diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-05 03:15:53 +0000 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2005-07-05 03:15:53 +0000 |
commit | 9922cef1af71786ae788903b52a8968e5775d510 (patch) | |
tree | badf23fc2701946b61df1d15227736783e44a754 /src/lngconfig.c | |
parent | a21deef1c62467b21500f94dfb2ab3d58e69cb85 (diff) | |
download | librcc-9922cef1af71786ae788903b52a8968e5775d510.tar.gz librcc-9922cef1af71786ae788903b52a8968e5775d510.tar.bz2 librcc-9922cef1af71786ae788903b52a8968e5775d510.tar.xz librcc-9922cef1af71786ae788903b52a8968e5775d510.zip |
Save / Load
Diffstat (limited to 'src/lngconfig.c')
-rw-r--r-- | src/lngconfig.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lngconfig.c b/src/lngconfig.c index ad87189..67b7e0b 100644 --- a/src/lngconfig.c +++ b/src/lngconfig.c @@ -127,6 +127,17 @@ int rccConfigFree(rcc_language_config config) { } } +rcc_language_config rccCheckConfig(rcc_context ctx, rcc_language_id language_id) { + rcc_language_id new_language_id; + int err; + + new_language_id = rccGetRealLanguage(ctx, language_id); + if ((language_id<=0)||(new_language_id != language_id)) return NULL; + if (!ctx->configs[language_id].charset) return NULL; + if (!strcasecmp(ctx->languages[language_id]->sn, "off")) return NULL; + + return ctx->configs + language_id; +} rcc_language_config rccGetConfig(rcc_context ctx, rcc_language_id language_id) { int err; @@ -271,10 +282,12 @@ const char *rccConfigGetCurrentCharsetName(rcc_language_config config, rcc_class int rccConfigSetEngine(rcc_language_config config, rcc_engine_id engine_id) { unsigned int i; - if ((!config)||(!config->language)||(engine_id < 0)) return -1; + if ((!config)||(!config->language)||(engine_id < -1)) return -1; - for (i=0;config->language->engines[i];i++); - if (engine_id >= i) return -1; + if (engine_id != (rcc_engine_id)-1) { + for (i=0;config->language->engines[i];i++); + if (engine_id >= i) return -1; + } if (config->engine != engine_id) { if (config->ctx->current_config == config) config->ctx->configure = 1; @@ -285,7 +298,12 @@ int rccConfigSetEngine(rcc_language_config config, rcc_engine_id engine_id) { int rccConfigSetEngineByName(rcc_language_config config, const char *name) { rcc_engine_id engine_id; - + + if (!config) return -1; + + if ((!name)||(!strcasecmp(name,rcc_engine_nonconfigured))) + return rccConfigSetEngine(config, (rcc_engine_id)-1); + engine_id = rccConfigGetEngineByName(config, name); if (engine_id < 0) return -1; |