intl/icu/source/common/unicode/ucnv_err.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/unicode/ucnv_err.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,463 @@
     1.4 +/*
     1.5 +**********************************************************************
     1.6 +*   Copyright (C) 1999-2009, International Business Machines
     1.7 +*   Corporation and others.  All Rights Reserved.
     1.8 +**********************************************************************
     1.9 + *
    1.10 + *
    1.11 + *   ucnv_err.h:
    1.12 + */
    1.13 +
    1.14 +/**
    1.15 + * \file
    1.16 + * \brief C UConverter predefined error callbacks
    1.17 + *
    1.18 + *  <h2>Error Behaviour Functions</h2>
    1.19 + *  Defines some error behaviour functions called by ucnv_{from,to}Unicode
    1.20 + *  These are provided as part of ICU and many are stable, but they
    1.21 + *  can also be considered only as an example of what can be done with
    1.22 + *  callbacks.  You may of course write your own.
    1.23 + *
    1.24 + *  If you want to write your own, you may also find the functions from
    1.25 + *  ucnv_cb.h useful when writing your own callbacks.
    1.26 + *
    1.27 + *  These functions, although public, should NEVER be called directly.
    1.28 + *  They should be used as parameters to the ucnv_setFromUCallback
    1.29 + *  and ucnv_setToUCallback functions, to set the behaviour of a converter
    1.30 + *  when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
    1.31 + *
    1.32 + *  usage example:  'STOP' doesn't need any context, but newContext
    1.33 + *    could be set to something other than 'NULL' if needed. The available
    1.34 + *    contexts in this header can modify the default behavior of the callback.
    1.35 + *
    1.36 + *  \code
    1.37 + *  UErrorCode err = U_ZERO_ERROR;
    1.38 + *  UConverter *myConverter = ucnv_open("ibm-949", &err);
    1.39 + *  const void *oldContext;
    1.40 + *  UConverterFromUCallback oldAction;
    1.41 + *
    1.42 + *
    1.43 + *  if (U_SUCCESS(err))
    1.44 + *  {
    1.45 + *      ucnv_setFromUCallBack(myConverter,
    1.46 + *                       UCNV_FROM_U_CALLBACK_STOP,
    1.47 + *                       NULL,
    1.48 + *                       &oldAction,
    1.49 + *                       &oldContext,
    1.50 + *                       &status);
    1.51 + *  }
    1.52 + *  \endcode
    1.53 + *
    1.54 + *  The code above tells "myConverter" to stop when it encounters an
    1.55 + *  ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
    1.56 + *  Unicode -> Codepage. The behavior from Codepage to Unicode is not changed,
    1.57 + *  and ucnv_setToUCallBack would need to be called in order to change
    1.58 + *  that behavior too.
    1.59 + *
    1.60 + *  Here is an example with a context:
    1.61 + *
    1.62 + *  \code
    1.63 + *  UErrorCode err = U_ZERO_ERROR;
    1.64 + *  UConverter *myConverter = ucnv_open("ibm-949", &err);
    1.65 + *  const void *oldContext;
    1.66 + *  UConverterFromUCallback oldAction;
    1.67 + *
    1.68 + *
    1.69 + *  if (U_SUCCESS(err))
    1.70 + *  {
    1.71 + *      ucnv_setToUCallBack(myConverter,
    1.72 + *                       UCNV_TO_U_CALLBACK_SUBSTITUTE,
    1.73 + *                       UCNV_SUB_STOP_ON_ILLEGAL,
    1.74 + *                       &oldAction,
    1.75 + *                       &oldContext,
    1.76 + *                       &status);
    1.77 + *  }
    1.78 + *  \endcode
    1.79 + *
    1.80 + *  The code above tells "myConverter" to stop when it encounters an
    1.81 + *  ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
    1.82 + *  Codepage -> Unicode. Any unmapped and legal characters will be
    1.83 + *  substituted to be the default substitution character.
    1.84 + */
    1.85 +
    1.86 +#ifndef UCNV_ERR_H
    1.87 +#define UCNV_ERR_H
    1.88 +
    1.89 +#include "unicode/utypes.h"
    1.90 +
    1.91 +#if !UCONFIG_NO_CONVERSION
    1.92 +
    1.93 +/** Forward declaring the UConverter structure. @stable ICU 2.0 */
    1.94 +struct UConverter;
    1.95 +
    1.96 +/** @stable ICU 2.0 */
    1.97 +typedef struct UConverter UConverter;
    1.98 +
    1.99 +/**
   1.100 + * FROM_U, TO_U context options for sub callback
   1.101 + * @stable ICU 2.0
   1.102 + */
   1.103 +#define UCNV_SUB_STOP_ON_ILLEGAL "i"
   1.104 +
   1.105 +/**
   1.106 + * FROM_U, TO_U context options for skip callback
   1.107 + * @stable ICU 2.0
   1.108 + */
   1.109 +#define UCNV_SKIP_STOP_ON_ILLEGAL "i"
   1.110 +
   1.111 +/**
   1.112 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) 
   1.113 + * @stable ICU 2.0
   1.114 + */
   1.115 +#define UCNV_ESCAPE_ICU       NULL
   1.116 +/**
   1.117 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX)
   1.118 + * @stable ICU 2.0
   1.119 + */
   1.120 +#define UCNV_ESCAPE_JAVA      "J"
   1.121 +/**
   1.122 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
   1.123 + * TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX)
   1.124 + * @stable ICU 2.0
   1.125 + */
   1.126 +#define UCNV_ESCAPE_C         "C"
   1.127 +/**
   1.128 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
   1.129 + * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
   1.130 + * @stable ICU 2.0
   1.131 + */
   1.132 +#define UCNV_ESCAPE_XML_DEC   "D"
   1.133 +/**
   1.134 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
   1.135 + * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
   1.136 + * @stable ICU 2.0
   1.137 + */
   1.138 +#define UCNV_ESCAPE_XML_HEX   "X"
   1.139 +/**
   1.140 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX)
   1.141 + * @stable ICU 2.0
   1.142 + */
   1.143 +#define UCNV_ESCAPE_UNICODE   "U"
   1.144 +
   1.145 +/**
   1.146 + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H<space>, that is,
   1.147 + * a backslash, 1..6 hex digits, and a space)
   1.148 + * @stable ICU 4.0
   1.149 + */
   1.150 +#define UCNV_ESCAPE_CSS2   "S"
   1.151 +
   1.152 +/** 
   1.153 + * The process condition code to be used with the callbacks.  
   1.154 + * Codes which are greater than UCNV_IRREGULAR should be 
   1.155 + * passed on to any chained callbacks.
   1.156 + * @stable ICU 2.0
   1.157 + */
   1.158 +typedef enum {
   1.159 +    UCNV_UNASSIGNED = 0,  /**< The code point is unassigned.
   1.160 +                             The error code U_INVALID_CHAR_FOUND will be set. */
   1.161 +    UCNV_ILLEGAL = 1,     /**< The code point is illegal. For example, 
   1.162 +                             \\x81\\x2E is illegal in SJIS because \\x2E
   1.163 +                             is not a valid trail byte for the \\x81 
   1.164 +                             lead byte.
   1.165 +                             Also, starting with Unicode 3.0.1, non-shortest byte sequences
   1.166 +                             in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
   1.167 +                             are also illegal, not just irregular.
   1.168 +                             The error code U_ILLEGAL_CHAR_FOUND will be set. */
   1.169 +    UCNV_IRREGULAR = 2,   /**< The codepoint is not a regular sequence in 
   1.170 +                             the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
   1.171 +                             are irregular UTF-8 byte sequences for single surrogate
   1.172 +                             code points.
   1.173 +                             The error code U_INVALID_CHAR_FOUND will be set. */
   1.174 +    UCNV_RESET = 3,       /**< The callback is called with this reason when a
   1.175 +                             'reset' has occured. Callback should reset all
   1.176 +                             state. */
   1.177 +    UCNV_CLOSE = 4,        /**< Called when the converter is closed. The
   1.178 +                             callback should release any allocated memory.*/
   1.179 +    UCNV_CLONE = 5         /**< Called when ucnv_safeClone() is called on the
   1.180 +                              converter. the pointer available as the
   1.181 +                              'context' is an alias to the original converters'
   1.182 +                              context pointer. If the context must be owned
   1.183 +                              by the new converter, the callback must clone 
   1.184 +                              the data and call ucnv_setFromUCallback 
   1.185 +                              (or setToUCallback) with the correct pointer.
   1.186 +                              @stable ICU 2.2
   1.187 +                           */
   1.188 +} UConverterCallbackReason;
   1.189 +
   1.190 +
   1.191 +/**
   1.192 + * The structure for the fromUnicode callback function parameter.
   1.193 + * @stable ICU 2.0
   1.194 + */
   1.195 +typedef struct {
   1.196 +    uint16_t size;              /**< The size of this struct. @stable ICU 2.0 */
   1.197 +    UBool flush;                /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0    */
   1.198 +    UConverter *converter;      /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0  */
   1.199 +    const UChar *source;        /**< Pointer to the source source buffer. @stable ICU 2.0    */
   1.200 +    const UChar *sourceLimit;   /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0    */
   1.201 +    char *target;               /**< Pointer to the target buffer. @stable ICU 2.0    */
   1.202 +    const char *targetLimit;    /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0     */
   1.203 +    int32_t *offsets;           /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0  */
   1.204 +} UConverterFromUnicodeArgs;
   1.205 +
   1.206 +
   1.207 +/**
   1.208 + * The structure for the toUnicode callback function parameter.
   1.209 + * @stable ICU 2.0
   1.210 + */
   1.211 +typedef struct {
   1.212 +    uint16_t size;              /**< The size of this struct   @stable ICU 2.0 */
   1.213 +    UBool flush;                /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0   */
   1.214 +    UConverter *converter;      /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
   1.215 +    const char *source;         /**< Pointer to the source source buffer. @stable ICU 2.0    */
   1.216 +    const char *sourceLimit;    /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0    */
   1.217 +    UChar *target;              /**< Pointer to the target buffer. @stable ICU 2.0    */
   1.218 +    const UChar *targetLimit;   /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0     */
   1.219 +    int32_t *offsets;           /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0  */
   1.220 +} UConverterToUnicodeArgs;
   1.221 +
   1.222 +
   1.223 +/**
   1.224 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.225 + * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,
   1.226 + * returning the error code back to the caller immediately.
   1.227 + *
   1.228 + * @param context Pointer to the callback's private data
   1.229 + * @param fromUArgs Information about the conversion in progress
   1.230 + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
   1.231 + * @param length Size (in bytes) of the concerned codepage sequence
   1.232 + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
   1.233 + * @param reason Defines the reason the callback was invoked
   1.234 + * @param err This should always be set to a failure status prior to calling.
   1.235 + * @stable ICU 2.0
   1.236 + */
   1.237 +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
   1.238 +                  const void *context,
   1.239 +                  UConverterFromUnicodeArgs *fromUArgs,
   1.240 +                  const UChar* codeUnits,
   1.241 +                  int32_t length,
   1.242 +                  UChar32 codePoint,
   1.243 +                  UConverterCallbackReason reason,
   1.244 +                  UErrorCode * err);
   1.245 +
   1.246 +
   1.247 +
   1.248 +/**
   1.249 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.250 + * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,
   1.251 + * returning the error code back to the caller immediately.
   1.252 + *
   1.253 + * @param context Pointer to the callback's private data
   1.254 + * @param toUArgs Information about the conversion in progress
   1.255 + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
   1.256 + * @param length Size (in bytes) of the concerned codepage sequence
   1.257 + * @param reason Defines the reason the callback was invoked
   1.258 + * @param err This should always be set to a failure status prior to calling.
   1.259 + * @stable ICU 2.0
   1.260 + */
   1.261 +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
   1.262 +                  const void *context,
   1.263 +                  UConverterToUnicodeArgs *toUArgs,
   1.264 +                  const char* codeUnits,
   1.265 +                  int32_t length,
   1.266 +                  UConverterCallbackReason reason,
   1.267 +                  UErrorCode * err);
   1.268 +
   1.269 +/**
   1.270 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.271 + * This From Unicode callback skips any ILLEGAL_SEQUENCE, or
   1.272 + * skips only UNASSINGED_SEQUENCE depending on the context parameter
   1.273 + * simply ignoring those characters. 
   1.274 + *
   1.275 + * @param context  The function currently recognizes the callback options:
   1.276 + *                 UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
   1.277 + *                      returning the error code back to the caller immediately.
   1.278 + *                 NULL: Skips any ILLEGAL_SEQUENCE
   1.279 + * @param fromUArgs Information about the conversion in progress
   1.280 + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
   1.281 + * @param length Size (in bytes) of the concerned codepage sequence
   1.282 + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
   1.283 + * @param reason Defines the reason the callback was invoked
   1.284 + * @param err Return value will be set to success if the callback was handled,
   1.285 + *      otherwise this value will be set to a failure status.
   1.286 + * @stable ICU 2.0
   1.287 + */
   1.288 +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
   1.289 +                  const void *context,
   1.290 +                  UConverterFromUnicodeArgs *fromUArgs,
   1.291 +                  const UChar* codeUnits,
   1.292 +                  int32_t length,
   1.293 +                  UChar32 codePoint,
   1.294 +                  UConverterCallbackReason reason,
   1.295 +                  UErrorCode * err);
   1.296 +
   1.297 +/**
   1.298 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.299 + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or 
   1.300 + * UNASSIGNED_SEQUENCE depending on context parameter, with the
   1.301 + * current substitution string for the converter. This is the default
   1.302 + * callback.
   1.303 + *
   1.304 + * @param context The function currently recognizes the callback options:
   1.305 + *                 UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
   1.306 + *                      returning the error code back to the caller immediately.
   1.307 + *                 NULL: Substitutes any ILLEGAL_SEQUENCE
   1.308 + * @param fromUArgs Information about the conversion in progress
   1.309 + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
   1.310 + * @param length Size (in bytes) of the concerned codepage sequence
   1.311 + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
   1.312 + * @param reason Defines the reason the callback was invoked
   1.313 + * @param err Return value will be set to success if the callback was handled,
   1.314 + *      otherwise this value will be set to a failure status.
   1.315 + * @see ucnv_setSubstChars
   1.316 + * @stable ICU 2.0
   1.317 + */
   1.318 +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
   1.319 +                  const void *context,
   1.320 +                  UConverterFromUnicodeArgs *fromUArgs,
   1.321 +                  const UChar* codeUnits,
   1.322 +                  int32_t length,
   1.323 +                  UChar32 codePoint,
   1.324 +                  UConverterCallbackReason reason,
   1.325 +                  UErrorCode * err);
   1.326 +
   1.327 +/**
   1.328 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.329 + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the
   1.330 + * hexadecimal representation of the illegal codepoints
   1.331 + *
   1.332 + * @param context The function currently recognizes the callback options:
   1.333 + *        <ul>
   1.334 + *        <li>UCNV_ESCAPE_ICU: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
   1.335 + *          representation in the format  %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). 
   1.336 + *          In the Event the converter doesn't support the characters {%,U}[A-F][0-9], 
   1.337 + *          it will  substitute  the illegal sequence with the substitution characters.
   1.338 + *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
   1.339 + *          %UD84D%UDC56</li>
   1.340 + *        <li>UCNV_ESCAPE_JAVA: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
   1.341 + *          representation in the format  \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). 
   1.342 + *          In the Event the converter doesn't support the characters {\,u}[A-F][0-9], 
   1.343 + *          it will  substitute  the illegal sequence with the substitution characters.
   1.344 + *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
   1.345 + *          \\uD84D\\uDC56</li>
   1.346 + *        <li>UCNV_ESCAPE_C: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
   1.347 + *          representation in the format  \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). 
   1.348 + *          In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], 
   1.349 + *          it will  substitute  the illegal sequence with the substitution characters.
   1.350 + *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
   1.351 + *          \\U00023456</li>
   1.352 + *        <li>UCNV_ESCAPE_XML_DEC: Substitues the  ILLEGAL SEQUENCE with the decimal 
   1.353 + *          representation in the format \htmlonly&amp;#DDDDDDDD;, e.g. "&amp;#65534;&amp;#172;&amp;#51454;")\endhtmlonly. 
   1.354 + *          In the Event the converter doesn't support the characters {&amp;,#}[0-9], 
   1.355 + *          it will  substitute  the illegal sequence with the substitution characters.
   1.356 + *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
   1.357 + *          &amp;#144470; and Zero padding is ignored.</li>
   1.358 + *        <li>UCNV_ESCAPE_XML_HEX:Substitues the  ILLEGAL SEQUENCE with the decimal 
   1.359 + *          representation in the format \htmlonly&amp;#xXXXX; e.g. "&amp;#xFFFE;&amp;#x00AC;&amp;#xC8FE;")\endhtmlonly. 
   1.360 + *          In the Event the converter doesn't support the characters {&,#,x}[0-9], 
   1.361 + *          it will  substitute  the illegal sequence with the substitution characters.
   1.362 + *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
   1.363 + *          \htmlonly&amp;#x23456;\endhtmlonly</li>
   1.364 + *        </ul>
   1.365 + * @param fromUArgs Information about the conversion in progress
   1.366 + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
   1.367 + * @param length Size (in bytes) of the concerned codepage sequence
   1.368 + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
   1.369 + * @param reason Defines the reason the callback was invoked
   1.370 + * @param err Return value will be set to success if the callback was handled,
   1.371 + *      otherwise this value will be set to a failure status.
   1.372 + * @stable ICU 2.0
   1.373 + */
   1.374 +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
   1.375 +                  const void *context,
   1.376 +                  UConverterFromUnicodeArgs *fromUArgs,
   1.377 +                  const UChar* codeUnits,
   1.378 +                  int32_t length,
   1.379 +                  UChar32 codePoint,
   1.380 +                  UConverterCallbackReason reason,
   1.381 +                  UErrorCode * err);
   1.382 +
   1.383 +
   1.384 +/**
   1.385 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.386 + * This To Unicode callback skips any ILLEGAL_SEQUENCE, or
   1.387 + * skips only UNASSINGED_SEQUENCE depending on the context parameter
   1.388 + * simply ignoring those characters. 
   1.389 + *
   1.390 + * @param context  The function currently recognizes the callback options:
   1.391 + *                 UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
   1.392 + *                      returning the error code back to the caller immediately.
   1.393 + *                 NULL: Skips any ILLEGAL_SEQUENCE
   1.394 + * @param toUArgs Information about the conversion in progress
   1.395 + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
   1.396 + * @param length Size (in bytes) of the concerned codepage sequence
   1.397 + * @param reason Defines the reason the callback was invoked
   1.398 + * @param err Return value will be set to success if the callback was handled,
   1.399 + *      otherwise this value will be set to a failure status.
   1.400 + * @stable ICU 2.0
   1.401 + */
   1.402 +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
   1.403 +                  const void *context,
   1.404 +                  UConverterToUnicodeArgs *toUArgs,
   1.405 +                  const char* codeUnits,
   1.406 +                  int32_t length,
   1.407 +                  UConverterCallbackReason reason,
   1.408 +                  UErrorCode * err);
   1.409 +
   1.410 +/**
   1.411 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.412 + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or 
   1.413 + * UNASSIGNED_SEQUENCE depending on context parameter,  with the
   1.414 + * Unicode substitution character, U+FFFD.
   1.415 + *
   1.416 + * @param context  The function currently recognizes the callback options:
   1.417 + *                 UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
   1.418 + *                      returning the error code back to the caller immediately.
   1.419 + *                 NULL: Substitutes any ILLEGAL_SEQUENCE
   1.420 + * @param toUArgs Information about the conversion in progress
   1.421 + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
   1.422 + * @param length Size (in bytes) of the concerned codepage sequence
   1.423 + * @param reason Defines the reason the callback was invoked
   1.424 + * @param err Return value will be set to success if the callback was handled,
   1.425 + *      otherwise this value will be set to a failure status.
   1.426 + * @stable ICU 2.0
   1.427 + */
   1.428 +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
   1.429 +                  const void *context,
   1.430 +                  UConverterToUnicodeArgs *toUArgs,
   1.431 +                  const char* codeUnits,
   1.432 +                  int32_t length,
   1.433 +                  UConverterCallbackReason reason,
   1.434 +                  UErrorCode * err);
   1.435 +
   1.436 +/**
   1.437 + * DO NOT CALL THIS FUNCTION DIRECTLY!
   1.438 + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the
   1.439 + * hexadecimal representation of the illegal bytes
   1.440 + *  (in the format  %XNN, e.g. "%XFF%X0A%XC8%X03").
   1.441 + *
   1.442 + * @param context This function currently recognizes the callback options:
   1.443 + *      UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC,
   1.444 + *      UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE.
   1.445 + * @param toUArgs Information about the conversion in progress
   1.446 + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
   1.447 + * @param length Size (in bytes) of the concerned codepage sequence
   1.448 + * @param reason Defines the reason the callback was invoked
   1.449 + * @param err Return value will be set to success if the callback was handled,
   1.450 + *      otherwise this value will be set to a failure status.
   1.451 + * @stable ICU 2.0
   1.452 + */
   1.453 +
   1.454 +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
   1.455 +                  const void *context,
   1.456 +                  UConverterToUnicodeArgs *toUArgs,
   1.457 +                  const char* codeUnits,
   1.458 +                  int32_t length,
   1.459 +                  UConverterCallbackReason reason,
   1.460 +                  UErrorCode * err);
   1.461 +
   1.462 +#endif
   1.463 +
   1.464 +#endif
   1.465 +
   1.466 +/*UCNV_ERR_H*/ 

mercurial