diff options
Diffstat (limited to 'Build/source/libs/icu/icu-xetex/common/ucln_cmn.c')
-rw-r--r-- | Build/source/libs/icu/icu-xetex/common/ucln_cmn.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-xetex/common/ucln_cmn.c b/Build/source/libs/icu/icu-xetex/common/ucln_cmn.c new file mode 100644 index 00000000000..452e628bb38 --- /dev/null +++ b/Build/source/libs/icu/icu-xetex/common/ucln_cmn.c @@ -0,0 +1,74 @@ +/* +****************************************************************************** +* * +* Copyright (C) 2001-2006, International Business Machines * +* Corporation and others. All Rights Reserved. * +* * +****************************************************************************** +* file name: ucln_cmn.c +* encoding: US-ASCII +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001July05 +* created by: George Rhoten +*/ + +#include "unicode/utypes.h" +#include "unicode/uclean.h" +#include "utracimp.h" +#include "ustr_imp.h" +#include "unormimp.h" +#include "ucln_cmn.h" +#include "umutex.h" +#include "ucln.h" +#include "cmemory.h" +#include "uassert.h" + +static cleanupFunc *gCommonCleanupFunctions[UCLN_COMMON_COUNT]; +static cleanupFunc *gLibCleanupFunctions[UCLN_COMMON]; + +U_CFUNC void +ucln_common_registerCleanup(ECleanupCommonType type, + cleanupFunc *func) +{ + U_ASSERT(UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT); + if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT) + { + gCommonCleanupFunctions[type] = func; + } +} + +U_CAPI void U_EXPORT2 +ucln_registerCleanup(ECleanupLibraryType type, + cleanupFunc *func) +{ + U_ASSERT(UCLN_START < type && type < UCLN_COMMON); + if (UCLN_START < type && type < UCLN_COMMON) + { + gLibCleanupFunctions[type] = func; + } +} + +U_CFUNC UBool ucln_lib_cleanup(void) { + ECleanupLibraryType libType = UCLN_START; + ECleanupCommonType commonFunc = UCLN_COMMON_START; + + for (libType++; libType<UCLN_COMMON; libType++) { + if (gLibCleanupFunctions[libType]) + { + gLibCleanupFunctions[libType](); + gLibCleanupFunctions[libType] = NULL; + } + } + + for (commonFunc++; commonFunc<UCLN_COMMON_COUNT; commonFunc++) { + if (gCommonCleanupFunctions[commonFunc]) + { + gCommonCleanupFunctions[commonFunc](); + gCommonCleanupFunctions[commonFunc] = NULL; + } + } + return TRUE; +} + |