ekg2  GIT master
recode.h
Idź do dokumentacji tego pliku.
1 #ifndef __EKG_RECODE_H
2 #define __EKG_RECODE_H
3 
4 #include "dynstuff.h"
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #define EKG_RECODE_CP "CP-1250"
11 #define EKG_RECODE_ISO2 "ISO-8859-2"
12 #define EKG_RECODE_UTF8 "UTF-8"
13 
14 void *ekg_convert_string_init(const char *from, const char *to, void **rev);
15 void ekg_convert_string_destroy(void *ptr);
16 char *ekg_convert_string_p(const char *ps, void *ptr);
17 char *ekg_convert_string(const char *ps, const char *from, const char *to);
19 string_t ekg_convert_string_t(string_t s, const char *from, const char *to);
20 
21 void changed_console_charset(const char *name);
22 int ekg_converters_display(int quiet);
23 
24 void ekg_recode_inc_ref(const gchar *enc);
25 void ekg_recode_dec_ref(const gchar *enc);
26 
27 char *ekg_recode_from_core(const gchar *enc, gchar *buf);
28 gchar *ekg_recode_to_core(const gchar *enc, char *buf);
29 
30 char *ekg_recode_from_core_dup(const gchar *enc, const gchar *buf);
31 gchar *ekg_recode_to_core_dup(const gchar *enc, const char *buf);
32 
33 const char *ekg_recode_from_core_use(const gchar *enc, const gchar *buf);
34 const gchar *ekg_recode_to_core_use(const gchar *enc, const char *buf);
35 
36 /* below starts the current API */
37 
38 gchar *ekg_recode_from(const gchar *enc, const char *str);
39 char *ekg_recode_to(const gchar *enc, const gchar *str);
40 
41 gchar *ekg_recode_from_locale(const char *str);
42 char *ekg_recode_to_locale(const gchar *str);
43 
44 gboolean ekg_recode_gstring_from(const gchar *enc, GString *s);
45 gboolean ekg_try_recode_gstring_from(const gchar *enc, GString *s);
46 gboolean ekg_recode_gstring_to(const gchar *enc, GString *s);
47 
48 void ekg_fix_utf8(gchar *buf);
49 
51 
52 #define recode_xfree(org, ret) xfree((char *) ret);
53 
54 /* CP-1250 */
55 #define ekg_recode_cp_inc() ekg_recode_inc_ref(EKG_RECODE_CP)
56 #define ekg_recode_cp_dec() ekg_recode_dec_ref(EKG_RECODE_CP)
57 #define ekg_locale_to_cp(buf) ekg_recode_from_core(EKG_RECODE_CP, buf)
58 #define ekg_cp_to_core(buf) ekg_recode_to_core(EKG_RECODE_CP, buf)
59 #define ekg_locale_to_cp_dup(buf) ekg_recode_from_core_dup(EKG_RECODE_CP, buf)
60 #define ekg_cp_to_core_dup(buf) ekg_recode_to_core_dup(EKG_RECODE_CP, buf)
61 #define ekg_locale_to_cp_use(buf) ekg_recode_from_core_use(EKG_RECODE_CP, buf)
62 #define ekg_cp_to_core_use(buf) ekg_recode_to_core_use(EKG_RECODE_CP, buf)
63 
64 /* ISO-8859-2 */
65 #define ekg_recode_iso2_inc() ekg_recode_inc_ref(EKG_RECODE_ISO2)
66 #define ekg_recode_iso2_dec() ekg_recode_dec_ref(EKG_RECODE_ISO2)
67 #define ekg_locale_to_iso2(buf) ekg_recode_from_core(EKG_RECODE_ISO2, buf)
68 #define ekg_iso2_to_core(buf) ekg_recode_to_core(EKG_RECODE_ISO2, buf)
69 #define ekg_locale_to_iso2_dup(buf) ekg_recode_from_core_dup(EKG_RECODE_ISO2, buf)
70 #define ekg_iso2_to_core_dup(buf) ekg_recode_to_core_dup(EKG_RECODE_ISO2, buf)
71 #define ekg_locale_to_iso2_use(buf) ekg_recode_from_core_use(EKG_RECODE_ISO2, buf)
72 #define ekg_iso2_to_core_use(buf) ekg_recode_to_core_use(EKG_RECODE_ISO2, buf)
73 
74 /* UTF-8 */
75 #define ekg_recode_utf8_inc() ekg_recode_inc_ref(EKG_RECODE_UTF8)
76 #define ekg_recode_utf8_dec() ekg_recode_dec_ref(EKG_RECODE_UTF8)
77 #define ekg_locale_to_utf8(buf) ekg_recode_from_core(EKG_RECODE_UTF8, buf)
78 #define ekg_utf8_to_core(buf) ekg_recode_to_core(EKG_RECODE_UTF8, buf)
79 #define ekg_locale_to_utf8_dup(buf) ekg_recode_from_core_dup(EKG_RECODE_UTF8, buf)
80 #define ekg_utf8_to_core_dup(buf) ekg_recode_to_core_dup(EKG_RECODE_UTF8, buf)
81 #define ekg_locale_to_utf8_use(buf) ekg_recode_from_core_use(EKG_RECODE_UTF8, buf)
82 #define ekg_utf8_to_core_use(buf) ekg_recode_to_core_use(EKG_RECODE_UTF8, buf)
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif
gchar * ekg_recode_from(const gchar *enc, const char *str)
Definition: recode.c:228
GString * string_t
Definition: dynstuff.h:147
char * ekg_recode_from_core(const gchar *enc, gchar *buf)
Definition: recode.c:187
char * ekg_recode_to_locale(const gchar *str)
Definition: recode.c:291
Definition: themes.h:36
fstring_t * ekg_recode_fstr_to_locale(const fstring_t *fstr)
Definition: recode.c:439
gchar * ekg_recode_to_core(const gchar *enc, char *buf)
Definition: recode.c:193
char * ekg_convert_string_p(const char *ps, void *ptr)
Definition: recode.c:112
char * ekg_recode_to(const gchar *enc, const gchar *str)
Definition: recode.c:249
const gchar * ekg_recode_to_core_use(const gchar *enc, const char *buf)
Definition: recode.c:211
string_t ekg_convert_string_t_p(string_t s, void *ptr)
Definition: recode.c:155
void ekg_convert_string_destroy(void *ptr)
Definition: recode.c:90
char * ekg_convert_string(const char *ps, const char *from, const char *to)
Definition: recode.c:134
void ekg_recode_dec_ref(const gchar *enc)
Definition: recode.c:184
gchar * ekg_recode_to_core_dup(const gchar *enc, const char *buf)
Definition: recode.c:203
gboolean ekg_try_recode_gstring_from(const gchar *enc, GString *s)
Definition: recode.c:343
gchar * ekg_recode_from_locale(const char *str)
Definition: recode.c:269
gboolean ekg_recode_gstring_from(const gchar *enc, GString *s)
Definition: recode.c:326
int ekg_converters_display(int quiet)
void ekg_fix_utf8(gchar *buf)
Definition: recode.c:373
gboolean ekg_recode_gstring_to(const gchar *enc, GString *s)
Definition: recode.c:359
void ekg_recode_inc_ref(const gchar *enc)
Definition: recode.c:181
const char * name
Definition: remote.c:88
char * ekg_recode_from_core_dup(const gchar *enc, const gchar *buf)
Definition: recode.c:199
void changed_console_charset(const char *name)
#define s
void * ekg_convert_string_init(const char *from, const char *to, void **rev)
Definition: recode.c:60
string_t ekg_convert_string_t(string_t s, const char *from, const char *to)
Definition: recode.c:160
const char * ekg_recode_from_core_use(const gchar *enc, const gchar *buf)
Definition: recode.c:207