home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
rxjis096.zip
/
jiscase.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1998-09-26
|
8KB
|
251 lines
/* product name: RXJIS */
/* Version: 0.92 */
/* author: YANO Takashi */
/* target: OS/2 Warp J3.0+ (J2.1 is possible) */
/* source name: JISCASE.CMD */
/* address: tyano@ca2.so-net.or.jp or tyano@yamato.ibm.co.jp */
/* comment: RXJIS is a utility functions for REXX. */
/* This header file is a interface to be called from */
/* C/C++. */
/* History: */
/* 1997-9-5 0.92 Add RxJisKanjiAlias/JisKanjiAlias function */
/* 1998-9-30 0.95 Fix RxJisToAscii Conv problem */
/* */
/* This is a part of build tool. */
fn = 'jiscase1.dat'
cfn = 'jiscase.cpp'
tb. = 0
do while lines(fn)
parse value linein(fn) with lo up .
if length(lo) = 1 then do
h = 0
l = c2d(lo)
end /* do */
else do
h = c2d(left(lo, 1))
l = c2d(substr(lo, 2, 1))
end /* do */
i = h + 1
if tb.i = 0 then do
do j = 1 to 256
tb.i.j = right('0' || d2x(i - 1), 2) || right('0' || d2x(j - 1), 2)
end /* do */
tb.i = 1
end /* do */
options 'EXMODE'
j = l + 1
tb.i.j = c2x(up)
options 'NOEXMODE'
end /* do */
call SysFileDelete cfn
call lineout cfn, '#include <limits.h>'
call lineout cfn, '#include <os2.h>'
call lineout cfn, '#include "jiscase.hpp"'
call lineout cfn, '#pragma data_seg(rxjistbl)'
do i = 1 to 256
if tb.i = 0 then iterate
call lineout cfn, 'static wchar_t uppercasetable_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
do j = 1 to 256
call lineout cfn, '0x' || tb.i.j || ','
end /* do */
call lineout cfn, '};'
end /* do */
call lineout cfn, 'PWCHAR_T _Export UppercaseTable[UCHAR_MAX+1] = {'
do i = 1 to 256
if tb.i = 0 then call lineout cfn, 'NULL,'
else call lineout cfn, 'uppercasetable_' || d2x(i - 1) || ','
end /* do */
call lineout cfn, '};'
fn = 'jiscase2.dat'
tb. = 0
tb.33 = 8140
do while lines(fn)
parse value linein(fn) with sc dc .
i = c2d(sc) + 1
options 'EXMODE'
tb.i = c2x(dc)
options 'NOEXMODE'
end /* do */
call lineout cfn, 'wchar_t _Export ToDbcsTable1[UCHAR_MAX+1] = {'
do i = 1 to 256
call lineout cfn, "L'\x" || right('0000' || tb.i, 4) || "',"
end /* do */
call lineout cfn, '};'
fn = 'jiscase3.dat'
tb. = 0
do while lines(fn)
parse value linein(fn) with sc dc .
i = c2d(left(sc, 1)) + 1
options 'EXMODE'
tb.i = c2x(dc)
options 'NOEXMODE'
end /* do */
call lineout cfn, 'wchar_t _Export ToDbcsTable2[UCHAR_MAX+1] = {'
do i = 1 to 256
call lineout cfn, "L'\x" || right('0000' || tb.i, 4) || "',"
end /* do */
call lineout cfn, '};'
fn = 'jiscase4.dat'
tb. = 0
do while lines(fn)
parse value linein(fn) with sc dc .
i = c2d(left(sc, 1)) + 1
options 'EXMODE'
tb.i = c2x(dc)
options 'NOEXMODE'
end /* do */
call lineout cfn, 'wchar_t _Export ToDbcsTable3[UCHAR_MAX+1] = {'
do i = 1 to 256
call lineout cfn, "L'\x" || right('0000' || tb.i, 4) || "',"
end /* do */
call lineout cfn, '};'
fn = 'jiscase5.dat'
tb. = 0
do while lines(fn)
parse value linein(fn) with d1 d2 .
h = c2d(left(d1, 1))
l = c2d(substr(d1, 2, 1))
i = h + 1
if tb.i = 0 then do
do j = 1 to 256
tb.i.j = right('0' || d2x(i - 1), 2) || right('0' || d2x(j - 1), 2)
end /* do */
tb.i = 1
end /* do */
options 'EXMODE'
j = l + 1
tb.i.j = c2x(d2)
options 'NOEXMODE'
end /* do */
do i = 1 to 256
if tb.i = 0 then iterate
call lineout cfn, 'static wchar_t todbcstable4_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
do j = 1 to 256
call lineout cfn, '0x' || tb.i.j || ','
end /* do */
call lineout cfn, '};'
end /* do */
call lineout cfn, 'PWCHAR_T _Export ToDbcsTable4[UCHAR_MAX+1] = {'
do i = 1 to 256
if tb.i = 0 then call lineout cfn, 'NULL,'
else call lineout cfn, 'todbcstable4_' || d2x(i - 1) || ','
end /* do */
call lineout cfn, '};'
fn = 'jiscase6.dat'
tb. = 0
do while lines(fn)
parse value linein(fn) with d1 d2 .
h = c2d(left(d1, 1))
l = c2d(substr(d1, 2, 1))
i = h + 1
if tb.i = 0 then do
do j = 1 to 256
tb.i.j = 0
end /* do */
tb.i = 1
end /* do */
options 'EXMODE'
j = l + 1
tb.i.j = c2x(d2)
options 'NOEXMODE'
end /* do */
do i = 1 to 256
if tb.i = 0 then iterate
call lineout cfn, 'static wchar_t todbcstable5_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
do j = 1 to 256
call lineout cfn, '0x' || tb.i.j || ','
end /* do */
call lineout cfn, '};'
end /* do */
call lineout cfn, 'PWCHAR_T _Export ToDbcsTable5[UCHAR_MAX+1] = {'
do i = 1 to 256
if tb.i = 0 then call lineout cfn, 'NULL,'
else call lineout cfn, 'todbcstable5_' || d2x(i - 1) || ','
end /* do */
call lineout cfn, '};'
fn = 'jiscase7.dat'
tb. = 0
i = x2d('81') + 1
j = x2d('40') + 1
tb.i = 1
tb.i.j = '\x20'
do while lines(fn)
parse value linein(fn) with d1 s1 .
h = c2d(left(d1, 1))
l = c2d(substr(d1, 2, 1))
i = h + 1
if tb.i = 0 then do
do j = 1 to 256
tb.i.j = 0
end /* do */
tb.i = 1
end /* do */
v = ''
do j = 1 to length(s1)
v = v || '\x' || right('0' || c2x(substr(s1, j, 1)), 2)
end /* do */
j = l + 1
tb.i.j = v
end /* do */
do i = 1 to 256
if tb.i = 0 then iterate
call lineout cfn, 'static PCHAR tosbcstable_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
do j = 1 to 256
if tb.i.j = 0 then call lineout cfn, "NULL,"
else call lineout cfn, '"' || tb.i.j || '",'
end /* do */
call lineout cfn, '};'
end /* do */
call lineout cfn, 'PCHAR* _Export ToSbcsTable[UCHAR_MAX+1] = {'
do i = 1 to 256
if tb.i = 0 then call lineout cfn, 'NULL,'
else call lineout cfn, 'tosbcstable_' || d2x(i - 1) || ','
end /* do */
call lineout cfn, '};'
fn = 'jiscase8.dat'
tb. = ''
m = 0
do while lines(fn)
a = linein(fn)
z = a
c = ''
options 'EXMODE'
m = max(m, length(a))
do i = 1 by 1 while a <> ''
parse var a c.i 2 a
c = c || '\x' || c2x(c.i)
end /* do */
options 'NOEXMODE'
c.0 = i - 1
do n = 1 to c.0
h = c2d(left(c.n, 1))
l = c2d(substr(c.n, 2, 1))
i = h + 1
v = ''
j = l + 1
if tb.i.j <> '' then do
say z
end /* do */
tb.i.j = c
tb.i = 1
end /* do */
end /* do */
do i = 1 to 256
if tb.i = '' then iterate
call lineout cfn, 'static PWCHAR_T kanjialiastable_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
do j = 1 to 256
if tb.i.j = '' then call lineout cfn, "NULL,"
else call lineout cfn, 'L"' || tb.i.j || '",'
end /* do */
call lineout cfn, '};'
end /* do */
call lineout cfn, 'PWCHAR_T* _Export KanjiAliasTable[UCHAR_MAX+1] = {'
do i = 1 to 256
if tb.i = '' then call lineout cfn, 'NULL,'
else call lineout cfn, 'kanjialiastable_' || d2x(i - 1) || ','
end /* do */
call lineout cfn, '};'
call lineout cfn, 'const int _Export maxKanjiAliasSize =' m + 1 || ';'
call stream cfn, 'c', 'close'
exit