~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/icu/source/common/unicode/uclean.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
******************************************************************************
3
 
*                                                                            *
4
 
* Copyright (C) 2001-2009, International Business Machines                   *
5
 
*                Corporation and others. All Rights Reserved.                *
6
 
*                                                                            *
7
 
******************************************************************************
8
 
*   file name:  uclean.h
9
 
*   encoding:   US-ASCII
10
 
*   tab size:   8 (not used)
11
 
*   indentation:4
12
 
*
13
 
*   created on: 2001July05
14
 
*   created by: George Rhoten
15
 
*/
16
 
 
17
 
#ifndef __UCLEAN_H__
18
 
#define __UCLEAN_H__
19
 
 
20
 
#include "unicode/utypes.h"
21
 
/**
22
 
 * \file
23
 
 * \brief C API: Initialize and clean up ICU
24
 
 */
25
 
 
26
 
/**
27
 
 *  Initialize ICU.
28
 
 *
29
 
 *  Use of this function is optional.  It is OK to simply use ICU
30
 
 *  services and functions without first having initialized
31
 
 *  ICU by calling u_init().
32
 
 *
33
 
 *  u_init() will attempt to load some part of ICU's data, and is
34
 
 *  useful as a test for configuration or installation problems that
35
 
 *  leave the ICU data inaccessible.  A successful invocation of u_init()
36
 
 *  does not, however, guarantee that all ICU data is accessible.
37
 
 *
38
 
 *  Multiple calls to u_init() cause no harm, aside from the small amount
39
 
 *  of time required.
40
 
 *
41
 
 *  In old versions of ICU, u_init() was required in multi-threaded applications
42
 
 *  to ensure the thread safety of ICU.  u_init() is no longer needed for this purpose.
43
 
 *
44
 
 * @param status An ICU UErrorCode parameter. It must not be <code>NULL</code>.
45
 
 *    An Error will be returned if some required part of ICU data can not
46
 
 *    be loaded or initialized.
47
 
 *    The function returns immediately if the input error code indicates a
48
 
 *    failure, as usual.
49
 
 *
50
 
 * @stable ICU 2.6
51
 
 */  
52
 
U_STABLE void U_EXPORT2 
53
 
u_init(UErrorCode *status);
54
 
 
55
 
/**
56
 
 * Clean up the system resources, such as allocated memory or open files,
57
 
 * used in all ICU libraries. This will free/delete all memory owned by the
58
 
 * ICU libraries, and return them to their original load state. All open ICU
59
 
 * items (collators, resource bundles, converters, etc.) must be closed before
60
 
 * calling this function, otherwise ICU may not free its allocated memory
61
 
 * (e.g. close your converters and resource bundles before calling this
62
 
 * function). Generally, this function should be called once just before
63
 
 * an application exits. For applications that dynamically load and unload
64
 
 * the ICU libraries (relatively uncommon), u_cleanup() should be called
65
 
 * just before the library unload.
66
 
 * <p>
67
 
 * u_cleanup() also clears any ICU heap functions, mutex functions or
68
 
 * trace functions that may have been set for the process.  
69
 
 * This has the effect of restoring ICU to its initial condition, before
70
 
 * any of these override functions were installed.  Refer to
71
 
 * u_setMemoryFunctions(), u_setMutexFunctions and 
72
 
 * utrace_setFunctions().  If ICU is to be reinitialized after after
73
 
 * calling u_cleanup(), these runtime override functions will need to
74
 
 * be set up again if they are still required.
75
 
 * <p>
76
 
 * u_cleanup() is not thread safe.  All other threads should stop using ICU
77
 
 * before calling this function.
78
 
 * <p>
79
 
 * Any open ICU items will be left in an undefined state by u_cleanup(),
80
 
 * and any subsequent attempt to use such an item will give unpredictable
81
 
 * results.
82
 
 * <p>
83
 
 * After calling u_cleanup(), an application may continue to use ICU by
84
 
 * calling u_init().  An application must invoke u_init() first from one single
85
 
 * thread before allowing other threads call u_init().  All threads existing
86
 
 * at the time of the first thread's call to u_init() must also call
87
 
 * u_init() themselves before continuing with other ICU operations.  
88
 
 * <p>
89
 
 * The use of u_cleanup() just before an application terminates is optional,
90
 
 * but it should be called only once for performance reasons. The primary
91
 
 * benefit is to eliminate reports of memory or resource leaks originating
92
 
 * in ICU code from the results generated by heap analysis tools.
93
 
 * <p>
94
 
 * <strong>Use this function with great care!</strong>
95
 
 * </p>
96
 
 *
97
 
 * @stable ICU 2.0
98
 
 * @system
99
 
 */
100
 
U_STABLE void U_EXPORT2 
101
 
u_cleanup(void);
102
 
 
103
 
 
104
 
 
105
 
 
106
 
/**
107
 
  * An opaque pointer type that represents an ICU mutex.
108
 
  * For user-implemented mutexes, the value will typically point to a
109
 
  *  struct or object that implements the mutex.
110
 
  * @stable ICU 2.8
111
 
  * @system
112
 
  */
113
 
typedef void *UMTX;
114
 
 
115
 
/**
116
 
  *  Function Pointer type for a user supplied mutex initialization function.
117
 
  *  The user-supplied function will be called by ICU whenever ICU needs to create a
118
 
  *  new mutex.  The function implementation should create a mutex, and store a pointer
119
 
  *  to something that uniquely identifies the mutex into the UMTX that is supplied
120
 
  *  as a paramter.
121
 
  *  @param context user supplied value, obtained from from u_setMutexFunctions().
122
 
  *  @param mutex   Receives a pointer that identifies the new mutex.
123
 
  *                 The mutex init function must set the UMTX to a non-null value.   
124
 
  *                 Subsequent calls by ICU to lock, unlock, or destroy a mutex will 
125
 
  *                 identify the mutex by the UMTX value.
126
 
  *  @param status  Error status.  Report errors back to ICU by setting this variable
127
 
  *                 with an error code.
128
 
  *  @stable ICU 2.8
129
 
  *  @system
130
 
  */
131
 
typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX  *mutex, UErrorCode* status);
132
 
 
133
 
 
134
 
/**
135
 
  *  Function Pointer type for a user supplied mutex functions.
136
 
  *  One of the  user-supplied functions with this signature will be called by ICU
137
 
  *  whenever ICU needs to lock, unlock, or destroy a mutex.
138
 
  *  @param context user supplied value, obtained from from u_setMutexFunctions().
139
 
  *  @param mutex   specify the mutex on which to operate.
140
 
  *  @stable ICU 2.8
141
 
  *  @system
142
 
  */
143
 
typedef void U_CALLCONV UMtxFn   (const void *context, UMTX  *mutex);
144
 
 
145
 
 
146
 
/**
147
 
  *  Set the functions that ICU will use for mutex operations
148
 
  *  Use of this function is optional; by default (without this function), ICU will
149
 
  *  directly access system functions for mutex operations
150
 
  *  This function can only be used when ICU is in an initial, unused state, before
151
 
  *  u_init() has been called.
152
 
  *  This function may be used even when ICU has been built without multi-threaded
153
 
  *  support  (see ICU_USE_THREADS pre-processor variable, umutex.h)
154
 
  *  @param context This pointer value will be saved, and then (later) passed as
155
 
  *                 a parameter to the user-supplied mutex functions each time they
156
 
  *                 are called. 
157
 
  *  @param init    Pointer to a mutex initialization function.  Must be non-null.
158
 
  *  @param destroy Pointer to the mutex destroy function.  Must be non-null.
159
 
  *  @param lock    pointer to the mutex lock function.  Must be non-null.
160
 
  *  @param unlock  Pointer to the mutex unlock function.  Must be non-null.
161
 
  *  @param status  Receives error values.
162
 
  *  @stable ICU 2.8
163
 
  *  @system
164
 
  */  
165
 
U_STABLE void U_EXPORT2 
166
 
u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock,
167
 
                    UErrorCode *status);
168
 
 
169
 
 
170
 
/**
171
 
  *  Pointer type for a user supplied atomic increment or decrement function.
172
 
  *  @param context user supplied value, obtained from from u_setAtomicIncDecFunctions().
173
 
  *  @param p   Pointer to a 32 bit int to be incremented or decremented
174
 
  *  @return    The value of the variable after the inc or dec operation.
175
 
  *  @stable ICU 2.8
176
 
  *  @system
177
 
  */
178
 
typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p);
179
 
 
180
 
/**
181
 
 *  Set the functions that ICU will use for atomic increment and decrement of int32_t values.
182
 
 *  Use of this function is optional; by default (without this function), ICU will
183
 
 *  use its own internal implementation of atomic increment/decrement.
184
 
 *  This function can only be used when ICU is in an initial, unused state, before
185
 
 *  u_init() has been called.
186
 
 *  @param context This pointer value will be saved, and then (later) passed as
187
 
 *                 a parameter to the increment and decrement functions each time they
188
 
 *                 are called.  This function can only be called 
189
 
 *  @param inc     Pointer to a function to do an atomic increment operation.  Must be non-null.
190
 
 *  @param dec     Pointer to a function to do an atomic decrement operation.  Must be non-null.
191
 
 *  @param status  Receives error values.
192
 
 *  @stable ICU 2.8
193
 
 *  @system
194
 
 */  
195
 
U_STABLE void U_EXPORT2 
196
 
u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec,
197
 
                    UErrorCode *status);
198
 
 
199
 
 
200
 
 
201
 
/**
202
 
  *  Pointer type for a user supplied memory allocation function.
203
 
  *  @param context user supplied value, obtained from from u_setMemoryFunctions().
204
 
  *  @param size    The number of bytes to be allocated
205
 
  *  @return        Pointer to the newly allocated memory, or NULL if the allocation failed.
206
 
  *  @stable ICU 2.8
207
 
  *  @system
208
 
  */
209
 
typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size);
210
 
/**
211
 
  *  Pointer type for a user supplied memory re-allocation function.
212
 
  *  @param context user supplied value, obtained from from u_setMemoryFunctions().
213
 
  *  @param size    The number of bytes to be allocated
214
 
  *  @return        Pointer to the newly allocated memory, or NULL if the allocation failed.
215
 
  *  @stable ICU 2.8
216
 
  *  @system
217
 
  */
218
 
typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size);
219
 
/**
220
 
  *  Pointer type for a user supplied memory free  function.  Behavior should be
221
 
  *  similar the standard C library free().
222
 
  *  @param context user supplied value, obtained from from u_setMemoryFunctions().
223
 
  *  @param mem     Pointer to the memory block to be resized
224
 
  *  @param size    The new size for the block
225
 
  *  @return        Pointer to the resized memory block, or NULL if the resizing failed.
226
 
  *  @stable ICU 2.8
227
 
  *  @system
228
 
  */
229
 
typedef void  U_CALLCONV UMemFreeFn (const void *context, void *mem);
230
 
 
231
 
/**
232
 
 *  Set the functions that ICU will use for memory allocation.
233
 
 *  Use of this function is optional; by default (without this function), ICU will
234
 
 *  use the standard C library malloc() and free() functions.
235
 
 *  This function can only be used when ICU is in an initial, unused state, before
236
 
 *  u_init() has been called.
237
 
 *  @param context This pointer value will be saved, and then (later) passed as
238
 
 *                 a parameter to the memory functions each time they
239
 
 *                 are called.
240
 
 *  @param a       Pointer to a user-supplied malloc function.
241
 
 *  @param r       Pointer to a user-supplied realloc function.
242
 
 *  @param f       Pointer to a user-supplied free function.
243
 
 *  @param status  Receives error values.
244
 
 *  @stable ICU 2.8
245
 
 *  @system
246
 
 */  
247
 
U_STABLE void U_EXPORT2 
248
 
u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, 
249
 
                    UErrorCode *status);
250
 
 
251
 
#endif