REXXTAGS.org :: | Importing REXX code |
Since version 1.1, REXXTAGS supports importing REXX source files into your page. Since calling an internal routine is always much faster than calling an external one, REXXTAGS allows you to specify which routine(s) you want to import, and copies these routines into the compiled RSP file. The files are copied each time the RSP file is compiled; if you are using caching, this will happen automatically when any of the imported files change (or the source page itself changes).
The IMPORT statement
To import a REXX routine 'SampleProc'
located in a file called 'SampleProc.Rex'
you should use the following syntax in your RSP file:
<%@ import SampleProc %>
You can also write, if you prefer,
<%@ import SampleProc.Rex %>
You can separate multiple imports with blanks in a single IMPORT statement, as in
<%@ import SampleProc SampleFunc SampleCode %>
As of the current version (1.1), the IMPORT statement can be contained in a line with other code, but cannot span multiple lines.
Importing from tag routines
A .TAG procedure can also return a number of blank-separated REXX routine names
to the special call "QUERY IMPORT".
The REXXTAGS compiler will include all the specified routines as if they were
specified in a IMPORT statement.
Where to place imported code
Imported routines should reside in one of the defined TAGLIBs, and should not
contain any path information. REXXTAGS searches each TAGLIB in turn, stoping
when it finds a routine with the right name, and produces an error code an error
otherwise.
How files are imported
REXXTAGS collects information about which files have to be imported by examining
the page and issuing the special call "QUERY
IMPORT" to all the tags used in the file. It then eliminates duplicates,
and copies all the imported routines at the end of the generated REXX code,
preceding each of them with the appropiate label. For example, if the file contains
an IMPORT statement for "ProcA ProcB" and a tag used in the page returns
"ProcB ProcC" to the "QUERY
IMPORT" special call, the structure of the generated REXX file would
be the following:
(normal page translation) (normal page translation ends here) Return 0 ProcA: (file ProcA.rex is copied here) ProcB: (file ProcB.rex is copied here) ProcC: (file ProcC.rex is copied here) (other REXXTAGS housekeeping code goes here)
/specs/import.html Last update: 27/05/03 at 19:09 |