[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kdoc
Subject:    kdoc-Patch and questions
From:       Wolfgang Bangerth <Wolfgang.Bangerth () IWR ! Uni-Heidelberg ! De>
Date:       1999-12-01 9:39:19
[Download RAW message or body]


Hi Sirtaj,
I have some (a few) patches for kdoc, which I invented in order to get our
project through it. They are:
1) Take special care when matching the operator(), since it was
   misparsed before.
2) Some cosmetic things: reorder output for better information.
3) If we run on a templated class definition, try to match the whole
   name first, but if that fails, try again with the class name without
   the template args. Otherwise, the following will not be found:

    template <int dim>
    class Point {
      public:
        double   operator () (const unsigned int index) const;
    };

    template <int dim>
    double Point<dim>::operator () (const unsigned int index) const {};
                ^^^^^
              Here is the problem

Apart from this, I have a question. I happened to run over some SGML
documentation and I was impressed by the clarity of the linuxdoc SGML (as
compared to the uglyness that HTML presents to the eye). I immediately
thought of kdoc and that you mentioned it had a SGML backend, so I tried
it. It produces docbook, instead of linuxdoc, I found, so two questions:
1) What is the program I have to use to process docbook output? (Yes,
   stupid question, but actually I couldn't find something off-hand on my 
   Linux box, sorry).
2) Why did you choose docbook over linuxdoc? As far as I can see, the rest
   of the KDE project uses linuxdoc.

Best regards,
  Wolfgang



*** kdoc.old	Wed Dec  1 09:41:20 1999
--- kdoc	Wed Dec  1 10:27:12 1999
***************
*** 595,601 ****
  		$newNode = newIDLstruct( $type, $name, $fwd, $complete, @in );
  	}
  	# Method
! 	elsif ( $decl =~ /^\s*(.+?) 	# return type + name
  		\( (.*?) \)		# parameters
  		\s*((?:const)?)\s*
  		\s*((?:=\s*0(?:L?))?)\s*	# Pureness. is "0L" allowed?
--- 595,601 ----
  		$newNode = newIDLstruct( $type, $name, $fwd, $complete, @in );
  	}
  	# Method
! 	elsif ( $decl =~ /^\s*(.+?(?:operator\s*\(\)\s*)?) 	# return type + name
  		\( (.*?) \)		# parameters
  		\s*((?:const)?)\s*
  		\s*((?:=\s*0(?:L?))?)\s*	# Pureness. is "0L" allowed?
***************
*** 1090,1106 ****
  	my $parent = $cNode;
  	my $class;
  
! 	print "Cracked: [$retType] [$name]\n\t[$params]\n\t[$const]\n" 
! 		if $debug;
! 
! 	if ( $retType =~ /([\w\s_<>]+)\s*::\s*$/ ) {
  		# check if stuff before :: got into rettype by mistake.
  		$retType = $`;
  		($name = $1."::".$name);
  		$name =~ s/\s+//g;
! 		print "New name = \"$name\" and type = '$retType'\n";
  	}
  
  	if( $name =~ /^\s*(.*?)\s*::\s*(.*?)\s*$/ ) {
  		# Fully qualified method name.
  		$name = $2;
--- 1090,1107 ----
  	my $parent = $cNode;
  	my $class;
  
! 	if ( $retType =~ /([\w\s_<>,]+)\s*::\s*$/ ) {
  		# check if stuff before :: got into rettype by mistake.
  		$retType = $`;
  		($name = $1."::".$name);
  		$name =~ s/\s+//g;
! 		print "New name = \"$name\" and type = '$retType'\n"
! 		    if $debug;
  	}
  
+ 	print "Cracked: [$retType] [$name]\n\t[$params]\n\t[$const]\n" 
+ 		if $debug;
+ 
  	if( $name =~ /^\s*(.*?)\s*::\s*(.*?)\s*$/ ) {
  		# Fully qualified method name.
  		$name = $2;
***************
*** 1116,1124 ****
  			my $node = kdocAstUtil::findRef( $cNode, $class );
  
  			if ( !defined $node ) {
  				warn "$exe: Unidentified class: $class ".
! 					"in $currentfile\:$.\n";
  				return undef;
  			}
  
  			$parent = $node;
--- 1117,1135 ----
  			my $node = kdocAstUtil::findRef( $cNode, $class );
  
  			if ( !defined $node ) {
+ 			    # if we couldn't find the name, try again with
+ 			    # all template parameters stripped off:
+ 			    my $strippedClass = $class;
+ 			    $strippedClass =~ s/<[^<>]*>//g;
+ 
+ 			    $node = kdocAstUtil::findRef( $cNode, $strippedClass );
+ 
+ 			    # if still not found: give up
+ 			    if ( !defined $node ) {
  				warn "$exe: Unidentified class: $class ".
! 				    "in $currentfile\:$.\n";
  				return undef;
+ 			    }
  			}
  
  			$parent = $node;


-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic