cpp replaced by m4?
roger.levasseur at comcast.net
roger.levasseur at comcast.net
Tue Jul 3 12:25:31 EDT 2007
An article saved from long ago shows how to do something similar to this, but with Tcl.
C Preprocessing with Tcl, by Jonathan S. Arney, Dr Dobb's Journal, August 1998.
-roger
-------------- Original message --------------
From: Kent Johnson <kent37 at tds.net>
> Bill Sconce wrote:
> >> => Can we have an example of why you want to do this?
> >>
> >> Sure. For starters, one thing that we're looking to do:
> >>
> >> Loops.
> >>
> >> int *arr[]() = {
> >> #for ii in l1 l2 l3 l4 etc
> >> #do
> >> func##cpp_eval(ii),
> >> #done
> >> };
> >
> >
> > Ah. He wants Python...
>
> Cog lets you use Python as a code generator embedded in C or whatever:
> http://www.nedbatchelder.com/code/cog/index.html
>
> I think your example would look something like this:
>
> int *arr[]() = {
> /*[[[cog
> import cog
> for ii in 'l1 l2 l3 l4'.split():
> cog.outl('func%s,' % ii)
> ]]]*/
> //[[[end]]]
> };
>
> Kent
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20070703/ea2b29c6/attachment.html
More information about the gnhlug-discuss
mailing list