intl/icu/source/io/ucln_io.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/io/ucln_io.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +/*
     1.5 +******************************************************************************
     1.6 +*                                                                            *
     1.7 +* Copyright (C) 2001-2013, International Business Machines                   *
     1.8 +*                Corporation and others. All Rights Reserved.                *
     1.9 +*                                                                            *
    1.10 +******************************************************************************
    1.11 +*   file name:  ucln_io.c
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:4
    1.15 +*
    1.16 +*   created on: 2006August11
    1.17 +*   created by: George Rhoten
    1.18 +*/
    1.19 +
    1.20 +#include "ucln.h"
    1.21 +#include "ucln_io.h"
    1.22 +#include "uassert.h"
    1.23 +
    1.24 +#ifndef U_IO_IMPLEMENTATION
    1.25 +#error U_IO_IMPLEMENTATION not set - must be set for all ICU source files in io/ - see http://userguide.icu-project.org/howtouseicu
    1.26 +#endif
    1.27 +
    1.28 +
    1.29 +/**  Auto-client */
    1.30 +#define UCLN_TYPE UCLN_IO
    1.31 +#include "ucln_imp.h"
    1.32 +
    1.33 +/* Leave this copyright notice here! It needs to go somewhere in this library. */
    1.34 +static const char copyright[] = U_COPYRIGHT_STRING;
    1.35 +
    1.36 +static cleanupFunc *gCleanupFunctions[UCLN_IO_COUNT];
    1.37 +
    1.38 +static UBool io_cleanup(void)
    1.39 +{
    1.40 +    ECleanupIOType libType = UCLN_IO_START;
    1.41 +
    1.42 +    while (++libType<UCLN_IO_COUNT) {
    1.43 +        if (gCleanupFunctions[libType])
    1.44 +        {
    1.45 +            gCleanupFunctions[libType]();
    1.46 +            gCleanupFunctions[libType] = NULL;
    1.47 +        }
    1.48 +    }
    1.49 +#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
    1.50 +    ucln_unRegisterAutomaticCleanup();
    1.51 +#endif
    1.52 +    return TRUE;
    1.53 +}
    1.54 +
    1.55 +void ucln_io_registerCleanup(ECleanupIOType type,
    1.56 +                               cleanupFunc *func)
    1.57 +{
    1.58 +    U_ASSERT(UCLN_IO_START < type && type < UCLN_IO_COUNT);
    1.59 +    ucln_registerCleanup(UCLN_IO, io_cleanup);
    1.60 +    if (UCLN_IO_START < type && type < UCLN_IO_COUNT)
    1.61 +    {
    1.62 +        gCleanupFunctions[type] = func;
    1.63 +    }
    1.64 +
    1.65 +#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
    1.66 +    ucln_registerAutomaticCleanup();
    1.67 +#endif
    1.68 +}
    1.69 +

mercurial