3 # Boost.Signals library
5 # Copyright Douglas Gregor 2001-2003. Use, modification and
6 # distribution is subject to the Boost Software License, Version
7 # 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 # http://www.boost.org/LICENSE_1_0.txt)
10 # For more information, see http://www.boost.org
14 print "Usage: perl gen_signal_N <number of arguments>\n";
19 $totalNumArgs = $ARGV[0];
20 for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
21 open OUT, ">signal$numArgs.hpp";
22 print OUT "// Boost.Signals library\n";
24 print OUT "// Copyright (C) 2001 Doug Gregor (gregod\@cs.rpi.edu)\n";
26 print OUT "// Permission to copy, use, sell and distribute this software is granted\n";
27 print OUT "// provided this copyright notice appears in all copies.\n";
28 print OUT "// Permission to modify the code and to distribute modified code is granted\n";
29 print OUT "// provided this copyright notice appears in all copies, and a notice\n";
30 print OUT "// that the code was modified is included with the copyright notice.\n";
32 print OUT "// This software is provided \"as is\" without express or implied warranty,\n";
33 print OUT "// and with no claim as to its suitability for any purpose.\n";
35 print OUT "// For more information, see http://www.boost.org\n";
37 print OUT "#ifndef BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";
38 print OUT "#define BOOST_SIGNALS_SIGNAL" , $numArgs . "_HEADER\n";
40 print OUT "#define BOOST_SIGNALS_NUM_ARGS $numArgs\n";
43 for ($i = 1; $i <= $numArgs; ++$i) {
45 $templateParms .= ", ";
47 $templateParms .= "typename T$i";
49 print OUT "#define BOOST_SIGNALS_TEMPLATE_PARMS $templateParms\n";
54 print OUT "#define BOOST_SIGNALS_TEMPLATE_ARGS $templateArgs\n";
57 for ($i = 1; $i <= $numArgs; ++$i) {
63 print OUT "#define BOOST_SIGNALS_PARMS $parms\n";
66 for ($i = 1; $i <= $numArgs; ++$i) {
72 print OUT "#define BOOST_SIGNALS_ARGS $args\n";
75 for ($i = 1; $i <= $numArgs; ++$i) {
79 $boundArgs .= "args->a$i";
81 print OUT "#define BOOST_SIGNALS_BOUND_ARGS $boundArgs\n";
84 for ($i = 1; $i <= $numArgs; ++$i) {
85 $argsAsMembers .= "T$i a$i;";
87 print OUT "#define BOOST_SIGNALS_ARGS_AS_MEMBERS $argsAsMembers\n";
90 for ($i = 1; $i <= $numArgs; ++$i) {
94 $copyParms .= "T$i ia$i";
96 print OUT "#define BOOST_SIGNALS_COPY_PARMS $copyParms\n";
102 for ($i = 1; $i <= $numArgs; ++$i) {
106 $initArgs .= "a$i(ia$i)";
108 print OUT "#define BOOST_SIGNALS_INIT_ARGS $initArgs\n";
111 for ($i = 1; $i <= $numArgs; ++$i) {
112 $argTypes .= "typedef T$i arg". ($i+1) . "_type; ";
115 print OUT "#define BOOST_SIGNALS_ARG_TYPES $argTypes\n";
117 print OUT "#include <boost/signals/signal_template.hpp>\n";
119 print OUT "#undef BOOST_SIGNALS_ARG_TYPES\n";
120 print OUT "#undef BOOST_SIGNALS_INIT_ARGS\n";
121 print OUT "#undef BOOST_SIGNALS_COPY_PARMS\n";
122 print OUT "#undef BOOST_SIGNALS_ARGS_AS_MEMBERS\n";
123 print OUT "#undef BOOST_SIGNALS_BOUND_ARGS\n";
124 print OUT "#undef BOOST_SIGNALS_ARGS\n";
125 print OUT "#undef BOOST_SIGNALS_PARMS\n";
126 print OUT "#undef BOOST_SIGNALS_TEMPLATE_ARGS\n";
127 print OUT "#undef BOOST_SIGNALS_TEMPLATE_PARMS\n";
128 print OUT "#undef BOOST_SIGNALS_NUM_ARGS\n";
130 print OUT "#endif // BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";