Debian Codegraph @

nx-X11/lib/src/xlibi18n/XlcPublic.h

raw
1 /*
2 * Copyright 1992, 1993 by TOSHIBA Corp.
3 *
4 * Permission to use, copy, modify, and distribute this software and its
5 * documentation for any purpose and without fee is hereby granted, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of TOSHIBA not be used in advertising
9 * or publicity pertaining to distribution of the software without specific,
10 * written prior permission. TOSHIBA make no representations about the
11 * suitability of this software for any purpose. It is provided "as is"
12 * without express or implied warranty.
13 *
14 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 * SOFTWARE.
21 *
22 * Author: Katsuhisa Yano TOSHIBA Corp.
23 * [email protected]
24 */
25 /*
26 * Copyright 1995 by FUJITSU LIMITED
27 * This is source code modified by FUJITSU LIMITED under the Joint
28 * Development Agreement for the CDE/Motif PST.
29 *
30 * Modifier: Takanori Tateno FUJITSU LIMITED
31 *
32 */
33 /*
34 * Most of this API is documented in i18n/Framework.PS
35 */
36
37 #ifndef _XLCPUBLIC_H_
38 #define _XLCPUBLIC_H_
39
40 #include "Xlcint.h"
41
42
43 /*
44 * Character sets.
45 */
46
47 /* Every character set has a "side". It denotes the range of byte values for
48 which the character set is responsible. This means that the character
49 set's encoded characters will only assumes bytes within the range, and
50 that the character set can be used simultaneously with another character
51 set responsible for a disjoint range. */
52 typedef enum {
53 XlcUnknown,
54 XlcC0, /* responsible for values 0x00..0x1F */
55 XlcGL, /* responsible for values 0x00..0x7F or 0x20..0x7F */
56 XlcC1, /* responsible for values 0x80..0x9F */
57 XlcGR, /* responsible for values 0x80..0xFF or 0xA0..0xFF */
58 XlcGLGR, /* responsible for values 0x00..0xFF */
59 XlcOther, /* unused */
60 XlcNONE
61 } XlcSide;
62
63 /* Data read from XLC_LOCALE files.
64 XXX Apparently superseded by _XUDCGlyphRegion. */
65 typedef struct _UDCArea {
66 unsigned long start;
67 unsigned long end;
68 } UDCAreaRec, *UDCArea;
69
70 /* Where the character set comes from. */
71 typedef enum {
72 CSsrcUndef, /* unused */
73 CSsrcStd, /* defined in libX11 */
74 CSsrcXLC /* defined in an XLC_LOCALE file */
75 } CSSrc;
76
77 /* These are the supported properties of XlcCharSet. */
78 #define XlcNCharSize "charSize"
79 #define XlcNControlSequence "controlSequence"
80 #define XlcNEncodingName "encodingName"
81 #define XlcNName "name"
82 #define XlcNSetSize "setSize"
83 #define XlcNSide "side"
84
85 /* This is the structure of an XlcCharSet.
86 Once allocated, they are never freed. */
87 typedef struct _XlcCharSetRec {
88 /* Character set name, including side suffix */
89 const char *name;
90 XrmQuark xrm_name;
91
92 /* XLFD encoding name, no side suffix */
93 const char *encoding_name;
94 XrmQuark xrm_encoding_name;
95
96 /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */
97 XlcSide side;
98
99 /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */
100 int char_size;
101 /* Classification of the character set according to ISO-2022 */
102 int set_size; /* e.g. 94 or 96 */
103 const char *ct_sequence; /* control sequence of CT */
104 /* (normally at most 4 bytes) */
105
106 /* for UDC */
107 Bool string_encoding;
108 UDCArea udc_area;
109 int udc_area_num;
110
111 /* Description source */
112 CSSrc source;
113 } XlcCharSetRec, *XlcCharSet;
114
115 _XFUNCPROTOBEGIN
116
117 /* Returns the charset with the given name (including side suffix).
118 Returns NULL if not found. */
119 extern XlcCharSet _XlcGetCharSet(
120 const char* name
121 );
122
123 /* Returns the charset with the given encoding (no side suffix) and
124 responsible for at least the given side (XlcGL or XlcGR).
125 Returns NULL if not found. */
126 extern XlcCharSet _XlcGetCharSetWithSide(
127 const char* encoding_name,
128 XlcSide side
129 );
130
131 /* Registers an XlcCharSet in the list of character sets.
132 Returns True if successful. */
133 extern Bool _XlcAddCharSet(
134 XlcCharSet charset
135 );
136
137 /* Retrieves a number of attributes of an XlcCharSet.
138 Return NULL if successful, otherwise the name of the first argument
139 specifying a nonexistent attribute. */
140 extern char *_XlcGetCSValues(
141 XlcCharSet charset,
142 ...
143 );
144
145 _XFUNCPROTOEND
146
147
148 #define XlcNCodeset "codeset"
149 #define XlcNDefaultString "defaultString"
150 #define XlcNLanguage "language"
151 #define XlcNMbCurMax "mbCurMax"
152 #define XlcNStateDependentEncoding "stateDependentEncoding"
153 #define XlcNTerritory "territory"
154
155 typedef struct _FontScope {
156 unsigned long start;
157 unsigned long end;
158 unsigned long shift;
159 unsigned long shift_direction;
160 } FontScopeRec, *FontScope;
161
162 /*
163 * conversion methods
164 */
165
166 typedef struct _XlcConvRec *XlcConv;
167
168 typedef XlcConv (*XlcOpenConverterProc)(
169 XLCd from_lcd,
170 const char* from_type,
171 XLCd to_lcd,
172 const char* to_type
173 );
174
175 typedef void (*XlcCloseConverterProc)(
176 XlcConv /* conv */
177 );
178
179 typedef int (*XlcConvertProc)(
180 XlcConv /* conv */,
181 XPointer* /* from */,
182 int* /* from_left */,
183 XPointer* /* to */,
184 int* /* to_left */,
185 XPointer* /* args */,
186 int /* num_args */
187 );
188
189 typedef void (*XlcResetConverterProc)(
190 XlcConv /* conv */
191 );
192
193 typedef struct _XlcConvMethodsRec{
194 XlcCloseConverterProc close;
195 XlcConvertProc convert;
196 XlcResetConverterProc reset;
197 } XlcConvMethodsRec, *XlcConvMethods;
198
199 /*
200 * conversion data
201 */
202
203 #define XlcNMultiByte "multiByte"
204 #define XlcNWideChar "wideChar"
205 #define XlcNCompoundText "compoundText"
206 #define XlcNString "string"
207 #define XlcNUtf8String "utf8String"
208 #define XlcNCharSet "charSet"
209 #define XlcNCTCharSet "CTcharSet"
210 #define XlcNFontCharSet "FontCharSet"
211 #define XlcNChar "char"
212 #define XlcNUcsChar "UCSchar"
213
214 typedef struct _XlcConvRec {
215 XlcConvMethods methods;
216 XPointer state;
217 } XlcConvRec;
218
219
220 _XFUNCPROTOBEGIN
221
222 extern Bool _XInitOM(
223 XLCd /* lcd */
224 );
225
226 extern Bool _XInitIM(
227 XLCd /* lcd */
228 );
229
230 extern XIM _XimOpenIM(
231 XLCd /* lcd */,
232 Display * /* dpy */,
233 XrmDatabase /* rdb */,
234 char * /* res_name */,
235 char * /* res_class */
236 );
237
238 extern char *_XGetLCValues(
239 XLCd /* lcd */,
240 ...
241 );
242
243 extern XlcConv _XlcOpenConverter(
244 XLCd from_lcd,
245 const char* from_type,
246 XLCd to_lcd,
247 const char* to_type
248 );
249
250 extern void _XlcCloseConverter(
251 XlcConv conv
252 );
253
254 extern int _XlcConvert(
255 XlcConv conv,
256 XPointer* from,
257 int* from_left,
258 XPointer* to,
259 int* to_left,
260 XPointer* args,
261 int num_args
262 );
263
264 extern void _XlcResetConverter(
265 XlcConv conv
266 );
267
268 extern Bool _XlcSetConverter(
269 XLCd from_lcd,
270 const char* from_type,
271 XLCd to_lcd,
272 const char* to_type,
273 XlcOpenConverterProc open_converter
274 );
275
276 extern void _XlcGetResource(
277 XLCd lcd,
278 const char* category,
279 const char* _class,
280 char*** value,
281 int* count
282 );
283
284 extern char *_XlcFileName(
285 XLCd lcd,
286 const char* category
287 );
288
289 extern int _Xwcslen(
290 wchar_t* /* wstr */
291 );
292
293 extern wchar_t *_Xwcscpy(
294 wchar_t* /* wstr1 */,
295 wchar_t* /* wstr2 */
296 );
297
298 extern wchar_t *_Xwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len);
299 extern int _Xwcscmp(wchar_t *wstr1, wchar_t *wstr2);
300 extern int _Xwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len);
301
302 /* Compares two ISO 8859-1 strings, ignoring case of ASCII letters.
303 Like strcasecmp in an ASCII locale. */
304 extern int _XlcCompareISOLatin1(
305 const char* str1,
306 const char* str2
307 );
308
309 /* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring
310 case of ASCII letters. Like strncasecmp in an ASCII locale. */
311 extern int _XlcNCompareISOLatin1(
312 const char* str1,
313 const char* str2,
314 int len
315 );
316
317 extern XOM
318 _XDefaultOpenOM(
319 XLCd lcd, Display *dpy, XrmDatabase rdb,
320 _Xconst char *res_name, _Xconst char *res_class);
321
322 _XFUNCPROTOEND
323
324 #endif /* _XLCPUBLIC_H_ */