[docs] xmldocs - docelic modified 2 files
docs at icdevgroup.org
docs at icdevgroup.org
Wed Aug 4 13:40:44 EDT 2004
User: docelic
Date: 2004-08-04 17:40:44 GMT
Modified: bin refs-autogen stattree
Log:
- bin/stattree:
- now remembers the function name and starting linenumber where the
symbol appears
- bin/refs-autogen:
- added compatiblity code which understand both formats (with and without
the above function name). This compat code will be removed once we
regenerate all cache files with this new bin/stattree
Revision Changes Path
1.11 +6 -2 xmldocs/bin/refs-autogen
rev 1.11, prev_rev 1.10
Index: refs-autogen
===================================================================
RCS file: /var/cvs/xmldocs/bin/refs-autogen,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- refs-autogen 4 Aug 2004 16:34:10 -0000 1.10
+++ refs-autogen 4 Aug 2004 17:40:44 -0000 1.11
@@ -136,7 +136,11 @@
my $ar = $hash{symbols}{ $$ag{"_symbol type"} }{$key};
if ( @$ar ) { $$ag{source} = "" }
for my $ctx ( @$ar ) {
- my ($fi, $ln, $ctxsize, $ctxdata) = @$ctx;
+ my ($fi, $ln, $ctxmeta, $ctxdata) = @$ctx;
+ my @ctxsize = split /\s/, $ctxmeta;
+ # Support incompatible bin/stattree change
+ # XXX Remove once we autogenerate all with new bin/stattree
+ my $ctxsize = scalar @ctxsize == 2 ? $ctxsize[1] : $ctxsize[0];
my $loc = "$fi:$ln";
for my $arr ( @{ $covered{$key}{$fi} } ) {
goto DONELOOP if $ln > $$arr[0] and $ln < $$arr[1];
@@ -145,7 +149,7 @@
if ( length $ctxsdata ) {
$$ag{source} .= <<ENDD;
<example>
-<title>$loc ($ctxsize)</title>
+<title>$loc ($ctxmeta)</title>
<programlisting><![CDATA[
$ctxsdata
1.8 +20 -4 xmldocs/bin/stattree
rev 1.8, prev_rev 1.7
Index: stattree
===================================================================
RCS file: /var/cvs/xmldocs/bin/stattree,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- stattree 23 Jul 2004 22:42:23 -0000 1.7
+++ stattree 4 Aug 2004 17:40:44 -0000 1.8
@@ -181,6 +181,9 @@
unshift @file, ""; # Match index numbers with line numbers
close IN;
+ # Global variables to use from the loop below
+ my @gfunc = (qw/unknown -1/); # 2 elements: func name, line num
+
for (my $lnum = 1; $lnum < scalar @file; $lnum++) {
my $line = $file[$lnum];
@@ -233,6 +236,7 @@
$hash{tree}{$file}{code}++;
$hash{total}{perl_code}++;
+ ######################################################
# Discover pragmas
# Ph33r, PH33R my MaD R3G3X skiLLz! ;-)
# This matches $::Pragma->{} or $$::Pragma{}
@@ -244,20 +248,30 @@
# TODO Here, and 2 places below: make sure if ctx is say, 5:5,
# it always shows that much (that is, workaround file beginning/
# file end problems - pad with empty lines or something).
- [ "$i{ver}/$file", $lnum, "$ctx_p\:$ctx_n", [@file[$lnum-$ctx_p..$lnum+$ctx_n]] ];
+ [ "$i{ver}/$file", $lnum, "$gfunc[0]:$gfunc[1] $ctx_p\:$ctx_n", [@file[$lnum-$ctx_p..$lnum+$ctx_n]] ];
}
-
+
+ ######################################################
# Diskover global variables
if ( $line =~ /(()|\$())\$Global::Variable(->\2|\3){(\w+?)}/ ) {
push @{ $hash{symbols}{globvar}{$5} },
- [ "$i{ver}/$file", $lnum, "$ctx_p\:$ctx_n", [@file[$lnum-$ctx_p..$lnum+$ctx_n]] ];
+ [ "$i{ver}/$file", $lnum, "$gfunc[0]:$gfunc[1] $ctx_p\:$ctx_n", [@file[$lnum-$ctx_p..$lnum+$ctx_n]] ];
}
if ( $line =~ /\$Tag->var\s*\(\s*(["'])(\S+?)\1(\s*,\s*(\d))?/ ) {
push @{ $hash{symbols}{globvar}{$5} },
- [ "$i{ver}/$file", $lnum, "$ctx_p\:$ctx_n", [@file[$lnum-$ctx_p..$lnum+$ctx_n]] ];
+ [ "$i{ver}/$file", $lnum, "$gfunc[0]:$gfunc[1] $ctx_p\:$ctx_n", [@file[$lnum-$ctx_p..$lnum+$ctx_n]] ];
warn "\$Tag->var syntax never used in .pl/.pm files by now.
I'll register that, but is it a mistake? ($2, $4)\n";
}
+
+ ######################################################
+ # See if it's a beginning of a subroutine name, and remember the
+ # name/linenum.
+ if ( $line =~ /^\s*sub\s+(\w+)\s*\{\s*$/ ) {
+ $hash{total}{perl_functions}++;
+ @gfunc = ( $1, $lnum );
+ }
+
} else {
warn "IMPOSSIBLE\n";
}
@@ -333,6 +347,8 @@
# filetypes => { # files of that type
# ...ftype...
# }
+#
+# perl_functions # Total number of Perl functions in the source
#
# # Each file's stat() data
# tree => {
More information about the docs
mailing list