Mark ChangeLog
[official-gcc.git] / libstdc++-v3 / scripts / gen_includers.pl
blobbfc3a7ec59d724b043ddddadcffa55497a02b4d7
1 #!/usr/bin/perl -w
2 use English;
4 $max = shift @ARGV;
6 $template_params = "typename _T1";
7 $template_args = "_T1";
8 $params = "_T1 __a1";
9 $ref_params = "_T1& __a1";
10 $args = "__a1";
11 $bind_members = "_T1 _M_arg1;";
12 $bind_members_init = "_M_arg1(__a1)";
13 $mu_get_tuple_args = "::std::tr1::get<0>(__tuple)";
14 $bind_v_template_args = "typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type";
15 $bind_v_args = "_Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))";
16 $tuple_add_cref = "typename __add_c_ref<_T1>::type __a1";
17 $tuple_copy_init = "_M_arg1(__in._M_arg1)";
18 $tuple_assign = "_M_arg1 = __in._M_arg1;";
19 $template_params_u = "typename _U1";
20 $template_args_u = "_U1";
21 $ref_wrap_params = "ref(__a1)";
22 $ref_template_args = "_T1&";
23 for ($num_args = 2; $num_args <= $max; ++$num_args) {
24 $prev_args = $num_args - 1;
25 $next_args = $num_args + 1;
26 $template_params_shifted = $template_params;
27 $template_args_shifted = $template_args;
28 $params_shifted = $params;
29 $args_shifted = $args;
30 $template_params .= ", typename _T$num_args";
31 $template_args .= ", _T$num_args";
32 $params .= ", _T$num_args __a$num_args";
33 $ref_params .=", _T$num_args& __a$num_args";
34 $args .= ", __a$num_args";
35 $bind_members .= " _T$num_args _M_arg$num_args;";
36 $bind_members_init .= ", _M_arg$num_args(__a$num_args)";
37 $mu_get_tuple_args .= ", ::std::tr1::get<$prev_args>(__tuple)";
38 $bind_v_template_args .= ", typename result_of<_Mu<_T$num_args> _CV(_T$num_args, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type";
39 $bind_v_args .= ", _Mu<_T$num_args>()(_M_arg$num_args, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))";
40 $tuple_add_cref .= ", typename __add_c_ref<_T$num_args>::type __a$num_args";
41 $tuple_copy_init .= ", _M_arg$num_args(__in._M_arg$num_args)";
42 $tuple_assign .= " _M_arg$num_args = __in._M_arg$num_args;";
43 $template_params_u .= ", typename _U$num_args";
44 $template_args_u .= ", _U$num_args";
45 $ref_wrap_params .= ", ref(__a$num_args)";
46 $ref_template_args .= ", _T$num_args&";
48 print "#define _GLIBCXX_NUM_ARGS $num_args\n";
49 print "#define _GLIBCXX_COMMA ,\n";
50 print "#define _GLIBCXX_TEMPLATE_PARAMS $template_params\n";
51 print "#define _GLIBCXX_TEMPLATE_ARGS $template_args\n";
52 print "#define _GLIBCXX_PARAMS $params\n";
53 print "#define _GLIBCXX_REF_PARAMS $ref_params\n";
54 print "#define _GLIBCXX_ARGS $args\n";
55 print "#define _GLIBCXX_COMMA_SHIFTED ,\n";
56 print "#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED $template_params_shifted\n";
57 print "#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED $template_args_shifted\n";
58 print "#define _GLIBCXX_PARAMS_SHIFTED $params_shifted\n";
59 print "#define _GLIBCXX_ARGS_SHIFTED $args_shifted\n";
60 print "#define _GLIBCXX_BIND_MEMBERS $bind_members\n";
61 print "#define _GLIBCXX_BIND_MEMBERS_INIT $bind_members_init\n";
62 print "#define _GLIBCXX_MU_GET_TUPLE_ARGS $mu_get_tuple_args\n";
63 print "#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) $bind_v_template_args\n";
64 print "#define _GLIBCXX_BIND_V_ARGS $bind_v_args\n";
65 print "#define _GLIBCXX_TUPLE_ADD_CREF $tuple_add_cref\n";
66 print "#define _GLIBCXX_TUPLE_COPY_INIT $tuple_copy_init\n";
67 print "#define _GLIBCXX_TUPLE_ASSIGN $tuple_assign\n";
68 print "#define _GLIBCXX_TEMPLATE_PARAMS_U $template_params_u\n";
69 print "#define _GLIBCXX_TEMPLATE_ARGS_U $template_args_u\n";
70 print "#define _GLIBCXX_REF_WRAP_PARAMS $ref_wrap_params\n";
71 print "#define _GLIBCXX_REF_TEMPLATE_ARGS $ref_template_args\n";
72 print "#define _GLIBCXX_NUM_ARGS_PLUS_1 $next_args\n";
73 print "#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T$next_args\n";
74 if ($num_args == $max) {
75 print "#define _GLIBCXX_LAST_INCLUDE\n"
77 print "#include _GLIBCXX_REPEAT_HEADER\n";
78 if ($num_args == $max) {
79 print "#undef _GLIBCXX_LAST_INCLUDE\n"
81 print "#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n";
82 print "#undef _GLIBCXX_NUM_ARGS_PLUS_1\n";
83 print "#undef _GLIBCXX_REF_TEMPLATE_ARGS\n";
84 print "#undef _GLIBCXX_REF_WRAP_PARAMS\n";
85 print "#undef _GLIBCXX_TEMPLATE_ARGS_U\n";
86 print "#undef _GLIBCXX_TEMPLATE_PARAMS_U\n";
87 print "#undef _GLIBCXX_TUPLE_ASSIGN\n";
88 print "#undef _GLIBCXX_TUPLE_COPY_INIT\n";
89 print "#undef _GLIBCXX_TUPLE_ADD_CREF\n";
90 print "#undef _GLIBCXX_BIND_V_ARGS\n";
91 print "#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n";
92 print "#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n";
93 print "#undef _GLIBCXX_BIND_MEMBERS_INIT\n";
94 print "#undef _GLIBCXX_BIND_MEMBERS\n";
95 print "#undef _GLIBCXX_ARGS_SHIFTED\n";
96 print "#undef _GLIBCXX_PARAMS_SHIFTED\n";
97 print "#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n";
98 print "#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n";
99 print "#undef _GLIBCXX_COMMA_SHIFTED\n";
100 print "#undef _GLIBCXX_ARGS\n";
101 print "#undef _GLIBCXX_REF_PARAMS\n";
102 print "#undef _GLIBCXX_PARAMS\n";
103 print "#undef _GLIBCXX_TEMPLATE_ARGS\n";
104 print "#undef _GLIBCXX_TEMPLATE_PARAMS\n";
105 print "#undef _GLIBCXX_COMMA\n";
106 print "#undef _GLIBCXX_NUM_ARGS\n";
107 print "\n";