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  * 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 #ifndef _XLCGENERIC_H_
35 #define _XLCGENERIC_H_
36 
37 #include "XlcPubI.h"
38 
39 typedef struct _ByteInfo {
40      unsigned char start,end;
41 } ByteInfoRec, *ByteInfo;
42 
43 typedef struct _ByteInfoList {
44     int 	M;                          /* 1 <= M <= length */
45     int 	byteinfo_num;
46     ByteInfo 	byteinfo;
47 } ByteInfoListRec, *ByteInfoList;
48 
49 /* conversion_type values */
50 #define LOCALCONV      1
51 #define FILECONV       2
52 #define FUNCTIONCONV   4
53 
54 typedef struct _Conversion {
55     unsigned long 	conversion_type;
56     int       		conv_num;
57     FontScope 		convlist;
58     char      		*cnv_file;
59     XlcConv    		cnvfunc;
60 } ConversionRec, *Conversion;
61 
62 typedef struct _ExtdSegment {
63     char    	*name;
64     XlcSide 	side;
65     FontScope 	area;
66     int 	area_num;
67     XlcCharSet  charset;
68 } ExtdSegmentRec, *ExtdSegment;
69 
70 typedef struct _SegConvRec {
71     int         	length;
72     char        	*source_encoding;
73     XlcCharSet		source;
74     char        	*destination_encoding;
75     XlcCharSet		dest;
76     FontScopeRec   	range;
77     int         	conv_num;
78     FontScope   	conv;
79 } SegConvRec, *SegConv;
80 
81 typedef struct _ParseInfoRec *ParseInfo;
82 
83 typedef struct _CodeSetRec {
84     XlcCharSet 		*charset_list;
85     int 		num_charsets;
86     int 		cs_num;
87     XlcSide 		side;
88     int 		length;
89     ByteInfoList 	byteM;
90     Conversion 		mbconv;
91     Conversion 		ctconv;
92     ExtdSegment 	ctextseg;
93     ParseInfo 		parse_info;
94     unsigned long 	wc_encoding;
95     Bool		string_encoding;
96 } CodeSetRec, *CodeSet;
97 
98 typedef enum {
99     E_GL,			/* GL encoding */
100     E_GR,			/* GR encoding */
101     E_SS,			/* single shift */
102     E_LSL,			/* locking shift left */
103     E_LSR,			/* locking shift right */
104     E_LAST
105 } EncodingType;
106 
107 typedef struct _ParseInfoRec {
108     EncodingType 	type;
109     char 		*encoding;
110     CodeSet 		codeset;
111 } ParseInfoRec;
112 
113 /*
114  * XLCd private data
115  */
116 
117 #define XLC_GENERIC(lcd, x)	(((XLCdGeneric) lcd->core)->gen.x)
118 #define XLC_GENERIC_PART(lcd)	(&(((XLCdGeneric) lcd->core)->gen))
119 
120 typedef struct _XLCdGenericPart {
121     int 		codeset_num;
122     CodeSet 		*codeset_list;
123     unsigned char 	*mb_parse_table;
124     int 		mb_parse_list_num;
125     ParseInfo 		*mb_parse_list;
126     unsigned long 	wc_encode_mask;
127     unsigned long 	wc_shift_bits;
128     CodeSet 		initial_state_GL;
129     CodeSet 		initial_state_GR;
130     int  		segment_conv_num;  /* UDC */
131     SegConv 		segment_conv;      /* UDC */
132     Bool 		use_stdc_env;
133     Bool 		force_convert_to_mb;
134 } XLCdGenericPart;
135 
136 typedef struct _XLCdGenericRec {
137     XLCdCoreRec 	core;
138     XLCdPublicPart 	pub;
139     XLCdGenericPart 	gen;
140 } XLCdGenericRec, *XLCdGeneric;
141 
142 extern XLCdMethods _XlcGenericMethods;
143 
144 extern FontScope
145 _XlcParse_scopemaps(
146     const char *str,
147     int *size);
148 extern void
149 _XlcDbg_printValue(
150     const char *str,
151     char **value,
152     int num);
153 
154 extern XIM
155 _XDefaultOpenIM(
156     XLCd                lcd,
157     Display             *dpy,
158     XrmDatabase         rdb,
159     char                *res_name,
160     char                *res_class);
161 
162 #endif  /* _XLCGENERIC_H_ */
163