3 # Boost.Function 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_function_N <number of arguments>\n";
25 $totalNumArgs = $ARGV[0];
26 for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
27 open OUT, ">function$numArgs.hpp";
28 print OUT "// Boost.Function 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_FUNCTION_FUNCTION" . $numArgs . "_HEADER\n";
44 print OUT "#define BOOST_FUNCTION_FUNCTION" , $numArgs . "_HEADER\n";
46 print OUT "#define BOOST_FUNCTION_NUM_ARGS $numArgs\n";
49 for ($i = 0; $i < $numArgs; ++$i) {
51 $templateParms .= ", ";
53 $templateParms .= "typename T$i";
55 print OUT "#define BOOST_FUNCTION_TEMPLATE_PARMS $templateParms\n";
60 print OUT "#define BOOST_FUNCTION_TEMPLATE_ARGS $templateArgs\n";
63 for ($i = 0; $i < $numArgs; ++$i) {
69 print OUT "#define BOOST_FUNCTION_PARMS $parms\n";
72 for ($i = 0; $i < $numArgs; ++$i) {
78 print OUT "#define BOOST_FUNCTION_ARGS $args\n";
81 for ($i = 1; $i < $numArgs; ++$i) {
85 $not0Parms .= "T$i a$i";
87 print OUT "#define BOOST_FUNCTION_NOT_0_PARMS $not0Parms\n";
90 for ($i = 1; $i < $numArgs; ++$i) {
96 print OUT "#define BOOST_FUNCTION_NOT_0_ARGS $not0Args\n";
99 print OUT "#include <boost/function/function_template.hpp>\n";
101 print OUT "#undef BOOST_FUNCTION_NOT_0_ARGS\n";
102 print OUT "#undef BOOST_FUNCTION_NOT_0_PARMS\n";
103 print OUT "#undef BOOST_FUNCTION_ARGS\n";
104 print OUT "#undef BOOST_FUNCTION_PARMS\n";
105 print OUT "#undef BOOST_FUNCTION_TEMPLATE_ARGS\n";
106 print OUT "#undef BOOST_FUNCTION_TEMPLATE_PARMS\n";
107 print OUT "#undef BOOST_FUNCTION_NUM_ARGS\n";
109 print OUT "#endif // BOOST_FUNCTION_FUNCTION" . $numArgs . "_HEADER\n";