1 |
#include <stdio.h> |
---|
2 |
#include <stdlib.h> |
---|
3 |
#include <unistd.h> |
---|
4 |
#include <string.h> |
---|
5 |
#include <iconv.h> |
---|
6 |
|
---|
7 |
#include "aribstr.h" |
---|
8 |
|
---|
9 |
#define CODE_UNKNOWN 0 // 筝���������c�������(���綽� |
---|
10 |
#define CODE_KANJI 1 // Kanji |
---|
11 |
#define CODE_ALPHANUMERIC 2 // Alphanumeric |
---|
12 |
#define CODE_HIRAGANA 3 // Hiragana |
---|
13 |
#define CODE_KATAKANA 4 // Katakana |
---|
14 |
#define CODE_MOSAIC_A 5 // Mosaic A |
---|
15 |
#define CODE_MOSAIC_B 6 // Mosaic B |
---|
16 |
#define CODE_MOSAIC_C 7 // Mosaic C |
---|
17 |
#define CODE_MOSAIC_D 8 // Mosaic D |
---|
18 |
#define CODE_PROP_ALPHANUMERIC 9 // Proportional Alphanumeric |
---|
19 |
#define CODE_PROP_HIRAGANA 10 // Proportional Hiragana |
---|
20 |
#define CODE_PROP_KATAKANA 11 // Proportional Katakana |
---|
21 |
#define CODE_JIS_X0201_KATAKANA 12 // JIS X 0201 Katakana |
---|
22 |
#define CODE_JIS_KANJI_PLANE_1 13 // JIS compatible Kanji Plane 1 |
---|
23 |
#define CODE_JIS_KANJI_PLANE_2 14 // JIS compatible Kanji Plane 2 |
---|
24 |
#define CODE_ADDITIONAL_SYMBOLS 15 // Additional symbols |
---|
25 |
|
---|
26 |
|
---|
27 |
#define TCHAR char |
---|
28 |
#define BYTE char |
---|
29 |
#define WORD int |
---|
30 |
#define DWORD int |
---|
31 |
#define bool int |
---|
32 |
#define true 1 |
---|
33 |
#define false 0 |
---|
34 |
#define TEXT(a) a |
---|
35 |
#define _T(a) a |
---|
36 |
#define CODE_SET int |
---|
37 |
|
---|
38 |
static int m_CodeG[4]; |
---|
39 |
static int *m_pLockingGL; |
---|
40 |
static int *m_pLockingGR; |
---|
41 |
static int *m_pSingleGL; |
---|
42 |
|
---|
43 |
static BYTE m_byEscSeqCount; |
---|
44 |
static BYTE m_byEscSeqIndex; |
---|
45 |
static bool m_bIsEscSeqDrcs; |
---|
46 |
|
---|
47 |
|
---|
48 |
static const DWORD AribToStringInternal(TCHAR *lpszDst, const BYTE *pSrcData, const DWORD dwSrcLen); |
---|
49 |
static const DWORD ProcessCharCode(TCHAR *lpszDst, const WORD wCode, const CODE_SET CodeSet); |
---|
50 |
|
---|
51 |
static const DWORD PutKanjiChar(TCHAR *lpszDst, const WORD wCode); |
---|
52 |
static const DWORD PutAlphanumericChar(TCHAR *lpszDst, const WORD wCode); |
---|
53 |
|
---|
54 |
static const DWORD PutHiraganaChar(TCHAR *lpszDst, const WORD wCode); |
---|
55 |
static const DWORD PutKatakanaChar(TCHAR *lpszDst, const WORD wCode); |
---|
56 |
static const DWORD PutJisKatakanaChar(TCHAR *lpszDst, const WORD wCode); |
---|
57 |
static const DWORD PutSymbolsChar(TCHAR *lpszDst, const WORD wCode); |
---|
58 |
|
---|
59 |
static void ProcessEscapeSeq(const BYTE byCode); |
---|
60 |
|
---|
61 |
static void LockingShiftGL(const BYTE byIndexG); |
---|
62 |
static void LockingShiftGR(const BYTE byIndexG); |
---|
63 |
static void SingleShiftGL(const BYTE byIndexG); |
---|
64 |
|
---|
65 |
static const bool DesignationGSET(const BYTE byIndexG, const BYTE byCode); |
---|
66 |
static const bool DesignationDRCS(const BYTE byIndexG, const BYTE byCode); |
---|
67 |
|
---|
68 |
static const bool abCharSizeTable[] = |
---|
69 |
{ |
---|
70 |
false, |
---|
71 |
true, |
---|
72 |
false, |
---|
73 |
false, |
---|
74 |
false, |
---|
75 |
false, |
---|
76 |
false, |
---|
77 |
false, |
---|
78 |
false, |
---|
79 |
false, |
---|
80 |
false, |
---|
81 |
false, |
---|
82 |
false, |
---|
83 |
true, |
---|
84 |
true, |
---|
85 |
true |
---|
86 |
}; |
---|
87 |
|
---|
88 |
typedef enum{ |
---|
89 |
STR_SMALL = 0, |
---|
90 |
STR_MEDIUM, |
---|
91 |
STR_NORMAL, |
---|
92 |
STR_MICRO, |
---|
93 |
STR_HIGH_W, |
---|
94 |
STR_WIDTH_W, |
---|
95 |
STR_W, |
---|
96 |
STR_SPECIAL_1, |
---|
97 |
STR_SPECIAL_2, |
---|
98 |
} STRING_SIZE; |
---|
99 |
|
---|
100 |
STRING_SIZE m_emStrSize; |
---|
101 |
|
---|
102 |
bool IsSmallCharMode(void) |
---|
103 |
{ |
---|
104 |
bool bRet = false; |
---|
105 |
switch(m_emStrSize){ |
---|
106 |
case STR_SMALL: |
---|
107 |
bRet = true; |
---|
108 |
break; |
---|
109 |
case STR_MEDIUM: |
---|
110 |
bRet = true; |
---|
111 |
break; |
---|
112 |
case STR_NORMAL: |
---|
113 |
bRet = false; |
---|
114 |
break; |
---|
115 |
case STR_MICRO: |
---|
116 |
bRet = true; |
---|
117 |
break; |
---|
118 |
case STR_HIGH_W: |
---|
119 |
bRet = false; |
---|
120 |
break; |
---|
121 |
case STR_WIDTH_W: |
---|
122 |
bRet = false; |
---|
123 |
break; |
---|
124 |
case STR_W: |
---|
125 |
bRet = false; |
---|
126 |
break; |
---|
127 |
case STR_SPECIAL_1: |
---|
128 |
bRet = false; |
---|
129 |
break; |
---|
130 |
case STR_SPECIAL_2: |
---|
131 |
bRet = false; |
---|
132 |
break; |
---|
133 |
default: |
---|
134 |
break; |
---|
135 |
} |
---|
136 |
return bRet; |
---|
137 |
} |
---|
138 |
|
---|
139 |
int AribToString( |
---|
140 |
char *lpszDst, |
---|
141 |
const char *pSrcData, |
---|
142 |
const int dwSrcLen) { |
---|
143 |
|
---|
144 |
return AribToStringInternal(lpszDst, pSrcData, dwSrcLen); |
---|
145 |
} |
---|
146 |
|
---|
147 |
|
---|
148 |
const DWORD AribToStringInternal(TCHAR *lpszDst, |
---|
149 |
const BYTE *pSrcData, const DWORD dwSrcLen) |
---|
150 |
{ |
---|
151 |
if(!pSrcData || !dwSrcLen || !lpszDst)return 0UL; |
---|
152 |
|
---|
153 |
DWORD dwSrcPos = 0UL; |
---|
154 |
DWORD dwDstLen = 0UL; |
---|
155 |
int dwSrcData; |
---|
156 |
|
---|
157 |
|
---|
158 |
m_byEscSeqCount = 0U; |
---|
159 |
m_pSingleGL = NULL; |
---|
160 |
|
---|
161 |
m_CodeG[0] = CODE_KANJI; |
---|
162 |
m_CodeG[1] = CODE_ALPHANUMERIC; |
---|
163 |
m_CodeG[2] = CODE_HIRAGANA; |
---|
164 |
m_CodeG[3] = CODE_KATAKANA; |
---|
165 |
|
---|
166 |
m_pLockingGL = &m_CodeG[0]; |
---|
167 |
m_pLockingGR = &m_CodeG[2]; |
---|
168 |
|
---|
169 |
m_emStrSize = STR_NORMAL; |
---|
170 |
|
---|
171 |
while(dwSrcPos < dwSrcLen){ |
---|
172 |
dwSrcData = pSrcData[dwSrcPos] & 0xFF; |
---|
173 |
|
---|
174 |
if(!m_byEscSeqCount){ |
---|
175 |
|
---|
176 |
|
---|
177 |
if((dwSrcData >= 0x21U) && (dwSrcData <= 0x7EU)){ |
---|
178 |
|
---|
179 |
const CODE_SET CurCodeSet = (m_pSingleGL)? *m_pSingleGL : *m_pLockingGL; |
---|
180 |
m_pSingleGL = NULL; |
---|
181 |
|
---|
182 |
if(abCharSizeTable[CurCodeSet]){ |
---|
183 |
|
---|
184 |
if((dwSrcLen - dwSrcPos) < 2UL)break; |
---|
185 |
|
---|
186 |
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], ((WORD)pSrcData[dwSrcPos + 0] << 8) | (WORD)pSrcData[dwSrcPos + 1], CurCodeSet); |
---|
187 |
dwSrcPos++; |
---|
188 |
} |
---|
189 |
else{ |
---|
190 |
|
---|
191 |
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], (WORD)dwSrcData, CurCodeSet); |
---|
192 |
} |
---|
193 |
} |
---|
194 |
else if((dwSrcData >= 0xA1U) && (dwSrcData <= 0xFEU)){ |
---|
195 |
|
---|
196 |
const CODE_SET CurCodeSet = *m_pLockingGR; |
---|
197 |
|
---|
198 |
if(abCharSizeTable[CurCodeSet]){ |
---|
199 |
|
---|
200 |
if((dwSrcLen - dwSrcPos) < 2UL)break; |
---|
201 |
|
---|
202 |
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], ((WORD)(pSrcData[dwSrcPos + 0] & 0x7FU) << 8) | (WORD)(pSrcData[dwSrcPos + 1] & 0x7FU), CurCodeSet); |
---|
203 |
dwSrcPos++; |
---|
204 |
} |
---|
205 |
else{ |
---|
206 |
|
---|
207 |
dwDstLen += ProcessCharCode(&lpszDst[dwDstLen], (WORD)(dwSrcData & 0x7FU), CurCodeSet); |
---|
208 |
} |
---|
209 |
} |
---|
210 |
else{ |
---|
211 |
|
---|
212 |
case 0x0FU : LockingShiftGL(0U); break; |
---|
213 |
case 0x0EU : LockingShiftGL(1U); break; |
---|
214 |
case 0x19U : SingleShiftGL(2U); break; |
---|
215 |
case 0x1DU : SingleShiftGL(3U); break; |
---|
216 |
case 0x1BU : m_byEscSeqCount = 1U; break; |
---|
217 |
case 0x89U : m_emStrSize = STR_MEDIUM; break; |
---|
218 |
case 0x8AU : m_emStrSize = STR_NORMAL; break; |
---|
219 |
case 0x20U : |
---|
220 |
case 0xA0U : |
---|
221 |
|
---|
222 |
|
---|
223 |
strcpy(&lpszDst[dwDstLen], "��); |
---|
224 |
|
---|
225 |
|
---|
226 |
|
---|
227 |
|
---|
228 |
|
---|
229 |
|
---|
230 |
|
---|
231 |
|
---|
232 |
|
---|
233 |
|
---|
234 |
|
---|
235 |
|
---|
236 |
|
---|
237 |
|
---|
238 |
|
---|
239 |
|
---|
240 |
|
---|
241 |
|
---|
242 |
|
---|
243 |
|
---|
244 |
|
---|
245 |
|
---|
246 |
|
---|
247 |
|
---|
248 |
|
---|
249 |
|
---|
250 |
|
---|
251 |
|
---|
252 |
|
---|
253 |
|
---|
254 |
|
---|
255 |
|
---|
256 |
|
---|
257 |
|
---|
258 |
|
---|
259 |
|
---|
260 |
|
---|
261 |
|
---|
262 |
|
---|
263 |
|
---|
264 |
|
---|
265 |
|
---|
266 |
|
---|
267 |
|
---|
268 |
|
---|
269 |
|
---|
270 |
|
---|
271 |
|
---|
272 |
|
---|
273 |
|
---|
274 |
|
---|
275 |
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 |
|
---|
281 |
|
---|
282 |
|
---|
283 |
|
---|
284 |
|
---|
285 |
|
---|
286 |
|
---|
287 |
|
---|
288 |
|
---|
289 |
|
---|
290 |
|
---|
291 |
|
---|
292 |
|
---|
293 |
|
---|
294 |
|
---|
295 |
|
---|
296 |
|
---|
297 |
|
---|
298 |
|
---|
299 |
|
---|
300 |
|
---|
301 |
|
---|
302 |
|
---|
303 |
|
---|
304 |
|
---|
305 |
|
---|
306 |
|
---|
307 |
|
---|
308 |
UTF-8","ISO-2022-JP"); |
---|
309 |
|
---|
310 |
|
---|
311 |
|
---|
312 |
|
---|
313 |
|
---|
314 |
|
---|
315 |
|
---|
316 |
|
---|
317 |
|
---|
318 |
|
---|
319 |
|
---|
320 |
|
---|
321 |
|
---|
322 |
|
---|
323 |
|
---|
324 |
������������������������") |
---|
325 |
������������������������") |
---|
326 |
������鐚��鐚��鐚��鐚��鐚��鐚��") |
---|
327 |
鐚��鐚��鐚��鐚��鐚��鐚��鐚��鐚��") |
---|
328 |
鐚�次鐚�治鐚わ璽鐚�磁鐚�而鐚�自鐚�辞鐚�鹿") |
---|
329 |
鐚逸識鐚駕竺鐚器宍鐚駈七鐚醐執鐚削嫉鐃ワ悉鐚常漆") |
---|
330 |
���鐔��鐔��鐔��鐔��鐔��鐔��鐔��") |
---|
331 |
鐔��鐔��鐔��鐔��鐔��鐔��鐔��鐃c�"); |
---|
332 |
|
---|
333 |
|
---|
334 |
|
---|
335 |
|
---|
336 |
|
---|
337 |
|
---|
338 |
|
---|
339 |
|
---|
340 |
|
---|
341 |
|
---|
342 |
|
---|
343 |
|
---|
344 |
|
---|
345 |
|
---|
346 |
|
---|
347 |
|
---|
348 |
|
---|
349 |
������������������������") |
---|
350 |
������������������������") |
---|
351 |
������������������������") |
---|
352 |
������������������������") |
---|
353 |
����≪��ゃ����������������") |
---|
354 |
�違��蚊��眼��吟��吾��冴��若��障�") |
---|
355 |
������������������������") |
---|
356 |
����������������������祉�"); |
---|
357 |
|
---|
358 |
|
---|
359 |
|
---|
360 |
|
---|
361 |
|
---|
362 |
|
---|
363 |
|
---|
364 |
|
---|
365 |
|
---|
366 |
|
---|
367 |
|
---|
368 |
|
---|
369 |
|
---|
370 |
|
---|
371 |
|
---|
372 |
|
---|
373 |
|
---|
374 |
������������������������") |
---|
375 |
������������������������") |
---|
376 |
����≪��ゃ����������������") |
---|
377 |
�違��蚊��眼��吟��吾��冴��若��障�") |
---|
378 |
������������������������") |
---|
379 |
������������������������") |
---|
380 |
����≪��ゃ����������������") |
---|
381 |
�違��蚊��眼��吟��障��������祉�"); |
---|
382 |
|
---|
383 |
|
---|
384 |
|
---|
385 |
|
---|
386 |
|
---|
387 |
|
---|
388 |
|
---|
389 |
|
---|
390 |
|
---|
391 |
|
---|
392 |
|
---|
393 |
|
---|
394 |
|
---|
395 |
|
---|
396 |
|
---|
397 |
|
---|
398 |
|
---|
399 |
������������������������") |
---|
400 |
������������������������") |
---|
401 |
����������蚊��c��с��c��с�") |
---|
402 |
�若��ゃ�����������潟��激��祉�") |
---|
403 |
�帥����������������������) |
---|
404 |
TEXT("����<��ゃ����������������") |
---|
405 |
TEXT("������������������������") |
---|
406 |
TEXT("������������������������"); |
---|
407 |
|
---|
408 |
#ifdef _UNICODE |
---|
409 |
lpszDst[0] = acJisKatakanaTable[wCode]; |
---|
410 |
|
---|
411 |
return 1UL; |
---|
412 |
#else |
---|
413 |
lpszDst[0] = acJisKatakanaTable[wCode * 3U + 0U]; |
---|
414 |
lpszDst[1] = acJisKatakanaTable[wCode * 3U + 1U]; |
---|
415 |
lpszDst[2] = acJisKatakanaTable[wCode * 3U + 2U]; |
---|
416 |
|
---|
417 |
return 3UL; |
---|
418 |
#endif |
---|
419 |
} |
---|
420 |
|
---|
421 |
const DWORD PutSymbolsChar(TCHAR *lpszDst, const WORD wCode) |
---|
422 |
{ |
---|
423 |
|
---|
424 |
static const TCHAR *aszSymbolsTable1[] = |
---|
425 |
{ |
---|
426 |
_T("��V��), _T("��D��), _T("��式��), _T("��七��), _T("��V��), _T("�����), _T("�����), _T("����"), // 0x7A50 - 0x7A57 90/48 - 90/55 |
---|
427 |
_T("�����), _T("��竺��), _T("�����), _T("�����), _T("��В��), _T("��S��), _T("��滋��), _T("��汐��), // 0x7A58 - 0x7A5F 90/56 - 90/63 |
---|
428 |
_T("��), _T("��, _T("��ぉ��), _T("��困��), _T("�����), _T("�����), _T("�����), _T("��拘藹√����"), |
---|
429 |
_T("�����), _T("�����), _T("�����), _T("�����), _T("�����), _T("�����), _T("�����), _T("��鴬��), |
---|
430 |
_T("��0��), _T("�����), _T("��PV��), _T("鐚��鐚�), _T("�祉�") |
---|
431 |
}; |
---|
432 |
|
---|
433 |
static const TCHAR *aszSymbolsTable2[] = |
---|
434 |
{ |
---|
435 |
_T("��), _T("��), _T("��), _T("��), _T("��, _T("��), _T("綛�), _T("��), |
---|
436 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("鐚�"), // 0x7C29 - 0x7C30 92/09 - 92/16 |
---|
437 |
_T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), // 0x7C31 - 0x7C38 92/17 - 92/24 |
---|
438 |
_T("鐚�"), _T("羂�, _T("��), _T("��), _T("��), _T("��), _T("[��"), _T("鐚�"), |
---|
439 |
_T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), _T("鐚�"), |
---|
440 |
_T("鐚�"), _T("(腓�"), _T("(莢�"), _T("(��"), _T("(��"), _T("(篁�"), _T("(��), _T("��), |
---|
441 |
_T("��), _T("��), _T("��), _T("��), _T("^2"), _T("^3"), _T("(CD)"), _T("(vn)"), |
---|
442 |
_T("(ob)"), _T("(cb)"), _T("(ce"), _T("mb)"), _T("(hp)"), _T("(br)"), _T("(p)"), _T("(s)"), |
---|
443 |
_T("(ms)"), _T("(t)"), _T("(bs)"), _T("(b)"), _T("(tb)"), _T("(tp)"), _T("(ds)"), _T("(ag)"), |
---|
444 |
_T("(eg)"), _T("(vo)"), _T("(fl)"), _T("(ke"), _T("y)"), _T("(sa"), _T("x)"), _T("(sy"), |
---|
445 |
_T("n)"), _T("(or"), _T("g)"), _T("(pe"), _T("r)"), _T("(R)"), _T("(C)"), _T("(膊�), // 0x7C71 - 0x7C78 92/81 - 92/88 |
---|
446 |
_T("DJ"), _T("[羲�"), _T("Fax") // 0x7C79 - 0x7C7B 92/89 - 92/91 |
---|
447 |
}; |
---|
448 |
|
---|
449 |
static const TCHAR *aszSymbolsTable3[] = |
---|
450 |
{ |
---|
451 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7D21 - 0x7D28 93/01 - 93/08 |
---|
452 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7D29 - 0x7D30 93/09 - 93/16 |
---|
453 |
_T("�����), _T("�����), _T("�����), _T("�����), _T("�����), _T("�����), _T("�����), _T("�����), // 0x7D31 - 0x7D38 93/17 - 93/24 |
---|
454 |
_T("�����), _T("��竺��), _T("鐚紙�鐚�), _T("鐚紙�鐚�), _T("鐚私�鐚�), _T("鐚私�鐚�), _T("鐚私�鐚�), _T("鐚脂�鐚�), // 0x7D39 - 0x7D40 93/25 - 93/32 |
---|
455 |
_T("鐚糸窪鐚�), _T("鐚私賢鐚�), _T("鐚糸勜悉"), _T("鐚紙�鐚�), _T("鐚肢軌鐚�), _T("鐚紙�鐚�), _T("��), _T("��, |
---|
456 |
_T("��), _T("ha"), _T("��), _T("��), _T("��), _T("��), _T("��), _T("1/2"), |
---|
457 |
_T("0/3"), _T("1/3"), _T("2/3"), _T("1/4"), _T("3/4"), _T("1/5"), _T("2/5"), _T("3/5"), |
---|
458 |
_T("4/5"), _T("1/6"), _T("5/6"), _T("1/7"), _T("1/8"), _T("1/9"), _T("1/10"), _T("��), // 0x7D59 - 0x7D60 93/57 - 93/64 |
---|
459 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7D61 - 0x7D68 93/65 - 93/72 |
---|
460 |
_T("��), _T("��), _T("��), _T("��), _T("皃�), _T("��), _T("��), _T("(����"), |
---|
461 |
_T("��), _T("(��"), _T("(��"), _T("(紊ч�)"), _T("��), _T("(�潔�)"), _T("��), _T("��), |
---|
462 |
_T("��), _T("��), _T("��) // 0x7D79 - 0x7D7B 93/89 - 93/91 |
---|
463 |
}; |
---|
464 |
|
---|
465 |
static const TCHAR *aszSymbolsTable4[] = |
---|
466 |
{ |
---|
467 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E21 - 0x7E28 94/01 - 94/08 |
---|
468 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E29 - 0x7E30 94/09 - 94/16 |
---|
469 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E31 - 0x7E38 94/17 - 94/24 |
---|
470 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E39 - 0x7E40 94/25 - 94/32 |
---|
471 |
_T("(A)"), _T("(B)"), _T("(C)"), _T("(D)"), _T("(E)"), _T("(F)"), _T("(G)"), _T("(H)"), // 0x7E41 - 0x7E48 94/33 - 94/40 |
---|
472 |
_T("(I)"), _T("(J)"), _T("(K)"), _T("(L)"), _T("(M)"), _T("(N)"), _T("(O)"), _T("(P)"), // 0x7E49 - 0x7E50 94/41 - 94/48 |
---|
473 |
_T("(Q)"), _T("(R)"), _T("(S)"), _T("(T)"), _T("(U)"), _T("(V)"), _T("(W)"), _T("(X)"), // 0x7E51 - 0x7E58 94/49 - 94/56 |
---|
474 |
_T("(Y)"), _T("(Z)"), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E59 - 0x7E60 94/57 - 94/64 |
---|
475 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E61 - 0x7E68 94/65 - 94/72 |
---|
476 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E69 - 0x7E70 94/73 - 94/80 |
---|
477 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), // 0x7E71 - 0x7E78 94/81 - 94/88 |
---|
478 |
_T("��), _T("��), _T("��), _T("��), _T("��) |
---|
479 |
}; |
---|
480 |
|
---|
481 |
static const TCHAR *aszSymbolsTable5[] = |
---|
482 |
{ |
---|
483 |
_T("��), _T("篋�), _T("篁�), _T("篁�), _T("箴�), _T("篆�), _T("��), _T("��), |
---|
484 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("荅�), _T("��), _T("��), |
---|
485 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), |
---|
486 |
_T("��), _T("鍜�), _T("紜�), _T("紮�), _T("紲�), _T("紿�), _T("絲�), _T("鍜�), |
---|
487 |
_T("��), _T("綺�), _T("綣�), _T("綵�), _T("緇�), _T("��), _T("��), _T("��), |
---|
488 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("罅�), _T("��), _T("罎�), |
---|
489 |
_T("罎�), _T("罘�), _T("罟�), _T("罠�), _T("��), _T("��), _T("��), _T("罸�), |
---|
490 |
_T("羈�), _T("羇�), _T("鍠�), _T("羔�), _T("羞�), _T("羞�), _T("鍠�), _T("羹�), |
---|
491 |
_T("羶�), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), |
---|
492 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("鍠�), _T("��), _T("��), |
---|
493 |
_T("��), _T("��), _T("��), _T("禹�), _T("��), _T("��), _T("��), _T("��), |
---|
494 |
_T("脾�), _T("脾�), _T("腑�), _T("胼�), _T("��), _T("��) |
---|
495 |
}; |
---|
496 |
|
---|
497 |
static const TCHAR *aszSymbolsTable6[] = |
---|
498 |
{ |
---|
499 |
_T("��), _T("腱�), _T("腮�), _T("膈�), _T("膂�), _T("��), _T("膓�), _T("臂�), |
---|
500 |
_T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), |
---|
501 |
_T("��), _T("��), _T("��), _T("��), _T("茖�), _T("茹�), _T("茫�), _T("莊�), |
---|
502 |
_T("莨�), _T("菴�), _T("��), _T("��), _T("��), _T("��), _T("��), _T("��), |
---|
503 |
_T("��), _T("��), _T("��), _T("��), _T("蕕�), _T("薀�), _T("蕭�), _T("薇�), |
---|
504 |
_T("薹�), _T("藝�), _T("藝�) // 0x7649 - 0x764B 86/41 - 86/43 |
---|
505 |
}; |
---|
506 |
|
---|
507 |
// �激������������ if((wCode >= 0x7A50U) && (wCode <= 0x7A74U)){ |
---|
508 |
strcpy(lpszDst, aszSymbolsTable1[wCode - 0x7A50U]); |
---|
509 |
} |
---|
510 |
else if((wCode >= 0x7C21U) && (wCode <= 0x7C7BU)){ |
---|
511 |
strcpy(lpszDst, aszSymbolsTable2[wCode - 0x7C21U]); |
---|
512 |
} |
---|
513 |
else if((wCode >= 0x7D21U) && (wCode <= 0x7D7BU)){ |
---|
514 |
strcpy(lpszDst, aszSymbolsTable3[wCode - 0x7D21U]); |
---|
515 |
} |
---|
516 |
else if((wCode >= 0x7E21U) && (wCode <= 0x7E7DU)){ |
---|
517 |
strcpy(lpszDst, aszSymbolsTable4[wCode - 0x7E21U]); |
---|
518 |
} |
---|
519 |
else if((wCode >= 0x7521U) && (wCode <= 0x757EU)){ |
---|
520 |
strcpy(lpszDst, aszSymbolsTable5[wCode - 0x7521U]); |
---|
521 |
} |
---|
522 |
else if((wCode >= 0x7621U) && (wCode <= 0x764BU)){ |
---|
523 |
strcpy(lpszDst, aszSymbolsTable6[wCode - 0x7621U]); |
---|
524 |
} |
---|
525 |
else{ |
---|
526 |
strcpy(lpszDst, TEXT("��)); |
---|
527 |
} |
---|
528 |
|
---|
529 |
return strlen(lpszDst); |
---|
530 |
} |
---|
531 |
|
---|
532 |
void ProcessEscapeSeq(const BYTE byCode) |
---|
533 |
{ |
---|
534 |
|
---|
535 |
switch(m_byEscSeqCount){ |
---|
536 |
|
---|
537 |
case 1U : |
---|
538 |
switch(byCode){ |
---|
539 |
|
---|
540 |
case 0x6EU : LockingShiftGL(2U); m_byEscSeqCount = 0U; return; |
---|
541 |
case 0x6FU : LockingShiftGL(3U); m_byEscSeqCount = 0U; return; |
---|
542 |
case 0x7EU : LockingShiftGR(1U); m_byEscSeqCount = 0U; return; |
---|
543 |
case 0x7DU : LockingShiftGR(2U); m_byEscSeqCount = 0U; return; |
---|
544 |
case 0x7CU : LockingShiftGR(3U); m_byEscSeqCount = 0U; return; |
---|
545 |
|
---|
546 |
|
---|
547 |
case 0x24U : |
---|
548 |
case 0x28U : m_byEscSeqIndex = 0U; break; |
---|
549 |
case 0x29U : m_byEscSeqIndex = 1U; break; |
---|
550 |
case 0x2AU : m_byEscSeqIndex = 2U; break; |
---|
551 |
case 0x2BU : m_byEscSeqIndex = 3U; break; |
---|
552 |
default : m_byEscSeqCount = 0U; return; |
---|
553 |
break; |
---|
554 |
|
---|
555 |
|
---|
556 |
case 2U : |
---|
557 |
if(DesignationGSET(m_byEscSeqIndex, byCode)){ |
---|
558 |
m_byEscSeqCount = 0U; |
---|
559 |
return; |
---|
560 |
} |
---|
561 |
|
---|
562 |
switch(byCode){ |
---|
563 |
case 0x20 : m_bIsEscSeqDrcs = true; break; |
---|
564 |
case 0x28 : m_bIsEscSeqDrcs = true; m_byEscSeqIndex = 0U; break; |
---|
565 |
case 0x29 : m_bIsEscSeqDrcs = false; m_byEscSeqIndex = 1U; break; |
---|
566 |
case 0x2A : m_bIsEscSeqDrcs = false; m_byEscSeqIndex = 2U; break; |
---|
567 |
case 0x2B : m_bIsEscSeqDrcs = false; m_byEscSeqIndex = 3U; break; |
---|
568 |
default : m_byEscSeqCount = 0U; return; |
---|
569 |
break; |
---|
570 |
|
---|
571 |
|
---|
572 |
case 3U : |
---|
573 |
if(!m_bIsEscSeqDrcs){ |
---|
574 |
if(DesignationGSET(m_byEscSeqIndex, byCode)){ |
---|
575 |
m_byEscSeqCount = 0U; |
---|
576 |
return; |
---|
577 |
} |
---|
578 |
} |
---|
579 |
else{ |
---|
580 |
if(DesignationDRCS(m_byEscSeqIndex, byCode)){ |
---|
581 |
m_byEscSeqCount = 0U; |
---|
582 |
return; |
---|
583 |
} |
---|
584 |
} |
---|
585 |
|
---|
586 |
if(byCode == 0x20U){ |
---|
587 |
m_bIsEscSeqDrcs = true; |
---|
588 |
} |
---|
589 |
else{ |
---|
590 |
|
---|
591 |
return; |
---|
592 |
} |
---|
593 |
break; |
---|
594 |
|
---|
595 |
|
---|
596 |
case 4U : |
---|
597 |
DesignationDRCS(m_byEscSeqIndex, byCode); |
---|
598 |
m_byEscSeqCount = 0U; |
---|
599 |
return; |
---|
600 |
} |
---|
601 |
|
---|
602 |
m_byEscSeqCount++; |
---|
603 |
} |
---|
604 |
|
---|
605 |
void LockingShiftGL(const BYTE byIndexG) |
---|
606 |
{ |
---|
607 |
|
---|
608 |
m_pLockingGL = &m_CodeG[(int)byIndexG]; |
---|
609 |
} |
---|
610 |
|
---|
611 |
void LockingShiftGR(const BYTE byIndexG) |
---|
612 |
{ |
---|
613 |
|
---|
614 |
m_pLockingGR = &m_CodeG[(int)byIndexG]; |
---|
615 |
} |
---|
616 |
|
---|
617 |
void SingleShiftGL(const BYTE byIndexG) |
---|
618 |
{ |
---|
619 |
|
---|
620 |
m_pSingleGL = &m_CodeG[(int)byIndexG]; |
---|
621 |
} |
---|
622 |
|
---|
623 |
const bool DesignationGSET(const BYTE byIndexG_arg, const BYTE byCode) |
---|
624 |
{ |
---|
625 |
int byIndexG = (int)byIndexG_arg; |
---|
626 |
|
---|
627 |
|
---|
628 |
switch(byCode){ |
---|
629 |
case 0x42U : m_CodeG[byIndexG] = CODE_KANJI; return true; |
---|
630 |
case 0x4AU : m_CodeG[byIndexG] = CODE_ALPHANUMERIC; return true; |
---|
631 |
case 0x30U : m_CodeG[byIndexG] = CODE_HIRAGANA; return true; |
---|
632 |
case 0x31U : m_CodeG[byIndexG] = CODE_KATAKANA; return true; |
---|
633 |
case 0x32U : m_CodeG[byIndexG] = CODE_MOSAIC_A; return true; |
---|
634 |
case 0x33U : m_CodeG[byIndexG] = CODE_MOSAIC_B; return true; |
---|
635 |
case 0x34U : m_CodeG[byIndexG] = CODE_MOSAIC_C; return true; |
---|
636 |
case 0x35U : m_CodeG[byIndexG] = CODE_MOSAIC_D; return true; |
---|
637 |
case 0x36U : m_CodeG[byIndexG] = CODE_PROP_ALPHANUMERIC; return true; |
---|
638 |
case 0x37U : m_CodeG[byIndexG] = CODE_PROP_HIRAGANA; return true; |
---|
639 |
case 0x38U : m_CodeG[byIndexG] = CODE_PROP_KATAKANA; return true; |
---|
640 |
case 0x49U : m_CodeG[byIndexG] = CODE_JIS_X0201_KATAKANA; return true; |
---|
641 |
case 0x39U : m_CodeG[byIndexG] = CODE_JIS_KANJI_PLANE_1; return true; |
---|
642 |
case 0x3AU : m_CodeG[byIndexG] = CODE_JIS_KANJI_PLANE_2; return true; |
---|
643 |
case 0x3BU : m_CodeG[byIndexG] = CODE_ADDITIONAL_SYMBOLS; return true; |
---|
644 |
default : return false; |
---|
645 |
} |
---|
646 |
} |
---|
647 |
|
---|
648 |
const bool DesignationDRCS(const BYTE byIndexG_arg, const BYTE byCode) |
---|
649 |
{ |
---|
650 |
int byIndexG = (int)byIndexG_arg; |
---|
651 |
|
---|
652 |
|
---|
653 |
switch(byCode){ |
---|
654 |
case 0x40U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
655 |
case 0x41U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
656 |
case 0x42U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
657 |
case 0x43U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
658 |
case 0x44U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
659 |
case 0x45U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
660 |
case 0x46U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
661 |
case 0x47U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
662 |
case 0x48U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
663 |
case 0x49U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
664 |
case 0x4AU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
665 |
case 0x4BU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
666 |
case 0x4CU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
667 |
case 0x4DU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
668 |
case 0x4EU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
669 |
case 0x4FU : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
670 |
case 0x70U : m_CodeG[byIndexG] = CODE_UNKNOWN; return true; |
---|
671 |
default : return false; |
---|
672 |
} |
---|
673 |
} |
---|