annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/ucnv_err.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2016 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3 /*
jpayne@69 4 **********************************************************************
jpayne@69 5 * Copyright (C) 1999-2009, International Business Machines
jpayne@69 6 * Corporation and others. All Rights Reserved.
jpayne@69 7 **********************************************************************
jpayne@69 8 *
jpayne@69 9 *
jpayne@69 10 * ucnv_err.h:
jpayne@69 11 */
jpayne@69 12
jpayne@69 13 /**
jpayne@69 14 * \file
jpayne@69 15 * \brief C UConverter predefined error callbacks
jpayne@69 16 *
jpayne@69 17 * <h2>Error Behaviour Functions</h2>
jpayne@69 18 * Defines some error behaviour functions called by ucnv_{from,to}Unicode
jpayne@69 19 * These are provided as part of ICU and many are stable, but they
jpayne@69 20 * can also be considered only as an example of what can be done with
jpayne@69 21 * callbacks. You may of course write your own.
jpayne@69 22 *
jpayne@69 23 * If you want to write your own, you may also find the functions from
jpayne@69 24 * ucnv_cb.h useful when writing your own callbacks.
jpayne@69 25 *
jpayne@69 26 * These functions, although public, should NEVER be called directly.
jpayne@69 27 * They should be used as parameters to the ucnv_setFromUCallback
jpayne@69 28 * and ucnv_setToUCallback functions, to set the behaviour of a converter
jpayne@69 29 * when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
jpayne@69 30 *
jpayne@69 31 * usage example: 'STOP' doesn't need any context, but newContext
jpayne@69 32 * could be set to something other than 'NULL' if needed. The available
jpayne@69 33 * contexts in this header can modify the default behavior of the callback.
jpayne@69 34 *
jpayne@69 35 * \code
jpayne@69 36 * UErrorCode err = U_ZERO_ERROR;
jpayne@69 37 * UConverter *myConverter = ucnv_open("ibm-949", &err);
jpayne@69 38 * const void *oldContext;
jpayne@69 39 * UConverterFromUCallback oldAction;
jpayne@69 40 *
jpayne@69 41 *
jpayne@69 42 * if (U_SUCCESS(err))
jpayne@69 43 * {
jpayne@69 44 * ucnv_setFromUCallBack(myConverter,
jpayne@69 45 * UCNV_FROM_U_CALLBACK_STOP,
jpayne@69 46 * NULL,
jpayne@69 47 * &oldAction,
jpayne@69 48 * &oldContext,
jpayne@69 49 * &status);
jpayne@69 50 * }
jpayne@69 51 * \endcode
jpayne@69 52 *
jpayne@69 53 * The code above tells "myConverter" to stop when it encounters an
jpayne@69 54 * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
jpayne@69 55 * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed,
jpayne@69 56 * and ucnv_setToUCallBack would need to be called in order to change
jpayne@69 57 * that behavior too.
jpayne@69 58 *
jpayne@69 59 * Here is an example with a context:
jpayne@69 60 *
jpayne@69 61 * \code
jpayne@69 62 * UErrorCode err = U_ZERO_ERROR;
jpayne@69 63 * UConverter *myConverter = ucnv_open("ibm-949", &err);
jpayne@69 64 * const void *oldContext;
jpayne@69 65 * UConverterFromUCallback oldAction;
jpayne@69 66 *
jpayne@69 67 *
jpayne@69 68 * if (U_SUCCESS(err))
jpayne@69 69 * {
jpayne@69 70 * ucnv_setToUCallBack(myConverter,
jpayne@69 71 * UCNV_TO_U_CALLBACK_SUBSTITUTE,
jpayne@69 72 * UCNV_SUB_STOP_ON_ILLEGAL,
jpayne@69 73 * &oldAction,
jpayne@69 74 * &oldContext,
jpayne@69 75 * &status);
jpayne@69 76 * }
jpayne@69 77 * \endcode
jpayne@69 78 *
jpayne@69 79 * The code above tells "myConverter" to stop when it encounters an
jpayne@69 80 * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
jpayne@69 81 * Codepage -> Unicode. Any unmapped and legal characters will be
jpayne@69 82 * substituted to be the default substitution character.
jpayne@69 83 */
jpayne@69 84
jpayne@69 85 #ifndef UCNV_ERR_H
jpayne@69 86 #define UCNV_ERR_H
jpayne@69 87
jpayne@69 88 #include "unicode/utypes.h"
jpayne@69 89
jpayne@69 90 #if !UCONFIG_NO_CONVERSION
jpayne@69 91
jpayne@69 92 /** Forward declaring the UConverter structure. @stable ICU 2.0 */
jpayne@69 93 struct UConverter;
jpayne@69 94
jpayne@69 95 /** @stable ICU 2.0 */
jpayne@69 96 typedef struct UConverter UConverter;
jpayne@69 97
jpayne@69 98 /**
jpayne@69 99 * FROM_U, TO_U context options for sub callback
jpayne@69 100 * @stable ICU 2.0
jpayne@69 101 */
jpayne@69 102 #define UCNV_SUB_STOP_ON_ILLEGAL "i"
jpayne@69 103
jpayne@69 104 /**
jpayne@69 105 * FROM_U, TO_U context options for skip callback
jpayne@69 106 * @stable ICU 2.0
jpayne@69 107 */
jpayne@69 108 #define UCNV_SKIP_STOP_ON_ILLEGAL "i"
jpayne@69 109
jpayne@69 110 /**
jpayne@69 111 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX)
jpayne@69 112 * @stable ICU 2.0
jpayne@69 113 */
jpayne@69 114 #define UCNV_ESCAPE_ICU NULL
jpayne@69 115 /**
jpayne@69 116 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX)
jpayne@69 117 * @stable ICU 2.0
jpayne@69 118 */
jpayne@69 119 #define UCNV_ESCAPE_JAVA "J"
jpayne@69 120 /**
jpayne@69 121 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
jpayne@69 122 * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX)
jpayne@69 123 * @stable ICU 2.0
jpayne@69 124 */
jpayne@69 125 #define UCNV_ESCAPE_C "C"
jpayne@69 126 /**
jpayne@69 127 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
jpayne@69 128 * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
jpayne@69 129 * @stable ICU 2.0
jpayne@69 130 */
jpayne@69 131 #define UCNV_ESCAPE_XML_DEC "D"
jpayne@69 132 /**
jpayne@69 133 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
jpayne@69 134 * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
jpayne@69 135 * @stable ICU 2.0
jpayne@69 136 */
jpayne@69 137 #define UCNV_ESCAPE_XML_HEX "X"
jpayne@69 138 /**
jpayne@69 139 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX)
jpayne@69 140 * @stable ICU 2.0
jpayne@69 141 */
jpayne@69 142 #define UCNV_ESCAPE_UNICODE "U"
jpayne@69 143
jpayne@69 144 /**
jpayne@69 145 * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H<space>, that is,
jpayne@69 146 * a backslash, 1..6 hex digits, and a space)
jpayne@69 147 * @stable ICU 4.0
jpayne@69 148 */
jpayne@69 149 #define UCNV_ESCAPE_CSS2 "S"
jpayne@69 150
jpayne@69 151 /**
jpayne@69 152 * The process condition code to be used with the callbacks.
jpayne@69 153 * Codes which are greater than UCNV_IRREGULAR should be
jpayne@69 154 * passed on to any chained callbacks.
jpayne@69 155 * @stable ICU 2.0
jpayne@69 156 */
jpayne@69 157 typedef enum {
jpayne@69 158 UCNV_UNASSIGNED = 0, /**< The code point is unassigned.
jpayne@69 159 The error code U_INVALID_CHAR_FOUND will be set. */
jpayne@69 160 UCNV_ILLEGAL = 1, /**< The code point is illegal. For example,
jpayne@69 161 \\x81\\x2E is illegal in SJIS because \\x2E
jpayne@69 162 is not a valid trail byte for the \\x81
jpayne@69 163 lead byte.
jpayne@69 164 Also, starting with Unicode 3.0.1, non-shortest byte sequences
jpayne@69 165 in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
jpayne@69 166 are also illegal, not just irregular.
jpayne@69 167 The error code U_ILLEGAL_CHAR_FOUND will be set. */
jpayne@69 168 UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in
jpayne@69 169 the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
jpayne@69 170 are irregular UTF-8 byte sequences for single surrogate
jpayne@69 171 code points.
jpayne@69 172 The error code U_INVALID_CHAR_FOUND will be set. */
jpayne@69 173 UCNV_RESET = 3, /**< The callback is called with this reason when a
jpayne@69 174 'reset' has occurred. Callback should reset all
jpayne@69 175 state. */
jpayne@69 176 UCNV_CLOSE = 4, /**< Called when the converter is closed. The
jpayne@69 177 callback should release any allocated memory.*/
jpayne@69 178 UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the
jpayne@69 179 converter. the pointer available as the
jpayne@69 180 'context' is an alias to the original converters'
jpayne@69 181 context pointer. If the context must be owned
jpayne@69 182 by the new converter, the callback must clone
jpayne@69 183 the data and call ucnv_setFromUCallback
jpayne@69 184 (or setToUCallback) with the correct pointer.
jpayne@69 185 @stable ICU 2.2
jpayne@69 186 */
jpayne@69 187 } UConverterCallbackReason;
jpayne@69 188
jpayne@69 189
jpayne@69 190 /**
jpayne@69 191 * The structure for the fromUnicode callback function parameter.
jpayne@69 192 * @stable ICU 2.0
jpayne@69 193 */
jpayne@69 194 typedef struct {
jpayne@69 195 uint16_t size; /**< The size of this struct. @stable ICU 2.0 */
jpayne@69 196 UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */
jpayne@69 197 UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
jpayne@69 198 const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */
jpayne@69 199 const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
jpayne@69 200 char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
jpayne@69 201 const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
jpayne@69 202 int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
jpayne@69 203 } UConverterFromUnicodeArgs;
jpayne@69 204
jpayne@69 205
jpayne@69 206 /**
jpayne@69 207 * The structure for the toUnicode callback function parameter.
jpayne@69 208 * @stable ICU 2.0
jpayne@69 209 */
jpayne@69 210 typedef struct {
jpayne@69 211 uint16_t size; /**< The size of this struct @stable ICU 2.0 */
jpayne@69 212 UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */
jpayne@69 213 UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
jpayne@69 214 const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */
jpayne@69 215 const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */
jpayne@69 216 UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */
jpayne@69 217 const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */
jpayne@69 218 int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */
jpayne@69 219 } UConverterToUnicodeArgs;
jpayne@69 220
jpayne@69 221
jpayne@69 222 /**
jpayne@69 223 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 224 * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,
jpayne@69 225 * returning the error code back to the caller immediately.
jpayne@69 226 *
jpayne@69 227 * @param context Pointer to the callback's private data
jpayne@69 228 * @param fromUArgs Information about the conversion in progress
jpayne@69 229 * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
jpayne@69 230 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 231 * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
jpayne@69 232 * @param reason Defines the reason the callback was invoked
jpayne@69 233 * @param err This should always be set to a failure status prior to calling.
jpayne@69 234 * @stable ICU 2.0
jpayne@69 235 */
jpayne@69 236 U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
jpayne@69 237 const void *context,
jpayne@69 238 UConverterFromUnicodeArgs *fromUArgs,
jpayne@69 239 const UChar* codeUnits,
jpayne@69 240 int32_t length,
jpayne@69 241 UChar32 codePoint,
jpayne@69 242 UConverterCallbackReason reason,
jpayne@69 243 UErrorCode * err);
jpayne@69 244
jpayne@69 245
jpayne@69 246
jpayne@69 247 /**
jpayne@69 248 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 249 * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,
jpayne@69 250 * returning the error code back to the caller immediately.
jpayne@69 251 *
jpayne@69 252 * @param context Pointer to the callback's private data
jpayne@69 253 * @param toUArgs Information about the conversion in progress
jpayne@69 254 * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
jpayne@69 255 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 256 * @param reason Defines the reason the callback was invoked
jpayne@69 257 * @param err This should always be set to a failure status prior to calling.
jpayne@69 258 * @stable ICU 2.0
jpayne@69 259 */
jpayne@69 260 U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
jpayne@69 261 const void *context,
jpayne@69 262 UConverterToUnicodeArgs *toUArgs,
jpayne@69 263 const char* codeUnits,
jpayne@69 264 int32_t length,
jpayne@69 265 UConverterCallbackReason reason,
jpayne@69 266 UErrorCode * err);
jpayne@69 267
jpayne@69 268 /**
jpayne@69 269 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 270 * This From Unicode callback skips any ILLEGAL_SEQUENCE, or
jpayne@69 271 * skips only UNASSINGED_SEQUENCE depending on the context parameter
jpayne@69 272 * simply ignoring those characters.
jpayne@69 273 *
jpayne@69 274 * @param context The function currently recognizes the callback options:
jpayne@69 275 * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
jpayne@69 276 * returning the error code back to the caller immediately.
jpayne@69 277 * NULL: Skips any ILLEGAL_SEQUENCE
jpayne@69 278 * @param fromUArgs Information about the conversion in progress
jpayne@69 279 * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
jpayne@69 280 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 281 * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
jpayne@69 282 * @param reason Defines the reason the callback was invoked
jpayne@69 283 * @param err Return value will be set to success if the callback was handled,
jpayne@69 284 * otherwise this value will be set to a failure status.
jpayne@69 285 * @stable ICU 2.0
jpayne@69 286 */
jpayne@69 287 U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
jpayne@69 288 const void *context,
jpayne@69 289 UConverterFromUnicodeArgs *fromUArgs,
jpayne@69 290 const UChar* codeUnits,
jpayne@69 291 int32_t length,
jpayne@69 292 UChar32 codePoint,
jpayne@69 293 UConverterCallbackReason reason,
jpayne@69 294 UErrorCode * err);
jpayne@69 295
jpayne@69 296 /**
jpayne@69 297 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 298 * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or
jpayne@69 299 * UNASSIGNED_SEQUENCE depending on context parameter, with the
jpayne@69 300 * current substitution string for the converter. This is the default
jpayne@69 301 * callback.
jpayne@69 302 *
jpayne@69 303 * @param context The function currently recognizes the callback options:
jpayne@69 304 * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
jpayne@69 305 * returning the error code back to the caller immediately.
jpayne@69 306 * NULL: Substitutes any ILLEGAL_SEQUENCE
jpayne@69 307 * @param fromUArgs Information about the conversion in progress
jpayne@69 308 * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
jpayne@69 309 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 310 * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
jpayne@69 311 * @param reason Defines the reason the callback was invoked
jpayne@69 312 * @param err Return value will be set to success if the callback was handled,
jpayne@69 313 * otherwise this value will be set to a failure status.
jpayne@69 314 * @see ucnv_setSubstChars
jpayne@69 315 * @stable ICU 2.0
jpayne@69 316 */
jpayne@69 317 U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
jpayne@69 318 const void *context,
jpayne@69 319 UConverterFromUnicodeArgs *fromUArgs,
jpayne@69 320 const UChar* codeUnits,
jpayne@69 321 int32_t length,
jpayne@69 322 UChar32 codePoint,
jpayne@69 323 UConverterCallbackReason reason,
jpayne@69 324 UErrorCode * err);
jpayne@69 325
jpayne@69 326 /**
jpayne@69 327 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 328 * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the
jpayne@69 329 * hexadecimal representation of the illegal codepoints
jpayne@69 330 *
jpayne@69 331 * @param context The function currently recognizes the callback options:
jpayne@69 332 * <ul>
jpayne@69 333 * <li>UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal
jpayne@69 334 * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE").
jpayne@69 335 * In the Event the converter doesn't support the characters {%,U}[A-F][0-9],
jpayne@69 336 * it will substitute the illegal sequence with the substitution characters.
jpayne@69 337 * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
jpayne@69 338 * %UD84D%UDC56</li>
jpayne@69 339 * <li>UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal
jpayne@69 340 * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
jpayne@69 341 * In the Event the converter doesn't support the characters {\,u}[A-F][0-9],
jpayne@69 342 * it will substitute the illegal sequence with the substitution characters.
jpayne@69 343 * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
jpayne@69 344 * \\uD84D\\uDC56</li>
jpayne@69 345 * <li>UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal
jpayne@69 346 * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
jpayne@69 347 * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9],
jpayne@69 348 * it will substitute the illegal sequence with the substitution characters.
jpayne@69 349 * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
jpayne@69 350 * \\U00023456</li>
jpayne@69 351 * <li>UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal
jpayne@69 352 * representation in the format \htmlonly&amp;#DDDDDDDD;, e.g. "&amp;#65534;&amp;#172;&amp;#51454;")\endhtmlonly.
jpayne@69 353 * In the Event the converter doesn't support the characters {&amp;,#}[0-9],
jpayne@69 354 * it will substitute the illegal sequence with the substitution characters.
jpayne@69 355 * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
jpayne@69 356 * &amp;#144470; and Zero padding is ignored.</li>
jpayne@69 357 * <li>UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal
jpayne@69 358 * representation in the format \htmlonly&amp;#xXXXX; e.g. "&amp;#xFFFE;&amp;#x00AC;&amp;#xC8FE;")\endhtmlonly.
jpayne@69 359 * In the Event the converter doesn't support the characters {&,#,x}[0-9],
jpayne@69 360 * it will substitute the illegal sequence with the substitution characters.
jpayne@69 361 * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
jpayne@69 362 * \htmlonly&amp;#x23456;\endhtmlonly</li>
jpayne@69 363 * </ul>
jpayne@69 364 * @param fromUArgs Information about the conversion in progress
jpayne@69 365 * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
jpayne@69 366 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 367 * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
jpayne@69 368 * @param reason Defines the reason the callback was invoked
jpayne@69 369 * @param err Return value will be set to success if the callback was handled,
jpayne@69 370 * otherwise this value will be set to a failure status.
jpayne@69 371 * @stable ICU 2.0
jpayne@69 372 */
jpayne@69 373 U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
jpayne@69 374 const void *context,
jpayne@69 375 UConverterFromUnicodeArgs *fromUArgs,
jpayne@69 376 const UChar* codeUnits,
jpayne@69 377 int32_t length,
jpayne@69 378 UChar32 codePoint,
jpayne@69 379 UConverterCallbackReason reason,
jpayne@69 380 UErrorCode * err);
jpayne@69 381
jpayne@69 382
jpayne@69 383 /**
jpayne@69 384 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 385 * This To Unicode callback skips any ILLEGAL_SEQUENCE, or
jpayne@69 386 * skips only UNASSINGED_SEQUENCE depending on the context parameter
jpayne@69 387 * simply ignoring those characters.
jpayne@69 388 *
jpayne@69 389 * @param context The function currently recognizes the callback options:
jpayne@69 390 * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
jpayne@69 391 * returning the error code back to the caller immediately.
jpayne@69 392 * NULL: Skips any ILLEGAL_SEQUENCE
jpayne@69 393 * @param toUArgs Information about the conversion in progress
jpayne@69 394 * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
jpayne@69 395 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 396 * @param reason Defines the reason the callback was invoked
jpayne@69 397 * @param err Return value will be set to success if the callback was handled,
jpayne@69 398 * otherwise this value will be set to a failure status.
jpayne@69 399 * @stable ICU 2.0
jpayne@69 400 */
jpayne@69 401 U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
jpayne@69 402 const void *context,
jpayne@69 403 UConverterToUnicodeArgs *toUArgs,
jpayne@69 404 const char* codeUnits,
jpayne@69 405 int32_t length,
jpayne@69 406 UConverterCallbackReason reason,
jpayne@69 407 UErrorCode * err);
jpayne@69 408
jpayne@69 409 /**
jpayne@69 410 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 411 * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or
jpayne@69 412 * UNASSIGNED_SEQUENCE depending on context parameter, with the
jpayne@69 413 * Unicode substitution character, U+FFFD.
jpayne@69 414 *
jpayne@69 415 * @param context The function currently recognizes the callback options:
jpayne@69 416 * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
jpayne@69 417 * returning the error code back to the caller immediately.
jpayne@69 418 * NULL: Substitutes any ILLEGAL_SEQUENCE
jpayne@69 419 * @param toUArgs Information about the conversion in progress
jpayne@69 420 * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
jpayne@69 421 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 422 * @param reason Defines the reason the callback was invoked
jpayne@69 423 * @param err Return value will be set to success if the callback was handled,
jpayne@69 424 * otherwise this value will be set to a failure status.
jpayne@69 425 * @stable ICU 2.0
jpayne@69 426 */
jpayne@69 427 U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
jpayne@69 428 const void *context,
jpayne@69 429 UConverterToUnicodeArgs *toUArgs,
jpayne@69 430 const char* codeUnits,
jpayne@69 431 int32_t length,
jpayne@69 432 UConverterCallbackReason reason,
jpayne@69 433 UErrorCode * err);
jpayne@69 434
jpayne@69 435 /**
jpayne@69 436 * DO NOT CALL THIS FUNCTION DIRECTLY!
jpayne@69 437 * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the
jpayne@69 438 * hexadecimal representation of the illegal bytes
jpayne@69 439 * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03").
jpayne@69 440 *
jpayne@69 441 * @param context This function currently recognizes the callback options:
jpayne@69 442 * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC,
jpayne@69 443 * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE.
jpayne@69 444 * @param toUArgs Information about the conversion in progress
jpayne@69 445 * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
jpayne@69 446 * @param length Size (in bytes) of the concerned codepage sequence
jpayne@69 447 * @param reason Defines the reason the callback was invoked
jpayne@69 448 * @param err Return value will be set to success if the callback was handled,
jpayne@69 449 * otherwise this value will be set to a failure status.
jpayne@69 450 * @stable ICU 2.0
jpayne@69 451 */
jpayne@69 452
jpayne@69 453 U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
jpayne@69 454 const void *context,
jpayne@69 455 UConverterToUnicodeArgs *toUArgs,
jpayne@69 456 const char* codeUnits,
jpayne@69 457 int32_t length,
jpayne@69 458 UConverterCallbackReason reason,
jpayne@69 459 UErrorCode * err);
jpayne@69 460
jpayne@69 461 #endif
jpayne@69 462
jpayne@69 463 #endif
jpayne@69 464
jpayne@69 465 /*UCNV_ERR_H*/