00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef UCNV_BLD_H
00025 #define UCNV_BLD_H
00026
00027 #include "unicode/utypes.h"
00028 #include "unicode/ucnv.h"
00029 #include "unicode/ucnv_err.h"
00030 #include "ucnvmbcs.h"
00031
00032
00033 #define UCNV_ERROR_BUFFER_LENGTH 32
00034
00035 #define UCNV_MAX_SUBCHAR_LEN 4
00036 #define UCNV_MAX_AMBIGUOUSCCSIDS 5
00037
00038
00039 typedef struct
00040 {
00041 int32_t ccsid;
00042 UChar mismapped;
00043 UChar replacement;
00044 } UAmbiguousConverter;
00045
00046 static const UAmbiguousConverter UCNV_AMBIGUOUSCONVERTERS[UCNV_MAX_AMBIGUOUSCCSIDS] =
00047 {
00048 { 943, 0x00A5, 0x005C },
00049 { 949, 0x20A9, 0x005C },
00050 { 1361, 0x20A9, 0x005C },
00051 { 942, 0x00A5, 0x005C },
00052 { 1363, 0x20A9, 0x005C }
00053 };
00054
00055
00056 U_CDECL_BEGIN
00057
00058
00059
00060
00061 union UConverterTable;
00062 typedef union UConverterTable UConverterTable;
00063
00064 struct UConverterImpl;
00065 typedef struct UConverterImpl UConverterImpl;
00066
00067 typedef struct UConverterStaticData {
00068 uint32_t structSize;
00069
00070 char name
00071 [UCNV_MAX_CONVERTER_NAME_LENGTH];
00072
00073 int32_t codepage;
00074
00075 int8_t platform;
00076 int8_t conversionType;
00077
00078 int8_t minBytesPerChar;
00079 int8_t maxBytesPerChar;
00080
00081 uint8_t subChar[UCNV_MAX_SUBCHAR_LEN];
00082 int8_t subCharLen;
00083
00084 uint8_t hasToUnicodeFallback;
00085 uint8_t hasFromUnicodeFallback;
00086 uint8_t reserved[21];
00087
00088 } UConverterStaticData;
00089
00090
00091
00092
00093
00094 struct UConverterSharedData {
00095 uint32_t structSize;
00096 uint32_t referenceCounter;
00097
00098 const void *dataMemory;
00099 UConverterTable *table;
00100
00101 const UConverterStaticData *staticData;
00102 UBool staticDataOwned;
00103 const UConverterImpl *impl;
00104
00105
00106 uint32_t toUnicodeStatus;
00107 };
00108
00109
00110
00111
00112 struct UConverter {
00113 uint32_t toUnicodeStatus;
00114 uint8_t toUBytes[7];
00115 int8_t toULength;
00116 uint32_t fromUnicodeStatus;
00117 UChar fromUSurrogateLead;
00118 int32_t mode;
00119 UBool useFallback;
00120
00121 int8_t subCharLen;
00122 int8_t invalidCharLength;
00123 int8_t invalidUCharLength;
00124 int8_t charErrorBufferLength;
00125 int8_t UCharErrorBufferLength;
00126
00127 uint8_t subChar[UCNV_MAX_SUBCHAR_LEN];
00128 char invalidCharBuffer[UCNV_MAX_SUBCHAR_LEN];
00129 uint8_t charErrorBuffer[UCNV_ERROR_BUFFER_LENGTH];
00130
00131 UChar invalidUCharBuffer[3];
00132 UChar UCharErrorBuffer[UCNV_ERROR_BUFFER_LENGTH];
00133
00134
00135
00136
00137
00138 void (*fromUCharErrorBehaviour) (void *context,
00139 UConverterFromUnicodeArgs *args,
00140 const UChar *codeUnits,
00141 int32_t length,
00142 UChar32 codePoint,
00143 UConverterCallbackReason reason,
00144 UErrorCode *);
00145
00146
00147
00148
00149 void (*fromCharErrorBehaviour) (void *context,
00150 UConverterToUnicodeArgs *args,
00151 const char *codeUnits,
00152 int32_t length,
00153 UConverterCallbackReason reason,
00154 UErrorCode *);
00155
00156 void *fromUContext;
00157 void *toUContext;
00158 UConverterSharedData *sharedData;
00159
00160
00161
00162
00163
00164 void *extraInfo;
00165 };
00166
00167 U_CDECL_END
00168
00169 typedef struct
00170 {
00171 UConverter *OptGrpConverter[0x20];
00172 uint8_t OptGroup;
00173 uint8_t localeConverterIndex;
00174
00175 }
00176 UConverterDataLMBCS;
00177
00178 #define CONVERTER_FILE_EXTENSION ".cnv"
00179
00180 #endif