Next: , Previous: , Up: Common Scheme Functions   [Contents][Index]


3.5.6 format-arg-count - count the args to a format

Usage: (format-arg-count format)
Sometimes, it is useful to simply be able to figure out how many arguments are required by a format string. For example, if you are extracting a format string for the purpose of generating a macro to invoke a printf-like function, you can run the formatting string through this function to determine how many arguments to provide for in the macro. e.g. for this extraction text:


 /*=fumble bumble
  * fmt: 'stumble %s: %d\n'
 =*/

You may wish to generate a macro:


 #define BUMBLE(a1,a2) printf_like(something,(a1),(a2))

You can do this by knowing that the format needs two arguments.

Arguments:
format - formatting string