1 This directory contains files associated with building large numbers
2 of templates needed to represent different numbers of parameters.
3 The file signal.macros.m4 defines all necessary macros for construction
4 of templates with variable arguments.
6 These files will be placed in $(INCLUDE_DIR)/sigc++/macros for
10 Gnu M4 (others m4 may work)
12 Macros of particular interest:
14 IF(arg1,arg2[,arg3]) - if arg1 non-zero length print arg2, else arg3
15 LIST(arg0,cond0 [,arg1,cond1]) - generates comma seperated list with
16 conditions for each argument
17 ARG_CLASS([P1,P2, ... ]) - generates string "class P1,class P2"
18 ARG_BOTH([P1,P2, ... ]) - generates string "P1 p1,P2 p2"
19 ARG_TYPE([P1,P2, ... ]) - generates string "P1,P2"
20 ARG_NAME([P1,P2, ... ]) - generates string "p1,p2"
21 [name]NUM(arg) - prints name#, where # is items in arg
22 ARGS(P,n) - generates string [P1,P2,...Pn]
28 template<class P1,class P2> // needs to be inline for zero arguments
29 void Foo::func2(int (*f)(P1,P2),P1 p1,P2 p2)
35 include(template.macros.m4)
38 IF([$1],template<ARG_CLASS($1)>,inline)
39 void Foo::[func]NUM($1)(LIST(int (*f)(ARG_TYPE($1)),1,ARG_BOTH($1),[$1]))
48 (to prove it m4 this README file. Honest!)