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