Accesses examples and source code of library procedures (R.W. Payne).
No options
Parameters
PROCEDURE = texts |
Single-valued texts indicating the procedures about which the information is required |
---|---|
EXAMPLE = texts |
Identifiers of text structures to store the example for each procedure |
SOURCE = texts |
Identifiers of text structures to store the source code of each procedure |
Description
LIBEXAMPLE
allows you to obtain an example of the use of any procedure in the Genstat Procedure Library, also to access the source code of any procedure, so that you can see how it works, or modify it. The names of procedures for which examples or source code are required should be listed, in quotes, using the PROCEDURE
parameter. The EXAMPLE
parameter can be used to specify the identifier of a text to store each example, and the SOURCE
parameter to specify texts to store the source code. The examples can then be run (as macros) using the operator ##
. Thus,
LIBEXAMPLE 'PERCENT'; EXAMPLE=%Ex
##%Ex
would put an example of how to use PERCENT
into the text %Ex
, and then run it.
Options: none.
Parameters: PROCEDURE
, EXAMPLE
, SOURCE
.
Method
The examples are read from the Genstat Examples
folder, which is usually located alongside the bin
folder that holds the Genstat executable program. The source code is held in a backing-store file whose name is supplied by procedure LIBFILENAME
. This file is opened on the first available backing-store channel; if all the channels are in use, the procedures stops with a diagnostic. After the code has been brought back from backing store, the file is closed.
See also
Directive: HELP
.
Procedures: LIBFILENAME
, LIBHELP
, LIBVERSION
.
Example
CAPTION 'LIBEXAMPLE example',\ 'Put the example for PERCENT into the text %Ex.'; STYLE=meta,plain LIBEXAMPLE 'PERCENT'; EXAMPLE=%Ex SCALAR Chan ENQUIRE Chan; FILETYPE=output; OUTSTYLE=Style OUTPUT [STYLE=plain] PRINT %Ex; JUSTIFICATION=left OUTPUT [STYLE=#Style] CAPTION\ '%Ex can now be run (as a macro) using the operator ##, i.e. by typing ##%Ex'