Methanol Element Specifications


Define

<Define Macro="{name}"> {macro text} </Define>
Description
Defines the specified macro to expand to the DEFINE element's contents. If the macro already exists, it is replaced. If it does not exist, it is created. The contents of the element are parsed before they are assigned to the macro.
Text Produced
None.
Attributes
AttributeValuesDescription
Macro REQUIRED text name of macro
Variations
To define a macro which will cause some MetaHTML tags to be parsed when it is expanded instead of when it is defined, use the MetaQuote element inside the Define element.

Invoke

<Invoke Macro="{name}" {Arg}={value} ...>
Description
When Invoke element is parsed, it replaces itself with the contents of the macro it specifies. Before the content is parsed, any additional attributes provided to the Invoke element are assigned as arguments.
Text Produced
The contents of the specified macro are interpreted and inserted in place of the Invoke element.
Attributes
AttributeValuesDescription
Macro REQUIRED text name of a previously Defined macro
{Arg} {value} other arbitrary arguments are assigned as arguments
Variations

MetaQuote

<MetaQuote> ... </MetaQuote>
Description
The contents of a MetaQuote element are *not* interpreted, but the MetaQuote is removed. Particularly useful in macro definitions to include MetaHTML elements that will be interpreted when they are expanded instead of when thay are defined.
Text Produced
Contents remain.
Attributes
None.
Variations

Assign

<Assign Arg="{name}"> {value} </Assign>
Description
Assigns its contents to the specified argument. If the argument already exists, it is replaced. If not, it is created.
Text Produced
Contents.
Attributes
AttributeValuesDescription
Arg REQUIRED text argument name
Variations

Value

<Value Arg="{name}">
Description
Value element is removed and replaced with the current value of the named argument.
Text Produced
Returns the current value of the named argument.
Attributes
AttributeValuesDescription
Arg REQUIRED text argument name
Variations

Random

<Random Seed=["time"|integer] Type=["INT"|"FLOAT"|"STRING"] Min={value} Max={value} Step={value}>
Description
Generates a random integer, floating-point number, or character in place of the Random element. A very good, 48-bit random number algorithm is used, specifically drand48(). When seeded with system time (the default operation) this produces a very good approximation of true randomness.
Text Produced
A random integer, floating-point number, or character.
Attributes
AttributeValuesDescription
Seed "time" or integer seed value, if any: defaults to "time" for first use only
Type "INT", "FLOAT", "STRING" what to generate: defaults to INT
Min by type minimum value to generate: defaults to "0", "0.0" or "A"
Max by type maximum value to generate: defaults to "100", "100.0", or "Z"
Step integer or float increment between possible values to generate: defaults to "1", "0.0000001", or "1"
Variations

If a seed value is given, it will be used to seed the random number generator. The seed value can be either an integer or the word "time", which will use the system time as the seed. If no seed is specified the first time Random is used, it will initialize with the system time by default. After the first time, not specifying a seed means that the random number generator will not be reseeded.

Type defaults to INT, which produces an integer value. FLOAT produces a (floating-point) real number. STRING produces a single ASCII character.

Min defaults to 0 for INT or FLOAT and "A" for STRING. Note that since STRING uses ASCII, the range "A" - "Z" is different from, and lower in value than "a" - "z". The range "A" - "z" includes all letter of both cases, as well as several punctuation marks that fall in between.

Max defaults to 100 for INT or FLOAT and "Z" for STRING. If Max is specified to be less than Min, Min is produced and an error message will precede the produced value.

Step defaults to 1 for INT or STRING and 0.0000001 for FLOAT. Step determines the interval between possible values. For example, an integer with Min=0 and Step=2 will produce only even numbers.


Load

<Load File="{filename}" [Interpret=["Yes"|"No"] | Nointerpret]>
Description
The Load element is replaced by the contents of the file it specifies. The Interpret or Nointerpret element determines whether the file will be interpreted by MetaHTML before it is inserted into the text.
Text Produced
Specified file's contents, possibly MetaHTML interpreted.
Attributes
AttributeValuesDescription
File REQUIRED filespec specifies the file to include
Interpret "Yes" or "No" determines whether to interpret the file
Nointerpret none equivalent to Interpret="No"
Variations

Quiet

<Quiet> ... </Quiet>
Description
The inverse of MetaQuote. Interprets its contents normally, but throws away the output.
Text Produced
None.
Attributes
None.
Variations

File

<File Handle="{handle name}" File="{filespec}" Mode=["Read"|"Write"|"Append"]> ... </File>
Description
Opens a specified file and assigns it a handle so that Read, Write and EOF elements in its contents can refer to the open file. File is closed when end tag is reached.
Text Produced
Nothing special. File element is removed and contents are interpreted normally.
Attributes
AttributeValuesDescription
Handle REQUIRED text name to refer to open file with
File REQUIRED filespec specifies file to open
Mode "Read", "Write", or "Append" file access mode: defaults to Read
Variations
Read, Write and EOF elements can only be used within a File element. Write mode will create the file if it does not exist and replace it if it does. Read and Append modes will return an error message if the file does not exist.

Write

<Write Handle="{handle name}" > ... </Write>
Description
Write element writes its contents to the specified file.
Text Produced
None.
Attributes
AttributeValuesDescription
Handle text handle of currently open file: defaults to most recently opened file
Variations
Only usable within a File element. If Handle is not specified, the most recently opened file is assumed. If the specified (or assumed) file is in Read mode, an error message is returned.

Read

<Read Handle="{handle name}" Arg="{argument list}> {scanf-format string} </Read>
Description
Reads data from an open file (in Read mode) and assigns the data to the specified arguments. The contents of this element are used as a format string to determine how the input file is parsed. The %d, %s, %f, %e, and %c scanf formats are supported. Any other text, besides format specifiers and whitespace, is matched against the input file contents. For each format specifier, a value of the appropriate type is parsed from the file and assigned to the next argument in the arglist.
Text Produced
None.
Attributes
AttributeValuesDescription
Handle text handle of currently open file: defaults to most recently opened file
Arg text string(s) name(s) of arguments to assign values to
Variations
Only usable within a File element. If no Handle is specified, the most recently opened file is assumed. If the file is not in Read mode, an error message is returned. If no arguments are specified or the arguments are exhausted before the format string is satisfied, any subsequent input values are ignored.

EOF

<EOF Handle="{handle name}">
Description
States whether the end of the input file has been reached.
Text Produced
"TRUE" if the end of the file has been read, "FALSE" otherwise.
Attributes
AttributeValuesDescription
Handle text handle of currently open file: defaults to most recently opened file
Variations
Only usable within a File element. If no Handle is specified, the most recently opened file is assumed. If the file is not in Read mode, an error message is returned.