]> git.lyx.org Git - lyx.git/blob - boost/boost/function/gen_function_N.pl
complie fix
[lyx.git] / boost / boost / function / gen_function_N.pl
1 #!/usr/bin/perl -w
2 #
3 # Boost.Function library
4 #
5 # Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
6 #
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.
12 #
13 # This software is provided "as is" without express or implied warranty,
14 # and with no claim as to its suitability for any purpose.
15 #
16 # For more information, see http://www.boost.org
17 use English;
18
19 if ($#ARGV < 0) {
20   print "Usage: perl gen_function_N <number of arguments>\n";
21   exit;
22 }
23
24
25 $totalNumArgs = $ARGV[0];
26 for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
27   open OUT, ">function$numArgs.hpp";
28   print OUT "// Boost.Function library\n";
29   print OUT "//\n";
30   print OUT "// Copyright (C) 2001 Doug Gregor (gregod\@cs.rpi.edu)\n";
31   print OUT "//\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";
37   print OUT "//\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";
40   print OUT " \n";
41   print OUT "// For more information, see http://www.boost.org\n";
42   print OUT "\n";
43   print OUT "#ifndef BOOST_FUNCTION_FUNCTION" . $numArgs . "_HEADER\n";
44   print OUT "#define BOOST_FUNCTION_FUNCTION" , $numArgs . "_HEADER\n";
45   print OUT "\n";
46   print OUT "#define BOOST_FUNCTION_NUM_ARGS $numArgs\n";
47
48   $templateParms = "";
49   for ($i = 0; $i < $numArgs; ++$i) {
50     if ($i > 0) {
51       $templateParms .= ", ";
52     }
53     $templateParms .= "typename T$i";
54   }
55   print OUT "#define BOOST_FUNCTION_TEMPLATE_PARMS $templateParms\n";
56
57   $_ = $templateParms;
58   s/typename //g;
59   $templateArgs = $_;
60   print OUT "#define BOOST_FUNCTION_TEMPLATE_ARGS $templateArgs\n";
61
62   $parms = "";
63   for ($i = 0; $i < $numArgs; ++$i) {
64     if ($i > 0) {
65       $parms .= ", ";
66     }
67     $parms .= "T$i a$i";
68   }
69   print OUT "#define BOOST_FUNCTION_PARMS $parms\n";
70
71   $args = "";
72   for ($i = 0; $i < $numArgs; ++$i) {
73     if ($i > 0) {
74       $args .= ", ";
75     }
76     $args .= "a$i";
77   }
78   print OUT "#define BOOST_FUNCTION_ARGS $args\n";
79
80   $not0Parms = "";
81   for ($i = 1; $i < $numArgs; ++$i) {
82     if ($i > 1) {
83       $not0Parms .= ", ";
84     }
85     $not0Parms .= "T$i a$i";
86   }
87   print OUT "#define BOOST_FUNCTION_NOT_0_PARMS $not0Parms\n";
88
89   $not0Args = "";
90   for ($i = 1; $i < $numArgs; ++$i) {
91     if ($i > 1) {
92       $not0Args .= ", ";
93     }
94     $not0Args .= "a$i";
95   }
96   print OUT "#define BOOST_FUNCTION_NOT_0_ARGS $not0Args\n";
97
98   print OUT "\n";
99   print OUT "#include <boost/function/function_template.hpp>\n";
100   print OUT "\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";
108   print OUT "\n";
109   print OUT "#endif // BOOST_FUNCTION_FUNCTION" . $numArgs . "_HEADER\n";
110   close OUT;
111 }