The Rexx Plug-in uses three Rexx stem variables:
The variables wdMainArgs. and wdEMbed are read-only variables and should not be changed by the Rexx programs. Both of these variables are created by the wdParseArgs() function.
The stem variable wdPlugin. is created by the Rexx programmer and is used to control how the plug-in reports errors in the plug-in Rexx functions.
All wdMainArgs. variables are read-only variables and should not be changed by the Rexx program. If any values are changed unpredicatible results will occur.
| Name | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wdMainArgs.0 | number of args in wdMainArgs.
| ||||||||||||||||||
| wdMainArgs.environment | The environment value is used by the
wdExposeArgs()
function to copy the wdMainArgs. and wdEmbed. stem
variables to another variable pool. This allows plug-in commands and features
to be used in Rexx code located in separate files from the main program.
| ||||||||||||||||||
| wdMainArgs.instance | Unique identifier for each instance of a running plugin. This is the
same value returned by the
query instanceHandle command.
| ||||||||||||||||||
| wdMainArgs.RexxRunType | A numeric indicator of the type of Rexx program that is running, as shown
in the table below. Values <= 15 are programs that are running as a macro
of the plug-in. Values > 15 are programs that are running in a separate session.
The textual description for the value is returned by the
same value returned by the
query MIMEType command.
| ||||||||||||||||||
| wdMainArgs.WINX | Position of lower left corner of window (plug-in area) relative to desktop, in pixels.
| ||||||||||||||||||
| wdMainArgs.WINY | Position of lower left corner of window relative to desktop, in pixels.
| ||||||||||||||||||
| wdMainArgs.WINHEIGHT | Height of the window in pixels.
| ||||||||||||||||||
| wdMainArgs.WINWIDTH | Width of the window, in pixels.
| ||||||||||||||||||
| wdMainArgs.POSX | Position of lower left corner of window relative to browser frame containing the HTML page, in pixels.
| ||||||||||||||||||
| wdMainArgs.POSY | Position of lower left corner of window relative to the browser frame
containing the HTML page, in pixels.
| ||||||||||||||||||
| wdMainArgs.cmdPipeName | The name of the named pipe (the command pipe) used to communicate
with the plug-in. The plug-in Rexx function
wdCommand()
uses this name to open the client end of the command pipe the first time
it is called.
| ||||||||||||||||||
| wdMainArgs.msgPipeName | The name of the named pipe used to communicate with the plug-in
when the Rexx program is using the message pipe to receive events from
the plug-in. This name must be passed to the
wdOpenPipe()
function to establish message pipe communications.
| ||||||||||||||||||
| wdMainArgs.cmdPipeHandle | The handle to the command pipe. Used by
wdCommand().
| ||||||||||||||||||
| wdMainArgs.msgPipeHandle | The handle of the message pipe, used by
wdReadPipe()
and
wdClosePipe().
|
wdEmbed. is a read-only variable and should not be modified by the Rexx program.
Each user defined parameter to the EMBED HTML tag
results in three wdEmbed. Rexx stem variables
EMBED parameter parameterName
EMBED parameter. n is a number from 1 to wdEmbed.0
EMBED parametee. n is a number from 1 to wdEmbed.0
So, for example an EMBED tab of
<html> <BODY bgcolor="#A6CAF0"> <br> <h3>Rexx Cmd Execution</h3> <embed type='x-warpdoctor/cmdrexx' height=10 width=10 src='http://www.warpdoctor.org/helloWorld2.rex' Fred=NO myparameter=32 > </embed> </body> <html>
Would result in the WdEmbed. stem variable as show below
The variable wdPlugin. is both an input and output type
variable: the tail .errorSwitch is set by the Rexx programmer
to control how the plug-in handles errors in the plug-in Rexx
functions. The tail .errorMessage is set by the plug-in when an
error occurrs if wdplugin.errorswitch=1.
The variable wdplugin.errorswitch can be used to change the behavior of the plug-in Rexx functions.
If the variable is not present, or if it is set to 0 (zero) then the functions return errors
as part of the normal Rexx return value. When wdPlugin.errorSwitch = 1 any errors
encountered by any functions will result in a Rexx syntax error. You can pick up this syntax error
using the Rexx signal on syntax statement. If any of the Rexx functions have caused the
syntax error they will change the value of wdPlugin.errorSwitch to 2 in order to indicate that the
syntax error was caused by a return value of the plug-in functions. When that happens the error
message, if any, is set to the tail part of the variable
.errorMessage.
This is intended to simplify error handling when using the plug-in Rexx fuctions. Instead of checking
return values from the functions you can simply use the CALL syntax, or use the function syntax and
ignore the return value, knowing that any errors will trip a signal.
The example below shows a very simple Rexx program that demostrates this feature. The third line of the example sets the variable wdPlugin.errorSwitch = 1. From this point on any errors detected by any plug-in functions will trip a syntax error. The second say statement
say 'zersion: ' wdCommand('query zersion')
will trip the syntax handler because zersion is not a valid parameter to the query command.
Control will jump to the label badJuju which outputs the changed value in wdPlugin.errorSwitch
and the error message from the wdCommand() function that tripped the syntax signal.
/* Demo Error Handling */
signal on syntax name badjuju
wdplugin.errorSwitch = 1
call wdParseArgs
say 'version: ' wdCommand('query version')
say 'zersion: ' wdCommand('query zersion')
say 'here at end'
return
badJuju:
say 'here in error section'
say 'errorSwitch: ' wdplugin.errorSwitch
say 'errorMessage:' wdplugin.errormessage
The output from the program is
Notice that the value of
When the program is changed to this
The output from the program is
Notice that we reach the last SAY statement
wdPlugin.errorSwitch
has changed to 2. This tells us that the syntax was signaled by one of the
Rexx plug-in functions - as opposed to being a syntax error typed into the source.
The error message that is normally returned by the function is instead placed into
the Rexx variable wdPlugin.errorMessage which gives us a convenient way
of finding out the cause of the error.
/* Demo Error Handling */
signal on syntax name badjuju
call wdParseArgs
say 'version: ' wdCommand('query version')
say 'zersion: ' wdCommand('query zersion')
say 'here at end'
return
badJuju:
say 'here in error section'
say 'errorSwitch: ' wdplugin.errorSwitch
say 'errorMessage:' wdplugin.errormessage
say 'here at end'
in this example.