]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a script to process forward declarations of all classes declared somewhere in...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Feb 1999 17:02:37 +0000 (17:02 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Feb 1999 17:02:37 +0000 (17:02 +0000)
git-svn-id: https://svn.dealii.org/trunk@883 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/Make_forward_declarations [new file with mode: 0644]

diff --git a/deal.II/deal.II/Make_forward_declarations b/deal.II/deal.II/Make_forward_declarations
new file mode 100644 (file)
index 0000000..1c34656
--- /dev/null
@@ -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 (<FILE>) {
+
+       # 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//;
+           $_ = $_ . " " . <FILE>;
+       }
+
+       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";
+           }
+       }
+    }
+}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.