summaryrefslogtreecommitdiffstats
path: root/src/rcclist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rcclist.c')
-rw-r--r--src/rcclist.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/src/rcclist.c b/src/rcclist.c
index 25e6d07..2664ed6 100644
--- a/src/rcclist.c
+++ b/src/rcclist.c
@@ -2,19 +2,33 @@
#include "internal.h"
rcc_language_ptr *rccGetLanguageList(rcc_context ctx) {
- if (!ctx) return NULL;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else 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;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
+
+ if ((language_id<0)||(language_id>=ctx->n_languages)) return NULL;
if (!language_id) language_id = rccGetCurrentLanguage(ctx);
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;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
+
+ if ((language_id<0)||(language_id>=ctx->n_languages)) return NULL;
if (!language_id) language_id = rccGetCurrentLanguage(ctx);
return ctx->languages[language_id]->engines;
@@ -23,10 +37,13 @@ rcc_engine_ptr *rccGetEngineList(rcc_context ctx, rcc_language_id language_id) {
rcc_charset *rccGetCurrentCharsetList(rcc_context ctx) {
rcc_language_id language_id;
- if (!ctx) return NULL;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
language_id = rccGetCurrentLanguage(ctx);
- if (language_id<0) return NULL;
+ if (language_id == (rcc_language_id)-1) return NULL;
return rccGetCharsetList(ctx, language_id);
}
@@ -34,10 +51,13 @@ rcc_charset *rccGetCurrentCharsetList(rcc_context ctx) {
rcc_engine_ptr *rccGetCurrentEngineList(rcc_context ctx) {
rcc_language_id language_id;
- if (!ctx) return NULL;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
language_id = rccGetCurrentLanguage(ctx);
- if (language_id<0) return NULL;
+ if (language_id == (rcc_language_id)-1) return NULL;
return rccGetEngineList(ctx, language_id);
}
@@ -46,18 +66,24 @@ rcc_charset *rccGetCurrentAutoCharsetList(rcc_context ctx) {
rcc_language_id language_id;
rcc_engine_id engine_id;
- if (!ctx) return NULL;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
language_id = rccGetCurrentLanguage(ctx);
engine_id = rccGetCurrentEngine(ctx);
- if ((language_id<0)||(engine_id<0)) return NULL;
+ if ((language_id == (rcc_language_id)-1)||(engine_id == (rcc_engine_id)-1)) return NULL;
return ctx->languages[language_id]->engines[engine_id]->charsets;
}
rcc_class_ptr *rccGetClassList(rcc_context ctx) {
- if (!ctx) return NULL;
-
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
+
return ctx->classes;
}