]> git.lyx.org Git - lyx.git/blob - boost/boost/signals/detail/gen_signal_N.pl
update boost to pre-1.30.0
[lyx.git] / boost / boost / signals / detail / gen_signal_N.pl
1 #!/usr/bin/perl -w
2 #
3 # Boost.Signals 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_signal_N <number of arguments>\n";
21   exit;
22 }
23
24
25 $totalNumArgs = $ARGV[0];
26 for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
27   open OUT, ">signal$numArgs.hpp";
28   print OUT "// Boost.Signals 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_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";
44   print OUT "#define BOOST_SIGNALS_SIGNAL" , $numArgs . "_HEADER\n";
45   print OUT "\n";
46   print OUT "#define BOOST_SIGNALS_NUM_ARGS $numArgs\n";
47
48   $templateParms = "";
49   for ($i = 1; $i <= $numArgs; ++$i) {
50     if ($i > 1) {
51       $templateParms .= ", ";
52     }
53     $templateParms .= "typename T$i";
54   }
55   print OUT "#define BOOST_SIGNALS_TEMPLATE_PARMS $templateParms\n";
56
57   $_ = $templateParms;
58   s/typename //g;
59   $templateArgs = $_;
60   print OUT "#define BOOST_SIGNALS_TEMPLATE_ARGS $templateArgs\n";
61
62   $parms = "";
63   for ($i = 1; $i <= $numArgs; ++$i) {
64     if ($i > 1) {
65       $parms .= ", ";
66     }
67     $parms .= "T$i a$i";
68   }
69   print OUT "#define BOOST_SIGNALS_PARMS $parms\n";
70
71   $args = "";
72   for ($i = 1; $i <= $numArgs; ++$i) {
73     if ($i > 1) {
74       $args .= ", ";
75     }
76     $args .= "a$i";
77   }
78   print OUT "#define BOOST_SIGNALS_ARGS $args\n";
79
80   $boundArgs = "";
81   for ($i = 1; $i <= $numArgs; ++$i) {
82     if ($i > 1) {
83       $boundArgs .= ", ";
84     }
85     $boundArgs .= "args->a$i";
86   }
87   print OUT "#define BOOST_SIGNALS_BOUND_ARGS $boundArgs\n";
88
89   $argsAsMembers = "";
90   for ($i = 1; $i <= $numArgs; ++$i) {
91     $argsAsMembers .= "T$i a$i;";
92   }
93   print OUT "#define BOOST_SIGNALS_ARGS_AS_MEMBERS $argsAsMembers\n";
94
95   $copyParms = "";
96   for ($i = 1; $i <= $numArgs; ++$i) {
97     if ($i > 1) {
98       $copyParms .= ", ";
99     }
100     $copyParms .= "T$i ia$i";
101   }
102   print OUT "#define BOOST_SIGNALS_COPY_PARMS $copyParms\n";
103
104   $initArgs = "";
105   if ($numArgs > 0) {
106       $initArgs = ":";
107   }
108   for ($i = 1; $i <= $numArgs; ++$i) {
109     if ($i > 1) {
110       $initArgs .= ", ";
111     }
112     $initArgs .= "a$i(ia$i)";
113   }
114   print OUT "#define BOOST_SIGNALS_INIT_ARGS $initArgs\n";
115
116   $argTypes = "";
117   for ($i = 1; $i <= $numArgs; ++$i) {
118     $argTypes .= "typedef T$i arg". ($i+1) . "_type; ";
119   }
120
121   print OUT "#define BOOST_SIGNALS_ARG_TYPES $argTypes\n";
122   print OUT "\n";
123   print OUT "#include <boost/signals/signal_template.hpp>\n";
124   print OUT "\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";
135   print OUT "\n";
136   print OUT "#endif // BOOST_SIGNALS_SIGNAL" . $numArgs . "_HEADER\n";
137   close OUT;
138 }