home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxface.zip / xbm2xface.cmd < prev    next >
OS/2 REXX Batch file  |  1998-02-01  |  2KB  |  58 lines

  1. /*
  2.  * xbm2xface.cmd  --- X-Face strings generator
  3.  *
  4.  *         Copyright (C) 1997-1998  OKUNISHI Fujikazu
  5.  *
  6.  * Author:  OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
  7.  * Created: Jul 30, 1997
  8.  * Revised: Feb  1, 1998
  9.  *
  10.  * how2use:
  11.  *  ex.)
  12.  *   1a. xbm2xface.cmd foo.xbm > foo.xface [RET]
  13.  *   1b. xbm2xface.cmd < foo.xbm > foo.xface [RET]
  14.  *   2.  cat foo.xbm |xbm2xface.cmd [RET]    ## to STDOUT
  15.  */
  16.  
  17.   If RxFuncQuery('SysLoadFuncs') Then Do
  18.     Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  19.     Call SysLoadFuncs
  20.   End
  21.  
  22.   Parse Arg IN .
  23.   If IN='' Then Do; If Lines()==0 Then Exit 255; IN='STDIN'; End
  24.            Else If Stream(IN,'C','Query Exist') ='' Then Exit 255
  25.  
  26.   OUT=SysTempFileName(')_icon_(.???')
  27. /*EOL=d2c(13)||d2c(10)*/
  28.   EOL=d2c(10)
  29.   COMPFACE = SysSearchPath('PATH','compface.exe')
  30.    If COMPFACE='' Then Exit
  31.  
  32.   str=''  /*initialize*/
  33.  
  34.   Do i=1 By 1 While Lines(IN)
  35.     str.i= Linein(IN)
  36.     If Left(Word(str.i,1),2)<>'0x' Then Iterate
  37.     Do While Length(str.i) > 0
  38.       Parse Var str.i '0x' strA.i ',' str.i
  39.       strA.i =Substr(strA.i,1,2)
  40.       If Datatype(strA.i,'X') <>1 Then Leave
  41.       strA.i = B2X(Reverse(X2b(strA.i)))
  42.       str = str strA.i
  43.     End
  44.   End
  45.  
  46.   Do n=1 By 1 While Length(str) > 0
  47.     Parse Var str strA.n strB.n str
  48.     str.n = '0x' || strA.n || strB.n || ',' /*||EOL*/
  49.     Call CharOut OUT,str.n || EOL
  50.   End
  51.   Call LineOut OUT /*close*/
  52.  
  53.   '@'COMPFACE OUT
  54.   rc= SysFileDelete(OUT)
  55. Exit
  56.  
  57. /* end of procedure */
  58.