3 # Boost.Signals library
5 # Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
7 # Permission to copy, use, sell and distribute this software is granted
8 # provided this copyright notice appears in all copies.
9 # Permission to modify the code and to distribute modified code is granted
10 # provided this copyright notice appears in all copies, and a notice
11 # that the code was modified is included with the copyright notice.
13 # This software is provided "as is" without express or implied warranty,
14 # and with no claim as to its suitability for any purpose.
16 # For more information, see http://www.boost.org
20 print "Usage: perl gen_signal_N <number of arguments>\n";
25 $totalNumArgs = $ARGV[0];
26 for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
27 open OUT, ">signal$numArgs.hpp";
28 print OUT "// Boost.Signals library\n";
30 print OUT "// Copyright (C) 2001 Doug Gregor (gregod\@cs.rpi.edu)\n";
32 print OUT "// Permission to copy, use, sell and distribute this software is granted\n";
33 print OUT "// provided this copyright notice appears in all copies.\n";
34 print OUT "// Permission to modify the code and to distribute modified code is granted\n";
35 print OUT "// provided this copyright notice appears in all copies, and a notice\n";
36 print OUT "// that the code was modified is included with the copyright notice.\n";
38 print OUT "// This software is provided \"as is\" without express or implied warranty,\n";
39 print OUT "// and with no claim as to its suitability for any purpose.\n";
41 print OUT "// For more information, see http://www.boost.org\n";
43 print OUT "#ifndef BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";
44 print OUT "#define BOOST_SIGNALS_SIGNAL" , $numArgs . "_HEADER\n";
46 print OUT "#define BOOST_SIGNALS_NUM_ARGS $numArgs\n";
49 for ($i = 1; $i <= $numArgs; ++$i) {
51 $templateParms .= ", ";
53 $templateParms .= "typename T$i";
55 print OUT "#define BOOST_SIGNALS_TEMPLATE_PARMS $templateParms\n";
60 print OUT "#define BOOST_SIGNALS_TEMPLATE_ARGS $templateArgs\n";
63 for ($i = 1; $i <= $numArgs; ++$i) {
69 print OUT "#define BOOST_SIGNALS_PARMS $parms\n";
72 for ($i = 1; $i <= $numArgs; ++$i) {
78 print OUT "#define BOOST_SIGNALS_ARGS $args\n";
81 for ($i = 1; $i <= $numArgs; ++$i) {
85 $boundArgs .= "args->a$i";
87 print OUT "#define BOOST_SIGNALS_BOUND_ARGS $boundArgs\n";
90 for ($i = 1; $i <= $numArgs; ++$i) {
91 $argsAsMembers .= "T$i a$i;";
93 print OUT "#define BOOST_SIGNALS_ARGS_AS_MEMBERS $argsAsMembers\n";
96 for ($i = 1; $i <= $numArgs; ++$i) {
100 $copyParms .= "T$i ia$i";
102 print OUT "#define BOOST_SIGNALS_COPY_PARMS $copyParms\n";
108 for ($i = 1; $i <= $numArgs; ++$i) {
112 $initArgs .= "a$i(ia$i)";
114 print OUT "#define BOOST_SIGNALS_INIT_ARGS $initArgs\n";
117 for ($i = 1; $i <= $numArgs; ++$i) {
118 $argTypes .= "typedef T$i arg". ($i+1) . "_type; ";
121 print OUT "#define BOOST_SIGNALS_ARG_TYPES $argTypes\n";
123 print OUT "#include <boost/signals/signal_template.hpp>\n";
125 print OUT "#undef BOOST_SIGNALS_ARG_TYPES\n";
126 print OUT "#undef BOOST_SIGNALS_INIT_ARGS\n";
127 print OUT "#undef BOOST_SIGNALS_COPY_PARMS\n";
128 print OUT "#undef BOOST_SIGNALS_ARGS_AS_MEMBERS\n";
129 print OUT "#undef BOOST_SIGNALS_BOUND_ARGS\n";
130 print OUT "#undef BOOST_SIGNALS_ARGS\n";
131 print OUT "#undef BOOST_SIGNALS_PARMS\n";
132 print OUT "#undef BOOST_SIGNALS_TEMPLATE_ARGS\n";
133 print OUT "#undef BOOST_SIGNALS_TEMPLATE_PARMS\n";
134 print OUT "#undef BOOST_SIGNALS_NUM_ARGS\n";
136 print OUT "#endif // BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";