cpp replaced by m4?
    Kent Johnson 
    kent37 at tds.net
       
    Tue Jul  3 12:18:49 EDT 2007
    
    
  
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
    
    
More information about the gnhlug-discuss
mailing list