1 | /* FriBidi - Library of BiDi algorithm |
---|
2 | * Copyright (C) 1999,2000 Dov Grobgeld, and |
---|
3 | * Copyright (C) 2001,2002 Behdad Esfahbod. |
---|
4 | * |
---|
5 | * This library is free software; you can redistribute it and/or |
---|
6 | * modify it under the terms of the GNU Lesser General Public |
---|
7 | * License as published by the Free Software Foundation; either |
---|
8 | * version 2.1 of the License, or (at your option) any later version. |
---|
9 | * |
---|
10 | * This library is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
13 | * Lesser General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU Lesser General Public License |
---|
16 | * along with this library, in a file named COPYING; if not, write to the |
---|
17 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
---|
18 | * Boston, MA 02111-1307, USA |
---|
19 | * |
---|
20 | * For licensing issues, contact <dov@imagic.weizmann.ac.il> and |
---|
21 | * <fwpg@sharif.edu>. |
---|
22 | */ |
---|
23 | |
---|
24 | #include "fribidi_config.h" |
---|
25 | #ifndef FRIBIDI_NO_CHARSETS |
---|
26 | |
---|
27 | #ifndef FRIBIDI_CHAR_SETS_H |
---|
28 | #define FRIBIDI_CHAR_SETS_H |
---|
29 | |
---|
30 | #include "fribidi.h" |
---|
31 | |
---|
32 | #ifdef __cplusplus |
---|
33 | extern "C" |
---|
34 | { |
---|
35 | #endif |
---|
36 | |
---|
37 | #include "fribidi_char_sets_cap_rtl.h" |
---|
38 | #include "fribidi_char_sets_utf8.h" |
---|
39 | #include "fribidi_char_sets_iso8859_6.h" |
---|
40 | #include "fribidi_char_sets_iso8859_8.h" |
---|
41 | #include "fribidi_char_sets_cp1255.h" |
---|
42 | #include "fribidi_char_sets_cp1256.h" |
---|
43 | #include "fribidi_char_sets_isiri_3342.h" |
---|
44 | |
---|
45 | /* The following enum members are going to be used as array indices, |
---|
46 | so they must be numbered from 0, and with the fixed order, |
---|
47 | FRIBIDI_CHARSET_DEFAULT is the one that when a charset leaves it's |
---|
48 | state with fribidi_charset_leave(), it gets into DEFAULT mode, |
---|
49 | so it must have no initialization. */ |
---|
50 | typedef enum |
---|
51 | { |
---|
52 | FRIBIDI_CHAR_SET_NOT_FOUND, |
---|
53 | #define _FRIBIDI_ADD_CHAR_SET(CHAR_SET, char_set) FRIBIDI_CHAR_SET_##CHAR_SET, |
---|
54 | #include "fribidi_char_sets.i" |
---|
55 | #undef _FRIBIDI_ADD_CHAR_SET |
---|
56 | |
---|
57 | FRIBIDI_CHAR_SETS_NUM_PLUS_ONE, |
---|
58 | |
---|
59 | FRIBIDI_CHAR_SET_DEFAULT = FRIBIDI_CHAR_SET_UTF8 |
---|
60 | } |
---|
61 | FriBidiCharSet; |
---|
62 | |
---|
63 | #define FRIBIDI_CHAR_SETS_NUM (FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1) |
---|
64 | |
---|
65 | /* Convert the character string "s" in charset "char_set" to unicode |
---|
66 | string "us" and return it's length. */ |
---|
67 | FRIBIDI_API int fribidi_charset_to_unicode (FriBidiCharSet char_set, |
---|
68 | char *s, int length, |
---|
69 | /* output */ |
---|
70 | FriBidiChar *us); |
---|
71 | |
---|
72 | /* Convert the unicode string "us" with length "length" to character |
---|
73 | string "s" in charset "char_set" and return it's length. */ |
---|
74 | FRIBIDI_API int fribidi_unicode_to_charset (FriBidiCharSet char_set, |
---|
75 | FriBidiChar *us, int length, |
---|
76 | /* output */ |
---|
77 | char *s); |
---|
78 | |
---|
79 | /* Return the string containing the name of the charset. */ |
---|
80 | FRIBIDI_API char *fribidi_char_set_name (FriBidiCharSet char_set); |
---|
81 | |
---|
82 | /* Return the string containing the title (name with a short description) |
---|
83 | of the charset. */ |
---|
84 | FRIBIDI_API char *fribidi_char_set_title (FriBidiCharSet char_set); |
---|
85 | |
---|
86 | /* Return the string containing a descreption about the charset, if any. */ |
---|
87 | FRIBIDI_API char *fribidi_char_set_desc (FriBidiCharSet char_set); |
---|
88 | |
---|
89 | /* Some charsets like CapRTL may need to change some fribidis tables, by |
---|
90 | calling this function, they can do this changes. */ |
---|
91 | FRIBIDI_API fribidi_boolean fribidi_char_set_enter (FriBidiCharSet |
---|
92 | char_set); |
---|
93 | |
---|
94 | /* Some charsets like CapRTL may need to change some fribidis tables, by |
---|
95 | calling this function, they can undo their changes, perhaps to enter |
---|
96 | another mode. */ |
---|
97 | FRIBIDI_API fribidi_boolean fribidi_char_set_leave (FriBidiCharSet |
---|
98 | char_set); |
---|
99 | |
---|
100 | /* Return the charset which name is "s". */ |
---|
101 | FRIBIDI_API FriBidiCharSet fribidi_parse_charset (char *s); |
---|
102 | |
---|
103 | |
---|
104 | #ifdef FRIBIDI_INTERFACE_1 |
---|
105 | /* Interface version 1, deprecated, just for compatibility. */ |
---|
106 | |
---|
107 | FRIBIDI_API int fribidi_charset_to_unicode_1 (FriBidiCharSet char_set, |
---|
108 | char *s, |
---|
109 | /* output */ |
---|
110 | FriBidiChar *us); |
---|
111 | #define fribidi_charset_to_unicode fribidi_charset_to_unicode_1 |
---|
112 | |
---|
113 | /* Also old character sets. */ |
---|
114 | #define fribidi_utf8_to_unicode fribidi_utf8_to_unicode_1 |
---|
115 | #define fribidi_cap_rtl_to_unicode fribidi_cap_rtl_to_unicode_1 |
---|
116 | #define fribidi_iso8859_6_to_unicode fribidi_iso8859_6_to_unicode_1 |
---|
117 | #define fribidi_iso8859_8_to_unicode fribidi_iso8859_8_to_unicode_1 |
---|
118 | #define fribidi_cp1255_to_unicode fribidi_cp1255_to_unicode_1 |
---|
119 | #define fribidi_cp1256_to_unicode fribidi_cp1256_to_unicode_1 |
---|
120 | #define fribidi_isiri_3342_to_unicode fribidi_isiri_3342_to_unicode_1 |
---|
121 | |
---|
122 | #define FRIBIDI_TO_UNICODE_DECLARE_1(cs) \ |
---|
123 | int fribidi_##cs##_to_unicode_1 (char *s, FriBidiChar *us); |
---|
124 | FRIBIDI_TO_UNICODE_DECLARE_1 (utf8) |
---|
125 | FRIBIDI_TO_UNICODE_DECLARE_1 (cap_rtl) |
---|
126 | FRIBIDI_TO_UNICODE_DECLARE_1 (iso8859_6) |
---|
127 | FRIBIDI_TO_UNICODE_DECLARE_1 (iso8859_8) |
---|
128 | FRIBIDI_TO_UNICODE_DECLARE_1 (cp1255) |
---|
129 | FRIBIDI_TO_UNICODE_DECLARE_1 (cp1256) |
---|
130 | FRIBIDI_TO_UNICODE_DECLARE_1 (isiri_3342) |
---|
131 | #undef FRIBIDI_TO_UNICODE_DECLARE_1 |
---|
132 | #endif /* FRIBIDI_INTERFACE_1 */ |
---|
133 | #ifdef __cplusplus |
---|
134 | } |
---|
135 | #endif |
---|
136 | |
---|
137 | #endif /* FRIBIDI_CHAR_SETS_H */ |
---|
138 | |
---|
139 | #endif |
---|