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/rccconfig.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/rccconfig.c')
-rw-r--r-- | src/rccconfig.c | 77 |
1 files changed, 71 insertions, 6 deletions
diff --git a/src/rccconfig.c b/src/rccconfig.c index 6d0a372..e1ac34a 100644 --- a/src/rccconfig.c +++ b/src/rccconfig.c @@ -3,6 +3,7 @@ #include "internal.h" #include "rccconfig.h" +#include "opt.h" static rcc_charset_id rcc_autoengine_russian(rcc_engine_context ctx, const char *buf, int len) { return (rcc_charset_id)rcdGetRussianCharset(buf,len); @@ -14,7 +15,8 @@ rcc_language_alias rcc_default_aliases[] = { { NULL, NULL} }; -const char rcc_engine_nonconfigured[] = "NonConfigured"; +const char rcc_engine_nonconfigured[] = "default"; +const char rcc_option_nonconfigured[] = "default"; rcc_engine rcc_default_engine = { "Off", NULL, NULL, NULL, {NULL} @@ -24,7 +26,7 @@ rcc_engine rcc_russian_engine = { "Russian", NULL, NULL, &rcc_autoengine_russian, {"CP1251","KOI8-R","UTF-8","IBM866", NULL} }; -rcc_language rcc_default_languages[] = { +rcc_language rcc_default_languages[RCC_MAX_LANGUAGES + 1] = { {"default", {"Default", NULL}, { &rcc_default_engine, NULL @@ -115,8 +117,71 @@ rcc_language_name rcc_default_language_names[RCC_MAX_LANGUAGES+1] = { }; rcc_option_name rcc_default_option_names[] = { - { RCC_LEARNING_MODE, "Learning Mode" }, - { RCC_AUTODETECT_FS_TITLES, "Autodetect FS Encoding" }, - { RCC_AUTODETECT_FS_NAMES, "Autodetect File Names" }, - { RCC_MAX_OPTIONS, NULL} + { RCC_LEARNING_MODE, "Learning Mode", "LEARNING_MODE" }, + { RCC_AUTODETECT_FS_TITLES, "Autodetect FS Encoding", "AUTODETECT_FS_TITLES" }, + { RCC_AUTODETECT_FS_NAMES, "Autodetect File Names", "AUTODETECT_FS_NAMES" }, + { RCC_MAX_OPTIONS, NULL, NULL} }; + +rcc_option_defval rcc_default_option_values[] = { + { RCC_LEARNING_MODE, 0 }, + { RCC_AUTODETECT_FS_TITLES, 1}, + { RCC_AUTODETECT_FS_NAMES, 1}, + { RCC_MAX_OPTIONS, 0} +}; + +const char *rccGetLanguageFullName(const char *lang) { + unsigned int i; + rcc_language_name *names; + + if (!lang) return NULL; + + names = rcc_default_language_names; + + for (i=0;names[i].sn;i++) + if (!strcmp(lang, names[i].sn)) return names[i].name; + + return NULL; +} + +const char *rccGetOptionName(rcc_option option) { + unsigned int i; + rcc_option_name *names; + + if ((option<0)||(option>=RCC_MAX_OPTIONS)) return NULL; + + names = rcc_default_option_names; + + for (i=0;names[i].option!=RCC_MAX_OPTIONS;i++) + if (names[i].option == option) return names[i].sn; + + return NULL; +} + +const char *rccGetOptionFullName(rcc_option option) { + unsigned int i; + rcc_option_name *names; + + if ((option<0)||(option>=RCC_MAX_OPTIONS)) return NULL; + + names = rcc_default_option_names; + + for (i=0;names[i].option!=RCC_MAX_OPTIONS;i++) + if (names[i].option == option) return names[i].name; + + return NULL; +} + +rcc_option_value rccGetOptionDefaultValue(rcc_option option) { + unsigned int i; + rcc_option_defval *values; + + if ((option<0)||(option>=RCC_MAX_OPTIONS)) return 0; + + values = rcc_default_option_values; + + for (i=0;values[i].option!=RCC_MAX_OPTIONS;i++) + if (values[i].option == option) return values[i].value; + + return 0; +} |