]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/ucln_in.c
ICU-6.2.14.tar.gz
[apple/icu.git] / icuSources / i18n / ucln_in.c
index 1f92321c35efeff5719f51c4d4411e03ccd2f5db..34653e079e6673eb1536389c431fc634dca0c56f 100644 (file)
@@ -1,11 +1,11 @@
 /*
 ******************************************************************************
 *                                                                            *
-* Copyright (C) 2001-2003, International Business Machines                   *
+* Copyright (C) 2001-2004, International Business Machines                   *
 *                Corporation and others. All Rights Reserved.                *
 *                                                                            *
 ******************************************************************************
-*   file name:  ucln_cmn.c
+*   file name:  ucln_in.c
 *   encoding:   US-ASCII
 *   tab size:   8 (not used)
 *   indentation:4
 
 #include "ucln.h"
 #include "ucln_in.h"
+#include "uassert.h"
 
 /* Leave this copyright notice here! It needs to go somewhere in this library. */
 static const char copyright[] = U_COPYRIGHT_STRING;
 
+static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
+
 static UBool i18n_cleanup(void)
 {
-#if !UCONFIG_NO_TRANSLITERATION
-    transliterator_cleanup();
-#endif
-
-#if !UCONFIG_NO_REGULAR_EXPRESSIONS
-    regex_cleanup();
-#endif
-
-#if !UCONFIG_NO_FORMATTING
-    calendar_cleanup();
-    numfmt_cleanup();
-    currency_cleanup();
-    timeZone_cleanup();
-#endif
-
-#if !UCONFIG_NO_COLLATION
-    collator_cleanup();
-    ucol_cleanup();
-    ucol_bld_cleanup();
-#endif
-
+    ECleanupI18NType libType;
+
+    for (libType = UCLN_I18N_START+1; libType<UCLN_I18N_COUNT; libType++) {
+        if (gCleanupFunctions[libType])
+        {
+            gCleanupFunctions[libType]();
+            gCleanupFunctions[libType] = NULL;
+        }
+    }
     return TRUE;
 }
 
-void ucln_i18n_registerCleanup()
+void ucln_i18n_registerCleanup(ECleanupI18NType type,
+                               cleanupFunc *func)
 {
+    U_ASSERT(UCLN_I18N_START < type && type < UCLN_I18N_COUNT);
     ucln_registerCleanup(UCLN_I18N, i18n_cleanup);
+    if (UCLN_I18N_START < type && type < UCLN_I18N_COUNT)
+    {
+        gCleanupFunctions[type] = func;
+    }
 }