1 | /* FriBidi |
2 | * fribidi-char-sets.h - character set conversion routines |
3 | * |
4 | * Authors: |
5 | * Behdad Esfahbod, 2001, 2002, 2004 |
6 | * Dov Grobgeld, 1999, 2000 |
7 | * |
8 | * Copyright (C) 2004 Sharif FarsiWeb, Inc |
9 | * Copyright (C) 2001,2002 Behdad Esfahbod |
10 | * Copyright (C) 1999,2000 Dov Grobgeld |
11 | * |
12 | * This library is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU Lesser General Public |
14 | * License as published by the Free Software Foundation; either |
15 | * version 2.1 of the License, or (at your option) any later version. |
16 | * |
17 | * This library is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | * Lesser General Public License for more details. |
21 | * |
22 | * You should have received a copy of the GNU Lesser General Public License |
23 | * along with this library, in a file named COPYING; if not, write to the |
24 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 | * Boston, MA 02110-1301, USA |
26 | * |
27 | * For licensing issues, contact <fribidi.license@gmail.com>. |
28 | */ |
29 | #ifndef _FRIBIDI_CHAR_SETS_H |
30 | #define _FRIBIDI_CHAR_SETS_H |
31 | |
32 | #include "fribidi-common.h" |
33 | |
34 | #include "fribidi-types.h" |
35 | |
36 | #include "fribidi-begindecls.h" |
37 | |
38 | typedef enum |
39 | { |
40 | _FRIBIDI_CHAR_SET_NOT_FOUND, |
41 | # define _FRIBIDI_ADD_CHAR_SET(CHAR_SET, char_set) FRIBIDI_CHAR_SET_##CHAR_SET, |
42 | # include "fribidi-char-sets-list.h" |
43 | # undef _FRIBIDI_ADD_CHAR_SET |
44 | _FRIBIDI_CHAR_SETS_NUM_PLUS_ONE |
45 | } |
46 | FriBidiCharSet; |
47 | |
48 | #define FRIBIDI_CHAR_SET_NOT_FOUND _FRIBIDI_CHAR_SET_NOT_FOUND |
49 | #define FRIBIDI_CHAR_SETS_NUM (_FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1) |
50 | |
51 | |
52 | /* fribidi_charset_to_unicode - convert string to Unicode |
53 | * |
54 | * This function converts an string from a character set, to a Unicode string. |
55 | * |
56 | * Returns: The length of the new string. |
57 | */ |
58 | FRIBIDI_ENTRY FriBidiStrIndex fribidi_charset_to_unicode ( |
59 | FriBidiCharSet char_set, /* character set to convert from */ |
60 | const char *s, /* input string encoded in char_set */ |
61 | FriBidiStrIndex len, /* input string length */ |
62 | FriBidiChar *us /* output Unicode string */ |
63 | ); |
64 | |
65 | /* fribidi_unicode_to_charset - convert string from Unicode |
66 | * |
67 | * This function converts a Unicode string to an string in another character |
68 | * set. It also null-terminates the output string. |
69 | * |
70 | * Returns: The length of the new string. |
71 | */ |
72 | FRIBIDI_ENTRY FriBidiStrIndex fribidi_unicode_to_charset ( |
73 | FriBidiCharSet char_set, /* character set to convert to */ |
74 | const FriBidiChar *us, /* input Unicode string */ |
75 | FriBidiStrIndex len, /* input string length */ |
76 | char *s /* output string encoded in char_set */ |
77 | ); |
78 | |
79 | /* fribidi_parse_charset - parse character set name |
80 | * |
81 | * Returns: The character set named s, or FRIBIDI_CHAR_SET_NOT_FOUND if the |
82 | * character set is not available. |
83 | */ |
84 | FRIBIDI_ENTRY FriBidiCharSet fribidi_parse_charset ( |
85 | const char *s /* input name of the character set */ |
86 | ); |
87 | |
88 | |
89 | FRIBIDI_ENTRY const char *fribidi_char_set_name ( |
90 | FriBidiCharSet char_set |
91 | ); |
92 | |
93 | FRIBIDI_ENTRY const char *fribidi_char_set_title ( |
94 | FriBidiCharSet char_set |
95 | ); |
96 | |
97 | FRIBIDI_ENTRY const char *fribidi_char_set_desc ( |
98 | FriBidiCharSet char_set |
99 | ); |
100 | |
101 | #include "fribidi-enddecls.h" |
102 | |
103 | #endif /* !_FRIBIDI_CHAR_SETS_H */ |
104 | /* Editor directions: |
105 | * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent |
106 | */ |
107 | |