… | |
… | |
20 | #ifndef PSICONV_UNICODE_H |
20 | #ifndef PSICONV_UNICODE_H |
21 | #define PSICONV_UNICODE_H |
21 | #define PSICONV_UNICODE_H |
22 | |
22 | |
23 | #include <psiconv/general.h> |
23 | #include <psiconv/general.h> |
24 | #include <psiconv/configuration.h> |
24 | #include <psiconv/configuration.h> |
|
|
25 | #include <psiconv/buffer.h> |
25 | |
26 | |
26 | #ifdef __cplusplus |
27 | #ifdef __cplusplus |
27 | extern "C" { |
28 | extern "C" { |
28 | #endif /* __cplusplus */ |
29 | #endif /* __cplusplus */ |
29 | |
30 | |
… | |
… | |
36 | extern int psiconv_unicode_select_characterset(const psiconv_config config, |
37 | extern int psiconv_unicode_select_characterset(const psiconv_config config, |
37 | int charset); |
38 | int charset); |
38 | |
39 | |
39 | /* Translate a single character to a unicode character, using the |
40 | /* Translate a single character to a unicode character, using the |
40 | translation tables in config */ |
41 | translation tables in config */ |
41 | extern psiconv_ucs2 psiconv_unicode_from_char(const psiconv_config config, |
42 | extern psiconv_ucs2 psiconv_unicode_read_char(const psiconv_config config, |
42 | psiconv_u8 input); |
43 | psiconv_buffer buf, |
|
|
44 | int lev,psiconv_u32 off, |
|
|
45 | int *length, |
|
|
46 | int *status); |
43 | |
47 | |
44 | /* Translate a single unicode character to a normal character, using the |
|
|
45 | translation tables in config */ |
|
|
46 | extern psiconv_u8 psiconv_unicode_to_char(psiconv_config config, |
48 | extern int psiconv_unicode_write_char(const psiconv_config config, |
47 | psiconv_ucs2 input); |
49 | psiconv_buffer buf, |
|
|
50 | int lev, |
|
|
51 | psiconv_ucs2 value); |
48 | |
52 | |
49 | /* Translate a normal string to unicode. |
|
|
50 | Output is allocated by this function on success, and must be freed by |
|
|
51 | hand. */ |
|
|
52 | extern int psiconv_unicode_from_chars(const psiconv_config config, |
|
|
53 | const psiconv_u8 *input, |
|
|
54 | psiconv_ucs2 **output); |
|
|
55 | /* Translate a unicode string to a normal one. |
|
|
56 | Output is allocated by this function on success, and must be freed by |
|
|
57 | hand. */ |
|
|
58 | extern int psiconv_unicode_to_chars(const psiconv_config config, |
|
|
59 | const psiconv_ucs2 *input, |
|
|
60 | psiconv_u8 **output); |
|
|
61 | |
53 | |
62 | /* Compute the length of a unicode string */ |
54 | /* Compute the length of a unicode string */ |
63 | extern int psiconv_unicode_strlen(const psiconv_ucs2 *input); |
55 | extern int psiconv_unicode_strlen(const psiconv_ucs2 *input); |
64 | |
56 | |
65 | /* Duplicate a unicode string */ |
57 | /* Duplicate a unicode string */ |
66 | extern psiconv_ucs2 *psiconv_unicode_strdup(const psiconv_ucs2 *input); |
58 | extern psiconv_ucs2 *psiconv_unicode_strdup(const psiconv_ucs2 *input); |
67 | |
59 | |
68 | /* Compare two unicode strings. Ordering as in Unicode codepoints! */ |
60 | /* Compare two unicode strings. Ordering as in Unicode codepoints! */ |
69 | int psiconv_unicode_strcmp(const psiconv_ucs2 *str1, const psiconv_ucs2 *str2); |
61 | extern int psiconv_unicode_strcmp(const psiconv_ucs2 *str1, const psiconv_ucs2 *str2); |
|
|
62 | |
|
|
63 | /* Return a newly allocated empty string */ |
|
|
64 | extern psiconv_ucs2 *psiconv_unicode_empty_string(void); |
|
|
65 | |
70 | |
66 | |
71 | #ifdef __cplusplus |
67 | #ifdef __cplusplus |
72 | } |
68 | } |
73 | #endif /* __cplusplus */ |
69 | #endif /* __cplusplus */ |
74 | |
70 | |