no-standaloneglue.patch
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 153 cd96178a2e472dc6cd10443a56a3cedf9e8e1140
permissions -rw-r--r--
State as of now

diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -464,7 +464,6 @@ LDAP_CFLAGS	= @LDAP_CFLAGS@
 LDAP_CFLAGS	= @LDAP_CFLAGS@
 LDAP_LIBS	= @LDAP_LIBS@
 XPCOM_GLUE_LDOPTS = @XPCOM_GLUE_LDOPTS@
-XPCOM_STANDALONE_GLUE_LDOPTS = @XPCOM_STANDALONE_GLUE_LDOPTS@
 MOZ_XPCOM_OBSOLETE_LIBS = @MOZ_XPCOM_OBSOLETE_LIBS@
 
 USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -955,7 +955,6 @@ XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bi
 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
-XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
 
 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
diff --git a/embedding/browser/gtk/Makefile.in b/embedding/browser/gtk/Makefile.in
--- a/embedding/browser/gtk/Makefile.in
+++ b/embedding/browser/gtk/Makefile.in
@@ -47,10 +47,6 @@ MODULE		= gtkembedmoz
 
 DIRS=src
 
-ifdef ENABLE_TESTS
-TOOL_DIRS  += tests
-endif
-
 PACKAGE_FILE = gtkembed.pkg
 
 include $(topsrcdir)/config/rules.mk
diff --git a/embedding/tests/Makefile.in b/embedding/tests/Makefile.in
--- a/embedding/tests/Makefile.in
+++ b/embedding/tests/Makefile.in
@@ -39,14 +39,6 @@ DIRS = os2Embed
 DIRS = os2Embed
 endif
 
-ifeq ($(OS_ARCH),WINNT)
-# disable winembed in non-libxul
-ifndef BUILD_STATIC_LIBS
-ifdef MOZ_XUL_APP
-DIRS = winEmbed
-endif
-endif
-
 endif
 
 include $(topsrcdir)/config/rules.mk
diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -464,7 +464,6 @@ MAKEFILES_xpcom="
   xpcom/components/Makefile
   xpcom/ds/Makefile
   xpcom/glue/Makefile
-  xpcom/glue/standalone/Makefile
   xpcom/io/Makefile
   xpcom/typelib/Makefile
   xpcom/reflect/Makefile
diff --git a/xpcom/Makefile.in b/xpcom/Makefile.in
--- a/xpcom/Makefile.in
+++ b/xpcom/Makefile.in
@@ -65,10 +65,6 @@ DIRS += stub
 DIRS += stub
 endif
 
-TOOL_DIRS = \
-	tools \
-	$(NULL)
-
 ifeq ($(OS_ARCH),WINNT)
 ifdef MOZ_DEBUG
 DIRS		+= windbgdlg
diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in
--- a/xpcom/glue/Makefile.in
+++ b/xpcom/glue/Makefile.in
@@ -44,8 +44,6 @@ include $(srcdir)/objs.mk
 include $(srcdir)/objs.mk
 
 EXTRA_DEPS += $(srcdir)/objs.mk
-
-DIRS            = standalone
 
 MODULE		= xpcom
 LIBRARY_NAME	= xpcomglue_s
@@ -124,6 +122,7 @@ EXPORTS = \
 		nsThreadUtils.h \
 		nsProxyRelease.h \
 		nsXPTCUtils.h \
+		nsXPCOMGlue.h \
 		$(NULL)
 
 SDK_LIBRARY     =                        \
diff --git a/xpcom/glue/nsGenericFactory.cpp b/xpcom/glue/nsGenericFactory.cpp
--- a/xpcom/glue/nsGenericFactory.cpp
+++ b/xpcom/glue/nsGenericFactory.cpp
@@ -493,23 +493,4 @@ NS_NewGenericModule2(nsModuleInfo const 
     return rv;
 }
 
-NS_COM_GLUE nsresult
-NS_NewGenericModule(const char* moduleName,
-                    PRUint32 componentCount,
-                    nsModuleComponentInfo* components,
-                    nsModuleDestructorProc dtor,
-                    nsIModule* *result)
-{
-    nsModuleInfo info;
-    memset(&info, 0, sizeof(info));
-
-    info.mVersion    = NS_MODULEINFO_VERSION;
-    info.mModuleName = moduleName;
-    info.mComponents = components;
-    info.mCount      = componentCount;
-    info.mDtor       = dtor;
-
-    return NS_NewGenericModule2(&info, result);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/xpcom/glue/nsIGenericFactory.h b/xpcom/glue/nsIGenericFactory.h
--- a/xpcom/glue/nsIGenericFactory.h
+++ b/xpcom/glue/nsIGenericFactory.h
@@ -75,11 +75,9 @@ public:
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIGenericFactory, NS_IGENERICFACTORY_IID)
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
 NS_COM_GLUE nsresult
 NS_NewGenericFactory(nsIGenericFactory **result,
                      const nsModuleComponentInfo *info);
-#endif
 
 
 /** Component Callbacks **/
@@ -304,25 +302,12 @@ struct nsModuleInfo {
  */
 #define NS_MODULEINFO_VERSION 0x00015000UL // 1.5
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
 /**
  * Create a new generic module. Use the NS_IMPL_NSGETMODULE macro, or
  * one of its relatives, rather than using this directly.
  */
 NS_COM_GLUE nsresult
 NS_NewGenericModule2(nsModuleInfo const *info, nsIModule* *result);
-
-/**
- * Obsolete. Use NS_NewGenericModule2() instead.
- */
-NS_COM_GLUE nsresult
-NS_NewGenericModule(const char* moduleName,
-                    PRUint32 componentCount,
-                    nsModuleComponentInfo* components,
-                    nsModuleDestructorProc dtor,
-                    nsIModule* *result);
-
-#endif // XPCOM_GLUE_AVOID_NSPR
 
 #if defined(XPCOM_TRANSLATE_NSGM_ENTRY_POINT)
 #  define NSGETMODULE_ENTRY_POINT(_name)  NS_VISIBILITY_HIDDEN nsresult _name##_NSGetModule
diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -50,11 +50,8 @@
 #include "nsISupportsUtils.h"
 #endif
 
-
-#if !defined(XPCOM_GLUE_AVOID_NSPR)
 #include "prthread.h" /* needed for thread-safety checks */
 #include "pratom.h"   /* needed for PR_AtomicIncrement and PR_AtomicDecrement */
-#endif
 
 #include "nsDebug.h"
 #include "nsTraceRefcnt.h"
@@ -63,7 +60,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 // Macros to help detect thread-safety:
 
-#if defined(NS_DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
+#if defined(NS_DEBUG)
 
 class nsAutoOwningThread {
 public:
@@ -1163,8 +1160,6 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(
  *        because the implementation requires PR_ symbols.
  */
 
-#if !defined(XPCOM_GLUE_AVOID_NSPR)
-
 /**
  * Use this macro to implement the AddRef method for a given <i>_class</i>
  * @param _class The name of the class implementing the method
@@ -1201,16 +1196,6 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release
   }                                                                           \
   return count;                                                               \
 }
-
-#else // XPCOM_GLUE_AVOID_NSPR
-
-#define NS_IMPL_THREADSAFE_ADDREF(_class)                                     \
-  THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE;
-
-#define NS_IMPL_THREADSAFE_RELEASE(_class)                                    \
-  THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE;
-
-#endif
 
 #define NS_IMPL_THREADSAFE_ISUPPORTS0(_class)                                 \
   NS_IMPL_THREADSAFE_ADDREF(_class)                                           \
diff --git a/xpcom/glue/nsProxyRelease.h b/xpcom/glue/nsProxyRelease.h
--- a/xpcom/glue/nsProxyRelease.h
+++ b/xpcom/glue/nsProxyRelease.h
@@ -42,10 +42,6 @@
 #include "nsIEventTarget.h"
 #include "nsCOMPtr.h"
 
-#ifdef XPCOM_GLUE_AVOID_NSPR
-#error NS_ProxyRelease implementation depends on NSPR.
-#endif
-
 /**
  * Ensure that a nsCOMPtr is released on the target thread.
  *
diff --git a/xpcom/glue/nsStringAPI.cpp b/xpcom/glue/nsStringAPI.cpp
--- a/xpcom/glue/nsStringAPI.cpp
+++ b/xpcom/glue/nsStringAPI.cpp
@@ -520,7 +520,6 @@ nsAString::AppendInt(int aInt, PRInt32 a
 
 // Strings
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
 PRInt32
 nsAString::ToInteger(nsresult *aErrorCode, PRUint32 aRadix) const
 {
@@ -550,7 +549,6 @@ nsAString::ToInteger(nsresult *aErrorCod
 
   return result;
 }
-#endif // XPCOM_GLUE_AVOID_NSPR
 
 // nsACString
 
@@ -928,7 +926,6 @@ nsACString::AppendInt(int aInt, PRInt32 
   Append(buf, len);
 }
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
 PRInt32
 nsACString::ToInteger(nsresult *aErrorCode, PRUint32 aRadix) const
 {
@@ -956,7 +953,6 @@ nsACString::ToInteger(nsresult *aErrorCo
 
   return result;
 }
-#endif // XPCOM_GLUE_AVOID_NSPR
 
 // Substrings
 
diff --git a/xpcom/glue/nsStringAPI.h b/xpcom/glue/nsStringAPI.h
--- a/xpcom/glue/nsStringAPI.h
+++ b/xpcom/glue/nsStringAPI.h
@@ -362,7 +362,6 @@ public:
    */
   NS_HIDDEN_(void) AppendInt(int aInt, PRInt32 aRadix = 10);
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
   /**
    * Convert this string to an integer.
    *
@@ -371,7 +370,6 @@ public:
    */
   NS_HIDDEN_(PRInt32) ToInteger(nsresult* aErrorCode,
                                 PRUint32 aRadix = 10) const;
-#endif // XPCOM_GLUE_AVOID_NSPR
 
 protected:
   // Prevent people from allocating a nsAString directly.
@@ -688,7 +686,6 @@ public:
    */
   NS_HIDDEN_(void) AppendInt(int aInt, PRInt32 aRadix = 10);
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
   /**
    * Convert this string to an integer.
    *
@@ -697,7 +694,6 @@ public:
    */
   NS_HIDDEN_(PRInt32) ToInteger(nsresult* aErrorCode,
                                 PRUint32 aRadix = 10) const;
-#endif // XPCOM_GLUE_AVOID_NSPR
 
 protected:
   // Prevent people from allocating a nsAString directly.
diff --git a/xpcom/glue/nsThreadUtils.cpp b/xpcom/glue/nsThreadUtils.cpp
--- a/xpcom/glue/nsThreadUtils.cpp
+++ b/xpcom/glue/nsThreadUtils.cpp
@@ -46,8 +46,6 @@
 # include "nsServiceManagerUtils.h"
 #endif
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
-
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsRunnable, nsIRunnable)
   
 NS_IMETHODIMP
@@ -56,8 +54,6 @@ nsRunnable::Run()
   // Do nothing
   return NS_OK;
 }
-
-#endif  // XPCOM_GLUE_AVOID_NSPR
 
 //-----------------------------------------------------------------------------
 
@@ -154,7 +150,6 @@ NS_DispatchToMainThread(nsIRunnable *eve
   return thread->Dispatch(event, dispatchFlags);
 }
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
 NS_METHOD
 NS_ProcessPendingEvents(nsIThread *thread, PRIntervalTime timeout)
 {
@@ -185,7 +180,6 @@ NS_ProcessPendingEvents(nsIThread *threa
   }
   return rv;
 }
-#endif // XPCOM_GLUE_AVOID_NSPR
 
 PRBool
 NS_HasPendingEvents(nsIThread *thread)
diff --git a/xpcom/glue/nsThreadUtils.h b/xpcom/glue/nsThreadUtils.h
--- a/xpcom/glue/nsThreadUtils.h
+++ b/xpcom/glue/nsThreadUtils.h
@@ -134,7 +134,6 @@ NS_DispatchToMainThread(nsIRunnable *eve
 NS_DispatchToMainThread(nsIRunnable *event,
                         PRUint32 dispatchFlags = NS_DISPATCH_NORMAL);
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
 /**
  * Process all pending events for the given thread before returning.  This
  * method simply calls ProcessNextEvent on the thread while HasPendingEvents
@@ -153,7 +152,6 @@ extern NS_COM_GLUE NS_METHOD
 extern NS_COM_GLUE NS_METHOD
 NS_ProcessPendingEvents(nsIThread *thread,
                         PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT);
-#endif
 
 /**
  * Shortcut for nsIThread::HasPendingEvents.
@@ -221,8 +219,6 @@ extern NS_COM_GLUE nsIThread *NS_GetCurr
 
 //-----------------------------------------------------------------------------
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
-
 #undef  IMETHOD_VISIBILITY
 #define IMETHOD_VISIBILITY NS_COM_GLUE
 
@@ -285,8 +281,6 @@ private:
 //
 #define NS_NEW_RUNNABLE_METHOD(class_, obj_, method_) \
     new nsRunnableMethod<class_>(obj_, &class_::method_)
-
-#endif  // XPCOM_GLUE_AVOID_NSPR
 
 // This class is designed to be used when you have an event class E that has a
 // pointer back to resource class R.  If R goes away while E is still pending,
diff --git a/xpcom/glue/nsXPCOMGlue.h b/xpcom/glue/nsXPCOMGlue.h
new file mode 100644
--- /dev/null
+++ b/xpcom/glue/nsXPCOMGlue.h
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * 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
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Benjamin Smedberg <benjamin@smedbergs.us>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * 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"),
+ * 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
+ * use your version of this file under the terms of the MPL, indicate your
+ * 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
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsXPCOMGlue_h__
+#define nsXPCOMGlue_h__
+
+#include "nscore.h"
+
+class nsILocalFile;
+
+/**
+ * The following function is available in both the standalone and
+ * dynamically linked versions of the glue.
+ */
+
+struct GREVersionRange {
+    const char *lower;
+    PRBool      lowerInclusive;
+    const char *upper;
+    PRBool      upperInclusive;
+};
+
+struct GREProperty {
+    const char *property;
+    const char *value;
+};
+
+/**
+ * Locate the path of the xpcom shared library from a GRE with specified
+ * properties.
+ * 
+ * @param versions         An array of version ranges: if any version range
+ *                         matches, the GRE is considered acceptable.
+ * @param versionsLength   The length of the versions array.
+ * @param properties       A null-terminated list of GRE property/value pairs
+ *                         which must all be satisfied.
+ * @param propertiesLength Length of the properties array.
+ * @param buffer           A buffer to be filled with the appropriate path. If
+ *                         the "local" GRE is specified (via the USE_LOCAL_GRE
+ *                         environment variable, for example), this buffer
+ *                         will be set to the empty string.
+ * @param buflen           The length of buffer. This must be at least
+ *                         PATH_MAX/MAXPATHLEN.
+ * @throws NS_ERROR_FAILURE if an appropriate GRE could not be found.
+ * @note The properties parameter is ignored on macintosh, because of the
+ *       manner in which the XUL frameworks are installed by version.
+ * @note Currently this uses a "first-fit" algorithm, it does not select
+ *       the newest available GRE.
+ */
+extern "C" NS_COM_GLUE nsresult
+GRE_GetGREPathWithProperties(const GREVersionRange *versions,
+                             PRUint32 versionsLength,
+                             const GREProperty *properties,
+                             PRUint32 propertiesLength,
+                             char *buffer, PRUint32 buflen);
+
+#ifdef XPCOM_GLUE
+
+/**
+ * The following functions are only available in the standalone glue.
+ */
+
+/**
+ * Initialize the XPCOM glue by dynamically linking against the XPCOM
+ * shared library indicated by xpcomFile.
+ */
+extern "C" NS_HIDDEN_(nsresult)
+XPCOMGlueStartup(const char* xpcomFile);
+
+typedef void (*NSFuncPtr)();
+
+struct nsDynamicFunctionLoad
+{
+    const char *functionName;
+    NSFuncPtr  *function;
+};
+
+/**
+ * Dynamically load functions from libxul.
+ *
+ * @throws NS_ERROR_NOT_INITIALIZED if XPCOMGlueStartup() was not called or
+ *         if the libxul DLL was not found.
+ * @throws NS_ERROR_LOSS_OF_SIGNIFICANT_DATA if only some of the required
+ *         functions were found.
+ */
+extern "C" NS_HIDDEN_(nsresult)
+XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols);
+
+/**
+ * Finish the XPCOM glue after it is no longer needed.
+ */
+extern "C" NS_HIDDEN_(nsresult)
+XPCOMGlueShutdown();
+
+#endif // XPCOM_GLUE
+#endif // nsXPCOMGlue_h__
diff --git a/xpcom/glue/standalone/nsXPCOMGlue.h b/xpcom/glue/standalone/nsXPCOMGlue.h
deleted file mode 100644
--- a/xpcom/glue/standalone/nsXPCOMGlue.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * 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
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Benjamin Smedberg <benjamin@smedbergs.us>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * 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"),
- * 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
- * use your version of this file under the terms of the MPL, indicate your
- * 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
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsXPCOMGlue_h__
-#define nsXPCOMGlue_h__
-
-#include "nscore.h"
-
-class nsILocalFile;
-
-/**
- * The following function is available in both the standalone and
- * dynamically linked versions of the glue.
- */
-
-struct GREVersionRange {
-    const char *lower;
-    PRBool      lowerInclusive;
-    const char *upper;
-    PRBool      upperInclusive;
-};
-
-struct GREProperty {
-    const char *property;
-    const char *value;
-};
-
-/**
- * Locate the path of the xpcom shared library from a GRE with specified
- * properties.
- * 
- * @param versions         An array of version ranges: if any version range
- *                         matches, the GRE is considered acceptable.
- * @param versionsLength   The length of the versions array.
- * @param properties       A null-terminated list of GRE property/value pairs
- *                         which must all be satisfied.
- * @param propertiesLength Length of the properties array.
- * @param buffer           A buffer to be filled with the appropriate path. If
- *                         the "local" GRE is specified (via the USE_LOCAL_GRE
- *                         environment variable, for example), this buffer
- *                         will be set to the empty string.
- * @param buflen           The length of buffer. This must be at least
- *                         PATH_MAX/MAXPATHLEN.
- * @throws NS_ERROR_FAILURE if an appropriate GRE could not be found.
- * @note The properties parameter is ignored on macintosh, because of the
- *       manner in which the XUL frameworks are installed by version.
- * @note Currently this uses a "first-fit" algorithm, it does not select
- *       the newest available GRE.
- */
-extern "C" NS_COM_GLUE nsresult
-GRE_GetGREPathWithProperties(const GREVersionRange *versions,
-                             PRUint32 versionsLength,
-                             const GREProperty *properties,
-                             PRUint32 propertiesLength,
-                             char *buffer, PRUint32 buflen);
-
-#ifdef XPCOM_GLUE
-
-/**
- * The following functions are only available in the standalone glue.
- */
-
-/**
- * Initialize the XPCOM glue by dynamically linking against the XPCOM
- * shared library indicated by xpcomFile.
- */
-extern "C" NS_HIDDEN_(nsresult)
-XPCOMGlueStartup(const char* xpcomFile);
-
-typedef void (*NSFuncPtr)();
-
-struct nsDynamicFunctionLoad
-{
-    const char *functionName;
-    NSFuncPtr  *function;
-};
-
-/**
- * Dynamically load functions from libxul.
- *
- * @throws NS_ERROR_NOT_INITIALIZED if XPCOMGlueStartup() was not called or
- *         if the libxul DLL was not found.
- * @throws NS_ERROR_LOSS_OF_SIGNIFICANT_DATA if only some of the required
- *         functions were found.
- */
-extern "C" NS_HIDDEN_(nsresult)
-XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols);
-
-/**
- * Finish the XPCOM glue after it is no longer needed.
- */
-extern "C" NS_HIDDEN_(nsresult)
-XPCOMGlueShutdown();
-
-#endif // XPCOM_GLUE
-#endif // nsXPCOMGlue_h__
diff --git a/xpcom/sample/Makefile.in b/xpcom/sample/Makefile.in
--- a/xpcom/sample/Makefile.in
+++ b/xpcom/sample/Makefile.in
@@ -42,9 +42,6 @@ VPATH		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
-
-# This makefile builds the "program" subdirectory.
-DIRS = program
 
 # MODULE specifies where header files from this Makefile are installed,
 # i.e. dist/include/xpcomsample
diff --git a/xpcom/sample/program/Makefile.in b/xpcom/sample/program/Makefile.in
deleted file mode 100644
--- a/xpcom/sample/program/Makefile.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# 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
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Benjamin Smedberg <benjamin@smedbergs.us>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# 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"),
-# 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
-# use your version of this file under the terms of the MPL, indicate your
-# 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
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= xpcomsample
-
-# We must specify CPPSRCS in order to link using the proper c++ linker
-# on certain platforms.
-CPPSRCS = nsTestSample.cpp
-
-# SIMPLE_PROGRAMS compiles a single .cpp file into an executable
-SIMPLE_PROGRAMS = nsTestSample$(BIN_SUFFIX)
-
-# LIBS specifies linker flags when building an executable program from
-# this Makefile. We link against the "standalone glue" which does not require
-# that the application be linked against the XPCOM dynamic library or the NSPR
-# dynamic libraries.
-LIBS            = \
-		$(XPCOM_STANDALONE_GLUE_LDOPTS) \
-		$(NULL)
-
-# Need to link with CoreFoundation on Mac
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-LIBS            += \
-		$(TK_LIBS) \
-		$(NULL)
-endif
-
-# Whatever code is going to be linked with the *standalone* glue must be
-# built with the XPCOM_GLUE define set.
-DEFINES += -DXPCOM_GLUE
-
-include $(topsrcdir)/config/rules.mk
diff --git a/xpcom/sample/program/nsTestSample.cpp b/xpcom/sample/program/nsTestSample.cpp
deleted file mode 100644
--- a/xpcom/sample/program/nsTestSample.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * 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
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Suresh Duddi <dp@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * 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"),
- * 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
- * use your version of this file under the terms of the MPL, indicate your
- * 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
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-/**
- * A Test application that exercises the sample moudule. This is intented
- * to be a sample application for using xpcom standalone.
- */
-
-#include <stdio.h>
-
-#include "nsXPCOMGlue.h"
-#include "nsXPCOM.h"
-#include "nsCOMPtr.h"
-#include "nsISample.h"
-#include "nsIServiceManager.h"
-#include "nsIComponentManager.h"
-#include "nsIComponentRegistrar.h"
-
-#define NS_SAMPLE_CONTRACTID "@mozilla.org/sample;1"
-
-int
-main(void)
-{
-    nsresult rv;
-
-    XPCOMGlueStartup(nsnull);
-
-    // Initialize XPCOM
-    nsCOMPtr<nsIServiceManager> servMan;
-    rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
-    if (NS_FAILED(rv))
-    {
-        printf("ERROR: XPCOM intialization error [%x].\n", rv);
-        return -1;
-    }
-    // register all components in our default component directory
-    nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
-    NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
-    registrar->AutoRegister(nsnull);
-    
-    nsCOMPtr<nsIComponentManager> manager = do_QueryInterface(registrar);
-    NS_ASSERTION(registrar, "Null nsIComponentManager");
-    
-    // Create an instance of our component
-    nsCOMPtr<nsISample> mysample;
-    rv = manager->CreateInstanceByContractID(NS_SAMPLE_CONTRACTID,
-                                             nsnull,
-                                             NS_GET_IID(nsISample),
-                                             getter_AddRefs(mysample));
-    if (NS_FAILED(rv))
-    {
-        printf("ERROR: Cannot create instance of component " NS_SAMPLE_CONTRACTID " [%x].\n"
-               "Debugging hint:\n"
-               "\tsetenv NSPR_LOG_MODULES nsComponentManager:5\n"
-               "\tsetenv NSPR_LOG_FILE xpcom.log\n"
-               "\t./nsTestSample\n"
-               "\t<check the contents for xpcom.log for possible cause of error>.\n",
-               rv);
-        return -2;
-    }
-
-    // Call methods on our sample to test it out.
-    rv = mysample->WriteValue("Inital print:");
-    if (NS_FAILED(rv))
-    {
-        printf("ERROR: Calling nsISample::WriteValue() [%x]\n", rv);
-        return -3;
-    }
-
-    const char *testValue = "XPCOM defies gravity";
-    rv = mysample->SetValue(testValue);
-    if (NS_FAILED(rv))
-    {
-        printf("ERROR: Calling nsISample::SetValue() [%x]\n", rv);
-        return -3;
-    }
-    printf("Set value to: %s\n", testValue);
-    char *str;
-    rv = mysample->GetValue(&str);
-
-    if (NS_FAILED(rv))
-    {
-        printf("ERROR: Calling nsISample::GetValue() [%x]\n", rv);
-        return -3;
-    }
-    if (strcmp(str, testValue))
-    {
-        printf("Test FAILED.\n");
-        return -4;
-    }
-
-    NS_Free(str);
-
-    rv = mysample->WriteValue("Final print :");
-    printf("Test passed.\n");
-    
-    // All nsCOMPtr's must be deleted prior to calling shutdown XPCOM
-    // as we should not hold references passed XPCOM Shutdown.
-    servMan = 0;
-    registrar = 0;
-    manager = 0;
-    mysample = 0;
-    
-    // Shutdown XPCOM
-    NS_ShutdownXPCOM(nsnull);
-
-    XPCOMGlueShutdown();
-    return 0;
-}
diff --git a/xpcom/tools/Makefile.in b/xpcom/tools/Makefile.in
deleted file mode 100644
--- a/xpcom/tools/Makefile.in
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# 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
-# 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
-# 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"),
-# 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
-# use your version of this file under the terms of the MPL, indicate your
-# 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
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= xpcom
-DIRS		= registry
-
-include $(topsrcdir)/config/rules.mk
-
diff --git a/xpcom/tools/registry/Makefile.in b/xpcom/tools/registry/Makefile.in
deleted file mode 100644
--- a/xpcom/tools/registry/Makefile.in
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# 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
-# 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
-# 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"),
-# 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
-# use your version of this file under the terms of the MPL, indicate your
-# 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
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= xpcom
-CPPSRCS		= regxpcom.cpp
-
-DEFINES		+= -DXPCOM_GLUE
-
-LOCAL_INCLUDES	= \
-		-I$(srcdir)/../../build \
-		$(NULL)
-
-SIMPLE_PROGRAMS	= $(CPPSRCS:.cpp=$(BIN_SUFFIX))
-
-LIBS            = \
-		$(XPCOM_STANDALONE_GLUE_LDOPTS) \
-		$(NULL)
-
-# Need to link with CoreFoundation on Mac
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-LIBS            += \
-		$(TK_LIBS) \
-		$(NULL)
-endif
-
-SDK_BINARY     =                    \
-		$(SIMPLE_PROGRAMS)  \
-		$(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
diff --git a/xpcom/tools/registry/regxpcom.cpp b/xpcom/tools/registry/regxpcom.cpp
deleted file mode 100644
--- a/xpcom/tools/registry/regxpcom.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * 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
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Pierre Phaneuf <pp@ludusdesign.com>
- *   Mike Shaver <shaver@mozilla.org>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * 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"),
- * 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
- * use your version of this file under the terms of the MPL, indicate your
- * 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
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "stdlib.h"
-#include "prenv.h"
-#include "nspr.h"
-
-#include "nsXPCOMPrivate.h" // for XPCOM_DLL defines.
-
-#include "nsXPCOMGlue.h"
-#include "nsIComponentManager.h"
-#include "nsIComponentRegistrar.h"
-#include "nsIServiceManager.h"
-#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
-#include "nsEmbedString.h"
-#include "nsIDirectoryService.h"
-#include "nsDirectoryServiceDefs.h"
-
-
-static PRBool gUnreg = PR_FALSE, gQuiet = PR_FALSE;
-
-static const char* gXPCOMLocation = nsnull;
-static const char* gCompRegLocation = nsnull;
-static const char* gXPTIDatLocation = nsnull;
-
-class DirectoryServiceProvider : public nsIDirectoryServiceProvider
-{
-  public:
-  DirectoryServiceProvider() {}
-  
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDIRECTORYSERVICEPROVIDER
-
-  private:
-  ~DirectoryServiceProvider() {}
-};
-
-NS_IMPL_ISUPPORTS1(DirectoryServiceProvider, nsIDirectoryServiceProvider)
-
-NS_IMETHODIMP
-DirectoryServiceProvider::GetFile(const char *prop, PRBool *persistent, nsIFile **_retval)
-{    
-  nsCOMPtr<nsILocalFile> localFile;
-  nsresult rv = NS_ERROR_FAILURE;
-
-  *_retval = nsnull;
-  *persistent = PR_TRUE;
-
-  const char* fileLocation = nsnull;
-
-  if(strcmp(prop, NS_XPCOM_CURRENT_PROCESS_DIR) == 0 && gXPCOMLocation)
-  {
-    fileLocation = gXPCOMLocation;
-  }
-  else if(strcmp(prop, NS_XPCOM_COMPONENT_REGISTRY_FILE) == 0 && gCompRegLocation)
-  {
-    fileLocation = gCompRegLocation;
-  }    
-  else if(strcmp(prop, NS_XPCOM_XPTI_REGISTRY_FILE) == 0 && gXPTIDatLocation)
-  {
-    fileLocation = gXPTIDatLocation;
-  }
-  else
-    return NS_ERROR_FAILURE;
-
-  rv = NS_NewNativeLocalFile(nsEmbedCString(fileLocation), PR_TRUE, getter_AddRefs(localFile));  
-  if (NS_FAILED(rv)) return rv;
-
-  return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval);
-}
-
-int startup_xpcom()
-{
-  nsresult rv;
-
-  if (gXPCOMLocation) {
-    int len = strlen(gXPCOMLocation);
-    char* xpcomPath = (char*) malloc(len + sizeof(XPCOM_DLL) + sizeof(XPCOM_FILE_PATH_SEPARATOR) + 1);
-    sprintf(xpcomPath, "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL, gXPCOMLocation);
-
-    rv = XPCOMGlueStartup(xpcomPath);
-
-    free(xpcomPath);
-
-    const char* path = getenv(XPCOM_SEARCH_KEY);
-    if (!path) {
-      path = "";
-    }
-  }
-  else 
-  {
-    rv = XPCOMGlueStartup(nsnull);
-  }
-
-  if (NS_FAILED(rv)) 
-  {
-    printf("Can not initialize XPCOM Glue\n");
-    return -1;
-  }
-
-  DirectoryServiceProvider *provider = new DirectoryServiceProvider();
-  if ( !provider )
-  {
-    NS_WARNING("GRE_Startup failed");
-    XPCOMGlueShutdown();
-    return -1;
-  }
-
-  nsCOMPtr<nsILocalFile> file;
-  if (gXPCOMLocation) 
-  {
-    rv = NS_NewNativeLocalFile(nsEmbedCString(gXPCOMLocation), 
-                               PR_TRUE, 
-                               getter_AddRefs(file));
-  }
-
-  NS_ADDREF(provider);
-  rv = NS_InitXPCOM2(nsnull, file, provider);
-  NS_RELEASE(provider);
-    
-  if (NS_FAILED(rv)) {
-    printf("Can not initialize XPCOM\n");
-    XPCOMGlueShutdown();
-    return -1;
-  }
-
-  return 0;
-}
-
-void shutdown_xpcom()
-{
-  nsresult rv;
-
-  rv = NS_ShutdownXPCOM(nsnull);
-
-  if (NS_FAILED(rv)) {
-    printf("Can not shutdown XPCOM cleanly\n");
-  }
-
-  rv = XPCOMGlueShutdown();
-  
-  if (NS_FAILED(rv)) {
-    printf("Can not shutdown XPCOM Glue cleanly\n");
-  }
-}
-
-
-nsresult Register(const char *path) 
-{ 
-  startup_xpcom();
-
-  nsresult rv;
-  nsCOMPtr<nsILocalFile> spec;
-  
-  if (path) {
-    rv = NS_NewNativeLocalFile(nsEmbedCString(path), 
-                               PR_TRUE, 
-                               getter_AddRefs(spec));
-  }
-
-  nsCOMPtr<nsIComponentRegistrar> registrar;
-  rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
-  if (NS_FAILED(rv)) {
-    printf("Can not aquire component registrar\n");
-    return rv;
-  }
-
-  if (gUnreg)
-    rv = registrar->AutoUnregister(spec);
-  else
-    rv = registrar->AutoRegister(spec);
-
-  spec = 0;
-  registrar = 0;
-
-  shutdown_xpcom();
-  return rv;
-}
-
-
-void ReportSuccess(const char *file)
-{
-  if (gQuiet)
-    return;
-
-  if (gUnreg)
-    printf("Unregistration successful for %s\n", file);
-  else
-    printf("Registration successful for %s\n", file);
-}
-
-void ReportError(nsresult err, const char *file)
-{
-  if (gUnreg)
-    printf("Unregistration failed: (");
-  else
-    printf("Registration failed: (");
-  
-  switch (err) 
-  {
-    case NS_ERROR_FACTORY_NOT_LOADED:
-      printf("Factory not loaded");
-      break;
-    case NS_NOINTERFACE:
-      printf("No Interface");
-      break;
-    case NS_ERROR_NULL_POINTER:
-      printf("Null pointer");
-      break;
-    case NS_ERROR_OUT_OF_MEMORY:
-      printf("Out of memory");
-      break;
-    default:
-      printf("%x", (unsigned)err);
-  }
-  
-  printf(") %s\n", file);
-}
-
-void printHelp()
-{
-  printf(
-"Mozilla regxpcom - a registration tool for xpcom components                    \n"
-"                                                                               \n"
-"Usage: regxpcom [options] [file-or-directory]                                  \n"
-"                                                                               \n"
-"Options:                                                                       \n"
-"         -x path        Specifies the location of a directory containing the   \n"
-"                        xpcom library which will be used when registering new  \n"
-"                        component libraries.  This path will also be added to  \n"
-"                        the \"load library\" path.  If not specified, the      \n"
-"                        current working directory will be used.                \n"
-"         -c path        Specifies the location of the compreg.dat file.  If    \n"
-"                        not specified, the compreg.dat file will be in its     \n"
-"                        default location.                                      \n"
-"         -d path        Specifies the location of the xpti.dat file.  If not   \n"
-"                        specified, the xpti.dat file will be in its default    \n"
-"                        location.                                              \n"
-"         -a             Option to register all files in the default component  \n"
-"                        directories.  This is the default behavior if regxpcom \n"
-"                        is called without any arguments.                       \n"
-"         -h             Displays this help screen.  Must be the only option    \n"
-"                        specified.                                             \n"
-"         -u             Option to uninstall the files-or-directory instead of  \n"
-"                        registering them.                                      \n"
-"         -q             Quiets some of the output of regxpcom.                 \n\n");
-}
-
-int ProcessArgs(int argc, char *argv[])
-{
-  int i = 1, result = 0;
-  nsresult res;
-
-  while (i < argc) 
-  {
-    if (argv[i][0] == '-') 
-    {
-      int j;
-      for (j = 1; argv[i][j] != '\0'; j++) 
-      {
-        switch (argv[i][j]) 
-        {
-          case 'h':
-            printHelp();
-            return 0;  // we are all done!
-
-          case 'u':
-            gUnreg = PR_TRUE;
-            break;
-
-          case 'q':
-            gQuiet = PR_TRUE;
-            break;
-
-          case 'a':
-          {
-            res = Register(nsnull);
-            if (NS_FAILED(res)) 
-            {
-              ReportError(res, "component directory");
-              result = -1;
-            } 
-            else 
-            {
-              ReportSuccess("component directory");
-            }
-          }
-          break;
-
-          case 'x':
-            gXPCOMLocation = argv[++i];
-            j = strlen(gXPCOMLocation) - 1;
-            break;
-
-          case 'c':
-            gCompRegLocation = argv[++i];
-            j = strlen(gCompRegLocation) - 1;
-            break;
-
-          case 'd':
-            gXPTIDatLocation = argv[++i];
-            j = strlen(gXPTIDatLocation) - 1;
-            break;
-
-          default:
-            printf("Unknown option '%c'\n", argv[i][j]);
-        }
-      }
-    } 
-    else
-    {
-      res = Register(argv[i]);
-      
-      if (NS_FAILED(res)) 
-      {
-        ReportError(res, argv[i]);
-        result = -1;
-      } 
-      else 
-      {
-        ReportSuccess(argv[i]);
-      }
-    }
-    i++;
-  }
-  return result;
-}
-
-
-int main(int argc, char *argv[])
-{
-  int ret;
-  nsresult rv;
-
-  /* With no arguments, regxpcom will autoregister */
-  if (argc <= 1)
-  {
-    startup_xpcom();
-    nsCOMPtr<nsIComponentRegistrar> registrar;
-    rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
-    if (NS_FAILED(rv)) {
-      printf("Can not aquire component registrar\n");
-      return -1;
-    }
-    rv = registrar->AutoRegister(nsnull);
-    ret = (NS_FAILED(rv)) ? -1 : 0;
-    registrar = 0;
-    shutdown_xpcom();
-  } else
-    ret = ProcessArgs(argc, argv);
-
-  return ret;
-}