summaryrefslogtreecommitdiffstats
path: root/src/librcc.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-29 03:26:28 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-29 03:26:28 +0000
commite3f702e83a26468ee44f3f342a7a40a252f4603c (patch)
tree5ff76e9d11a9fdbdb493683d0f0840f46c67b6f8 /src/librcc.c
parentcfaef1b6c9f33fbaa114628cf513d129bdff3c1c (diff)
downloadlibrcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.tar.gz
librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.tar.bz2
librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.tar.xz
librcc-e3f702e83a26468ee44f3f342a7a40a252f4603c.zip
Translation
- Language Translation using libtranslate is implemented - Autoengine sets current charset (option)
Diffstat (limited to 'src/librcc.c')
-rw-r--r--src/librcc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/librcc.c b/src/librcc.c
index ec2df39..c0112df 100644
--- a/src/librcc.c
+++ b/src/librcc.c
@@ -11,6 +11,9 @@
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif /* HAVE_SYS_STAT_H */
#ifdef HAVE_PWD_H
# include <pwd.h>
@@ -23,6 +26,8 @@
#include "plugin.h"
#include "engine.h"
#include "rccxml.h"
+#include "rccexternal.h"
+#include "rcctranslate.h"
static int initialized = 0;
char *rcc_home_dir = NULL;
@@ -43,6 +48,9 @@ rcc_compiled_configuration rccGetCompiledConfiguration() {
#ifdef HAVE_DB_H
compiled_configuration.flags|=RCC_CC_FLAG_HAVE_BERKLEY_DB;
#endif /* HAVE_DB_H */
+#ifdef HAVE_LIBTRANSLATE
+ compiled_configuration.flags|=RCC_CC_FLAG_HAVE_LIBTRANSLATE;
+#endif /* HAVE_LIBTRANSLATE */
return &compiled_configuration;
}
@@ -72,7 +80,12 @@ int rccInit() {
memcpy(rcc_default_languages, rcc_default_languages_embeded, (RCC_MAX_LANGUAGES + 1)*sizeof(rcc_language));
memcpy(rcc_option_descriptions, rcc_option_descriptions_embeded, (RCC_MAX_OPTIONS + 1)*sizeof(rcc_option_description));
+#ifdef HAVE_LIBTRANSLATE
+ rccExternalInit();
+#endif /* HAVE_LIBTRANSLATE */
+
err = rccPluginInit();
+ if (!err) err = rccTranslateInit();
if (!err) err = rccXmlInit(1);
if (!err) err = rccEngineInit();
@@ -94,8 +107,11 @@ void rccFree() {
rccEngineFree();
rccXmlFree();
+ rccTranslateFree();
rccPluginFree();
+ rccExternalFree();
+
if (rcc_home_dir) {
free(rcc_home_dir);
rcc_home_dir = NULL;
@@ -274,6 +290,35 @@ void rccFreeContext(rcc_context ctx) {
}
}
+int rccInitDb4(rcc_context ctx, const char *name, rcc_db4_flags flags) {
+ size_t size;
+ char *dbname;
+
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return -1;
+ }
+
+ if (!name) name = "default";
+
+ size = strlen(rcc_home_dir) + strlen(name) + 32;
+ dbname = (char*)malloc(size*sizeof(char));
+ if (!dbname) return -1;
+
+ sprintf(dbname,"%s/.rcc/",rcc_home_dir);
+ mkdir(dbname, 00644);
+
+ sprintf(dbname,"%s/.rcc/%s.db/",rcc_home_dir,name);
+ mkdir(dbname, 00644);
+
+ ctx->db4ctx = rccDb4CreateContext(dbname, flags);
+ free(dbname);
+
+ if (!ctx->db4ctx) return -1;
+
+ return 0;
+}
+
int rccLockConfiguration(rcc_context ctx, unsigned int lock_code) {
if (!ctx) {
if (rcc_default_ctx) ctx = rcc_default_ctx;