/* ******************************************************************************* * * Copyright (C) 2002-2005, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uprops.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002feb24 * created by: Markus W. Scherer * * Constants for mostly non-core Unicode character properties * stored in uprops.icu. */ #ifndef __UPROPS_H__ #define __UPROPS_H__ #include "unicode/utypes.h" #include "unicode/uset.h" #include "uset_imp.h" #include "udataswp.h" /* indexes[] entries */ enum { UPROPS_PROPS32_INDEX, UPROPS_EXCEPTIONS_INDEX, UPROPS_EXCEPTIONS_TOP_INDEX, UPROPS_ADDITIONAL_TRIE_INDEX, UPROPS_ADDITIONAL_VECTORS_INDEX, UPROPS_ADDITIONAL_VECTORS_COLUMNS_INDEX, UPROPS_RESERVED_INDEX, /* 6 */ /* maximum values for code values in vector word 0 */ UPROPS_MAX_VALUES_INDEX=10, /* maximum values for code values in vector word 2 */ UPROPS_MAX_VALUES_2_INDEX, UPROPS_INDEX_COUNT=16 }; /* definitions for the main properties words */ enum { /* general category shift==0 0 (5 bits) */ UPROPS_NUMERIC_TYPE_SHIFT=5, /* 5 (3 bits) */ UPROPS_NUMERIC_VALUE_SHIFT=8 /* 8 (8 bits) */ }; #define GET_CATEGORY(props) ((props)&0x1f) #define CAT_MASK(props) U_MASK(GET_CATEGORY(props)) #define GET_NUMERIC_TYPE(props) (((props)>>UPROPS_NUMERIC_TYPE_SHIFT)&7) #define GET_NUMERIC_VALUE(props) (((props)>>UPROPS_NUMERIC_VALUE_SHIFT)&0xff) /* internal numeric pseudo-types for special encodings of numeric values */ enum { UPROPS_NT_FRACTION=4, /* ==U_NT_COUNT, must not change unless binary format version changes */ UPROPS_NT_LARGE, UPROPS_NT_COUNT }; /* encoding of fractional and large numbers */ enum { UPROPS_MAX_SMALL_NUMBER=0xff, UPROPS_FRACTION_NUM_SHIFT=3, /* numerator: bits 7..3 */ UPROPS_FRACTION_DEN_MASK=7, /* denominator: bits 2..0 */ UPROPS_FRACTION_MAX_NUM=31, UPROPS_FRACTION_DEN_OFFSET=2, /* denominator values are 2..9 */ UPROPS_FRACTION_MIN_DEN=UPROPS_FRACTION_DEN_OFFSET, UPROPS_FRACTION_MAX_DEN=UPROPS_FRACTION_MIN_DEN+UPROPS_FRACTION_DEN_MASK, UPROPS_LARGE_MANT_SHIFT=4, /* mantissa: bits 7..4 */ UPROPS_LARGE_EXP_MASK=0xf, /* exponent: bits 3..0 */ UPROPS_LARGE_EXP_OFFSET=2, /* regular exponents 2..17 */ UPROPS_LARGE_EXP_OFFSET_EXTRA=18, /* extra large exponents 18..33 */ UPROPS_LARGE_MIN_EXP=UPROPS_LARGE_EXP_OFFSET, UPROPS_LARGE_MAX_EXP=UPROPS_LARGE_MIN_EXP+UPROPS_LARGE_EXP_MASK, UPROPS_LARGE_MAX_EXP_EXTRA=UPROPS_LARGE_EXP_OFFSET_EXTRA+UPROPS_LARGE_EXP_MASK }; /* number of properties vector words */ #define UPROPS_VECTOR_WORDS 3 /* * Properties in vector word 0 * Bits * 31..24 DerivedAge version major/minor one nibble each * 23..18 Line Break * 17..15 East Asian Width * 14.. 7 UBlockCode * 6.. 0 UScriptCode */ /* derived age: one nibble each for major and minor version numbers */ #define UPROPS_AGE_MASK 0xff000000 #define UPROPS_AGE_SHIFT 24 #define UPROPS_LB_MASK 0x00FC0000 #define UPROPS_LB_SHIFT 18 #define UPROPS_EA_MASK 0x00038000 #define UPROPS_EA_SHIFT 15 #define UPROPS_BLOCK_MASK 0x00007f80 #define UPROPS_BLOCK_SHIFT 7 #define UPROPS_SCRIPT_MASK 0x0000007f /* * Properties in vector word 1 * Each bit encodes one binary property. * The following constants represent the bit number, use 1<