michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIAtom.h" michael@0: #include "nsString.h" michael@0: #include "nspr.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "mozilla/ModuleUtils.h" michael@0: #include "nsParserCIID.h" michael@0: #include "nsParser.h" michael@0: #include "CNavDTD.h" michael@0: #include "nsHTMLEntities.h" michael@0: #include "nsHTMLTokenizer.h" michael@0: //#include "nsTextTokenizer.h" michael@0: #include "nsElementTable.h" michael@0: #include "nsParserService.h" michael@0: #include "nsSAXAttributes.h" michael@0: #include "nsSAXLocator.h" michael@0: #include "nsSAXXMLReader.h" michael@0: michael@0: #if defined(DEBUG) michael@0: #include "nsExpatDriver.h" michael@0: #endif michael@0: michael@0: //---------------------------------------------------------------------- michael@0: michael@0: #if defined(DEBUG) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver) michael@0: #endif michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService) michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXXMLReader) michael@0: michael@0: #if defined(DEBUG) michael@0: NS_DEFINE_NAMED_CID(NS_EXPAT_DRIVER_CID); michael@0: #endif michael@0: NS_DEFINE_NAMED_CID(NS_PARSER_CID); michael@0: NS_DEFINE_NAMED_CID(NS_CNAVDTD_CID); michael@0: NS_DEFINE_NAMED_CID(NS_PARSERSERVICE_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SAXATTRIBUTES_CID); michael@0: NS_DEFINE_NAMED_CID(NS_SAXXMLREADER_CID); michael@0: michael@0: static const mozilla::Module::CIDEntry kParserCIDs[] = { michael@0: #if defined(DEBUG) michael@0: { &kNS_EXPAT_DRIVER_CID, false, nullptr, nsExpatDriverConstructor }, michael@0: #endif michael@0: { &kNS_PARSER_CID, false, nullptr, nsParserConstructor }, michael@0: { &kNS_CNAVDTD_CID, false, nullptr, CNavDTDConstructor }, michael@0: { &kNS_PARSERSERVICE_CID, false, nullptr, nsParserServiceConstructor }, michael@0: { &kNS_SAXATTRIBUTES_CID, false, nullptr, nsSAXAttributesConstructor }, michael@0: { &kNS_SAXXMLREADER_CID, false, nullptr, nsSAXXMLReaderConstructor }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kParserContracts[] = { michael@0: { NS_PARSERSERVICE_CONTRACTID, &kNS_PARSERSERVICE_CID }, michael@0: { NS_SAXATTRIBUTES_CONTRACTID, &kNS_SAXATTRIBUTES_CID }, michael@0: { NS_SAXXMLREADER_CONTRACTID, &kNS_SAXXMLREADER_CID }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static nsresult michael@0: Initialize() michael@0: { michael@0: nsresult rv = nsHTMLTags::AddRefTable(); michael@0: NS_ENSURE_SUCCESS(rv, rv); michael@0: michael@0: rv = nsHTMLEntities::AddRefTable(); michael@0: if (NS_FAILED(rv)) { michael@0: nsHTMLTags::ReleaseTable(); michael@0: return rv; michael@0: } michael@0: #ifdef DEBUG michael@0: CheckElementTable(); michael@0: #endif michael@0: michael@0: #ifdef DEBUG michael@0: nsHTMLTags::TestTagTable(); michael@0: #endif michael@0: michael@0: return rv; michael@0: } michael@0: michael@0: static void michael@0: Shutdown() michael@0: { michael@0: nsHTMLTags::ReleaseTable(); michael@0: nsHTMLEntities::ReleaseTable(); michael@0: } michael@0: michael@0: static mozilla::Module kParserModule = { michael@0: mozilla::Module::kVersion, michael@0: kParserCIDs, michael@0: kParserContracts, michael@0: nullptr, michael@0: nullptr, michael@0: Initialize, michael@0: Shutdown michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsParserModule) = &kParserModule;