Macromania is used to dynamically construct:
grp Nwhich is used by macromania to determine which set of input files to process. For each output file listed in the filelist, the input file is determined to be filename_%grp%, where %grp% is replaced by the value of the grp keyword. For example, If the filelist contains the filename
aqcfgand the keyfile contains the line
grp 1the file aqcfg will be created from them template file aqcfg_1. This allows the key file to select which group of input template files should be used to create the requested output file.
Only the FIRST definition of the keyword is used -- subsequent definitions of the same keyword are ignored. This means that system-specific values can be defined early in the key file, and later definitions (often defined in an include file or defined in keymacros) can supply "default" values for keywords that have not been previously defined.
Macromania stores the keyword table in a memory module which can be used by subsequent infocations of macromania in order to save the time needed to re-create the keyword table. If the keymacro file is not specified, macromania will use a previously constructed keyword table in the memory module to process the template files.
Macromania reads each line from the template file, and processes it in the following manner:
keyword valueThe keyword must begin in column 1. The keyword is a single token not containing whitespaces. The keyword and value are separated by whitespace. The value is either a single whitespace-delimited token, a quoted string (quoted by double quotes), or an empty string. If additional tokens are present on the line, they are considered to be comments and are ignored by macromania. Keywords are case insensitive, ie the keywords "hello", "Hello", and "HELLO" are considered to be the same keyword. The following are examples of valid keyword definition lines:
ip_net_1 192.108.32 Network number of network 1 ip_addr_1 208 ip_net_2 BANNER "BDSN Station BOZO" Station login banner
If the string is quoted, the value of the string is taken to be the characters BETWEEN the quotes, ie the quotes are NOT considered part of the keyword value.
$macroname arglistThe arglist is an optional argument list which is separated by whitespace from the macroname. The arguments in the arglist are separated from each other by a ";" (semicolon). An argument may be a single unquoted token, a quoted string or empty. Any additional tokens on the line are considered to be comments (?). Keyword macro names are case insensitive -- the keyword macro name "hello", "Hello", and "HELLO" are all identical.
There are 2 special keyword macro calls that are processed by macromania:
$INCLUDE keyfile $MACROFILE keymacrofile
The $INCLUDE macro will include the contents of the specified keyfile at this point in the file. The $MACROFILE macro will include the contents of the specified keymacrofile at this point in the file.
Examples of valid keyword macro calls are:
$Q4128 $DEST_IP PRI;SEC;AUX $DEST_IP PRI;;AUX
[$macroname] formal_argument_list keyword value ....The formal_argument_list is currently considered interpreted as a comment, and is provided as an example of values might be used as arguments. A keymacro can accept up to 36 positional arguments which it refers to as $1$, $2$, ..., $9$, $A$, $B$, ..., $Z$. When the keymacro is called, the first argument is assigned to $1$, the second argument to $2$, and soforth. The body of the keymacro consists of keyword definition lines. Arguments can appear within a keyword or within a keyword value token. The body of the macro starts with the line following the keymacro definition line and continues to to the next keymacro definition line or the end of file. When a keyword macro is called, the formal arguments $1$ through $Z$ are replaced by the actual arguments in the keymacro call. The value of any formal argument not specifed in the keymacro call is set to the empty string. If an actual argument is a quoted string, the quotes are removed from the string when it is assigned to the corresponding formal argument. Within a body of a keymacro, you may refer to a substring of an actual argument by using
A template file may contain the following types of lines:
A template macro definition consists of 2 or more line of the format
$MDEFINE template_macroname optional_comments_on_argument_list
... body of macro ...
The template_macroname is the name of the template macro, and the body
of the macro consists up to (but not including) the $MEND line. A
template_macro can accept up to 36 positional arguments which it refers to as
$1$, $2$, ..., $9$, $A$, $B$, ...,
$Z$. When the template_macro is called, the first argument is assigned
to $1$, the second argument to $2$, and soforth. The body of
the template_macro consists of any valid template file line OTHER than
$MDEFINE and $MEND, i.e. template_macros definitions can not be