From 1b048e4a156ab81ea4bf5e0607cfb217f392cacd Mon Sep 17 00:00:00 2001 From: "idk%eng.sun.com" Date: Thu, 13 Jul 2000 03:36:02 +0000 Subject: [PATCH] ** NOT PART OF TBOX BUILDS** Upgraded blackConnect for M16. Added make files for win git-svn-id: svn://10.0.0.236/trunk@74148 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/java/xpcom/connect/makefile.win | 33 ++ mozilla/java/xpcom/connect/public/bcDefs.h | 3 +- mozilla/java/xpcom/connect/src/Call.h | 5 + mozilla/java/xpcom/connect/src/Marshaler.cpp | 5 +- .../java/xpcom/connect/src/UnMarshaler.cpp | 2 +- mozilla/java/xpcom/connect/src/makefile.win | 62 ++++ mozilla/java/xpcom/connect/xpcom/Makefile.in | 28 +- mozilla/java/xpcom/connect/xpcom/bcORB.cpp | 1 + mozilla/java/xpcom/connect/xpcom/bcORB.h | 1 + mozilla/java/xpcom/connect/xpcom/makefile.win | 47 +++ mozilla/java/xpcom/java/classes/makefile.win | 39 +++ .../java/loader/bcJavaComponentLoader.cpp | 282 ++++-------------- mozilla/java/xpcom/java/loader/makefile.win | 46 +++ mozilla/java/xpcom/java/src/bcJavaGlobal.cpp | 6 + mozilla/java/xpcom/java/src/bcJavaGlobal.h | 1 + .../xpcom/java/src/bcJavaMarshalToolkit.cpp | 4 +- .../xpcom/java/src/bcJavaMarshalToolkit.h | 5 +- mozilla/java/xpcom/java/src/bcJavaStub.cpp | 6 +- .../xpcom/java/src/bcJavaStubsAndProxies.cpp | 3 +- mozilla/java/xpcom/java/src/makefile.win | 52 ++++ mozilla/java/xpcom/java/test/Makefile.in | 9 +- mozilla/java/xpcom/java/test/makefile.win | 63 ++++ .../xpcom/xpcom/bcXPCOMMarshalToolkit.cpp | 10 +- mozilla/java/xpcom/xpcom/bcXPCOMProxy.cpp | 5 - mozilla/java/xpcom/xpcom/bcXPCOMStub.cpp | 4 +- mozilla/java/xpcom/xpcom/makefile.win | 52 ++++ 26 files changed, 504 insertions(+), 270 deletions(-) create mode 100644 mozilla/java/xpcom/connect/makefile.win create mode 100644 mozilla/java/xpcom/connect/src/makefile.win create mode 100644 mozilla/java/xpcom/connect/xpcom/makefile.win create mode 100644 mozilla/java/xpcom/java/classes/makefile.win create mode 100644 mozilla/java/xpcom/java/loader/makefile.win create mode 100644 mozilla/java/xpcom/java/src/makefile.win create mode 100644 mozilla/java/xpcom/java/test/makefile.win create mode 100644 mozilla/java/xpcom/xpcom/makefile.win diff --git a/mozilla/java/xpcom/connect/makefile.win b/mozilla/java/xpcom/connect/makefile.win new file mode 100644 index 00000000000..dc9ee67c17d --- /dev/null +++ b/mozilla/java/xpcom/connect/makefile.win @@ -0,0 +1,33 @@ +#!nmake +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): +# Igor Kushnirskiy +# + +DEPTH = ../../.. + +DIRS= \ + src \ + xpcom \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> + + diff --git a/mozilla/java/xpcom/connect/public/bcDefs.h b/mozilla/java/xpcom/connect/public/bcDefs.h index 67f4438b84d..da96cc9166f 100644 --- a/mozilla/java/xpcom/connect/public/bcDefs.h +++ b/mozilla/java/xpcom/connect/public/bcDefs.h @@ -32,7 +32,8 @@ enum bcXPType { bc_T_IID , bc_T_CHAR_STR, bc_T_WCHAR_STR, bc_T_ARRAY, - bc_T_INTERFACE + bc_T_INTERFACE, + bc_T_UNDEFINED }; typedef long bcOID; diff --git a/mozilla/java/xpcom/connect/src/Call.h b/mozilla/java/xpcom/connect/src/Call.h index 1302d89c94d..1ec88b80cd9 100644 --- a/mozilla/java/xpcom/connect/src/Call.h +++ b/mozilla/java/xpcom/connect/src/Call.h @@ -22,7 +22,12 @@ #ifndef __Call_h #define __Call_h + +#ifdef WIN32 +#include +#else #include +#endif #include "bcICall.h" class Call : public bcICall { diff --git a/mozilla/java/xpcom/connect/src/Marshaler.cpp b/mozilla/java/xpcom/connect/src/Marshaler.cpp index 578a16d7522..e9683bba526 100644 --- a/mozilla/java/xpcom/connect/src/Marshaler.cpp +++ b/mozilla/java/xpcom/connect/src/Marshaler.cpp @@ -21,7 +21,8 @@ */ #include -#include + +#include #include "Marshaler.h" #include "util.h" @@ -56,7 +57,7 @@ int Marshaler::WriteArray(void *ptr, size_t length, bcXPType type) { case bc_T_CHAR_STR: case bc_T_WCHAR_STR: { - for (int i = 0; i < length; i++) { + for (unsigned int i = 0; i < length; i++) { char *str = ((char**)ptr)[i]; size_t size = (!str) ? 0 : strlen(str)+1; //we want to store \0 WriteString((void *)str, size); diff --git a/mozilla/java/xpcom/connect/src/UnMarshaler.cpp b/mozilla/java/xpcom/connect/src/UnMarshaler.cpp index b83d7ba66e3..a3cc122f2be 100644 --- a/mozilla/java/xpcom/connect/src/UnMarshaler.cpp +++ b/mozilla/java/xpcom/connect/src/UnMarshaler.cpp @@ -60,7 +60,7 @@ int UnMarshaler::ReadArray(void *ptr, size_t *length, bcXPType type, bcIAllocato char **strArray = *(char***)ptr; *strArray = (char*)allocator->Alloc(*length * sizeof(char*)); - for (int i = 0; i < *length; i++) { + for (unsigned int i = 0; i < *length; i++) { char * str; size_t size; ReadString((void*)&str, &size, allocator); diff --git a/mozilla/java/xpcom/connect/src/makefile.win b/mozilla/java/xpcom/connect/src/makefile.win new file mode 100644 index 00000000000..7e3931cafc3 --- /dev/null +++ b/mozilla/java/xpcom/connect/src/makefile.win @@ -0,0 +1,62 @@ +#!nmake +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): +# Igor Kushnirskiy +# + +DEPTH=..\..\..\.. + +MAKE_OBJ_TYPE = lib +LIBRARY_NAME = bcorbcore +LIB=.\$(OBJDIR)\bcorbcore.lib + +OBJS= \ + .\$(OBJDIR)\Allocator.obj \ + .\$(OBJDIR)\Call.obj \ + .\$(OBJDIR)\Marshaler.obj \ + .\$(OBJDIR)\ORB.obj \ + .\$(OBJDIR)\UnMarshaler.obj \ + .\$(OBJDIR)\util.obj \ + $(NULL) + +EXPORTS = \ + ..\public\bcIORB.h \ + ..\public\bcDefs.h \ + ..\public\bcICall.h \ + ..\public\bcIUnMarshaler.h \ + ..\public\bcIAllocator.h \ + ..\public\bcIMarshaler.h \ + ..\public\bcIStub.h \ + ..\public\bcIThread.h + +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib + +INCS = \ + -I..\public -I..\src \ + $(INCS) \ + $(NULL) + + +include <$(DEPTH)\config\rules.mak> + +install:: $(LIB) + $(MAKE_INSTALL) $(LIB) $(DIST)\lib +clobber:: + rm -f $(DIST)\lib\$(LIBRARY_NAME).lib \ No newline at end of file diff --git a/mozilla/java/xpcom/connect/xpcom/Makefile.in b/mozilla/java/xpcom/connect/xpcom/Makefile.in index 3de7ff09775..348fcfc0fe5 100644 --- a/mozilla/java/xpcom/connect/xpcom/Makefile.in +++ b/mozilla/java/xpcom/connect/xpcom/Makefile.in @@ -34,14 +34,14 @@ LIBRARY_NAME = bcorb MODULE = bcorb IS_COMPONENT = 1 -CPPSRCS = \ - bcORB.cpp \ - ../src/Allocator.cpp \ - ../src/Call.cpp \ - ../src/Marshaler.cpp \ - ../src/ORB.cpp \ - ../src/UnMarshaler.cpp \ - ../src/util.cpp \ +OBJS = \ + .\$(OBJDIR)\bcORB.cpp \ + ..\$(OBJDIR)\src\Allocator.cpp \ + ..\$(OBJDIR)\src\Call.cpp \ + ..\$(OBJDIR)\src\Marshaler.cpp \ + ..\$(OBJDIR)\src\ORB.cpp \ + ..\$(OBJDIR)\src\UnMarshaler.cpp \ + ..\$(OBJDIR)\src\util.cpp \ $(NULL) EXPORTS = \ @@ -58,18 +58,6 @@ EXPORTS = \ CXXFLAGS += -I../public -I../src -DSO_LDOPTS += \ - -L$(JDKHOME)/jre/lib/$(HOSTTYPE)/ \ - -L$(JDKHOME)/jre/lib/$(HOSTTYPE)/classic \ - -ljava -ljvm \ - $(NULL) - -ifneq ($(OS_ARCH), Linux) -DSO_LDOPTS += \ - -lthread -lXm -lX11 -lXt -lm -endif - - include $(topsrcdir)/config/rules.mk diff --git a/mozilla/java/xpcom/connect/xpcom/bcORB.cpp b/mozilla/java/xpcom/connect/xpcom/bcORB.cpp index a8f3a76f26a..14e4d6c0269 100644 --- a/mozilla/java/xpcom/connect/xpcom/bcORB.cpp +++ b/mozilla/java/xpcom/connect/xpcom/bcORB.cpp @@ -63,6 +63,7 @@ NS_IMETHODIMP bcORB::GetORB(bcIORB **_orb) { orb = new ORB(); } *_orb = orb; + return NS_OK; } diff --git a/mozilla/java/xpcom/connect/xpcom/bcORB.h b/mozilla/java/xpcom/connect/xpcom/bcORB.h index 25c5fc55451..1444d86c6a5 100644 --- a/mozilla/java/xpcom/connect/xpcom/bcORB.h +++ b/mozilla/java/xpcom/connect/xpcom/bcORB.h @@ -19,6 +19,7 @@ * Contributor(s): * Igor Kushnirskiy */ + #ifndef _bcORB_h #define _bcORB_h #include "nsISupports.h" diff --git a/mozilla/java/xpcom/connect/xpcom/makefile.win b/mozilla/java/xpcom/connect/xpcom/makefile.win new file mode 100644 index 00000000000..45a7e7c02aa --- /dev/null +++ b/mozilla/java/xpcom/connect/xpcom/makefile.win @@ -0,0 +1,47 @@ +#!nmake +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): +# Igor Kushnirskiy +# + +DEPTH=..\..\..\.. + +MAKE_OBJ_TYPE = DLL +MODULE=bcorb +COMPONENT = 1 +DLLNAME = bcorb +DLL=.\$(OBJDIR)\$(DLLNAME).dll + +OBJS= \ + .\$(OBJDIR)\bcORB.obj \ + $(NULL) + +EXPORTS = \ + bcORB.h \ + $(NULL) + +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib $(DIST)\lib\bcorbcore.lib + +include <$(DEPTH)\config\rules.mak> + +install:: $(DLL) + $(MAKE_INSTALL) $(DLL) $(DIST)\bin\components +clobber:: + rm -f $(DIST)\bin\components\$(DLLNAME).dll \ No newline at end of file diff --git a/mozilla/java/xpcom/java/classes/makefile.win b/mozilla/java/xpcom/java/classes/makefile.win new file mode 100644 index 00000000000..f409fb67e04 --- /dev/null +++ b/mozilla/java/xpcom/java/classes/makefile.win @@ -0,0 +1,39 @@ +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): +# Igor Kushnirskiy +# + +IGNORE_MANIFEST=1 +DEPTH = ..\..\..\.. + +JAVA_OR_NSJVM=1 +NO_CAFE=1 + +include <$(DEPTH)\config\config.mak> + +JAR_PLUGLET_CLASSES = \ + org\mozilla\xpcom \ + $(NULL) + +JDIRS = $(JAR_PLUGLET_CLASSES) +JAVAC_PROG=$(JDKHOME)\bin\javac +JAVAC_FLAGS=-classpath "$(CLASSPATH);$(JAVA_DESTPATH)" -d "$(JAVA_DESTPATH)" + +include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/java/xpcom/java/loader/bcJavaComponentLoader.cpp b/mozilla/java/xpcom/java/loader/bcJavaComponentLoader.cpp index 1229289ecf2..be200425f67 100644 --- a/mozilla/java/xpcom/java/loader/bcJavaComponentLoader.cpp +++ b/mozilla/java/xpcom/java/loader/bcJavaComponentLoader.cpp @@ -23,6 +23,7 @@ /* A bunch of stuff was copied from mozJSComponentLoader.cpp */ +#include "nsICategoryManager.h" #include "bcJavaComponentLoader.h" #include "nsCOMPtr.h" #include "nsIModule.h" @@ -32,17 +33,19 @@ #include "bcJavaModule.h" -/*********************************************************************************/ - -//#include "bcIJavaSample.h" -#include "unistd.h" -#include "signal.h" - - -/********************************************************************************/ const char javaComponentTypeName[] = JAVACOMPONENTTYPENAME; -extern const char xpcomKeyName[]; + +/* XXX export properly from libxpcom, for now this will let Mac build */ +#ifdef RHAPSODY +extern const char fileSizeValueName[]; // = "FileSize"; +extern const char lastModValueName[]; // = "LastModTimeStamp"; +extern const char xpcomKeyName[]; // = "Software/Mozilla/XPCOM"; +#else +const char fileSizeValueName[] = "FileSize"; +const char lastModValueName[] = "LastModTimeStamp"; +const char xpcomKeyName[] = "software/mozilla/XPCOM/components"; +#endif NS_IMPL_ISUPPORTS(bcJavaComponentLoader,NS_GET_IID(nsIComponentLoader)); @@ -50,7 +53,6 @@ bcJavaComponentLoader::bcJavaComponentLoader() : mCompMgr(NULL), mXPCOMKey(0) - { NS_INIT_REFCNT(); printf("--bcJavaComponentLoader::bcJavaComponentLoader \n"); @@ -126,12 +128,18 @@ NS_IMETHODIMP bcJavaComponentLoader::OnRegister(const nsIID & aCID, const char * /** * AutoRegister components in the given directory. */ -/* void autoRegisterComponents (in long aWhen, in nsIFile aDirectory); */ NS_IMETHODIMP bcJavaComponentLoader::AutoRegisterComponents(PRInt32 aWhen, nsIFile *aDirectory) { - //printf("--bcJavaComponentLoader::AutoRegisterComponents \n"); + printf("--bcJavaComponentLoader::AutoRegisterComponents \n"); return RegisterComponentsInDir(aWhen,aDirectory); } +NS_IMETHODIMP bcJavaComponentLoader::AutoUnregisterComponent(PRInt32 when, + nsIFile *component, + PRBool *unregistered) { + //nb need to impelement + return NS_OK; +} + nsresult bcJavaComponentLoader::RegisterComponentsInDir(PRInt32 when, nsIFile *dir) { nsresult rv; @@ -403,230 +411,56 @@ NS_IMETHODIMP bcJavaComponentLoader::UnloadAll(PRInt32 aWhen) { //nb -NS_GENERIC_FACTORY_CONSTRUCTOR(bcJavaComponentLoader) - -static nsModuleComponentInfo components[] = +//--------------------------------------------------------------------------------------------------- + +/* XXX this should all be data-driven, via NS_IMPL_GETMODULE_WITH_CATEGORIES */ +static NS_METHOD +RegisterJavaLoader(nsIComponentManager *aCompMgr, nsIFile *aPath, + const char *registryLocation, const char *componentType) { - { - "Java Component Loader", - BC_JAVACOMPONENTLOADER_CID, - BC_JAVACOMPONENTLOADER_PROGID, - bcJavaComponentLoaderConstructor - } -}; + printf("--JavaLoader got registered\n"); + nsresult rv; + nsCOMPtr catman = + do_GetService(NS_CATEGORYMANAGER_PROGID, &rv); + if (NS_FAILED(rv)) return rv; + nsXPIDLCString previous; + return catman->AddCategoryEntry("component-loader", javaComponentTypeName, + BC_JAVACOMPONENTLOADER_PROGID, + PR_TRUE, PR_TRUE, getter_Copies(previous)); - -/* copied-and-pasted from mozJSComponentLoader */ -#include "nsHashtable.h" -class bcJavaComponentLoaderModule : public nsIModule -{ -public: - bcJavaComponentLoaderModule(const char *moduleName, PRUint32 componentCount, - nsModuleComponentInfo *components); - virtual ~bcJavaComponentLoaderModule(); - NS_DECL_ISUPPORTS - NS_DECL_NSIMODULE - -protected: - nsresult Initialize(); - - void Shutdown(); - - PRBool mInitialized; - const char* mModuleName; - PRUint32 mComponentCount; - nsModuleComponentInfo* mComponents; - nsSupportsHashtable mFactories; -}; - -bcJavaComponentLoaderModule::bcJavaComponentLoaderModule(const char* moduleName, PRUint32 componentCount, - nsModuleComponentInfo* aComponents) - : mInitialized(PR_FALSE), - mModuleName(moduleName), - mComponentCount(componentCount), - mComponents(aComponents), - mFactories(8, PR_FALSE) -{ - NS_INIT_ISUPPORTS(); } -bcJavaComponentLoaderModule::~bcJavaComponentLoaderModule() -{ - Shutdown(); -} - -NS_IMPL_ISUPPORTS1(bcJavaComponentLoaderModule, nsIModule) - -// Perform our one-time intialization for this module -nsresult -bcJavaComponentLoaderModule::Initialize() -{ - if (mInitialized) { - return NS_OK; - } - mInitialized = PR_TRUE; - return NS_OK; -} - -// Shutdown this module, releasing all of the module resources -void -bcJavaComponentLoaderModule::Shutdown() -{ - // Release the factory objects - mFactories.Reset(); -} - -// Create a factory object for creating instances of aClass. -NS_IMETHODIMP -bcJavaComponentLoaderModule::GetClassObject(nsIComponentManager *aCompMgr, - const nsCID& aClass, - const nsIID& aIID, - void** r_classObj) +static NS_METHOD +UnregisterJavaLoader(nsIComponentManager *aCompMgr, nsIFile *aPath, + const char *registryLocation) { nsresult rv; + nsCOMPtr catman = + do_GetService(NS_CATEGORYMANAGER_PROGID, &rv); + if (NS_FAILED(rv)) return rv; + nsXPIDLCString javaLoader; + rv = catman->GetCategoryEntry("component-loader", javaComponentTypeName, + getter_Copies(javaLoader)); + if (NS_FAILED(rv)) return rv; - // Defensive programming: Initialize *r_classObj in case of error below - if (!r_classObj) { - return NS_ERROR_INVALID_POINTER; + // only unregister if we're the current JS component loader + if (!strcmp(javaLoader, BC_JAVACOMPONENTLOADER_PROGID)) { + return catman->DeleteCategoryEntry("component-loader", + javaComponentTypeName, PR_TRUE, + getter_Copies(javaLoader)); } - *r_classObj = NULL; - - // Do one-time-only initialization if necessary - if (!mInitialized) { - rv = Initialize(); - if (NS_FAILED(rv)) { - // Initialization failed! yikes! - return rv; - } - } - - // Choose the appropriate factory, based on the desired instance - // class type (aClass). - nsIDKey key(aClass); - nsCOMPtr fact = getter_AddRefs(NS_REINTERPRET_CAST(nsIGenericFactory *, mFactories.Get(&key))); - if (fact == nsnull) { - nsModuleComponentInfo* desc = mComponents; - for (PRUint32 i = 0; i < mComponentCount; i++) { - if (desc->mCID.Equals(aClass)) { - rv = NS_NewGenericFactory(getter_AddRefs(fact), desc->mConstructor); - if (NS_FAILED(rv)) return rv; - - (void)mFactories.Put(&key, fact); - goto found; - } - desc++; - } - // not found in descriptions -#ifdef DEBUG - char* cs = aClass.ToString(); - printf("+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs); - nsCRT::free(cs); -#endif - // XXX put in stop-gap so that we don't search for this one again - return NS_ERROR_FACTORY_NOT_REGISTERED; - } - found: - rv = fact->QueryInterface(aIID, r_classObj); - return rv; -} - -NS_IMETHODIMP -bcJavaComponentLoaderModule::RegisterSelf(nsIComponentManager *aCompMgr, - nsIFile* aPath, - const char* registryLocation, - const char* componentType) -{ - nsresult rv = NS_OK; - -#ifdef DEBUG - printf("*** Registering %s components (all right -- an almost-generic module!)\n", mModuleName); -#endif - - nsModuleComponentInfo* cp = mComponents; - for (PRUint32 i = 0; i < mComponentCount; i++) { - rv = aCompMgr->RegisterComponentSpec(cp->mCID, cp->mDescription, - cp->mProgID, aPath, PR_TRUE, - PR_TRUE); - if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: unable to register %s component => %x\n", - mModuleName, cp->mDescription, rv); -#endif - break; - } - cp++; - } - printf("JavaComponentLoaderModule::RegisterSelf \n"); - return aCompMgr->RegisterComponentLoader(javaComponentTypeName, - BC_JAVACOMPONENTLOADER_PROGID, - PR_TRUE); -} - -NS_IMETHODIMP -bcJavaComponentLoaderModule::UnregisterSelf(nsIComponentManager* aCompMgr, - nsIFile* aPath, - const char* registryLocation) -{ -#ifdef DEBUG - printf("*** Unregistering %s components (all right -- an almost-generic module!)\n", mModuleName); -#endif - nsModuleComponentInfo* cp = mComponents; - for (PRUint32 i = 0; i < mComponentCount; i++) { - nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath); - if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: unable to unregister %s component => %x\n", - mModuleName, cp->mDescription, rv); -#endif - } - cp++; - } - return NS_OK; } -NS_IMETHODIMP -bcJavaComponentLoaderModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload) -{ - printf("--bcJavaComponentLoaderModule::CanUnload\n"); - if (!okToUnload) { - return NS_ERROR_INVALID_POINTER; - } - *okToUnload = PR_TRUE; - return NS_OK; -} +NS_GENERIC_FACTORY_CONSTRUCTOR(bcJavaComponentLoader); +static nsModuleComponentInfo components[] = { + { "Java component loader", BC_JAVACOMPONENTLOADER_CID, + BC_JAVACOMPONENTLOADER_PROGID, + bcJavaComponentLoaderConstructor, + RegisterJavaLoader, UnregisterJavaLoader } +}; -NS_EXPORT nsresult -NS_NewJavaComponentLoaderModule(const char* moduleName, - PRUint32 componentCount, - nsModuleComponentInfo* aComponents, - nsIModule* *result) -{ - nsresult rv = NS_OK; +NS_IMPL_NSGETMODULE("Java component loader", components); - NS_ASSERTION(result, "Null argument"); - // Create and initialize the module instance - bcJavaComponentLoaderModule *m = new bcJavaComponentLoaderModule(moduleName, componentCount, aComponents); - if (!m) { - return NS_ERROR_OUT_OF_MEMORY; - } - - // Increase refcnt and store away nsIModule interface to m in return_cobj - rv = m->QueryInterface(NS_GET_IID(nsIModule), (void**)result); - if (NS_FAILED(rv)) { - delete m; - m = nsnull; - } - return rv; -} - -extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *compMgr, - nsIFile *location, - nsIModule** result) -{ - return NS_NewJavaComponentLoaderModule("bcJavaComponentLoaderModule", - sizeof(components) / sizeof(components[0]), - components, result); -} diff --git a/mozilla/java/xpcom/java/loader/makefile.win b/mozilla/java/xpcom/java/loader/makefile.win new file mode 100644 index 00000000000..1eabec2eb94 --- /dev/null +++ b/mozilla/java/xpcom/java/loader/makefile.win @@ -0,0 +1,46 @@ +#!nmake +# +# 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): +# Igor Kushnirskiy +# + +DEPTH=..\..\..\.. + +MAKE_OBJ_TYPE = DLL +MODULE=bcjavaloader +COMPONENT = 1 +DLLNAME = bcjavaloader + +DLL=.\$(OBJDIR)\$(DLLNAME).dll + +OBJS= \ + .\$(OBJDIR)\bcJavaComponentLoader.obj \ + .\$(OBJDIR)\bcJavaModule.obj \ + .\$(OBJDIR)\bcJavaComponentFactory.obj \ + $(NULL) + +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib + +include <$(DEPTH)\config\rules.mak> + +install:: $(DLL) + $(MAKE_INSTALL) $(DLL) $(DIST)\bin\components +clobber:: + rm -f $(DIST)\bin\components\$(DLLNAME).dll \ No newline at end of file diff --git a/mozilla/java/xpcom/java/src/bcJavaGlobal.cpp b/mozilla/java/xpcom/java/src/bcJavaGlobal.cpp index 53295670a6d..6edf5f8cf72 100644 --- a/mozilla/java/xpcom/java/src/bcJavaGlobal.cpp +++ b/mozilla/java/xpcom/java/src/bcJavaGlobal.cpp @@ -25,7 +25,12 @@ JavaVM *bcJavaGlobal::jvm = NULL; +#ifdef XP_PC +#define PATH_SEPARATOR ';' +#else #define PATH_SEPARATOR ':' +#endif + JNIEnv * bcJavaGlobal::GetJNIEnv(void) { JNIEnv * res; if (!jvm) { @@ -53,6 +58,7 @@ void bcJavaGlobal::StartJVM() { /* Append USER_CLASSPATH to the default system class path */ sprintf(classpath, "%s%c%s", vm_args.classpath, PATH_SEPARATOR, PR_GetEnv("CLASSPATH")); + printf("--[c++] classpath %s\n",classpath); char **props = new char*[2]; props[0]="java.compiler=NONE"; props[1]=0; diff --git a/mozilla/java/xpcom/java/src/bcJavaGlobal.h b/mozilla/java/xpcom/java/src/bcJavaGlobal.h index f233a2a0a59..9d661744db9 100644 --- a/mozilla/java/xpcom/java/src/bcJavaGlobal.h +++ b/mozilla/java/xpcom/java/src/bcJavaGlobal.h @@ -21,6 +21,7 @@ */ #ifndef __bcJavaGlobal_h_ #define __bcJavaGlobal_h_ +#include "nscore.h" #include "jni.h" class bcJavaGlobal { diff --git a/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.cpp b/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.cpp index 5ec295fcace..a0751c17a3a 100644 --- a/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.cpp +++ b/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.cpp @@ -116,7 +116,7 @@ nsresult bcJavaMarshalToolkit::UnMarshal(bcIUnMarshaler *um) { PRUint32 paramCount = info->GetParamCount(); jobject value; void * data = allocator->Alloc(sizeof(nsXPTCMiniVariant)); // sizeof(nsXPTCMiniVariant) is ok - for (int i = 0; i < paramCount; i++) { + for (unsigned int i = 0; i < paramCount; i++) { nsXPTParamInfo param = info->GetParam(i); PRBool isOut = param.IsOut(); nsXPTType type = param.GetType(); @@ -230,6 +230,8 @@ bcXPType bcJavaMarshalToolkit::XPTType2bcXPType(uint8 type) { return bc_T_INTERFACE; case nsXPTType::T_ARRAY: return bc_T_ARRAY; + default: + return bc_T_UNDEFINED; } } diff --git a/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.h b/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.h index 06f1c9de695..b90358ea14e 100644 --- a/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.h +++ b/mozilla/java/xpcom/java/src/bcJavaMarshalToolkit.h @@ -23,9 +23,10 @@ #ifndef _bcJavaMarshalToolkit_h #define _bcJavaMarshalToolkit_h -#include "jni.h" -#include "nsISupports.h" +#include "nscore.h" #include "xptcall.h" +#include "nsISupports.h" +#include "jni.h" #include "bcIMarshaler.h" #include "bcIUnMarshaler.h" #include "bcIORB.h" diff --git a/mozilla/java/xpcom/java/src/bcJavaStub.cpp b/mozilla/java/xpcom/java/src/bcJavaStub.cpp index 524e5697837..fb08e2db7c4 100644 --- a/mozilla/java/xpcom/java/src/bcJavaStub.cpp +++ b/mozilla/java/xpcom/java/src/bcJavaStub.cpp @@ -20,15 +20,15 @@ * Igor Kushnirskiy */ + +#include "nscore.h" +#include "xptcall.h" #include "bcJavaStub.h" #include "nsIInterfaceInfo.h" #include "nsIInterfaceInfoManager.h" -#include "xptcall.h" #include "bcJavaMarshalToolkit.h" #include "bcJavaGlobal.h" #include "bcIIDJava.h" -#include "unistd.h" -#include "signal.h" jclass bcJavaStub::objectClass = NULL; jclass bcJavaStub::utilitiesClass = NULL; diff --git a/mozilla/java/xpcom/java/src/bcJavaStubsAndProxies.cpp b/mozilla/java/xpcom/java/src/bcJavaStubsAndProxies.cpp index b45df5b53d8..b734576c697 100644 --- a/mozilla/java/xpcom/java/src/bcJavaStubsAndProxies.cpp +++ b/mozilla/java/xpcom/java/src/bcJavaStubsAndProxies.cpp @@ -87,7 +87,8 @@ NS_IMETHODIMP bcJavaStubsAndProxies::GetOID(char *location, bcOID *oid) { if (!componentLoader) { Init(); } - location[strlen(location)-5] = 0; //nb dirty hack. location is xyz.jar.info + //location[strlen(location)-5] = 0; //nb dirty hack. location is xyz.jar.info + strcpy(location + strlen(location)-4,"comp"); jstring jstr = env->NewStringUTF(location); jobject object = env->CallStaticObjectMethod(componentLoader, loadComponentID, jstr); bcIStub *stub = new bcJavaStub(object); diff --git a/mozilla/java/xpcom/java/src/makefile.win b/mozilla/java/xpcom/java/src/makefile.win new file mode 100644 index 00000000000..ed3fbdd4eec --- /dev/null +++ b/mozilla/java/xpcom/java/src/makefile.win @@ -0,0 +1,52 @@ +#!nmake +# +# 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): +# Igor Kushnirskiy +# + +DEPTH=..\..\..\.. + + +MAKE_OBJ_TYPE = DLL +MODULE=bcjavastubs +COMPONENT = 1 +DLLNAME = bcjavastubs +DLL=.\$(OBJDIR)\$(DLLNAME).dll + +EXPORTS = \ + bcJavaStubsAndProxies.h + +OBJS= \ + .\$(OBJDIR)\bcJavaMarshalToolkit.obj \ + .\$(OBJDIR)\bcJavaStub.obj \ + .\$(OBJDIR)\bcJavaGlobal.obj \ + .\$(OBJDIR)\bcJavaStubsAndProxies.obj \ + .\$(OBJDIR)\bcIIDJava.obj \ + .\$(OBJDIR)\org_mozilla_xpcom_Utilities.obj \ + $(NULL) + +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib $(JDKHOME)\lib\jvm.lib + +include <$(DEPTH)\config\rules.mak> + +install:: $(DLL) + $(MAKE_INSTALL) $(DLL) $(DIST)\bin\components +clobber:: + rm -f $(DIST)\bin\components\$(DLLNAME).dll diff --git a/mozilla/java/xpcom/java/test/Makefile.in b/mozilla/java/xpcom/java/test/Makefile.in index d4463a39ccf..6c4375aa08e 100644 --- a/mozilla/java/xpcom/java/test/Makefile.in +++ b/mozilla/java/xpcom/java/test/Makefile.in @@ -32,16 +32,17 @@ include $(DEPTH)/config/autoconf.mk MODULE = javaSample LIBRARY_NAME = javaSample IS_COMPONENT = 1 +XPIDL_MODULE = javaSample XPIDLSRCS = bcIJavaSample.idl CPPSRCS = bcJavaSample.cpp include $(topsrcdir)/config/rules.mk -bcJavaSample.jar: manifest bcIJavaSample.class bcJavaSample.class - $(JDKHOME)/bin/jar cvfm bcJavaSample.jar manifest *.class +bcJavaSample.jar.comp: manifest bcIJavaSample.class bcJavaSample.class + $(JDKHOME)/bin/jar cvfm bcJavaSample.jar.comp manifest *.class .java.class: $(JDKHOME)/bin/javac -classpath .:../classes $< -install-component: bcJavaSample.jar bcJavaSample.jar.info - cp bcJavaSample.jar bcJavaSample.jar.info $(DEPTH)/dist/bin/components/ +install-component: bcJavaSample.jar.comp bcJavaSample.jar.info + cp bcJavaSample.jar.comp bcJavaSample.jar.info $(DEPTH)/dist/bin/components/ clobber-java: rm -f *.class *.jar diff --git a/mozilla/java/xpcom/java/test/makefile.win b/mozilla/java/xpcom/java/test/makefile.win new file mode 100644 index 00000000000..1caecfc5d6c --- /dev/null +++ b/mozilla/java/xpcom/java/test/makefile.win @@ -0,0 +1,63 @@ +#!gmake +# +# 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): +# Igor Kushnirskiy +# + + +DEPTH = ..\..\..\.. +topsrcdir = ..\..\..\.. +srcdir = . +VPATH = . + +MAKE_OBJ_TYPE=DLL +MODULE=javaSample +COMPONENT=1 +DLLNAME=$(MODULE) +DLL=.\$(OBJDIR)\$(DLLNAME).dll + +XPIDLSRCS = \ + .\bcIJavaSample.idl \ + $(NULL) + +OBJS = bcJavaSample.obj +LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib + +include <$(DEPTH)\config\rules.mak> + +bcJavaSample.jar.comp: manifest bcIJavaSample.class bcJavaSample.class + $(JDKHOME)\bin\jar cvfm bcJavaSample.jar.comp manifest *.class + +.SUFFIXES: .java .class + +.java.class: + $(JDKHOME)\bin\javac -classpath .;..\classes $< + +install-component: bcJavaSample.jar.comp bcJavaSample.jar.info $(DLL) + copy bcJavaSample.jar* $(DIST)\bin\components + copy $(DLL) $(DIST)\bin\components + +clobber-java: + -del *.class *.jar.comp +clobber:: clobber-java + rm $(DIST)\bin\components\$(DLLNAME).dll + rm $(DIST)\bin\components\bcJavaSample.jar.* +clobber_all:: clobber-java +install:: install-component \ No newline at end of file diff --git a/mozilla/java/xpcom/xpcom/bcXPCOMMarshalToolkit.cpp b/mozilla/java/xpcom/xpcom/bcXPCOMMarshalToolkit.cpp index f590877d9c3..d7575a65d66 100644 --- a/mozilla/java/xpcom/xpcom/bcXPCOMMarshalToolkit.cpp +++ b/mozilla/java/xpcom/xpcom/bcXPCOMMarshalToolkit.cpp @@ -41,7 +41,7 @@ bcXPCOMMarshalToolkit::bcXPCOMMarshalToolkit(PRUint16 _methodIndex, nsIInterface if (params == nsnull) { return; } - for (int i = 0; i < paramCount; i++) { + for (unsigned int i = 0; i < paramCount; i++) { (params)[i].Init(_params[i], info->GetParam(i).GetType()); if (info->GetParam(i).IsOut()) { params[i].flags |= nsXPTCVariant::PTR_IS_DATA; @@ -66,7 +66,7 @@ bcXPCOMMarshalToolkit::~bcXPCOMMarshalToolkit() { nsresult bcXPCOMMarshalToolkit::Marshal(bcIMarshaler *m) { PRUint32 paramCount = info->GetParamCount(); - for (int i = 0; i < paramCount; i++) { + for (unsigned int i = 0; i < paramCount; i++) { nsXPTParamInfo param = info->GetParam(i); nsXPTType type = param.GetType(); PRBool isOut = param.IsOut(); @@ -172,7 +172,7 @@ nsresult bcXPCOMMarshalToolkit::Marshal(bcIMarshaler *m) { return NS_ERROR_FAILURE; } } - + return NS_ERROR_FAILURE; } class xpAllocator : public bcIAllocator { @@ -197,7 +197,7 @@ private: nsresult bcXPCOMMarshalToolkit::UnMarshal(bcIUnMarshaler *um) { bcIAllocator * allocator = new xpAllocator(nsAllocator::GetGlobalAllocator()); PRUint32 paramCount = info->GetParamCount(); - for (int i = 0; i < paramCount; i++) { + for (unsigned int i = 0; i < paramCount; i++) { nsXPTParamInfo param = info->GetParam(i); PRBool isOut = param.IsOut(); nsXPTCMiniVariant tmpValue = params[i]; //we need to set value for client side @@ -344,6 +344,8 @@ bcXPType bcXPCOMMarshalToolkit::XPTType2bcXPType(uint8 type) { return bc_T_INTERFACE; case nsXPTType::T_ARRAY: return bc_T_ARRAY; + default: + return bc_T_UNDEFINED; } } diff --git a/mozilla/java/xpcom/xpcom/bcXPCOMProxy.cpp b/mozilla/java/xpcom/xpcom/bcXPCOMProxy.cpp index 3c5358fc80e..6b49ed95328 100644 --- a/mozilla/java/xpcom/xpcom/bcXPCOMProxy.cpp +++ b/mozilla/java/xpcom/xpcom/bcXPCOMProxy.cpp @@ -25,11 +25,6 @@ #include "bcXPCOMProxy.h" #include "bcXPCOMMarshalToolkit.h" -#include "unistd.h" -#include "signal.h" - - - NS_IMPL_ISUPPORTS(bcXPCOMProxy, NS_GET_IID(bcXPCOMProxy)); diff --git a/mozilla/java/xpcom/xpcom/bcXPCOMStub.cpp b/mozilla/java/xpcom/xpcom/bcXPCOMStub.cpp index c7fc7944e2a..74d08506181 100644 --- a/mozilla/java/xpcom/xpcom/bcXPCOMStub.cpp +++ b/mozilla/java/xpcom/xpcom/bcXPCOMStub.cpp @@ -62,8 +62,8 @@ void bcXPCOMStub::Dispatch(bcICall *call) { } //nb return value; excepion handling XPTC_InvokeByIndex(object, mid, paramCount, params); - bcIMarshaler * m = call->GetMarshaler(); //nb ** to do - mt->Marshal(m); + //bcIMarshaler * m = call->GetMarshaler(); //nb ** to do + //mt->Marshal(m); return; } diff --git a/mozilla/java/xpcom/xpcom/makefile.win b/mozilla/java/xpcom/xpcom/makefile.win new file mode 100644 index 00000000000..7978bbb47a9 --- /dev/null +++ b/mozilla/java/xpcom/xpcom/makefile.win @@ -0,0 +1,52 @@ +#!nmake +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 Sun Microsystems, +# Inc. Portions created by Sun are +# Copyright (C) 1999 Sun Microsystems, Inc. All +# Rights Reserved. +# +# Contributor(s): +# Igor Kushnirskiy +# + +DEPTH=..\..\..\ + +MAKE_OBJ_TYPE = DLL +DLLNAME = bcxpcomstubs +DLL=.\$(OBJDIR)\$(DLLNAME).dll +MODULE = bcxpcomstubs +COMPONENT = 1 + + +OBJS= \ + .\$(OBJDIR)\bcXPCOMProxy.obj \ + .\$(OBJDIR)\bcXPCOMStub.obj \ + .\$(OBJDIR)\bcXPCOMMarshalToolkit.obj \ + .\$(OBJDIR)\bcXPCOMStubsAndProxies.obj \ + $(NULL) + +EXPORTS = \ + bcXPCOMStubsAndProxies.h + +LLIBS= \ + $(DIST)\lib\xpcom.lib \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> + +install:: $(DLL) + $(MAKE_INSTALL) $(DLL) $(DIST)\bin\components +clobber:: + rm -f $(DIST)\bin\components\$(DLLNAME).dll