intl/icu/source/common/ubidi_props.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 2004-2013, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 *******************************************************************************
michael@0 8 * file name: ubidi_props.h
michael@0 9 * encoding: US-ASCII
michael@0 10 * tab size: 8 (not used)
michael@0 11 * indentation:4
michael@0 12 *
michael@0 13 * created on: 2004dec30
michael@0 14 * created by: Markus W. Scherer
michael@0 15 *
michael@0 16 * Low-level Unicode bidi/shaping properties access.
michael@0 17 */
michael@0 18
michael@0 19 #ifndef __UBIDI_PROPS_H__
michael@0 20 #define __UBIDI_PROPS_H__
michael@0 21
michael@0 22 #include "unicode/utypes.h"
michael@0 23 #include "unicode/uset.h"
michael@0 24 #include "putilimp.h"
michael@0 25 #include "uset_imp.h"
michael@0 26 #include "udataswp.h"
michael@0 27
michael@0 28 U_CDECL_BEGIN
michael@0 29
michael@0 30 /* library API -------------------------------------------------------------- */
michael@0 31
michael@0 32 struct UBiDiProps;
michael@0 33 typedef struct UBiDiProps UBiDiProps;
michael@0 34
michael@0 35 U_CFUNC const UBiDiProps *
michael@0 36 ubidi_getSingleton(void);
michael@0 37
michael@0 38 U_CFUNC void
michael@0 39 ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *pErrorCode);
michael@0 40
michael@0 41 /* property access functions */
michael@0 42
michael@0 43 U_CFUNC int32_t
michael@0 44 ubidi_getMaxValue(const UBiDiProps *bdp, UProperty which);
michael@0 45
michael@0 46 U_CAPI UCharDirection
michael@0 47 ubidi_getClass(const UBiDiProps *bdp, UChar32 c);
michael@0 48
michael@0 49 U_CFUNC UBool
michael@0 50 ubidi_isMirrored(const UBiDiProps *bdp, UChar32 c);
michael@0 51
michael@0 52 U_CFUNC UChar32
michael@0 53 ubidi_getMirror(const UBiDiProps *bdp, UChar32 c);
michael@0 54
michael@0 55 U_CFUNC UBool
michael@0 56 ubidi_isBidiControl(const UBiDiProps *bdp, UChar32 c);
michael@0 57
michael@0 58 U_CFUNC UBool
michael@0 59 ubidi_isJoinControl(const UBiDiProps *bdp, UChar32 c);
michael@0 60
michael@0 61 U_CFUNC UJoiningType
michael@0 62 ubidi_getJoiningType(const UBiDiProps *bdp, UChar32 c);
michael@0 63
michael@0 64 U_CFUNC UJoiningGroup
michael@0 65 ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c);
michael@0 66
michael@0 67 U_CFUNC UBidiPairedBracketType
michael@0 68 ubidi_getPairedBracketType(const UBiDiProps *bdp, UChar32 c);
michael@0 69
michael@0 70 U_CFUNC UChar32
michael@0 71 ubidi_getPairedBracket(const UBiDiProps *bdp, UChar32 c);
michael@0 72
michael@0 73 /* file definitions --------------------------------------------------------- */
michael@0 74
michael@0 75 #define UBIDI_DATA_NAME "ubidi"
michael@0 76 #define UBIDI_DATA_TYPE "icu"
michael@0 77
michael@0 78 /* format "BiDi" */
michael@0 79 #define UBIDI_FMT_0 0x42
michael@0 80 #define UBIDI_FMT_1 0x69
michael@0 81 #define UBIDI_FMT_2 0x44
michael@0 82 #define UBIDI_FMT_3 0x69
michael@0 83
michael@0 84 /* indexes into indexes[] */
michael@0 85 enum {
michael@0 86 UBIDI_IX_INDEX_TOP,
michael@0 87 UBIDI_IX_LENGTH,
michael@0 88 UBIDI_IX_TRIE_SIZE,
michael@0 89 UBIDI_IX_MIRROR_LENGTH,
michael@0 90
michael@0 91 UBIDI_IX_JG_START,
michael@0 92 UBIDI_IX_JG_LIMIT,
michael@0 93
michael@0 94 UBIDI_MAX_VALUES_INDEX=15,
michael@0 95 UBIDI_IX_TOP=16
michael@0 96 };
michael@0 97
michael@0 98 /* definitions for 16-bit bidi/shaping properties word ---------------------- */
michael@0 99
michael@0 100 enum {
michael@0 101 /* UBIDI_CLASS_SHIFT=0, */ /* bidi class: 5 bits (4..0) */
michael@0 102 UBIDI_JT_SHIFT=5, /* joining type: 3 bits (7..5) */
michael@0 103
michael@0 104 UBIDI_BPT_SHIFT=8, /* Bidi_Paired_Bracket_Type(bpt): 2 bits (9..8) */
michael@0 105
michael@0 106 UBIDI_JOIN_CONTROL_SHIFT=10,
michael@0 107 UBIDI_BIDI_CONTROL_SHIFT=11,
michael@0 108
michael@0 109 UBIDI_IS_MIRRORED_SHIFT=12, /* 'is mirrored' */
michael@0 110 UBIDI_MIRROR_DELTA_SHIFT=13, /* bidi mirroring delta: 3 bits (15..13) */
michael@0 111
michael@0 112 UBIDI_MAX_JG_SHIFT=16 /* max JG value in indexes[UBIDI_MAX_VALUES_INDEX] bits 23..16 */
michael@0 113 };
michael@0 114
michael@0 115 #define UBIDI_CLASS_MASK 0x0000001f
michael@0 116 #define UBIDI_JT_MASK 0x000000e0
michael@0 117 #define UBIDI_BPT_MASK 0x00000300
michael@0 118
michael@0 119 #define UBIDI_MAX_JG_MASK 0x00ff0000
michael@0 120
michael@0 121 #define UBIDI_GET_CLASS(props) ((props)&UBIDI_CLASS_MASK)
michael@0 122 #define UBIDI_GET_FLAG(props, shift) (((props)>>(shift))&1)
michael@0 123
michael@0 124 #if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
michael@0 125 # define UBIDI_GET_MIRROR_DELTA(props) ((int16_t)(props)>>UBIDI_MIRROR_DELTA_SHIFT)
michael@0 126 #else
michael@0 127 # define UBIDI_GET_MIRROR_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UBIDI_MIRROR_DELTA_SHIFT)|0xe000) : ((props)>>UBIDI_MIRROR_DELTA_SHIFT))
michael@0 128 #endif
michael@0 129
michael@0 130 enum {
michael@0 131 UBIDI_ESC_MIRROR_DELTA=-4,
michael@0 132 UBIDI_MIN_MIRROR_DELTA=-3,
michael@0 133 UBIDI_MAX_MIRROR_DELTA=3
michael@0 134 };
michael@0 135
michael@0 136 /* definitions for 32-bit mirror table entry -------------------------------- */
michael@0 137
michael@0 138 enum {
michael@0 139 /* the source Unicode code point takes 21 bits (20..0) */
michael@0 140 UBIDI_MIRROR_INDEX_SHIFT=21,
michael@0 141 UBIDI_MAX_MIRROR_INDEX=0x7ff
michael@0 142 };
michael@0 143
michael@0 144 #define UBIDI_GET_MIRROR_CODE_POINT(m) (UChar32)((m)&0x1fffff)
michael@0 145
michael@0 146 #define UBIDI_GET_MIRROR_INDEX(m) ((m)>>UBIDI_MIRROR_INDEX_SHIFT)
michael@0 147
michael@0 148 U_CDECL_END
michael@0 149
michael@0 150 #endif

mercurial