cpp replaced by m4?

Bill McGonigle bill at bfccomputing.com
Tue Jul 3 17:33:34 EDT 2007


On Jul 3, 2007, at 12:05, Steven W. Orr wrote:

> Actually no. Another friend suggest that perl could do it. But what I
> really want is macro processing, not to write my C code from another
> script.

You *could* use perl as a macro language.   That's basically what  
HTML::Mason does.  e.g., from the docs:

   % foreach my $person (@people) {
     Name: <% $person->{name} %>
     Age: <% $person->{age} %>
     Height: <% $person->{height} %>
     Weight: <% $person->{weight} %>
   % }

Hmm, I bet you could even use HTML::Mason for your example.  There's  
no reason I know of that Mason has to be used to generate HTML and  
its ilk.

------
int *arr[]() = {
% foreach my $ii (l1,l2,l3,l4) {
     func##cpp_eval(<% $ii $%>),
     };
% }
-------

Sorry, I don't understand what your pseudocode func##cpp_eval is  
meant to do.  If that's a function expansion, you'd need to have  
defined the expansion function previously in a <%perl></%perl> block  
and call it at substitution time.

If my understanding is muted, please elaborate - it sounds like an  
interesting problem.

-Bill

-----
Bill McGonigle, Owner           Work: 603.448.4440
BFC Computing, LLC              Home: 603.448.1668
bill at bfccomputing.com           Cell: 603.252.2606
http://www.bfccomputing.com/    Page: 603.442.1833
Blog: http://blog.bfccomputing.com/
VCard: http://bfccomputing.com/vcard/bill.vcf



More information about the gnhlug-discuss mailing list