X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/common/ucnvmbcs.h diff --git a/icuSources/common/ucnvmbcs.h b/icuSources/common/ucnvmbcs.h index 9e4f2957..209cdc53 100644 --- a/icuSources/common/ucnvmbcs.h +++ b/icuSources/common/ucnvmbcs.h @@ -1,12 +1,14 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * -* Copyright (C) 2000-2007, International Business Machines +* Copyright (C) 2000-2013, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: ucnvmbcs.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -60,6 +62,9 @@ * * When possible, makeconv continues to generate version 4.m files. * + * _MBCSHeader.version 5.4/4.4 supports "good one-way" mappings (|4) + * in the extension tables (fromUTableValues bit 30). See ucnv_ext.h for details. + * * _MBCSHeader.version 4.3 optionally modifies the fromUnicode data structures * slightly and optionally adds a table for conversion to MBCS (non-SBCS) * charsets. @@ -274,17 +279,17 @@ enum { #define MBCS_ENTRY_SET_STATE(entry, state) (int32_t)(((entry)&0x80ffffff)|((int32_t)(state)<<24L)) -#define MBCS_ENTRY_STATE(entry) (((entry)>>24)&0x7f) +#define MBCS_ENTRY_STATE(entry) ((((uint32_t)entry)>>24)&0x7f) #define MBCS_ENTRY_IS_TRANSITION(entry) ((entry)>=0) #define MBCS_ENTRY_IS_FINAL(entry) ((entry)<0) -#define MBCS_ENTRY_TRANSITION_STATE(entry) ((entry)>>24) +#define MBCS_ENTRY_TRANSITION_STATE(entry) (((uint32_t)entry)>>24) #define MBCS_ENTRY_TRANSITION_OFFSET(entry) ((entry)&0xffffff) -#define MBCS_ENTRY_FINAL_STATE(entry) (((entry)>>24)&0x7f) +#define MBCS_ENTRY_FINAL_STATE(entry) ((((uint32_t)entry)>>24)&0x7f) #define MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry) ((entry)<(int32_t)0x80100000) -#define MBCS_ENTRY_FINAL_ACTION(entry) (((entry)>>20)&0xf) +#define MBCS_ENTRY_FINAL_ACTION(entry) ((((uint32_t)entry)>>20)&0xf) #define MBCS_ENTRY_FINAL_VALUE(entry) ((entry)&0xfffff) #define MBCS_ENTRY_FINAL_VALUE_16(entry) (uint16_t)(entry) @@ -397,6 +402,41 @@ typedef struct UConverterMBCSTable { const int32_t *extIndexes; } UConverterMBCSTable; +#define UCNV_MBCS_TABLE_INITIALIZER { \ + /* toUnicode */ \ + 0, 0, 0, \ + 0, \ + \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + \ + /* fromUnicode */ \ + NULL, \ + NULL, \ + { 0 }, \ + NULL, \ + NULL, \ + 0, \ + 0, 0, \ + FALSE, \ + 0, \ + \ + /* roundtrips */ \ + 0, \ + \ + /* reconstituted data that was omitted from the .cnv file */ \ + NULL, \ + \ + /* converter name for swaplfnl */ \ + NULL, \ + \ + /* extension data */ \ + NULL, \ + NULL \ +} + enum { MBCS_OPT_LENGTH_MASK=0x3f, MBCS_OPT_NO_FROM_U=0x40, @@ -437,6 +477,8 @@ typedef struct { uint32_t fullStage2Length; /* number of 32-bit units */ } _MBCSHeader; +#define UCNV_MBCS_HEADER_INITIALIZER { { 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + /* * This is a simple version of _MBCSGetNextUChar() that is used * by other converter implementations.