]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/ubidi_props.h
2 *******************************************************************************
4 * Copyright (C) 2004-2010, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: ubidi_props.h
10 * tab size: 8 (not used)
13 * created on: 2004dec30
14 * created by: Markus W. Scherer
16 * Low-level Unicode bidi/shaping properties access.
19 #ifndef __UBIDI_PROPS_H__
20 #define __UBIDI_PROPS_H__
22 #include "unicode/utypes.h"
23 #include "unicode/uset.h"
29 /* library API -------------------------------------------------------------- */
32 typedef struct UBiDiProps UBiDiProps
;
34 U_CFUNC
const UBiDiProps
*
35 ubidi_getSingleton(void);
38 ubidi_swap(const UDataSwapper
*ds
,
39 const void *inData
, int32_t length
, void *outData
,
40 UErrorCode
*pErrorCode
);
43 ubidi_addPropertyStarts(const UBiDiProps
*bdp
, const USetAdder
*sa
, UErrorCode
*pErrorCode
);
45 /* property access functions */
48 ubidi_getMaxValue(const UBiDiProps
*bdp
, UProperty which
);
51 ubidi_getClass(const UBiDiProps
*bdp
, UChar32 c
);
54 ubidi_isMirrored(const UBiDiProps
*bdp
, UChar32 c
);
57 ubidi_getMirror(const UBiDiProps
*bdp
, UChar32 c
);
60 ubidi_isBidiControl(const UBiDiProps
*bdp
, UChar32 c
);
63 ubidi_isJoinControl(const UBiDiProps
*bdp
, UChar32 c
);
66 ubidi_getJoiningType(const UBiDiProps
*bdp
, UChar32 c
);
69 ubidi_getJoiningGroup(const UBiDiProps
*bdp
, UChar32 c
);
71 /* file definitions --------------------------------------------------------- */
73 #define UBIDI_DATA_NAME "ubidi"
74 #define UBIDI_DATA_TYPE "icu"
77 #define UBIDI_FMT_0 0x42
78 #define UBIDI_FMT_1 0x69
79 #define UBIDI_FMT_2 0x44
80 #define UBIDI_FMT_3 0x69
82 /* indexes into indexes[] */
87 UBIDI_IX_MIRROR_LENGTH
,
92 UBIDI_MAX_VALUES_INDEX
=15,
96 /* definitions for 16-bit bidi/shaping properties word ---------------------- */
99 /* UBIDI_CLASS_SHIFT=0, */ /* bidi class: 5 bits (4..0) */
100 UBIDI_JT_SHIFT
=5, /* joining type: 3 bits (7..5) */
102 /* UBIDI__SHIFT=8, reserved: 2 bits (9..8) */
104 UBIDI_JOIN_CONTROL_SHIFT
=10,
105 UBIDI_BIDI_CONTROL_SHIFT
=11,
107 UBIDI_IS_MIRRORED_SHIFT
=12, /* 'is mirrored' */
108 UBIDI_MIRROR_DELTA_SHIFT
=13, /* bidi mirroring delta: 3 bits (15..13) */
110 UBIDI_MAX_JG_SHIFT
=16 /* max JG value in indexes[UBIDI_MAX_VALUES_INDEX] bits 23..16 */
113 #define UBIDI_CLASS_MASK 0x0000001f
114 #define UBIDI_JT_MASK 0x000000e0
116 #define UBIDI_MAX_JG_MASK 0x00ff0000
118 #define UBIDI_GET_CLASS(props) ((props)&UBIDI_CLASS_MASK)
119 #define UBIDI_GET_FLAG(props, shift) (((props)>>(shift))&1)
122 UBIDI_ESC_MIRROR_DELTA
=-4,
123 UBIDI_MIN_MIRROR_DELTA
=-3,
124 UBIDI_MAX_MIRROR_DELTA
=3
127 /* definitions for 32-bit mirror table entry -------------------------------- */
130 /* the source Unicode code point takes 21 bits (20..0) */
131 UBIDI_MIRROR_INDEX_SHIFT
=21,
132 UBIDI_MAX_MIRROR_INDEX
=0x7ff
135 #define UBIDI_GET_MIRROR_CODE_POINT(m) (UChar32)((m)&0x1fffff)
137 #define UBIDI_GET_MIRROR_INDEX(m) ((m)>>UBIDI_MIRROR_INDEX_SHIFT)