home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
rxjis096.zip
/
ibm2jis.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-08-09
|
2KB
|
62 lines
/* product name: RXJIS */
/* Version: 0.90 */
/* author: YANO Takashi */
/* target: OS/2 Warp J3.0+ (J2.1 is possible) */
/* source name: IBM2JIS.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++. */
/* */
/* This is a part of build tool. */
arg fn
if fn = '' then fn = directory() || '\ibm2jis.dat'
parse value filespec('N', fn) with cfn '.' .
cfn = directory() || '\' || cfn || '.cpp'
tb. = ''
m = 0
do while lines(fn)
parse value linein(fn) with cd st .
m = max(m, conststrlen(st))
i = x2d(left(cd, 2)) + 1
j = x2d(right(cd, 2)) + 1
tb.i.j = st
tb.i = 1
end /* do */
call SysFileDelete cfn
call lineout cfn, '#include <limits.h>'
call lineout cfn, '#include <os2.h>'
call lineout cfn, '#pragma data_seg(rxjistbl)'
call lineout cfn, '#include "ibm2jis.hpp"'
do i = 1 to 256
if tb.i = '' then iterate
call lineout cfn, 'static const PCHAR ibmToJisTable_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
do j = 1 to 256
if tb.i.j = '' then call lineout cfn, 'NULL,'
else call lineout cfn, tb.i.j || ','
end /* do */
call lineout cfn, '};'
end /* do */
call lineout cfn, 'const PCHAR _Export *IbmToJisTable[UCHAR_MAX+1] = {'
do i = 1 to 256
if tb.i = '' then call lineout cfn, 'NULL,'
else call lineout cfn, 'ibmToJisTable_' || d2x(i - 1) || ','
end /* do */
call lineout cfn, '};'
call lineout cfn, 'int _Export maxIbm2JisSize =' m || ';'
call stream cfn, 'c', 'close'
exit
conststrlen: procedure
parse arg '"' a '"'
l = 0
do while length(a) > 0
select
when translate(left(a, 2)) = '\X' then a = substr(a, 5)
otherwise
a = substr(a, 2)
end /* select */
l = l + 1
end /* do */
return l