]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Import my changes to kdoc which did not make it yet into a release.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 21 Jun 2000 12:46:42 +0000 (12:46 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 21 Jun 2000 12:46:42 +0000 (12:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@3046 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/kdoc/src/kdoc
deal.II/contrib/kdoc/src/kdocCxxHTML.pm
deal.II/contrib/kdoc/src/kdocHTMLutil.pm

index b7c0ca2c54b5e966543422436303e490e881f41f..86219e287f12124db024774d369bb5084bb3766d 100755 (executable)
@@ -564,12 +564,14 @@ sub identifyDecl
 
        # Typedef
        elsif ( $decl =~ /^\s*typedef\s+
+                        (?:typename\s+)?        # `typename' keyword
                        (.*?\s*[\*&]?)          # type
-                       \s*([-\w_\:]+)          # name
+                       \s+([-\w_\:]+)          # name
+                       \s*(\[[-\w_\:<>\s]*\])?              # array
                        \s*[{;]\s*$/xs  ) {
 
-               print "Typedef: <$1> <$2>\n" if $debug;
-               $newNode = newTypedef( $1, $2 );
+               print "Typedef: <$1 $3> <$2>\n" if $debug;
+               $newNode = newTypedef( $1.$3, $2 );
        }
 
        # Enum
@@ -657,7 +659,7 @@ sub identifyDecl
                my $pure = $4 eq "" ? 0 : 1;
 
                if ( $tpn =~ /((?:\w+\s*::\s*)?operator.*?)\s*$/        # operator
-                                       || $tpn =~ /((?:\w*\s*::\s*~?)?[-\w:]+)\s*$/ ) { # normal
+                               || $tpn =~ /((?:\w*(?:\s*<[\w\s_,]*>\s*)?\s*::\s*~?)?[-\w:]+)\s*$/ ) { # normal
                                my $name = $1;
                                $tpn = $`;
                                $newNode = newMethod( $tpn, $name, 
@@ -1145,7 +1147,7 @@ sub newMethod
        print "Cracked: [$retType] [$name]\n\t[$params]\n\t[$const]\n" 
                if $debug;
 
-    if ( $retType =~ /([\w\s_<>,]+)\s*::\s*$/ ) {
+    if ( $retType =~ /(\w+(<[\w\s_,]*>|\s*::\s*\w+)*)\s*::\s*$/ ) {
                # check if stuff before :: got into rettype by mistake.
                $retType = $`;
                ($name = $1."::".$name);
index 2b2d0b35d2406dc966c5ec00b7044cc46a8526ee..58c1cddfda9568d1e723d5239a76219497839522 100644 (file)
@@ -688,7 +688,7 @@ EOF
                $type = $m->{NodeType};
                $name = B( "b", $name );
 
-               print CLASS "<LI>";
+               print CLASS "<LI>\n";
 
                if( $type eq "var" ) {
                        print CLASS esc( $m->{Type}), " $name\n";
@@ -721,7 +721,7 @@ EOF
                        print CLASS esc($type), " $name\n";
                }
 
-               print CLASS "</LI>\n";
+               print CLASS "</LI>\n\n";
        }
 
 print CLASS<<EOF;
index 76f6edc68cd670f1d06582665abb021f9b15cea9..f9ff6323c8f9315be75280458491562ac697a226 100644 (file)
@@ -393,15 +393,15 @@ sub printDoc
                                if !defined $type;
 
                        if( $lasttype eq "ListItem" && $type ne $lasttype ) {
-                               print CLASS "</ul><p>\n";
+                               print CLASS "</ul>\n\n<p>\n";
                        }
 
                         if( $type eq "DocText" ) {
                                 print CLASS "", deref( $name, $rootnode );
                         }
                         elsif ( $type eq "Pre" ) {
-                                print CLASS "</p><pre>\n",
-                                       esc( $name ), "\n</pre><p>";
+                                print CLASS "</p>\n\n<pre>\n",
+                                       esc( $name ), "\n</pre>\n\n<p>\n";
                         }
                        elsif( $type eq "Ref" ) {
                                my $ref = $node->{Ref};
@@ -414,19 +414,19 @@ sub printDoc
                                }
                        }
                        elsif ( $type eq "DocSection" ) {
-                               print CLASS "</p><H3>",
-                                       deref( $name, $rootnode),"</H3><p>";
+                               print CLASS "</p>\n\n<H3>",
+                                       deref( $name, $rootnode),"</H3>\n<p>\n";
                        }
                        elsif ( $type eq "Image" ) {
-                               print CLASS "</p><img url=\"",
-                                       $node->{Path}, "\"><p>";                
+                               print CLASS "</p>\n<img url=\"",
+                                       $node->{Path}, "\">\n<p>\n";
                        }
                         elsif ( $type eq "ParaBreak" ) {
-                                print CLASS "</p><p>";
+                                print CLASS "</p>\n\n<p>";
                         }
                        elsif ( $type eq "ListItem" ) {
                                if ( $lasttype ne "ListItem" ) {
-                                       print CLASS "</p><ul>\n";
+                                       print CLASS "</p>\n\n<ul>\n";
                                }
                                print CLASS "<li>", 
                                        deref( $name, $rootnode ), "</li>\n";
@@ -436,10 +436,10 @@ sub printDoc
                 }
 
                if( $type eq "ListItem" ) {
-                       print CLASS "</ul><p>\n";
+                       print CLASS "</ul>\n\n<p>\n";
                }
 
-                print CLASS "</p>";
+                print CLASS "</p>\n";
 
         }
 
@@ -602,18 +602,43 @@ sub deref
        my $out = "";
        my $text;
 
-       foreach $text ( split (/(\@\w+\s+[\w:#]+)/, $str ) ) {
-               if ( $text =~ /\@ref\s+([\w:#]+)/ ) {
-                       my $name = $1;
-                       $name =~ s/^\s*#//g;
-                       $out .= wordRef( $name, $rootnode );
-               }
-               elsif ( $text =~ /\@p\s+([\w:#]+)/ ) {
-                       $out .= "<code>".esc($1)."</code>";
-               }
-               elsif ( $text =~/\@em\s+(\w+)/ ) {       # emphasized
-                       $out .= "<em>".esc($1)."</em>";
+       # escape @x commands
+       foreach $text ( split (/(\@\w+(?:\s+.+?(?=\s)|\{.*?\}))/, $str ) ) {
+
+               # check whether $text is an @command or the text between
+               # @commands
+               if (  $text =~ /\@(\w+)(?:\s+(.+?)(?:\s|$)|\{(.*?)\})/ )   {
+                        my $command = $1;
+                       my $content = $2 . $3;
+
+                       # @ref -- cross reference
+                       if ( $command eq "ref" ) {
+                           $content =~ s/^\s*#//g;
+                           $out .= wordRef( $content, $rootnode );
+                       }
+
+                       # @p  -- typewriter
+                       elsif ( $command eq "p" ) {
+                           $out .= "<code>".esc($content)."</code>";
+                       }
+
+                       # @em -- emphasized
+                       elsif ( $command eq "em" ) {
+                           $out .= "<em>".esc($content)."</em>";
+                       }
+
+                       # @sect1-4 -- section header
+                       elsif ( $command =~ /^sect([1-4])$/ ) {
+                           $out .= "<h$1>".esc($content)."</h$1>";
+                       }
+
+                       # unknown command. warn and copy command
+                       else {
+                           print "Unknown command @", $command, "\n";
+                           $out .= esc($text);
+                       }
                }
+               # no @x command, thus regular text
                else {
                        $out .= esc($text);
                }

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.