home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxface.zip
/
any2RGBxbm.cmd
next >
Wrap
OS/2 REXX Batch file
|
1998-02-01
|
2KB
|
67 lines
/*
* any2RGBxbm.cmd -- GIF/BMP(OS2-1.3,Windoze)/XPM/PPM to RGB-XBM
*
* Copyright (C) 1997-1998 OKUNISHI Fujikazu
*
* Author: OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
* Created: Aug 22, 1997
* Revised: Feb 1, 1998
*
* how2use:
* ex.) any2RGBxbm.cmd foo.bmp[RET]
*
*/
Trace Off; '@echo off'
If RxFuncQuery('SysLoadFuncs') Then Do
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
End
Parse Arg src .
If src='' Then Call EMSG(255 'error: no src file' src)
If Stream(src,'C','Query Exist')=''
Then Call EMSG(255 'error: no such file:' src)
pgmFiles = 'noname.red noname.grn noname.blu'
fspec = Left(src, LastPos('.',src) -1)
rgbPbm = fspec || '.pbm'
dstXbm = fspec || '.xbm'
tmpFiles = pgmFiles rgbPbm
head=Translate(Linein(src))
Select
When Left(head,3)='GIF' Then filter='giftopnm.exe'
When Left(head,2)='BM' Then filter='bmptoppm.exe'
When Pos('XPM',head)<>0 Then filter='xpmtoppm.exe'
When head='P3' Then filter='cat.exe' /*no operation*/
Otherwise Call EMSG(2 'error: invalid file format')
End
If SysSearchPath('PATH',filter)=''
Then Call EMSG(1 "error: can't find filter:" filter)
filter src '|ppmtorgb3'
/*'pnmcat -lr' pgmFiles '|pgmtopbm |pbmtoxbm>' dstXbm*/
/*'pnmcat -tb' pgmFiles '|pgmtopbm |pbmtoxbm>' dstXbm*/
'pnmcat -tb' pgmFiles '|pgmtopbm>' rgbPbm /* `#define fspec_width=' */
'pbmtoxbm' rgbPbm '>' dstXbm
/* clean */
Do While Words(tmpFiles)>0
Parse Var tmpFiles del tmpFiles
Call SysFileDelete(del)
End
Exit
/* ----------------------------------------------------------------- */
EMSG: Procedure
Parse Arg errcode msg
Call LineOut STDERR,msg
Exit errcode
/* end of procedure */