gtk-doc r572 - trunk



Author: stefkost
Date: Tue Jun  3 13:53:43 2008
New Revision: 572
URL: http://svn.gnome.org/viewvc/gtk-doc?rev=572&view=rev

Log:
	* TODO:
	  Spelling.
	* gtkdoc-mkdb.in:
	  Warn and skip double file entries in section files.
	* gtkdoc-mktmpl.in:
	  Use the new warning format in this script too.
	* gtkdoc-rebase.in:
	  Also use optional parameters here.



Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/gtkdoc-mkdb.in
   trunk/gtkdoc-mktmpl.in
   trunk/gtkdoc-rebase.in

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Tue Jun  3 13:53:43 2008
@@ -14,7 +14,7 @@
 and join discussion about future features.
 
 
-Developer can also add items here :)
+Developers can also add items here :)
 
 = Tracing =
 * there is a bunch of #print statements for tracing

Modified: trunk/gtkdoc-mkdb.in
==============================================================================
--- trunk/gtkdoc-mkdb.in	(original)
+++ trunk/gtkdoc-mkdb.in	Tue Jun  3 13:53:43 2008
@@ -378,6 +378,7 @@
     my $prerequisites = "";
     my $derived = "";
     my @file_objects = ();
+    my %templates = ();
 
     # merge the source docs, in case there are no templates
     &MergeSourceDocumentation;
@@ -411,8 +412,13 @@
             my $sym;
 
 	    $filename = $1;
-	    if (&ReadTemplateFile ("$TMPL_DIR/$filename", 1)) {
-                &MergeSourceDocumentation;
+	    if (! defined $templates{$filename}) {
+	       if (&ReadTemplateFile ("$TMPL_DIR/$filename", 1)) {
+                   &MergeSourceDocumentation;
+                   $templates{$filename}=1;
+               }
+            } else {
+                &LogWarning ($file, $., "Double <FILE>$filename</FILE> entry.");
             }
 
 	} elsif (m/^<INCLUDE>(.*)<\/INCLUDE>/) {
@@ -2883,7 +2889,7 @@
     if ($file =~ m/^.*[\/\\]([^\/\\]*)$/) {
 	$basename = $1;
     } else {
-	print "WARNING: Can't find basename of file $file\n";
+	&LogWarning ($file, 1, "Can't find basename for this filename.");
 	$basename = $file;
     }
 
@@ -2957,7 +2963,6 @@
                 # Handle Section docs
                 if ($symbol =~ m/SECTION:\s*(.*)/) {
                     my $real_symbol=$1;
-                    my $k;
                     my $key;
 
                     #print "SECTION DOCS found in source for : '$real_symbol'\n";
@@ -3524,7 +3529,7 @@
 
                         # Allow '...' as the Varargs parameter.
                         if ($tmpl_param_name eq "...") {
-                          $tmpl_param_name = "Varargs";
+                            $tmpl_param_name = "Varargs";
                         }
 
                         # Try to find the param in the source comment documentation.
@@ -3540,7 +3545,7 @@
                                 $found = 1;
 
                                 # Override the description.
-                                $$tmpl_params[$j + 1] = $param_desc ;
+                                $$tmpl_params[$j + 1] = $param_desc;
 
                                 # Set the name to "" to mark it as used.
                                 $$params[$k] = "";
@@ -3569,7 +3574,7 @@
                             &LogWarning (&GetSymbolSourceFile ($symbol), &GetSymbolSourceLine($symbol),
                                 "$item described in source code comment block but does not exist. $type: $symbol $item: $param_name.");
                         }
-		    }
+                    }
 		}
 	    }
 	} else {
@@ -3580,7 +3585,7 @@
             else {
 		#print "[$symbol] undocumented\n";
             }
-        }
+	}
 
 	# if this symbol is documented, check if docs are complete
 	$tmpl_doc = $SymbolDocs{$symbol};
@@ -3605,6 +3610,8 @@
                     $type="SIGNAL";
                 }
 
+                #print "Check param docs for $symbol, tmpl_params: ",$#$tmpl_params,"\n";
+
                 my $j;
                 for ($j = 0; $j <= $#$tmpl_params; $j += 2) {
                     # Output a warning if the parameter is empty and
@@ -3619,10 +3626,6 @@
                         }
                         &LogWarning ($SourceSymbolSourceFile{$symbol}, $SourceSymbolSourceLine{$symbol},
                             "$item description for $tmpl_param_name is missing in source code comment block.");
-#                        print <<EOF;
-#WARNING: $item description missing in source code comment block -
-# $type: $symbol $item: $tmpl_param_name.
-#EOF
                     }
                 }
             }

Modified: trunk/gtkdoc-mktmpl.in
==============================================================================
--- trunk/gtkdoc-mktmpl.in	(original)
+++ trunk/gtkdoc-mktmpl.in	Tue Jun  3 13:53:43 2008
@@ -137,6 +137,8 @@
 my %SymbolDocs;
 my %SymbolTypes;
 my %SymbolParams;
+my %SymbolSourceFile;
+my %SymbolSourceLine;
 
 # These global arrays store GObject and subclasses and the hierarchy.
 my @Objects;
@@ -285,7 +287,7 @@
 		}
 
 	    } else {
-		print "WARNING: No declaration found for: $1\n";
+		&LogWarning ($file, $., "No declaration found for: $1");
 	    }
 	}
     }
@@ -322,13 +324,8 @@
     }
     close (UNUSED);
     if ($num_unused != 0) {
-	print <<EOF;
-=============================================================================
-WARNING: $num_unused unused declarations.
-  These can be found in $MODULE-unused.txt.
-  They should be added to $MODULE-sections.txt in the appropriate place.
-=============================================================================
-EOF
+        &LogWarning ($old_unused_file, 1, "$num_unused unused declarations.".
+            "They should be added to $MODULE-sections.txt in the appropriate place.");
     }
 
     return &UpdateFileIfChanged ($old_unused_file, $new_unused_file, 0);
@@ -378,7 +375,6 @@
 	my $ret_type_pointer = $4;
 
 	my ($param_num) = 0;
-	my ($name);
 	while ($declaration ne "") {
 	    if ($declaration =~ s/^[\s,]+//) {
 		# skip whitespace and commas
@@ -386,7 +382,7 @@
 
 	    } elsif ($declaration =~ s/^void\s*[,\n]//) {
 		if ($param_num != 0) {
-		    print "WARNING: void used as parameter in function $symbol\n";
+		    &LogWarning ($SymbolSourceFile{$symbol},$SymbolSourceLine{$symbol}, "void used as parameter in function $symbol");
 		}
 
 	    } elsif ($declaration =~ s/^...\s*[,\n]//) {
@@ -397,34 +393,33 @@
 	    #                                $1                                                                                                                                    $2                             $3                                                           $4       $5
 	    } elsif ($declaration =~ s/^\s*((?:G_CONST_RETURN|G_GNUC_UNUSED|unsigned long|unsigned short|signed long|signed short|unsigned|signed|long|short|volatile|const)\s+)*((?:struct\b|enum\b)?\s*\w+)\s*((?:(?:const\b|restrict\b)?\s*\*?\s*(?:const\b|restrict\b)?\s*)*)(\w+)?\s*((?:\[\S*\])*)\s*[,\n]//) {
  		my $pre		= defined($1) ? $1 : "";
- 		my $type	= $2;
+ 		my $vtype	= $2;
  		my $ptr		= defined($3) ? $3 : "";
  		my $name	= defined($4) ? $4 : "";
 
- 		$pre  =~ s/\s+/ /g;
- 		$type =~ s/\s+/ /g;
- 		$ptr  =~ s/\s+/ /g;
- 		$ptr  =~ s/\s+$//;
+ 		$pre   =~ s/\s+/ /g;
+ 		$vtype =~ s/\s+/ /g;
+ 		$ptr   =~ s/\s+/ /g;
+ 		$ptr   =~ s/\s+$//;
  		if ($ptr && $ptr !~ m/\*$/) { $ptr .= " "; }
 
  		if (($name eq "") && $pre =~ m/^((un)?signed .*)\s?/ ) {
- 		    $name = $type;
- 		    $type = "$1";
- 		    $pre = "";
+ 		    $name  = $vtype;
+ 		    $vtype = "$1";
+ 		    $pre   = "";
  		}
 
- 		#print "$symbol: '$pre' '$type' '$ptr' '$name' \n";
+ 		#print "$symbol: '$pre' '$vtype' '$ptr' '$name' \n";
 
  		if ($name eq "") {
 		    $name = "Param" . ($param_num + 1);
 		}
-		$output .= &OutputParam ($symbol, $name, $template_exists, 1,
-					 "");
+		$output .= &OutputParam ($symbol, $name, $template_exists, 1, "");
 
 	    # Try to match parameters which are functions (keep in sync with gtkdoc-mkdb)
 	    #                              $1                                       $2          $3      $4                      $5                    $7             $8
 	    } elsif ($declaration =~ s/^(const\s+|G_CONST_RETURN\s+|unsigned\s+)*(struct\s+)?(\w+)\s*(\**)\s*(?:restrict\b)?\s*(const\s+)?\(\s*\*+\s*(\w+)\s*\)\s*\(([^)]*)\)\s*[,\n]//) {
-	        $name = $6;
+		my $name = $6;
 		$output .= &OutputParam ($symbol, $name, $template_exists, 1,
 					 "");
 
@@ -815,7 +810,7 @@
 	my $type = $SymbolTypes{$symbol};
 	if (!defined ($type)) {
 	    $type = "UNKNOWN";
-	    print "WARNING: Unused symbol $symbol has unknown type\n";
+	    &LogWarning ($SymbolSourceFile{$symbol},$SymbolSourceLine{$symbol}, "Unused symbol $symbol has unknown type.");
 	}
 
     $output .= <<EOF;
@@ -928,7 +923,7 @@
 			    } elsif ($declaration =~ m/^\s*(struct\s+\w+\s*;)?\s*$/) {
 				# Ignore an empty or forward declaration.
 			    } else {
-				print "WARNING: Structure $declaration_name has multiple definitions: $file:$.\n";
+				&LogWarning ($file, $., "Structure $declaration_name has multiple definitions.");
 			    }
 
 			} else {
@@ -937,7 +932,7 @@
 			    $DeclarationConditional{$declaration_name} = 1;
 			}
 		    } else {
-			print "ERROR: $declaration_name has multiple definitions: $file:$.\n";
+			&LogWarning ($file, $., "$declaration_name has multiple definitions.");
 		    }
 		} else {
 		    $Declarations{$declaration_name} = $declaration;
@@ -1076,7 +1071,11 @@
 		|| $symbol eq "Stability_Level") {
 		$symbol = $docsfile . ":" . $symbol;
 	    }
-#	    print "Found symbol: $symbol\n";
+
+	    #print "Found symbol: $symbol\n";
+	    # Remember file and line for the symbol
+	    $SymbolSourceFile{$symbol} = $docsfile;
+	    $SymbolSourceLine{$symbol} = $.;
 
 	    # Canonicalize signal and argument names to have -, not _
 	    if ($type eq "ARG" || $type eq "SIGNAL") {

Modified: trunk/gtkdoc-rebase.in
==============================================================================
--- trunk/gtkdoc-rebase.in	(original)
+++ trunk/gtkdoc-rebase.in	Tue Jun  3 13:53:43 2008
@@ -51,7 +51,7 @@
 	      'verbose' => \$VERBOSE,
 	      'version' => \$PRINT_VERSION,
 	      'help' => \$PRINT_HELP);
-GetOptions(\%optctl, 'html-dir=s', 'other-dir=s@', 'dest-dir=s',
+GetOptions(\%optctl, 'html-dir=s', 'other-dir=s@', 'dest-dir:s',
 		     'online', 'relative', 'aggressive', 'verbose',
 		     'version', 'help');
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]