From 8a0a1ce3d84315eef81f4a3e0f5bf963bcb1bf85 Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Wed, 25 Jul 2001 07:01:05 +0000 Subject: [PATCH] Use %var% instead of @var@ as placeholders for the static build dynamic module lists. This prevents acoutput-fast.pl from complaining about unknown variables. --- modules/staticmod/Makefile.in | 12 +- modules/staticmod/nsMetaModule_crypto.cpp.in | 6 +- modules/staticmod/nsMetaModule_mail.cpp.in | 6 +- modules/staticmod/nsStaticModule.cpp.in | 158 ------------------- xpfe/bootstrap/Makefile.in | 4 +- xpfe/bootstrap/nsStaticComponents.cpp.in | 4 +- 6 files changed, 16 insertions(+), 174 deletions(-) diff --git a/modules/staticmod/Makefile.in b/modules/staticmod/Makefile.in index 610a06dcbb8..484a98d0108 100644 --- a/modules/staticmod/Makefile.in +++ b/modules/staticmod/Makefile.in @@ -94,15 +94,15 @@ list: ifdef MOZ_STATIC_COMPONENTS nsStaticModule.cpp: nsStaticModule.cpp.in Makefile Makefile.in $(DEPTH)/config/autoconf.mk rm -f $@ - cat $< | sed -e "s|@COMPONENT_NS_GET_MODULE@|$(foreach m, $(MOZ_STATIC_COMPONENTS), REGISTER_MODULE_USING($(m)_NSGetModule);)|" | \ - sed -e "s|@COMPONENT_LIST@|$(foreach m, $(MOZ_STATIC_COMPONENTS), { $(m)_NSGM_comps, $(m)_NSGM_comp_count }, )|" | \ - sed -e "s|@DECLARE_COMPONENT_LIST@|$(foreach m,$(MOZ_STATIC_COMPONENTS), extern \"C\" nsresult $(m)_NSGetModule(nsIComponentManager *servMgr, nsIFile* aPath, nsIModule** return_cobj); extern nsModuleComponentInfo* $(m)_NSGM_comps; extern PRUint32 $(m)_NSGM_comp_count;)|" > $@ + cat $< | sed -e "s|%COMPONENT_NS_GET_MODULE%|$(foreach m, $(MOZ_STATIC_COMPONENTS), REGISTER_MODULE_USING($(m)_NSGetModule);)|" | \ + sed -e "s|%COMPONENT_LIST%|$(foreach m, $(MOZ_STATIC_COMPONENTS), { $(m)_NSGM_comps, $(m)_NSGM_comp_count }, )|" | \ + sed -e "s|%DECLARE_COMPONENT_LIST%|$(foreach m,$(MOZ_STATIC_COMPONENTS), extern \"C\" nsresult $(m)_NSGetModule(nsIComponentManager *servMgr, nsIFile* aPath, nsIModule** return_cobj); extern nsModuleComponentInfo* $(m)_NSGM_comps; extern PRUint32 $(m)_NSGM_comp_count;)|" > $@ endif nsMetaModule_%.cpp: nsMetaModule_%.cpp.in Makefile Makefile.in $(topsrcdir)/config/config.mk rm -f $@ cat $< | \ - sed -e "s|@COMPONENT_NS_GET_MODULE@|$(foreach m, $($(_META_COMPONENT_NAMES)), REGISTER_MODULE_USING($(m)_NSGetModule);)|" | \ - sed -e "s|@COMPONENT_LIST@|$(foreach m, $($(_META_COMPONENT_NAMES)), { $(m)_NSGM_comps, $(m)_NSGM_comp_count }, )|" | \ - sed -e "s|@DECLARE_COMPONENT_LIST@|$(foreach m,$($(_META_COMPONENT_NAMES)), extern \"C\" nsresult $(m)_NSGetModule(nsIComponentManager *servMgr, nsIFile* aPath, nsIModule** return_cobj); extern nsModuleComponentInfo* $(m)_NSGM_comps; extern PRUint32 $(m)_NSGM_comp_count;)|" > $@ + sed -e "s|%COMPONENT_NS_GET_MODULE%|$(foreach m, $($(_META_COMPONENT_NAMES)), REGISTER_MODULE_USING($(m)_NSGetModule);)|" | \ + sed -e "s|%COMPONENT_LIST%|$(foreach m, $($(_META_COMPONENT_NAMES)), { $(m)_NSGM_comps, $(m)_NSGM_comp_count }, )|" | \ + sed -e "s|%DECLARE_COMPONENT_LIST%|$(foreach m,$($(_META_COMPONENT_NAMES)), extern \"C\" nsresult $(m)_NSGetModule(nsIComponentManager *servMgr, nsIFile* aPath, nsIModule** return_cobj); extern nsModuleComponentInfo* $(m)_NSGM_comps; extern PRUint32 $(m)_NSGM_comp_count;)|" > $@ diff --git a/modules/staticmod/nsMetaModule_crypto.cpp.in b/modules/staticmod/nsMetaModule_crypto.cpp.in index 61c6e1d13c4..9fe52ce32da 100644 --- a/modules/staticmod/nsMetaModule_crypto.cpp.in +++ b/modules/staticmod/nsMetaModule_crypto.cpp.in @@ -53,7 +53,7 @@ struct nsModuleComponentInfoContainer { PRUint32 count; }; -@DECLARE_COMPONENT_LIST@ +%DECLARE_COMPONENT_LIST% static nsresult NS_RegisterMetaModules(nsIComponentManager *aCompMgr, @@ -63,7 +63,7 @@ NS_RegisterMetaModules(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; - @COMPONENT_NS_GET_MODULE@ + %COMPONENT_NS_GET_MODULE% {}; @@ -129,7 +129,7 @@ static nsModuleComponentInfo components[] = static nsModuleComponentInfoContainer componentsList[] = { { components, sizeof(components)/sizeof(components[0]) }, - @COMPONENT_LIST@ + %COMPONENT_LIST% { nsnull, 0 } }; diff --git a/modules/staticmod/nsMetaModule_mail.cpp.in b/modules/staticmod/nsMetaModule_mail.cpp.in index 2ef3eb2fbe9..f81a784c775 100644 --- a/modules/staticmod/nsMetaModule_mail.cpp.in +++ b/modules/staticmod/nsMetaModule_mail.cpp.in @@ -53,7 +53,7 @@ struct nsModuleComponentInfoContainer { PRUint32 count; }; -@DECLARE_COMPONENT_LIST@ +%DECLARE_COMPONENT_LIST% static nsresult NS_RegisterMetaModules(nsIComponentManager *aCompMgr, @@ -63,7 +63,7 @@ NS_RegisterMetaModules(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; - @COMPONENT_NS_GET_MODULE@ + %COMPONENT_NS_GET_MODULE% {}; @@ -128,7 +128,7 @@ static nsModuleComponentInfo components[] = static nsModuleComponentInfoContainer componentsList[] = { { components, sizeof(components)/sizeof(components[0]) }, - @COMPONENT_LIST@ + %COMPONENT_LIST% { nsnull, 0 } }; diff --git a/modules/staticmod/nsStaticModule.cpp.in b/modules/staticmod/nsStaticModule.cpp.in index e7ea1099b30..e69de29bb2d 100644 --- a/modules/staticmod/nsStaticModule.cpp.in +++ b/modules/staticmod/nsStaticModule.cpp.in @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * Christopher Seawood - * Doug Turner - */ - -#include "nsError.h" -#include "nsIModule.h" -#include "nsIFile.h" -#include "nsIGenericFactory.h" -#include "prmem.h" - -#define REGISTER_MODULE_USING(mod) { \ - nsCOMPtr module; \ - mod##(compMgr, aPath, getter_AddRefs(module)); \ - module->RegisterSelf(compMgr, aPath, "", ""); \ -} - -struct nsModuleComponentInfoContainer { - nsModuleComponentInfo *list; - PRUint32 count; -}; - -@DECLARE_COMPONENT_LIST@ - -static nsresult -NS_RegisterStaticModules(nsIFile *aPath) -{ - nsresult rv = PR_TRUE; - nsIComponentManager *compMgr = nsnull; - - rv = NS_GetGlobalComponentManager(&compMgr); - - NS_ASSERTION(NS_SUCCEEDED(rv), "Static mods cannot get global component manager."); - - @COMPONENT_NS_GET_MODULE@ - - {}; - - return rv; -} - -void StaticModuleDestructor(nsIModule *self, nsModuleComponentInfo *components) -{ - PR_Free(components); -} - - -#define NS_STATICMODULE_CID \ -{ 0x1926250e, 0xef22, 0x4c8d, { 0x94, 0x37, 0x86, 0xa8, 0x07, 0xeb, 0xe4, 0xca } } - -#define NS_STATICMODULE_CONTRACTID "@mozilla.org/staticmodule;1" - - - -class nsStaticModuleImpl : public nsISupports -{ -public: - nsStaticModuleImpl(); - virtual ~nsStaticModuleImpl(); - NS_DECL_ISUPPORTS -}; - -nsStaticModuleImpl::nsStaticModuleImpl() -{ - NS_INIT_REFCNT(); -} - -nsStaticModuleImpl::~nsStaticModuleImpl() -{ -} - -NS_IMPL_ISUPPORTS1(nsStaticModuleImpl, nsISupports); - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsStaticModuleImpl) - -static NS_METHOD nsStaticModuleRegistrationProc(nsIComponentManager *aCompMgr, - nsIFile *aPath, - const char *registryLocation, - const char *componentType, - const nsModuleComponentInfo *info) -{ - NS_RegisterStaticModules(aPath); - return NS_OK; -} - -static NS_METHOD nsStaticModuleUnregistrationProc(nsIComponentManager *aCompMgr, - nsIFile *aPath, - const char *registryLocation, - const nsModuleComponentInfo *info) -{ - return NS_OK; -} - - -static nsModuleComponentInfo components[] = -{ - { "Static Component", - NS_STATICMODULE_CID, - NS_STATICMODULE_CONTRACTID, - nsStaticModuleImplConstructor, - nsStaticModuleRegistrationProc, - nsStaticModuleUnregistrationProc - }, -}; - -static nsModuleComponentInfoContainer componentsList[] = { - { components, sizeof(components)/sizeof(components[0]) }, - @COMPONENT_LIST@ - { nsnull, 0 } -}; - -extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr, - nsIFile* location, - nsIModule** result) -{ - nsModuleComponentInfo *outList = nsnull; - nsModuleComponentInfoContainer *inList = componentsList; - PRUint32 count = 0, i = 0, k=0, msize = sizeof(nsModuleComponentInfo); - - while (inList[i].list != nsnull) { - count += inList[i].count; - i++; - } - - outList = (nsModuleComponentInfo *) PR_Calloc(count, sizeof(nsModuleComponentInfo)); - - i = 0; k =0; - while (inList[i].list != nsnull) { - memcpy(&outList[k], inList[i].list, msize * inList[i].count); - k+= inList[i].count; - i++; - } - return NS_NewGenericModule("nsStaticModule", count, outList, nsnull, result); -} - - - - - diff --git a/xpfe/bootstrap/Makefile.in b/xpfe/bootstrap/Makefile.in index 6d2b502cfeb..3fa2a4f0a8c 100644 --- a/xpfe/bootstrap/Makefile.in +++ b/xpfe/bootstrap/Makefile.in @@ -264,7 +264,7 @@ endif nsStaticComponents.cpp: nsStaticComponents.cpp.in Makefile Makefile.in $(FINAL_LINK_COMP_NAMES) rm -f $@ cat $< | \ - sed -e "s|@DECLARE_COMPONENTS@|$(foreach m,$(_COMPONENT_LIST),DECL_MODULE($(m));)|" | \ - sed -e "s|@COMPONENT_LIST@|$(foreach m, $(_COMPONENT_LIST),MODULE($(m)),)|" \ + sed -e "s|%DECLARE_COMPONENTS%|$(foreach m,$(_COMPONENT_LIST),DECL_MODULE($(m));)|" | \ + sed -e "s|%COMPONENT_LIST%|$(foreach m, $(_COMPONENT_LIST),MODULE($(m)),)|" \ > $@ diff --git a/xpfe/bootstrap/nsStaticComponents.cpp.in b/xpfe/bootstrap/nsStaticComponents.cpp.in index d0c9c146a07..2b042c78b7a 100644 --- a/xpfe/bootstrap/nsStaticComponents.cpp.in +++ b/xpfe/bootstrap/nsStaticComponents.cpp.in @@ -35,10 +35,10 @@ NSGETMODULE_ENTRY_POINT(name) (nsIComponentManager *aCompMgr, \ nsIFile *aLocation, \ nsIModule **aResult) -@DECLARE_COMPONENTS@ +%DECLARE_COMPONENTS% static nsStaticModuleInfo StaticModuleInfo[] = { - @COMPONENT_LIST@ + %COMPONENT_LIST% }; nsresult PR_CALLBACK