2002-02-25 18:43:20 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002, 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.dat.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UPROPS_H__
|
|
|
|
#define __UPROPS_H__
|
|
|
|
|
2002-09-02 21:45:24 +00:00
|
|
|
#include "unicode/utypes.h"
|
2002-08-29 23:05:23 +00:00
|
|
|
#include "unicode/uset.h"
|
|
|
|
|
2002-02-25 18:43:20 +00:00
|
|
|
/* indexes[] entries */
|
|
|
|
enum {
|
|
|
|
UPROPS_PROPS32_INDEX,
|
|
|
|
UPROPS_EXCEPTIONS_INDEX,
|
|
|
|
UPROPS_EXCEPTIONS_TOP_INDEX,
|
2002-03-01 01:59:59 +00:00
|
|
|
|
2002-02-25 18:43:20 +00:00
|
|
|
UPROPS_ADDITIONAL_TRIE_INDEX,
|
|
|
|
UPROPS_ADDITIONAL_VECTORS_INDEX,
|
2002-02-25 22:41:40 +00:00
|
|
|
UPROPS_ADDITIONAL_VECTORS_COLUMNS_INDEX,
|
2002-03-01 01:59:59 +00:00
|
|
|
|
2002-07-04 16:46:36 +00:00
|
|
|
UPROPS_RESERVED_INDEX, /* 6 */
|
|
|
|
|
2003-03-07 21:49:09 +00:00
|
|
|
/* maximum values for code values in vector word 0 */
|
2002-07-04 16:46:36 +00:00
|
|
|
UPROPS_MAX_VALUES_INDEX=10,
|
2003-03-07 21:49:09 +00:00
|
|
|
/* maximum values for code values in vector word 2 */
|
|
|
|
UPROPS_MAX_VALUES_2_INDEX,
|
2002-02-25 22:41:40 +00:00
|
|
|
|
|
|
|
UPROPS_INDEX_COUNT=16
|
2002-02-25 18:43:20 +00:00
|
|
|
};
|
|
|
|
|
2002-03-04 01:33:29 +00:00
|
|
|
/* definitions for the main properties words */
|
|
|
|
enum {
|
2003-03-07 21:49:09 +00:00
|
|
|
/* general category shift==0 0 (5 bits) */
|
|
|
|
UPROPS_EXCEPTION_SHIFT=5, /* 5 (1 bit) */
|
|
|
|
UPROPS_BIDI_SHIFT, /* 6 (5 bits) */
|
|
|
|
UPROPS_MIRROR_SHIFT=UPROPS_BIDI_SHIFT+5, /* 11 (1 bit) */
|
|
|
|
UPROPS_NUMERIC_TYPE_SHIFT, /* 12 (3 bits) */
|
|
|
|
UPROPS_CASE_SENSITIVE_SHIFT=UPROPS_NUMERIC_TYPE_SHIFT+3,/* 15 (1 bit) format version 3.2 */
|
|
|
|
UPROPS_RESERVED_SHIFT, /* 16 (4 bits) */
|
|
|
|
UPROPS_VALUE_SHIFT=20, /* 20 */
|
2002-03-04 01:33:29 +00:00
|
|
|
|
|
|
|
UPROPS_EXCEPTION_BIT=1UL<<UPROPS_EXCEPTION_SHIFT,
|
|
|
|
UPROPS_VALUE_BITS=32-UPROPS_VALUE_SHIFT,
|
|
|
|
|
|
|
|
UPROPS_MIN_VALUE=-(1L<<(UPROPS_VALUE_BITS-1)),
|
|
|
|
UPROPS_MAX_VALUE=(1L<<(UPROPS_VALUE_BITS-1))-1,
|
|
|
|
UPROPS_MAX_EXCEPTIONS_COUNT=1L<<UPROPS_VALUE_BITS
|
|
|
|
};
|
|
|
|
|
2002-07-04 00:17:12 +00:00
|
|
|
#define PROPS_VALUE_IS_EXCEPTION(props) ((props)&UPROPS_EXCEPTION_BIT)
|
|
|
|
#define GET_CATEGORY(props) ((props)&0x1f)
|
2003-04-03 19:41:00 +00:00
|
|
|
#define GET_BIDI_CLASS(props) ((props>>UPROPS_BIDI_SHIFT)&0x1f)
|
2002-07-04 00:17:12 +00:00
|
|
|
#define GET_NUMERIC_TYPE(props) (((props)>>UPROPS_NUMERIC_TYPE_SHIFT)&7)
|
|
|
|
#define GET_UNSIGNED_VALUE(props) ((props)>>UPROPS_VALUE_SHIFT)
|
|
|
|
#define GET_SIGNED_VALUE(props) ((int32_t)(props)>>UPROPS_VALUE_SHIFT)
|
|
|
|
#define GET_EXCEPTIONS(props) (exceptionsTable+GET_UNSIGNED_VALUE(props))
|
|
|
|
|
2003-02-11 23:26:13 +00:00
|
|
|
#define CAT_MASK(props) U_MASK(GET_CATEGORY(props))
|
|
|
|
|
2002-07-04 00:17:12 +00:00
|
|
|
enum {
|
|
|
|
EXC_UPPERCASE,
|
|
|
|
EXC_LOWERCASE,
|
|
|
|
EXC_TITLECASE,
|
|
|
|
EXC_UNUSED,
|
|
|
|
EXC_NUMERIC_VALUE,
|
|
|
|
EXC_DENOMINATOR_VALUE,
|
|
|
|
EXC_MIRROR_MAPPING,
|
|
|
|
EXC_SPECIAL_CASING,
|
|
|
|
EXC_CASE_FOLDING
|
|
|
|
};
|
|
|
|
|
2002-02-25 18:43:20 +00:00
|
|
|
/* number of properties vector words */
|
2002-07-04 16:46:36 +00:00
|
|
|
#define UPROPS_VECTOR_WORDS 3
|
2002-02-25 18:43:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Properties in vector word 0
|
|
|
|
* Bits
|
|
|
|
* 31..24 DerivedAge version major/minor one nibble each
|
2002-07-04 16:46:36 +00:00
|
|
|
* 23 reserved
|
|
|
|
* 22..18 Line Break
|
2002-03-04 01:33:29 +00:00
|
|
|
* 17..15 East Asian Width
|
|
|
|
* 14.. 7 UBlockCode
|
2002-03-01 01:59:59 +00:00
|
|
|
* 6.. 0 UScriptCode
|
2002-02-25 18:43:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* derived age: one nibble each for major and minor version numbers */
|
|
|
|
#define UPROPS_AGE_MASK 0xff000000
|
|
|
|
#define UPROPS_AGE_SHIFT 24
|
|
|
|
|
2002-07-04 16:46:36 +00:00
|
|
|
#define UPROPS_LB_MASK 0x007C0000
|
|
|
|
#define UPROPS_LB_SHIFT 18
|
|
|
|
|
|
|
|
#define UPROPS_EA_MASK 0x00038000
|
|
|
|
#define UPROPS_EA_SHIFT 15
|
2002-03-04 01:33:29 +00:00
|
|
|
|
2002-03-02 02:26:19 +00:00
|
|
|
#define UPROPS_BLOCK_MASK 0x00007f80
|
|
|
|
#define UPROPS_BLOCK_SHIFT 7
|
|
|
|
|
|
|
|
#define UPROPS_SCRIPT_MASK 0x0000007f
|
2002-03-01 01:59:59 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Properties in vector word 1
|
2002-03-02 02:26:19 +00:00
|
|
|
* Each bit encodes one binary property.
|
|
|
|
* The following constants represent the bit number, use 1<<UPROPS_XYZ.
|
|
|
|
* UPROPS_BINARY_1_TOP<=32!
|
2002-03-03 04:45:26 +00:00
|
|
|
*
|
|
|
|
* Keep this list of property enums in sync with
|
|
|
|
* propListNames[] in icu/source/tools/genprops/props2.c!
|
2003-03-07 21:49:09 +00:00
|
|
|
*
|
|
|
|
* ICU 2.6/uprops format version 3.2 stores full properties instead of "Other_".
|
2002-03-01 01:59:59 +00:00
|
|
|
*/
|
2002-03-02 02:26:19 +00:00
|
|
|
enum {
|
|
|
|
UPROPS_WHITE_SPACE,
|
|
|
|
UPROPS_BIDI_CONTROL,
|
|
|
|
UPROPS_JOIN_CONTROL,
|
|
|
|
UPROPS_DASH,
|
|
|
|
UPROPS_HYPHEN,
|
|
|
|
UPROPS_QUOTATION_MARK,
|
|
|
|
UPROPS_TERMINAL_PUNCTUATION,
|
2003-03-07 21:49:09 +00:00
|
|
|
UPROPS_MATH,
|
2002-03-02 02:26:19 +00:00
|
|
|
UPROPS_HEX_DIGIT,
|
|
|
|
UPROPS_ASCII_HEX_DIGIT,
|
2003-03-07 21:49:09 +00:00
|
|
|
UPROPS_ALPHABETIC,
|
2002-03-02 02:26:19 +00:00
|
|
|
UPROPS_IDEOGRAPHIC,
|
|
|
|
UPROPS_DIACRITIC,
|
|
|
|
UPROPS_EXTENDER,
|
2003-03-07 21:49:09 +00:00
|
|
|
UPROPS_LOWERCASE,
|
|
|
|
UPROPS_UPPERCASE,
|
2002-03-02 02:26:19 +00:00
|
|
|
UPROPS_NONCHARACTER_CODE_POINT,
|
2003-03-07 21:49:09 +00:00
|
|
|
UPROPS_GRAPHEME_EXTEND,
|
2002-03-02 02:26:19 +00:00
|
|
|
UPROPS_GRAPHEME_LINK,
|
|
|
|
UPROPS_IDS_BINARY_OPERATOR,
|
|
|
|
UPROPS_IDS_TRINARY_OPERATOR,
|
|
|
|
UPROPS_RADICAL,
|
|
|
|
UPROPS_UNIFIED_IDEOGRAPH,
|
2003-03-07 21:49:09 +00:00
|
|
|
UPROPS_DEFAULT_IGNORABLE_CODE_POINT,
|
2002-03-02 02:26:19 +00:00
|
|
|
UPROPS_DEPRECATED,
|
|
|
|
UPROPS_SOFT_DOTTED,
|
|
|
|
UPROPS_LOGICAL_ORDER_EXCEPTION,
|
2003-03-07 21:49:09 +00:00
|
|
|
UPROPS_XID_START,
|
|
|
|
UPROPS_XID_CONTINUE,
|
|
|
|
UPROPS_ID_START, /* ICU 2.6, uprops format version 3.2 */
|
|
|
|
UPROPS_ID_CONTINUE,
|
|
|
|
UPROPS_GRAPHEME_BASE,
|
|
|
|
UPROPS_BINARY_1_TOP /* ==32 - full! */
|
2002-03-02 02:26:19 +00:00
|
|
|
};
|
2002-03-01 01:59:59 +00:00
|
|
|
|
2002-07-04 16:46:36 +00:00
|
|
|
/*
|
|
|
|
* Properties in vector word 2
|
|
|
|
* Bits
|
|
|
|
* 13..11 Joining Type
|
|
|
|
* 10.. 5 Joining Group
|
|
|
|
* 4.. 0 Decomposition Type
|
|
|
|
*/
|
|
|
|
#define UPROPS_JT_MASK 0x00003800
|
|
|
|
#define UPROPS_JT_SHIFT 11
|
|
|
|
|
|
|
|
#define UPROPS_JG_MASK 0x000007e0
|
|
|
|
#define UPROPS_JG_SHIFT 5
|
|
|
|
|
|
|
|
#define UPROPS_DT_MASK 0x0000001f
|
|
|
|
|
2002-02-25 22:41:40 +00:00
|
|
|
/**
|
|
|
|
* Get a properties vector word for a code point.
|
|
|
|
* Implemented in uchar.c for uprops.c.
|
2002-07-04 00:17:12 +00:00
|
|
|
* column==-1 gets the 32-bit main properties word instead.
|
2002-02-25 22:41:40 +00:00
|
|
|
* @return 0 if no data or illegal argument
|
|
|
|
*/
|
|
|
|
U_CFUNC uint32_t
|
|
|
|
u_getUnicodeProperties(UChar32 c, int32_t column);
|
|
|
|
|
2002-07-04 16:46:36 +00:00
|
|
|
/**
|
|
|
|
* Get the the maximum values for some enum/int properties.
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
U_CFUNC int32_t
|
2003-03-07 21:49:09 +00:00
|
|
|
uprv_getMaxValues(int32_t column);
|
2002-07-04 16:46:36 +00:00
|
|
|
|
2002-06-01 00:33:55 +00:00
|
|
|
/**
|
|
|
|
* Unicode property names and property value names are compared
|
|
|
|
* "loosely". Property[Value]Aliases.txt say:
|
|
|
|
* "With loose matching of property names, the case distinctions, whitespace,
|
|
|
|
* and '_' are ignored."
|
|
|
|
*
|
|
|
|
* This function does just that, for ASCII (char *) name strings.
|
|
|
|
* It is almost identical to ucnv_compareNames() but also ignores
|
|
|
|
* ASCII White_Space characters (U+0009..U+000d).
|
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
|
|
|
uprv_comparePropertyNames(const char *name1, const char *name2);
|
|
|
|
|
2002-06-07 18:55:08 +00:00
|
|
|
/** Turn a bit index into a bit flag. @internal */
|
|
|
|
#define FLAG(n) ((uint32_t)1<<(n))
|
|
|
|
|
|
|
|
/** Flags for general categories in the order of UCharCategory. @internal */
|
|
|
|
#define _Cn FLAG(U_GENERAL_OTHER_TYPES)
|
|
|
|
#define _Lu FLAG(U_UPPERCASE_LETTER)
|
|
|
|
#define _Ll FLAG(U_LOWERCASE_LETTER)
|
|
|
|
#define _Lt FLAG(U_TITLECASE_LETTER)
|
|
|
|
#define _Lm FLAG(U_MODIFIER_LETTER)
|
|
|
|
#define _Lo FLAG(U_OTHER_LETTER)
|
|
|
|
#define _Mn FLAG(U_NON_SPACING_MARK)
|
|
|
|
#define _Me FLAG(U_ENCLOSING_MARK)
|
|
|
|
#define _Mc FLAG(U_COMBINING_SPACING_MARK)
|
|
|
|
#define _Nd FLAG(U_DECIMAL_DIGIT_NUMBER)
|
|
|
|
#define _Nl FLAG(U_LETTER_NUMBER)
|
|
|
|
#define _No FLAG(U_OTHER_NUMBER)
|
|
|
|
#define _Zs FLAG(U_SPACE_SEPARATOR)
|
|
|
|
#define _Zl FLAG(U_LINE_SEPARATOR)
|
|
|
|
#define _Zp FLAG(U_PARAGRAPH_SEPARATOR)
|
|
|
|
#define _Cc FLAG(U_CONTROL_CHAR)
|
|
|
|
#define _Cf FLAG(U_FORMAT_CHAR)
|
|
|
|
#define _Co FLAG(U_PRIVATE_USE_CHAR)
|
|
|
|
#define _Cs FLAG(U_SURROGATE)
|
|
|
|
#define _Pd FLAG(U_DASH_PUNCTUATION)
|
|
|
|
#define _Ps FLAG(U_START_PUNCTUATION)
|
|
|
|
#define _Pe FLAG(U_END_PUNCTUATION)
|
|
|
|
#define _Pc FLAG(U_CONNECTOR_PUNCTUATION)
|
|
|
|
#define _Po FLAG(U_OTHER_PUNCTUATION)
|
|
|
|
#define _Sm FLAG(U_MATH_SYMBOL)
|
|
|
|
#define _Sc FLAG(U_CURRENCY_SYMBOL)
|
|
|
|
#define _Sk FLAG(U_MODIFIER_SYMBOL)
|
|
|
|
#define _So FLAG(U_OTHER_SYMBOL)
|
|
|
|
#define _Pi FLAG(U_INITIAL_PUNCTUATION)
|
|
|
|
#define _Pf FLAG(U_FINAL_PUNCTUATION)
|
|
|
|
|
2002-11-06 00:52:44 +00:00
|
|
|
/** Some code points. @internal */
|
2002-11-06 03:09:56 +00:00
|
|
|
enum {
|
|
|
|
TAB =0x0009,
|
|
|
|
LF =0x000a,
|
|
|
|
FF =0x000c,
|
|
|
|
CR =0x000d,
|
2002-11-06 20:50:03 +00:00
|
|
|
U_A =0x0041,
|
|
|
|
U_Z =0x005a,
|
|
|
|
U_a =0x0061,
|
|
|
|
U_z =0x007a,
|
2002-11-06 03:09:56 +00:00
|
|
|
DEL =0x007f,
|
|
|
|
NL =0x0085,
|
|
|
|
NBSP =0x00a0,
|
|
|
|
CGJ =0x034f,
|
2003-02-09 21:02:26 +00:00
|
|
|
FIGURESP=0x2007,
|
2002-11-06 03:09:56 +00:00
|
|
|
HAIRSP =0x200a,
|
|
|
|
ZWNJ =0x200c,
|
|
|
|
ZWJ =0x200d,
|
|
|
|
RLM =0x200f,
|
|
|
|
NNBSP =0x202f,
|
|
|
|
WJ =0x2060,
|
|
|
|
INHSWAP =0x206a,
|
|
|
|
NOMDIG =0x206f,
|
|
|
|
ZWNBSP =0xfeff
|
|
|
|
};
|
2002-11-06 00:52:44 +00:00
|
|
|
|
2002-07-19 21:16:42 +00:00
|
|
|
/**
|
|
|
|
* Is this character a "white space" in the sense of ICU rule parsers?
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
U_CAPI UBool U_EXPORT2
|
|
|
|
uprv_isRuleWhiteSpace(UChar32 c);
|
|
|
|
|
2002-11-07 01:28:14 +00:00
|
|
|
/**
|
|
|
|
* Get the set of "white space" characters in the sense of ICU rule
|
|
|
|
* parsers. Caller must close/delete result.
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
U_CAPI USet* U_EXPORT2
|
|
|
|
uprv_openRuleWhiteSpaceSet(UErrorCode* ec);
|
|
|
|
|
2002-08-29 23:05:23 +00:00
|
|
|
/**
|
2002-09-02 21:45:24 +00:00
|
|
|
* Get the maximum length of a (regular/1.0/extended) character name.
|
|
|
|
* @return 0 if no character names available.
|
|
|
|
*/
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
2002-12-19 01:06:00 +00:00
|
|
|
uprv_getMaxCharNameLength(void);
|
2002-09-02 21:45:24 +00:00
|
|
|
|
2002-11-23 00:51:10 +00:00
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
Currently not used but left for future use. Probably by UnicodeSet.
|
|
|
|
urename.h and unames.c changed accordingly.
|
|
|
|
*/
|
2002-09-02 21:45:24 +00:00
|
|
|
/**
|
|
|
|
* Get the maximum length of an ISO comment.
|
|
|
|
* @return 0 if no ISO comments available.
|
|
|
|
*/
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
|
|
|
uprv_getMaxISOCommentLength();
|
2002-11-23 00:51:10 +00:00
|
|
|
#endif
|
2002-09-02 21:45:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fills set with characters that are used in Unicode character names.
|
|
|
|
* Includes all characters that are used in regular/Unicode 1.0/extended names.
|
|
|
|
* Just empties the set if no character names are available.
|
|
|
|
* @param set USet to receive characters. Existing contents are deleted.
|
|
|
|
*/
|
|
|
|
U_CAPI void U_EXPORT2
|
|
|
|
uprv_getCharNameCharacters(USet* set);
|
|
|
|
|
2002-11-23 00:51:10 +00:00
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
Currently not used but left for future use. Probably by UnicodeSet.
|
|
|
|
urename.h and unames.c changed accordingly.
|
|
|
|
*/
|
2002-09-02 21:45:24 +00:00
|
|
|
/**
|
|
|
|
* Fills set with characters that are used in Unicode character names.
|
|
|
|
* Just empties the set if no ISO comments are available.
|
|
|
|
* @param set USet to receive characters. Existing contents are deleted.
|
2002-08-29 23:05:23 +00:00
|
|
|
*/
|
|
|
|
U_CAPI void U_EXPORT2
|
2002-09-02 21:45:24 +00:00
|
|
|
uprv_getISOCommentCharacters(USet* set);
|
2002-11-23 00:51:10 +00:00
|
|
|
*/
|
|
|
|
#endif
|
2002-08-29 23:05:23 +00:00
|
|
|
|
2002-10-30 18:12:49 +00:00
|
|
|
/**
|
2002-11-06 00:52:44 +00:00
|
|
|
* Enumerate each core properties data trie and add the
|
|
|
|
* start of each range of same properties to the set.
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
U_CAPI void U_EXPORT2
|
2003-04-09 17:34:24 +00:00
|
|
|
uchar_addPropertyStarts(USet *set, UErrorCode *pErrorCode);
|
2002-11-06 00:52:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a set of characters for property enumeration.
|
|
|
|
* For each two consecutive characters (start, limit) in the set,
|
|
|
|
* all of the properties for start..limit-1 are all the same.
|
|
|
|
*
|
|
|
|
* @param set USet to receive result. Existing contents are lost.
|
|
|
|
* @internal
|
2002-10-30 18:12:49 +00:00
|
|
|
*/
|
|
|
|
U_CAPI void U_EXPORT2
|
2003-04-09 17:34:24 +00:00
|
|
|
uprv_getInclusions(USet* set, UErrorCode *pErrorCode);
|
2002-10-30 18:12:49 +00:00
|
|
|
|
2002-02-25 18:43:20 +00:00
|
|
|
#endif
|