Background
I''m generating rather substantial D scripts (for DTrace), using
cpp(1). In fact, they''re so large that DTrace can''t load them
by default. On Solaris, I have to increase a kernel value
(dtrace_dof_maxsize). On Leopard, that option isn''t available
(yet), so I simply limit the size of my probe sets. Sigh.
Leopard''s dtrace also has a minor bug in handing code off to
cpp for processing. I started using cpp directly as a way to
work around this, but soon found that it was very useful to be
able to look at the expanded code.
Finally, Leopard''s cpp allows some things that neither Solaris
nor "C Reference Manual" (Harbison and Steele, 4th ed.) accept:
% cat t1
#define foo(bar) printf("bar=...")
foo(abc);
% cpp t1
...
printf("abc=...");
Although this workaround is legal:
% cat t3
#define foo(bar) printf("%s=...", bar)
foo("abc");
% cpp t3
...
printf("%s=...", "abc");
it makes my D scripts bigger, so the reduced size probe sets
don''t load. So, it''a not a happy solution.
I tried messing about with concatenation macros, but so far, I''m
not getting the results I want.
Question
What (portable!) cpp syntax can I use to allow a macro parameter
to be folded into a double-quoted string? It doesn''t have to be
pretty!
-r
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume rdm at cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development