1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru******************************************************************************
3b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*                                                                            *
450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho* Copyright (C) 2001-2009, International Business Machines                   *
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*                Corporation and others. All Rights Reserved.                *
6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*                                                                            *
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru******************************************************************************
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   file name:  ucln_in.c
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   encoding:   US-ASCII
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   tab size:   8 (not used)
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   indentation:4
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created on: 2001July05
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created by: George Rhoten
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "ucln.h"
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "ucln_in.h"
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "uassert.h"
20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
2150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**  Auto-client for UCLN_I18N **/
2250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#define UCLN_TYPE UCLN_I18N
2350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "ucln_imp.h"
2450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* Leave this copyright notice here! It needs to go somewhere in this library. */
26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic const char copyright[] = U_COPYRIGHT_STRING;
27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustatic UBool i18n_cleanup(void)
31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ECleanupI18NType libType = UCLN_I18N_START;
33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    while (++libType<UCLN_I18N_COUNT) {
35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        if (gCleanupFunctions[libType])
36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        {
37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            gCleanupFunctions[libType]();
38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            gCleanupFunctions[libType] = NULL;
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        }
40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
4150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
4250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    ucln_unRegisterAutomaticCleanup();
4350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#endif
44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    return TRUE;
45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruvoid ucln_i18n_registerCleanup(ECleanupI18NType type,
48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                               cleanupFunc *func)
49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru{
50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    U_ASSERT(UCLN_I18N_START < type && type < UCLN_I18N_COUNT);
51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    ucln_registerCleanup(UCLN_I18N, i18n_cleanup);
52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    if (UCLN_I18N_START < type && type < UCLN_I18N_COUNT)
53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    {
54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        gCleanupFunctions[type] = func;
55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    }
5650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
5750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    ucln_registerAutomaticCleanup();
5850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#endif
59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}
60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
61