001: /**
002: *******************************************************************************
003: * Copyright (C) 2006, International Business Machines Corporation and *
004: * others. All Rights Reserved. *
005: *******************************************************************************
006: *
007: *******************************************************************************
008: */package com.ibm.icu.charset;
009:
010: interface UConverterConstants {
011:
012: static final short UNSIGNED_BYTE_MASK = 0xff;
013: static final int UNSIGNED_SHORT_MASK = 0xffff;
014: static final long UNSIGNED_INT_MASK = 0xffffffffL;
015:
016: static final int U_IS_BIG_ENDIAN = 0;
017:
018: /**
019: * Useful constant for the maximum size of the whole locale ID
020: * (including the terminating NULL).
021: * @draft ICU 3.6
022: */
023: static final int ULOC_FULLNAME_CAPACITY = 56;
024:
025: /**
026: * This value is intended for sentinel values for APIs that
027: * (take or) return single code points (UChar32).
028: * It is outside of the Unicode code point range 0..0x10ffff.
029: *
030: * For example, a "done" or "error" value in a new API
031: * could be indicated with U_SENTINEL.
032: *
033: * ICU APIs designed before ICU 2.4 usually define service-specific "done"
034: * values, mostly 0xffff.
035: * Those may need to be distinguished from
036: * actual U+ffff text contents by calling functions like
037: * CharacterIterator::hasNext() or UnicodeString::length().
038: * @draft ICU 2.4
039: */
040: static final int U_SENTINEL = -1;
041:
042: //end utf.h
043:
044: //begin ucnv.h
045: /**
046: * Character that separates converter names from options and options from each other.
047: * @see CharsetICU#forNameICU(String)
048: * @draft ICU 3.6
049: */
050: static final byte OPTION_SEP_CHAR = ',';
051:
052: /** Maximum length of a converter name including the terminating NULL @draft ICU 3.6 */
053: static final int MAX_CONVERTER_NAME_LENGTH = 60;
054: /** Maximum length of a converter name including path and terminating NULL @draft ICU 3.6 */
055: static final int MAX_FULL_FILE_NAME_LENGTH = (600 + MAX_CONVERTER_NAME_LENGTH);
056:
057: /** Shift in for EBDCDIC_STATEFUL and iso2022 states @draft ICU 3.6 */
058: static final int SI = 0x0F;
059: /** Shift out for EBDCDIC_STATEFUL and iso2022 states @draft ICU 3.6 */
060: static final int SO = 0x0E;
061:
062: //end ucnv.h
063:
064: // begin bld.h
065: /* size of the overflow buffers in UConverter, enough for escaping callbacks */
066: //#define ERROR_BUFFER_LENGTH 32
067: static final int ERROR_BUFFER_LENGTH = 32;
068:
069: /* at most 4 bytes per substitution character (part of .cnv file format! see UConverterStaticData) */
070: static final int MAX_SUBCHAR_LEN = 4;
071:
072: /* at most 8 bytes per character in toUBytes[] (UTF-8 uses up to 6) */
073: static final int MAX_CHAR_LEN = 8;
074:
075: /* converter options bits */
076: static final int OPTION_VERSION = 0xf;
077: static final int OPTION_SWAP_LFNL = 0x10;
078: static final int OPTION_MAC = 0x20; //agljport:comment added for Mac ISCII encodings
079:
080: /** values for the unicodeMask */
081: static final int HAS_SUPPLEMENTARY = 1;
082: static final int HAS_SURROGATES = 2;
083: // end bld.h
084:
085: // begin cnv.h
086: /* this is used in fromUnicode DBCS tables as an "unassigned" marker */
087: static final int missingCharMarker = 0xFFFF;
088:
089: /**
090: *
091: * @author ram
092: * @draft ICU 3.6
093: * @provisional This API might change or be removed in a future release.
094: */
095: static interface UConverterResetChoice {
096: static final int RESET_BOTH = 0;
097: static final int RESET_TO_UNICODE = RESET_BOTH + 1;
098: static final int RESET_FROM_UNICODE = RESET_TO_UNICODE + 1;
099: }
100:
101: // begin utf16.h
102: /**
103: * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
104: * @draft ICU 2.4
105: */
106: static final int U16_MAX_LENGTH = 2;
107: // end utf16.h
108:
109: // begin err.h
110: /**
111: * FROM_U, TO_U context options for sub callback
112: * @draft ICU 3.6
113: */
114: static byte[] SUB_STOP_ON_ILLEGAL = { 'i' };
115:
116: /**
117: * FROM_U, TO_U context options for skip callback
118: * @draft ICU 3.6
119: */
120: static byte[] SKIP_STOP_ON_ILLEGAL = { 'i' };
121:
122: /**
123: * The process condition code to be used with the callbacks.
124: * Codes which are greater than IRREGULAR should be
125: * passed on to any chained callbacks.
126: * @draft ICU 3.6
127: * @provisional This API might change or be removed in a future release.
128: */
129: static interface UConverterCallbackReason {
130: static final int UNASSIGNED = 0;
131: /**< The code point is unassigned.
132: The error code U_INVALID_CHAR_FOUND will be set. */
133: static final int ILLEGAL = 1;
134: /**< The code point is illegal. For example,
135: \\x81\\x2E is illegal in SJIS because \\x2E
136: is not a valid trail byte for the \\x81
137: lead byte.
138: Also, starting with Unicode 3.0.1, non-shortest byte sequences
139: in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
140: are also illegal, not just irregular.
141: The error code U_ILLEGAL_CHAR_FOUND will be set. */
142: static final int IRREGULAR = 2;
143: /**< The codepoint is not a regular sequence in
144: the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
145: are irregular UTF-8 byte sequences for single surrogate
146: code points.
147: The error code U_INVALID_CHAR_FOUND will be set. */
148: static final int RESET = 3;
149: /**< The callback is called with this reason when a
150: 'reset' has occured. Callback should reset all
151: state. */
152: static final int CLOSE = 4;
153: /**< Called when the converter is closed. The
154: callback should release any allocated memory.*/
155: static final int CLONE = 5;
156: /**< Called when safeClone() is called on the
157: converter. the pointer available as the
158: 'context' is an alias to the original converters'
159: context pointer. If the context must be owned
160: by the new converter, the callback must clone
161: the data and call setFromUCallback
162: (or setToUCallback) with the correct pointer.
163: @draft ICU 2.2
164: */
165: }
166:
167: //end err.h
168:
169: static final String DATA_TYPE = "cnv";
170: static final int CNV_DATA_BUFFER_SIZE = 25000;
171: static final int SIZE_OF_UCONVERTER_SHARED_DATA = 100;
172:
173: static final int MAXIMUM_UCS2 = 0x0000FFFF;
174: static final int MAXIMUM_UTF = 0x0010FFFF;
175: static final int MAXIMUM_UCS4 = 0x7FFFFFFF;
176: static final int HALF_SHIFT = 10;
177: static final int HALF_BASE = 0x0010000;
178: static final int HALF_MASK = 0x3FF;
179: static final int SURROGATE_HIGH_START = 0xD800;
180: static final int SURROGATE_HIGH_END = 0xDBFF;
181: static final int SURROGATE_LOW_START = 0xDC00;
182: static final int SURROGATE_LOW_END = 0xDFFF;
183:
184: /* -SURROGATE_LOW_START + HALF_BASE */
185: static final int SURROGATE_LOW_BASE = 9216;
186: }
|