[docs] xmldocs - docelic modified 3 files

docs at icdevgroup.org docs at icdevgroup.org
Thu Oct 14 11:32:39 EDT 2004


User:      docelic
Date:      2004-10-14 15:32:38 GMT
Modified:  .        Makefile
Modified:  bin      refs-autogen stattree
Log:
Well well...

- Makefile:
 - Add bin/stattree to dependency list for 'make caches'
 - Minor style change

- bin/stattree:
 - ** Support for expanding MapRoutine (as Jon suggested) now works properly **
   Took me a little more than I predicted at first ;-)
 - When saving tagopts to $hash{special}{...}, use lowercase (we can easily
   reformat properly for eventual later display)

- bin/refs-autogen:
 - Minor comments / fixes
 - Add missing "lib/" that somehow sometimes gets passed in filename
 - Make context reporting code more general
 - Don't display version template unless the data for it is present (empty
   placeholders look stupid)
 -

- TODO: items

Revision  Changes    Path
1.31      +2 -2      xmldocs/Makefile


rev 1.31, prev_rev 1.30
Index: Makefile
===================================================================
RCS file: /var/cvs/xmldocs/Makefile,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Makefile	12 Oct 2004 16:36:16 -0000	1.30
+++ Makefile	14 Oct 2004 15:32:38 -0000	1.31
@@ -162,7 +162,7 @@
 #############################################################
 # Cache files
 cache caches: $(foreach icver,$(IC_VERSIONS),cache/$(icver)/.cache.bin) $T
-cache/%/.cache.bin: sources/%
+cache/%/.cache.bin: sources/% bin/stattree
 	echo "C     $@"
 	bin/stattree $<
 
@@ -178,7 +178,7 @@
 refs/%.xml: BNAME = $(subst refs/,,$@)
 $T/%.list: FNAME = $(subst .list,,$(BNAME))
 refs/%.xml: FNAME = $(subst .xml,,$(BNAME))
-$T/%.list refs/%.xml: bin/refs-autogen $(foreach icver,$(IC_VERSIONS),cache/$(icver)/.cache.bin)
+$T/%.list refs/%.xml: $(foreach icver,$(IC_VERSIONS),cache/$(icver)/.cache.bin) bin/refs-autogen
 	# PEH, -g is useless since tags migrate between tag groups
 	#bin/refs-autogen -g $(FNAME) -o $@ $(BOTH) $(IC_VERSIONS)
 	bin/refs-autogen -o $@ $(BOTH) $(IC_VERSIONS)



1.46      +13 -9     xmldocs/bin/refs-autogen


rev 1.46, prev_rev 1.45
Index: refs-autogen
===================================================================
RCS file: /var/cvs/xmldocs/bin/refs-autogen,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- refs-autogen	12 Oct 2004 09:41:24 -0000	1.45
+++ refs-autogen	14 Oct 2004 15:32:38 -0000	1.46
@@ -136,7 +136,7 @@
 	# Inner loop: actual symbols
 	while ( my ($gkey,$gval) = each %{ $hash{symbols} } ) {
 		next if $specific_only and $gkey ne $specific_only;
-		if (! $symbol_lists{$gkey} ) {
+		if (! $symbol_lists{$gkey} ) { # So the item is new
 			my @olist;
 			push @olist, "refs/${gkey}s.xml" if $output_xml;
 			push @olist, "tmp/${gkey}s.list" if $output_list;
@@ -219,7 +219,7 @@
 #ENDD
 
 				my $fi = $$ctx{file};
-				my $ln = $$ctx{lnum};
+				my $ln = $$ctx{lnum} || 0; #HA! How come $$ctx{lnum} is undefined??
 			
 				# Support item types with only context info in this field
 				for my $arr ( @{ $covered{$key}{$fi} } ) {
@@ -233,6 +233,7 @@
 				if ( length $ctxsdata ) {
 					my $ls = $$ctx{ctxs}; # line start nr.
 					( my $plf = $$ctx{file} ) =~ s#.+?/##;
+					$plf =~ /^Vend/ and $plf = "lib/" . $plf; #HA?
 					#my $loc = "$$ctx{file}:$$ctx{lnum}";
 					my $loc = $$ctx{file};
 					
@@ -243,13 +244,14 @@
 					if ( $gkey !~ /(tag|conf)$/ ) {
 						$cstart = $$ctx{lnum}-$$ctx{ctxpre};
 						$cend = $$ctx{lnum}+$$ctx{ctxpost};
-						$ctxmeta .= " (context shows lines " . ( $cstart . "-" .  $cend );
 
 					} else {
 						# WE SHOW ALL FOR THOSE
-						$cstart = 1;
-						$cend = scalar @{$$ctx{ctx}}-1;
+						$cstart = $$ctx{ctxs} || 1;
+						$cend = $cstart + scalar @{$$ctx{ctx}}-1;
+						$cstart == 1 and $cend -= 1;
 					}
+					$ctxmeta .= " (context shows lines " . ( $cstart . "-" .  $cend );
 					# XXX - eliminate negative numbers in source context spans
 					# ( 0-6 == OK, -4-6 != OK )
 					#if ( $cstart < 0 ) {
@@ -259,13 +261,15 @@
 					
 					if ( $$ctx{funclnum} ) {
 						$ctxmeta .= " in $$ctx{func}():$$ctx{funclnum}" ;
-						$ctxmeta .= ")";
 					}
+					$ctxmeta .= ")";
 					my $r = $hash{revision}{$plf}->[0];
 					my $d = $hash{revision}{$plf}->[1];
 					my $revinfo = "";
 					if ( $gkey !~ /conf$/ ) {
-						$revinfo = "(rev. $r from $d)";
+						if ( $r and $d ) {
+							$revinfo = "(rev. $r from $d)";
+							}
 					}
 					{ no warnings; # XXX If someone can figure out which of the used vars here is undefined...
 					$$ag{source} .= <<ENDD;
@@ -508,8 +512,8 @@
 	# To fix this, we simply leave item skeleton to be autoregenerated in
 	# those cases (we could leave through in any case, but that would waste
 	# time).
-	if ( ref $autogenerated{$name} ) {
-		if ( $autogenerated{$name}{"_symbol type"} ne $group ) {
+	if ( ref $autogenerated{$name} ) { # Symbol known
+		if ( $autogenerated{$name}{"_symbol type"} ne $group ) { # But changed grp.
 			# The good entry is already in symbol_lists (done in wanted()), we
 			# only need to remove this invalid one here.
 			@{$symbol_lists{$group} } = grep{!/^$name$/} @{ $symbol_lists{$group}};



1.27      +44 -12    xmldocs/bin/stattree


rev 1.27, prev_rev 1.26
Index: stattree
===================================================================
RCS file: /var/cvs/xmldocs/bin/stattree,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- stattree	12 Oct 2004 18:09:31 -0000	1.26
+++ stattree	14 Oct 2004 15:32:38 -0000	1.27
@@ -37,6 +37,8 @@
 # Source contexts
 my $ctx_p = 10; # How much context lines to show before
 my $ctx_n = 4; #                                after
+my %resolver_path; # Support for stack (a -> b -> c -> d   =>
+                   # a = d with full "path" recorded). This expands MapRoutines.
 
 # All file types should be listed here or the stats wont. It should be
 # reported if an unknown file is found in the archive
@@ -302,7 +304,7 @@
 				# (Most often, the difference is in _ and -).
 				my $tn = shift @lis;
 
-				my $tagopt = shift @lis;
+				my $tagopt = lc(shift @lis);
 				next if $tagopt =~ /^documentation$/i;
 
 				# See if it's a routine and parse routine lines as usual perl lines
@@ -326,7 +328,7 @@
 
 					@lis == 1 or die "$tn MapRoutines, but argc != 1 ?\n";
 					next if "@lis" =~ /^::/; # TODO
-					file_extractSub("@lis");
+					file_extractSub($tn, "@lis", \%c);
 				}
 				
 				if ( "@lis" =~ /<</ and $tagopt !~ /^routine/i ) {
@@ -363,10 +365,19 @@
 					%{ $hash{specific}{$tagname} || {}},
 					%{ $specific{$tagname} || {}},
 				};
+
+				# Push whole resolved chain; last item is actual function
+				if ( $resolver_path{$tagname} ) {
+					while ( my $spath = shift @{ $resolver_path{$tagname} } ) {
+						push @{ $hash{symbols}{$c{fsubtype}}{$tagname} }, {
+							ctxpre => 0,
+							ctxpost => 0,
+							%$spath,
+						};
+					}
+				}
 			}
-			
 			last;
-
 		}
 	} # END FOR each line
 
@@ -616,9 +627,12 @@
 
 
 sub file_extractSub {
+	my $tagname = shift;
 	my $func = shift;
+	my $c = shift;
 	my $done = 0;
 	$func or die "file_extractSub with no args?\n";
+	my ( $start, $end );
 	my $content;
 
 	my @path = split /::/, $func;
@@ -633,31 +647,49 @@
 		my $line = $fc[$i];
 
 		if ( $line =~ /^\*$func = \\\&(\S+);/ ) {
-			#print "REPOINT TO $1\n";
-			my $repoint = ( file_extractSub( $1 ) );
+			push @{ $resolver_path{$tagname} }, {
+				name => $func,
+				file => "lib/$path",
+				lnum => $start,
+				ctxs => $i,
+				ctxe => $i,
+				ctx_p => 0,
+				ctx_n => 0,
+				ctx => [ format_ctx($line) ],
+			};
+			file_extractSub( $tagname, $1, $c );
 			return;
 
 		} elsif ( $line =~ /^sub $func {/ ) {
+			$start = $i+1 unless $start;
 			$content = $line;
 
 			# Quick and dirty extractor. This same functionality is in 
 			# file_parseVendConfig() above but is written too much purpose-specific
 			# to generalize it.
-			my $opens = 0;
-			for ( my $j = $i; $j < @fc; $j++) {
+			my $opens = 1; # Oh you dirty one..
+			for ( my $j = $i+1; $j < @fc; $j++) {
 				my $line2 = $fc[$j];
 				$opens += ( $line2 =~ s/(?<!(?<!\\)\\)([\(\[\{])/$1/g );
 				$opens -= ( $line2 =~ s/(?<!(?<!\\)\\)([\)\]\}])/$1/g );
 				$content .= $line2;
-				if ( !$opens) { $done++; last }
+				if ( !$opens) { $done++; $end = $j+1; last }
 			}
 
 			die "NOT FOUND FOR $func ?\n" unless $done;
 		}
 	}
 
-	return $content if wantarray;
-
-	$hash{functions}{$path}{$func} = [ split(/\n/, $content) ];
+	# func in lib/$path from $start to $end
+	push @{ $resolver_path{$tagname} }, {
+		name => $func,
+		file => "lib/$path",
+		lnum => $start,
+		ctxs => $start,
+		ctxe => $end,
+		ctx_p => 0,
+		ctx_n => 0,
+		ctx => [ format_ctx(split(/\n/, $content)) ],
+	};
 }
 








More information about the docs mailing list