From: wolf Date: Tue, 23 Feb 1999 17:02:37 +0000 (+0000) Subject: Add a script to process forward declarations of all classes declared somewhere in... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92edf0ca287788383693eb64175e7e6911916b54;p=dealii-svn.git Add a script to process forward declarations of all classes declared somewhere in its input. git-svn-id: https://svn.dealii.org/trunk@883 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/Make_forward_declarations b/deal.II/deal.II/Make_forward_declarations new file mode 100644 index 0000000000..1c34656d85 --- /dev/null +++ b/deal.II/deal.II/Make_forward_declarations @@ -0,0 +1,57 @@ +# call this script with a list of files it shall process for +# class and struct declarations. + + +#fill list of files to be processed +while ($ARGV[0]) { + @input_files = (@input_files, shift); +} + + +foreach $file (@input_files) { + parse_class_declarations ($file); +}; + + + + + + + +sub parse_class_declarations { + local ($filename) = $_[0]; + + open (FILE, $filename); + while () { + + # if the lines contains a "template" at the + # beginning and no semicolon at the end: join it + # with the next line. + if ( /^\s*template/ && !/;\s*$/ ) { + s/\n//; + $_ = $_ . " " . ; + } + + if ( /^\s*((template\s*<(([-\w,_\s]|<([-\w_,+\s])+>)+)>\s*)?(class|struct))(.*)/ ) { + # this is the declaration of a class, possibly a template + $basepart = $1; + $rest = $7; + + # test whether it is a forward declaration or something else. + # $rest contains the name of the class and what comes after that + # + # first extract the name of the class + $rest =~ /([\w_]+(\s*<(([-\w,_\s]|<([-\w,+\s])+>)+)>)?)(.*)/; + + $name = $1; + $rest = $6; + + # we look for declarations, where after the name comes a colon + # or an open-brace + if ($rest =~ /^\s*[:\{;]/) { +# print "$_"; + print "$basepart $name;\n"; + } + } + } +}