[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] add option --no-anchor-db and configuration variable no_anch
From: |
Shigio Yamaguchi |
Subject: |
Re: [PATCH] add option --no-anchor-db and configuration variable no_anchor_db |
Date: |
Sat, 31 May 2003 00:59:50 +0900 |
> Probably people who are using GLOBAL in the small project
> will not notice reduction in performance.
I also think so.
I have commited your patch with some modifications.
o Replace old method with your new method completely.
o Eemove --no-anchor-db option and no_anchor_db config variable.
o Add comment to online manual of htags.
Thank you!
Index: htags.in
===================================================================
RCS file: /cvsroot/global/global/htags/htags.in,v
retrieving revision 1.127
diff -c -r1.127 htags.in
*** htags.in 29 May 2003 07:31:27 -0000 1.127
--- htags.in 30 May 2003 15:38:30 -0000
***************
*** 466,472 ****
# set things right before exiting.
#
sub clean {
- &anchor'finish();
&cache'close();
}
#
--- 466,471 ----
***************
*** 1018,1028 ****
print STDERR "[", &'date, "] ", "(8) making main index ...\n" if ($'vflag);
&makemainindex("$dist/mains.$'normal_suffix", $index);
#
- # (#) make anchor database
- #
- print STDERR "[", &'date, "] ", "(#) making temporary database ...\n" if
($'vflag);
- &anchor'create();
- #
# (9) make HTML files ($SRCS/*)
# USING TAG CACHE, %includes and anchor database.
#
--- 1017,1022 ----
***************
*** 2137,2143 ****
#
# load tags belonging to this file.
#
! &anchor'load($file);
$command = "$'gtags --expand -$tabs ";
$command .= ($'w32) ? "\"$file\"" : "'$file'";
open(SRC, "$command |") || &'error("cannot fork.");
--- 2131,2137 ----
#
# load tags belonging to this file.
#
! &anchor'load($file) unless ($notsource);
$command = "$'gtags --expand -$tabs ";
$command .= ($'w32) ? "\"$file\"" : "'$file'";
open(SRC, "$command |") || &'error("cannot fork.");
***************
*** 2550,2579 ****
#=========================================================================
package anchor;
#
! # create: create anchors temporary database
#
! # go) %PATHLIST
#
! sub create {
! $ANCH = "$'tmp/htaga$$";
! open(ANCH, ">$ANCH") || &'error("cannot create file '$ANCH'.");
! close(ANCH);
! chmod ($ANCH, 0600);
! local($pipeout) = "$'gtags --createdb=$ANCH";
! open(ANCH, "| $pipeout") || &'error("cannot fork.");
! local($fcount) = 1;
! local($fnumber);
foreach $db (&'get_taglist()) {
local($option) = &'get_option($db);
! local($pipein) = "global -nx$option \".*\"";
open(PIPE, "$pipein |") || &'error("cannot fork.");
while (<PIPE>) {
local($tag, $lno, $filename, $image) = split(/\s+/, $_,
4);
! $fnumber = $PATHLIST{$filename};
! if (!$fnumber) {
! $PATHLIST{$filename} = $fnumber = $fcount++;
! }
if ($db eq 'GTAGS') {
$type = ($image =~ /^#[ \t]*(define|undef)/) ?
'M' : 'D';
} elsif ($db eq 'GRTAGS') {
--- 2544,2570 ----
#=========================================================================
package anchor;
#
! # load: load anchors belonging to specified file.
#
! # i) $file source file
! # go) FIRST first definition
! # go) LAST last definition
#
! sub load {
! local($file) = @_;
! local(@keys);
!
! @ANCHORS = ();
! $FIRST = $LAST = 0;
foreach $db (&'get_taglist()) {
local($option) = &'get_option($db);
! local($pipein) = "global -fn$option ";
! $pipein .= ($'w32) ? "\"$file\"" : "'$file'";
open(PIPE, "$pipein |") || &'error("cannot fork.");
while (<PIPE>) {
local($tag, $lno, $filename, $image) = split(/\s+/, $_,
4);
! local($type);
if ($db eq 'GTAGS') {
$type = ($image =~ /^#[ \t]*(define|undef)/) ?
'M' : 'D';
} elsif ($db eq 'GRTAGS') {
***************
*** 2581,2633 ****
} else {
$type = 'Y';
}
! #
! # key: $fnumber
! # dat: $lno$type$tag
! #
! print ANCH "$fnumber $lno$type$tag\n";
}
close(PIPE);
if ($?) { &'error("'$pipein' failed."); }
}
- close(ANCH);
- if ($?) { &'error("'$pipeout' failed."); }
- }
- #
- # finish: remove anchors database
- #
- sub finish {
- unlink("$ANCH") if (defined($ANCH));
- }
- #
- # load: load anchors belonging to specified file.
- #
- # i) $file source file
- # gi) %PATHLIST
- # go) FIRST first definition
- # go) LAST last definition
- #
- sub load {
- local($file) = @_;
- local($fnumber);
-
- @ANCHORS = ();
- $FIRST = $LAST = 0;
-
- $file = './' . $file if ($file !~ /^\.\//);
- if (!($fnumber = $PATHLIST{$file})) {
- return;
- }
- local(@keys);
- local($command) = "$'gtags --readdb=$ANCH $fnumber";
- open(ANCH, "$command |") || &'error("cannot fork.");
- while (<ANCH>) {
- chop;
- push(@keys, int); # int($lno)
- push(@ANCHORS, $_); # "$lno$type$tag"
- }
- close(ANCH);
- if ($?) {&'error("'$command' failed."); }
sub compare { $keys[$a] <=> $keys[$b]; }
@ANCHORS = @ANCHORS[sort compare 0 .. $#keys];
local($c);
--- 2572,2583 ----
} else {
$type = 'Y';
}
! push(@keys, int($lno));
! push(@ANCHORS, "$lno$type$tag");
}
close(PIPE);
if ($?) { &'error("'$pipein' failed."); }
}
sub compare { $keys[$a] <=> $keys[$b]; }
@ANCHORS = @ANCHORS[sort compare 0 .. $#keys];
local($c);
Index: manual.in
===================================================================
RCS file: /cvsroot/global/global/htags/manual.in,v
retrieving revision 1.47
diff -c -r1.47 manual.in
*** manual.in 24 May 2003 14:55:07 -0000 1.47
--- manual.in 30 May 2003 15:38:30 -0000
***************
*** 35,40 ****
--- 35,43 ----
Then you can execute @name{htags} from the same place.
@name{Htags} makes an @file{HTML} directory and generates hypertext in
it.
+ You must use the same parser for both @xref{gtags,1} and @name{htags}.
+ If you use the default parser, it is not necessary to consider for it.
+
You can start browsing from @file{HTML/index.html}.
Once the hypertext is generated, you can move it anywhere and browse it
with any browser.
--
Shigio Yamaguchi <address@hidden> - Tama Communications Corporation
Spare mail address: <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3