Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ucnvmbcs.h

Go to the documentation of this file.
00001 /*
00002 *******************************************************************************
00003 *
00004 *   Copyright (C) 2000, International Business Machines
00005 *   Corporation and others.  All Rights Reserved.
00006 *
00007 *******************************************************************************
00008 *   file name:  ucnvmbcs.h
00009 *   encoding:   US-ASCII
00010 *   tab size:   8 (not used)
00011 *   indentation:4
00012 *
00013 *   created on: 2000jul07
00014 *   created by: Markus W. Scherer
00015 */
00016 
00017 #ifndef __UCNVMBCS_H__
00018 #define __UCNVMBCS_H__
00019 
00020 #include "unicode/utypes.h"
00021 
00022 /* MBCS converter data and state -------------------------------------------- */
00023 
00024 enum {
00025     MBCS_STATE_ILLEGAL,
00026     MBCS_STATE_CHANGE_ONLY,
00027     MBCS_STATE_UNASSIGNED,
00028 
00029     MBCS_STATE_FALLBACK_DIRECT_16,
00030     MBCS_STATE_FALLBACK_DIRECT_20,
00031 
00032     MBCS_STATE_VALID_DIRECT_16,
00033     MBCS_STATE_VALID_DIRECT_20,
00034 
00035     MBCS_STATE_VALID_16,
00036     MBCS_STATE_VALID_16_PAIR
00037 };
00038 
00039 enum {
00040     MBCS_OUTPUT_1,
00041     MBCS_OUTPUT_2,
00042     MBCS_OUTPUT_3,
00043     MBCS_OUTPUT_4,
00044 
00045     MBCS_OUTPUT_3_EUC=8,
00046     MBCS_OUTPUT_4_EUC
00047 };
00048 
00049 typedef struct {
00050     uint32_t offset;
00051     UChar32 codePoint;
00052 } _MBCSToUFallback;
00053 
00054 typedef struct UConverterMBCSTable {
00055     /* toUnicode */
00056     uint8_t countStates;
00057     uint32_t countToUFallbacks;
00058 
00059     const int32_t (*stateTable)/*[countStates]*/[256];
00060     const uint16_t *unicodeCodeUnits/*[countUnicodeResults]*/;
00061     const _MBCSToUFallback *toUFallbacks;
00062 
00063     /* fromUnicode */
00064     const uint16_t *fromUnicodeTable;
00065     const uint8_t *fromUnicodeBytes;
00066     uint8_t outputType;
00067 } UConverterMBCSTable;
00068 
00069 /*
00070  * MBCS data structure as part of a .cnv file:
00071  *
00072  * uint32_t [8]; -- 8 values:
00073  *  0   MBCS version in UVersionInfo format (1.0.0.0)
00074  *  1   countStates
00075  *  2   countToUFallbacks
00076  *  3   offsetToUCodeUnits (offsets are counted from the beginning of this header structure)
00077  *  4   offsetFromUTable
00078  *  5   offsetFromUBytes
00079  *  6   flags, bits:
00080  *          31.. 8 reserved
00081  *           7.. 0 outputType
00082  *  7   reserved
00083  *
00084  * stateTable[countStates][256];
00085  *
00086  * struct { (fallbacks are sorted by offset)
00087  *     uint32_t offset;
00088  *     UChar32 codePoint;
00089  * } toUFallbacks[countToUFallbacks];
00090  *
00091  * uint16_t unicodeCodeUnits[?]; (even number of units or padded)
00092  *
00093  * uint16_t fromUTable[0x440+?]; (32-bit-aligned)
00094  *
00095  * uint8_t fromUBytes[?];
00096  */
00097 typedef struct {
00098     UVersionInfo version;
00099     uint32_t countStates,
00100              countToUFallbacks,
00101              offsetToUCodeUnits,
00102              offsetFromUTable,
00103              offsetFromUBytes,
00104              flags,
00105              reserved;
00106 } _MBCSHeader;
00107 
00108 struct UConverterSharedData;
00109 typedef struct UConverterSharedData UConverterSharedData;
00110 
00111 U_CFUNC UChar32
00112 _MBCSSimpleGetNextUChar(UConverterSharedData *sharedData,
00113                         const char **pSource, const char *sourceLimit,
00114                         UBool useFallback);
00115 
00116 U_CFUNC UBool
00117 _MBCSIsLeadByte(UConverterSharedData *sharedData, char byte);
00118 
00119 U_CFUNC int32_t
00120 _MBCSFromUChar32(UConverterSharedData *sharedData,
00121                  UChar32 c, uint32_t *pValue,
00122                  UBool useFallback);
00123 
00124 #endif

Generated at Tue Dec 5 17:55:34 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000