1.1 The Purpose of AutoGen
The idea of this program is to have a text file, a template if
you will, that contains the general text of the desired output file.
That file includes substitution expressions and sections of text that are
replicated under the control of separate definition files.
AutoGen was designed with the following features:
-
The definitions are completely separate from the template. By completely
isolating the definitions from the template it greatly increases the
flexibility of the template implementation. A secondary goal is that a
template user only needs to specify those data that are necessary to describe
his application of a template.
-
Each datum in the definitions is named. Thus, the definitions can be
rearranged, augmented and become obsolete without it being necessary to
go back and clean up older definition files. Reduce incompatibilities!
-
Every definition name defines an array of values, even when there is
only one entry. These arrays of values are used to control the
replication of sections of the template.
-
There are named collections of definitions. They form a nested hierarchy.
Associated values are collected and associated with a group name.
These associated data are used collectively in sets of substitutions.
-
The template has special markers to indicate where substitutions are
required, much like the
${VAR}
construct in a shell here doc
.
These markers are not fixed strings. They are specified at the start of
each template. Template designers know best what fits into their
syntax and can avoid marker conflicts.
We did this because it is burdensome and difficult to avoid conflicts
using either M4 tokenizaion or C preprocessor substitution rules. It
also makes it easier to specify expressions that transform the value.
Of course, our expressions are less cryptic than the shell methods.
-
These same markers are used, in conjunction with enclosed keywords, to
indicate sections of text that are to be skipped and for sections of
text that are to be repeated. This is a major improvement over using C
preprocessing macros. With the C preprocessor, you have no way of
selecting output text because it is an unvarying, mechanical
substitution process.
-
Finally, we supply methods for carefully controlling the output.
Sometimes, it is just simply easier and clearer to compute some text or
a value in one context when its application needs to be later. So,
functions are available for saving text or values for later use.
This document was generated
by Bruce Korb on May 5, 2003 using texi2html