Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,923 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
09-04-2003 Initial checkin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
------------------------------------------------- | ||
- README file for the LCOV galaxy mapping tool - | ||
- Last changes: 2003-09-04 - | ||
------------------------------------------------- | ||
|
||
Description | ||
----------- | ||
|
||
Further README contents | ||
----------------------- | ||
1. Included files | ||
2. Installing | ||
3. Notes and Comments | ||
|
||
|
||
|
||
1. Important files | ||
------------------ | ||
README - This README file | ||
CHANGES - List of changes between releases | ||
conglomerate_functions.pl - Replacement file - Generates shading | ||
genflat.pl - Generates info for shading from .info files | ||
gen_makefile.sh - Replacement file - updates to postscript | ||
posterize.pl - Replacement file - generates a final ps file | ||
|
||
2. Installing | ||
------------- | ||
This install requires fcgp, which means the target kernel src must be on | ||
the system creating the map. | ||
|
||
Download and copy the new files into the fcgp directory, (Note: its always | ||
a good idea to have backups). | ||
|
||
Run genflat.pl against your kernel info files | ||
./genflat.pl kernel.info kernel2.info > coverage.dat | ||
|
||
Run the make command for the fcgp (Note: this can take a while) | ||
make KERNEL_DIR=/usr/src/linux | ||
|
||
Update posterize.pl as needed, normally page size, margins, titles. | ||
Most of these settings will be broken out as command line options in the future. | ||
|
||
Run posterize.pl this will generate the file poster.ps. | ||
|
||
3. Notes and Comments | ||
--------------------- | ||
This is a quick and dirty implementation suited for my needs. It does not | ||
perform any of the tiling the original did. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
#! /usr/bin/perl -w | ||
|
||
# Takes a set of ps images (belonging to one file) and produces a | ||
# conglomerate picture of that file: static functions in the middle, | ||
# others around it. Each one gets a box about its area. | ||
|
||
use strict; | ||
|
||
my $SCRUNCH = $ARGV [0]; | ||
my $BOXSCRUNCH = $ARGV [1]; | ||
my $Tmp; | ||
my $DEBUG = 1; | ||
|
||
shift @ARGV; # skip SCRUNCH and BOXSCRUNCH | ||
shift @ARGV; | ||
|
||
|
||
DecorateFuncs (@ARGV); | ||
|
||
|
||
#TMPFILE=`mktemp ${TMPDIR:-/tmp}/$$.XXXXXX` | ||
|
||
# Arrange. | ||
my $ArgList = ""; | ||
|
||
foreach $Tmp (@ARGV) { | ||
$ArgList .= "'$Tmp' "; | ||
} | ||
|
||
my @Arranged = `../draw_arrangement $SCRUNCH 0 360 0 $ArgList`; | ||
|
||
my $CFile = $ARGV [0]; | ||
$CFile =~ s/\.c\..*$/.c/; | ||
if ($DEBUG) { print ("% Conglomeration of $CFile\n"); } | ||
|
||
print "gsave angle rotate\n"; | ||
|
||
# Now output the file, except last line. | ||
my $LastLine = pop (@Arranged); | ||
my $Fill = Box_2 ($LastLine,$CFile); | ||
print $Fill; | ||
# Draw box with file name | ||
my @Output = Box ('normal', 'Helvetica-Bold', 32, $CFile, $LastLine); | ||
splice(@Output, $#Output, 0, "grestore\n"); | ||
#print @Output; | ||
|
||
print (@Arranged); | ||
#add a duplicate box to test if this works | ||
print @Output; | ||
|
||
|
||
sub ParseBound | ||
{ | ||
my $BBoxLine = shift; | ||
|
||
$BBoxLine =~ /(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)/; | ||
|
||
# XMin, YMin, XMax, YMax | ||
return ($1 * $BOXSCRUNCH, $2 * $BOXSCRUNCH, | ||
$3 * $BOXSCRUNCH, $4 * $BOXSCRUNCH); | ||
} | ||
|
||
|
||
|
||
# Box (type, font, fontsize, Label, BBoxLine) | ||
sub Box | ||
{ | ||
my $Type = shift; | ||
my $Font = shift; | ||
my $Fontsize = shift; | ||
my $Label = shift; | ||
my $BBoxLine = shift; | ||
my @Output = (); | ||
|
||
# print (STDERR "Box ('$Type', '$Font', '$Fontsize', '$Label', '$BBoxLine')\n"); | ||
push (@Output, "% start of box\n"); | ||
|
||
push (@Output, "D5\n") if ($Type eq "dashed"); | ||
|
||
# print (STDERR "BBoxLine: '$BBoxLine'\n"); | ||
# print (STDERR "Parsed: '" . join ("' '", ParseBound ($BBoxLine)) . "\n"); | ||
my ($XMin, $YMin, $XMax, $YMax) = ParseBound ($BBoxLine); | ||
|
||
my $LeftSpaced = $XMin + 6; | ||
my $BottomSpaced = $YMin + 6; | ||
|
||
# Put black box around it | ||
push (@Output, ( | ||
"($Label) $LeftSpaced $BottomSpaced $Fontsize /$Font\n", | ||
"$YMin $XMin $YMax $XMax U\n" | ||
) | ||
); | ||
|
||
push (@Output, "D\n") if ($Type eq "dashed"); | ||
# fill bounding box | ||
push (@Output, "% end of box\n"); | ||
|
||
# Output bounding box | ||
push (@Output, "% bound $XMin $YMin $XMax $YMax\n"); | ||
|
||
return @Output; | ||
} | ||
|
||
sub Box_2 | ||
{ | ||
my $BBoxLine = shift; | ||
my $CFile = shift; | ||
my $CovFile = "./coverage.dat"; | ||
my ($XMin, $YMin, $XMax, $YMax) = ParseBound ($BBoxLine); | ||
my @output = `fgrep $CFile $CovFile`; | ||
chomp $output[0]; | ||
my ($junk, $Class, $per) = split /\t/, $output[0]; | ||
return "$XMin $YMin $XMax $YMax $Class\n"; | ||
} | ||
# Decorate (rgb-vals(1 string) filename) | ||
sub Decorate | ||
{ | ||
my $RGB = shift; | ||
my $Filename = shift; | ||
|
||
my @Input = ReadPS ($Filename); | ||
my $LastLine = pop (@Input); | ||
my @Output = (); | ||
|
||
# Color at the beginning. | ||
push (@Output, "C$RGB\n"); | ||
|
||
# Now output the file, except last line. | ||
push (@Output, @Input); | ||
|
||
# Draw dashed box with function name | ||
# FIXME Make bound cover the label as well! | ||
my $FuncName = $Filename; | ||
$FuncName =~ s/^[^.]+\.c\.(.+?)\..*$/$1/; | ||
|
||
push (@Output, Box ('dashed', 'Helvetica', 24, $FuncName, $LastLine)); | ||
|
||
# Slap over the top. | ||
WritePS ($Filename, @Output); | ||
} | ||
|
||
|
||
|
||
# Add colored boxes around functions | ||
sub DecorateFuncs | ||
{ | ||
my $FName = ""; | ||
my $FType = ""; | ||
|
||
foreach $FName (@ARGV) | ||
{ | ||
$FName =~ /\+([A-Z]+)\+/; | ||
$FType = $1; | ||
|
||
if ($FType eq 'STATIC') { | ||
Decorate ("2", $FName); # Light green. | ||
} | ||
elsif ($FType eq 'INDIRECT') { | ||
Decorate ("3", $FName); # Green. | ||
} | ||
elsif ($FType eq 'EXPORTED') { | ||
Decorate ("4", $FName); # Red. | ||
} | ||
elsif ($FType eq 'NORMAL') { | ||
Decorate ("5", $FName); # Blue. | ||
} | ||
else { | ||
die ("Unknown extension $FName"); | ||
} | ||
} | ||
} | ||
|
||
|
||
sub ReadPS | ||
{ | ||
my $Filename = shift; | ||
my @Contents = (); | ||
|
||
open (INFILE, "$Filename") or die ("Could not read $Filename: $!"); | ||
@Contents = <INFILE>; | ||
close (INFILE); | ||
|
||
return @Contents; | ||
} | ||
|
||
sub WritePS | ||
{ | ||
my $Filename = shift; | ||
|
||
open (OUTFILE, ">$Filename") | ||
or die ("Could not write $Filename: $!"); | ||
print (OUTFILE @_); | ||
close (OUTFILE); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#! /bin/sh | ||
|
||
cd image | ||
|
||
# Space-optimized version: strip comments, drop precision to 3 | ||
# figures, eliminate duplicates. | ||
# update(creinig): precision reduction is now done in data2ps and comments | ||
# (except for % bound) now are also ommitted from the start | ||
|
||
echo 'image.ps: image-unop.ps' | ||
#echo ' grep -v "^%" < $< | sed -e "s/\.\([0-9][0-9]\)[0-9]\+/.\1/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)[0-9][0-9]\.[0-9][0-9]/\1\200/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)[0-9]\.[0-9][0-9]/\1\20/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)\.[0-9][0-9]/\1\2/g" -e "s/\(^\| \|-\)\([0-9][0-9]\)\.\([0-9]\)[0-9]/\1\2.\30/g" | awk "\$$0 ~ /lineto/ { if ( LASTLINE == \$$0 ) next; } { LASTLINE=\$$0; print; }" > $@' | ||
echo ' grep -v "^% bound" < $< > $@' | ||
# Need last comment (bounding box) | ||
echo ' tail -1 $< >> $@' | ||
echo ' ls -l image.ps image-unop.ps' | ||
|
||
echo 'image-unop.ps: outline.ps ring1.ps ring2.ps ring3.ps ring4.ps' | ||
echo ' cat ring[1234].ps > $@' | ||
# Bounding box is at bottom now. Next two won't change it. | ||
echo ' tail -1 $@ > bounding-box' | ||
echo ' cat outline.ps >> $@' | ||
echo ' cat ../tux.ps >> $@' | ||
echo ' cat bounding-box >> $@ && rm bounding-box' | ||
|
||
# Finished rings are precious! | ||
echo .SECONDARY: ring1.ps ring2.ps ring3.ps ring4.ps | ||
|
||
# Rings 1 and 4 are all thrown together. | ||
echo RING1_DEPS:=`find $RING1 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq` | ||
echo RING4_DEPS:=`find $RING4 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq` | ||
|
||
# Other rings are divided into dirs. | ||
echo RING2_DEPS:=`for d in $RING2; do echo $d-ring2.ps; done` | ||
echo RING3_DEPS:=`for d in $RING3; do echo $d-ring3.ps; done` | ||
echo | ||
|
||
# First ring starts at inner radius. | ||
echo 'ring1.ps: $(RING1_DEPS)' | ||
echo " @echo Making Ring 1" | ||
echo " @echo /angle 0 def > \$@" | ||
echo " @../draw_arrangement $FILE_SCRUNCH 0 360 $INNER_RADIUS \$(RING1_DEPS) >> \$@" | ||
echo " @echo Done Ring 1" | ||
|
||
# Second ring starts at end of above ring (assume it's circular, so | ||
# grab any bound). | ||
echo 'ring2.ps: ring1.ps $(RING2_DEPS)' | ||
echo " @echo Making Ring 2" | ||
echo " @echo /angle 0 def > \$@" | ||
echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING2; do echo $f-ring2.ps $f-ring2.angle; done` '>> $@' | ||
echo " @echo Done Ring 2" | ||
|
||
# Third ring starts at end of second ring. | ||
echo 'ring3.ps: ring2.ps $(RING3_DEPS)' | ||
echo " @echo Making Ring 3" | ||
echo " @echo /angle 0 def > \$@" | ||
echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING3; do echo $f-ring3.ps $f-ring3.angle; done` '>> $@' | ||
echo " @echo Done Ring 3" | ||
|
||
# Outer ring starts at end of fourth ring. | ||
# And it's just a big ring of drivers. | ||
echo 'ring4.ps: $(RING4_DEPS) ring3.radius' | ||
echo " @echo Making Ring 4" | ||
echo " @echo /angle 0 def > \$@" | ||
echo " @../draw_arrangement $FILE_SCRUNCH 0 360 \`cat ring3.radius\` \$(RING4_DEPS) >> \$@" | ||
echo " @echo Done Ring 4" | ||
echo | ||
|
||
# How to make directory picture: angle file contains start and end angle. | ||
# Second ring starts at end of above ring (assume it's circular, so | ||
# grab any bound). | ||
echo "%-ring2.ps: %-ring2.angle ring1.radius" | ||
echo " @echo Rendering \$@" | ||
echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring1.radius\` \`find \$* -name '*-all.ps'\` > \$@" | ||
|
||
echo "%-ring3.ps: %-ring3.angle ring2.radius" | ||
echo " @echo Rendering \$@" | ||
echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring2.radius\` \`find \$* -name '*-all.ps'\` > \$@" | ||
|
||
# How to extract radii | ||
echo "%.radius: %.ps" | ||
echo ' @echo scale=2\; `tail -1 $< | sed "s/^.* //"` + '$RING_SPACING' | bc > $@' | ||
echo | ||
|
||
# How to make angle. Need total angle for that directory, and weight. | ||
echo "%-ring2.angle: %-ring2.weight ring2.weight" | ||
echo ' @echo "scale=2; ( 360 - ' `echo $RING2 | wc -w` ' * ' $DIR_SPACING ') * `cat $<` / `cat ring2.weight`" | bc > $@' | ||
|
||
echo "%-ring3.angle: %-ring3.weight ring3.weight" | ||
echo ' @echo "scale=2; ( 360 - ' `echo $RING3 | wc -w` ' * ' $DIR_SPACING ') * `cat $<` / `cat ring3.weight`" | bc > $@' | ||
|
||
# How to make ring weights (sum directory totals). | ||
echo "ring2.weight:" `for d in $RING2; do echo $d-ring2.weight; done` | ||
echo ' @cat $^ | ../tally > $@' | ||
echo "ring3.weight:" `for d in $RING3; do echo $d-ring3.weight; done` | ||
echo ' @cat $^ | ../tally > $@' | ||
|
||
# How to make a wieght. | ||
echo "%-ring2.weight:" `find $RING2 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq` | ||
echo ' @../total_area.pl `find $* -name \*-all.ps` > $@' | ||
echo "%-ring3.weight:" `find $RING3 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq` | ||
echo ' @../total_area.pl `find $* -name \*-all.ps` > $@' | ||
echo | ||
|
||
# Now rule to make the graphs of a function. | ||
#echo %.ps::% | ||
#echo ' @../function2ps `echo $< | sed '\''s/^.*\.\([^.]*\)\.\+.*$$/\1/'\''` > $@ $<' | ||
## Need the space. | ||
##echo ' @rm -f $<' | ||
#echo | ||
|
||
# Rule to make all from constituent parts. | ||
echo %-all.ps: | ||
echo " @echo Rendering \$*.c" | ||
echo " @../conglomerate_functions.pl $FUNCTION_SCRUNCH $BOX_SCRUNCH \$^ > \$@" | ||
# Need the space. | ||
#echo ' @rm -f $^' | ||
echo | ||
|
||
# Generating outline, requires all the angles. | ||
echo outline.ps: ../make-outline.sh ring1.ps ring2.ps ring3.ps ring4.ps `for f in $RING2; do echo $f-ring2.angle; done` `for f in $RING3; do echo $f-ring3.angle; done` | ||
echo " ../make-outline.sh $INNER_RADIUS $DIR_SPACING $RING_SPACING \"$RING1\" > \$@" | ||
echo | ||
|
||
# Now all the rules to make each function. | ||
for d in `find . -type d`; do | ||
for f in `cd $d; ls *+.ps 2>/dev/null | sed 's/\.c\..*$//' | uniq`; do | ||
echo $d/$f-all.ps: `cd $d; ls $f.c.* | sed -e "s?^?$d/?"` | ||
done | ||
done |
Oops, something went wrong.