2
# This perl script takes a template class definition and converts it to
10
# skip whole line comment and blank lines
11
next if (/^\s*(\/\/.*)?$/);
14
if (/^template *< *class +([_A-Za-z][_A-Za-z0-9]*) *>/) { #the template dec
16
} elsif (/^class +([_A-Za-z][_A-Za-z0-9]*)/) { # the class dec
18
print "\#define $1_declare($type) \\\n";
19
s/^(class +)$class/$1$class \#\# $type/;
21
# change the names of inherited template classes to macro version
22
s/< *$type *>/ \#\# $type/g;
25
} elsif (/^} *; *$/) { # the end of the class definition
26
# (don't end members like this)
29
} elsif (/^ *$/) { # in case the above misses the definition end
32
} elsif ($macroize) { # a line in the body of the class definition
33
s/$class *< *$type *>/$class \#\# $type/g;
34
s/^( *~? *)$class( *\()/$1$class \#\# $type$2/; # fixes the CTOR's
36
# change the names of inherited template classes initializers
37
# that appear in CTOR to the macro version
38
s/< *$type *>/ \#\# $type/g;
41
} else { # a line outside the class definition