home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vxdemo.zip
/
SYSTEM.$$$
/
RXCONS.VRM
< prev
next >
Wrap
Text File
|
1993-09-01
|
5KB
|
196 lines
/* Custom mainline for macro */
call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
call VRLoadFuncs
_VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
if( _VREVersion < 1.01 )then do
call VRMessage "", "This program requires VX-REXX version 1.01 to run", "Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
signal on SYNTAX name _VRESyntax
signal _VREMain
_VRESyntax:
parse source . . _VRESourceSpec
call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
_VREMain:
/*:VRX Main
*/
/* Main
*/
Main:
/* Process the arguments.
Get the parent window.
*/
parse source . calledAs .
parent = ""
argCount = arg()
argOff = 0
if( calledAs \= "COMMAND" )then do
if argCount >= 1 then do
parent = arg(1)
argCount = argCount - 1
argOff = 1
end
end
InitArgs.0 = argCount
if( argCount > 0 )then do i = 1 to argCount
InitArgs.i = arg( i + argOff )
end
drop calledAs argCount argOff
/* Load the windows
*/
call VRInit
parse source . . spec
_VREPrimaryWindowPath = ,
VRParseFileName( spec, "dpn" ) || ".VRW"
_VREPrimaryWindow = ,
VRLoad( parent, _VREPrimaryWindowPath )
drop parent spec
if( _VREPrimaryWindow == "" )then do
call VRMessage "", "Cannot load window:" VRError(), ,
"Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
/* Process events
*/
call Init
signal on halt
do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
_VREEvent = VREvent()
interpret _VREEvent
end
_VREHalt:
_VREReturnValue = Fini()
call VRDestroy _VREPrimaryWindow
_VRELeaveMain:
call VRFini
exit _VREReturnValue
VRLoadSecondary: procedure
name = arg( 1 )
window = VRLoad( VRWindow(), VRWindowPath(), name )
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
return window
/*:VRX Comments
*/
Comments:
/*
RXCons: Generate a prototype for the REXX constructs
Usage: call RXCons <Parent>
Where: Parent is the parent window for the dialog
*/
return
/*:VRX Error
*/
Error: procedure
field = arg( 1 )
error = arg( 2 )
call VRMessage VRWindow(), error, "Error"
call VRMethod field, "SetFocus"
return
/*:VRX Fini
*/
Fini:
window = VRWindow()
call VRSet window, "Visible", 0
drop window
return Prototype
/*:VRX Halt
*/
Halt:
signal _VREHalt
return
/*:VRX Init
*/
Init:
Prototype = ""
/* Only one argument is accepted, which identifies what kind of REXX
construct it is. The argument is a string, e.g. "IF-THEN-ELSE".
*/
cons_name = InitArgs.2
select
when cons_name == "if-then" then
Prototype = "if a = b then do" || "0d0a"x || "end" || "0d0a"x
when cons_name == "if-then-else" then
Prototype = "if a = b then do" || "0d0a"x || "end" || "0d0a"x ||,
"else do" || "0d0a"x || "end" || "0d0a"x
when cons_name == "simple-do" then
Prototype = "do" || "0d0a"x || "end" || "0d0a"x
when cons_name == "do-while" then
Prototype = "do while a = b" || "0d0a"x || "end" || "0d0a"x
when cons_name == "do-until" then
Prototype = "do until a = b" || "0d0a"x || "end" || "0d0a"x
when cons_name == "simple-iterative-loop" then
Prototype = "do 100" || "0d0a"x || "end" || "0d0a"x
when cons_name == "unconditional-iterative-loop" then
Prototype = "do index = 1 to 100" || "0d0a"x || "end" || "0d0a"x
when cons_name == "conditional-iterative-loop-with-by-for" then
Prototype = "do index = 1 to 100 by 1 for 100" || "0d0a"x ||,
"end" || "0d0a"x
when cons_name == "conditional-iterative-loop-with-while" then
Prototype = "do index = 1 to 100 while a = b" || "0d0a"x ||,
"end" || "0d0a"x
when cons_name == "conditional-iterative-loop-with-until" then
Prototype = "do index = 1 to 100 until a = b" || "0d0a"x ||,
"end" || "0d0a"x
when cons_name == "do-forever-leave" then
Prototype = "do forever" || "0d0a"x || " if a = b then leave" ||,
"0d0a"x || "end" || "0d0a"x
when cons_name == "select-when" then
Prototype = "select" || "0d0a"x ||,
" when a = b then do" || "0d0a"x ||,
" end" || "0d0a"x ||,
" when b = c then do" || "0d0a"x ||,
" end" || "0d0a"x ||,
" when c = d then do" || "0d0a"x ||,
" end" || "0d0a"x ||,
" otherwise do" || "0d0a"x ||,
" end" || "0d0a"x,
"end" || "0d0a"x
otherwise
nop
end
call Quit
return
/*:VRX Quit
*/
Quit:
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
return
/*:VRX Window1_Close
*/
Window1_Close:
rc = ""
call Quit
return