Auxiliary functions

Auxiliary functions — Variouis auxiliary functions and informations about libenca.

Synopsis

int                 enca_charset_has_ucs2_map           (int charset);
int                 enca_charset_ucs2_map               (int charset,
                                                         unsigned int *buffer);
size_t              enca_number_of_charsets             (void);
const char*         enca_analyser_language              (EncaAnalyser analyser);
const char**        enca_get_languages                  (size_t *n);
const char*         enca_language_english_name          (const char *lang);
int*                enca_get_language_charsets          (const char *langname,
                                                         size_t *n);

Description

Details

enca_charset_has_ucs2_map ()

int                 enca_charset_has_ucs2_map           (int charset);

Find whether we have charset -> UCS-2 map.

charset :

An 8bit charset.

Returns :

Nonzero when the map is available, zero otherwise.

enca_charset_ucs2_map ()

int                 enca_charset_ucs2_map               (int charset,
                                                         unsigned int *buffer);

Creates map from an 8bit charset to UCS-2.

The buffer must be at least 256*sizeof(unsigned int) long to hold the map.

charset :

An 8bit charset.

buffer :

Buffer to store the map to.

Returns :

Nonzero when the map was successfully created, zero otherwise.

enca_number_of_charsets ()

size_t              enca_number_of_charsets             (void);

Returns number of known charsets.

Charsets idetifiers are assigned successively starting from zero, so last charset has identifier enca_number_of_charsets() - 1.

Returns :

The number of charsets.

enca_analyser_language ()

const char*         enca_analyser_language              (EncaAnalyser analyser);

Returns name of language which was analyser initialized for.

The returned string must be considered constant and must NOT be freed.

analyser :

An analyser.

Returns :

The language name.

enca_get_languages ()

const char**        enca_get_languages                  (size_t *n);

Returns list of known languages.

The returned strings are two-letter ISO-639 language codes, the same as enca_analyser_alloc() accepts.

The list of languages has to be freed by caller; the strings themselves must be considered constant and must NOT be freed.

n :

The number of languages will be stored here.

Returns :

The list of languages, storing their number into *n.

enca_language_english_name ()

const char*         enca_language_english_name          (const char *lang);

Returns an English name of a language given its ISO-639 code.

The returned string must be considered constant and must NOT be freed.

lang :

A two-letter language code, such as obtained from enca_analyser_language() or enca_get_languages().

Returns :

The English language name.

enca_get_language_charsets ()

int*                enca_get_language_charsets          (const char *langname,
                                                         size_t *n);

Returns list of identifiers of charsets supported for language language.

The list of charset identifiers has to be freed by caller.

langname :

Two-letter ISO-639 language code.

n :

The number of charsets will be stored here.

Returns :

The list of charsets, storing their number into *n. When language contains no charsets or langname is invalid, NULL is returned and zero stored into *n.