[docs] xmldocs - docelic modified 2 files

docs at icdevgroup.org docs at icdevgroup.org
Wed Sep 22 02:55:59 EDT 2004


User:      docelic
Date:      2004-09-22 06:55:58 GMT
Modified:  bin      refs-autogen stattree
Log:
bin/refs-autogen:
 - just warn about items with more than $max_ctxs (10) source contexts

bin/stattree:
 - now properly trims common number of /^spaces/ from source contexts
   (It worked before, but trimmed nothing if there was an empty line
   within the context)

Revision  Changes    Path
1.29      +16 -3     xmldocs/bin/refs-autogen


rev 1.29, prev_rev 1.28
Index: refs-autogen
===================================================================
RCS file: /var/cvs/xmldocs/bin/refs-autogen,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- refs-autogen	21 Sep 2004 16:08:01 -0000	1.28
+++ refs-autogen	22 Sep 2004 06:55:58 -0000	1.29
@@ -159,7 +159,11 @@
 				# Make sure we don't overdo it with source contexts.
 				# MV_PAGE appears on like 31 place. We definitely don't need to
 				# see more than 10.
-				if ( $ctxcount++ > $max_ctxs ) { last }
+				if ( $ctxcount++ > $max_ctxs ) {
+					print STDERR "$$ag{name} has ", scalar @$ar,
+						" contexts, limiting to $max_ctxs\n";
+					last;
+				}
 #					my $hidden = @$ar - $max_ctxs;
 #					$$ag{source} .= <<ENDD;
 #<para>
@@ -182,9 +186,18 @@
 					( my $plf = $$ctx{file} ) =~ s#.+?/##;
 					#my $loc = "$$ctx{file}:$$ctx{lnum}";
 					my $loc = $$ctx{file};
+					
+					my $cstart = $$ctx{lnum}-$$ctx{ctxpre};
+					# XXX - eliminate negative numbers in source context spans
+					# ( 0-6 == OK, -4-6 != OK )
+					#if ( $cstart < 0 ) {
+					#	print STDERR "CSTART IS $cstart FOR $$ag{name}\n";
+					#	$cstart = 0 ;
+					#}
+					my $cend = $$ctx{lnum}+$$ctx{ctxpost};
 					my $ctxmeta = "Line $$ctx{lnum} (context shows lines " .
-						( $$ctx{lnum}-$$ctx{ctxpre}) . "-" .
-						($$ctx{lnum}+$$ctx{ctxpost});
+						( $cstart . "-" .  $cend );
+					
 					$ctxmeta .= " in $$ctx{func}():$$ctx{funclnum}" if $$ctx{funclnum};
 					$ctxmeta .= ")";
 					my $r = $hash{revision}{$plf}->[0];



1.17      +10 -13    xmldocs/bin/stattree


rev 1.17, prev_rev 1.16
Index: stattree
===================================================================
RCS file: /var/cvs/xmldocs/bin/stattree,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- stattree	21 Sep 2004 16:04:26 -0000	1.16
+++ stattree	22 Sep 2004 06:55:58 -0000	1.17
@@ -382,24 +382,21 @@
 
 # Format the context lines before saving to the db
 sub format_ctx {
-	map { s/\t/  /g; chomp } @_;
+	for $_ ( @_ ) { s/\t/  /g; chomp };
 	# Find the number of starting whitespace common to all lines
-	# and trim it. XXX doesn't work
-	my $cs = 1000;
-	for my $ol ( @_ ) {
-		$ol =~ /^(\s*)/;
-		my $space_len = length $1;
-		$cs = $space_len if $space_len < $cs;
+	# and trim it.
+	my $common;
+	for $_ ( @_ ) {
+		if (/\S/ and /^( +)/) {
+			$common = length($1) if !defined $common || length($1) < $common
+		}
 		# Catch runaway lines (produces crapload of things, so refine
 		# search before starting to use it)
-		#if ( $ol =~ /\S\s{10,}/ ) {
-		#	warn "Runaway '$ol' ?\n";
+		#if ( $_ =~ /\S\s{10,}/ ) {
+		#	warn "Runaway '$_' ?\n";
 		#}
 	}
-	if ( $cs ) { # There is something to trim
-		#print "Trimming by $cs\n"; # XXX <- should be more of those ?!
-		map { s/^\s{$cs}// or warn "LTRIM: No $cs spaces?\n" } @_
-	}
+	if ( $common ) { s/^ {$common}// for @_ }
 	return @_;
 }
 








More information about the docs mailing list