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

  1. /*
  2.  *  xbm2VREXX.cmd  ---  Display 48*48 XBM in VREXX Window
  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.  *   1.  xface.cmd +x-face/6 | xbm2VREXX.cmd [RET]
  13.  *   2a. xbm2VREXX.cmd foo.xbm [RET]
  14.  *   2b. xbm2VREXX.cmd < foo.xbm [RET]
  15.  */
  16.  
  17.   Parse Arg IN .
  18.  
  19.   Call INIT
  20.   Call PARSE_XBM
  21.   Call DRAW_PIXEL
  22.   Call CLEAN
  23. Exit
  24.  
  25.  
  26. INIT:
  27.   If IN='' Then Do; If Lines()==0 Then Exit 255; IN='STDIN'; End
  28.            Else If Stream(IN,'C','Query Exist') ='' Then Exit 255
  29.   str=''
  30.  
  31.   If RxFuncQuery('VInit') Then
  32.     Call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  33.   If VInit() =='ERROR' then Do; Call VExit; Exit 999; End
  34.  
  35.   /* VREXX variables */
  36.   pos.left   = 0
  37.   pos.bottom = 0
  38.   pos.right  = 100
  39.   pos.top    = 100
  40.   msg.0 = 1
  41.   msg.1 = 'Press OK to close the windows'
  42. Return
  43.  
  44.  
  45. PARSE_XBM:
  46.   Do i=1 By 1 While Lines(IN)
  47.     str.i= Linein(IN)
  48.     If Left(Word(str.i, 1), 2)<>'0x' Then Iterate
  49.     Do Until Length(str.i)==0
  50.       Parse Var str.i '0x' strA.i ',' str.i
  51.       strA.i =Substr(strA.i, 1, 2)
  52.       If Datatype(strA.i, 'X') <>1 Then Leave
  53.       strA.i = B2X(Reverse(X2b(strA.i)))
  54.       str = str strA.i
  55.     End
  56.   End
  57.   j=1
  58.   Do i=48 By -1 While Length(str)>0
  59.     Parse Var str str1.i str2.i str3.i str4.i str5.i str6.i str
  60.     line.i= X2B(str1.i||str2.i||str3.i||str4.i||str5.i||str6.i)
  61.   /*Say Line.i*/
  62.     Do k=1 To Length(line.i)
  63.       y.j=i
  64.       x.j=Substr(line.i, k, 1)
  65.       If x.j Then x.j=k
  66.         Else Do; Drop y.j;Drop x.j; Iterate; End
  67.       j=j+1
  68.     End
  69.   End
  70.   j=j-1
  71. Return
  72.  
  73.  
  74. DRAW_PIXEL:  /* Drawing */
  75.   id = VOpenWindow('X-Face Graphics Window', 'WHITE', pos)
  76. /*Call VForeColor id, 'BLUE'*/
  77.   Call VDraw id, 'PIXEL', x, y, j
  78.   Call VMsgBox 'XBM2VREXX', msg, 1
  79.   Call VCloseWindow id
  80. Return
  81.  
  82.  
  83. CLEAN:
  84. SYNTAX:
  85. HALT:
  86. FAILURE:
  87.   rb=VExit()
  88. Return
  89.  
  90. /* end of procedure */
  91.