2001-12-07 22:54:16 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-02-19 05:44:03 +03:00
|
|
|
/* vim:set ts=4 sw=4 et cindent: */
|
2001-12-07 22:54:16 +03:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:21:17 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2001-12-07 22:54:16 +03:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* 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/
|
2001-12-07 22:54:16 +03:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-12-07 22:54:16 +03:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:21:17 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-12-07 22:54:16 +03:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:21:17 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-12-07 22:54:16 +03:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:21:17 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-12-07 22:54:16 +03:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsXPComPrivate_h__
|
|
|
|
#define nsXPComPrivate_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
2002-06-21 23:58:54 +04:00
|
|
|
#include "nsXPCOM.h"
|
2006-05-03 20:11:14 +04:00
|
|
|
#include "nsXPCOMStrings.h"
|
2007-04-24 21:02:52 +04:00
|
|
|
#include "xptcall.h"
|
2004-02-19 05:44:03 +03:00
|
|
|
|
|
|
|
class nsStringContainer;
|
|
|
|
class nsCStringContainer;
|
2005-07-21 17:33:43 +04:00
|
|
|
class nsIComponentLoader;
|
2004-02-19 05:44:03 +03:00
|
|
|
|
2005-11-23 17:32:18 +03:00
|
|
|
/**
|
|
|
|
* During this shutdown notification all threads which run XPCOM code must
|
|
|
|
* be joined.
|
|
|
|
*/
|
|
|
|
#define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* During this shutdown notification all module loaders must unload XPCOM
|
|
|
|
* modules.
|
|
|
|
*/
|
|
|
|
#define NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID "xpcom-shutdown-loaders"
|
|
|
|
|
2002-06-21 23:58:54 +04:00
|
|
|
// PUBLIC
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef nsresult (* InitFunc)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider);
|
2005-07-21 17:33:43 +04:00
|
|
|
typedef nsresult (* Init3Func)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider, nsStaticModuleInfo const *staticComponents, PRUint32 componentCount);
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef nsresult (* ShutdownFunc)(nsIServiceManager* servMgr);
|
|
|
|
typedef nsresult (* GetServiceManagerFunc)(nsIServiceManager* *result);
|
|
|
|
typedef nsresult (* GetComponentManagerFunc)(nsIComponentManager* *result);
|
|
|
|
typedef nsresult (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result);
|
|
|
|
typedef nsresult (* GetMemoryManagerFunc)(nsIMemory* *result);
|
|
|
|
typedef nsresult (* NewLocalFileFunc)(const nsAString &path, PRBool followLinks, nsILocalFile* *result);
|
|
|
|
typedef nsresult (* NewNativeLocalFileFunc)(const nsACString &path, PRBool followLinks, nsILocalFile* *result);
|
|
|
|
|
|
|
|
typedef nsresult (* GetDebugFunc)(nsIDebug* *result);
|
|
|
|
typedef nsresult (* GetTraceRefcntFunc)(nsITraceRefcnt* *result);
|
|
|
|
|
|
|
|
typedef nsresult (* StringContainerInitFunc)(nsStringContainer&);
|
2004-11-16 07:44:57 +03:00
|
|
|
typedef nsresult (* StringContainerInit2Func)(nsStringContainer&, const PRUnichar *, PRUint32, PRUint32);
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef void (* StringContainerFinishFunc)(nsStringContainer&);
|
|
|
|
typedef PRUint32 (* StringGetDataFunc)(const nsAString&, const PRUnichar**, PRBool*);
|
2005-04-27 05:38:35 +04:00
|
|
|
typedef PRUint32 (* StringGetMutableDataFunc)(nsAString&, PRUint32, PRUnichar**);
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef PRUnichar* (* StringCloneDataFunc)(const nsAString&);
|
|
|
|
typedef nsresult (* StringSetDataFunc)(nsAString&, const PRUnichar*, PRUint32);
|
|
|
|
typedef nsresult (* StringSetDataRangeFunc)(nsAString&, PRUint32, PRUint32, const PRUnichar*, PRUint32);
|
|
|
|
typedef nsresult (* StringCopyFunc)(nsAString &, const nsAString &);
|
2007-08-18 07:48:17 +04:00
|
|
|
typedef void (* StringSetIsVoidFunc)(nsAString &, const PRBool);
|
|
|
|
typedef PRBool (* StringGetIsVoidFunc)(const nsAString &);
|
2004-04-20 04:21:34 +04:00
|
|
|
|
|
|
|
typedef nsresult (* CStringContainerInitFunc)(nsCStringContainer&);
|
2004-11-16 07:44:57 +03:00
|
|
|
typedef nsresult (* CStringContainerInit2Func)(nsCStringContainer&, const char *, PRUint32, PRUint32);
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef void (* CStringContainerFinishFunc)(nsCStringContainer&);
|
|
|
|
typedef PRUint32 (* CStringGetDataFunc)(const nsACString&, const char**, PRBool*);
|
2005-04-27 05:38:35 +04:00
|
|
|
typedef PRUint32 (* CStringGetMutableDataFunc)(nsACString&, PRUint32, char**);
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef char* (* CStringCloneDataFunc)(const nsACString&);
|
|
|
|
typedef nsresult (* CStringSetDataFunc)(nsACString&, const char*, PRUint32);
|
|
|
|
typedef nsresult (* CStringSetDataRangeFunc)(nsACString&, PRUint32, PRUint32, const char*, PRUint32);
|
|
|
|
typedef nsresult (* CStringCopyFunc)(nsACString &, const nsACString &);
|
2007-08-18 07:48:17 +04:00
|
|
|
typedef void (* CStringSetIsVoidFunc)(nsACString &, const PRBool);
|
|
|
|
typedef PRBool (* CStringGetIsVoidFunc)(const nsACString &);
|
2004-04-20 04:21:34 +04:00
|
|
|
|
2004-11-12 22:26:37 +03:00
|
|
|
typedef nsresult (* CStringToUTF16)(const nsACString &, nsCStringEncoding, nsAString &);
|
|
|
|
typedef nsresult (* UTF16ToCString)(const nsAString &, nsCStringEncoding, nsACString &);
|
|
|
|
|
|
|
|
typedef void* (* AllocFunc)(PRSize size);
|
|
|
|
typedef void* (* ReallocFunc)(void* ptr, PRSize size);
|
|
|
|
typedef void (* FreeFunc)(void* ptr);
|
2004-02-19 05:44:03 +03:00
|
|
|
|
2006-02-10 18:00:36 +03:00
|
|
|
typedef void (* DebugBreakFunc)(PRUint32 aSeverity,
|
|
|
|
const char *aStr, const char *aExpr,
|
|
|
|
const char *aFile, PRInt32 aLine);
|
|
|
|
|
|
|
|
typedef void (* xpcomVoidFunc)();
|
|
|
|
typedef void (* LogAddRefFunc)(void*, nsrefcnt, const char*, PRUint32);
|
|
|
|
typedef void (* LogReleaseFunc)(void*, nsrefcnt, const char*);
|
|
|
|
typedef void (* LogCtorFunc)(void*, const char*, PRUint32);
|
|
|
|
typedef void (* LogCOMPtrFunc)(void*, nsISupports*);
|
|
|
|
|
2007-04-24 21:02:52 +04:00
|
|
|
typedef nsresult (* GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*, nsISomeInterface**);
|
|
|
|
typedef void (* DestroyXPTCallStubFunc)(nsISomeInterface*);
|
|
|
|
typedef nsresult (* InvokeByIndexFunc)(nsISupports*, PRUint32, PRUint32, nsXPTCVariant*);
|
2007-08-06 18:34:05 +04:00
|
|
|
typedef PRBool (* CycleCollectorFunc)(nsISupports*);
|
2007-04-24 21:02:52 +04:00
|
|
|
|
2006-02-13 19:08:55 +03:00
|
|
|
// PRIVATE AND DEPRECATED
|
|
|
|
typedef NS_CALLBACK(XPCOMExitRoutine)(void);
|
|
|
|
|
2004-04-20 04:21:34 +04:00
|
|
|
typedef nsresult (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, PRUint32 priority);
|
|
|
|
typedef nsresult (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine);
|
2002-06-21 23:58:54 +04:00
|
|
|
|
|
|
|
typedef struct XPCOMFunctions{
|
|
|
|
PRUint32 version;
|
|
|
|
PRUint32 size;
|
|
|
|
|
|
|
|
InitFunc init;
|
|
|
|
ShutdownFunc shutdown;
|
|
|
|
GetServiceManagerFunc getServiceManager;
|
|
|
|
GetComponentManagerFunc getComponentManager;
|
|
|
|
GetComponentRegistrarFunc getComponentRegistrar;
|
|
|
|
GetMemoryManagerFunc getMemoryManager;
|
|
|
|
NewLocalFileFunc newLocalFile;
|
|
|
|
NewNativeLocalFileFunc newNativeLocalFile;
|
|
|
|
|
|
|
|
RegisterXPCOMExitRoutineFunc registerExitRoutine;
|
|
|
|
UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
|
2003-07-08 02:11:36 +04:00
|
|
|
|
2004-04-02 00:47:48 +04:00
|
|
|
// Added for Mozilla 1.5
|
2003-07-08 02:11:36 +04:00
|
|
|
GetDebugFunc getDebug;
|
2003-08-05 09:29:10 +04:00
|
|
|
GetTraceRefcntFunc getTraceRefcnt;
|
2004-02-19 05:44:03 +03:00
|
|
|
|
2004-04-02 00:47:48 +04:00
|
|
|
// Added for Mozilla 1.7
|
2004-02-19 05:44:03 +03:00
|
|
|
StringContainerInitFunc stringContainerInit;
|
|
|
|
StringContainerFinishFunc stringContainerFinish;
|
|
|
|
StringGetDataFunc stringGetData;
|
|
|
|
StringSetDataFunc stringSetData;
|
|
|
|
StringSetDataRangeFunc stringSetDataRange;
|
|
|
|
StringCopyFunc stringCopy;
|
|
|
|
CStringContainerInitFunc cstringContainerInit;
|
|
|
|
CStringContainerFinishFunc cstringContainerFinish;
|
|
|
|
CStringGetDataFunc cstringGetData;
|
|
|
|
CStringSetDataFunc cstringSetData;
|
|
|
|
CStringSetDataRangeFunc cstringSetDataRange;
|
|
|
|
CStringCopyFunc cstringCopy;
|
2004-04-02 00:47:48 +04:00
|
|
|
CStringToUTF16 cstringToUTF16;
|
|
|
|
UTF16ToCString utf16ToCString;
|
2004-04-20 04:21:34 +04:00
|
|
|
StringCloneDataFunc stringCloneData;
|
|
|
|
CStringCloneDataFunc cstringCloneData;
|
2004-11-16 07:44:57 +03:00
|
|
|
|
|
|
|
// Added for Mozilla 1.8
|
2004-11-12 22:26:37 +03:00
|
|
|
AllocFunc allocFunc;
|
|
|
|
ReallocFunc reallocFunc;
|
|
|
|
FreeFunc freeFunc;
|
2004-11-16 07:44:57 +03:00
|
|
|
StringContainerInit2Func stringContainerInit2;
|
|
|
|
CStringContainerInit2Func cstringContainerInit2;
|
2005-04-27 05:38:35 +04:00
|
|
|
StringGetMutableDataFunc stringGetMutableData;
|
|
|
|
CStringGetMutableDataFunc cstringGetMutableData;
|
2005-07-21 17:33:43 +04:00
|
|
|
Init3Func init3;
|
2006-02-10 18:00:36 +03:00
|
|
|
|
|
|
|
// Added for Mozilla 1.9
|
|
|
|
DebugBreakFunc debugBreakFunc;
|
|
|
|
xpcomVoidFunc logInitFunc;
|
|
|
|
xpcomVoidFunc logTermFunc;
|
|
|
|
LogAddRefFunc logAddRefFunc;
|
|
|
|
LogReleaseFunc logReleaseFunc;
|
|
|
|
LogCtorFunc logCtorFunc;
|
|
|
|
LogCtorFunc logDtorFunc;
|
|
|
|
LogCOMPtrFunc logCOMPtrAddRefFunc;
|
|
|
|
LogCOMPtrFunc logCOMPtrReleaseFunc;
|
2007-04-24 21:02:52 +04:00
|
|
|
GetXPTCallStubFunc getXPTCallStubFunc;
|
|
|
|
DestroyXPTCallStubFunc destroyXPTCallStubFunc;
|
|
|
|
InvokeByIndexFunc invokeByIndexFunc;
|
2007-08-06 18:34:05 +04:00
|
|
|
CycleCollectorFunc cycleSuspectFunc;
|
|
|
|
CycleCollectorFunc cycleForgetFunc;
|
2007-08-18 07:48:17 +04:00
|
|
|
StringSetIsVoidFunc stringSetIsVoid;
|
|
|
|
StringGetIsVoidFunc stringGetIsVoid;
|
|
|
|
CStringSetIsVoidFunc cstringSetIsVoid;
|
|
|
|
CStringGetIsVoidFunc cstringGetIsVoid;
|
2006-02-10 18:00:36 +03:00
|
|
|
|
2002-06-21 23:58:54 +04:00
|
|
|
} XPCOMFunctions;
|
|
|
|
|
2002-09-21 02:23:24 +04:00
|
|
|
typedef nsresult (PR_CALLBACK *GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
|
2005-11-08 21:17:49 +03:00
|
|
|
XPCOM_API(nsresult)
|
2002-09-21 02:23:24 +04:00
|
|
|
NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
|
2002-06-21 23:58:54 +04:00
|
|
|
|
|
|
|
// think hard before changing this
|
|
|
|
#define XPCOM_GLUE_VERSION 1
|
|
|
|
|
2003-01-03 02:09:30 +03:00
|
|
|
|
|
|
|
/* XPCOM Specific Defines
|
|
|
|
*
|
|
|
|
* XPCOM_DLL - name of the loadable xpcom library on disk.
|
2005-11-18 20:45:59 +03:00
|
|
|
* XUL_DLL - name of the loadable XUL library on disk
|
2003-01-03 02:09:30 +03:00
|
|
|
* XPCOM_SEARCH_KEY - name of the environment variable that can be
|
2003-11-17 09:13:49 +03:00
|
|
|
* modified to include additional search paths.
|
2003-03-12 11:35:57 +03:00
|
|
|
* GRE_CONF_NAME - Name of the GRE Configuration file
|
2003-01-03 02:09:30 +03:00
|
|
|
*/
|
|
|
|
|
2005-01-31 00:33:47 +03:00
|
|
|
#if defined(XP_WIN32) || defined(XP_OS2) || defined(WINCE)
|
2003-01-03 02:09:30 +03:00
|
|
|
|
|
|
|
#define XPCOM_SEARCH_KEY "PATH"
|
|
|
|
#define GRE_CONF_NAME "gre.config"
|
2005-06-13 20:45:22 +04:00
|
|
|
#define GRE_WIN_REG_LOC "Software\\mozilla.org\\GRE"
|
2003-04-23 04:54:38 +04:00
|
|
|
#define XPCOM_DLL "xpcom.dll"
|
2005-11-18 20:45:59 +03:00
|
|
|
#define XUL_DLL "xul.dll"
|
2003-01-03 04:39:38 +03:00
|
|
|
|
|
|
|
#elif defined(XP_BEOS)
|
|
|
|
|
|
|
|
#define XPCOM_SEARCH_KEY "ADDON_PATH"
|
2006-09-27 20:07:06 +04:00
|
|
|
#define GRE_CONF_NAME "gre.config"
|
|
|
|
#define GRE_CONF_PATH "gre.conf"
|
|
|
|
#define GRE_CONF_DIR "gre.d"
|
2003-01-03 04:39:38 +03:00
|
|
|
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
|
2005-11-18 20:45:59 +03:00
|
|
|
#define XUL_DLL "libxul"MOZ_DLL_SUFFIX
|
2003-01-03 04:39:38 +03:00
|
|
|
|
|
|
|
#else // Unix
|
2003-01-03 02:09:30 +03:00
|
|
|
|
2003-04-20 21:59:47 +04:00
|
|
|
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
|
|
|
|
|
2003-01-03 02:09:30 +03:00
|
|
|
// you have to love apple..
|
|
|
|
#ifdef XP_MACOSX
|
2003-01-03 04:39:38 +03:00
|
|
|
#define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH"
|
2005-10-09 22:20:03 +04:00
|
|
|
#define GRE_FRAMEWORK_NAME "XUL.framework"
|
2005-11-18 20:45:59 +03:00
|
|
|
#define XUL_DLL "XUL"
|
2003-01-03 02:09:30 +03:00
|
|
|
#else
|
2003-01-03 04:39:38 +03:00
|
|
|
#define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH"
|
2005-11-18 20:45:59 +03:00
|
|
|
#define XUL_DLL "libxul"MOZ_DLL_SUFFIX
|
2003-01-03 02:09:30 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GRE_CONF_NAME ".gre.config"
|
|
|
|
#define GRE_CONF_PATH "/etc/gre.conf"
|
2005-06-16 17:29:45 +04:00
|
|
|
#define GRE_CONF_DIR "/etc/gre.d"
|
|
|
|
#define GRE_USER_CONF_DIR ".gre.d"
|
2003-01-03 02:09:30 +03:00
|
|
|
#endif
|
|
|
|
|
2003-11-17 09:13:49 +03:00
|
|
|
#if defined(XP_WIN) || defined(XP_OS2)
|
2003-01-03 02:09:30 +03:00
|
|
|
#define XPCOM_FILE_PATH_SEPARATOR "\\"
|
2003-11-17 09:13:49 +03:00
|
|
|
#define XPCOM_ENV_PATH_SEPARATOR ";"
|
2003-01-03 02:09:30 +03:00
|
|
|
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
|
|
|
#define XPCOM_FILE_PATH_SEPARATOR "/"
|
2003-11-17 09:13:49 +03:00
|
|
|
#define XPCOM_ENV_PATH_SEPARATOR ":"
|
2003-01-03 02:09:30 +03:00
|
|
|
#else
|
|
|
|
#error need_to_define_your_file_path_separator_and_illegal_characters
|
|
|
|
#endif
|
|
|
|
|
2005-06-14 06:37:32 +04:00
|
|
|
#ifdef AIX
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
2005-06-13 20:45:22 +04:00
|
|
|
#ifndef MAXPATHLEN
|
2005-07-15 16:07:47 +04:00
|
|
|
#ifdef PATH_MAX
|
|
|
|
#define MAXPATHLEN PATH_MAX
|
|
|
|
#elif defined(_MAX_PATH)
|
2005-06-13 20:45:22 +04:00
|
|
|
#define MAXPATHLEN _MAX_PATH
|
|
|
|
#elif defined(CCHMAXPATH)
|
|
|
|
#define MAXPATHLEN CCHMAXPATH
|
|
|
|
#else
|
|
|
|
#define MAXPATHLEN 1024
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-07-21 17:33:43 +04:00
|
|
|
#endif
|