ekg2
Definicje | Wyliczenia | Funkcje
Dokumentacja pliku ekg/recode.h
#include "dynstuff.h"

Idź do kodu źródłowego tego pliku.

Definicje

#define recode_xfree(org, ret)   do { if (org != ret) xfree((char *) ret); } while(0);
#define ekg_recode_cp_inc()   ekg_recode_inc_ref(EKG_RECODE_CP)
#define ekg_recode_cp_dec()   ekg_recode_dec_ref(EKG_RECODE_CP)
#define ekg_locale_to_cp(buf)   ekg_recode_from_locale(EKG_RECODE_CP, buf)
#define ekg_cp_to_locale(buf)   ekg_recode_to_locale(EKG_RECODE_CP, buf)
#define ekg_locale_to_cp_dup(buf)   ekg_recode_from_locale_dup(EKG_RECODE_CP, buf)
#define ekg_cp_to_locale_dup(buf)   ekg_recode_to_locale_dup(EKG_RECODE_CP, buf)
#define ekg_locale_to_cp_use(buf)   ekg_recode_from_locale_use(EKG_RECODE_CP, buf)
#define ekg_cp_to_locale_use(buf)   ekg_recode_to_locale_use(EKG_RECODE_CP, buf)
#define ekg_recode_iso2_inc()   ekg_recode_inc_ref(EKG_RECODE_ISO2)
#define ekg_recode_iso2_dec()   ekg_recode_dec_ref(EKG_RECODE_ISO2)
#define ekg_locale_to_iso2(buf)   ekg_recode_from_locale(EKG_RECODE_ISO2, buf)
#define ekg_iso2_to_locale(buf)   ekg_recode_to_locale(EKG_RECODE_ISO2, buf)
#define ekg_locale_to_iso2_dup(buf)   ekg_recode_from_locale_dup(EKG_RECODE_ISO2, buf)
#define ekg_iso2_to_locale_dup(buf)   ekg_recode_to_locale_dup(EKG_RECODE_ISO2, buf)
#define ekg_locale_to_iso2_use(buf)   ekg_recode_from_locale_use(EKG_RECODE_ISO2, buf)
#define ekg_iso2_to_locale_use(buf)   ekg_recode_to_locale_use(EKG_RECODE_ISO2, buf)
#define ekg_recode_utf8_inc()   ekg_recode_inc_ref(EKG_RECODE_UTF8)
#define ekg_recode_utf8_dec()   ekg_recode_dec_ref(EKG_RECODE_UTF8)
#define ekg_locale_to_utf8(buf)   ekg_recode_from_locale(EKG_RECODE_UTF8, buf)
#define ekg_utf8_to_locale(buf)   ekg_recode_to_locale(EKG_RECODE_UTF8, buf)
#define ekg_locale_to_utf8_dup(buf)   ekg_recode_from_locale_dup(EKG_RECODE_UTF8, buf)
#define ekg_utf8_to_locale_dup(buf)   ekg_recode_to_locale_dup(EKG_RECODE_UTF8, buf)
#define ekg_locale_to_utf8_use(buf)   ekg_recode_from_locale_use(EKG_RECODE_UTF8, buf)
#define ekg_utf8_to_locale_use(buf)   ekg_recode_to_locale_use(EKG_RECODE_UTF8, buf)

Wyliczenia

enum  ekg_recode_name { EKG_RECODE_CP = 0, EKG_RECODE_ISO2, EKG_RECODE_UTF8 }

Funkcje

void * ekg_convert_string_init (const char *from, const char *to, void **rev)
void ekg_convert_string_destroy (void *ptr)
char * ekg_convert_string_p (const char *ps, void *ptr)
char * ekg_convert_string (const char *ps, const char *from, const char *to)
string_t ekg_convert_string_t_p (string_t s, void *ptr)
string_t ekg_convert_string_t (string_t s, const char *from, const char *to)
void changed_console_charset (const char *name)
int ekg_converters_display (int quiet)
void ekg_recode_inc_ref (enum ekg_recode_name enc)
void ekg_recode_dec_ref (enum ekg_recode_name enc)
char * ekg_recode_from_locale (enum ekg_recode_name enc, char *buf)
char * ekg_recode_to_locale (enum ekg_recode_name enc, char *buf)
char * ekg_recode_from_locale_dup (enum ekg_recode_name enc, const char *buf)
char * ekg_recode_to_locale_dup (enum ekg_recode_name enc, const char *buf)
const char * ekg_recode_from_locale_use (enum ekg_recode_name enc, const char *buf)
const char * ekg_recode_to_locale_use (enum ekg_recode_name enc, const char *buf)

Dokumentacja definicji

#define ekg_cp_to_locale (   buf)    ekg_recode_to_locale(EKG_RECODE_CP, buf)
#define ekg_cp_to_locale_dup (   buf)    ekg_recode_to_locale_dup(EKG_RECODE_CP, buf)
#define ekg_cp_to_locale_use (   buf)    ekg_recode_to_locale_use(EKG_RECODE_CP, buf)
#define ekg_iso2_to_locale (   buf)    ekg_recode_to_locale(EKG_RECODE_ISO2, buf)
#define ekg_iso2_to_locale_dup (   buf)    ekg_recode_to_locale_dup(EKG_RECODE_ISO2, buf)
#define ekg_iso2_to_locale_use (   buf)    ekg_recode_to_locale_use(EKG_RECODE_ISO2, buf)
#define ekg_locale_to_cp (   buf)    ekg_recode_from_locale(EKG_RECODE_CP, buf)
#define ekg_locale_to_cp_dup (   buf)    ekg_recode_from_locale_dup(EKG_RECODE_CP, buf)
#define ekg_locale_to_cp_use (   buf)    ekg_recode_from_locale_use(EKG_RECODE_CP, buf)
#define ekg_locale_to_iso2 (   buf)    ekg_recode_from_locale(EKG_RECODE_ISO2, buf)
#define ekg_locale_to_iso2_dup (   buf)    ekg_recode_from_locale_dup(EKG_RECODE_ISO2, buf)
#define ekg_locale_to_iso2_use (   buf)    ekg_recode_from_locale_use(EKG_RECODE_ISO2, buf)
#define ekg_locale_to_utf8 (   buf)    ekg_recode_from_locale(EKG_RECODE_UTF8, buf)
#define ekg_locale_to_utf8_dup (   buf)    ekg_recode_from_locale_dup(EKG_RECODE_UTF8, buf)
#define ekg_locale_to_utf8_use (   buf)    ekg_recode_from_locale_use(EKG_RECODE_UTF8, buf)
#define ekg_recode_cp_dec ( )    ekg_recode_dec_ref(EKG_RECODE_CP)
#define ekg_recode_cp_inc ( )    ekg_recode_inc_ref(EKG_RECODE_CP)
#define ekg_recode_iso2_dec ( )    ekg_recode_dec_ref(EKG_RECODE_ISO2)
#define ekg_recode_iso2_inc ( )    ekg_recode_inc_ref(EKG_RECODE_ISO2)
#define ekg_recode_utf8_dec ( )    ekg_recode_dec_ref(EKG_RECODE_UTF8)
#define ekg_recode_utf8_inc ( )    ekg_recode_inc_ref(EKG_RECODE_UTF8)
#define ekg_utf8_to_locale (   buf)    ekg_recode_to_locale(EKG_RECODE_UTF8, buf)
#define ekg_utf8_to_locale_dup (   buf)    ekg_recode_to_locale_dup(EKG_RECODE_UTF8, buf)
#define ekg_utf8_to_locale_use (   buf)    ekg_recode_to_locale_use(EKG_RECODE_UTF8, buf)
#define recode_xfree (   org,
  ret 
)    do { if (org != ret) xfree((char *) ret); } while(0);

Dokumentacja typów wyliczanych

Wartości wyliczeń:
EKG_RECODE_CP 
EKG_RECODE_ISO2 
EKG_RECODE_UTF8 

Dokumentacja funkcji

void changed_console_charset ( const char *  name)
char* ekg_convert_string ( const char *  ps,
const char *  from,
const char *  to 
)

ekg_convert_string()

Converts string to specified encoding, replacing invalid chars with question marks.

Nota:
Deprecated, in favour of ekg_convert_string_p(). Should be used only on single conversions, where charset pair won't be used again.
Parametry:
ps- string to be converted (it won't be freed).
from- input encoding (if NULL, console_charset will be assumed).
to- output encoding (if NULL, console_charset will be assumed).
Zwraca:
Pointer to allocated result on success, NULL on failure or when both encodings are equal.
Zobacz również:
ekg_convert_string_p() - more optimized version.
void ekg_convert_string_destroy ( void *  ptr)

ekg_convert_string_destroy()

Frees internal data associated with given pointer, and uninitalizes iconv, if it's not needed anymore.

Nota:
If 'rev' param was used with ekg_convert_string_init(), this functions must be called two times
  • with returned value, and with rev-associated one.
Parametry:
ptr- pointer returned by ekg_convert_string_init().
Zobacz również:
ekg_convert_string_init() - init charset conversion.
ekg_convert_string_p() - main charset conversion function.
void* ekg_convert_string_init ( const char *  from,
const char *  to,
void **  rev 
)

ekg_convert_string_init()

Initialize string conversion thing for two given charsets.

Parametry:
from- input encoding (will be duped; if NULL, console_charset will be assumed).
to- output encoding (will be duped; if NULL, console_charset will be assumed).
rev- pointer to assign reverse conversion into; if NULL, no reverse converter will be initialized.
Zwraca:
Pointer that should be passed to other ekg_convert_string_*(), even if it's NULL.
Zobacz również:
ekg_convert_string_destroy() - deinits charset conversion.
ekg_convert_string_p() - main charset conversion function.
char* ekg_convert_string_p ( const char *  ps,
void *  ptr 
)

ekg_convert_string_p()

Converts string to specified encoding, using pointer returned by ekg_convert_string_init(). Invalid characters in input will be replaced with question marks.

Parametry:
ps- string to be converted (won't be freed).
ptr- pointer returned by ekg_convert_string_init().
Zwraca:
Pointer to allocated result or NULL, if some failure has occured or no conversion is needed (i.e. resulting string would be same as input).
Zobacz również:
ekg_convert_string_init() - init charset conversion.
ekg_convert_string_destroy() - deinits charset conversion.
string_t ekg_convert_string_t ( string_t  s,
const char *  from,
const char *  to 
)
string_t ekg_convert_string_t_p ( string_t  s,
void *  ptr 
)
int ekg_converters_display ( int  quiet)
void ekg_recode_dec_ref ( enum ekg_recode_name  enc)
char* ekg_recode_from_locale ( enum ekg_recode_name  enc,
char *  buf 
)
char* ekg_recode_from_locale_dup ( enum ekg_recode_name  enc,
const char *  buf 
)
const char* ekg_recode_from_locale_use ( enum ekg_recode_name  enc,
const char *  buf 
)
void ekg_recode_inc_ref ( enum ekg_recode_name  enc)
char* ekg_recode_to_locale ( enum ekg_recode_name  enc,
char *  buf 
)
char* ekg_recode_to_locale_dup ( enum ekg_recode_name  enc,
const char *  buf 
)
const char* ekg_recode_to_locale_use ( enum ekg_recode_name  enc,
const char *  buf 
)
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje