[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Template file processor
From: |
Bruce Korb |
Subject: |
RE: Template file processor |
Date: |
Sun, 4 Dec 2005 12:51:19 -0800 |
User-agent: |
KMail/1.7.1 |
Neil wrote:
> Following the recent thread about Bruce's AutoGen, I thought it might
> be of interest to post my template processor implementation, so here
> it is.
Hi Neil, et al.,
That is useful and handy and a convenient representation for generating
a text file that has computed fragments. To be clear, though, that is not
exactly the prime motivation behind my program. :) It is rather the
separation of a template that describes the output file from the data
used to drive the instantiation. e.g. in my "trivial example", these
data:
> autogen definitions list;
> list = { list_element = alpha;
> list_info = "some alpha stuff"; };
> list = { list_info = "more beta stuff";
> list_element = beta; };
> list = { list_element = omega;
> list_info = "final omega stuff"; };
are used with a template to produce these two output files,
a "list.h":
> typedef enum {
> IDX_ALPHA,
> IDX_BETA,
> IDX_OMEGA } list_enum;
>
> extern const char* az_name_list[ 3 ];
and a "list.c":
> #include "list.h"
> const char* az_name_list[] = {
> "some alpha stuff",
> "more beta stuff",
> "final omega stuff" };
C.F.: http://www.gnu.org/software/autogen/manual/html_node/autogen_3.html#SEC3
Cheers - Bruce