Re: is there a macro that prints the incoming param list?

2009-06-01 Thread Wojciech Puchar

is there any marco that printfs the incoming list, or am i asking too much of 
the
compiler at runtime?



what a problem to do

int a;
for (a=0;aargc;a++)
 printf(Arg %d == %s,a,argv[a]);




example:

main (int argc, char *argv)

with this macro might print:

2, testinput

and baz(char *file, int count)

similarly might print,

testinput, 47

i'm probably asking the impossible, but this is certainly the place to
ask.

thanks,

gary


ps: i'm looking to create a DEBUG header.



--
Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
   http://jottings.thought.org   http://transfinite.thought.org
   The 4.91a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


is there a macro that prints the incoming param list?

2009-05-31 Thread Gary Kline

is there any marco that printfs the incoming list, or am i asking too much of 
the
compiler at runtime?

example:

main (int argc, char *argv)

with this macro might print:  

2, testinput

and baz(char *file, int count)

similarly might print, 

testinput, 47

i'm probably asking the impossible, but this is certainly the place to
ask.  

thanks,

gary


ps: i'm looking to create a DEBUG header.



-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 4.91a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: is there a macro that prints the incoming param list?

2009-05-31 Thread till plewe
On Mon, Jun 1, 2009 at 10:06 AM, Gary Kline kl...@thought.org wrote:

 is there any marco that printfs the incoming list, or am i asking too much of 
 the
 compiler at runtime?

 example:

main (int argc, char *argv)

with this macro might print:

2, testinput

and baz(char *file, int count)

similarly might print,

testinput, 47

i'm probably asking the impossible, but this is certainly the place to
ask.

thanks,

gary


ps: i'm looking to create a DEBUG header.



 --
  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 4.91a release of Jottings: http://jottings.thought.org/index.php

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


How is the macro supposed to know how to print the arguments?
There may be user defined types.

The simplest way would be to add a printf statement after each
function definition.

You could write scripts which generate the format strings for you from
your header files and then use a (variadic) macro which expects that you have
generated a table which contains for each function name the corresponding
format string and argument list.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: is there a macro that prints the incoming param list?

2009-05-31 Thread Gary Kline
On Mon, Jun 01, 2009 at 10:23:01AM +0900, till plewe wrote:
 On Mon, Jun 1, 2009 at 10:06 AM, Gary Kline kl...@thought.org wrote:
 
  is there any marco that printfs the incoming list, or am i asking too much 
  of the
  compiler at runtime?
 
  example:
 
 main (int argc, char *argv)
 
 with this macro might print:
 
 2, testinput
 
 and baz(char *file, int count)
 
 similarly might print,
 
 testinput, 47
 
 i'm probably asking the impossible, but this is certainly the place 
  to
 ask.
 
 thanks,
 
 gary
 
 
 ps: i'm looking to create a DEBUG header.
 
 
 
  --
   Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
 http://jottings.thought.org   http://transfinite.thought.org
 The 4.91a release of Jottings: http://jottings.thought.org/index.php
 
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
 
 
 How is the macro supposed to know how to print the arguments?
 There may be user defined types.
 
 The simplest way would be to add a printf statement after each
 function definition.


yeah, this is what i've done by hand.  printfs at first, then gdb 
last.  
 
 You could write scripts which generate the format strings for you from
 your header files and then use a (variadic) macro which expects that you have
 generated a table which contains for each function name the corresponding
 format string and argument list.


a script might work, thanks for the idea.  but it's enought to have 
been 
reminded of the gcc macros .



-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org
The 4.91a release of Jottings: http://jottings.thought.org/index.php

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org