intl/icu/source/common/ubidi_props.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/ubidi_props.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,150 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 2004-2013, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*   file name:  ubidi_props.h
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:4
    1.15 +*
    1.16 +*   created on: 2004dec30
    1.17 +*   created by: Markus W. Scherer
    1.18 +*
    1.19 +*   Low-level Unicode bidi/shaping properties access.
    1.20 +*/
    1.21 +
    1.22 +#ifndef __UBIDI_PROPS_H__
    1.23 +#define __UBIDI_PROPS_H__
    1.24 +
    1.25 +#include "unicode/utypes.h"
    1.26 +#include "unicode/uset.h"
    1.27 +#include "putilimp.h"
    1.28 +#include "uset_imp.h"
    1.29 +#include "udataswp.h"
    1.30 +
    1.31 +U_CDECL_BEGIN
    1.32 +
    1.33 +/* library API -------------------------------------------------------------- */
    1.34 +
    1.35 +struct UBiDiProps;
    1.36 +typedef struct UBiDiProps UBiDiProps;
    1.37 +
    1.38 +U_CFUNC const UBiDiProps *
    1.39 +ubidi_getSingleton(void);
    1.40 +
    1.41 +U_CFUNC void
    1.42 +ubidi_addPropertyStarts(const UBiDiProps *bdp, const USetAdder *sa, UErrorCode *pErrorCode);
    1.43 +
    1.44 +/* property access functions */
    1.45 +
    1.46 +U_CFUNC int32_t
    1.47 +ubidi_getMaxValue(const UBiDiProps *bdp, UProperty which);
    1.48 +
    1.49 +U_CAPI UCharDirection
    1.50 +ubidi_getClass(const UBiDiProps *bdp, UChar32 c);
    1.51 +
    1.52 +U_CFUNC UBool
    1.53 +ubidi_isMirrored(const UBiDiProps *bdp, UChar32 c);
    1.54 +
    1.55 +U_CFUNC UChar32
    1.56 +ubidi_getMirror(const UBiDiProps *bdp, UChar32 c);
    1.57 +
    1.58 +U_CFUNC UBool
    1.59 +ubidi_isBidiControl(const UBiDiProps *bdp, UChar32 c);
    1.60 +
    1.61 +U_CFUNC UBool
    1.62 +ubidi_isJoinControl(const UBiDiProps *bdp, UChar32 c);
    1.63 +
    1.64 +U_CFUNC UJoiningType
    1.65 +ubidi_getJoiningType(const UBiDiProps *bdp, UChar32 c);
    1.66 +
    1.67 +U_CFUNC UJoiningGroup
    1.68 +ubidi_getJoiningGroup(const UBiDiProps *bdp, UChar32 c);
    1.69 +
    1.70 +U_CFUNC UBidiPairedBracketType
    1.71 +ubidi_getPairedBracketType(const UBiDiProps *bdp, UChar32 c);
    1.72 +
    1.73 +U_CFUNC UChar32
    1.74 +ubidi_getPairedBracket(const UBiDiProps *bdp, UChar32 c);
    1.75 +
    1.76 +/* file definitions --------------------------------------------------------- */
    1.77 +
    1.78 +#define UBIDI_DATA_NAME "ubidi"
    1.79 +#define UBIDI_DATA_TYPE "icu"
    1.80 +
    1.81 +/* format "BiDi" */
    1.82 +#define UBIDI_FMT_0 0x42
    1.83 +#define UBIDI_FMT_1 0x69
    1.84 +#define UBIDI_FMT_2 0x44
    1.85 +#define UBIDI_FMT_3 0x69
    1.86 +
    1.87 +/* indexes into indexes[] */
    1.88 +enum {
    1.89 +    UBIDI_IX_INDEX_TOP,
    1.90 +    UBIDI_IX_LENGTH,
    1.91 +    UBIDI_IX_TRIE_SIZE,
    1.92 +    UBIDI_IX_MIRROR_LENGTH,
    1.93 +
    1.94 +    UBIDI_IX_JG_START,
    1.95 +    UBIDI_IX_JG_LIMIT,
    1.96 +
    1.97 +    UBIDI_MAX_VALUES_INDEX=15,
    1.98 +    UBIDI_IX_TOP=16
    1.99 +};
   1.100 +
   1.101 +/* definitions for 16-bit bidi/shaping properties word ---------------------- */
   1.102 +
   1.103 +enum {
   1.104 + /* UBIDI_CLASS_SHIFT=0, */     /* bidi class: 5 bits (4..0) */
   1.105 +    UBIDI_JT_SHIFT=5,           /* joining type: 3 bits (7..5) */
   1.106 +
   1.107 +    UBIDI_BPT_SHIFT=8,          /* Bidi_Paired_Bracket_Type(bpt): 2 bits (9..8) */
   1.108 +
   1.109 +    UBIDI_JOIN_CONTROL_SHIFT=10,
   1.110 +    UBIDI_BIDI_CONTROL_SHIFT=11,
   1.111 +
   1.112 +    UBIDI_IS_MIRRORED_SHIFT=12,         /* 'is mirrored' */
   1.113 +    UBIDI_MIRROR_DELTA_SHIFT=13,        /* bidi mirroring delta: 3 bits (15..13) */
   1.114 +
   1.115 +    UBIDI_MAX_JG_SHIFT=16               /* max JG value in indexes[UBIDI_MAX_VALUES_INDEX] bits 23..16 */
   1.116 +};
   1.117 +
   1.118 +#define UBIDI_CLASS_MASK        0x0000001f
   1.119 +#define UBIDI_JT_MASK           0x000000e0
   1.120 +#define UBIDI_BPT_MASK          0x00000300
   1.121 +
   1.122 +#define UBIDI_MAX_JG_MASK       0x00ff0000
   1.123 +
   1.124 +#define UBIDI_GET_CLASS(props) ((props)&UBIDI_CLASS_MASK)
   1.125 +#define UBIDI_GET_FLAG(props, shift) (((props)>>(shift))&1)
   1.126 +
   1.127 +#if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
   1.128 +#   define UBIDI_GET_MIRROR_DELTA(props) ((int16_t)(props)>>UBIDI_MIRROR_DELTA_SHIFT)
   1.129 +#else
   1.130 +#   define UBIDI_GET_MIRROR_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UBIDI_MIRROR_DELTA_SHIFT)|0xe000) : ((props)>>UBIDI_MIRROR_DELTA_SHIFT))
   1.131 +#endif
   1.132 +
   1.133 +enum {
   1.134 +    UBIDI_ESC_MIRROR_DELTA=-4,
   1.135 +    UBIDI_MIN_MIRROR_DELTA=-3,
   1.136 +    UBIDI_MAX_MIRROR_DELTA=3
   1.137 +};
   1.138 +
   1.139 +/* definitions for 32-bit mirror table entry -------------------------------- */
   1.140 +
   1.141 +enum {
   1.142 +    /* the source Unicode code point takes 21 bits (20..0) */
   1.143 +    UBIDI_MIRROR_INDEX_SHIFT=21,
   1.144 +    UBIDI_MAX_MIRROR_INDEX=0x7ff
   1.145 +};
   1.146 +
   1.147 +#define UBIDI_GET_MIRROR_CODE_POINT(m) (UChar32)((m)&0x1fffff)
   1.148 +
   1.149 +#define UBIDI_GET_MIRROR_INDEX(m) ((m)>>UBIDI_MIRROR_INDEX_SHIFT)
   1.150 +
   1.151 +U_CDECL_END
   1.152 +
   1.153 +#endif

mercurial