]> arthur.barton.de Git - netatalk.git/blob - libatalk/unicode/unicode.h
Add unicode to Mac OS code page (internal or with iconv) Björn Fernhomberg and
[netatalk.git] / libatalk / unicode / unicode.h
1
2
3
4
5 #define ucs2_t  u_int16_t
6
7 /* generic iconv conversion structure */
8 typedef struct {
9         size_t (*direct)(void *cd, char **inbuf, size_t *inbytesleft,
10                          char **outbuf, size_t *outbytesleft);
11         size_t (*pull)(void *cd, char **inbuf, size_t *inbytesleft,
12                        char **outbuf, size_t *outbytesleft);
13         size_t (*push)(void *cd, char **inbuf, size_t *inbytesleft,
14                        char **outbuf, size_t *outbytesleft);
15         void *cd_direct, *cd_pull, *cd_push;
16         char *from_name, *to_name;
17 } *atalk_iconv_t;
18
19
20 /* this defines the charset types used in samba */
21 typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4} charset_t;
22
23 #define NUM_CHARSETS 5
24
25 /*
26  *   for each charset we have a function that pulls from that charset to
27  *     a ucs2 buffer, and a function that pushes to a ucs2 buffer
28  *     */
29
30 struct charset_functions {
31         const char *name;
32         size_t (*pull)(void *, char **inbuf, size_t *inbytesleft,
33                                    char **outbuf, size_t *outbytesleft);
34         size_t (*push)(void *, char **inbuf, size_t *inbytesleft,
35                                    char **outbuf, size_t *outbytesleft);
36         struct charset_functions *prev, *next;
37 };
38
39
40 extern size_t atalk_iconv(atalk_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
41 atalk_iconv_t atalk_iconv_open(const char *tocode, const char *fromcode);
42 int atalk_iconv_close (atalk_iconv_t cd);
43
44 ucs2_t toupper_w(ucs2_t val);
45 ucs2_t tolower_w(ucs2_t val);
46
47