2001-12-07 19:54:16 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-02-19 02:44:03 +00:00
|
|
|
/* vim:set ts=4 sw=4 et cindent: */
|
2001-12-07 19:54:16 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:21:17 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2001-12-07 19:54:16 +00:00
|
|
|
*
|
2004-04-18 14:21:17 +00: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 19:54:16 +00: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 14:21:17 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-12-07 19:54:16 +00: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 14:21:17 +00: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 19:54:16 +00: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 14:21:17 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-12-07 19:54:16 +00: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 14:21:17 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-12-07 19:54:16 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsXPComPrivate_h__
|
|
|
|
#define nsXPComPrivate_h__
|
|
|
|
|
2004-10-25 19:34:45 +00:00
|
|
|
// Map frozen functions to private symbol names if not using strict API.
|
|
|
|
#ifndef MOZILLA_STRICT_API
|
|
|
|
# define NS_RegisterXPCOMExitRoutine NS_RegisterXPCOMExitRoutine_P
|
|
|
|
# define NS_UnregisterXPCOMExitRoutine NS_UnregisterXPCOMExitRoutine_P
|
|
|
|
#endif
|
|
|
|
|
2001-12-07 19:54:16 +00:00
|
|
|
#include "nscore.h"
|
2002-06-21 19:58:54 +00:00
|
|
|
#include "nsXPCOM.h"
|
2004-11-12 19:26:37 +00:00
|
|
|
#include "nsStringAPI.h"
|
2004-02-19 02:44:03 +00:00
|
|
|
|
|
|
|
class nsStringContainer;
|
|
|
|
class nsCStringContainer;
|
|
|
|
|
2001-12-07 19:54:16 +00:00
|
|
|
/**
|
|
|
|
* Private Method to register an exit routine. This method
|
|
|
|
* allows you to setup a callback that will be called from
|
|
|
|
* the NS_ShutdownXPCOM function after all services and
|
|
|
|
* components have gone away.
|
|
|
|
*
|
|
|
|
* This API is for the exclusive use of the xpcom glue library.
|
|
|
|
*
|
2002-06-04 14:21:32 +00:00
|
|
|
* Note that these APIs are NOT threadsafe and must be called on the
|
|
|
|
* main thread.
|
|
|
|
*
|
2001-12-07 19:54:16 +00:00
|
|
|
* @status FROZEN
|
|
|
|
* @param exitRoutine pointer to user defined callback function
|
|
|
|
* of type XPCOMExitRoutine.
|
|
|
|
* @param priority higher priorities are called before lower
|
|
|
|
* priorities.
|
|
|
|
*
|
|
|
|
* @return NS_OK for success;
|
|
|
|
* other error codes indicate a failure.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef NS_CALLBACK(XPCOMExitRoutine)(void);
|
|
|
|
|
|
|
|
extern "C" NS_COM nsresult
|
|
|
|
NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority);
|
|
|
|
|
|
|
|
extern "C" NS_COM nsresult
|
|
|
|
NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine);
|
|
|
|
|
2002-06-21 19:58:54 +00:00
|
|
|
|
|
|
|
// PUBLIC
|
2004-04-20 00:21:34 +00:00
|
|
|
typedef nsresult (* InitFunc)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider);
|
|
|
|
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 04:44:57 +00:00
|
|
|
typedef nsresult (* StringContainerInit2Func)(nsStringContainer&, const PRUnichar *, PRUint32, PRUint32);
|
2004-04-20 00:21:34 +00:00
|
|
|
typedef void (* StringContainerFinishFunc)(nsStringContainer&);
|
|
|
|
typedef PRUint32 (* StringGetDataFunc)(const nsAString&, const PRUnichar**, PRBool*);
|
|
|
|
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 &);
|
|
|
|
|
|
|
|
typedef nsresult (* CStringContainerInitFunc)(nsCStringContainer&);
|
2004-11-16 04:44:57 +00:00
|
|
|
typedef nsresult (* CStringContainerInit2Func)(nsCStringContainer&, const char *, PRUint32, PRUint32);
|
2004-04-20 00:21:34 +00:00
|
|
|
typedef void (* CStringContainerFinishFunc)(nsCStringContainer&);
|
|
|
|
typedef PRUint32 (* CStringGetDataFunc)(const nsACString&, const char**, PRBool*);
|
|
|
|
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 &);
|
|
|
|
|
2004-11-12 19:26:37 +00: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 02:44:03 +00:00
|
|
|
|
2002-06-21 19:58:54 +00:00
|
|
|
// PRIVATE
|
2004-04-20 00:21:34 +00:00
|
|
|
typedef nsresult (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, PRUint32 priority);
|
|
|
|
typedef nsresult (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine);
|
2002-06-21 19:58:54 +00: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-07 22:11:36 +00:00
|
|
|
|
2004-04-01 20:47:48 +00:00
|
|
|
// Added for Mozilla 1.5
|
2003-07-07 22:11:36 +00:00
|
|
|
GetDebugFunc getDebug;
|
2003-08-05 05:29:10 +00:00
|
|
|
GetTraceRefcntFunc getTraceRefcnt;
|
2004-02-19 02:44:03 +00:00
|
|
|
|
2004-04-01 20:47:48 +00:00
|
|
|
// Added for Mozilla 1.7
|
2004-02-19 02:44:03 +00: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-01 20:47:48 +00:00
|
|
|
CStringToUTF16 cstringToUTF16;
|
|
|
|
UTF16ToCString utf16ToCString;
|
2004-04-20 00:21:34 +00:00
|
|
|
StringCloneDataFunc stringCloneData;
|
|
|
|
CStringCloneDataFunc cstringCloneData;
|
2004-11-16 04:44:57 +00:00
|
|
|
|
|
|
|
// Added for Mozilla 1.8
|
2004-11-12 19:26:37 +00:00
|
|
|
AllocFunc allocFunc;
|
|
|
|
ReallocFunc reallocFunc;
|
|
|
|
FreeFunc freeFunc;
|
2004-11-16 04:44:57 +00:00
|
|
|
StringContainerInit2Func stringContainerInit2;
|
|
|
|
CStringContainerInit2Func cstringContainerInit2;
|
2004-04-20 00:21:34 +00:00
|
|
|
|
2002-06-21 19:58:54 +00:00
|
|
|
} XPCOMFunctions;
|
|
|
|
|
2002-09-20 22:23:24 +00:00
|
|
|
typedef nsresult (PR_CALLBACK *GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
|
2002-06-21 19:58:54 +00:00
|
|
|
extern "C" NS_COM nsresult
|
2002-09-20 22:23:24 +00:00
|
|
|
NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
|
2002-06-21 19:58:54 +00:00
|
|
|
|
|
|
|
// think hard before changing this
|
|
|
|
#define XPCOM_GLUE_VERSION 1
|
|
|
|
|
2003-01-02 23:09:30 +00:00
|
|
|
|
|
|
|
/* XPCOM Specific Defines
|
|
|
|
*
|
|
|
|
* XPCOM_DLL - name of the loadable xpcom library on disk.
|
|
|
|
* XPCOM_SEARCH_KEY - name of the environment variable that can be
|
2003-11-17 06:13:49 +00:00
|
|
|
* modified to include additional search paths.
|
2003-03-12 08:35:57 +00:00
|
|
|
* GRE_CONF_NAME - Name of the GRE Configuration file
|
2003-01-02 23:09:30 +00:00
|
|
|
*/
|
|
|
|
|
2003-01-03 01:39:38 +00:00
|
|
|
#if defined(XP_WIN32) || defined(XP_OS2)
|
2003-01-02 23:09:30 +00:00
|
|
|
|
|
|
|
#define XPCOM_SEARCH_KEY "PATH"
|
|
|
|
#define GRE_CONF_NAME "gre.config"
|
|
|
|
#define GRE_WIN_REG_LOC "Software\\mozilla.org\\GRE\\"
|
2003-04-23 00:54:38 +00:00
|
|
|
#define XPCOM_DLL "xpcom.dll"
|
2003-01-03 01:39:38 +00:00
|
|
|
|
|
|
|
#elif defined(XP_BEOS)
|
|
|
|
|
|
|
|
#define XPCOM_SEARCH_KEY "ADDON_PATH"
|
|
|
|
#define GRE_CONF_NAME ".gre.config"
|
|
|
|
#define GRE_CONF_PATH "/boot/home/config/settings/GRE/gre.conf"
|
|
|
|
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
|
|
|
|
|
|
|
|
#else // Unix
|
2003-01-02 23:09:30 +00:00
|
|
|
|
2003-04-20 17:59:47 +00:00
|
|
|
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
|
|
|
|
|
2003-01-02 23:09:30 +00:00
|
|
|
// you have to love apple..
|
|
|
|
#ifdef XP_MACOSX
|
2003-01-03 01:39:38 +00:00
|
|
|
#define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH"
|
2003-01-02 23:09:30 +00:00
|
|
|
#else
|
2003-01-03 01:39:38 +00:00
|
|
|
#define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH"
|
2003-01-02 23:09:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GRE_CONF_NAME ".gre.config"
|
|
|
|
#define GRE_CONF_PATH "/etc/gre.conf"
|
2003-05-20 18:52:40 +00:00
|
|
|
#define GRE_CONF_DIR "/etc/gre.d/"
|
2003-01-02 23:09:30 +00:00
|
|
|
#endif
|
|
|
|
|
2003-11-17 06:13:49 +00:00
|
|
|
#if defined(XP_WIN) || defined(XP_OS2)
|
2003-01-02 23:09:30 +00:00
|
|
|
#define XPCOM_FILE_PATH_SEPARATOR "\\"
|
2003-11-17 06:13:49 +00:00
|
|
|
#define XPCOM_ENV_PATH_SEPARATOR ";"
|
2003-01-02 23:09:30 +00:00
|
|
|
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
|
|
|
#define XPCOM_FILE_PATH_SEPARATOR "/"
|
2003-11-17 06:13:49 +00:00
|
|
|
#define XPCOM_ENV_PATH_SEPARATOR ":"
|
2003-01-02 23:09:30 +00:00
|
|
|
#else
|
|
|
|
#error need_to_define_your_file_path_separator_and_illegal_characters
|
|
|
|
#endif
|
|
|
|
|
2001-12-07 19:54:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|