home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / rxjis096.zip / jis2pc.cmd < prev    next >
OS/2 REXX Batch file  |  1997-08-09  |  2KB  |  48 lines

  1. /* product name: RXJIS                                                */
  2. /* Version:      0.90                                                 */
  3. /* author:       YANO Takashi                                         */
  4. /* target:       OS/2 Warp J3.0+ (J2.1 is possible)                   */
  5. /* source name:  JIS2PC.CMD                                           */
  6. /* address:      tyano@ca2.so-net.or.jp or tyano@yamato.ibm.co.jp     */
  7. /* comment:      RXJIS is a utility functions for REXX.               */
  8. /*               This header file is a interface to be called from    */
  9. /*               C/C++.                                               */
  10. /* History:                                                           */
  11. /*                                                                    */
  12. /* This is a part of build tool.                                      */
  13. arg fn
  14. if fn = '' then fn = 'jis2pc.dat'
  15. parse var fn cfn '.' .
  16. cfn = cfn || '.cpp'
  17. tb. = 0
  18. do while lines(fn)
  19.    parse value linein(fn) with jc pc .
  20.    if jc = 0 then iterate
  21.    tb.i = 1
  22.    i = left(jc, 2)
  23.    j = right(jc, 2)
  24.    tb.i.j = pc
  25. end /* do */
  26. call SysFileDelete cfn
  27. call lineout cfn, '#include <limits.h>'
  28. call lineout cfn, '#include <os2.h>'
  29. call lineout cfn, '#include "jis2pc.hpp"'
  30. call lineout cfn, '#pragma data_seg(rxjistbl)'
  31. do i = 1 to 256
  32.    if tb.i = 0 then iterate
  33.    call lineout cfn, 'static wchar_t jiscode2pccode_' || d2x(i - 1) || '[UCHAR_MAX+1] = {'
  34.    do j = 1 to 256
  35.       if tb.i.j = 0 then call lineout cfn, '0x81ac,'
  36.       else call lineout cfn, '0x' || tb.i.j || ','
  37.    end /* do */
  38.    call lineout cfn, '};'
  39. end /* do */
  40. call lineout cfn, 'wchar_t _Export *JisCodeToPcCodeTable[UCHAR_MAX+1] = {'
  41. do i = 1 to 256
  42.    if tb.i = 0 then call lineout cfn, 'NULL,'
  43.    else call lineout cfn, 'jiscode2pccode_' || d2x(i - 1) || ','
  44. end /* do */
  45. call lineout cfn, '};'
  46. call stream cfn, 'c', 'close'
  47. exit
  48.