cpp replaced by m4?
Steven W. Orr
steveo at syslang.net
Tue Jul 3 16:14:18 EDT 2007
On Tuesday, Jul 3rd 2007 at 12:18 -0400, quoth Kent Johnson:
=>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
BINGO! This is it! This is what we need. Thanks :-)
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the gnhlug-discuss
mailing list