ekg2
ekg/recode.h
Idź do dokumentacji tego pliku.
00001 #ifndef __EKG_RECODE_H
00002 #define __EKG_RECODE_H
00003 
00004 #include "dynstuff.h"
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 enum ekg_recode_name {
00011         EKG_RECODE_CP = 0,      /* CP-1250 */
00012         EKG_RECODE_ISO2,        /* ISO-8859-2 */
00013         EKG_RECODE_UTF8         /* UTF-8 */
00014 };
00015 
00016 void *ekg_convert_string_init(const char *from, const char *to, void **rev);
00017 void ekg_convert_string_destroy(void *ptr);
00018 char *ekg_convert_string_p(const char *ps, void *ptr);
00019 char *ekg_convert_string(const char *ps, const char *from, const char *to);
00020 string_t ekg_convert_string_t_p(string_t s, void *ptr);
00021 string_t ekg_convert_string_t(string_t s, const char *from, const char *to);
00022 
00023 void changed_console_charset(const char *name);
00024 int ekg_converters_display(int quiet);
00025 
00026 void ekg_recode_inc_ref(enum ekg_recode_name enc);
00027 void ekg_recode_dec_ref(enum ekg_recode_name enc);
00028 
00029 char *ekg_recode_from_locale(enum ekg_recode_name enc, char *buf);
00030 char *ekg_recode_to_locale(enum ekg_recode_name enc, char *buf);
00031 
00032 char *ekg_recode_from_locale_dup(enum ekg_recode_name enc, const char *buf);
00033 char *ekg_recode_to_locale_dup(enum ekg_recode_name enc, const char *buf);
00034 
00035 const char *ekg_recode_from_locale_use(enum ekg_recode_name enc, const char *buf);
00036 const char *ekg_recode_to_locale_use(enum ekg_recode_name enc, const char *buf);
00037 
00038 #define recode_xfree(org, ret) do { if (org != ret) xfree((char *) ret); } while(0); 
00039 
00040 /* CP-1250 */
00041 #define ekg_recode_cp_inc()     ekg_recode_inc_ref(EKG_RECODE_CP)
00042 #define ekg_recode_cp_dec()     ekg_recode_dec_ref(EKG_RECODE_CP)
00043 #define ekg_locale_to_cp(buf)   ekg_recode_from_locale(EKG_RECODE_CP, buf)
00044 #define ekg_cp_to_locale(buf)   ekg_recode_to_locale(EKG_RECODE_CP, buf)
00045 #define ekg_locale_to_cp_dup(buf) ekg_recode_from_locale_dup(EKG_RECODE_CP, buf)
00046 #define ekg_cp_to_locale_dup(buf) ekg_recode_to_locale_dup(EKG_RECODE_CP, buf)
00047 #define ekg_locale_to_cp_use(buf) ekg_recode_from_locale_use(EKG_RECODE_CP, buf)
00048 #define ekg_cp_to_locale_use(buf) ekg_recode_to_locale_use(EKG_RECODE_CP, buf)
00049 
00050 /* ISO-8859-2 */
00051 #define ekg_recode_iso2_inc()   ekg_recode_inc_ref(EKG_RECODE_ISO2)
00052 #define ekg_recode_iso2_dec()   ekg_recode_dec_ref(EKG_RECODE_ISO2)
00053 #define ekg_locale_to_iso2(buf) ekg_recode_from_locale(EKG_RECODE_ISO2, buf)
00054 #define ekg_iso2_to_locale(buf) ekg_recode_to_locale(EKG_RECODE_ISO2, buf)
00055 #define ekg_locale_to_iso2_dup(buf) ekg_recode_from_locale_dup(EKG_RECODE_ISO2, buf)
00056 #define ekg_iso2_to_locale_dup(buf) ekg_recode_to_locale_dup(EKG_RECODE_ISO2, buf)
00057 #define ekg_locale_to_iso2_use(buf) ekg_recode_from_locale_use(EKG_RECODE_ISO2, buf)
00058 #define ekg_iso2_to_locale_use(buf) ekg_recode_to_locale_use(EKG_RECODE_ISO2, buf)
00059 
00060 /* UTF-8 */
00061 #define ekg_recode_utf8_inc()   ekg_recode_inc_ref(EKG_RECODE_UTF8)
00062 #define ekg_recode_utf8_dec()   ekg_recode_dec_ref(EKG_RECODE_UTF8)
00063 #define ekg_locale_to_utf8(buf) ekg_recode_from_locale(EKG_RECODE_UTF8, buf)
00064 #define ekg_utf8_to_locale(buf) ekg_recode_to_locale(EKG_RECODE_UTF8, buf)
00065 #define ekg_locale_to_utf8_dup(buf) ekg_recode_from_locale_dup(EKG_RECODE_UTF8, buf)
00066 #define ekg_utf8_to_locale_dup(buf) ekg_recode_to_locale_dup(EKG_RECODE_UTF8, buf)
00067 #define ekg_locale_to_utf8_use(buf) ekg_recode_from_locale_use(EKG_RECODE_UTF8, buf)
00068 #define ekg_utf8_to_locale_use(buf) ekg_recode_to_locale_use(EKG_RECODE_UTF8, buf)
00069 
00070 #ifdef __cplusplus
00071 }
00072 #endif
00073 
00074 #endif
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje