METRO is a powerful macro preprocessor which allows to capture
the generic structure present in many kind of files used in
software development and document processing and to generate
all possible specific file instances obeying to this generic
structure.
Concept
Recognizing
that some files always reveal the same structure and contain
similar fragments, it becomes easy to replace these parts
by macro calls and to associate the substituted file fragment
as the body of a macro definition. Macro arguments can be
defined to introduce variable parts as data or as control
variables for introducing some genericity between similar
but not identical fragments. This substitution may occur in
the original file or in already defined macros.
At the end of this process, the file contain macro calls and
text fragments; these remaining text fragments can also be
replaced by specific macro calls (called place-holders) whose
definitions are kept into a new specific library. This new
version of the file only contains macro calls and represent
the generic structure of all these files which can also be
encapsulated into a macro (this structure is also called a
template or a skeleton or a model).
Metro provides a sophisticated macro formalism to define what
is also often called "cliches".
Expressive
power
Macros
are defined and logically grouped in special files called
macro libraries. A macro definition contains a header and
a body; the header identifies the macro and its typeless arguments
with a possible default value; the body contains macro-calls
and textlines. The concept of macro is similar to the one
of control abstraction (procedure) in programming languages
and the concept of library is similar to the one of module.
Macro-calls and textlines may refer to typeless variables.
All variables have a list structure. Macro arguments are actualized
as well by value as by reference. Variables are macro arguments
or locally declared and their validity follows the macro call
hierarchy. Variables may also be globally declared. Macro
call recursivity is possible.
Predefined macro identifiers are used for controlling the
production flow, accessing files, activating processes and
defining variables; their possible arguments may be actualized
by expressions of constants and/or variables and/or predefined
functions. The embedded translation directives (ifdef,...)
obey to the same syntactically conventions.
The
interpretation process
METRO
interprets a template with the help of libraries.
All METRO libraries are translated into a binary representation
to speed up the interpretation process and check their validity.
The interpreter first substitutes the variables by their value,
then executes the predefined macros or expands the macro calls
and sends the relevant textlines to the RESULT file. Empty
variables may be prompted for a value.
The symbolic debugger is useful during the creation phase.
The
utilities
A
cross-reference utility reports which macro is used, where
it is called and which macro it is calling.
A second utility allow to relocate text fragments from a document
to anchor points within the same document. This is usefull
in a development environment where macro definition may refer
to variables to be declared somewhere else. These declaration
may then be locally attached. The tool also takes care of
avoiding double relocation of the same fragment.
Another utility produces a tag file to speed up the editing
process. Tag files allow to retrieve a macro definition associated
to a macro call reference.
METRO is also the backend engine of XGL, the DECADE open application
generator.
Available
platforms