home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vxdemo.zip
/
SYSTEM.$$$
/
STREAM.VRM
< prev
next >
Wrap
Text File
|
1993-09-01
|
7KB
|
290 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 cmd_ef_Change
*/
cmd_ef_Change:
if VRGet( "cmd_ef", "value" ) == "Seek" then do
call VRSet "seek_gb", "enabled", 1
call VRSet "offset_ef", "enabled", 1
call VRSet "offset_dt", "enabled", 1
call VRSet "offset_cb", "enabled", 1
call VRSet "beg_rb", "enabled", 1
call VRSet "end_rb", "enabled", 1
call VRSet "for_rb", "enabled", 1
call VRSet "bak_rb", "enabled", 1
end
else do
call VRSet "seek_gb", "enabled", 0
call VRSet "offset_ef", "enabled", 0
call VRSet "offset_dt", "enabled", 0
call VRSet "offset_cb", "enabled", 0
call VRSet "beg_rb", "enabled", 0
call VRSet "end_rb", "enabled", 0
call VRSet "for_rb", "enabled", 0
call VRSet "bak_rb", "enabled", 0
end
return
/*:VRX cmd_rb_Click
*/
cmd_rb_Click:
call VRSet "cmd_dt", "enabled", 1
call VRSet "cmd_ef", "enabled", 1
call cmd_ef_Change
return
/*:VRX Comments
*/
Comments:
/*
STREAM: Generate a prototype the REXX function STREAM
Usage: call Stream <Parent>
Where: Parent is the parent window for the dialog
*/
return
/*:VRX desc_rb_Click
*/
desc_rb_Click:
call VRSet "cmd_dt", "enabled", 0
call VRSet "cmd_ef", "enabled", 0
call VRSet "seek_gb", "enabled", 0
call VRSet "offset_ef", "enabled", 0
call VRSet "offset_dt", "enabled", 0
call VRSet "offset_cb", "enabled", 0
call VRSet "beg_rb", "enabled", 0
call VRSet "end_rb", "enabled", 0
call VRSet "for_rb", "enabled", 0
call VRSet "bak_rb", "enabled", 0
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 = ""
window = VRWindow()
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
drop window
return
/*:VRX PB_1_Click
*/
PB_1_Click:
stream_name = VRGet( "name_ef", "value" )
if stream_name == "" then do
call VRMessage VRWindow(), "You must specify a stream name!"
return
end
else do
if VRGet( "quo_cb", "set" ) == 1 then
stream_name = '"' || stream_name || '"'
end
if VRGet( "cmd_rb", "set" ) == 1 then do
operation = "Command"
stream_command = VRGet( "cmd_ef", "value" )
if stream_command == "" then do
call VRMessage VRWindow(), "You must specify a stream command when using Command option!"
return
end
else do
cmd_type = word( stream_command, 1 )
if cmd_type == "Seek" then do
offset = VRGet( "offset_ef", "value" )
if offset == "" then do
call VRMessage VRWindow(), "You must specify an offset for the Seek command!"
return
end
else do
if VRGet( "beg_rb", "set" ) == 1 then
sym = "="
else if VRGet( "end_rb", "set" ) == 1 then
sym = "<"
else if VRGet( "for_rb", "set" ) == 1 then
sym = "+"
else
sym = "-"
if datatype( offset ) \== "NUM" then
stream_command = '"Seek ' || sym || '"' || offset
else
stream_command = '"Seek ' || sym || offset || '"'
end
end
else do
stream_command = '"' || stream_command || '"'
end
end
Prototype = "strm_status = Stream( "stream_name', "'operation'", 'stream_command' )'
end
else do
if VRGet( "desc_rb", "set" ) == 1 then
operation = "Description"
else
operation = "State"
Prototype = "strm_status = Stream( "stream_name', "'operation'" )'
end
call Quit
return
/*:VRX PB_2_Click
*/
PB_2_Click:
rc = ""
call Quit
return
/*:VRX PB_3_Click
*/
PB_3_Click:
"view rexx.inf Stream"
return
/*:VRX Quit
*/
Quit:
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
return
/*:VRX state_rb_Click
*/
state_rb_Click:
call VRSet "cmd_dt", "enabled", 0
call VRSet "cmd_ef", "enabled", 0
call VRSet "seek_gb", "enabled", 0
call VRSet "offset_ef", "enabled", 0
call VRSet "offset_dt", "enabled", 0
call VRSet "offset_cb", "enabled", 0
call VRSet "beg_rb", "enabled", 0
call VRSet "end_rb", "enabled", 0
call VRSet "for_rb", "enabled", 0
call VRSet "bak_rb", "enabled", 0
return
/*:VRX Window1_Close
*/
Window1_Close:
rc = ""
call Quit
return