// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * * Copyright (C) 2002-2016, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uprops.h * encoding: UTF-8 * 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_SCRIPT_EXTENSIONS_INDEX, UPROPS_RESERVED_INDEX_7, UPROPS_RESERVED_INDEX_8, /* size of the data file (number of 32-bit units after the header) */ UPROPS_DATA_TOP_INDEX, /* 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) */ /* reserved 5 (1 bit) */ UPROPS_NUMERIC_TYPE_VALUE_SHIFT=6 /* 6 (10 bits) */ }; #define GET_CATEGORY(props) ((props)&0x1f) #define CAT_MASK(props) U_MASK(GET_CATEGORY(props)) #define GET_NUMERIC_TYPE_VALUE(props) ((props)>>UPROPS_NUMERIC_TYPE_VALUE_SHIFT) /* constants for the storage form of numeric types and values */ enum { /** No numeric value. */ UPROPS_NTV_NONE=0, /** Decimal digits: nv=0..9 */ UPROPS_NTV_DECIMAL_START=1, /** Other digits: nv=0..9 */ UPROPS_NTV_DIGIT_START=11, /** Small integers: nv=0..154 */ UPROPS_NTV_NUMERIC_START=21, /** Fractions: ((ntv>>4)-12) / ((ntv&0xf)+1) = -1..17 / 1..16 */ UPROPS_NTV_FRACTION_START=0xb0, /** * Large integers: * ((ntv>>5)-14) * 10^((ntv&0x1f)+2) = (1..9)*(10^2..10^33) * (only one significant decimal digit) */ UPROPS_NTV_LARGE_START=0x1e0, /** * Sexagesimal numbers: * ((ntv>>2)-0xbf) * 60^((ntv&3)+1) = (1..9)*(60^1..60^4) */ UPROPS_NTV_BASE60_START=0x300, /** * Fraction-20 values: * frac20 = ntv-0x324 = 0..0x17 -> 1|3|5|7 / 20|40|80|160|320|640 * numerator: num = 2*(frac20&3)+1 * denominator: den = 20<<(frac20>>2) */ UPROPS_NTV_FRACTION20_START=UPROPS_NTV_BASE60_START+36, // 0x300+9*4=0x324 /** No numeric value (yet). */ UPROPS_NTV_RESERVED_START=UPROPS_NTV_FRACTION20_START+24, // 0x324+6*4=0x34c UPROPS_NTV_MAX_SMALL_INT=UPROPS_NTV_FRACTION_START-UPROPS_NTV_NUMERIC_START-1 }; #define UPROPS_NTV_GET_TYPE(ntv) \ ((ntv==UPROPS_NTV_NONE) ? U_NT_NONE : \ (ntv