Op 19 mrt 2010, om 15:24 heeft Amaury Ampe het volgende geschreven:
I'm quite new to programming in general and completely new to M4,
so any help would be most welcome.
In your controller program in C:
int thevalue = 1234;
const char cmd[100];
sprintf(cmd, "m4 -DPPCVAL=%d yourfile.m4 >thecode.c", thevalue);
In your template file in M4:
.... (some code already there...) ...
asm("your assembly stuff using PPCVAL ....");
....
to make a long story short: use -D with m4 to define a macro on the
command line. Use this macro by name in your generated C code. M4
will replace the macro by its value even when it occurs within a C
string.
--
Raphael 'kena' Poss · address@hidden · +31 20 525 7559
UvA · FNWI · IvI · CSA · 1098XG 107 Amsterdam (NL)
z = \f. (\x. f (\y. x x y)) (\x. f (\y. x x y))
There is no spoon, only fork() and vfork().