1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#if 0 /* -*-perl-*- */
# /*
# $Id: vatmpl.h,v 1.3 1998/11/10 21:36:06 dm Exp $
#
# This header file was automatically generated by itself.
# (Yup, it's a C++ header file and a perl script.)
#
# Copyright (C) 1998 David Mazieres (dm@uun.org)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
# Note: For the purposes of the GNU General Public License, source
# includes the source to the perl script, not just the resulting
# header file, callback.h. However, since the perl script is
# conveniently embedded in the header file, you needn't do anything
# special to distribute source as long as you don't take the perl out
# of the header.
eval 'exec perl -w -S $0 ${1+"$@"}'
if 0;
use strict;
use vars qw(@a);
my $NA = 10;
seek DATA, 0, 0;
while (<DATA>) {
print;
last if m/^\#endif \/\* perl \*\/$/;
}
print <<'EOF;';
#ifndef _VATMPL_H_INCLUDED_
#define _VATMPL_H_INCLUDED_ 1
EOF;
print <<'EOF;';
#define COMMA ,
#define LPAREN (
#define RPAREN )
EOF;
sub jc(@) {
join (', ', @_);
}
sub nlist ($) {
my $pat = shift;
jc (map { my $ret = $pat; $ret =~ s/%/$_/g; $ret; } @a);
}
sub pdef(\@) {
my $ar = shift;
foreach $_ (@$ar[0 .. $#$ar - 1]) {
my $nt = int ((71 - length ($_)) / 8);
print $_, ($nt > 0 ? "\t" x $nt : ' '), "\\\n";
}
print $$ar[$#$ar], "\n" if @$ar;
}
my @lines;
push @lines, '#define VA_TEMPLATE(fn, start, end)';
my $a;
for ($a = 0; $a <= $NA; $a++) {
local @a = (1 .. $a);
push @lines, '', sprintf ("template<%s>", nlist 'class A%') if ($a > 0);
push @lines, sprintf ("fn (%s)", nlist 'const A% &a%');
push @lines, sprintf (" start (%s) end", nlist 'a%');
}
pdef @lines;
print "\n";
@lines = ();
print "\n", '#endif /', '* !_VATMPL_H_INCLUDED_ *', '/', "\n";
__END__
# */
#endif /* perl */
#ifndef _VATMPL_H_INCLUDED_
#define _VATMPL_H_INCLUDED_ 1
#define COMMA ,
#define LPAREN (
#define RPAREN )
#define VA_TEMPLATE(fn, start, end) \
fn () \
start () end \
\
template<class A1> \
fn (const A1 &a1) \
start (a1) end \
\
template<class A1, class A2> \
fn (const A1 &a1, const A2 &a2) \
start (a1, a2) end \
\
template<class A1, class A2, class A3> \
fn (const A1 &a1, const A2 &a2, const A3 &a3) \
start (a1, a2, a3) end \
\
template<class A1, class A2, class A3, class A4> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) \
start (a1, a2, a3, a4) end \
\
template<class A1, class A2, class A3, class A4, class A5> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) \
start (a1, a2, a3, a4, a5) end \
\
template<class A1, class A2, class A3, class A4, class A5, class A6> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6) \
start (a1, a2, a3, a4, a5, a6) end \
\
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7) \
start (a1, a2, a3, a4, a5, a6, a7) end \
\
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) \
start (a1, a2, a3, a4, a5, a6, a7, a8) end \
\
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) \
start (a1, a2, a3, a4, a5, a6, a7, a8, a9) end \
\
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10> \
fn (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9, const A10 &a10) \
start (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) end
#endif /* !_VATMPL_H_INCLUDED_ */
|