summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-02 05:08:36 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-02 05:08:36 +0000
commit97e76f4c979d7a0c4ed296c512c3024e3c6afa18 (patch)
treea83fe703fa3ef3a26eed5d6c5929fdcad7429072 /src
parent081011f386915bd037a3569e46ed5e4f10c490da (diff)
downloadlibrcc-97e76f4c979d7a0c4ed296c512c3024e3c6afa18.tar.gz
librcc-97e76f4c979d7a0c4ed296c512c3024e3c6afa18.tar.bz2
librcc-97e76f4c979d7a0c4ed296c512c3024e3c6afa18.tar.xz
librcc-97e76f4c979d7a0c4ed296c512c3024e3c6afa18.zip
02.07.2005
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/curconfig.c95
-rw-r--r--src/curconfig.h5
-rw-r--r--src/internal.h4
-rw-r--r--src/librcc.c79
-rw-r--r--src/librcc.h93
-rw-r--r--src/lngconfig.c46
-rw-r--r--src/opt.c21
-rw-r--r--src/opt.h5
-rw-r--r--src/rccconfig.c58
-rw-r--r--src/rccconfig.h3
-rw-r--r--src/rccenca.c2
-rw-r--r--src/rcclist.c59
-rw-r--r--src/rcclist.h5
-rw-r--r--src/xml.c4
15 files changed, 361 insertions, 121 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 01a7da1..72cf0ec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,8 +2,11 @@ lib_LTLIBRARIES = librcc.la
librcc_la_SOURCES = librcc.c \
rcclocale.c rcclocale.h \
lng.c lng.h \
+ opt.c opt.h \
lngconfig.c lngconfig.h \
+ curconfig.c curconfig.h \
rccconfig.c rccconfig.h \
+ rcclist.c rcclist.h \
plugin.c plugin.h \
rccenca.c rccenca.h \
engine.c engine.h \
diff --git a/src/curconfig.c b/src/curconfig.c
new file mode 100644
index 0000000..4a26a33
--- /dev/null
+++ b/src/curconfig.c
@@ -0,0 +1,95 @@
+#include <stdio.h>
+#include "internal.h"
+
+const char *rccGetEngineName(rcc_context ctx, rcc_engine_id engine_id) {
+ if (!ctx) return NULL;
+ return rccConfigGetEngineName(ctx->current_config, engine_id);
+}
+
+const char *rccGetCharsetName(rcc_context ctx, rcc_charset_id charset_id) {
+ if (!ctx) return NULL;
+ return rccConfigGetCharsetName(ctx->current_config, charset_id);
+}
+
+const char *rccGetAutoCharsetName(rcc_context ctx, rcc_charset_id charset_id) {
+ if (!ctx) return NULL;
+ return rccConfigGetAutoCharsetName(ctx->current_config, charset_id);
+}
+
+rcc_engine_id rccGetEngineByName(rcc_context ctx, const char *name) {
+ if (!ctx) return (rcc_engine_id)-1;
+ return rccConfigGetEngineByName(ctx->current_config, name);
+}
+
+rcc_charset_id rccGetCharsetByName(rcc_context ctx, const char *name) {
+ if (!ctx) return (rcc_charset_id)-1;
+ return rccConfigGetCharsetByName(ctx->current_config, name);
+}
+
+rcc_charset_id rccGetAutoCharsetByName(rcc_context ctx, const char *name) {
+ if (!ctx) return (rcc_charset_id)-1;
+ return rccConfigGetAutoCharsetByName(ctx->current_config, name);
+}
+
+rcc_engine_id rccGetSelectedEngine(rcc_context ctx) {
+ if (!ctx) return (rcc_engine_id)-1;
+ return rccConfigGetSelectedEngine(ctx->current_config);
+}
+
+const char *rccGetSelectedEngineName(rcc_context ctx) {
+ if (!ctx) return NULL;
+ return rccConfigGetSelectedEngineName(ctx->current_config);
+}
+
+rcc_engine_id rccGetCurrentEngine(rcc_context ctx) {
+ if (!ctx) return (rcc_engine_id)-1;
+ return rccConfigGetCurrentEngine(ctx->current_config);
+}
+
+const char *rccGetCurrentEngineName(rcc_context ctx) {
+ if (!ctx) return NULL;
+ return rccConfigGetCurrentEngineName(ctx->current_config);
+}
+
+rcc_charset_id rccGetSelectedCharset(rcc_context ctx, rcc_class_id class_id) {
+ return rccConfigGetSelectedCharset(ctx->current_config, class_id);
+}
+
+const char *rccGetSelectedCharsetName(rcc_context ctx, rcc_class_id class_id) {
+ if (!ctx) return NULL;
+ return rccConfigGetSelectedCharsetName(ctx->current_config, class_id);
+}
+
+rcc_charset_id rccGetCurrentCharset(rcc_context ctx, rcc_class_id class_id) {
+ return rccConfigGetCurrentCharset(ctx->current_config, class_id);
+}
+
+const char *rccGetCurrentCharsetName(rcc_context ctx, rcc_class_id class_id) {
+ if (!ctx) return NULL;
+ return rccConfigGetCurrentCharsetName(ctx->current_config, class_id);
+}
+
+int rccSetEngine(rcc_context ctx, rcc_engine_id engine_id) {
+ if (!ctx) return -1;
+ return rccConfigSetEngine(ctx->current_config, engine_id);
+}
+
+int rccSetCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id) {
+ if (!ctx) return -1;
+ return rccConfigSetCharset(ctx->current_config, class_id, charset_id);
+}
+
+int rccSetEngineByName(rcc_context ctx, const char *name) {
+ if (!ctx) return -1;
+ return rccConfigSetEngineByName(ctx->current_config, name);
+}
+
+int rccSetCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name) {
+ if (!ctx) return -1;
+ return rccConfigSetCharsetByName(ctx->current_config, class_id, name);
+}
+
+rcc_charset_id rccGetLocaleCharset(rcc_context ctx, const char *locale_variable) {
+ if (!ctx) return (rcc_charset_id)-1;
+ return rccConfigGetLocaleCharset(ctx->current_config, locale_variable);
+}
diff --git a/src/curconfig.h b/src/curconfig.h
new file mode 100644
index 0000000..f1ffaff
--- /dev/null
+++ b/src/curconfig.h
@@ -0,0 +1,5 @@
+#ifndef _RCC_CUR_CONFIG_H
+#define _RCC_CUR_CONFIG_H
+
+
+#endif /* _RCC_CUR_CONFIG_H */
diff --git a/src/internal.h b/src/internal.h
index 7d40547..c943384 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -11,6 +11,8 @@ struct rcc_context_t {
char locale_variable[RCC_MAX_VARIABLE_CHARS+1];
rcc_language_alias_list aliases;
+
+ rcc_option_value options[RCC_MAX_OPTIONS];
unsigned int max_languages;
unsigned int n_languages;
@@ -33,6 +35,8 @@ struct rcc_context_t {
unsigned char configure;
rcc_language_config current_config;
rcc_language_id current_language;
+
+ unsigned int configuration_lock;
};
typedef struct rcc_context_t rcc_context_s;
diff --git a/src/librcc.c b/src/librcc.c
index 56c357b..684e76a 100644
--- a/src/librcc.c
+++ b/src/librcc.c
@@ -6,9 +6,11 @@
#include "internal.h"
#include "rccconfig.h"
#include "rccenca.h"
+#include "rcclist.h"
int rccInit() {
+ /*DS: Load addition languages from config! */
return rccEncaInit();
}
@@ -16,7 +18,7 @@ void rccFree() {
rccEncaFree();
}
-rcc_context rccInitContext(rcc_init_flags flags, unsigned int max_languages, unsigned int max_classes, const char *locale) {
+rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, unsigned int max_classes, const char *locale) {
int err;
unsigned int i;
@@ -109,7 +111,11 @@ rcc_context rccInitContext(rcc_init_flags flags, unsigned int max_languages, uns
rccRegisterLanguage(ctx, rcc_default_languages);
ctx->current_config = NULL;
}
-
+
+ for (i=0;i<RCC_MAX_OPTIONS;i++)
+ ctx->options[i] = 0;
+
+ ctx->configuration_lock = 0;
ctx->configure = 1;
return ctx;
@@ -163,8 +169,24 @@ void rccFreeContext(rcc_context ctx) {
}
}
+int rccLockConfiguration(rcc_context ctx, unsigned int lock_code) {
+ if (!ctx) return -1;
+ if (ctx->configuration_lock) return -3;
+ ctx->configuration_lock = lock_code;
+ return 0;
+}
+
+int rccUnlockConfiguration(rcc_context ctx, unsigned int lock_code) {
+ if (!ctx) return -1;
+ if (ctx->configuration_lock != lock_code) return -3;
+ ctx->configuration_lock = 0;
+ return 0;
+}
+
rcc_language_id rccRegisterLanguage(rcc_context ctx, rcc_language *language) {
if ((!ctx)||(!language)) return -1;
+ if (ctx->configuration_lock) return -3;
+
if (ctx->n_languages == ctx->max_languages) return -2;
ctx->languages[ctx->n_languages++] = language;
ctx->languages[ctx->n_languages] = NULL;
@@ -213,7 +235,9 @@ rcc_alias_id rccRegisterLanguageAlias(rcc_context ctx, rcc_language_alias *alias
rcc_class_id rccRegisterClass(rcc_context ctx, rcc_class *cl) {
if ((!ctx)||(!cl)) return -1;
+ if (ctx->configuration_lock) return -3;
if (ctx->n_classes == ctx->max_classes) return -2;
+
ctx->configure = 1;
ctx->classes[ctx->n_languages++] = cl;
ctx->classes[ctx->n_languages] = NULL;
@@ -227,57 +251,6 @@ rcc_class_type rccGetClassType(rcc_context ctx, rcc_class_id class_id) {
return ctx->classes[class_id]->class_type;
}
-static rcc_language_ptr *rccGetLanguageList(rcc_context ctx) {
- if (!ctx) return NULL;
- return ctx->languages;
-}
-
-static rcc_charset *rccGetCharsetList(rcc_context ctx, rcc_language_id language_id) {
- if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return NULL;
- return ctx->languages[language_id]->charsets;
-}
-
-static rcc_engine_ptr *rccGetEngineList(rcc_context ctx, rcc_language_id language_id) {
- if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return NULL;
- return ctx->languages[language_id]->engines;
-}
-
-static rcc_charset *rccGetCurrentCharsetList(rcc_context ctx) {
- rcc_language_id language_id;
-
- if (!ctx) return NULL;
-
- language_id = rccGetCurrentLanguage(ctx);
- if (language_id<0) return NULL;
-
- return rccGetCharsetList(ctx, language_id);
-}
-
-static rcc_engine_ptr *rccGetCurrentEngineList(rcc_context ctx) {
- rcc_language_id language_id;
-
- if (!ctx) return NULL;
-
- language_id = rccGetCurrentLanguage(ctx);
- if (language_id<0) return NULL;
-
- return rccGetEngineList(ctx, language_id);
-}
-
-static rcc_charset *rccGetCurrentAutoCharsetList(rcc_context ctx) {
- rcc_language_id language_id;
- rcc_engine_id engine_id;
-
- if (!ctx) return NULL;
-
- language_id = rccGetCurrentLanguage(ctx);
- engine_id = rccGetCurrentEngine(ctx);
- if ((language_id<0)||(engine_id<0)) return NULL;
-
-
- return ctx->languages[language_id]->engines[engine_id]->charsets;
-}
-
int rccConfigure(rcc_context ctx) {
unsigned int i;
diff --git a/src/librcc.h b/src/librcc.h
index 0ca55a4..2e06911 100644
--- a/src/librcc.h
+++ b/src/librcc.h
@@ -1,5 +1,5 @@
-#ifndef LIBRCC_H
-#define LIBRCC_H
+#ifndef _LIBRCC_H
+#define _LIBRCC_H
/*******************************************************************************
***************************** Global Defines ***********************************
@@ -44,9 +44,12 @@ void rccFree();
*******************************************************************************/
typedef unsigned int rcc_init_flags;
#define RCC_DEFAULT_CONFIGURATION 1
-rcc_context rccInitContext(rcc_init_flags flags, unsigned int max_languages, unsigned int max_classes, const char *locale);
+rcc_context rccCreateContext(rcc_init_flags flags, unsigned int max_languages, unsigned int max_classes, const char *locale);
void rccFreeContext(rcc_context ctx);
+int rccLockConfiguration(rcc_context ctx, unsigned int lock_code);
+int rccUnlockConfiguration(rcc_context ctx, unsigned int lock_code);
+
/*******************************************************************************
******************* Altering Language Configuaration ***************************
*******************************************************************************/
@@ -73,7 +76,6 @@ typedef rcc_engine_ptr rcc_engine_list[RCC_MAX_ENGINES+1];
/* Language */
struct rcc_language_t {
const char *sn;
- const char *name;
rcc_charset_list charsets;
rcc_engine_list engines;
};
@@ -90,6 +92,12 @@ typedef struct rcc_language_alias_t rcc_language_alias;
typedef rcc_language_alias *rcc_language_alias_ptr;
typedef rcc_language_alias_ptr rcc_language_alias_list[RCC_MAX_ALIASES+1];
+struct rcc_language_name_t {
+ const char *sn;
+ const char *name;
+};
+typedef struct rcc_language_name_t rcc_language_name;
+
rcc_language_id rccRegisterLanguage(rcc_context ctx, rcc_language *language);
rcc_charset_id rccLanguageRegisterCharset(rcc_language *language, rcc_charset charset);
rcc_engine_id rccLanguageRegisterEngine(rcc_language *language, rcc_engine *engine);
@@ -101,6 +109,7 @@ rcc_alias_id rccRegisterLanguageAlias(rcc_context ctx, rcc_language_alias *alias
typedef enum rcc_class_type_t {
RCC_CLASS_INVALID = 0,
RCC_CLASS_STANDARD,
+ RCC_CLASS_KNOWN,
RCC_CLASS_FS
} rcc_class_type;
typedef const struct rcc_class_t rcc_class;
@@ -109,6 +118,7 @@ struct rcc_class_t {
const char *name;
const char *defvalue; /* locale variable name or parrent name */
const rcc_class_type class_type;
+ const char *fullname;
};
typedef rcc_class *rcc_class_ptr;
typedef rcc_class_ptr rcc_class_list[RCC_MAX_CLASSES+1];
@@ -124,10 +134,15 @@ typedef enum rcc_option_t {
RCC_LEARNING_MODE = 0,
RCC_AUTODETECT_FS_TITLES,
RCC_AUTODETECT_FS_NAMES,
- RCC_USE_HEADERS,
RCC_MAX_OPTIONS
} rcc_option;
+struct rcc_option_name_t {
+ rcc_option option;
+ const char *name;
+};
+typedef struct rcc_option_name_t rcc_option_name;
+
/* lng.c */
const char *rccGetLanguageName(rcc_context ctx, rcc_language_id language_id);
rcc_language_id rccGetLanguageByName(rcc_context ctx, const char *name);
@@ -141,6 +156,10 @@ const char *rccGetCurrentLanguageName(rcc_context ctx);
int rccSetLanguage(rcc_context ctx, rcc_language_id language_id);
int rccSetLanguageByName(rcc_context ctx, const char *name);
+/* opt.c */
+rcc_option_value rccGetOption(rcc_context ctx, rcc_option option);
+int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value);
+
/* lngconfig.c */
int rccConfigInit(rcc_language_config config, rcc_context ctx);
int rccConfigFree(rcc_language_config config);
@@ -164,41 +183,51 @@ rcc_charset_id rccConfigGetSelectedCharset(rcc_language_config config, rcc_class
const char *rccConfigGetSelectedCharsetName(rcc_language_config config, rcc_class_id class_id);
rcc_charset_id rccConfigGetCurrentCharset(rcc_language_config config, rcc_class_id class_id);
const char *rccConfigGetCurrentCharsetName(rcc_language_config config, rcc_class_id class_id);
-rcc_option_value rccConfigGetOption(rcc_language_config config, rcc_option option);
int rccConfigSetEngine(rcc_language_config config, rcc_engine_id engine_id);
int rccConfigSetCharset(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id);
int rccConfigSetEngineByName(rcc_language_config config, const char *name);
int rccConfigSetCharsetByName(rcc_language_config config, rcc_class_id class_id, const char *name);
-int rccConfigSetOption(rcc_language_config config, rcc_option option, rcc_option_value value);
rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char *locale_variable);
/* curconfig.c */
-#define rccGetEngineName(ctx, engine_id) rccConfigGetEngineName(ctx->current_config, engine_id)
-#define rccGetCharsetName(ctx, charset_id) rccConfigGetCharsetName(ctx->current_config, charset_id)
-#define rccGetAutoCharsetName(ctx, charset_id) rccConfigGetAutoCharsetName(ctx->current_config, charset_id)
-#define rccGetEngineByName(ctx, name) rccConfigGetEngineByName(ctx->current_config, name)
-#define rccGetCharsetByName(ctx, name) rccConfigGetCharsetByName(ctx->current_config, name)
-#define rccGetAutoCharsetByName(ctx, name) rccConfigGetAutoCharsetByName(ctx->current_config, name)
-
-#define rccGetSelectedEngine(ctx) rccConfigGetSelectedEngine(ctx->current_config)
-#define rccGetSelectedEngineName(ctx) rccConfigGetSelectedEngineName(ctx->current_config)
-#define rccGetCurrentEngine(ctx) rccConfigGetCurrentEngine(ctx->current_config)
-#define rccGetCurrentEngineName(ctx) rccConfigGetCurrentEngineName(ctx->current_config)
-#define rccGetSelectedCharset(ctx,class_id) rccConfigGetSelectedCharset(ctx->current_config, class_id)
-#define rccGetSelectedCharsetName(ctx,class_id) rccConfigGetSelectedCharsetName(ctx->current_config, class_id)
-#define rccGetCurrentCharset(ctx,class_id) rccConfigGetCurrentCharset(ctx->current_config, class_id)
-#define rccGetCurrentCharsetName(ctx,class_id) rccConfigGetCurrentCharsetName(ctx->current_config, class_id)
-#define rccGetOption(ctx, option) rccConfigGetOption(ctx->current_config, option)
-
-#define rccSetEngine(ctx, engine_id) rccConfigSetEngine(ctx->current_config, engine_id)
-#define rccSetCharset(ctx, class_id, charset_id) rccConfigSetCharset(ctx->current_config, class_id, charset_id)
-#define rccSetOption(ctx,option,value) rccConfigSetOption(ctx->current_config, option, value)
-#define rccSetEngineByName(ctx, name) rccConfigSetEngineByName(ctx->current_config, name)
-#define rccSetCharsetByName(ctx, class_id, name) rccConfigSetCharsetByName(ctx->current_config, class_id, name)
-
-#define rccGetLocaleCharset(ctx, locale_variable) rccConfigGetLocaleCharset(ctx->current_config, locale_variable)
+const char *rccGetEngineName(rcc_context ctx, rcc_engine_id engine_id);
+const char *rccGetCharsetName(rcc_context ctx, rcc_charset_id charset_id);
+const char *rccGetAutoCharsetName(rcc_context ctx, rcc_charset_id charset_id);
+
+rcc_engine_id rccGetEngineByName(rcc_context ctx, const char *name);
+rcc_charset_id rccGetCharsetByName(rcc_context ctx, const char *name);
+rcc_charset_id rccGetAutoCharsetByName(rcc_context ctx, const char *name);
+
+rcc_engine_id rccGetSelectedEngine(rcc_context ctx);
+const char *rccGetSelectedEngineName(rcc_context ctx);
+rcc_engine_id rccGetCurrentEngine(rcc_context ctx);
+const char *rccGetCurrentEngineName(rcc_context ctx);
+rcc_charset_id rccGetSelectedCharset(rcc_context ctx, rcc_class_id class_id);
+const char *rccGetSelectedCharsetName(rcc_context ctx, rcc_class_id class_id);
+rcc_charset_id rccGetCurrentCharset(rcc_context ctx, rcc_class_id class_id);
+const char *rccGetCurrentCharsetName(rcc_context ctx, rcc_class_id class_id);
+
+int rccSetEngine(rcc_context ctx, rcc_engine_id engine_id);
+int rccSetCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id);
+int rccSetEngineByName(rcc_context ctx, const char *name);
+int rccSetCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name);
+
+rcc_charset_id rccGetLocaleCharset(rcc_context ctx, const char *locale_variable);
+
+/*******************************************************************************
+************************ Language Configuaration *******************************
+*******************************************************************************/
+/* rcclist.c */
+rcc_language_ptr *rccGetLanguageList(rcc_context ctx);
+rcc_charset *rccGetCharsetList(rcc_context ctx, rcc_language_id language_id);
+rcc_engine_ptr *rccGetEngineList(rcc_context ctx, rcc_language_id language_id);
+rcc_charset *rccGetCurrentCharsetList(rcc_context ctx);
+rcc_engine_ptr *rccGetCurrentEngineList(rcc_context ctx);
+rcc_charset *rccGetCurrentAutoCharsetList(rcc_context ctx);
+rcc_class_ptr *rccGetClassList(rcc_context ctx);
+
/*******************************************************************************
************************ RCC_STRING Manipulations ******************************
@@ -238,4 +267,4 @@ int rccLoad(rcc_context ctx);
}
#endif
-#endif /* LIBRCC_H */
+#endif /* _LIBRCC_H */
diff --git a/src/lngconfig.c b/src/lngconfig.c
index b7c40c4..5de0fae 100644
--- a/src/lngconfig.c
+++ b/src/lngconfig.c
@@ -116,8 +116,6 @@ int rccConfigInit(rcc_language_config config, rcc_context ctx) {
config->language = NULL;
config->charset = charsets;
config->engine = -1;
- for (i=0;i<RCC_MAX_OPTIONS;i++)
- config->options[i] = 0;
return 0;
}
@@ -161,7 +159,6 @@ rcc_language_config rccGetCurrentConfig(rcc_context ctx) {
return rccGetConfig(ctx, language_id);
}
-
rcc_engine_id rccConfigGetSelectedEngine(rcc_language_config config) {
if (!config) return -1;
@@ -270,11 +267,6 @@ const char *rccConfigGetCurrentCharsetName(rcc_language_config config, rcc_class
return rccConfigGetCharsetName(config, charset_id);
}
-rcc_option_value rccConfigGetOption(rcc_language_config config, rcc_option option) {
- if ((!config)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
-
- return config->options[option];
-}
int rccConfigSetEngine(rcc_language_config config, rcc_engine_id engine_id) {
unsigned int i;
@@ -325,16 +317,6 @@ int rccConfigSetCharsetByName(rcc_language_config config, rcc_class_id class_id,
return rccConfigSetCharset(config, class_id, charset_id);
}
-int rccConfigSetOption(rcc_language_config config, rcc_option option, rcc_option_value value) {
- if ((!config)||(option>=RCC_MAX_OPTIONS)) return -1;
- if (config->options[option] != value) {
- if (config->ctx->current_config == config) config->ctx->configure = 1;
- config->options[option]=value;
- }
-
- return 0;
-}
-
rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char *locale_variable) {
int err;
rcc_charset *charsets;
@@ -359,3 +341,31 @@ rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char
return rccConfigGetCharsetByName(config, stmp);
}
+
+/*
+int rccConfigInit(rcc_language_config config, rcc_context ctx) {
+ for (i=0;i<RCC_MAX_OPTIONS;i++)
+ config->options[i] = 0;
+}
+
+rcc_option_value rccConfigGetOption(rcc_language_config config, rcc_option option) {
+ if ((!config)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
+
+ return config->options[option];
+}
+
+int rccConfigSetOption(rcc_language_config config, rcc_option option, rcc_option_value value) {
+ if ((!config)||(option>=RCC_MAX_OPTIONS)) return -1;
+ if (config->options[option] != value) {
+ if (config->ctx->current_config == config) config->ctx->configure = 1;
+ config->options[option]=value;
+ }
+
+ return 0;
+}
+
+rcc_option_value rccConfigGetOption(rcc_language_config config, rcc_option option);
+int rccConfigSetOption(rcc_language_config config, rcc_option option, rcc_option_value value);
+#define rccGetOption(ctx, option) rccConfigGetOption(ctx->current_config, option)
+#define rccSetOption(ctx,option,value) rccConfigSetOption(ctx->current_config, option, value)
+*/
diff --git a/src/opt.c b/src/opt.c
new file mode 100644
index 0000000..ec4684f
--- /dev/null
+++ b/src/opt.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+#include "internal.h"
+#include "opt.h"
+
+rcc_option_value rccConfigGetOption(rcc_context ctx, rcc_option option) {
+ if ((!ctx)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
+
+ return ctx->options[option];
+}
+
+int rccConfigSetOption(rcc_context ctx, rcc_option option, rcc_option_value value) {
+ if ((!ctx)||(option>=RCC_MAX_OPTIONS)) return -1;
+
+ if (ctx->options[option] != value) {
+ ctx->configure = 1;
+ ctx->options[option]=value;
+ }
+
+ return 0;
+}
diff --git a/src/opt.h b/src/opt.h
new file mode 100644
index 0000000..566cf1e
--- /dev/null
+++ b/src/opt.h
@@ -0,0 +1,5 @@
+#ifndef _RCC_OPT_H
+#define _RCC_OPT_H
+
+
+#endif /* _RCC_OPT_H */
diff --git a/src/rccconfig.c b/src/rccconfig.c
index 7caabea..c77b27a 100644
--- a/src/rccconfig.c
+++ b/src/rccconfig.c
@@ -25,72 +25,98 @@ rcc_engine rcc_russian_engine = {
};
rcc_language rcc_default_languages[] = {
-{"default", "Autodetect", {"Default", NULL}, {
+{"default", {"Default", NULL}, {
&rcc_default_engine,
NULL
}},
-{"off", "Dissable", {"Default", NULL}, {
+{"off", {"Default", NULL}, {
&rcc_default_engine,
NULL
}},
-{"ru","Russian", {"Default","KOI8-R","CP1251","UTF-8","IBM866","MACCYRILLIC","ISO8859-5", NULL}, {
+{"ru", {"Default","KOI8-R","CP1251","UTF-8","IBM866","MACCYRILLIC","ISO8859-5", NULL}, {
&rcc_russian_engine,
&rcc_default_engine,
NULL
}},
-{"uk","Ukrainian", {"Default","KOI8-U","CP1251","UTF-8","IBM855","MACCYRILLIC","ISO8859-5","CP1125", NULL}, {
+{"uk", {"Default","KOI8-U","CP1251","UTF-8","IBM855","MACCYRILLIC","ISO8859-5","CP1125", NULL}, {
&rcc_russian_engine,
&rcc_default_engine,
NULL
}},
-{"be","Belarussian",{"Default", "UTF-8", "CP1251", "IBM866", "ISO-8859-5", "KOI8-UNI", "maccyr" "IBM855", NULL},{
+{"be", {"Default", "UTF-8", "CP1251", "IBM866", "ISO-8859-5", "KOI8-UNI", "maccyr" "IBM855", NULL},{
&rcc_default_engine,
NULL
}},
-{"bg","Bulgarian",{"Default", "UTF-8", "CP1251", "ISO-8859-5", "IBM855", "maccyr", "ECMA-113", NULL},{
+{"bg", {"Default", "UTF-8", "CP1251", "ISO-8859-5", "IBM855", "maccyr", "ECMA-113", NULL},{
&rcc_default_engine,
NULL
}},
-{"cz","Czech",{"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "KEYBCS2", "macce", "KOI-8_CS_2", "CORK", NULL},{
+{"cz", {"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "KEYBCS2", "macce", "KOI-8_CS_2", "CORK", NULL},{
&rcc_default_engine,
NULL
}},
-{"es","Estonian",{"Default", "UTF-8", "ISO-8859-4", "CP1257", "IBM775", "ISO-8859-13", "macce", "baltic", NULL},{
+{"es", {"Default", "UTF-8", "ISO-8859-4", "CP1257", "IBM775", "ISO-8859-13", "macce", "baltic", NULL},{
&rcc_default_engine,
NULL
}},
-{"hr","Croatian",{"Default", "UTF-8", "CP1250", "ISO-8859-2", "IBM852", "macce", "CORK", NULL},{
+{"hr", {"Default", "UTF-8", "CP1250", "ISO-8859-2", "IBM852", "macce", "CORK", NULL},{
&rcc_default_engine,
NULL
}},
-{"hu","Hungarian",{"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "macce", "CORK", NULL},{
+{"hu", {"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "macce", "CORK", NULL},{
&rcc_default_engine,
NULL
}},
-{"lt","Lithuanian",{"Default", "UTF-8", "CP1257", "ISO-8859-4", "IBM775", "ISO-8859-13", "macce", "baltic", NULL},{
+{"lt", {"Default", "UTF-8", "CP1257", "ISO-8859-4", "IBM775", "ISO-8859-13", "macce", "baltic", NULL},{
&rcc_default_engine,
NULL
}},
-{"lv","Latvian",{"Default", "UTF-8", "CP1257", "ISO-8859-4", "IBM775", "ISO-8859-13", "macce", "baltic", NULL},{
+{"lv", {"Default", "UTF-8", "CP1257", "ISO-8859-4", "IBM775", "ISO-8859-13", "macce", "baltic", NULL},{
&rcc_default_engine,
NULL
}},
-{"pl","Polish",{"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "macce", "ISO-8859-13", "ISO-8859-16", "baltic", "CORK", NULL},{
+{"pl", {"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "macce", "ISO-8859-13", "ISO-8859-16", "baltic", "CORK", NULL},{
&rcc_default_engine,
NULL
}},
-{"sk","Slovak",{"Default", "UTF-8", "CP1250", "ISO-8859-2", "IBM852", "KEYBCS2", "macce", "KOI-8_CS_2", "CORK", NULL},{
+{"sk", {"Default", "UTF-8", "CP1250", "ISO-8859-2", "IBM852", "KEYBCS2", "macce", "KOI-8_CS_2", "CORK", NULL},{
&rcc_default_engine,
NULL
}},
-{"sl","Slovenian",{"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "macce", "CORK", NULL},{
+{"sl", {"Default", "UTF-8", "ISO-8859-2", "CP1250", "IBM852", "macce", "CORK", NULL},{
&rcc_default_engine,
NULL
}},
-{"zh","Chinese",{"Default", "UTF-8", "GB2312", "GBK", "GB18030", "BIG5", NULL},{
+{"zh", {"Default", "UTF-8", "GB2312", "GBK", "GB18030", "BIG5", NULL},{
&rcc_default_engine,
NULL
}},
{NULL}
};
+rcc_language_name rcc_default_language_names[RCC_MAX_LANGUAGES+1] = {
+{"default", "Autodetect"},
+{"off", "Dissable"},
+{"ru","Russian"},
+{"uk","Ukrainian"},
+{"be","Belarussian"},
+{"bg","Bulgarian"},
+{"cz","Czech"},
+{"es","Estonian"},
+{"hr","Croatian"},
+{"hu","Hungarian"},
+{"lt","Lithuanian"},
+{"lv","Latvian"},
+{"pl","Polish"},
+{"sk","Slovak"},
+{"sl","Slovenian"},
+{"zh","Chinese"},
+{NULL, NULL}
+};
+
+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}
+};
diff --git a/src/rccconfig.h b/src/rccconfig.h
index ac74dbe..8ca4810 100644
--- a/src/rccconfig.h
+++ b/src/rccconfig.h
@@ -14,4 +14,7 @@ extern rcc_engine rcc_russian_engine;
extern rcc_language rcc_default_languages[];
+extern rcc_language_name rcc_default_language_names[];
+extern rcc_option_name rcc_default_option_names[];
+
#endif /* _RCC_CONFIG_H */
diff --git a/src/rccenca.c b/src/rccenca.c
index d01e3d8..20e1eb4 100644
--- a/src/rccenca.c
+++ b/src/rccenca.c
@@ -49,7 +49,7 @@ void rccEncaFreeContext(rcc_engine_context ctx) {
#endif /* RCC_ENCA_SUPPORT */
}
-rcc_charset_id rccEnca(rcc_engine_context ctx, char *buf, int len) {
+rcc_charset_id rccEnca(rcc_engine_context ctx, const char *buf, int len) {
#ifdef RCC_ENCA_SUPPORT
rcc_engine_internal internal;
const char *charset;
diff --git a/src/rcclist.c b/src/rcclist.c
new file mode 100644
index 0000000..dc26d7e
--- /dev/null
+++ b/src/rcclist.c
@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include "internal.h"
+
+rcc_language_ptr *rccGetLanguageList(rcc_context ctx) {
+ if (!ctx) return NULL;
+ return ctx->languages;
+}
+
+rcc_charset *rccGetCharsetList(rcc_context ctx, rcc_language_id language_id) {
+ if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return NULL;
+ return ctx->languages[language_id]->charsets;
+}
+
+rcc_engine_ptr *rccGetEngineList(rcc_context ctx, rcc_language_id language_id) {
+ if ((!ctx)||(language_id<0)||(language_id>=ctx->n_languages)) return NULL;
+ return ctx->languages[language_id]->engines;
+}
+
+rcc_charset *rccGetCurrentCharsetList(rcc_context ctx) {
+ rcc_language_id language_id;
+
+ if (!ctx) return NULL;
+
+ language_id = rccGetCurrentLanguage(ctx);
+ if (language_id<0) return NULL;
+
+ return rccGetCharsetList(ctx, language_id);
+}
+
+rcc_engine_ptr *rccGetCurrentEngineList(rcc_context ctx) {
+ rcc_language_id language_id;
+
+ if (!ctx) return NULL;
+
+ language_id = rccGetCurrentLanguage(ctx);
+ if (language_id<0) return NULL;
+
+ return rccGetEngineList(ctx, language_id);
+}
+
+rcc_charset *rccGetCurrentAutoCharsetList(rcc_context ctx) {
+ rcc_language_id language_id;
+ rcc_engine_id engine_id;
+
+ if (!ctx) return NULL;
+
+ language_id = rccGetCurrentLanguage(ctx);
+ engine_id = rccGetCurrentEngine(ctx);
+ if ((language_id<0)||(engine_id<0)) return NULL;
+
+
+ return ctx->languages[language_id]->engines[engine_id]->charsets;
+}
+
+rcc_class_ptr *rccGetClassList(rcc_context ctx) {
+ if (!ctx) return NULL;
+
+ return ctx->classes;
+}
diff --git a/src/rcclist.h b/src/rcclist.h
new file mode 100644
index 0000000..000e09c
--- /dev/null
+++ b/src/rcclist.h
@@ -0,0 +1,5 @@
+#ifndef _RCC_LIST_H
+#define _RCC_LIST_H
+
+
+#endif /* _RCC_LIST_H */
diff --git a/src/xml.c b/src/xml.c
index 40bb3d4..5026fec 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -2,11 +2,13 @@
#include "internal.h"
/* pass programm name */
+
+/* Load and Then Save */
+/* flock */
int rccSave(rcc_context ctx) {
return 0;
}
-/* Load and Then Save */
int rccLoad(rcc_context ctx) {
return 0;
}