1 /*
2 LibRCC - module providing access to actual RCC configuration
3
4 Copyright (C) 2005-2008 Suren A. Chilingaryan <csa@dside.dyndns.org>
5
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License version 2.1 or later
8 as published by the Free Software Foundation.
9
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include <stdio.h>
21 #include "internal.h"
22
rccGetCharsetNumber(rcc_context ctx)23 int rccGetCharsetNumber(rcc_context ctx) {
24 if (!ctx) {
25 if (rcc_default_ctx) ctx = rcc_default_ctx;
26 else return 0;
27 }
28
29 return rccConfigGetCharsetNumber(ctx->current_config);
30 }
31
rccGetClassCharsetNumber(rcc_context ctx,rcc_class_id class_id)32 int rccGetClassCharsetNumber(rcc_context ctx, rcc_class_id class_id) {
33 if (!ctx) {
34 if (rcc_default_ctx) ctx = rcc_default_ctx;
35 else return 0;
36 }
37
38 return rccConfigGetClassCharsetNumber(ctx->current_config, class_id);
39 }
40
rccGetEngineNumber(rcc_context ctx)41 int rccGetEngineNumber(rcc_context ctx) {
42 if (!ctx) {
43 if (rcc_default_ctx) ctx = rcc_default_ctx;
44 else return 0;
45 }
46
47 return rccConfigGetEngineNumber(ctx->current_config);
48 }
49
50
rccGetEngineName(rcc_context ctx,rcc_engine_id engine_id)51 const char *rccGetEngineName(rcc_context ctx, rcc_engine_id engine_id) {
52 if (!ctx) {
53 if (rcc_default_ctx) ctx = rcc_default_ctx;
54 else return NULL;
55 }
56
57 return rccConfigGetEngineName(ctx->current_config, engine_id);
58 }
59
rccGetCharsetName(rcc_context ctx,rcc_charset_id charset_id)60 const char *rccGetCharsetName(rcc_context ctx, rcc_charset_id charset_id) {
61 if (!ctx) {
62 if (rcc_default_ctx) ctx = rcc_default_ctx;
63 else return NULL;
64 }
65
66 return rccConfigGetCharsetName(ctx->current_config, charset_id);
67 }
68
rccGetClassCharsetName(rcc_context ctx,rcc_class_id class_id,rcc_charset_id charset_id)69 const char *rccGetClassCharsetName(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id) {
70 if (!ctx) {
71 if (rcc_default_ctx) ctx = rcc_default_ctx;
72 else return NULL;
73 }
74
75 return rccConfigGetClassCharsetName(ctx->current_config, class_id, charset_id);
76 }
77
rccGetAutoCharsetName(rcc_context ctx,rcc_autocharset_id charset_id)78 const char *rccGetAutoCharsetName(rcc_context ctx, rcc_autocharset_id charset_id) {
79 if (!ctx) {
80 if (rcc_default_ctx) ctx = rcc_default_ctx;
81 else return NULL;
82 }
83
84 return rccConfigGetAutoCharsetName(ctx->current_config, charset_id);
85 }
86
rccGetEngineByName(rcc_context ctx,const char * name)87 rcc_engine_id rccGetEngineByName(rcc_context ctx, const char *name) {
88 if (!ctx) {
89 if (rcc_default_ctx) ctx = rcc_default_ctx;
90 else return (rcc_engine_id)-1;
91 }
92
93 return rccConfigGetEngineByName(ctx->current_config, name);
94 }
95
rccGetCharsetByName(rcc_context ctx,const char * name)96 rcc_charset_id rccGetCharsetByName(rcc_context ctx, const char *name) {
97 if (!ctx) {
98 if (rcc_default_ctx) ctx = rcc_default_ctx;
99 else return (rcc_charset_id)-1;
100 }
101
102 return rccConfigGetCharsetByName(ctx->current_config, name);
103 }
104
rccGetClassCharsetByName(rcc_context ctx,rcc_class_id class_id,const char * name)105 rcc_charset_id rccGetClassCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name) {
106 if (!ctx) {
107 if (rcc_default_ctx) ctx = rcc_default_ctx;
108 else return (rcc_charset_id)-1;
109 }
110
111 return rccConfigGetClassCharsetByName(ctx->current_config, class_id, name);
112 }
113
rccGetAutoCharsetByName(rcc_context ctx,const char * name)114 rcc_autocharset_id rccGetAutoCharsetByName(rcc_context ctx, const char *name) {
115 if (!ctx) {
116 if (rcc_default_ctx) ctx = rcc_default_ctx;
117 else return (rcc_autocharset_id)-1;
118 }
119
120 return rccConfigGetAutoCharsetByName(ctx->current_config, name);
121 }
122
rccGetSelectedEngine(rcc_context ctx)123 rcc_engine_id rccGetSelectedEngine(rcc_context ctx) {
124 if (!ctx) {
125 if (rcc_default_ctx) ctx = rcc_default_ctx;
126 else return (rcc_engine_id)-1;
127 }
128
129 return rccConfigGetSelectedEngine(ctx->current_config);
130 }
131
rccGetSelectedEngineName(rcc_context ctx)132 const char *rccGetSelectedEngineName(rcc_context ctx) {
133 if (!ctx) {
134 if (rcc_default_ctx) ctx = rcc_default_ctx;
135 else return NULL;
136 }
137
138 return rccConfigGetSelectedEngineName(ctx->current_config);
139 }
140
rccGetCurrentEngine(rcc_context ctx)141 rcc_engine_id rccGetCurrentEngine(rcc_context ctx) {
142 if (!ctx) {
143 if (rcc_default_ctx) ctx = rcc_default_ctx;
144 else return (rcc_engine_id)-1;
145 }
146 return rccConfigGetCurrentEngine(ctx->current_config);
147 }
148
rccGetCurrentEngineName(rcc_context ctx)149 const char *rccGetCurrentEngineName(rcc_context ctx) {
150 if (!ctx) {
151 if (rcc_default_ctx) ctx = rcc_default_ctx;
152 else return NULL;
153 }
154 return rccConfigGetCurrentEngineName(ctx->current_config);
155 }
156
rccGetSelectedCharset(rcc_context ctx,rcc_class_id class_id)157 rcc_charset_id rccGetSelectedCharset(rcc_context ctx, rcc_class_id class_id) {
158 if (!ctx) {
159 if (rcc_default_ctx) ctx = rcc_default_ctx;
160 else return (rcc_charset_id)-1;
161 }
162 return rccConfigGetSelectedCharset(ctx->current_config, class_id);
163 }
164
rccGetSelectedCharsetName(rcc_context ctx,rcc_class_id class_id)165 const char *rccGetSelectedCharsetName(rcc_context ctx, rcc_class_id class_id) {
166 if (!ctx) {
167 if (rcc_default_ctx) ctx = rcc_default_ctx;
168 else return NULL;
169 }
170 return rccConfigGetSelectedCharsetName(ctx->current_config, class_id);
171 }
172
rccGetCurrentCharset(rcc_context ctx,rcc_class_id class_id)173 rcc_charset_id rccGetCurrentCharset(rcc_context ctx, rcc_class_id class_id) {
174 if (!ctx) {
175 if (rcc_default_ctx) ctx = rcc_default_ctx;
176 else return (rcc_charset_id)-1;
177 }
178 return rccConfigGetCurrentCharset(ctx->current_config, class_id);
179 }
180
rccGetCurrentCharsetName(rcc_context ctx,rcc_class_id class_id)181 const char *rccGetCurrentCharsetName(rcc_context ctx, rcc_class_id class_id) {
182 if (!ctx) {
183 if (rcc_default_ctx) ctx = rcc_default_ctx;
184 else return NULL;
185 }
186 return rccConfigGetCurrentCharsetName(ctx->current_config, class_id);
187 }
188
rccSetEngine(rcc_context ctx,rcc_engine_id engine_id)189 int rccSetEngine(rcc_context ctx, rcc_engine_id engine_id) {
190 if (!ctx) {
191 if (rcc_default_ctx) ctx = rcc_default_ctx;
192 else return -1;
193 }
194 return rccConfigSetEngine(ctx->current_config, engine_id);
195 }
196
rccSetCharset(rcc_context ctx,rcc_class_id class_id,rcc_charset_id charset_id)197 int rccSetCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id) {
198 if (!ctx) {
199 if (rcc_default_ctx) ctx = rcc_default_ctx;
200 else return -1;
201 }
202 return rccConfigSetCharset(ctx->current_config, class_id, charset_id);
203 }
204
rccSetEngineByName(rcc_context ctx,const char * name)205 int rccSetEngineByName(rcc_context ctx, const char *name) {
206 if (!ctx) {
207 if (rcc_default_ctx) ctx = rcc_default_ctx;
208 else return -1;
209 }
210 return rccConfigSetEngineByName(ctx->current_config, name);
211 }
212
rccSetCharsetByName(rcc_context ctx,rcc_class_id class_id,const char * name)213 int rccSetCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name) {
214 if (!ctx) {
215 if (rcc_default_ctx) ctx = rcc_default_ctx;
216 else return -1;
217 }
218 return rccConfigSetCharsetByName(ctx->current_config, class_id, name);
219 }
220
rccGetLocaleCharset(rcc_context ctx,const char * locale_variable)221 rcc_charset_id rccGetLocaleCharset(rcc_context ctx, const char *locale_variable) {
222 if (!ctx) {
223 if (rcc_default_ctx) ctx = rcc_default_ctx;
224 else return -1;
225 }
226 return rccConfigGetLocaleCharset(ctx->current_config, locale_variable);
227 }
228
rccGetLocaleClassCharset(rcc_context ctx,rcc_class_id class_id,const char * locale_variable)229 rcc_charset_id rccGetLocaleClassCharset(rcc_context ctx, rcc_class_id class_id, const char *locale_variable) {
230 if (!ctx) {
231 if (rcc_default_ctx) ctx = rcc_default_ctx;
232 else return -1;
233 }
234 return rccConfigGetLocaleClassCharset(ctx->current_config, class_id, locale_variable);
235 }
236
rccDetectCharset(rcc_context ctx,rcc_class_id class_id,const char * buf,size_t len)237 rcc_autocharset_id rccDetectCharset(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len) {
238 if (!ctx) {
239 if (rcc_default_ctx) ctx = rcc_default_ctx;
240 else return -1;
241 }
242
243 return rccConfigDetectCharset(ctx->current_config, class_id, buf, len);
244 }
245
rccIsDisabledCharset(rcc_context ctx,rcc_class_id class_id,rcc_charset_id charset_id)246 int rccIsDisabledCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id) {
247 if (!ctx) {
248 if (rcc_default_ctx) ctx = rcc_default_ctx;
249 else return -1;
250 }
251
252 return rccConfigIsDisabledCharset(ctx->current_config, class_id, charset_id);
253 }
254