Hi,

On 7/5/07, Bruce Korb <[EMAIL PROTECTED]> wrote:
> On 7/5/07, black hole <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am trying to specify the output file name inside the pseudo macro
> > using the get autogen scheme function. I understand the docs that
> > it should be possible, but I somehow can't get it right.
> >
> > This is the definitions file (trace.ag):
> > autogen definitions trace.tpl;
> > trace_file=trace.h;
> >
> > This is the template file (trace.tpl):
> > [+ autogen5 template h=(get "trace_file") (setenv "SHELL" "/bin/sh") +]
>
> I guess it looks like it ought to work, but it does not.
> I'll have to reproduce this at home and look at the stack trace to
> see what I can do.  Thanks for the report. - Bruce
>
> P.S. a workaround:  Inside the template proper, add this:
>
>    [= (out-move (get "trace-file")) =]

Thank you, that'll do it. However, I am trying to solve another situation.
I have a definitions file and need to set a name to be a list of files
found in a specific directory. One way to do it would be (1):
list=my/dir/file01;
list=my/dir/file02;
...
I don't find it practical when there are lots of files (like 50+).
I could use text editor and shell to do the job. But in case a new file is
added to the directory, or an existing file is removed, I have to re-edit
the definitions file, which is what I want to avoid.

I could also do this (2):
list=`for i in my/dir/*; do echo $i; done`
But then list is not usable with [+FOR+] macro, which is what I also need to be.

I am looking for a way to achieve (1), but with a single definition
line like (2).
One way (maybe naive) to solve this would be to allow shell execution
inside definitions file and then replace the contents of the file (*)
with the result.
Example:
line 0: autogen definitions template.tpl;
line 1: `for i in my/dir/*; do echo list="${i};"; done`

Parsing the first line would result into:
line 0: autogen definitions template.tpl;
line 1: list=my/dir/file01;
line 2: list=my/dir/file02;
...
Parsing would of course resume from the first line.

blackhole

[*]
Not the file on the disk, but an in memory image (the content of the
parser's buffer).

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Autogen-users mailing list
Autogen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/autogen-users

Reply via email to