|REXXTAGS.org ::||Variable sharing|
A REXX TAG can use a limited form of variable sharing with the RSP page. Variables may be copied (passed) to the tag buy using the "VARIABLES" special call, and returned to the RSP page by including REXX code in the tag output. The "VARIABLES" special call returns "0" (the default) or a list of REXX variable names or stem names which will be passed to the tag as the fourth argument on the "START", "BODY" (if the tag mandates it) and "END" calls. The list of variables will be passed to the tag in an interpret-ready format, so that by executing an "interpret variables" instruction all required variables will be available to the tag procedure. Please note that these variables are a copy of the RSP page variables, and not the same; altering them does not alter the corresponding RSP page variables; if you want to alter the RSP page variables, you may do so by including REXX code in the tag output. This is to say that shared variables are not exposed variables, in the REXX sense.
Limited stem sharing
Since version 1.1c, REXXTAGS incorporates a limited form of stem sharing in the shared variables support. Stem or sub-stem names (i.e, "stem." or "v." or "x.y.") can be returned by the "VARIABLES" special call. A stem is a symbol with a single perior at its end; a sub-stem is a symbol with several periods, one of them at its end (like "x.y."). The REXXTAGS compiler will evaluate "stem.0" at run-time, and incorporate "stem.N" (N=0..stem.0) and in the variables parameter.
Parameters and shared variables
Parameters are evaluated before shared variables, and the "VARIABLES" special call receives the current parameters for the current tag invocation. Therefore, it can return different shared variables, depending on the parameter list.
Here's a <sample:tag> procedure:
And sample RSP code using it:
Last update: 15/06/03 at 16:48