1 /************************************************************************/
2 /*									*/
3 /*  UCD Bidirectional classes.						*/
4 /*									*/
5 /************************************************************************/
6 
7 #   ifndef		UCD_BIDI_CLASS_H
8 #   define		UCD_BIDI_CLASS_H
9 
10 typedef enum UCDBidiClass
11     {
12 	    /**
13 	     * Left_To_Right any strong left-to-right character
14 	     */
15     UCDbidi_L= 0,
16 	    /**
17 	     * Left_To_Right_Embedding U+202A: the LR embedding control
18 	     */
19     UCDbidi_LRE,
20 	    /**
21 	     * Left_To_Right_Override U+202D: the LR override control
22 	     */
23     UCDbidi_LRO,
24 	    /**
25 	     * Right_To_Left
26 	     * any strong right-to-left (non-Arabic-type) character
27 	     */
28     UCDbidi_R,
29 	    /**
30 	     * Arabic_Letter any strong right-to-left (Arabic-type) character
31 	     */
32     UCDbidi_AL,
33 	    /**
34 	     * Right_To_Left_Embedding U+202B: the RL embedding control
35 	     */
36     UCDbidi_RLE,
37 	    /**
38 	     * Right_To_Left_Override U+202E: the RL override control
39 	     */
40     UCDbidi_RLO,
41 	    /**
42 	     * Pop_Directional_Format
43 	     * U+202C: terminates an embedding or override control
44 	     */
45     UCDbidi_PDF,
46 	    /**
47 	     * European_Number any ASCII digit or Eastern Arabic-Indic digit
48 	     */
49     UCDbidi_EN,
50 	    /**
51 	     * European_Separator plus and minus signs
52 	     */
53     UCDbidi_ES,
54 	    /**
55 	     * European_Terminator
56 	     * a terminator in a numeric format context, includes currency signs
57 	     */
58     UCDbidi_ET,
59 	    /**
60 	     * Arabic_Number any Arabic-Indic digit
61 	     */
62     UCDbidi_AN,
63 	    /**
64 	     * Common_Separator commas, colons, and slashes
65 	     */
66     UCDbidi_NSM,
67 	    /**
68 	     * Nonspacing_Mark any nonspacing mark
69 	     */
70     UCDbidi_CS,
71 	    /**
72 	     * Boundary_Neutral
73 	     * most format characters, control codes, or noncharacters
74 	     */
75     UCDbidi_BN,
76 	    /**
77 	     * Paragraph_Separator various newline characters
78 	     */
79     UCDbidi_B,
80 	    /**
81 	     * Segment_Separator various segment-related control codes
82 	     */
83     UCDbidi_S,
84 	    /**
85 	     * White_Space spaces
86 	     */
87     UCDbidi_WS,
88 	    /**
89 	     * Other_Neutral most other symbols and punctuation marks
90 	     */
91     UCDbidi_ON,
92 
93     UCDbidi__COUNT
94     } UCDBidiClass;
95 
96 /************************************************************************/
97 /*									*/
98 /*  Classification following the Unicode Bidirectional algorithm.	*/
99 /*  See: http://unicode.org/reports/tr9/				*/
100 /*									*/
101 /************************************************************************/
102 
103 # define UNIbidi_IS_X9_REMOVED( c ) ( \
104             (c) == UCDbidi_RLE ||  \
105             (c) == UCDbidi_LRE ||  \
106             (c) == UCDbidi_RLO ||  \
107             (c) == UCDbidi_LRO ||  \
108             (c) == UCDbidi_PDF ||  \
109             (c) == UCDbidi_BN )
110 
111 # define UNIbidi_IS_STRONG( c ) ( \
112             (c) == UCDbidi_L   ||  \
113             (c) == UCDbidi_LRE ||  \
114             (c) == UCDbidi_LRO ||  \
115             (c) == UCDbidi_R   ||  \
116             (c) == UCDbidi_AL  ||  \
117             (c) == UCDbidi_RLE ||  \
118             (c) == UCDbidi_RLO )
119 
120 # define UNIbidi_IS_WEAK( c ) ( \
121             (c) == UCDbidi_PDF ||  \
122             (c) == UCDbidi_EN  ||  \
123             (c) == UCDbidi_ES  ||  \
124             (c) == UCDbidi_ET  ||  \
125             (c) == UCDbidi_AN  ||  \
126             (c) == UCDbidi_CS  ||  \
127             (c) == UCDbidi_NSM ||  \
128             (c) == UCDbidi_BN  )
129 
130 # define UNIbidi_IS_NEUTRAL( c ) ( \
131             (c) == UCDbidi_B   ||  \
132             (c) == UCDbidi_S   ||  \
133             (c) == UCDbidi_WS  ||  \
134             (c) == UCDbidi_ON  )
135 
136 /************************************************************************/
137 /*									*/
138 /*  Routine declarations						*/
139 /*									*/
140 /************************************************************************/
141 
142 extern int ucdBidiClass( int sym );
143 extern const char * ucdBidiClassStr( int sym );
144 
145 #   endif	/*	UCD_BIDI_CLASS_H	*/
146