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 *			   	mopi@osa.ilab.toshiba.co.jp
24 */
25
26#ifndef _XLCPUBLICI_H_
27#define _XLCPUBLICI_H_
28
29#include "XlcPublic.h"
30
31#define XLC_PUBLIC(lcd, x)	(((XLCdPublic) lcd->core)->pub.x)
32#define XLC_PUBLIC_PART(lcd)	(&(((XLCdPublic) lcd->core)->pub))
33#define XLC_PUBLIC_METHODS(lcd)	(&(((XLCdPublicMethods) lcd->methods)->pub))
34
35/*
36 * XLCd public methods
37 */
38
39typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods;
40
41typedef XLCd (*XlcPubCreateProc)(
42    const char*		name,
43    XLCdMethods		methods
44);
45
46typedef Bool (*XlcPubInitializeProc)(
47    XLCd		lcd
48);
49
50typedef void (*XlcPubDestroyProc)(
51    XLCd		lcd
52);
53
54typedef char* (*XlcPubGetValuesProc)(
55    XLCd		lcd,
56    XlcArgList		args,
57    int			num_args
58);
59
60typedef void (*XlcPubGetResourceProc)(
61    XLCd		lcd,
62    const char*		category,
63    const char*		_class,
64    char***		value,
65    int*		count
66);
67
68typedef struct _XLCdPublicMethodsPart {
69    XLCdPublicMethods superclass;
70    XlcPubCreateProc create;
71    XlcPubInitializeProc initialize;
72    XlcPubDestroyProc destroy;
73    XlcPubGetValuesProc get_values;
74    XlcPubGetResourceProc get_resource;
75} XLCdPublicMethodsPart;
76
77typedef struct _XLCdPublicMethodsRec {
78    XLCdMethodsRec core;
79    XLCdPublicMethodsPart pub;
80} XLCdPublicMethodsRec;
81
82/*
83 * XLCd public data
84 */
85
86typedef struct _XLCdPublicPart {
87    char *siname;			/* for _XlcMapOSLocaleName() */
88    char *language;			/* language part of locale name */
89    char *territory;			/* territory part of locale name */
90    char *codeset;			/* codeset part of locale name */
91    char *encoding_name;		/* encoding name */
92    int mb_cur_max;			/* ANSI C MB_CUR_MAX */
93    Bool is_state_depend;		/* state-depend encoding */
94    const char *default_string;		/* for XDefaultString() */
95    XPointer xlocale_db;
96} XLCdPublicPart;
97
98typedef struct _XLCdPublicRec {
99    XLCdCoreRec core;
100    XLCdPublicPart pub;
101} XLCdPublicRec, *XLCdPublic;
102
103extern XLCdMethods _XlcPublicMethods;
104
105_XFUNCPROTOBEGIN
106
107extern XLCd _XlcCreateLC(
108    const char*		name,
109    XLCdMethods		methods
110);
111
112extern void _XlcDestroyLC(
113    XLCd		lcd
114);
115
116/* Fills into a freshly created XlcCharSet the fields that can be inferred
117   from the ESC sequence. These are side, char_size, set_size. */
118extern Bool _XlcParseCharSet(
119    XlcCharSet		charset
120);
121
122/* Creates a new XlcCharSet, given its name (including side suffix) and
123   Compound Text ESC sequence (normally at most 4 bytes). */
124extern XlcCharSet _XlcCreateDefaultCharSet(
125    const char*		name,
126    const char*		ct_sequence
127);
128
129extern XlcCharSet _XlcAddCT(
130    const char*		name,
131    const char*		ct_sequence
132);
133
134extern Bool _XlcInitCTInfo (void);
135
136extern XrmMethods _XrmDefaultInitParseInfo(
137    XLCd		lcd,
138    XPointer*		state
139);
140
141extern int _XmbTextPropertyToTextList(
142    XLCd		lcd,
143    Display*		dpy,
144    const XTextProperty* text_prop,
145    char***		list_ret,
146    int*		count_ret
147);
148
149extern int _XwcTextPropertyToTextList(
150    XLCd		lcd,
151    Display*		dpy,
152    const XTextProperty* text_prop,
153    wchar_t***		list_ret,
154    int*		count_ret
155);
156
157extern int _Xutf8TextPropertyToTextList(
158    XLCd		lcd,
159    Display*		dpy,
160    const XTextProperty* text_prop,
161    char***		list_ret,
162    int*		count_ret
163);
164
165extern int _XmbTextListToTextProperty(
166    XLCd		/* lcd */,
167    Display*		/* dpy */,
168    char**		/* list */,
169    int			/* count */,
170    XICCEncodingStyle	/* style */,
171    XTextProperty*	/* text_prop */
172);
173
174extern int _XwcTextListToTextProperty(
175    XLCd		/* lcd */,
176    Display*		/* dpy */,
177    wchar_t**		/* list */,
178    int			/* count */,
179    XICCEncodingStyle	/* style */,
180    XTextProperty*	/* text_prop */
181);
182
183extern int _Xutf8TextListToTextProperty(
184    XLCd		/* lcd */,
185    Display*		/* dpy */,
186    char**		/* list */,
187    int			/* count */,
188    XICCEncodingStyle	/* style */,
189    XTextProperty*	/* text_prop */
190);
191
192extern void _XwcFreeStringList(
193    XLCd		/* lcd */,
194    wchar_t**		/* list */
195);
196
197extern int _XlcResolveLocaleName(
198    const char*		lc_name,
199    XLCdPublicPart*	pub
200);
201
202extern int _XlcResolveI18NPath(
203    char*		buf,
204    int			buf_len
205);
206
207extern char *_XlcLocaleLibDirName(
208     char*             /* dir_name */,
209     size_t,	       /* dir_len */
210     const char*       /* lc_name */
211);
212
213extern char *_XlcLocaleDirName(
214     char*             /* dir_name */,
215     size_t,	       /* dir_len */
216     const char*       /* lc_name */
217);
218
219extern XPointer _XlcCreateLocaleDataBase(
220    XLCd		lcd
221);
222
223extern void _XlcDestroyLocaleDataBase(
224    XLCd		lcd
225);
226
227extern void _XlcGetLocaleDataBase(
228    XLCd		/* lcd */,
229    const char*		/* category */,
230    const char*		/* name */,
231    char***		/* value */,
232    int*		/* count */
233);
234
235#ifdef __APPLE__
236extern char *
237_Xsetlocale(
238    int           category,
239    _Xconst char  *name);
240#endif
241extern char *_XlcMapOSLocaleName(
242    char *osname,
243    char *siname);
244
245extern int
246_Xmbstoutf8(
247    char *ustr,
248    const char *str,
249    int len);
250extern int
251_Xlcmbstoutf8(
252    XLCd lcd,
253    char *ustr,
254    const char *str,
255    int len);
256extern int
257_Xmbstowcs(
258    wchar_t *wstr,
259    char *str,
260    int len);
261extern int
262_Xlcwcstombs(
263    XLCd lcd,
264    char *str,
265    wchar_t *wstr,
266    int len);
267extern int
268_Xlcmbstowcs(
269    XLCd lcd,
270    wchar_t *wstr,
271    char *str,
272    int len);
273extern int
274_Xwcstombs(
275    char *str,
276    wchar_t *wstr,
277    int len);
278extern int
279_Xlcmbtowc(
280    XLCd lcd,
281    wchar_t *wstr,
282    char *str,
283    int len);
284extern int
285_Xlcwctomb(
286    XLCd lcd,
287    char *str,
288    wchar_t wc);
289
290
291
292extern XPointer
293_Utf8GetConvByName(
294    const char *name);
295
296_XFUNCPROTOEND
297
298#endif  /* _XLCPUBLICI_H_ */
299