xref: /aosp_15_r20/external/icu/libicu/cts_headers/ucnv_bld.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker **********************************************************************
5*0e209d39SAndroid Build Coastguard Worker *   Copyright (C) 1999-2015 International Business Machines
6*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker **********************************************************************
8*0e209d39SAndroid Build Coastguard Worker *
9*0e209d39SAndroid Build Coastguard Worker *
10*0e209d39SAndroid Build Coastguard Worker *  ucnv_bld.h:
11*0e209d39SAndroid Build Coastguard Worker *  Contains internal data structure definitions
12*0e209d39SAndroid Build Coastguard Worker * Created by Bertrand A. Damiba
13*0e209d39SAndroid Build Coastguard Worker *
14*0e209d39SAndroid Build Coastguard Worker *   Change history:
15*0e209d39SAndroid Build Coastguard Worker *
16*0e209d39SAndroid Build Coastguard Worker *   06/29/2000  helena      Major rewrite of the callback APIs.
17*0e209d39SAndroid Build Coastguard Worker */
18*0e209d39SAndroid Build Coastguard Worker 
19*0e209d39SAndroid Build Coastguard Worker #ifndef UCNV_BLD_H
20*0e209d39SAndroid Build Coastguard Worker #define UCNV_BLD_H
21*0e209d39SAndroid Build Coastguard Worker 
22*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
23*0e209d39SAndroid Build Coastguard Worker 
24*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_CONVERSION
25*0e209d39SAndroid Build Coastguard Worker 
26*0e209d39SAndroid Build Coastguard Worker #include "unicode/ucnv.h"
27*0e209d39SAndroid Build Coastguard Worker #include "unicode/ucnv_err.h"
28*0e209d39SAndroid Build Coastguard Worker #include "unicode/utf16.h"
29*0e209d39SAndroid Build Coastguard Worker #include "ucnv_cnv.h"
30*0e209d39SAndroid Build Coastguard Worker #include "ucnvmbcs.h"
31*0e209d39SAndroid Build Coastguard Worker #include "ucnv_ext.h"
32*0e209d39SAndroid Build Coastguard Worker #include "udataswp.h"
33*0e209d39SAndroid Build Coastguard Worker 
34*0e209d39SAndroid Build Coastguard Worker /* size of the overflow buffers in UConverter, enough for escaping callbacks */
35*0e209d39SAndroid Build Coastguard Worker #define UCNV_ERROR_BUFFER_LENGTH 32
36*0e209d39SAndroid Build Coastguard Worker 
37*0e209d39SAndroid Build Coastguard Worker /* at most 4 bytes per substitution character (part of .cnv file format! see UConverterStaticData) */
38*0e209d39SAndroid Build Coastguard Worker #define UCNV_MAX_SUBCHAR_LEN 4
39*0e209d39SAndroid Build Coastguard Worker 
40*0e209d39SAndroid Build Coastguard Worker /* at most 8 bytes per character in toUBytes[] (UTF-8 uses up to 6) */
41*0e209d39SAndroid Build Coastguard Worker #define UCNV_MAX_CHAR_LEN 8
42*0e209d39SAndroid Build Coastguard Worker 
43*0e209d39SAndroid Build Coastguard Worker /* converter options bits */
44*0e209d39SAndroid Build Coastguard Worker #define UCNV_OPTION_VERSION     0xf
45*0e209d39SAndroid Build Coastguard Worker #define UCNV_OPTION_SWAP_LFNL   0x10
46*0e209d39SAndroid Build Coastguard Worker 
47*0e209d39SAndroid Build Coastguard Worker #define UCNV_GET_VERSION(cnv) ((cnv)->options&UCNV_OPTION_VERSION)
48*0e209d39SAndroid Build Coastguard Worker 
49*0e209d39SAndroid Build Coastguard Worker U_CDECL_BEGIN /* We must declare the following as 'extern "C"' so that if ucnv
50*0e209d39SAndroid Build Coastguard Worker                  itself is compiled under C++, the linkage of the funcptrs will
51*0e209d39SAndroid Build Coastguard Worker                  work.
52*0e209d39SAndroid Build Coastguard Worker               */
53*0e209d39SAndroid Build Coastguard Worker 
54*0e209d39SAndroid Build Coastguard Worker union UConverterTable {
55*0e209d39SAndroid Build Coastguard Worker     UConverterMBCSTable mbcs;
56*0e209d39SAndroid Build Coastguard Worker };
57*0e209d39SAndroid Build Coastguard Worker 
58*0e209d39SAndroid Build Coastguard Worker typedef union UConverterTable UConverterTable;
59*0e209d39SAndroid Build Coastguard Worker 
60*0e209d39SAndroid Build Coastguard Worker struct UConverterImpl;
61*0e209d39SAndroid Build Coastguard Worker typedef struct UConverterImpl UConverterImpl;
62*0e209d39SAndroid Build Coastguard Worker 
63*0e209d39SAndroid Build Coastguard Worker /** values for the unicodeMask */
64*0e209d39SAndroid Build Coastguard Worker #define UCNV_HAS_SUPPLEMENTARY 1
65*0e209d39SAndroid Build Coastguard Worker #define UCNV_HAS_SURROGATES    2
66*0e209d39SAndroid Build Coastguard Worker 
67*0e209d39SAndroid Build Coastguard Worker typedef struct UConverterStaticData {   /* +offset: size */
68*0e209d39SAndroid Build Coastguard Worker     uint32_t structSize;                /* +0: 4 Size of this structure */
69*0e209d39SAndroid Build Coastguard Worker 
70*0e209d39SAndroid Build Coastguard Worker     char name
71*0e209d39SAndroid Build Coastguard Worker       [UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60  internal name of the converter- invariant chars */
72*0e209d39SAndroid Build Coastguard Worker 
73*0e209d39SAndroid Build Coastguard Worker     int32_t codepage;               /* +64: 4 codepage # (now IBM-$codepage) */
74*0e209d39SAndroid Build Coastguard Worker 
75*0e209d39SAndroid Build Coastguard Worker     int8_t platform;                /* +68: 1 platform of the converter (only IBM now) */
76*0e209d39SAndroid Build Coastguard Worker     int8_t conversionType;          /* +69: 1 conversion type */
77*0e209d39SAndroid Build Coastguard Worker 
78*0e209d39SAndroid Build Coastguard Worker     int8_t minBytesPerChar;         /* +70: 1 Minimum # bytes per char in this codepage */
79*0e209d39SAndroid Build Coastguard Worker     int8_t maxBytesPerChar;         /* +71: 1 Maximum # bytes output per UChar in this codepage */
80*0e209d39SAndroid Build Coastguard Worker 
81*0e209d39SAndroid Build Coastguard Worker     uint8_t subChar[UCNV_MAX_SUBCHAR_LEN]; /* +72: 4  [note:  4 and 8 byte boundary] */
82*0e209d39SAndroid Build Coastguard Worker     int8_t subCharLen;              /* +76: 1 */
83*0e209d39SAndroid Build Coastguard Worker 
84*0e209d39SAndroid Build Coastguard Worker     uint8_t hasToUnicodeFallback;   /* +77: 1 UBool needs to be changed to UBool to be consistent across platform */
85*0e209d39SAndroid Build Coastguard Worker     uint8_t hasFromUnicodeFallback; /* +78: 1 */
86*0e209d39SAndroid Build Coastguard Worker     uint8_t unicodeMask;            /* +79: 1  bit 0: has supplementary  bit 1: has single surrogates */
87*0e209d39SAndroid Build Coastguard Worker     uint8_t subChar1;               /* +80: 1  single-byte substitution character for IBM MBCS (0 if none) */
88*0e209d39SAndroid Build Coastguard Worker     uint8_t reserved[19];           /* +81: 19 to round out the structure */
89*0e209d39SAndroid Build Coastguard Worker                                     /* total size: 100 */
90*0e209d39SAndroid Build Coastguard Worker } UConverterStaticData;
91*0e209d39SAndroid Build Coastguard Worker 
92*0e209d39SAndroid Build Coastguard Worker /*
93*0e209d39SAndroid Build Coastguard Worker  * Defines the UConverterSharedData struct,
94*0e209d39SAndroid Build Coastguard Worker  * the immutable, shared part of UConverter.
95*0e209d39SAndroid Build Coastguard Worker  */
96*0e209d39SAndroid Build Coastguard Worker struct UConverterSharedData {
97*0e209d39SAndroid Build Coastguard Worker     uint32_t structSize;            /* Size of this structure */
98*0e209d39SAndroid Build Coastguard Worker     uint32_t referenceCounter;      /* used to count number of clients, unused for static/immutable SharedData */
99*0e209d39SAndroid Build Coastguard Worker 
100*0e209d39SAndroid Build Coastguard Worker     const void *dataMemory;         /* from udata_openChoice() - for cleanup */
101*0e209d39SAndroid Build Coastguard Worker 
102*0e209d39SAndroid Build Coastguard Worker     const UConverterStaticData *staticData; /* pointer to the static (non changing) data. */
103*0e209d39SAndroid Build Coastguard Worker 
104*0e209d39SAndroid Build Coastguard Worker     UBool                sharedDataCached;   /* true:  shared data is in cache, don't destroy on ucnv_close() if 0 ref.  false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */
105*0e209d39SAndroid Build Coastguard Worker     /** If false, then referenceCounter is not used. Must not change after initialization. */
106*0e209d39SAndroid Build Coastguard Worker     UBool isReferenceCounted;
107*0e209d39SAndroid Build Coastguard Worker 
108*0e209d39SAndroid Build Coastguard Worker     const UConverterImpl *impl;     /* vtable-style struct of mostly function pointers */
109*0e209d39SAndroid Build Coastguard Worker 
110*0e209d39SAndroid Build Coastguard Worker     /*initial values of some members of the mutable part of object */
111*0e209d39SAndroid Build Coastguard Worker     uint32_t toUnicodeStatus;
112*0e209d39SAndroid Build Coastguard Worker 
113*0e209d39SAndroid Build Coastguard Worker     /*
114*0e209d39SAndroid Build Coastguard Worker      * Shared data structures currently come in two flavors:
115*0e209d39SAndroid Build Coastguard Worker      * - readonly for built-in algorithmic converters
116*0e209d39SAndroid Build Coastguard Worker      * - allocated for MBCS, with a pointer to an allocated UConverterTable
117*0e209d39SAndroid Build Coastguard Worker      *   which always has a UConverterMBCSTable
118*0e209d39SAndroid Build Coastguard Worker      *
119*0e209d39SAndroid Build Coastguard Worker      * To eliminate one allocation, I am making the UConverterMBCSTable
120*0e209d39SAndroid Build Coastguard Worker      * a member of the shared data.
121*0e209d39SAndroid Build Coastguard Worker      *
122*0e209d39SAndroid Build Coastguard Worker      * markus 2003-nov-07
123*0e209d39SAndroid Build Coastguard Worker      */
124*0e209d39SAndroid Build Coastguard Worker     UConverterMBCSTable mbcs;
125*0e209d39SAndroid Build Coastguard Worker };
126*0e209d39SAndroid Build Coastguard Worker 
127*0e209d39SAndroid Build Coastguard Worker /** UConverterSharedData initializer for static, non-reference-counted converters. */
128*0e209d39SAndroid Build Coastguard Worker #define UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(pStaticData, pImpl) \
129*0e209d39SAndroid Build Coastguard Worker     { \
130*0e209d39SAndroid Build Coastguard Worker         sizeof(UConverterSharedData), ~((uint32_t)0), \
131*0e209d39SAndroid Build Coastguard Worker         NULL, pStaticData, false, false, pImpl, \
132*0e209d39SAndroid Build Coastguard Worker         0, UCNV_MBCS_TABLE_INITIALIZER \
133*0e209d39SAndroid Build Coastguard Worker     }
134*0e209d39SAndroid Build Coastguard Worker 
135*0e209d39SAndroid Build Coastguard Worker /* Defines a UConverter, the lightweight mutable part the user sees */
136*0e209d39SAndroid Build Coastguard Worker 
137*0e209d39SAndroid Build Coastguard Worker struct UConverter {
138*0e209d39SAndroid Build Coastguard Worker     /*
139*0e209d39SAndroid Build Coastguard Worker      * Error function pointer called when conversion issues
140*0e209d39SAndroid Build Coastguard Worker      * occur during a ucnv_fromUnicode call
141*0e209d39SAndroid Build Coastguard Worker      */
142*0e209d39SAndroid Build Coastguard Worker     void (U_EXPORT2 *fromUCharErrorBehaviour) (const void *context,
143*0e209d39SAndroid Build Coastguard Worker                                      UConverterFromUnicodeArgs *args,
144*0e209d39SAndroid Build Coastguard Worker                                      const UChar *codeUnits,
145*0e209d39SAndroid Build Coastguard Worker                                      int32_t length,
146*0e209d39SAndroid Build Coastguard Worker                                      UChar32 codePoint,
147*0e209d39SAndroid Build Coastguard Worker                                      UConverterCallbackReason reason,
148*0e209d39SAndroid Build Coastguard Worker                                      UErrorCode *);
149*0e209d39SAndroid Build Coastguard Worker     /*
150*0e209d39SAndroid Build Coastguard Worker      * Error function pointer called when conversion issues
151*0e209d39SAndroid Build Coastguard Worker      * occur during a ucnv_toUnicode call
152*0e209d39SAndroid Build Coastguard Worker      */
153*0e209d39SAndroid Build Coastguard Worker     void (U_EXPORT2 *fromCharErrorBehaviour) (const void *context,
154*0e209d39SAndroid Build Coastguard Worker                                     UConverterToUnicodeArgs *args,
155*0e209d39SAndroid Build Coastguard Worker                                     const char *codeUnits,
156*0e209d39SAndroid Build Coastguard Worker                                     int32_t length,
157*0e209d39SAndroid Build Coastguard Worker                                     UConverterCallbackReason reason,
158*0e209d39SAndroid Build Coastguard Worker                                     UErrorCode *);
159*0e209d39SAndroid Build Coastguard Worker 
160*0e209d39SAndroid Build Coastguard Worker     /*
161*0e209d39SAndroid Build Coastguard Worker      * Pointer to additional data that depends on the converter type.
162*0e209d39SAndroid Build Coastguard Worker      * Used by ISO 2022, SCSU, GB 18030 converters, possibly more.
163*0e209d39SAndroid Build Coastguard Worker      */
164*0e209d39SAndroid Build Coastguard Worker     void *extraInfo;
165*0e209d39SAndroid Build Coastguard Worker 
166*0e209d39SAndroid Build Coastguard Worker     const void *fromUContext;
167*0e209d39SAndroid Build Coastguard Worker     const void *toUContext;
168*0e209d39SAndroid Build Coastguard Worker 
169*0e209d39SAndroid Build Coastguard Worker     /*
170*0e209d39SAndroid Build Coastguard Worker      * Pointer to charset bytes for substitution string if subCharLen>0,
171*0e209d39SAndroid Build Coastguard Worker      * or pointer to Unicode string (UChar *) if subCharLen<0.
172*0e209d39SAndroid Build Coastguard Worker      * subCharLen==0 is equivalent to using a skip callback.
173*0e209d39SAndroid Build Coastguard Worker      * If the pointer is !=subUChars then it is allocated with
174*0e209d39SAndroid Build Coastguard Worker      * UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR bytes.
175*0e209d39SAndroid Build Coastguard Worker      * The subUChars field is declared as UChar[] not uint8_t[] to
176*0e209d39SAndroid Build Coastguard Worker      * guarantee alignment for UChars.
177*0e209d39SAndroid Build Coastguard Worker      */
178*0e209d39SAndroid Build Coastguard Worker     uint8_t *subChars;
179*0e209d39SAndroid Build Coastguard Worker 
180*0e209d39SAndroid Build Coastguard Worker     UConverterSharedData *sharedData;   /* Pointer to the shared immutable part of the converter object */
181*0e209d39SAndroid Build Coastguard Worker 
182*0e209d39SAndroid Build Coastguard Worker     uint32_t options; /* options flags from UConverterOpen, may contain additional bits */
183*0e209d39SAndroid Build Coastguard Worker 
184*0e209d39SAndroid Build Coastguard Worker     UBool sharedDataIsCached;  /* true:  shared data is in cache, don't destroy on ucnv_close() if 0 ref.  false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */
185*0e209d39SAndroid Build Coastguard Worker     UBool isCopyLocal;  /* true if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */
186*0e209d39SAndroid Build Coastguard Worker     UBool isExtraLocal; /* true if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */
187*0e209d39SAndroid Build Coastguard Worker 
188*0e209d39SAndroid Build Coastguard Worker     UBool  useFallback;
189*0e209d39SAndroid Build Coastguard Worker     int8_t toULength;                   /* number of bytes in toUBytes */
190*0e209d39SAndroid Build Coastguard Worker     uint8_t toUBytes[UCNV_MAX_CHAR_LEN-1];/* more "toU status"; keeps the bytes of the current character */
191*0e209d39SAndroid Build Coastguard Worker     uint32_t toUnicodeStatus;           /* Used to internalize stream status information */
192*0e209d39SAndroid Build Coastguard Worker     int32_t mode;
193*0e209d39SAndroid Build Coastguard Worker     uint32_t fromUnicodeStatus;
194*0e209d39SAndroid Build Coastguard Worker 
195*0e209d39SAndroid Build Coastguard Worker     /*
196*0e209d39SAndroid Build Coastguard Worker      * More fromUnicode() status. Serves 3 purposes:
197*0e209d39SAndroid Build Coastguard Worker      * - keeps a lead surrogate between buffers (similar to toUBytes[])
198*0e209d39SAndroid Build Coastguard Worker      * - keeps a lead surrogate at the end of the stream,
199*0e209d39SAndroid Build Coastguard Worker      *   which the framework handles as truncated input
200*0e209d39SAndroid Build Coastguard Worker      * - if the fromUnicode() implementation returns to the framework
201*0e209d39SAndroid Build Coastguard Worker      *   (ucnv.c ucnv_fromUnicode()), then the framework calls the callback
202*0e209d39SAndroid Build Coastguard Worker      *   for this code point
203*0e209d39SAndroid Build Coastguard Worker      */
204*0e209d39SAndroid Build Coastguard Worker     UChar32 fromUChar32;
205*0e209d39SAndroid Build Coastguard Worker 
206*0e209d39SAndroid Build Coastguard Worker     /*
207*0e209d39SAndroid Build Coastguard Worker      * value for ucnv_getMaxCharSize()
208*0e209d39SAndroid Build Coastguard Worker      *
209*0e209d39SAndroid Build Coastguard Worker      * usually simply copied from the static data, but ucnvmbcs.c modifies
210*0e209d39SAndroid Build Coastguard Worker      * the value depending on the converter type and options
211*0e209d39SAndroid Build Coastguard Worker      */
212*0e209d39SAndroid Build Coastguard Worker     int8_t maxBytesPerUChar;
213*0e209d39SAndroid Build Coastguard Worker 
214*0e209d39SAndroid Build Coastguard Worker     int8_t subCharLen;                  /* length of the codepage specific character sequence */
215*0e209d39SAndroid Build Coastguard Worker     int8_t invalidCharLength;
216*0e209d39SAndroid Build Coastguard Worker     int8_t charErrorBufferLength;       /* number of valid bytes in charErrorBuffer */
217*0e209d39SAndroid Build Coastguard Worker 
218*0e209d39SAndroid Build Coastguard Worker     int8_t invalidUCharLength;
219*0e209d39SAndroid Build Coastguard Worker     int8_t UCharErrorBufferLength;      /* number of valid UChars in charErrorBuffer */
220*0e209d39SAndroid Build Coastguard Worker 
221*0e209d39SAndroid Build Coastguard Worker     uint8_t subChar1;                                   /* single-byte substitution character if different from subChar */
222*0e209d39SAndroid Build Coastguard Worker     UBool useSubChar1;
223*0e209d39SAndroid Build Coastguard Worker     char invalidCharBuffer[UCNV_MAX_CHAR_LEN];          /* bytes from last error/callback situation */
224*0e209d39SAndroid Build Coastguard Worker     uint8_t charErrorBuffer[UCNV_ERROR_BUFFER_LENGTH];  /* codepage output from Error functions */
225*0e209d39SAndroid Build Coastguard Worker     UChar subUChars[UCNV_MAX_SUBCHAR_LEN/U_SIZEOF_UCHAR]; /* see subChars documentation */
226*0e209d39SAndroid Build Coastguard Worker 
227*0e209d39SAndroid Build Coastguard Worker     UChar invalidUCharBuffer[U16_MAX_LENGTH];           /* UChars from last error/callback situation */
228*0e209d39SAndroid Build Coastguard Worker     UChar UCharErrorBuffer[UCNV_ERROR_BUFFER_LENGTH];   /* unicode output from Error functions */
229*0e209d39SAndroid Build Coastguard Worker 
230*0e209d39SAndroid Build Coastguard Worker     /* fields for conversion extension */
231*0e209d39SAndroid Build Coastguard Worker 
232*0e209d39SAndroid Build Coastguard Worker     /* store previous UChars/chars to continue partial matches */
233*0e209d39SAndroid Build Coastguard Worker     UChar32 preFromUFirstCP;                /* >=0: partial match */
234*0e209d39SAndroid Build Coastguard Worker     UChar preFromU[UCNV_EXT_MAX_UCHARS];
235*0e209d39SAndroid Build Coastguard Worker     char preToU[UCNV_EXT_MAX_BYTES];
236*0e209d39SAndroid Build Coastguard Worker     int8_t preFromULength, preToULength;    /* negative: replay */
237*0e209d39SAndroid Build Coastguard Worker     int8_t preToUFirstLength;               /* length of first character */
238*0e209d39SAndroid Build Coastguard Worker 
239*0e209d39SAndroid Build Coastguard Worker     /* new fields for ICU 4.0 */
240*0e209d39SAndroid Build Coastguard Worker     UConverterCallbackReason toUCallbackReason; /* (*fromCharErrorBehaviour) reason, set when error is detected */
241*0e209d39SAndroid Build Coastguard Worker };
242*0e209d39SAndroid Build Coastguard Worker 
243*0e209d39SAndroid Build Coastguard Worker U_CDECL_END /* end of UConverter */
244*0e209d39SAndroid Build Coastguard Worker 
245*0e209d39SAndroid Build Coastguard Worker #define CONVERTER_FILE_EXTENSION ".cnv"
246*0e209d39SAndroid Build Coastguard Worker 
247*0e209d39SAndroid Build Coastguard Worker 
248*0e209d39SAndroid Build Coastguard Worker /**
249*0e209d39SAndroid Build Coastguard Worker  * Return the number of all converter names.
250*0e209d39SAndroid Build Coastguard Worker  * @param pErrorCode The error code
251*0e209d39SAndroid Build Coastguard Worker  * @return the number of all converter names
252*0e209d39SAndroid Build Coastguard Worker  */
253*0e209d39SAndroid Build Coastguard Worker U_CFUNC uint16_t
254*0e209d39SAndroid Build Coastguard Worker ucnv_bld_countAvailableConverters(UErrorCode *pErrorCode);
255*0e209d39SAndroid Build Coastguard Worker 
256*0e209d39SAndroid Build Coastguard Worker /**
257*0e209d39SAndroid Build Coastguard Worker  * Return the (n)th converter name in mixed case, or NULL
258*0e209d39SAndroid Build Coastguard Worker  * if there is none (typically, if the data cannot be loaded).
259*0e209d39SAndroid Build Coastguard Worker  * 0<=index<ucnv_io_countAvailableConverters().
260*0e209d39SAndroid Build Coastguard Worker  * @param n The number specifies which converter name to get
261*0e209d39SAndroid Build Coastguard Worker  * @param pErrorCode The error code
262*0e209d39SAndroid Build Coastguard Worker  * @return the (n)th converter name in mixed case, or NULL if there is none.
263*0e209d39SAndroid Build Coastguard Worker  */
264*0e209d39SAndroid Build Coastguard Worker U_CFUNC const char *
265*0e209d39SAndroid Build Coastguard Worker ucnv_bld_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode);
266*0e209d39SAndroid Build Coastguard Worker 
267*0e209d39SAndroid Build Coastguard Worker /**
268*0e209d39SAndroid Build Coastguard Worker  * Load a non-algorithmic converter.
269*0e209d39SAndroid Build Coastguard Worker  * If pkg==NULL, then this function must be called inside umtx_lock(&cnvCacheMutex).
270*0e209d39SAndroid Build Coastguard Worker  */
271*0e209d39SAndroid Build Coastguard Worker U_CAPI UConverterSharedData *
272*0e209d39SAndroid Build Coastguard Worker ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err);
273*0e209d39SAndroid Build Coastguard Worker 
274*0e209d39SAndroid Build Coastguard Worker /**
275*0e209d39SAndroid Build Coastguard Worker  * Unload a non-algorithmic converter.
276*0e209d39SAndroid Build Coastguard Worker  * It must be sharedData->isReferenceCounted
277*0e209d39SAndroid Build Coastguard Worker  * and this function must be called inside umtx_lock(&cnvCacheMutex).
278*0e209d39SAndroid Build Coastguard Worker  */
279*0e209d39SAndroid Build Coastguard Worker U_CAPI void
280*0e209d39SAndroid Build Coastguard Worker ucnv_unload(UConverterSharedData *sharedData);
281*0e209d39SAndroid Build Coastguard Worker 
282*0e209d39SAndroid Build Coastguard Worker /**
283*0e209d39SAndroid Build Coastguard Worker  * Swap ICU .cnv conversion tables. See udataswp.h.
284*0e209d39SAndroid Build Coastguard Worker  * @internal
285*0e209d39SAndroid Build Coastguard Worker  */
286*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
287*0e209d39SAndroid Build Coastguard Worker ucnv_swap(const UDataSwapper *ds,
288*0e209d39SAndroid Build Coastguard Worker           const void *inData, int32_t length, void *outData,
289*0e209d39SAndroid Build Coastguard Worker           UErrorCode *pErrorCode);
290*0e209d39SAndroid Build Coastguard Worker 
291*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
292*0e209d39SAndroid Build Coastguard Worker ucnv_enableCleanup(void);
293*0e209d39SAndroid Build Coastguard Worker 
294*0e209d39SAndroid Build Coastguard Worker #endif
295*0e209d39SAndroid Build Coastguard Worker 
296*0e209d39SAndroid Build Coastguard Worker #endif /* _UCNV_BLD */
297