home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vxdemo.zip
/
DISPATCH.$$$
/
VREDISP.VRM
next >
Wrap
Text File
|
1993-09-15
|
4KB
|
153 lines
/* Custom mainline for macro */
signal on SYNTAX name _VRESyntax
signal _VREMain
_VRESyntax:
parse source . . _VRESourceSpec
call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
exit 32000
_VREMain:
/*:VRX Main
*/
/*
codeString = VREDisp( <parent>, <object>, <dest> )
Generate a VX-REXX code string.
<parent> The parent window for any dialogs.
If the parent is non-empty the operating
environment is assumed to be VRXEdit.
Otherwise the environment variable
VXREXX is expected to point at the
VX-REXX directory.
<object> The object to use in VRGet, VRSet, and
VRMethod. If the empty string is passed
the general code dialog is used rather
than the object specific dialog.
<dest> The destination for the code string.
If empty, the code string is simply
returned. If "CLIPBOARD", the code
string is inserted into the OS/2
clipboard. Otherwise it is assumed to
be the handle of a VX-REXX section
editor and the code is inserted into
the editor.
Returns the code string or the empty string.
*/
Main:
/* Uncomment to debug
call VRRedirectSTDIO "on"
trace ?r
*/
signal on novalue
parse arg parent, object, destination
codeString = ""
/* Set VRXEdit and VRXPath
*/
ok = GetEnvironment( parent )
if ok = 0 then signal quit
/* General case
*/
if object = "" then do
ret = VREDispG( parent, VRXEdit, VRXPath )
parse VAR ret type ';' value
if type = "" then signal quit
if type = "OBJECT" then do
object = value
end
objName = ""
end
/* Object specific case
*/
if object \= "" then do
ret = VREDispO( parent, VRXEdit, VRXPath, object )
parse VAR ret type ';' value
if ret = "" then signal quit
objName = ""
if VRXEdit = 1 then do
objName = VRGet( object, "Name" )
end
end
/* Call the string generating macro
*/
if type \= "MACRO" then signal quit
parse VAR value macroname ";" parms
fname = VRXPath || "SYSTEM\" || macroname || ".VRM"
interpret 'codeString = "' || fname || '"( parent, objName, parms )'
if codeString = "" then signal quit
if translate(destination) = "CLIPBOARD" then do
call VRMethod "Application", "PutClipboard", codeString || "0d0a"x
end
else if destination \= "" then do
call VRSEInsertBlock destination, codeString
call VRSEActivate destination
end
quit:
return codeString
/* VREDispG Call the external VREDispG
*/
VREDispG: procedure
parse arg parent, edit, path
interpret 'string = "' || path || 'VREDISPG.VRM"( parent, edit, path )'
return string
/* VREDispO Call the external VREDispO
*/
VREDispO: procedure
parse arg parent, edit, path, object
interpret 'string = "' || path || 'VREDISPO.VRM"( parent, edit, path, object )'
return string
/*:VRX GetEnvironment
*/
GetEnvironment: procedure expose VRXEdit VRXPath
parse arg parent
ok = 0
/* Assume if we have a parent that we are executing
within VRXEdit. Otherwise assume we are not
(e.g. we are executing from an external editor).
*/
VRXEdit = (parent \= "")
/* Set the path to the VXREXX home directory.
This is VREPath() within VRXEdit, and the environment
variable VXREXX otherwise.
*/
if VRXEdit = 1 then do
VRXPath = VREPath()
ok = 1
end
else do
VRXPath = value( "VXREXX",,"OS2ENVIRONMENT" ) || '\'
file = VRXPath || "VRXEDIT.EXE"
file = stream( file, 'c', 'query exists' )
if file \= "" then do
ok = 1
end
else do
call VRMessage parent, "The OS/2 environment variable VXREXX is not set to the VX-REXX directory.", "Error"
end
end
return ok