LibRCC
|
#include <stdlib.h>
Go to the source code of this file.
#define RCC_CC_FLAG_HAVE_BERKLEY_DB 0x01 |
The Berkley DB support is compiled in
#define RCC_CC_FLAG_HAVE_DYNAMIC_ENGINES 0x02 |
The dynamic engine plugins support is compiled in
#define RCC_CC_FLAG_HAVE_ENCA 0x04 |
Enca engine is compiled in
#define RCC_CC_FLAG_HAVE_LIBTRANSLATE 0x10 |
Libtranslate translation engine compiled in
#define RCC_CC_FLAG_HAVE_RCD 0x08 |
LibRCD engine is compiled in
#define RCC_CLASS_FLAG_CONST 0x01 |
Forbid change class value using Library API
#define RCC_CLASS_FLAG_SKIP_SAVELOAD 0x02 |
Forbid saving and loading of class value
#define RCC_FLAG_NO_DEFAULT_CONFIGURATION 1 |
Do not load default language configuration
#define RCC_MAX_ALIASES 64 |
#define RCC_MAX_CHARSETS 16 |
#define RCC_MAX_CLASSES 16 |
#define RCC_MAX_ENGINES 5 |
#define RCC_MAX_LANGUAGES 64 |
#define RCC_OPTION_LEARNING_FLAG_LEARN 2 |
Cache recodings in BerkeleyDB recoding cache for future use
Referenced by main().
#define RCC_OPTION_LEARNING_FLAG_USE 1 |
Use BerkeleyDB recodings cache for encoding detection
Referenced by main().
#define RCC_OPTION_TRANSLATE_SKIP_PARRENT RCC_OPTION_TRANSLATE_SKIP_PARENT |
For compatibilty reasons
Referenced by main().
#define RCC_SPELLER_ALMOST_PARRENT RCC_SPELLER_ALMOST_PARENT |
#define RCC_SPELLER_PARRENT RCC_SPELLER_PARENT |
#define rccConfigFrom | ( | ctx, | |
class_id, | |||
buf | |||
) | rccConfigSizedFrom(ctx, class_id, buf, 0) |
#define rccConfigRecode | ( | ctx, | |
from, | |||
to, | |||
buf | |||
) | rccConfigSizedRecode(ctx, from, to, buf, 0, NULL) |
#define rccConfigRecodeFromCharset | ( | ctx, | |
class_id, | |||
charset, | |||
buf | |||
) | rccConfigSizedRecodeFromCharset(ctx, class_id, charset, buf, 0, NULL) |
#define rccConfigRecodeToCharset | ( | ctx, | |
class_id, | |||
charset, | |||
buf | |||
) | rccConfigSizedRecodeToCharset(ctx, class_id, charset, buf, 0, NULL) |
#define rccConfigTo | ( | ctx, | |
class_id, | |||
buf | |||
) | rccConfigSizedTo(ctx, class_id, buf, NULL) |
#define rccFrom | ( | ctx, | |
class_id, | |||
buf | |||
) | rccSizedFrom(ctx, class_id, buf, 0) |
Referenced by main(), and Translate().
#define rccFromCharset | ( | ctx, | |
charset, | |||
buf | |||
) | rccSizedFromCharset(ctx, charset, buf, 0) |
Referenced by Translate().
#define rccRecode | ( | ctx, | |
from, | |||
to, | |||
buf | |||
) | rccSizedRecode(ctx, from, to, buf, 0, NULL) |
Referenced by main().
#define rccRecodeCharsets | ( | ctx, | |
from, | |||
to, | |||
buf | |||
) | rccSizedRecodeCharsets(ctx, from, to, buf, 0, NULL) |
Referenced by Translate().
#define rccRecodeFromCharset | ( | ctx, | |
class_id, | |||
charset, | |||
buf | |||
) | rccSizedRecodeFromCharset(ctx, class_id, charset, buf, 0, NULL) |
#define rccRecodeToCharset | ( | ctx, | |
class_id, | |||
charset, | |||
buf | |||
) | rccSizedRecodeToCharset(ctx, class_id, charset, buf, 0, NULL) |
#define rccSpellerAddParrent rccSpellerAddParent |
#define rccTo | ( | ctx, | |
class_id, | |||
buf | |||
) | rccSizedTo(ctx, class_id, buf, NULL) |
Referenced by main(), and Translate().
#define rccToCharset | ( | ctx, | |
charset, | |||
buf | |||
) | rccSizedToCharset(ctx, charset, buf, NULL) |
Referenced by Translate().
typedef unsigned char rcc_alias_id |
Alias ID
typedef unsigned char rcc_autocharset_id |
Autocharset ID.
typedef const char* rcc_charset |
Encoding name.
typedef unsigned char rcc_charset_id |
Charset ID.
typedef rcc_charset rcc_charset_list[RCC_MAX_CHARSETS+1] |
List of Encoding names
typedef struct rcc_class_t rcc_class |
typedef struct rcc_class_default_charset_t rcc_class_default_charset |
typedef int rcc_class_id |
Class ID.
typedef rcc_class_ptr rcc_class_list[RCC_MAX_CLASSES+1] |
typedef struct rcc_class_t* rcc_class_ptr |
typedef enum rcc_class_type_t rcc_class_type |
Enumeration represents type of class.
typedef struct rcc_compiled_configuration_t* rcc_compiled_configuration |
typedef struct rcc_compiled_configuration_t rcc_compiled_configuration_s |
typedef void* rcc_config |
typedef const char* rcc_const_string |
Intermediate string format. RCC_string can be manipulated as standard NULL terminated string. However it contains small header with information about string language. All strings are encoded using UTF-8 encoding.
typedef struct rcc_context_t* rcc_context |
Current Working Context
typedef unsigned int rcc_db4_flags |
Berkeley DB initialization flags
typedef struct rcc_engine_t rcc_engine |
typedef struct rcc_engine_context_t* rcc_engine_context |
Encoding Detection Engine Context. Containes considered information about engine, which can be extracted using API functions.
typedef void(* rcc_engine_free_function)(rcc_engine_context ctx) |
Engine destructor function
typedef rcc_autocharset_id(* rcc_engine_function)(rcc_engine_context ctx, const char *buf, int len) |
Engine encoding detection function.
ctx | is engine context |
buf | is string encoded in unknow encoding |
len | is exact size of string or 0 (size will be detected with strlen) |
typedef unsigned char rcc_engine_id |
Engine ID.
typedef rcc_engine_internal(* rcc_engine_init_function)(rcc_engine_context ctx) |
Engine constructor function
ctx | is engine context |
typedef void* rcc_engine_internal |
Engine internal data
typedef rcc_engine_ptr rcc_engine_list[RCC_MAX_ENGINES+1] |
typedef rcc_engine* rcc_engine_ptr |
typedef struct rcc_iconv_t* rcc_iconv |
recoding context
typedef unsigned int rcc_init_flags |
RCC context initialization flags
typedef struct rcc_language_t rcc_language |
typedef struct rcc_language_alias_t rcc_language_alias |
typedef rcc_language_alias_ptr rcc_language_alias_list[RCC_MAX_ALIASES+1] |
typedef rcc_language_alias* rcc_language_alias_ptr |
typedef struct rcc_language_config_t* rcc_language_config |
Current Language Configuration: Information about current 'class encodings', and selected 'Encoding Detection Engine'
typedef unsigned char rcc_language_id |
Language ID.
typedef rcc_language_ptr rcc_language_list[RCC_MAX_LANGUAGES+1] |
typedef rcc_language* rcc_language_ptr |
typedef struct rcc_language_relation_t rcc_language_relation |
typedef enum rcc_option_t rcc_option |
List of options available
typedef struct rcc_option_range_t rcc_option_range |
Descriptionm of value range
typedef enum rcc_option_range_type_t rcc_option_range_type |
Description of option values range type
typedef enum rcc_option_translate_t rcc_option_translate |
typedef enum rcc_option_type_t rcc_option_type |
List of option types
typedef int rcc_option_value |
typedef rcc_engine*(* rcc_plugin_engine_info_function)(const char *lang) |
typedef unsigned char rcc_relation_id |
Relation ID
typedef struct rcc_speller_t* rcc_speller |
spelling context
typedef enum rcc_speller_result_t rcc_speller_result |
result of spelling
typedef char* rcc_string |
Intermediate string format. RCC_string can be manipulated as standard NULL terminated string. However it contains small header with information about string language. All strings are encoded using UTF-8 encoding.
typedef struct rcc_translate_t* rcc_translate |
translating context
enum rcc_class_type_t |
Enumeration represents type of class.
Description of option values range type
enum rcc_option_t |
List of options available
RCC_OPTION_LEARNING_MODE |
Recoding Caching mode (OFF/ON/RELEARN/LEARN) |
RCC_OPTION_AUTODETECT_FS_TITLES |
Detect titles of RCC_CLASS_FS classes |
RCC_OPTION_AUTODETECT_FS_NAMES |
Try to find encoding of RCC_CLASS_FS by accessing fs |
RCC_OPTION_CONFIGURED_LANGUAGES_ONLY |
Use only configured languages or languages with auto-engines |
RCC_OPTION_AUTOENGINE_SET_CURRENT |
If enabled autodetection engine will set current charset |
RCC_OPTION_AUTODETECT_LANGUAGE |
Enables language detection |
RCC_OPTION_TRANSLATE |
Translate rcc_string if it's language differs from current one |
RCC_OPTION_TIMEOUT |
Recoding timeout. Currently it is only used to limit translation time |
RCC_OPTION_OFFLINE |
Allows external module to finish it's job in offline after the main program is terminated |
RCC_MAX_OPTIONS | |
RCC_OPTION_ALL |
{ RCC_OPTION_LEARNING_MODE = 0, RCC_OPTION_AUTODETECT_FS_TITLES, RCC_OPTION_AUTODETECT_FS_NAMES, RCC_OPTION_CONFIGURED_LANGUAGES_ONLY, RCC_OPTION_AUTOENGINE_SET_CURRENT, RCC_OPTION_AUTODETECT_LANGUAGE, RCC_OPTION_TRANSLATE, RCC_OPTION_TIMEOUT, RCC_OPTION_OFFLINE, RCC_MAX_OPTIONS, RCC_OPTION_ALL } rcc_option;
enum rcc_option_type_t |
List of option types
enum rcc_speller_result_t |
result of spelling
rcc_language_config rccCheckConfig | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
Check if configuration is initialized for supplied language.
ctx | is working context ( or default one if NULL supplied ) |
language_id | is concerned language id |
rcc_autocharset_id rccConfigDetectCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | buf, | ||
size_t | len | ||
) |
Tries to detect charset of string
config | is language configuration |
class_id | is encoding class |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rcc_charset_id rccConfigGetCharsetByName | ( | rcc_language_config | config, |
const char * | name | ||
) |
Function finds encoding id by the supplied name.
config | is language configuration |
name | is encoding name |
const char* rccConfigGetCharsetName | ( | rcc_language_config | config, |
rcc_charset_id | charset_id | ||
) |
Return supplied encoding name
config | is language configuration |
charset_id | is desired charset |
int rccConfigGetCharsetNumber | ( | rcc_language_config | config | ) |
Return number of configured charsets
config | is language configuration |
rcc_charset_id rccConfigGetClassCharsetByName | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | name | ||
) |
Function finds encoding id by the supplied name.
config | is language configuration |
class_id | is encoding class |
name | is encoding name |
const char* rccConfigGetClassCharsetName | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
rcc_charset_id | charset_id | ||
) |
Return supplied encoding name
config | is language configuration |
class_id | is charset encodings |
charset_id | is desired charset |
int rccConfigGetClassCharsetNumber | ( | rcc_language_config | config, |
rcc_class_id | class_id | ||
) |
Return number of configured charsets
config | is language configuration |
class_id | is class id. |
rcc_charset_id rccConfigGetCurrentCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id | ||
) |
Return current encoding_id. The default value will be resolved to paticular encoding id. The following procedure is used to detect default encoding:
config | is language configuration |
class_id | is encoding class |
const char* rccConfigGetCurrentCharsetName | ( | rcc_language_config | config, |
rcc_class_id | class_id | ||
) |
Return current encoding name.
config | is language configuration |
class_id | is encoding class |
rcc_engine_id rccConfigGetCurrentEngine | ( | rcc_language_config | config | ) |
Return current engine_id. The default value will be resolved to paticular engine id. Normally, the id of the first available engine will be returned. If no engines registered for supplied language the 0 will be returned, indicating id of dummy(disabled) engine.
config | is language configuration |
const char* rccConfigGetCurrentEngineName | ( | rcc_language_config | config | ) |
Return current engine name.
config | is language configuration |
rcc_engine_id rccConfigGetEngineByName | ( | rcc_language_config | config, |
const char * | name | ||
) |
Function finds engine id by the supplied name.
config | is language configuration |
name | is engine name |
const char* rccConfigGetEngineName | ( | rcc_language_config | config, |
rcc_engine_id | engine_id | ||
) |
Return supplied engine name
config | is language configuration |
engine_id | is desired engine |
int rccConfigGetEngineNumber | ( | rcc_language_config | config | ) |
Return number of configured encoding auto-detection engines
config | is language configuration |
rcc_language_id rccConfigGetLanguage | ( | rcc_language_config | config | ) |
Return language associated with supplied configuration.
config | is language configuration |
const char* rccConfigGetLanguageName | ( | rcc_language_config | config | ) |
Return name of the language associated with supplied configuration.
config | is language configuration |
rcc_charset_id rccConfigGetLocaleCharset | ( | rcc_language_config | config, |
const char * | locale_variable | ||
) |
Function will return encoding id of charset specified by locale configuration.
config | is language configuration |
locale_variable | is locale variable (Default(NULL) is LC_CTYPE) |
rcc_charset_id rccConfigGetLocaleClassCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | locale_variable | ||
) |
Function will return encoding id of charset specified by locale configuration.
config | is language configuration |
class_id | is encoding class |
locale_variable | is locale variable (Default(NULL) is LC_CTYPE) |
rcc_charset_id rccConfigGetSelectedCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id | ||
) |
Return selected encoding id.
config | is language configuration |
class_id | is encoding class |
const char* rccConfigGetSelectedCharsetName | ( | rcc_language_config | config, |
rcc_class_id | class_id | ||
) |
Return selected encoding name.
config | is language configuration |
class_id | is charset encodings |
rcc_engine_id rccConfigGetSelectedEngine | ( | rcc_language_config | config | ) |
Return selected engin id.
config | is language configuration |
const char* rccConfigGetSelectedEngineName | ( | rcc_language_config | config | ) |
Return selected engine name.
config | is language configuration |
int rccConfigIsDisabledCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
rcc_charset_id | charset_id | ||
) |
Checks if charset is disabled for the specified class.
config | is language configuration |
class_id | is class id. |
charset_id | is charset id. |
int rccConfigSetCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
rcc_charset_id | charset_id | ||
) |
Set current encoding.
config | is language configuration |
class_id | is encoding class |
charset_id | is new charset id [0-n]. The 0 will switch charset to encoding state. |
int rccConfigSetCharsetByName | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | name | ||
) |
Set current encoding by name.
config | is language configuration |
class_id | is encoding class |
name | is the short name of new encoding ("default" is okey). |
int rccConfigSetEngine | ( | rcc_language_config | config, |
rcc_engine_id | engine_id | ||
) |
Set current engine.
config | is language configuration |
engine_id | is new language id [-1-n]. If -1 supplied the engine will go in non-configured state. |
int rccConfigSetEngineByName | ( | rcc_language_config | config, |
const char * | name | ||
) |
Set current engine by name.
config | is language configuration |
name | is the short name of new engine ("default" is okey). |
rcc_string rccConfigSizedFrom | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | buf, | ||
size_t | len | ||
) |
Recode string from specified encoding class to rcc_string. Encoding detection engines and recoding cache are used (if possible) to detect original 'buf' encoding. Otherwise the preconfigured encoding of class is assumed.
config | is language configuration |
class_id | is encoding class |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
char* rccConfigSizedRecode | ( | rcc_language_config | config, |
rcc_class_id | from, | ||
rcc_class_id | to, | ||
const char * | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string between different encoding classes. The conversion is relays on rccConfigSizedFrom and rccConfigSizedTo functions.
config | is language configuration |
from | is source encoding class |
to | is destination encoding class |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
rcc_string rccConfigSizedRecodeFromCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | charset, | ||
const char * | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string from specified encoding to rcc_string.
config | is language configuration |
class_id | is encoding class |
charset | is source encoding |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
char* rccConfigSizedRecodeToCharset | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
const char * | charset, | ||
rcc_const_string | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string from rcc_string to specified encoding.
config | is language configuration |
class_id | is encoding class |
charset | is destination encoding |
buf | is original zero terminated string |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
char* rccConfigSizedTo | ( | rcc_language_config | config, |
rcc_class_id | class_id, | ||
rcc_const_string | buf, | ||
size_t * | rlen | ||
) |
Recode string from rcc_string to specified encoding class. If encoding class is of 'File System' type, the autoprobing for file names can be performed. In the other cases the rcc_string will be recoded in preconfigured class encoding.
config | is language configuration |
class_id | is encoding class |
buf | is original zero terminated string |
rlen | in rlen the size of recoded string will be returned. |
rcc_context rccCreateContext | ( | const char * | locale_variable, |
unsigned int | max_languages, | ||
unsigned int | max_classes, | ||
rcc_class_ptr | defclasses, | ||
rcc_init_flags | flags | ||
) |
Initialize working context.
locale_variable | is variable to get locale from (Default: LC_CTYPE). |
max_languages | is maximal number of languages supported by context. (Default: detect) |
max_classes | is maximal number of classes (Default: detect) |
defclasses | is list of encoding classes (Default: will add later) |
flags | is option flag (Default: nothing) |
Referenced by main().
rcc_autocharset_id rccDetectCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | buf, | ||
size_t | len | ||
) |
rcc_language_id rccDetectLanguage | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | buf, | ||
size_t | len | ||
) |
Tries to detect language of string
ctx | is working context ( or default one if NULL supplied ) |
class_id | is encoding class |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rcc_autocharset_id rccEngineGetAutoCharsetByName | ( | rcc_engine_context | ctx, |
const char * | name | ||
) |
rcc_engine* rccEngineGetInfo | ( | rcc_engine_context | ctx | ) |
rcc_engine_internal rccEngineGetInternal | ( | rcc_engine_context | ctx | ) |
rcc_language* rccEngineGetLanguage | ( | rcc_engine_context | ctx | ) |
rcc_context rccEngineGetRccContext | ( | rcc_engine_context | ctx | ) |
void rccFree | ( | ) |
Library Cleanup function.
Referenced by main().
void rccFreeContext | ( | rcc_context | ctx | ) |
Free all memory used by working context and destroy it.
ctx | is working context to be destroyed. |
Referenced by main().
char* rccFS | ( | rcc_context | ctx, |
rcc_class_id | from, | ||
rcc_class_id | to, | ||
const char * | fspath, | ||
const char * | path, | ||
const char * | filename | ||
) |
Recode file name between different encoding classes. Normally, should be used to convert string from the file list to real file system names. The autoprobing of names is enabled depending on the output encoding class configuration and current options.
The conversion is partly relays on rccSizedFrom.
ctx | is working context ( or default one if NULL supplied ) |
from | is source encoding class |
to | is destination encoding class |
fspath | is path to the filesystem where file are located. |
path | is file path |
filename | is file name |
rcc_charset_id rccGetCharsetByName | ( | rcc_context | ctx, |
const char * | name | ||
) |
const char* rccGetCharsetName | ( | rcc_context | ctx, |
rcc_charset_id | charset_id | ||
) |
int rccGetCharsetNumber | ( | rcc_context | ctx | ) |
rcc_charset_id rccGetClassCharsetByName | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | name | ||
) |
const char* rccGetClassCharsetName | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
rcc_charset_id | charset_id | ||
) |
int rccGetClassCharsetNumber | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
const char* rccGetClassFullName | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
Returns full name of supplied class.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is class id |
const char* rccGetClassName | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
Returns name of supplied class.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is class id |
int rccGetClassNumber | ( | rcc_context | ctx | ) |
Return number of configured classes
ctx | is working context ( or default one if NULL supplied ) |
rcc_class_type rccGetClassType | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
Determines 'class type' of supplied class.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is class id |
rcc_compiled_configuration rccGetCompiledConfiguration | ( | ) |
Get information about library compilation environment
rcc_language_config rccGetConfig | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
Initializes language configuration if not yet configured and returns pointer on that configuration. If default language is supplied (language_id = 0), the language id will be resolved to particular language and config of that language will be returned.
ctx | is working context ( or default one if NULL supplied ) |
language_id | is concerned language id |
rcc_language_config rccGetConfigByName | ( | rcc_context | ctx, |
const char * | name | ||
) |
Initializes language configuration if not yet configured and returns pointer on that configuration.
ctx | is working context ( or default one if NULL supplied ) |
name | is concerned language name |
rcc_config rccGetConfiguration | ( | ) |
rcc_charset_id rccGetCurrentCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
const char* rccGetCurrentCharsetName | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
rcc_language_config rccGetCurrentConfig | ( | rcc_context | ctx | ) |
Returns pointer on the current language configuration (Initializes it as well if required)
ctx | is working context ( or default one if NULL supplied ) |
rcc_engine_id rccGetCurrentEngine | ( | rcc_context | ctx | ) |
const char* rccGetCurrentEngineName | ( | rcc_context | ctx | ) |
rcc_language_id rccGetCurrentLanguage | ( | rcc_context | ctx | ) |
Return current language id, resolving default language to particular one if necessary. See more details how default language is resolved:
ctx | is working context ( or default one if NULL supplied ) |
Referenced by main().
const char* rccGetCurrentLanguageName | ( | rcc_context | ctx | ) |
Return current language name. #
ctx | is working context ( or default one if NULL supplied ) |
Referenced by main().
rcc_engine_id rccGetEngineByName | ( | rcc_context | ctx, |
const char * | name | ||
) |
const char* rccGetEngineName | ( | rcc_context | ctx, |
rcc_engine_id | engine_id | ||
) |
int rccGetEngineNumber | ( | rcc_context | ctx | ) |
rcc_language_id rccGetLanguageByName | ( | rcc_context | ctx, |
const char * | name | ||
) |
Finds language id by the supplied name.
ctx | is working context ( or default one if NULL supplied ) |
name | is language name |
Referenced by main().
const char* rccGetLanguageName | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
Determines name of the supplied language.
ctx | is working context ( or default one if NULL supplied ) |
language_id | is 'language id' of desired language. For default language the 'default' value will be returned. |
Referenced by main().
int rccGetLanguageNumber | ( | rcc_context | ctx | ) |
Return number of configured languages
ctx | is working context ( or default one if NULL supplied ) |
rcc_charset_id rccGetLocaleCharset | ( | rcc_context | ctx, |
const char * | locale_variable | ||
) |
rcc_charset_id rccGetLocaleClassCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | locale_variable | ||
) |
rcc_option_value rccGetOption | ( | rcc_context | ctx, |
rcc_option | option | ||
) |
Return option value.
ctx | is working context ( or default one if NULL supplied ) |
option | is option |
rcc_option rccGetOptionByName | ( | const char * | name | ) |
Get option by short name.
name | is option name |
const char* rccGetOptionName | ( | rcc_option | option | ) |
Get short name of supplied option.
option | is option |
rcc_option_value rccGetOptionValueByName | ( | rcc_option | option, |
const char * | name | ||
) |
Get option value by short name.
option | is option |
name | is value name |
const char* rccGetOptionValueName | ( | rcc_option | option, |
rcc_option_value | value | ||
) |
Get short name of supplied option value.
option | is option |
value | is value of #option |
rcc_language_id rccGetRealLanguage | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
This function resolves default languages. If positive language id is supplied it will be returned back unchanged. The default language (0 is supplied as language id) will be resolved to some particular language. The following procedure will be used:
ctx | is working context ( or default one if NULL supplied ) |
language_id | is language id |
const char* rccGetRealLanguageName | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
Return considered language name, resolving default language if necessary.
ctx | is working context ( or default one if NULL supplied ) |
language_id | is language id |
rcc_charset_id rccGetSelectedCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
const char* rccGetSelectedCharsetName | ( | rcc_context | ctx, |
rcc_class_id | class_id | ||
) |
rcc_engine_id rccGetSelectedEngine | ( | rcc_context | ctx | ) |
const char* rccGetSelectedEngineName | ( | rcc_context | ctx | ) |
rcc_language_id rccGetSelectedLanguage | ( | rcc_context | ctx | ) |
Return selected language id.
ctx | is working context ( or default one if NULL supplied ) |
const char* rccGetSelectedLanguageName | ( | rcc_context | ctx | ) |
Return selected language name.
ctx | is working context ( or default one if NULL supplied ) |
const char* rccGetString | ( | const char * | str | ) |
If str is rcc_string function will return pointer on UTF-8 string kept inside, otherwise pointer on the passed string is returned.
str | is null-terminated string |
rcc_language_config rccGetUsableConfig | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
Checks if supplied language is usable. The usability of language is determined regarding RCC_OPTION_CONFIGURED_LANGUAGES_ONLY option. Depending on that option there are several possibilities for language usability: Any non-dummy language is usable Any configured or AutoEngine enabled language is usable Only configured languages are usable
Language configuration is initialized if not yet configured. And pointer on that configuration is returned. If default language is supplied (language_id = 0), the language id will be resolved to particular language and config of that language will be returned.
ctx | is working context ( or default one if NULL supplied ) |
language_id | is concerned language id |
char* rccIConv | ( | rcc_iconv | icnv, |
const char * | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recodes chunk of data.
icnv | is recoding context |
buf | is data for recoding |
len | is size of the data |
rlen | is size of recoded data |
void rccIConvClose | ( | rcc_iconv | icnv | ) |
Close recoding context.
icnv | is recoding context |
rcc_iconv rccIConvOpen | ( | const char * | from, |
const char * | to | ||
) |
Open recoding context.
from | is source encoding |
to | is destination encoding |
int rccInit | ( | ) |
Library Initialization function. Should be called prior to all any library manipulation.
Referenced by main().
int rccInitDb4 | ( | rcc_context | ctx, |
const char * | name, | ||
rcc_db4_flags | flags | ||
) |
Enables Berkeley DB recodings caching for specified working context.
ctx | is working context |
name | is database name (can be shared between different applications) |
flags | are reserved for future. |
Referenced by main().
int rccInitDefaultContext | ( | const char * | locale_variable, |
unsigned int | max_languages, | ||
unsigned int | max_classes, | ||
rcc_class_ptr | defclasses, | ||
rcc_init_flags | flags | ||
) |
Initialize default working context (used then no context supplied). Previously opened default context will be freed.
locale_variable | is variable to get locale from (Default: LC_CTYPE). |
max_languages | is maximal number of languages supported by context. (Default: detect) |
max_classes | is maximal number of classes (Default: detect) |
defclasses | is list of encoding classes (Default: will add later) |
flags | is option flag (Default: nothing) |
Referenced by main().
int rccIsDisabledCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
rcc_charset_id | charset_id | ||
) |
int rccIsDisabledCharsetName | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | charset | ||
) |
Checks if charset is disabled for the specified class.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is class id. |
charset | is charset name. |
rcc_charset_id rccLanguageRegisterCharset | ( | rcc_language * | language, |
rcc_charset | charset | ||
) |
Register new encoding belonging to language in supplied working context
language | is language charset should be added to ( or default one if NULL supplied ) |
charset | is pointer on charset name (shouldn't be freed before library deinitialization). |
rcc_engine_id rccLanguageRegisterEngine | ( | rcc_language * | language, |
rcc_engine * | engine | ||
) |
Register new Engine in supplied working context
language | is language charset should be added to ( or default one if NULL supplied ) |
engine | is pointer on engine description (shouldn't be freed before library deinitialization). |
int rccLoad | ( | rcc_context | ctx, |
const char * | name | ||
) |
Load Configuration.
ctx | is working context ( or default one if NULL supplied ) |
name | is configuration file name ( can be shared between multiple applications! ) |
Referenced by main().
int rccLocaleGetCharset | ( | char * | result, |
const char * | lv, | ||
unsigned int | n | ||
) |
int rccLocaleGetClassByName | ( | const char * | locale | ) |
int rccLocaleGetLanguage | ( | char * | result, |
const char * | lv, | ||
unsigned int | n | ||
) |
int rccLockConfiguration | ( | rcc_context | ctx, |
unsigned int | lock_code | ||
) |
rcc_option_range* rccOptionGetRange | ( | rcc_context | ctx, |
rcc_option | option | ||
) |
Return range description for specified option
ctx | is working context ( or default one if NULL supplied ) |
option | is option |
rcc_option_type rccOptionGetType | ( | rcc_context | ctx, |
rcc_option | option | ||
) |
Get current option type.
ctx | is working context ( or default one if NULL supplied ) |
option | is option |
int rccOptionIsDefault | ( | rcc_context | ctx, |
rcc_option | option | ||
) |
Tests if option have unchanged default value.
ctx | is working context ( or default one if NULL supplied ) |
option | is option |
int rccOptionSetDefault | ( | rcc_context | ctx, |
rcc_option | option | ||
) |
Sets option to its default value.
ctx | is working context ( or default one if NULL supplied ) |
option | is option |
int rccRegisterAdditionalCharsets | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
rcc_charset * | charsets | ||
) |
Register additional charsets for the current class.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is class id. |
charsets | is NULL terminated list of classes. |
rcc_class_id rccRegisterClass | ( | rcc_context | ctx, |
rcc_class * | cl | ||
) |
Register additional class
ctx | is working context ( or default one if NULL supplied ) |
cl | is pointer on the class description (shouldn't be freed before library deinitialization). |
int rccRegisterDisabledCharsets | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
rcc_charset * | charsets | ||
) |
Register names of charsets disabled in the specified class.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is class id. |
charsets | is NULL terminated list of classes ("unicode" / "nonunicode" specifies corespondent group of charsets). |
rcc_language_id rccRegisterLanguage | ( | rcc_context | ctx, |
rcc_language * | language | ||
) |
Register new language in supplied working context
ctx | is working context ( or default one if NULL supplied ) |
language | is pointer on language description (shouldn't be freed before library deinitialization). |
rcc_alias_id rccRegisterLanguageAlias | ( | rcc_context | ctx, |
rcc_language_alias * | alias | ||
) |
Register new language alias in supplied working context
ctx | is working context ( or default one if NULL supplied ) |
alias | is pointer on alias description (shouldn't be freed before library deinitialization). |
rcc_relation_id rccRegisterLanguageRelation | ( | rcc_context | ctx, |
rcc_language_relation * | relation | ||
) |
Register new language relation in supplied working context
ctx | is working context ( or default one if NULL supplied ) |
relation | is pointer on relation description (shouldn't be freed before library deinitialization). |
int rccSave | ( | rcc_context | ctx, |
const char * | name | ||
) |
Save Configuration.
ctx | is working context ( or default one if NULL supplied ) |
name | is configuration file name ( can be shared between multiple applications! ) |
int rccSetCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
rcc_charset_id | charset_id | ||
) |
int rccSetCharsetByName | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | name | ||
) |
int rccSetEngine | ( | rcc_context | ctx, |
rcc_engine_id | engine_id | ||
) |
int rccSetEngineByName | ( | rcc_context | ctx, |
const char * | name | ||
) |
int rccSetLanguage | ( | rcc_context | ctx, |
rcc_language_id | language_id | ||
) |
Set current language.
ctx | is working context ( or default one if NULL supplied ) |
language_id | is new language id [0-n]. Set to default state is Ok. |
Referenced by main(), and Translate().
int rccSetLanguageByName | ( | rcc_context | ctx, |
const char * | name | ||
) |
Set current language by name.
ctx | is working context ( or default one if NULL supplied ) |
name | is the short name of new language. |
Referenced by main().
int rccSetOption | ( | rcc_context | ctx, |
rcc_option | option, | ||
rcc_option_value | value | ||
) |
Set option value.
ctx | is working context ( or default one if NULL supplied ) |
option | is option |
value | is option value |
Referenced by main().
rcc_string rccSizedFrom | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | buf, | ||
size_t | len | ||
) |
Recode string from specified encoding class to rcc_string. Encoding detection engines and recoding cache are used (if possible) to detect original 'buf' encoding. Otherwise the preconfigured encoding of class is assumed.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is encoding class |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rcc_string rccSizedFromCharset | ( | rcc_context | ctx, |
const char * | charset, | ||
const char * | buf, | ||
size_t | len | ||
) |
Recode string from specified encoding to rcc_string.
ctx | is working context ( or default one if NULL supplied ) |
charset | is source encoding |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
const char* rccSizedGetString | ( | const char * | str, |
size_t | len | ||
) |
If str is rcc_string function will return pointer on UTF-8 string kept inside, otherwise pointer on the passed string is returned.
str | is string (perhaps not zero terminated) |
len | is exact length of string or 0 (in this case length will be computed using 'strlen' |
char* rccSizedRecode | ( | rcc_context | ctx, |
rcc_class_id | from, | ||
rcc_class_id | to, | ||
const char * | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string between different encoding classes. The conversion is relays on rccSizedFrom and rccSizedTo functions.
ctx | is working context ( or default one if NULL supplied ) |
from | is source encoding class |
to | is destination encoding class |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
char* rccSizedRecodeCharsets | ( | rcc_context | ctx, |
const char * | from, | ||
const char * | to, | ||
const char * | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string between specified encodings.
ctx | is working context ( or default one if NULL supplied ) |
from | is source encoding |
to | is destination encoding |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
rcc_string rccSizedRecodeFromCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | charset, | ||
const char * | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string between specified encoding and encoding class.
The conversion is partly relays on rccSizedTo
ctx | is working context ( or default one if NULL supplied ) |
class_id | is destination encoding class |
charset | is source encoding |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
char* rccSizedRecodeToCharset | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
const char * | charset, | ||
rcc_const_string | buf, | ||
size_t | len, | ||
size_t * | rlen | ||
) |
Recode string between specified encoding class and encoding.
The conversion is partly relays on rccSizedFrom.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is source encoding class |
charset | is destination encoding |
buf | is original string (perhaps not zero terminated) |
len | is exact size of string or 0. In the last case the size is determined using 'strlen' function. |
rlen | in rlen the size of recoded string will be returned. |
char* rccSizedTo | ( | rcc_context | ctx, |
rcc_class_id | class_id, | ||
rcc_const_string | buf, | ||
size_t * | rlen | ||
) |
Recode string from rcc_string to specified encoding class. If encoding class is of 'File System' type, the autoprobing for file names can be performed. In the other cases the rcc_string will be recoded in preconfigured class encoding.
ctx | is working context ( or default one if NULL supplied ) |
class_id | is encoding class |
buf | is original zero terminated string |
rlen | in rlen the size of recoded string will be returned. |
char* rccSizedToCharset | ( | rcc_context | ctx, |
const char * | charset, | ||
rcc_const_string | buf, | ||
size_t * | rlen | ||
) |
Recode string from rcc_string to specified encoding.
ctx | is working context ( or default one if NULL supplied ) |
charset | is destination encoding |
buf | is original zero terminated string |
rlen | in rlen the size of recoded string will be returned. |
rcc_speller_result rccSpeller | ( | rcc_speller | speller, |
const char * | word | ||
) |
Spell a word.
speller | is spelling context |
word | is UTF-8 encoded word for spelling |
int rccSpellerAddParent | ( | rcc_speller | speller, |
rcc_speller | parent | ||
) |
Add parent to the spelling context.
speller | is spelling context |
parent | is parent spelling context |
rcc_speller rccSpellerCreate | ( | const char * | lang | ) |
Open spelling context.
lang | is language |
void rccSpellerFree | ( | rcc_speller | speller | ) |
Close spelling context.
speller | is spelling context |
int rccSpellerResultIsCorrect | ( | rcc_speller_result | res | ) |
int rccSpellerResultIsOwn | ( | rcc_speller_result | res | ) |
int rccSpellerResultIsPrecise | ( | rcc_speller_result | res | ) |
int rccStringCaseCmp | ( | const char * | str1, |
const char * | str2 | ||
) |
size_t rccStringCheck | ( | const char * | str | ) |
Check string header and verify if it is really correct rcc_string.
str | is verifying string |
int rccStringCmp | ( | const char * | str1, |
const char * | str2 | ||
) |
char* rccStringExtractString | ( | rcc_const_string | str | ) |
Extract UTF-8 string from rcc_string.
str | is rcc_string |
rcc_language_id rccStringGetLanguage | ( | rcc_const_string | str | ) |
Extract language from rcc_string.
str | is rcc_string |
const char* rccStringGetString | ( | rcc_const_string | str | ) |
Returns pointer on UTF-8 string kept inside of rcc_string.
str | is rcc_string |
int rccStringNCaseCmp | ( | const char * | str1, |
const char * | str2, | ||
size_t | n | ||
) |
int rccStringNCmp | ( | const char * | str1, |
const char * | str2, | ||
size_t | n | ||
) |
size_t rccStringSizedCheck | ( | const char * | str, |
size_t | len | ||
) |
Check string header and verify if it is really correct rcc_string.
str | is verifying string |
len | is preciese size of str. |
char* rccTranslate | ( | rcc_translate | translate, |
const char * | buf | ||
) |
Translate string.
translate | is translating context |
buf | is UTF-8 encoded string for translating |
int rccTranslateAllowOfflineMode | ( | rcc_translate | translate | ) |
void rccTranslateClose | ( | rcc_translate | translate | ) |
Close translating context.
translate | is translating context |
rcc_translate rccTranslateOpen | ( | const char * | from, |
const char * | to | ||
) |
Open translating context.
from | is source language |
to | is destination language |
int rccTranslateSetTimeout | ( | rcc_translate | translate, |
unsigned long | us | ||
) |
int rccUnlockConfiguration | ( | rcc_context | ctx, |
unsigned int | lock_code | ||
) |