LibRCC
|
00001 /* 00002 LibRCC - public interface 00003 00004 Copyright (C) 2005-2008 Suren A. Chilingaryan <csa@dside.dyndns.org> 00005 00006 This library is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Lesser General Public License version 2.1 or later 00008 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00013 for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software Foundation, Inc., 00017 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00018 */ 00019 00020 #ifndef _LIBRCC_H 00021 #define _LIBRCC_H 00022 00023 #include <stdlib.h> 00024 00025 /******************************************************************************* 00026 ***************************** Global Defines *********************************** 00027 *******************************************************************************/ 00028 00029 #define RCC_MAX_CHARSETS 16 00030 #define RCC_MAX_ENGINES 5 00031 #define RCC_MAX_LANGUAGES 64 00032 #define RCC_MAX_ALIASES 64 00033 #define RCC_MAX_CLASSES 16 00034 00035 /* ID's */ 00043 typedef unsigned char rcc_language_id; 00047 typedef unsigned char rcc_alias_id; 00051 typedef unsigned char rcc_relation_id; 00058 typedef unsigned char rcc_charset_id; 00064 typedef unsigned char rcc_autocharset_id; 00071 typedef unsigned char rcc_engine_id; 00075 typedef int rcc_class_id; 00076 00077 /* Opaque Pointer's */ 00078 typedef struct rcc_context_t *rcc_context; 00086 typedef struct rcc_engine_context_t *rcc_engine_context; 00092 typedef struct rcc_language_config_t *rcc_language_config; 00093 typedef const struct rcc_class_t *rcc_class_ptr; 00094 00095 #ifdef __cplusplus 00096 extern "C" { 00097 #endif 00098 00103 int rccInit(); 00104 00108 void rccFree(); 00109 00110 /******************************************************************************* 00111 **************************** Initialization ************************************ 00112 *******************************************************************************/ 00116 typedef unsigned int rcc_init_flags; 00117 00121 #define RCC_FLAG_NO_DEFAULT_CONFIGURATION 1 00122 00134 rcc_context rccCreateContext(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); 00147 int rccInitDefaultContext(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); 00148 00154 void rccFreeContext(rcc_context ctx); 00155 00156 00160 typedef unsigned int rcc_db4_flags; 00161 00170 int rccInitDb4(rcc_context ctx, const char *name, rcc_db4_flags flags); 00171 00172 int rccLockConfiguration(rcc_context ctx, unsigned int lock_code); 00173 int rccUnlockConfiguration(rcc_context ctx, unsigned int lock_code); 00174 00175 /******************************************************************************* 00176 ******************* Altering Language Configuaration *************************** 00177 *******************************************************************************/ 00181 typedef const char *rcc_charset; 00185 typedef rcc_charset rcc_charset_list[RCC_MAX_CHARSETS+1]; 00186 00187 /* Engines */ 00191 typedef void *rcc_engine_internal; 00200 typedef rcc_engine_internal (*rcc_engine_init_function)(rcc_engine_context ctx); 00208 typedef rcc_autocharset_id (*rcc_engine_function)(rcc_engine_context ctx, const char *buf, int len); 00212 typedef void (*rcc_engine_free_function)(rcc_engine_context ctx); 00213 00219 struct rcc_engine_t { 00220 const char *title; 00221 rcc_engine_init_function init_func; 00222 rcc_engine_free_function free_func; 00223 rcc_engine_function func; 00224 rcc_charset_list charsets; 00225 }; 00226 typedef struct rcc_engine_t rcc_engine; 00227 typedef rcc_engine *rcc_engine_ptr; 00228 typedef rcc_engine_ptr rcc_engine_list[RCC_MAX_ENGINES+1]; 00229 00233 struct rcc_language_t { 00234 const char *sn; 00235 rcc_charset_list charsets; 00236 rcc_engine_list engines; 00237 }; 00238 typedef struct rcc_language_t rcc_language; 00239 typedef rcc_language *rcc_language_ptr; 00240 typedef rcc_language_ptr rcc_language_list[RCC_MAX_LANGUAGES+1]; 00241 00246 struct rcc_language_alias_t { 00247 const char *alias; 00248 const char *lang; 00249 }; 00250 typedef struct rcc_language_alias_t rcc_language_alias; 00251 typedef rcc_language_alias *rcc_language_alias_ptr; 00252 typedef rcc_language_alias_ptr rcc_language_alias_list[RCC_MAX_ALIASES+1]; 00253 00264 struct rcc_language_relation_t { 00265 const char *lang; 00266 const char *parent; 00267 }; 00268 typedef struct rcc_language_relation_t rcc_language_relation; 00269 00276 rcc_language_id rccRegisterLanguage(rcc_context ctx, rcc_language *language); 00283 rcc_charset_id rccLanguageRegisterCharset(rcc_language *language, rcc_charset charset); 00290 rcc_engine_id rccLanguageRegisterEngine(rcc_language *language, rcc_engine *engine); 00297 rcc_alias_id rccRegisterLanguageAlias(rcc_context ctx, rcc_language_alias *alias); 00304 rcc_relation_id rccRegisterLanguageRelation(rcc_context ctx, rcc_language_relation *relation); 00305 00306 /******************************************************************************* 00307 ************************ Altering Configuaration ******************************* 00308 *******************************************************************************/ 00312 typedef enum rcc_class_type_t { 00313 RCC_CLASS_INVALID = 0, 00314 RCC_CLASS_STANDARD, 00315 RCC_CLASS_KNOWN, 00316 RCC_CLASS_FS, 00317 RCC_CLASS_TRANSLATE_LOCALE, 00318 RCC_CLASS_TRANSLATE_CURRENT, 00319 RCC_CLASS_TRANSLATE_FROM, 00320 } rcc_class_type; 00321 00325 struct rcc_class_default_charset_t { 00326 const char *lang; 00327 const char *charset; 00328 }; 00329 typedef const struct rcc_class_default_charset_t rcc_class_default_charset; 00330 00332 #define RCC_CLASS_FLAG_CONST 0x01 00333 00334 #define RCC_CLASS_FLAG_SKIP_SAVELOAD 0x02 00335 00368 struct rcc_class_t { 00369 const char *name; 00370 const rcc_class_type class_type; 00371 const char *defvalue; 00372 rcc_class_default_charset *defcharset; 00373 const char *fullname; 00374 const unsigned long flags; 00375 }; 00376 typedef const struct rcc_class_t rcc_class; 00377 typedef rcc_class_ptr rcc_class_list[RCC_MAX_CLASSES+1]; 00378 00385 rcc_class_id rccRegisterClass(rcc_context ctx, rcc_class *cl); 00393 int rccRegisterAdditionalCharsets(rcc_context ctx, rcc_class_id class_id, rcc_charset *charsets); 00401 int rccRegisterDisabledCharsets(rcc_context ctx, rcc_class_id class_id, rcc_charset *charsets); 00409 int rccIsDisabledCharsetName(rcc_context ctx, rcc_class_id class_id, const char *charset); 00410 00417 rcc_class_type rccGetClassType(rcc_context ctx, rcc_class_id class_id); 00424 const char *rccGetClassName(rcc_context ctx, rcc_class_id class_id); 00431 const char *rccGetClassFullName(rcc_context ctx, rcc_class_id class_id); 00432 00433 /******************************************************************************* 00434 ************************ Altering Configuaration ******************************* 00435 *******************************************************************************/ 00436 typedef int rcc_option_value; 00437 00441 #define RCC_OPTION_LEARNING_FLAG_USE 1 00442 00445 #define RCC_OPTION_LEARNING_FLAG_LEARN 2 00446 00447 typedef enum rcc_option_translate_t { 00448 RCC_OPTION_TRANSLATE_OFF = 0, 00449 RCC_OPTION_TRANSLATE_TRANSLITERATE, 00450 RCC_OPTION_TRANSLATE_TO_ENGLISH, 00451 RCC_OPTION_TRANSLATE_SKIP_RELATED, 00452 RCC_OPTION_TRANSLATE_SKIP_PARENT, 00453 RCC_OPTION_TRANSLATE_FULL 00454 } rcc_option_translate; 00455 00459 typedef enum rcc_option_t { 00460 RCC_OPTION_LEARNING_MODE = 0, 00461 RCC_OPTION_AUTODETECT_FS_TITLES, 00462 RCC_OPTION_AUTODETECT_FS_NAMES, 00463 RCC_OPTION_CONFIGURED_LANGUAGES_ONLY, 00464 RCC_OPTION_AUTOENGINE_SET_CURRENT, 00465 RCC_OPTION_AUTODETECT_LANGUAGE, 00466 RCC_OPTION_TRANSLATE, 00467 RCC_OPTION_TIMEOUT, 00468 RCC_OPTION_OFFLINE, 00469 RCC_MAX_OPTIONS, 00470 RCC_OPTION_ALL 00471 } rcc_option; 00472 00476 typedef enum rcc_option_type_t { 00477 RCC_OPTION_TYPE_INVISIBLE = 0, 00478 RCC_OPTION_TYPE_STANDARD, 00479 RCC_OPTION_TYPE_MAX 00480 } rcc_option_type; 00481 00485 typedef enum rcc_option_range_type_t { 00486 RCC_OPTION_RANGE_TYPE_BOOLEAN = 0, 00487 RCC_OPTION_RANGE_TYPE_RANGE, 00488 RCC_OPTION_RANGE_TYPE_FLAGS, 00489 RCC_OPTION_RANGE_TYPE_MENU, 00490 RCC_OPTION_RANGE_TYPE_MAX 00491 } rcc_option_range_type; 00492 00496 typedef struct rcc_option_range_t { 00497 rcc_option_range_type type; 00498 rcc_option_value min; 00499 rcc_option_value max; 00500 rcc_option_value step; 00501 }rcc_option_range; 00502 00503 /* lng.c */ 00504 00511 int rccGetLanguageNumber(rcc_context ctx); 00518 int rccGetClassNumber(rcc_context ctx); 00526 const char *rccGetLanguageName(rcc_context ctx, rcc_language_id language_id); 00534 rcc_language_id rccGetLanguageByName(rcc_context ctx, const char *name); 00548 rcc_language_id rccGetRealLanguage(rcc_context ctx, rcc_language_id language_id); 00557 const char *rccGetRealLanguageName(rcc_context ctx, rcc_language_id language_id); 00564 rcc_language_id rccGetSelectedLanguage(rcc_context ctx); 00572 const char *rccGetSelectedLanguageName(rcc_context ctx); 00580 rcc_language_id rccGetCurrentLanguage(rcc_context ctx); 00588 const char *rccGetCurrentLanguageName(rcc_context ctx); 00589 00590 00598 int rccSetLanguage(rcc_context ctx, rcc_language_id language_id); 00606 int rccSetLanguageByName(rcc_context ctx, const char *name); 00607 00608 /* opt.c */ 00616 rcc_option_value rccGetOption(rcc_context ctx, rcc_option option); 00624 int rccOptionIsDefault(rcc_context ctx, rcc_option option); 00632 int rccOptionSetDefault(rcc_context ctx, rcc_option option); 00641 int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value); 00649 rcc_option_type rccOptionGetType(rcc_context ctx, rcc_option option); 00657 rcc_option_range *rccOptionGetRange(rcc_context ctx, rcc_option option); 00658 00665 const char *rccGetOptionName(rcc_option option); 00666 00674 const char *rccGetOptionValueName(rcc_option option, rcc_option_value value); 00681 rcc_option rccGetOptionByName(const char *name); 00689 rcc_option_value rccGetOptionValueByName(rcc_option option, const char *name); 00690 00691 00692 /* lngconfig.c */ 00704 rcc_language_config rccCheckConfig(rcc_context ctx, rcc_language_id language_id); 00716 rcc_language_config rccGetConfig(rcc_context ctx, rcc_language_id language_id); 00735 rcc_language_config rccGetUsableConfig(rcc_context ctx, rcc_language_id language_id); 00744 rcc_language_config rccGetConfigByName(rcc_context ctx, const char *name); 00752 rcc_language_config rccGetCurrentConfig(rcc_context ctx); 00753 00759 rcc_language_id rccConfigGetLanguage(rcc_language_config config); 00765 const char *rccConfigGetLanguageName(rcc_language_config config); 00766 00773 int rccConfigGetCharsetNumber(rcc_language_config config); 00781 int rccConfigGetClassCharsetNumber(rcc_language_config config, rcc_class_id class_id); 00788 int rccConfigGetEngineNumber(rcc_language_config config); 00789 00797 const char *rccConfigGetEngineName(rcc_language_config config, rcc_engine_id engine_id); 00805 const char *rccConfigGetCharsetName(rcc_language_config config, rcc_charset_id charset_id); 00814 const char *rccConfigGetClassCharsetName(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id); 00815 00823 rcc_engine_id rccConfigGetEngineByName(rcc_language_config config, const char *name); 00831 rcc_charset_id rccConfigGetCharsetByName(rcc_language_config config, const char *name); 00840 rcc_charset_id rccConfigGetClassCharsetByName(rcc_language_config config, rcc_class_id class_id, const char *name); 00848 int rccConfigIsDisabledCharset(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id); 00858 rcc_engine_id rccConfigGetSelectedEngine(rcc_language_config config); 00866 const char *rccConfigGetSelectedEngineName(rcc_language_config config); 00877 rcc_engine_id rccConfigGetCurrentEngine(rcc_language_config config); 00885 const char *rccConfigGetCurrentEngineName(rcc_language_config config); 00886 00896 rcc_charset_id rccConfigGetSelectedCharset(rcc_language_config config, rcc_class_id class_id); 00905 const char *rccConfigGetSelectedCharsetName(rcc_language_config config, rcc_class_id class_id); 00921 rcc_charset_id rccConfigGetCurrentCharset(rcc_language_config config, rcc_class_id class_id); 00930 const char *rccConfigGetCurrentCharsetName(rcc_language_config config, rcc_class_id class_id); 00931 00939 int rccConfigSetEngine(rcc_language_config config, rcc_engine_id engine_id); 00948 int rccConfigSetCharset(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id); 00956 int rccConfigSetEngineByName(rcc_language_config config, const char *name); 00965 int rccConfigSetCharsetByName(rcc_language_config config, rcc_class_id class_id, const char *name); 00966 00974 rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char *locale_variable); 00983 rcc_charset_id rccConfigGetLocaleClassCharset(rcc_language_config config, rcc_class_id class_id, const char *locale_variable); 00984 00985 /* curconfig.c */ 00986 int rccGetCharsetNumber(rcc_context ctx); 00987 int rccGetClassCharsetNumber(rcc_context ctx, rcc_class_id class_id); 00988 int rccGetEngineNumber(rcc_context ctx); 00989 00990 const char *rccGetEngineName(rcc_context ctx, rcc_engine_id engine_id); 00991 const char *rccGetCharsetName(rcc_context ctx, rcc_charset_id charset_id); 00992 const char *rccGetClassCharsetName(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id); 00993 00994 rcc_engine_id rccGetEngineByName(rcc_context ctx, const char *name); 00995 rcc_charset_id rccGetCharsetByName(rcc_context ctx, const char *name); 00996 rcc_charset_id rccGetClassCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name); 00997 00998 int rccIsDisabledCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id); 00999 01000 rcc_engine_id rccGetSelectedEngine(rcc_context ctx); 01001 const char *rccGetSelectedEngineName(rcc_context ctx); 01002 rcc_engine_id rccGetCurrentEngine(rcc_context ctx); 01003 const char *rccGetCurrentEngineName(rcc_context ctx); 01004 rcc_charset_id rccGetSelectedCharset(rcc_context ctx, rcc_class_id class_id); 01005 const char *rccGetSelectedCharsetName(rcc_context ctx, rcc_class_id class_id); 01006 rcc_charset_id rccGetCurrentCharset(rcc_context ctx, rcc_class_id class_id); 01007 const char *rccGetCurrentCharsetName(rcc_context ctx, rcc_class_id class_id); 01008 01009 int rccSetEngine(rcc_context ctx, rcc_engine_id engine_id); 01010 int rccSetCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id); 01011 int rccSetEngineByName(rcc_context ctx, const char *name); 01012 int rccSetCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name); 01013 01014 rcc_charset_id rccGetLocaleCharset(rcc_context ctx, const char *locale_variable); 01015 rcc_charset_id rccGetLocaleClassCharset(rcc_context ctx, rcc_class_id class_id, const char *locale_variable); 01016 01017 rcc_autocharset_id rccDetectCharset(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len); 01018 01019 /******************************************************************************* 01020 ************************ Language Configuaration ******************************* 01021 *******************************************************************************/ 01022 01023 /******************************************************************************* 01024 ************************ RCC_STRING Manipulations ****************************** 01025 *******************************************************************************/ 01026 /* string.c */ 01032 typedef char *rcc_string; 01038 typedef const char *rcc_const_string; 01039 01045 size_t rccStringCheck(const char *str); 01053 size_t rccStringSizedCheck(const char *str, size_t len); 01054 01061 rcc_language_id rccStringGetLanguage(rcc_const_string str); 01068 const char *rccStringGetString(rcc_const_string str); 01075 char *rccStringExtractString(rcc_const_string str); 01076 01084 const char *rccGetString(const char *str); 01093 const char *rccSizedGetString(const char *str, size_t len); 01094 01095 int rccStringCmp(const char *str1, const char *str2); 01096 int rccStringNCmp(const char *str1, const char *str2, size_t n); 01097 int rccStringCaseCmp(const char *str1, const char *str2); 01098 int rccStringNCaseCmp(const char *str1, const char *str2, size_t n); 01099 01100 /******************************************************************************* 01101 ******************************** Recoding ************************************** 01102 *******************************************************************************/ 01103 /* rcciconv.c */ 01104 01108 typedef struct rcc_iconv_t *rcc_iconv; 01109 01119 rcc_iconv rccIConvOpen(const char *from, const char *to); 01124 void rccIConvClose(rcc_iconv icnv); 01134 char *rccIConv(rcc_iconv icnv, const char *buf, size_t len, size_t *rlen); 01135 01136 /* rcctranslate.c */ 01137 01141 typedef struct rcc_translate_t *rcc_translate; 01142 01152 rcc_translate rccTranslateOpen(const char *from, const char *to); 01158 void rccTranslateClose(rcc_translate translate); 01159 01160 /* 01161 * Set translation timeout 01162 * 01163 * @param translate is translating context 01164 * @param us is timeout in microseconds (0 - no timeout) 01165 * @return non-zero value is returned in the case of errror 01166 */ 01167 int rccTranslateSetTimeout(rcc_translate translate, unsigned long us); 01168 01169 /* 01170 * Allows translation engine to perform pending task after the main program is 01171 * being terminated 01172 * 01173 * @param translate is translating context 01174 * @return non-zero value is returned in the case of errror 01175 */ 01176 int rccTranslateAllowOfflineMode(rcc_translate translate); 01177 01185 char *rccTranslate(rcc_translate translate, const char *buf); 01186 01187 01188 /* rccspell.c */ 01189 01193 typedef struct rcc_speller_t *rcc_speller; 01194 01198 typedef enum rcc_speller_result_t { 01199 RCC_SPELLER_INCORRECT = 0, 01200 RCC_SPELLER_ALMOST_PARENT, 01201 RCC_SPELLER_ALMOST_CORRECT, 01202 RCC_SPELLER_PARENT, 01203 RCC_SPELLER_CORRECT 01204 } rcc_speller_result; 01205 01206 int rccSpellerResultIsOwn(rcc_speller_result res); 01207 int rccSpellerResultIsPrecise(rcc_speller_result res); 01208 int rccSpellerResultIsCorrect(rcc_speller_result res); 01209 01218 rcc_speller rccSpellerCreate(const char *lang); 01224 void rccSpellerFree(rcc_speller speller); 01232 int rccSpellerAddParent(rcc_speller speller, rcc_speller parent); 01240 rcc_speller_result rccSpeller(rcc_speller speller, const char *word); 01241 01242 /* recode.c */ 01243 01252 rcc_language_id rccDetectLanguage(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len); 01253 01262 rcc_autocharset_id rccConfigDetectCharset(rcc_language_config config, rcc_class_id class_id, const char *buf, size_t len); 01263 01275 rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len); 01287 char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, rcc_const_string buf, size_t *rlen); 01302 char *rccSizedRecode(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); 01322 char *rccFS(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *fspath, const char *path, const char *filename); 01323 01333 rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char *buf, size_t len); 01343 char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string buf, size_t *rlen); 01358 char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen); 01373 rcc_string rccSizedRecodeFromCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, const char *buf, size_t len, size_t *rlen); 01385 char *rccSizedRecodeCharsets(rcc_context ctx, const char *from, const char *to, const char *buf, size_t len, size_t *rlen); 01386 01387 01399 rcc_string rccConfigSizedFrom(rcc_language_config config, rcc_class_id class_id, const char *buf, size_t len); 01411 char *rccConfigSizedTo(rcc_language_config config, rcc_class_id class_id, rcc_const_string buf, size_t *rlen); 01426 char *rccConfigSizedRecode(rcc_language_config config, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); 01438 rcc_string rccConfigSizedRecodeFromCharset(rcc_language_config config, rcc_class_id class_id, const char *charset, const char *buf, size_t len, size_t *rlen); 01450 char *rccConfigSizedRecodeToCharset(rcc_language_config config, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen); 01451 01452 01453 #define rccFrom(ctx, class_id, buf) rccSizedFrom(ctx, class_id, buf, 0) 01454 #define rccTo(ctx, class_id, buf) rccSizedTo(ctx, class_id, buf, NULL) 01455 #define rccRecode(ctx, from, to, buf) rccSizedRecode(ctx, from, to, buf, 0, NULL) 01456 01457 #define rccFromCharset(ctx, charset, buf) rccSizedFromCharset(ctx, charset, buf, 0) 01458 #define rccToCharset(ctx, charset, buf) rccSizedToCharset(ctx, charset, buf, NULL) 01459 #define rccRecodeToCharset(ctx, class_id, charset, buf) rccSizedRecodeToCharset(ctx, class_id, charset, buf, 0, NULL) 01460 #define rccRecodeFromCharset(ctx, class_id, charset, buf) rccSizedRecodeFromCharset(ctx, class_id, charset, buf, 0, NULL) 01461 #define rccRecodeCharsets(ctx, from, to, buf) rccSizedRecodeCharsets(ctx, from, to, buf, 0, NULL) 01462 01463 #define rccConfigFrom(ctx, class_id, buf) rccConfigSizedFrom(ctx, class_id, buf, 0) 01464 #define rccConfigTo(ctx, class_id, buf) rccConfigSizedTo(ctx, class_id, buf, NULL) 01465 #define rccConfigRecode(ctx, from, to, buf) rccConfigSizedRecode(ctx, from, to, buf, 0, NULL) 01466 #define rccConfigRecodeToCharset(ctx, class_id, charset, buf) rccConfigSizedRecodeToCharset(ctx, class_id, charset, buf, 0, NULL) 01467 #define rccConfigRecodeFromCharset(ctx, class_id, charset, buf) rccConfigSizedRecodeFromCharset(ctx, class_id, charset, buf, 0, NULL) 01468 01469 /******************************************************************************* 01470 ******************************** Options *************************************** 01471 *******************************************************************************/ 01472 01473 /* xml.c */ 01474 typedef void *rcc_config; 01475 rcc_config rccGetConfiguration(); 01476 01484 int rccSave(rcc_context ctx, const char *name); 01492 int rccLoad(rcc_context ctx, const char *name); 01493 01494 /******************************************************************************* 01495 **************************** Engine Plugins ************************************ 01496 *******************************************************************************/ 01497 01498 typedef rcc_engine *(*rcc_plugin_engine_info_function)(const char *lang); 01499 01500 rcc_engine_internal rccEngineGetInternal(rcc_engine_context ctx); 01501 rcc_language *rccEngineGetLanguage(rcc_engine_context ctx); 01502 rcc_context rccEngineGetRccContext(rcc_engine_context ctx); 01503 rcc_engine *rccEngineGetInfo(rcc_engine_context ctx); 01504 rcc_autocharset_id rccEngineGetAutoCharsetByName(rcc_engine_context ctx, const char *name); 01505 01506 01507 /******************************************************************************* 01508 **************************** Configuration ************************************* 01509 *******************************************************************************/ 01510 01514 #define RCC_CC_FLAG_HAVE_BERKLEY_DB 0x01 01515 01518 #define RCC_CC_FLAG_HAVE_DYNAMIC_ENGINES 0x02 01519 01522 #define RCC_CC_FLAG_HAVE_ENCA 0x04 01523 01526 #define RCC_CC_FLAG_HAVE_RCD 0x08 01527 01530 #define RCC_CC_FLAG_HAVE_LIBTRANSLATE 0x10 01531 01535 struct rcc_compiled_configuration_t { 01536 unsigned long flags; 01537 }; 01538 typedef struct rcc_compiled_configuration_t rcc_compiled_configuration_s; 01539 typedef const struct rcc_compiled_configuration_t *rcc_compiled_configuration; 01540 01544 rcc_compiled_configuration rccGetCompiledConfiguration(); 01545 01546 int rccLocaleGetClassByName(const char *locale); 01547 int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n); 01548 int rccLocaleGetCharset(char *result, const char *lv, unsigned int n); 01549 01550 01554 #define RCC_OPTION_TRANSLATE_SKIP_PARRENT RCC_OPTION_TRANSLATE_SKIP_PARENT 01555 #define RCC_SPELLER_ALMOST_PARRENT RCC_SPELLER_ALMOST_PARENT 01556 #define RCC_SPELLER_PARRENT RCC_SPELLER_PARENT 01557 #define rccSpellerAddParrent rccSpellerAddParent 01558 01559 #ifdef __cplusplus 01560 } 01561 #endif 01562 01563 #endif /* _LIBRCC_H */