use gperf for the charsets as well.
[apps/madmutt.git] / charset.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 #ifndef _CHARSET_H
11 #define _CHARSET_H
12
13 #ifdef HAVE_CONFIG_H
14 #  include "config.h"
15 #endif
16
17
18 #define M_ICONV_HOOK_FROM 1
19 #define M_ICONV_HOOK_TO   2
20
21 extern char *Charset;
22 extern int Charset_is_utf8;
23
24 #ifdef HAVE_ICONV_H
25 #  include <iconv.h>
26
27 static inline ssize_t
28 my_iconv(iconv_t ict, const char **in, ssize_t *il, char **out, ssize_t *ol) {
29     return iconv(ict, (char **)in, (size_t*)il, out, (size_t*)ol);
30 }
31
32 #else
33 #  define iconv_t              void*
34 #  define iconv_open(a, b)     ((iconv_t)(-1))
35 #  define my_iconv(a,b,c,d,e)  0
36 #  define iconv_close(a)       0
37 #endif
38
39 void mutt_set_langinfo_charset (void);
40 void mutt_canonical_charset(char *, ssize_t, const char *);
41
42 int mutt_is_utf8(const char *s);
43 int mutt_is_us_ascii(const char *s);
44
45 int mutt_convert_string (char **, const char *, const char *, int);
46 const char *mutt_get_first_charset (const char *);
47 int mutt_convert_nonmime_string (char **);
48
49 iconv_t mutt_iconv_open (const char *, const char *, int);
50 ssize_t mutt_iconv (iconv_t, const char **, ssize_t *, char **, ssize_t *,
51                     const char **, const char *);
52
53 typedef void *FGETCONV;
54
55 FGETCONV *fgetconv_open (FILE *, const char *, const char *, int);
56 int fgetconv (FGETCONV *);
57 char *fgetconvs (char *, ssize_t, FGETCONV *);
58 void fgetconv_close (FGETCONV **);
59
60 void mutt_set_charset(char *charset);
61 wchar_t replacement_char(void);
62
63 #endif /* _CHARSET_H */