ekg2
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
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 
11  EKG_RECODE_CP = 0, /* CP-1250 */
12  EKG_RECODE_ISO2, /* ISO-8859-2 */
13  EKG_RECODE_UTF8 /* UTF-8 */
14 };
15 
16 void *ekg_convert_string_init(const char *from, const char *to, void **rev);
17 void ekg_convert_string_destroy(void *ptr);
18 char *ekg_convert_string_p(const char *ps, void *ptr);
19 char *ekg_convert_string(const char *ps, const char *from, const char *to);
21 string_t ekg_convert_string_t(string_t s, const char *from, const char *to);
22 
23 void changed_console_charset(const char *name);
25 
26 void ekg_recode_inc_ref(enum ekg_recode_name enc);
27 void ekg_recode_dec_ref(enum ekg_recode_name enc);
28 
29 char *ekg_recode_from_locale(enum ekg_recode_name enc, char *buf);
30 char *ekg_recode_to_locale(enum ekg_recode_name enc, char *buf);
31 
32 char *ekg_recode_from_locale_dup(enum ekg_recode_name enc, const char *buf);
33 char *ekg_recode_to_locale_dup(enum ekg_recode_name enc, const char *buf);
34 
35 const char *ekg_recode_from_locale_use(enum ekg_recode_name enc, const char *buf);
36 const char *ekg_recode_to_locale_use(enum ekg_recode_name enc, const char *buf);
37 
38 #define recode_xfree(org, ret) do { if (org != ret) xfree((char *) ret); } while(0);
39 
40 /* CP-1250 */
41 #define ekg_recode_cp_inc() ekg_recode_inc_ref(EKG_RECODE_CP)
42 #define ekg_recode_cp_dec() ekg_recode_dec_ref(EKG_RECODE_CP)
43 #define ekg_locale_to_cp(buf) ekg_recode_from_locale(EKG_RECODE_CP, buf)
44 #define ekg_cp_to_locale(buf) ekg_recode_to_locale(EKG_RECODE_CP, buf)
45 #define ekg_locale_to_cp_dup(buf) ekg_recode_from_locale_dup(EKG_RECODE_CP, buf)
46 #define ekg_cp_to_locale_dup(buf) ekg_recode_to_locale_dup(EKG_RECODE_CP, buf)
47 #define ekg_locale_to_cp_use(buf) ekg_recode_from_locale_use(EKG_RECODE_CP, buf)
48 #define ekg_cp_to_locale_use(buf) ekg_recode_to_locale_use(EKG_RECODE_CP, buf)
49 
50 /* ISO-8859-2 */
51 #define ekg_recode_iso2_inc() ekg_recode_inc_ref(EKG_RECODE_ISO2)
52 #define ekg_recode_iso2_dec() ekg_recode_dec_ref(EKG_RECODE_ISO2)
53 #define ekg_locale_to_iso2(buf) ekg_recode_from_locale(EKG_RECODE_ISO2, buf)
54 #define ekg_iso2_to_locale(buf) ekg_recode_to_locale(EKG_RECODE_ISO2, buf)
55 #define ekg_locale_to_iso2_dup(buf) ekg_recode_from_locale_dup(EKG_RECODE_ISO2, buf)
56 #define ekg_iso2_to_locale_dup(buf) ekg_recode_to_locale_dup(EKG_RECODE_ISO2, buf)
57 #define ekg_locale_to_iso2_use(buf) ekg_recode_from_locale_use(EKG_RECODE_ISO2, buf)
58 #define ekg_iso2_to_locale_use(buf) ekg_recode_to_locale_use(EKG_RECODE_ISO2, buf)
59 
60 /* UTF-8 */
61 #define ekg_recode_utf8_inc() ekg_recode_inc_ref(EKG_RECODE_UTF8)
62 #define ekg_recode_utf8_dec() ekg_recode_dec_ref(EKG_RECODE_UTF8)
63 #define ekg_locale_to_utf8(buf) ekg_recode_from_locale(EKG_RECODE_UTF8, buf)
64 #define ekg_utf8_to_locale(buf) ekg_recode_to_locale(EKG_RECODE_UTF8, buf)
65 #define ekg_locale_to_utf8_dup(buf) ekg_recode_from_locale_dup(EKG_RECODE_UTF8, buf)
66 #define ekg_utf8_to_locale_dup(buf) ekg_recode_to_locale_dup(EKG_RECODE_UTF8, buf)
67 #define ekg_locale_to_utf8_use(buf) ekg_recode_from_locale_use(EKG_RECODE_UTF8, buf)
68 #define ekg_utf8_to_locale_use(buf) ekg_recode_to_locale_use(EKG_RECODE_UTF8, buf)
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif