rv = compMgr->RegisterComponent(kLanguageAtomServiceCID, NULL, NULL, path, PR_TRUE, PR_TRUE); NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: Register LanguageAtomService failed."); if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* aServMgr, const char * path){  nsresult rv;  nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));  if (NS_FAILED(rv)) return rv;  nsIComponentManager* compMgr;  rv = servMgr->GetService(kComponentManagerCID,                            NS_GET_IID(nsIComponentManager),                            (nsISupports**)&compMgr);  if (NS_FAILED(rv)) return rv;  //   // register the generic factory   //   rv = compMgr->RegisterComponent(kLocaleFactoryCID,"nsLocale component",                                   NS_LOCALE_PROGID,path,PR_TRUE,PR_TRUE);   NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: RegisterFactory failed.");   if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;    //   // register the service    //   rv = compMgr->RegisterComponent(kLocaleServiceCID,"nsLocaleService component",                                   NS_LOCALESERVICE_PROGID,path,PR_TRUE,PR_TRUE);   if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;   //  // register the generic factory  //  rv = compMgr->RegisterComponent(kMacLocaleFactoryCID,NULL,NULL,path,PR_TRUE,PR_TRUE);  NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: RegisterFactory failed.");  if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  //  // register the collation factory  //  rv = compMgr->RegisterComponent(kCollationFactoryCID, NULL, NULL, path, PR_TRUE, PR_TRUE);  NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: Register CollationFactory failed.");  if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;    //  // register the collation interface  //  rv = compMgr->RegisterComponent(kCollationCID, NULL, NULL, path, PR_TRUE, PR_TRUE);  NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: Register Collation failed.");  if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;    //  // register the date time formatter  //  rv = compMgr->RegisterComponent(kDateTimeFormatCID, NULL, NULL, path, PR_TRUE, PR_TRUE);  NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: Register DateTimeFormat failed.");  if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;	//	// register the scriptable date time formatter	//	rv = compMgr->RegisterComponent(kScriptableDateFormatCID, "Scriptable Date Format",     NS_SCRIPTABLEDATEFORMAT_PROGID, path, PR_TRUE, PR_TRUE);	NS_ASSERTION(NS_SUCCEEDED(rv),"nsLocaleTest: Register ScriptableDateFormat failed.");  if (NS_FAILED(rv) && (NS_ERROR_FACTORY_EXISTS != rv)) goto done;  done:  (void)servMgr->ReleaseService(kComponentManagerCID, compMgr);  return rv;}