XlcGeneric.h revision 61b2299d
1/* $Xorg: XlcGeneric.h,v 1.3 2000/08/17 19:45:06 cpqbld Exp $ */
2/*
3 * Copyright 1992, 1993 by TOSHIBA Corp.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation for any purpose and without fee is hereby granted, provided
7 * that the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of TOSHIBA not be used in advertising
10 * or publicity pertaining to distribution of the software without specific,
11 * written prior permission. TOSHIBA make no representations about the
12 * suitability of this software for any purpose.  It is provided "as is"
13 * without express or implied warranty.
14 *
15 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21 * SOFTWARE.
22 *
23 * Author: Katsuhisa Yano	TOSHIBA Corp.
24 *			   	mopi@osa.ilab.toshiba.co.jp
25 */
26/*
27 * Copyright 1995 by FUJITSU LIMITED
28 * This is source code modified by FUJITSU LIMITED under the Joint
29 * Development Agreement for the CDE/Motif PST.
30 *
31 * Modifier: Takanori Tateno   FUJITSU LIMITED
32 *
33 */
34/* $XFree86: xc/lib/X11/XlcGeneric.h,v 1.4 2001/07/25 15:04:44 dawes Exp $ */
35
36#ifndef _XLCGENERIC_H_
37#define _XLCGENERIC_H_
38
39#include "XlcPubI.h"
40
41typedef struct _ByteInfo {
42     unsigned char start,end;
43} ByteInfoRec, *ByteInfo;
44
45typedef struct _ByteInfoList {
46    int 	M;                          /* 1 <= M <= length */
47    int 	byteinfo_num;
48    ByteInfo 	byteinfo;
49} ByteInfoListRec, *ByteInfoList;
50
51/* conversion_type values */
52#define LOCALCONV      1
53#define FILECONV       2
54#define FUNCTIONCONV   4
55
56typedef struct _Conversion {
57    unsigned long 	conversion_type;
58    int       		conv_num;
59    FontScope 		convlist;
60    char      		*cnv_file;
61    XlcConv    		cnvfunc;
62} ConversionRec, *Conversion;
63
64typedef struct _ExtdSegment {
65    char    	*name;
66    XlcSide 	side;
67    FontScope 	area;
68    int 	area_num;
69    XlcCharSet  charset;
70} ExtdSegmentRec, *ExtdSegment;
71
72typedef struct _SegConvRec {
73    int         	length;
74    char        	*source_encoding;
75    XlcCharSet		source;
76    char        	*destination_encoding;
77    XlcCharSet		dest;
78    FontScopeRec   	range;
79    int         	conv_num;
80    FontScope   	conv;
81} SegConvRec, *SegConv;
82
83typedef struct _ParseInfoRec *ParseInfo;
84
85typedef struct _CodeSetRec {
86    XlcCharSet 		*charset_list;
87    int 		num_charsets;
88    int 		cs_num;
89    XlcSide 		side;
90    int 		length;
91    ByteInfoList 	byteM;
92    Conversion 		mbconv;
93    Conversion 		ctconv;
94    ExtdSegment 	ctextseg;
95    ParseInfo 		parse_info;
96    unsigned long 	wc_encoding;
97    Bool		string_encoding;
98} CodeSetRec, *CodeSet;
99
100typedef enum {
101    E_GL,			/* GL encoding */
102    E_GR,			/* GR encoding */
103    E_SS,			/* single shift */
104    E_LSL,			/* locking shift left */
105    E_LSR,			/* locking shift right */
106    E_LAST
107} EncodingType;
108
109typedef struct _ParseInfoRec {
110    EncodingType 	type;
111    char 		*encoding;
112    CodeSet 		codeset;
113} ParseInfoRec;
114
115/*
116 * XLCd private data
117 */
118
119#define XLC_GENERIC(lcd, x)	(((XLCdGeneric) lcd->core)->gen.x)
120#define XLC_GENERIC_PART(lcd)	(&(((XLCdGeneric) lcd->core)->gen))
121
122typedef struct _XLCdGenericPart {
123    int 		codeset_num;
124    CodeSet 		*codeset_list;
125    unsigned char 	*mb_parse_table;
126    int 		mb_parse_list_num;
127    ParseInfo 		*mb_parse_list;
128    unsigned long 	wc_encode_mask;
129    unsigned long 	wc_shift_bits;
130    CodeSet 		initial_state_GL;
131    CodeSet 		initial_state_GR;
132    int  		segment_conv_num;  /* UDC */
133    SegConv 		segment_conv;      /* UDC */
134    Bool 		use_stdc_env;
135    Bool 		force_convert_to_mb;
136} XLCdGenericPart;
137
138typedef struct _XLCdGenericRec {
139    XLCdCoreRec 	core;
140    XLCdPublicPart 	pub;
141    XLCdGenericPart 	gen;
142} XLCdGenericRec, *XLCdGeneric;
143
144extern XLCdMethods _XlcGenericMethods;
145
146extern FontScope
147_XlcParse_scopemaps(
148    const char *str,
149    int *size);
150extern void
151_XlcDbg_printValue(
152    const char *str,
153    char **value,
154    int num);
155
156extern XIM
157_XDefaultOpenIM(
158    XLCd                lcd,
159    Display             *dpy,
160    XrmDatabase         rdb,
161    char                *res_name,
162    char                *res_class);
163
164#endif  /* _XLCGENERIC_H_ */
165