home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
ppw1320.zip
/
rexx4ppw.zip
/
rexx4ppw.rex
Wrap
OS/2 REXX Batch file
|
2001-10-31
|
6KB
|
227 lines
/*
* Generator : PPWIZARD version 01.303
* : FREE tool for Windows, OS/2, DOS and UNIX by Dennis Bareis (dbareis@labyrinth.net.au)
* : http://www.labyrinth.net.au/~dbareis/ppwizard.htm
* Time : Wednesday, 31 Oct 2001 7:00:03pm
* Input File : C:\DBAREIS\Projects\MultiOs\PPWIZARD\rexx4ppw.x
* Output File : out\rexx4ppw.RE_
*/
if arg(1)="!CheckSyntax!" then exit(21924)
PgmVersion = "01.304"
Failed = 0
Passed = 0
say '[]-------------------------------------------------------------------------[]'
say '| REXX4PPW.CMD: Version ' || PgmVersion || ' (C)opyright Dennis Bareis 1999 |'
say '| http://www.labyrinth.net.au/~dbareis/index.htm (dbareis@labyrinth.net.au) |'
say '[]-------------------------------------------------------------------------[]'
say ''
call CheckCmdLineParameters arg(1), arg(2)
call ShowParseVersion
call ShowParseSource
call ShowCharacterEncoding
call ShowAddress
call TestVarLength
call TestUNAME
call TestStreamQueryExists
call TestSleepCmd
call TestEnvironment
call TestInterpret
call TestSimpleCmds
say ''
say 'SUMMARY'
say '~~~~~~~'
if Failed = 0 then
say 'All ' || Passed || ' tests passed'
else
say 'Failed ' || Failed || ' tests, passed ' || passed || ' tests'
exit(Failed)
CheckCmdLineParameters:
if arg(2) <> '' then
call Fail 'Have value of "' || arg(2) || ' in arg(2)'
else
do
ExpectedArgs = "TEST REXX"
if translate(arg(1)) = ExpectedArgs then
call Pass 'Command line parameters are OK'
else
do
call Fail 'Expected arg(1) = "' || ExpectedArgs || '", not "' || arg(1) || '"!'
say 'NOTE'
say '~~~~'
say 'You should start this program with the command:'
say ''
say ' rexx4ppw TEST REXX'
say ''
say 'If you didn''t then please restart the test and add the parameters!'
say ''
end
end
return
ShowParseSource:
parse source Result
call Info 'Parse SOURCE = "' || Result || '"'
return
ShowParseVersion:
parse version Result
call Info 'Parse VERSION = "' || Result || '"'
return
ShowAddress:
call Info 'ADDRESS() = "' || address() || '"'
return
ShowCharacterEncoding:
if '1' = 'F1'x then
Encoding = "EBCDIC"
else
Encoding = "ASCII"
call Info 'CHAR ENCODING = "' || Encoding || '"'
return
TestInterpret:
NlOk = TestNewLineInInterpret()
if NlOk = 'Y' then
Sep = d2c(10)
else
Sep = ';'
Fred = 0
SingleCmd = 'Fred = Fred + 1' || Sep
lSingleCmd= length(SingleCmd)
TestF = 50
TestT = 10000
OkLng = 0
signal on SYNTAX name TrapTestInterpretLng
do MaxLng = TestF to TestT by 50
ReqCnt = MaxLng % lSingleCmd
RealLng = ReqCnt * lSingleCmd
interpret copies(SingleCmd, ReqCnt)
OkLng = RealLng
end
call INFO 'Tested interpret length from ' || TestF || ' to ' || TestT || ', All OK'
return
TrapTestInterpretLng:
call INFO 'Biggest Interpret length was ' || OkLng || ', failed on ' || RealLng || ' bytes'
return
TestNewLineInInterpret:
Fred = 1
RexxCmds = 'Fred = Fred + 1'
RexxCmds = RexxCmds || d2c(10) || RexxCmds
signal on SYNTAX name TrapTestNewLineInInterpret
interpret RexxCmds
if Fred = 3 then
do
call INFO "interpret cmd takes multiple commands seperated by NewLines"
return('Y')
end
call FAIL 'interpret cmd did not die (from NewLines), however FRED = "' || Fred || '"!'
return('N')
TrapTestNewLineInInterpret:
call INFO 'interpret cmd does not like imbedded newlines'
return('N')
TestVarLength:
FoundBad = 0
MaxTest = 2000
do Index = 1 to MaxTest
Var = copies('A', Index)
if symbol(Var) = 'BAD' then
do
FoundBad = Index
leave
end
end
if FoundBad = 0 then
call Info 'Tried variable name lengths from 1 to ' || MaxTest || ', all OK'
else
call Info 'Max variable name length is ' || FoundBad-1
return
TestSleepCmd:
call Info 'Testing for Sleep() function'
signal on SYNTAX name TrapTestSleepCmd
call time 'R'
call Sleep 3
call PASS 'Seem to have a sleep(), did it sleep for 3 seconds? (Elapsed=' || time('E') || ')'
return
TrapTestSleepCmd:
call FAIL 'No function called Sleep(), or takes different parms'
return
TestStreamQueryExists:
call Info 'Testing for Stream("query exists") function'
signal on SYNTAX name TrapTestStreamQueryExists
FullName = stream('rexx4ppw.rex', 'c', 'query exists')
call PASS 'Seem to have a stream("query exists") - FULLNAME= "' || FullName || '"'
return
TrapTestStreamQueryExists:
call FAIL 'Died trying a stream("query exists")'
return
TestUNAME:
call Info 'Testing for uname() function'
signal on SYNTAX name TrapTestUnameCmd
UnameValue = uname()
call INFO 'uname() exists, RETURNED: ' || UnameValue
return
TrapTestUnameCmd:
call INFO 'uname() does not exist.'
return
TestEnvironment:
call TryEnv 'OS2ENVIRONMENT'
call TryEnv 'ENVIRONMENT'
call TryEnv 'SYSTEM'
return
TryEnv:
TestValue = "TestValue"
signal on SYNTAX name TrapTryEnv
call value "REXX4PPW", TestValue, arg(1)
BackFromEnv = value("REXX4PPW",, arg(1))
if BackFromEnv = TestValue then
call Info 'Environment is addressed by "' || arg(1) || '"'
else
call Info 'Addressed Environment by "' || arg(1) || '", no syntax error but got wrong value of "' || BackFromEnv || '"'
return
TrapTryEnv:
call Info 'Environment not addressed by "' || arg(1) || '"'
return
TestSimpleCmds:
say 'DIR'
say '~~~'
'dir'
say 'LS'
say '~~'
'ls'
say 'FIND --help'
say '~~~~~~~~~~~'
'find --help'
return
Info:
say 'INFO: ' || arg(1)
return
Fail:
say 'FAIL: ' || arg(1)
Failed = Failed + 1
return
Pass:
say 'PASS: ' || arg(1)
Passed = Passed + 1
return