]> granicus.if.org Git - icu/commitdiff
ICU-9474 Reduce unrename.h namespace pollution
authorGeorge Rhoten <grhoten@users.noreply.github.com>
Sat, 11 Aug 2012 04:57:13 +0000 (04:57 +0000)
committerGeorge Rhoten <grhoten@users.noreply.github.com>
Sat, 11 Aug 2012 04:57:13 +0000 (04:57 +0000)
X-SVN-Rev: 32157

icu4c/source/common/ucln.h
icu4c/source/common/ucln_cmn.c
icu4c/source/common/uinit.c
icu4c/source/common/unicode/urename.h
icu4c/source/i18n/colldata.cpp
icu4c/source/i18n/decContext.c
icu4c/source/i18n/decNumber.c
icu4c/source/i18n/decNumberLocal.h
icu4c/source/tools/genren/genren.pl

index 951ad192d91081f47cecffa3dce8aae28c268bce..47f082a154ec900182a38bb634d9c63db4c204b8 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-* Copyright (C) 2001-2011, International Business Machines
+* Copyright (C) 2001-2012, International Business Machines
 *                Corporation and others. All Rights Reserved.
 *
 ******************************************************************************
@@ -69,6 +69,7 @@ typedef enum ECleanupLibraryType {
  */
 U_CDECL_BEGIN
 typedef UBool U_CALLCONV cleanupFunc(void);
+typedef void U_CALLCONV initFunc(UErrorCode *);
 U_CDECL_END
 
 /**
@@ -87,11 +88,6 @@ U_CAPI void U_EXPORT2 ucln_registerCleanup(ECleanupLibraryType type,
 U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType type);
 
 /* ucln_cmn.c variables shared with uinit.c */
-U_CDECL_BEGIN
-
-extern UBool gICUInitialized;
-extern UMTX  gICUInitMutex;
-
-U_CDECL_END
+U_CFUNC UBool ucln_mutexedInit(initFunc *func, UErrorCode *status);
 
 #endif
index 45358736bd25a8a9e9aafc8efc6256ccc4da1f5c..a7776ba4a6f9656049accd03377f4f9cdcc46dfe 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ******************************************************************************
-* Copyright (C) 2001-2011, International Business Machines
+* Copyright (C) 2001-2012, International Business Machines
 *                Corporation and others. All Rights Reserved.
 ******************************************************************************
 *   file name:  ucln_cmn.c
 #define UCLN_TYPE_IS_COMMON
 #include "ucln_imp.h"
 
-U_CDECL_BEGIN
-
-UBool gICUInitialized = FALSE;
-UMTX  gICUInitMutex   = NULL;
-
-U_CDECL_END
+static UBool gICUInitialized = FALSE;
+static UMTX  gICUInitMutex   = NULL;
 
 static cleanupFunc *gCommonCleanupFunctions[UCLN_COMMON_COUNT];
 static cleanupFunc *gLibCleanupFunctions[UCLN_COMMON];
 
+U_CFUNC UBool ucln_mutexedInit(initFunc *func, UErrorCode *status) {
+    UBool initialized = FALSE;
+    umtx_lock(&gICUInitMutex);
+    if (!gICUInitialized && U_SUCCESS(*status)) {
+        if (func != NULL) {
+            func(status);
+        }
+        gICUInitialized = TRUE;    /* TODO:  don't set if U_FAILURE? */
+        initialized = TRUE;
+    }
+    umtx_unlock(&gICUInitMutex);
+    return initialized;
+}
+
 /************************************************
  The cleanup order is important in this function.
  Please be sure that you have read ucln.h
index bdbf9102e3bf41ead2f95f59cafb291f252f0e0b..44d496acbd474e5d779e43a8a3d22ddbd5435644 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *                                                                            *
-* Copyright (C) 2001-2011, International Business Machines                   *
+* Copyright (C) 2001-2012, International Business Machines                   *
 *                Corporation and others. All Rights Reserved.                *
 *                                                                            *
 ******************************************************************************
 #include "umutex.h"
 #include "utracimp.h"
 
-/*
- * ICU Initialization Function. Need not be called.
- */
-U_CAPI void U_EXPORT2
-u_init(UErrorCode *status) {
-    UTRACE_ENTRY_OC(UTRACE_U_INIT);
-    /* initialize plugins */
-    uplug_init(status);
-
-    umtx_lock(&gICUInitMutex);
-    if (gICUInitialized || U_FAILURE(*status)) {
-        umtx_unlock(&gICUInitMutex);
-        UTRACE_EXIT_STATUS(*status);
-        return;
-    }
-
+static void U_CALLCONV
+initData(UErrorCode *status)
+{
     /*
      * 2005-may-02
      *
@@ -55,8 +42,18 @@ u_init(UErrorCode *status) {
 #if !UCONFIG_NO_CONVERSION
     ucnv_io_countKnownConverters(status);
 #endif
+}
+
+/*
+ * ICU Initialization Function. Need not be called.
+ */
+U_CAPI void U_EXPORT2
+u_init(UErrorCode *status) {
+    UTRACE_ENTRY_OC(UTRACE_U_INIT);
+
+    /* initialize plugins */
+    uplug_init(status);
+    ucln_mutexedInit(initData, status);
 
-    gICUInitialized = TRUE;    /* TODO:  don't set if U_FAILURE? */
-    umtx_unlock(&gICUInitMutex);
     UTRACE_EXIT_STATUS(*status);
 }
index 04c14880d538af6d9c15a720c3877ede74cfc91a..a66b47d6794fb8cfa90c6e8b7d0a691ec4dbbaa6 100644 (file)
@@ -23,7 +23,7 @@
 
 /* U_DISABLE_RENAMING can be defined in the following ways:
  *   - when running configure, e.g.
- *        runConfigureICU Linux CPPFLAGS="-DU_DISABLE_RENAMING"
+ *        runConfigureICU Linux --disable-renaming
  *   - by changing the default setting of U_DISABLE_RENAMING in uconfig.h
  */
 
@@ -53,8 +53,6 @@
 
 /* C exports renaming data */
 
-#define DECPOWERS U_ICU_ENTRY_POINT_RENAME(DECPOWERS)
-#define DECSTICKYTAB U_ICU_ENTRY_POINT_RENAME(DECSTICKYTAB)
 #define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString)
 #define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString)
 #define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger)
 #define bms_setTargetString U_ICU_ENTRY_POINT_RENAME(bms_setTargetString)
 #define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup)
 #define cmemory_inUse U_ICU_ENTRY_POINT_RENAME(cmemory_inUse)
-#define d2utable U_ICU_ENTRY_POINT_RENAME(d2utable)
-#define deleteCEList U_ICU_ENTRY_POINT_RENAME(deleteCEList)
-#define deleteChars U_ICU_ENTRY_POINT_RENAME(deleteChars)
-#define deleteCollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(deleteCollDataCacheEntry)
-#define deleteStringList U_ICU_ENTRY_POINT_RENAME(deleteStringList)
-#define deleteUnicodeStringKey U_ICU_ENTRY_POINT_RENAME(deleteUnicodeStringKey)
-#define gICUInitMutex U_ICU_ENTRY_POINT_RENAME(gICUInitMutex)
-#define gICUInitialized U_ICU_ENTRY_POINT_RENAME(gICUInitialized)
 #define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone)
 #define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close)
 #define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals)
 #define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup)
 #define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup)
 #define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup)
+#define ucln_mutexedInit U_ICU_ENTRY_POINT_RENAME(ucln_mutexedInit)
 #define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup)
 #define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32)
 #define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets)
 #define ucol_findReorderingEntry U_ICU_ENTRY_POINT_RENAME(ucol_findReorderingEntry)
 #define ucol_forceHanImplicit U_ICU_ENTRY_POINT_RENAME(ucol_forceHanImplicit)
 #define ucol_forgetUCA U_ICU_ENTRY_POINT_RENAME(ucol_forgetUCA)
-#define ucol_freeOffsetBuffer U_ICU_ENTRY_POINT_RENAME(ucol_freeOffsetBuffer)
 #define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute)
 #define ucol_getAttributeOrDefault U_ICU_ENTRY_POINT_RENAME(ucol_getAttributeOrDefault)
 #define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable)
 #define ucol_tok_assembleTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_assembleTokenList)
 #define ucol_tok_closeTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_closeTokenList)
 #define ucol_tok_getNextArgument U_ICU_ENTRY_POINT_RENAME(ucol_tok_getNextArgument)
-#define ucol_tok_getRulesFromBundle U_ICU_ENTRY_POINT_RENAME(ucol_tok_getRulesFromBundle)
 #define ucol_tok_initTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_initTokenList)
 #define ucol_tok_parseNextToken U_ICU_ENTRY_POINT_RENAME(ucol_tok_parseNextToken)
 #define ucol_updateInternalState U_ICU_ENTRY_POINT_RENAME(ucol_updateInternalState)
 #define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault)
 #define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration)
 #define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration)
+#define uenum_openUCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openUCharStringsEnumeration)
 #define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset)
 #define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext)
 #define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault)
 #define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod)
 #define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free)
 #define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters)
-#define uprv_getDefaultCodepage U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultCodepage)
 #define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID)
 #define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity)
 #define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength)
index 946568b1e1ccd47e6412f18f851f7ef26910acda..a488ea07726a8b048f898ee67addd5af6a2fcf98 100644 (file)
@@ -287,7 +287,41 @@ int32_t StringList::size() const
 }
 
 
-U_CFUNC void deleteStringList(void *obj);
+U_CDECL_BEGIN
+static void U_CALLCONV
+deleteStringList(void *obj)
+{
+    StringList *strings = (StringList *) obj;
+
+    delete strings;
+}
+static void U_CALLCONV
+deleteCEList(void *obj)
+{
+    CEList *list = (CEList *) obj;
+
+    delete list;
+}
+
+static void U_CALLCONV
+deleteUnicodeStringKey(void *obj)
+{
+    UnicodeString *key = (UnicodeString *) obj;
+
+    delete key;
+}
+
+static void U_CALLCONV
+deleteChars(void * /*obj*/)
+{
+    // char *chars = (char *) obj;
+    // All the key strings are owned by the
+    // CollData objects and don't need to
+    // be freed here.
+  //DELETE_ARRAY(chars);
+}
+
+U_CDECL_END
 
 class CEToStringsMap : public UMemory
 {
@@ -356,16 +390,6 @@ void CEToStringsMap::putStringList(uint32_t ce, StringList *stringList, UErrorCo
     uhash_iput(map, ce, (void *) stringList, &status);
 }
 
-U_CFUNC void deleteStringList(void *obj)
-{
-    StringList *strings = (StringList *) obj;
-
-    delete strings;
-}
-
-U_CFUNC void deleteCEList(void *obj);
-U_CFUNC void deleteUnicodeStringKey(void *obj);
-
 class StringToCEsMap : public UMemory
 {
 public:
@@ -417,20 +441,6 @@ const CEList *StringToCEsMap::get(const UnicodeString *string)
     return (const CEList *) uhash_get(map, string);
 }
 
-U_CFUNC void deleteCEList(void *obj)
-{
-    CEList *list = (CEList *) obj;
-
-    delete list;
-}
-
-U_CFUNC void deleteUnicodeStringKey(void *obj)
-{
-    UnicodeString *key = (UnicodeString *) obj;
-
-    delete key;
-}
-
 class CollDataCacheEntry : public UMemory
 {
 public:
@@ -472,21 +482,15 @@ private:
 };
 static UMTX lock;
 
-U_CFUNC void deleteChars(void * /*obj*/)
-{
-    // char *chars = (char *) obj;
-    // All the key strings are owned by the
-    // CollData objects and don't need to
-    // be freed here.
-  //DELETE_ARRAY(chars);
-}
-
-U_CFUNC void deleteCollDataCacheEntry(void *obj)
+U_CDECL_BEGIN
+static void U_CALLCONV
+deleteCollDataCacheEntry(void *obj)
 {
     CollDataCacheEntry *entry = (CollDataCacheEntry *) obj;
 
     delete entry;
 }
+U_CDECL_END
 
 CollDataCache::CollDataCache(UErrorCode &status)
     : cache(NULL)
index 3b162f26995c7ea8006829d2be98cf99cb7ef621..440272884a799181dd31ee581b92b03644405839 100644 (file)
@@ -1,7 +1,7 @@
 /* ------------------------------------------------------------------ */
 /* Decimal Context module                                             */
 /* ------------------------------------------------------------------ */
-/* Copyright (c) IBM Corporation, 2000-2011.  All rights reserved.    */
+/* Copyright (c) IBM Corporation, 2000-2012.  All rights reserved.    */
 /*                                                                    */
 /* This software is made available under the terms of the             */
 /* ICU License -- ICU 1.8.1 and later.                                */
@@ -32,17 +32,6 @@ static  const  Flag *mfctop=(Flag *)&mfcone; /* -> top byte  */
 #define LITEND *mfctop             /* named flag; 1=little-endian  */
 #endif
 
-/* ------------------------------------------------------------------ */
-/* round-for-reround digits                                           */
-/* ------------------------------------------------------------------ */
-const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */
-
-/* ------------------------------------------------------------------ */
-/* Powers of ten (powers[n]==10**n, 0<=n<=9)                          */
-/* ------------------------------------------------------------------ */
-const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000,
-                          10000000, 100000000, 1000000000};
-
 /* ------------------------------------------------------------------ */
 /* decContextClearStatus -- clear bits in current status              */
 /*                                                                    */
index df3ab52a60dd4e3098cc55f7071d898cd3210482..94b079068c406891c861995ed36263875a7d7ca9 100644 (file)
 
 /* Constants */
 /* Public lookup table used by the D2U macro  */
-const uByte d2utable[DECMAXD2U+1]=D2UTABLE;
+static const uByte d2utable[DECMAXD2U+1]=D2UTABLE;
 
 #define DECVERB     1              /* set to 1 for verbose DECCHECK  */
 #define powers      DECPOWERS      /* old internal name  */
@@ -212,6 +212,18 @@ const uByte d2utable[DECMAXD2U+1]=D2UTABLE;
 
 static const Unit uarrone[1]={1};   /* Unit array of 1, used for incrementing  */
 
+/* ------------------------------------------------------------------ */
+/* round-for-reround digits                                           */
+/* ------------------------------------------------------------------ */
+static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */
+
+/* ------------------------------------------------------------------ */
+/* Powers of ten (powers[n]==10**n, 0<=n<=9)                          */
+/* ------------------------------------------------------------------ */
+static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000,
+                          10000000, 100000000, 1000000000};
+
+
 /* Granularity-dependent code */
 #if DECDPUN<=4
   #define eInt  Int           /* extended integer  */
index 4a36723ea7e2a9ca132100fa37dfaabb844362f0..bf6d54b8b27a4c90654acee42d49cf241a1bcc63 100644 (file)
@@ -1,7 +1,7 @@
 /* ------------------------------------------------------------------ */
 /* decNumber package local type, tuning, and macro definitions        */
 /* ------------------------------------------------------------------ */
-/* Copyright (c) IBM Corporation, 2000-2010.   All rights reserved.   */
+/* Copyright (c) IBM Corporation, 2000-2012.   All rights reserved.   */
 /*                                                                    */
 /* This software is made available under the terms of the             */
 /* ICU License -- ICU 1.8.1 and later.                                */
     #define long    ??        /* .. or 'long' types are not used      */
   #endif
 
-  /* Shared lookup tables                                             */
-  extern const uByte  DECSTICKYTAB[10]; /* re-round digits if sticky  */
-  extern const uInt   DECPOWERS[10];    /* powers of ten table        */
-  /* The following are included from decDPD.h                         */
-  extern const uShort DPD2BIN[1024];    /* DPD -> 0-999               */
-  extern const uShort BIN2DPD[1000];    /* 0-999 -> DPD               */
-  extern const uInt   DPD2BINK[1024];   /* DPD -> 0-999000            */
-  extern const uInt   DPD2BINM[1024];   /* DPD -> 0-999000000         */
-  extern const uByte  DPD2BCD8[4096];   /* DPD -> ddd + len           */
-  extern const uByte  BIN2BCD8[4000];   /* 0-999 -> ddd + len         */
-  extern const uShort BCD2DPD[2458];    /* 0-0x999 -> DPD (0x999=2457)*/
-
   /* LONGMUL32HI -- set w=(u*v)>>32, where w, u, and v are uInts      */
   /* (that is, sets w to be the high-order word of the 64-bit result; */
   /* the low-order word is simply u*v.)                               */
   /* ----- Shared data (in decNumber.c) ----- */
   /* Public lookup table used by the D2U macro (see below)            */
   #define DECMAXD2U 49
-  extern const uByte d2utable[DECMAXD2U+1];
+  /*extern const uByte d2utable[DECMAXD2U+1];*/
 
   /* ----- Macros ----- */
   /* ISZERO -- return true if decNumber dn is a zero                  */
index 3afd8c432baf9c9e66051aaa1680a2075bf086f0..764da946a3d9f9335a373e67da1e1e60ad504d34 100755 (executable)
@@ -148,8 +148,9 @@ for(;@ARGV; shift(@ARGV)) {
             ($_, $address, $type) = split(/\|/);
             chop $qtype;
         } elsif ($mode =~ /Mach-O/) {
-            if(/^(?:[0-9a-fA-F]){8} ([A-Z]) (?:_)?(.*)$/) {
-                ($_, $type) = ($2, $1);
+            ($address, $type, $_) = split(/ /);
+            if(/^_(.*)$/) {
+                $_ = $1;
             } else {
                 next;
             }