1 /*
2  * Copyright (c) 1994  Sony Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * Except as contained in this notice, the name of Sony Corporation
24  * shall not be used in advertising or otherwise to promote the sale, use
25  * or other dealings in this Software without prior written authorization
26  * from Sony Corporation.
27  *
28  */
29 
30 /*
31  * $SonyRCSfile: wchar16.h,v $
32  * $SonyRevision: 1.1 $
33  * $SonyDate: 1994/06/03 08:03:52 $
34  */
35 
36 
37 
38 #ifndef _WCHARH
39 #define _WCHARH
40 
41 
42 #if defined(__sony_news) && defined(SVR4)
43 #define _WCHAR_T
44 typedef unsigned short  wchar_t;
45 #include <stdlib.h>
46 #include <ctype.h>
47 #include <widec.h>
48 #include <wctype.h>
49 typedef wchar_t  wchar16_t;
50 #else
51 #include <stdlib.h>
52 #include <ctype.h>
53 typedef unsigned short  wchar16_t;
54 #endif
55 #include "key.h"
56 
57 #ifndef SS2
58 #define SS2 0x8e
59 #define SS3 0x8f
60 #endif
61 
62 #if !defined(__sony_news) || (defined(__sony_news) && !defined(SVR4))
63 
64 #ifdef iswcntrl
65 #undef iswcntrl
66 #endif
67 #define iswcntrl(wc)         sj3_iswcntrl16(wc)
68 #ifdef iswupper
69 #undef iswupper
70 #endif
71 #define iswupper(wc)         sj3_iswupper16(wc)
72 #ifdef iswdigit
73 #undef iswdigit
74 #endif
75 #define iswdigit(wc)         sj3_iswdigit16(wc)
76 #ifdef iswxdigit
77 #undef iswxdigit
78 #endif
79 #define iswxdigit(wc)        sj3_iswxdigit16(wc)
80 #ifdef wslen
81 #undef wslen
82 #endif
83 #define wslen(ws)            sj3_wslen16(ws)
84 #ifdef wscmp
85 #undef wscmp
86 #endif
87 #define wscmp(ws1, ws2)      sj3_wscmp16(ws1, ws2)
88 #ifdef wsncmp
89 #undef wsncmp
90 #endif
91 #define wsncmp(ws1, ws2, n)  sj3_wsncmp16(ws1, ws2, n)
92 #ifdef wscpy
93 #undef wscpy
94 #endif
95 #define wscpy(ws1, ws2)      sj3_wscpy16(ws1, ws2)
96 #ifdef wsncpy
97 #undef wsncpy
98 #endif
99 #define wsncpy(ws1, ws2, n)  sj3_wsncpy16(ws1, ws2, n)
100 #ifdef wscat
101 #undef wscat
102 #endif
103 #define wscat(ws1, ws2)      sj3_wscat16(ws1, ws2)
104 #ifdef mbstowcs
105 #undef mbstowcs
106 #endif
107 #define mbstowcs(mb, ws, n)  sj3_mbstowcs16(mb, ws, n)
108 #ifdef wcstombs
109 #undef wcstombs
110 #endif
111 #define wcstombs(ws, mb, n)  sj3_wcstombs16(ws, mb, n)
112 #endif
113 
114 
115 #define LC_CTYPE_SHIFTJIS 1
116 #define LC_CTYPE_EUC 2
117 
118 #define IsEUCHojo(x) (((unsigned char) (x)) == SS3)
119 
120 
121 
122 
123 #define WcX0208MASK 0xffff
124 #define WcX0212MASK 0xff7f
125 #define WcJISMASK 0x7f7f
126 #define WcLowMASK 0x00ff
127 #define WcHighMASK 0xff00
128 
129 #define WcASCIIFLAG 0x0000
130 #define WcX0208FLAG 0x8080
131 #define WcX0212FLAG 0x8000
132 #define WcX0201FLAG 0x0080
133 
134 #define WcLowByte(w)  ((w) & 0xff)
135 #define WcHighByte(w) (((w) >> 8) & 0xff)
136 
137 #define WcIsASCII(w)  ((((wchar16_t) (w)) & WcX0208FLAG) == WcASCIIFLAG)
138 #define WcIsX0208(w)  ((((wchar16_t) (w)) & WcX0208FLAG) == WcX0208FLAG)
139 #define WcIsX0201(w)  ((((wchar16_t) (w)) & WcX0208FLAG) == WcX0201FLAG)
140 #define WcIsX0212(w)  ((((wchar16_t) (w)) & WcX0208FLAG) == WcX0212FLAG)
141 
142 #define WcIsZENKAKU(w) ((((wchar16_t) (w)) & WcX0212FLAG) == WcX0212FLAG)
143 #define WcIsHANKAKU(w) ((((wchar16_t) (w)) & WcX0212FLAG) == WcASCIIFLAG)
144 #define WcIsKANJI(w)  WcIsZENKAKU(w)
145 #define WcIsKANA(w)  WcIsX0201(w)
146 
147 #define WcSetX0212(c1, c2) ((((c1) & 0xff) << 8) + ((c2) & 0x7f))
148 #define WcJIS2X0208(w)  ((w) | WcX0208FLAG)
149 #define WcJIS2X0212(w)  ((w) | WcX0212FLAG)
150 #define Wc2JIS(w)  ((w) & WcJISMASK)
151 
152 
153 #define WCSJrun		WcMessages[0]
154 
155 #define WCMode_buff	WcMessages[1]
156 #define WCMode_unbuff	WcMessages[2]
157 
158 #define WCMode_Zhira	WcMessages[3]
159 #define WCMode_Zkata	WcMessages[4]
160 #define WCMode_Hkata	WcMessages[5]
161 #define WCMode_Zalpha	WcMessages[6]
162 #define WCMode_Halpha	WcMessages[7]
163 
164 #define WCGmode           WcMessages[8]
165 #define WCGEtc		WcMessages[9]
166 #define WCGetc		WcMessages[10]
167 
168 #define WCGHelp		WcMessages[11]
169 #define WCMHelp		WcMessages[12]
170 
171 
172 
173 #define WCGCshift	        WcMessages[13]
174 #define WCGCeuc		WcMessages[14]
175 #define WCGCeuc2		WcMessages[15]
176 #define WCGCjis		WcMessages[16]
177 #define WCGCjis2		WcMessages[17]
178 #define WCGCkuten	        WcMessages[18]
179 #define WCGCkuten2	WcMessages[19]
180 
181 
182 
183 #define WCGtoroku	        WcMessages[20]
184 #define WCMhani		WcMessages[21]
185 #define WCMyomi		WcMessages[22]
186 #define WCTOUROKU_OK	WcMessages[23]
187 #define WCSYOUKYO_OK	WcMessages[24]
188 #define WCTOUROKU_HIN	WcMessages[25]
189 #define WCTOUROKU_SUCC	WcMessages[26]
190 #define WCYomi           WcMessages[27]
191 #define WCOne            WcMessages[28]
192 #define WCY              WcMessages[29]
193 #define WCExist          WcMessages[30]
194 #define WCYomiTouroku    WcMessages[31]
195 #define WCKanjiTouroku   WcMessages[32]
196 #define WCOnajiTouroku   WcMessages[33]
197 #define WCUserTouroku    WcMessages[34]
198 #define WCJishoLock      WcMessages[35]
199 #define WCSystemError    WcMessages[36]
200 #define WCKanma          WcMessages[37]
201 
202 
203 #define WCGsyoukyo	WcMessages[38]
204 #define WCSYOUKYO_SUCC	WcMessages[39]
205 #define WCNotExist       WcMessages[40]
206 #define WCUserLock       WcMessages[41]
207 #define WCYomiShokyo     WcMessages[42]
208 #define WCKanjiShokyo    WcMessages[43]
209 #define WCShokyoError    WcMessages[44]
210 
211 
212 
213 #define WCSUCCsjrc	WcMessages[45]
214 #define WCFAILsjrc	WcMessages[46]
215 #define WCNOTHsjrc       WcMessages[47]
216 
217 
218 #define WCWeight_mes     WcMessages[48]
219 
220 
221 
222 #define WCGrcon		WcMessages[49]
223 #define WCRserv		WcMessages[50]
224 #define WCRserv_OK	WcMessages[51]
225 #define WCDiscon		WcMessages[52]
226 
227 #define WCSpace          WcMessages[53]
228 #define WCSpace2         WcMessages[54]
229 #define WCContinue       WcMessages[55]
230 
231 
232 #define WCServer_Dead	WcMessages[56]
233 #define WCConnected		WcMessages[57]
234 #define WCNconnect		WcMessages[58]
235 #define WCNopen_Mdic	WcMessages[59]
236 #define WCNmake_Udir	WcMessages[60]
237 #define WCNmake_Udic	WcMessages[61]
238 #define WCNopen_Udic	WcMessages[62]
239 #define WCNmake_Study	WcMessages[63]
240 #define WCNopen_Study	WcMessages[64]
241 
242 
243 
244 #define WCGedit		WcMessages[65]
245 
246 
247 #define WCTooLong        WcMessages[67]
248 #define WCDollar         WcMessages[68]
249 
250 
251 #define WCOn             WcMessages[69]
252 #define WCOff            WcMessages[70]
253 
254 
255 #define WCMeishi         WcMessages[71]
256 #define WCMyouji         WcMessages[72]
257 #define WCNamae          WcMessages[73]
258 #define WCTimei          WcMessages[74]
259 #define WCSahen          WcMessages[75]
260 
261 
262 #define WCKara           WcMessages[76]
263 #define WCF1             WcMessages[77]
264 #define WCF2             WcMessages[78]
265 #define WCF3             WcMessages[79]
266 #define WCF4             WcMessages[80]
267 #define WCF5             WcMessages[81]
268 #define WCF6             WcMessages[82]
269 #define WCF7             WcMessages[83]
270 #define WCF8             WcMessages[84]
271 #define WCF9             WcMessages[85]
272 #define WCF10             WcMessages[86]
273 #define WCF11             WcMessages[87]
274 #define WCF12             WcMessages[88]
275 #define WCF13             WcMessages[89]
276 #define WCF14             WcMessages[90]
277 #define WCF15             WcMessages[91]
278 #define WCF16             WcMessages[92]
279 #define WCF17             WcMessages[93]
280 #define WCF18             WcMessages[94]
281 #define WCF19             WcMessages[95]
282 #define WCF20             WcMessages[96]
283 #define WCSelect          WcMessages[97]
284 #define WCKanji           WcMessages[98]
285 #define WCCancel          WcMessages[99]
286 #define WCExecute         WcMessages[100]
287 #define WCUp              WcMessages[101]
288 #define WCDown            WcMessages[102]
289 #define WCRight           WcMessages[103]
290 #define WCLeft            WcMessages[104]
291 
292 #define WCStart           WcMessages[105]
293 #define WCHenkan          WcMessages[106]
294 #define WCMuhen           WcMessages[107]
295 #define WCKettei          WcMessages[108]
296 #define WCHira            WcMessages[109]
297 #define WCHalpha          WcMessages[110]
298 #define WCZalpha          WcMessages[111]
299 #define WCHkata           WcMessages[112]
300 #define WCZkata           WcMessages[113]
301 #define WCCode            WcMessages[114]
302 #define WCEtc             WcMessages[115]
303 #define WCRightl          WcMessages[116]
304 #define WCLeftl           WcMessages[117]
305 #define WCKaku            WcMessages[118]
306 #define WCSyuku           WcMessages[119]
307 #define WCEdit            WcMessages[120]
308 #define WCToggle          WcMessages[121]
309 #define WCWrapback        WcMessages[122]
310 #define WCWrap            WcMessages[123]
311 #define WCSjrc            WcMessages[124]
312 #define WCBuffer          WcMessages[125]
313 #define WCToroku          WcMessages[126]
314 #define WCSyoukyo         WcMessages[127]
315 #define WCHelp            WcMessages[128]
316 #define WCHaKettei        WcMessages[129]
317 #define WCFlush           WcMessages[130]
318 #define WCDebug           WcMessages[131]
319 #define WCCancell         WcMessages[132]
320 #define WCSaihenkan       WcMessages[133]
321 #define WCIgnore          WcMessages[134]
322 #define WCTop             WcMessages[135]
323 #define WCEnd             WcMessages[136]
324 #define WCReconnect       WcMessages[137]
325 #define WCKill            WcMessages[138]
326 
327 
328 #define WCKey             WcMessages[139]
329 #define WCEscape          WcMessages[140]
330 #define WCSjxkey          WcMessages[141]
331 #define WCEtckey          WcMessages[142]
332 #define WCIntr            WcMessages[143]
333 #define WCBskey           WcMessages[144]
334 #define WCDelkey          WcMessages[145]
335 #define WCSetnormal       WcMessages[146]
336 #define WCThroughnext     WcMessages[147]
337 #define WCInitialmode     WcMessages[148]
338 #define WCHelpmode        WcMessages[149]
339 #define WCDefaultcode     WcMessages[150]
340 #define WCMuhenkanmode    WcMessages[151]
341 #define WCMuhenkaninedit  WcMessages[152]
342 #define WCMuhenkantoggle  WcMessages[153]
343 #define WCGuide           WcMessages[154]
344 #define WCForkshell       WcMessages[155]
345 #define WCExecshell       WcMessages[156]
346 #define WCDictionary      WcMessages[157]
347 #define WCUserdic         WcMessages[158]
348 #define WCMaindic         WcMessages[159]
349 #define WCRomaji          WcMessages[160]
350 #define WCBstudy          WcMessages[161]
351 #define WCSilent          WcMessages[162]
352 #define WCFlushafterconversion WcMessages[163]
353 #define WCRkerrbell       WcMessages[164]
354 #define WCServer          WcMessages[165]
355 
356 #define WCShiftjis        WcMessages[166]
357 #define WCSjis            WcMessages[167]
358 #define WCEuc             WcMessages[168]
359 #define WCEuc2            WcMessages[169]
360 #define WCJis             WcMessages[170]
361 #define WCJis2            WcMessages[171]
362 #define WCKuten           WcMessages[172]
363 #define WCKuten2          WcMessages[173]
364 
365 #define WCBuff            WcMessages[174]
366 #define WCUnbuff          WcMessages[175]
367 #define WCDirect          WcMessages[176]
368 
369 #define WCSj2             WcMessages[177]
370 #define WCShift           WcMessages[178]
371 
372 #define WCFunction        WcMessages[179]
373 
374 #define WCUnbuffer        WcMessages[180]
375 #define WCFuncetc         WcMessages[181]
376 
377 extern wchar16_t *WcMessages[];
378 
379 
380 
381 struct wcvtkey {
382         wchar16_t *key_word;
383         wchar16_t key_seq[SEQLEN];
384 };
385 
386 
387 struct functbl {
388         wchar16_t *keyword;
389         int (*func)();
390 };
391 
392 #endif
393