home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
ppwizard.zip
/
bin2ppw.cmd
next >
Wrap
OS/2 REXX Batch file
|
2000-02-09
|
3KB
|
78 lines
/*
* Generator : PPWIZARD version 2K.020
* : FREE tool for OS/2, Windows, DOS and UNIX by Dennis Bareis (dbareis@labyrinth.net.au)
* : http://www.labyrinth.net.au/~dbareis/ppwizard.htm
* Time : Wednesday, 9 Feb 2000 8:01:43pm
* Input File : E:\DB\PROJECTS\OS2\ppwizard\BIN2PPW.X
* Output File : .\OUT\bin2ppw.cmd
*/
if arg(1)="!CheckSyntax!" then exit(21924)
PgmVersion="2K.039"
Parameters=arg(1)
if Parameters='' then
SyntaxError('No parameters passed')
parse var Parameters InputFile Longest Indent RexxVarName
InputFile=strip(InputFile)
if stream(InputFile, 'c', 'query exists') = '' then
SyntaxError('The input file "' || InputFile || '" does not exist.')
if Longest='' then
Longest=16*4
if Indent<> '' then
Indent=copies(' ',Indent)
if RexxVarName='' then
RexxVarName='BinaryData'
DefineRexxS=Indent|| "#DefineRexx ''"
DefineRexxE=Indent|| "#DefineRexx"
say ''
say Indent|| ';---[ ' || InputFile || ' ]----------------------------'
Indent=Indent||copies(' ',7)
say DefineRexxS
say Indent|| 'B = ""'
CharsEachLine=length(Indent)+9+(Longest*2)+3
MaxLines=(1024%CharsEachLine)-1
if MaxLines<1 then
MaxLines=1
TotalRead=0
LinesThisBlock=0
CloseRc=stream(InputFile, 'c', 'close')
do until DataLength<>Longest
Data=charin(InputFile,,Longest)
DataLength=length(Data)
say Indent|| 'B = B || "' || c2x(Data) || '"x'
TotalRead=TotalRead+DataLength
LinesThisBlock=LinesThisBlock+1
end
say Indent||RexxVarName|| ' = B'
say DefineRexxE
CloseRc=stream(InputFile, 'c', 'close')
exit(0)
SyntaxError:
ExitRc=SIGL
say '[]---------------------------------------------------------------[]'
say '| BIN2PPW.CMD: Version ' || PgmVersion || ' (C)opyright Dennis Bareis 1998 |'
say '| http://www.labyrinth.net.au/~dbareis (db0@anz.com) |'
say '[]---------------------------------------------------------------[]'
say ''
say 'This is a simple command to convert a binary file into a PPWIZARD "#evaluate"'
say 'command which creates a rexx variable. You can regenerate the file using'
say 'simple rexx commands within PPWIZARD (see end of OL_DOC.DH for an example).'
say ''
say 'CORRECT SYNTAX'
say '~~~~~~~~~~~~~~'
say ' BIN2PPW[.CMD] InputFile [Longest [Indent [RexxVarName]]] [>OutputFile]'
say ''
say 'WHERE'
say '~~~~~'
say ' InputFile = Name of Input File (all other parameters optional)'
say ' Longest = Maximum number of bytes to dump in one line'
say ' Indent = Number of spaces for indenting (0 = none)'
say ' RexxVarName = Name of rexx variable to hold result'
say ''
say 'THE PROBLEM'
say '~~~~~~~~~~~'
say ' ' || arg(1) || ''
exit(ExitRc)