[gtk-doc] gtkdoc-fixxref: turn commented out prints into TRACE statements



commit ad286d367be8de8adab3413ca9ea5360ac577d15
Author: Stefan Sauer <ensonic users sf net>
Date:   Sun Sep 23 21:40:29 2012 +0200

    gtkdoc-fixxref: turn commented out prints into TRACE statements

 gtkdoc-fixxref.in |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in
index f1eceb3..a2194f4 100755
--- a/gtkdoc-fixxref.in
+++ b/gtkdoc-fixxref.in
@@ -98,7 +98,7 @@ my %NoLinks = (
 my $path_prefix="";
 if ($HTML_DIR =~ m%(.*?)/share/gtk-doc/html%) {
     $path_prefix=$1;
-    #print "Path prefix: $path_prefix\n";
+    @TRACE@("Path prefix: $path_prefix");
 }
 
 if (!defined $MODULE_DIR) {
@@ -113,7 +113,7 @@ $dir = `pkg-config --variable=prefix glib-2.0`;
 $dir =~ s/\s+$//;
 $dir = $dir . "/share/gtk-doc/html";
 if (-d $dir && $dir ne $HTML_DIR) {
-    #print "Scanning GLib directory: $dir\n";
+    @TRACE@("Scanning GLib directory: $dir");
     if ($dir !~ m%^\Q$path_prefix\E/%) {
         &ScanIndices ($dir, 1);
     } else {
@@ -126,7 +126,7 @@ if (defined ($ENV{"GNOME2_PATH"})) {
     foreach $dir (split (/:/, $ENV{"GNOME2_PATH"})) {
         $dir = $dir . "/share/gtk-doc/html";
         if (-d $dir && $dir ne $HTML_DIR) {
-            #print "Scanning GNOME2_PATH directory: $dir\n";
+            @TRACE@("Scanning GNOME2_PATH directory: $dir");
             if ($dir !~ m%^\Q$path_prefix\E/%) {
                 &ScanIndices ($dir, 1);
             } else {
@@ -139,10 +139,10 @@ if (defined ($ENV{"GNOME2_PATH"})) {
     }
 }
 
-#print "Scanning HTML_DIR directory: $HTML_DIR\n";
+ TRACE@("Scanning HTML_DIR directory: $HTML_DIR");
 &ScanIndices ($HTML_DIR, 0);
 push (@VisitedPaths, $HTML_DIR);
-#print "Scanning HTML_DIR directory: $MODULE_DIR\n";
+ TRACE@("Scanning HTML_DIR directory: $MODULE_DIR");
 &ScanIndices ($MODULE_DIR, 0);
 push (@VisitedPaths, $MODULE_DIR);
 
@@ -153,12 +153,12 @@ foreach my $dir (@EXTRA_DIRS) {
 
     foreach $vdir (@VisitedPaths) {
         if ($dir eq $vdir || $dir =~ m%^\Q$vdir\E/%) {
-            #print "Skipping EXTRA_DIR directory: $dir\n";
+            @TRACE@("Skipping EXTRA_DIR directory: $dir");
             $skip=1;
         }
     }
     next if $skip;
-    #print "Scanning EXTRA_DIR directory: $dir\n";
+    @TRACE@("Scanning EXTRA_DIR directory: $dir");
     push (@VisitedPaths, $dir);
 
     # If the --extra-dir option is not relative and is not sharing the same
@@ -209,7 +209,7 @@ if (defined($MODULE)) {
 sub ScanIndices {
     my ($scan_dir, $use_absolute_links) = @_;
 
-    #print "Scanning source directory: $scan_dir absolute: $use_absolute_links\n";
+    @TRACE@("Scanning source directory: $scan_dir absolute: $use_absolute_links");
 
     # This array holds any subdirectories found.
     my (@subdirs) = ();
@@ -238,7 +238,6 @@ sub ScanIndices {
 
 sub ScanIndex {
     my ($file, $use_absolute_links) = @_;
-    #print "Scanning index file: $file absolute: $use_absolute_links\n";
 
     # Determine the absolute directory, to be added to links in index.sgml
     # if we need to use an absolute link.
@@ -250,12 +249,13 @@ sub ScanIndex {
         $file =~ /(.*\/)(.*?)\/index\.sgml/;
         $dir = $1;
     }
+    @TRACE@("Scanning index file=$file, absolute=$use_absolute_links, dir=$dir");
 
     open (INDEXFILE, $file)
         || die "Can't open $file: $!";
     while (<INDEXFILE>) {
         if (m/^<ANCHOR\s+id\s*=\s*"([^"]*)"\s+href\s*=\s*"([^"]*)"\s*>/) {
-            #print "Found id: $1 href: $2\n";
+            @TRACE@("Found id: $1 href: $2");
             $Links{$1} = "$dir$2";
         }
     }
@@ -282,7 +282,7 @@ sub FixCrossReferences {
 
 sub FixHTMLFile {
     my ($file) = @_;
-    #print "Fixing file: $file\n";
+    @TRACE@("Fixing file: $file");
 
     open (HTMLFILE, $file)
         || die "Can't open $file: $!";
@@ -354,12 +354,14 @@ sub MakeXRef {
         # uninstalled
         if (defined($MODULE) && $href =~ m%^\.\./$MODULE/(.*)$%) {
             $href=$1;
+            @TRACE@("  Fixing link to uninstalled doc: $id, $href, $text");
+        } else {
+            @TRACE@("  Fixing link: $id, $href, $text");
         }
-        #print "  Fixing link: $id, $href, $text\n";
         return "<a href=\"$href\">$text</a>";
     } else {
         my $warn = 1;
-        #print "  no link for: $id, $text\n";
+        @TRACE@("  no link for: $id, $text");
 
         # don't warn multiple times and also skip blacklisted (ctypes)
         $warn = 0 if exists $NoLinks{$id};
@@ -420,7 +422,7 @@ sub HighlightSource {
     print NEWFILE $source;
     close (NEWFILE);
 
-    #print" running @HIGHLIGHT@ @HIGHLIGHT_OPTIONS $temp_source_file \n";
+    @TRACE@(" running @HIGHLIGHT@ @HIGHLIGHT_OPTIONS $temp_source_file ");
 
     # format source
     my $highlighted_source=` HIGHLIGHT@ @HIGHLIGHT_OPTIONS $temp_source_file`;



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