1 /* tag: Tom Lord Tue Dec  4 14:41:36 2001 (unidata.h)
2  */
3 /* unidata.h -
4  *
5  ****************************************************************
6  * Copyright (C) 2000 Tom Lord
7  *
8  * See the file "COPYING" for further information about
9  * the copyright and warranty status of this work.
10  */
11 
12 #ifndef INCLUDE__UNI__UNIDATA_H
13 #define INCLUDE__UNI__UNIDATA_H
14 
15 
16 
17 #include "hackerlab/machine/types.h"
18 
19 
20 
21 #define UNI_BIDI_CATEGORIES \
22   UNI_BIDI_CATEGORY(L, "Left-to-Right") \
23   UNI_BIDI_CATEGORY(LRE, "Left-to-Right Embedding") \
24   UNI_BIDI_CATEGORY(LRO, "Left-to-Right Override") \
25   UNI_BIDI_CATEGORY(R, "Right-to-Left") \
26   UNI_BIDI_CATEGORY(AL, "Right-to-Left Arabic") \
27   UNI_BIDI_CATEGORY(RLE, "Right-to-Left Embedding") \
28   UNI_BIDI_CATEGORY(RLO, "Right-to-Left Override") \
29   UNI_BIDI_CATEGORY(PDF, "Pop Directional Format") \
30   UNI_BIDI_CATEGORY(EN, "European Number") \
31   UNI_BIDI_CATEGORY(ES, "European Number Separator") \
32   UNI_BIDI_CATEGORY(ET, "European Number Terminator") \
33   UNI_BIDI_CATEGORY(AN, "Arabic Number") \
34   UNI_BIDI_CATEGORY(CS, "Common Number Separator") \
35   UNI_BIDI_CATEGORY(NSM, "Non-Spacing Mark") \
36   UNI_BIDI_CATEGORY(BN, "Boundary Neutral") \
37   UNI_BIDI_CATEGORY(B, "Paragraph Separator") \
38   UNI_BIDI_CATEGORY(S, "Segment Separator") \
39   UNI_BIDI_CATEGORY(WS, "Whitspace") \
40   UNI_BIDI_CATEGORY(ON, "Other Neutrals")
41 
42 enum uni_bidi_category
43 {
44 #undef UNI_BIDI_CATEGORY
45 #define UNI_BIDI_CATEGORY(NAME, IGN) uni_bidi_ ## NAME,
46 
47   UNI_BIDI_CATEGORIES
48 };
49 
50 struct uni_bidi_category_name
51 {
52   t_uchar * name;
53   enum uni_bidi_category category;
54 };
55 
56 extern const struct uni_bidi_category_name uni_bidi_category_names[];
57 extern const int n_uni_bidi_categories;
58 
59 
60 
61 #define UNI_GENERAL_CATEGORIES_LIST(MACRO) \
62   UNI_GENERAL_CATEGORY##MACRO (Lu, letter_uppercase, "Letter, uppercase") \
63   UNI_GENERAL_CATEGORY##MACRO (Ll, letter_lowercase, "Letter, lowercase") \
64   UNI_GENERAL_CATEGORY##MACRO (Lt, letter_titlecase, "Letter, titlecase") \
65   UNI_GENERAL_CATEGORY##MACRO (Lm, letter_modifier, "Letter, modifier") \
66   UNI_GENERAL_CATEGORY##MACRO (Lo, letter_other, "Letter, other") \
67   \
68   UNI_GENERAL_CATEGORY##MACRO (Mn, mark_nonspacing, "Mark, nonspacing") \
69   UNI_GENERAL_CATEGORY##MACRO (Mc, mark_spacing_combining, "Mark, spacing combining") \
70   UNI_GENERAL_CATEGORY##MACRO (Me, mark_enclosing, "Mark, enclosing") \
71   \
72   UNI_GENERAL_CATEGORY##MACRO (Nd, number_decimal_digit, "Number, decimal digit") \
73   UNI_GENERAL_CATEGORY##MACRO (Nl, number_letter, "Number, letter") \
74   UNI_GENERAL_CATEGORY##MACRO (No, number_other, "Number, other") \
75   \
76   UNI_GENERAL_CATEGORY##MACRO (Zs, separator_space, "Separator, space") \
77   UNI_GENERAL_CATEGORY##MACRO (Zl, separator_line, "Separator, line") \
78   UNI_GENERAL_CATEGORY##MACRO (Zp, separator_paragraph, "Separator, paragraph") \
79   \
80   UNI_GENERAL_CATEGORY##MACRO (Cc, other_control, "Other, control") \
81   UNI_GENERAL_CATEGORY##MACRO (Cf, other_format, "Other, format") \
82   UNI_GENERAL_CATEGORY##MACRO (Cs, other_surrogate, "Other, surrogate") \
83   UNI_GENERAL_CATEGORY##MACRO (Co, other_private_use, "Other, private use") \
84   UNI_GENERAL_CATEGORY##MACRO (Cn, other_not_assigned, "Other, not assigned") \
85   \
86   UNI_GENERAL_CATEGORY##MACRO (Pc, punctuation_connector, "Punctuation, connector") \
87   UNI_GENERAL_CATEGORY##MACRO (Pd, punctuation_dash, "Punctuation, dash") \
88   UNI_GENERAL_CATEGORY##MACRO (Ps, punctuation_open, "Punctuation, open") \
89   UNI_GENERAL_CATEGORY##MACRO (Pe, punctuation_close, "Punctuation, close") \
90   UNI_GENERAL_CATEGORY##MACRO (Pi, punctuation_initial_quote, "Punctuation, initial quote") \
91   UNI_GENERAL_CATEGORY##MACRO (Pf, punctuation_final_quote, "Punctuation, final quote") \
92   UNI_GENERAL_CATEGORY##MACRO (Po, punctuation_other, "Punctuation, other") \
93   \
94   UNI_GENERAL_CATEGORY##MACRO (Sm, symbol_math, "Symbol, math") \
95   UNI_GENERAL_CATEGORY##MACRO (Sc, symbol_currency, "Symbol, currency") \
96   UNI_GENERAL_CATEGORY##MACRO (Sk, symbol_modifier, "Symbol, modifier") \
97   UNI_GENERAL_CATEGORY##MACRO (So, symbol_other, "Symbol, other")
98 
99 #define UNI_SYNTHETIC_CATEGORIES_LIST(MACRO) \
100   UNI_SYNTH_CATEGORY##MACRO (L, letter, "Letter") \
101   UNI_SYNTH_CATEGORY##MACRO (M, mark, "Mark") \
102   UNI_SYNTH_CATEGORY##MACRO (N, number, "Number") \
103   UNI_SYNTH_CATEGORY##MACRO (Z, separator, "Separator") \
104   UNI_SYNTH_CATEGORY##MACRO (C, other, "Other") \
105   UNI_SYNTH_CATEGORY##MACRO (P, punctuation, "Punctuation") \
106   UNI_SYNTH_CATEGORY##MACRO (S, symbol, "Symbol")
107 
108 
109 enum uni_general_category
110 {
111 #define UNI_GENERAL_CATEGORY_ENUM(NAME, ALT_NAME, DESC) \
112 	uni_general_category_##NAME,  uni_general_category_##ALT_NAME = uni_general_category_##NAME,
113 #define UNI_SYNTH_CATEGORY_ENUM(NAME, ALT_NAME, DESC) \
114 	uni_general_category_##NAME,  uni_general_category_##ALT_NAME = uni_general_category_##NAME,
115 
116   UNI_GENERAL_CATEGORIES_LIST(_ENUM)
117   UNI_SYNTHETIC_CATEGORIES_LIST(_ENUM)
118 };
119 
120 
121 struct uni_general_category_name
122 {
123   t_uchar * name;
124   enum uni_general_category category;
125 };
126 
127 extern const struct uni_general_category_name uni_general_category_names[];
128 extern const enum uni_general_category uni_first_synthetic_category;
129 extern const int uni_n_categories;
130 
131 
132 
133 typedef t_uchar uni_canonical_combining_class;
134 
135 
136 
137 struct uni_numeric_value
138 {
139   t_uint numerator;
140   t_uint denominator;
141 };
142 
143 
144 
145 #define UNI_DECOMPOSITION_TYPES \
146   UNI_DECOMPOSITION_TYPE(none) \
147   UNI_DECOMPOSITION_TYPE(canonical) \
148   UNI_DECOMPOSITION_TYPE(font) \
149   UNI_DECOMPOSITION_TYPE(noBreak) \
150   UNI_DECOMPOSITION_TYPE(initial) \
151   UNI_DECOMPOSITION_TYPE(medial) \
152   UNI_DECOMPOSITION_TYPE(final) \
153   UNI_DECOMPOSITION_TYPE(isolated) \
154   UNI_DECOMPOSITION_TYPE(circle) \
155   UNI_DECOMPOSITION_TYPE(super) \
156   UNI_DECOMPOSITION_TYPE(sub) \
157   UNI_DECOMPOSITION_TYPE(vertical) \
158   UNI_DECOMPOSITION_TYPE(wide) \
159   UNI_DECOMPOSITION_TYPE(narrow) \
160   UNI_DECOMPOSITION_TYPE(small) \
161   UNI_DECOMPOSITION_TYPE(square) \
162   UNI_DECOMPOSITION_TYPE(fraction) \
163   UNI_DECOMPOSITION_TYPE(compat)
164 
165 enum uni_decomposition_type
166 {
167 #undef UNI_DECOMPOSITION_TYPE
168 #define UNI_DECOMPOSITION_TYPE(NAME) \
169   uni_decomposition_ ## NAME,
170 
171   UNI_DECOMPOSITION_TYPES
172 };
173 
174 struct uni_decomposition_mapping
175 {
176   enum uni_decomposition_type type;
177   t_unicode * decomposition;
178 };
179 
180 struct uni_decomposition_type_name
181 {
182   t_uchar * name;
183   enum uni_decomposition_type category;
184 };
185 
186 extern const struct uni_decomposition_type_name uni_decomposition_type_names[];
187 extern const int n_uni_decomposition_types;
188 
189 
190 struct uni_case_mapping
191 {
192   t_unicode upper;
193   t_unicode lower;
194   t_unicode title;
195 };
196 
197 
198 /* automatically generated __STDC__ prototypes */
199 extern int uni_bidi_category_lookup_n (t_uchar * name, size_t len);
200 extern int uni_bidi_category_lookup (t_uchar * name);
201 extern int uni_general_category_lookup_n (t_uchar * name, size_t len);
202 extern int uni_general_category_lookup (t_uchar * name);
203 extern int uni_decomposition_type_lookup_n (t_uchar * name, size_t len);
204 extern int uni_decomposition_type_lookup (t_uchar * name);
205 #endif  /* INCLUDE__UNI__UNIDATA_H */
206