OLD | NEW |
(Empty) | |
| 1 #! /bin/sh |
| 2 |
| 3 cd image |
| 4 |
| 5 # Space-optimized version: strip comments, drop precision to 3 |
| 6 # figures, eliminate duplicates. |
| 7 # update(creinig): precision reduction is now done in data2ps and comments |
| 8 # (except for % bound) now are also ommitted from the start |
| 9 |
| 10 echo 'image.ps: image-unop.ps' |
| 11 #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; }
" > $@' |
| 12 echo ' grep -v "^% bound" < $< > $@' |
| 13 # Need last comment (bounding box) |
| 14 echo ' tail -1 $< >> $@' |
| 15 echo ' ls -l image.ps image-unop.ps' |
| 16 |
| 17 echo 'image-unop.ps: outline.ps ring1.ps ring2.ps ring3.ps ring4.ps' |
| 18 echo ' cat ring[1234].ps > $@' |
| 19 # Bounding box is at bottom now. Next two won't change it. |
| 20 echo ' tail -1 $@ > bounding-box' |
| 21 echo ' cat outline.ps >> $@' |
| 22 echo ' cat ../tux.ps >> $@' |
| 23 echo ' cat bounding-box >> $@ && rm bounding-box' |
| 24 |
| 25 # Finished rings are precious! |
| 26 echo .SECONDARY: ring1.ps ring2.ps ring3.ps ring4.ps |
| 27 |
| 28 # Rings 1 and 4 are all thrown together. |
| 29 echo RING1_DEPS:=`find $RING1 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | un
iq` |
| 30 echo RING4_DEPS:=`find $RING4 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | un
iq` |
| 31 |
| 32 # Other rings are divided into dirs. |
| 33 echo RING2_DEPS:=`for d in $RING2; do echo $d-ring2.ps; done` |
| 34 echo RING3_DEPS:=`for d in $RING3; do echo $d-ring3.ps; done` |
| 35 echo |
| 36 |
| 37 # First ring starts at inner radius. |
| 38 echo 'ring1.ps: $(RING1_DEPS)' |
| 39 echo " @echo Making Ring 1" |
| 40 echo " @echo /angle 0 def > \$@" |
| 41 echo " @../draw_arrangement $FILE_SCRUNCH 0 360 $INNER_RADIUS \$(RING1_DEPS) >>
\$@" |
| 42 echo " @echo Done Ring 1" |
| 43 |
| 44 # Second ring starts at end of above ring (assume it's circular, so |
| 45 # grab any bound). |
| 46 echo 'ring2.ps: ring1.ps $(RING2_DEPS)' |
| 47 echo " @echo Making Ring 2" |
| 48 echo " @echo /angle 0 def > \$@" |
| 49 echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING2; do echo $f-ring2.p
s $f-ring2.angle; done` '>> $@' |
| 50 echo " @echo Done Ring 2" |
| 51 |
| 52 # Third ring starts at end of second ring. |
| 53 echo 'ring3.ps: ring2.ps $(RING3_DEPS)' |
| 54 echo " @echo Making Ring 3" |
| 55 echo " @echo /angle 0 def > \$@" |
| 56 echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING3; do echo $f-ring3.p
s $f-ring3.angle; done` '>> $@' |
| 57 echo " @echo Done Ring 3" |
| 58 |
| 59 # Outer ring starts at end of fourth ring. |
| 60 # And it's just a big ring of drivers. |
| 61 echo 'ring4.ps: $(RING4_DEPS) ring3.radius' |
| 62 echo " @echo Making Ring 4" |
| 63 echo " @echo /angle 0 def > \$@" |
| 64 echo " @../draw_arrangement $FILE_SCRUNCH 0 360 \`cat ring3.radius\` \$(RING4_D
EPS) >> \$@" |
| 65 echo " @echo Done Ring 4" |
| 66 echo |
| 67 |
| 68 # How to make directory picture: angle file contains start and end angle. |
| 69 # Second ring starts at end of above ring (assume it's circular, so |
| 70 # grab any bound). |
| 71 echo "%-ring2.ps: %-ring2.angle ring1.radius" |
| 72 echo " @echo Rendering \$@" |
| 73 echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring1.radius\` \`
find \$* -name '*-all.ps'\` > \$@" |
| 74 |
| 75 echo "%-ring3.ps: %-ring3.angle ring2.radius" |
| 76 echo " @echo Rendering \$@" |
| 77 echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring2.radius\` \`
find \$* -name '*-all.ps'\` > \$@" |
| 78 |
| 79 # How to extract radii |
| 80 echo "%.radius: %.ps" |
| 81 echo ' @echo scale=2\; `tail -1 $< | sed "s/^.* //"` + '$RING_SPACING' | bc > $
@' |
| 82 echo |
| 83 |
| 84 # How to make angle. Need total angle for that directory, and weight. |
| 85 echo "%-ring2.angle: %-ring2.weight ring2.weight" |
| 86 echo ' @echo "scale=2; ( 360 - ' `echo $RING2 | wc -w` ' * ' $DIR_SPACING ') *
`cat $<` / `cat ring2.weight`" | bc > $@' |
| 87 |
| 88 echo "%-ring3.angle: %-ring3.weight ring3.weight" |
| 89 echo ' @echo "scale=2; ( 360 - ' `echo $RING3 | wc -w` ' * ' $DIR_SPACING ') *
`cat $<` / `cat ring3.weight`" | bc > $@' |
| 90 |
| 91 # How to make ring weights (sum directory totals). |
| 92 echo "ring2.weight:" `for d in $RING2; do echo $d-ring2.weight; done` |
| 93 echo ' @cat $^ | ../tally > $@' |
| 94 echo "ring3.weight:" `for d in $RING3; do echo $d-ring3.weight; done` |
| 95 echo ' @cat $^ | ../tally > $@' |
| 96 |
| 97 # How to make a wieght. |
| 98 echo "%-ring2.weight:" `find $RING2 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sor
t | uniq` |
| 99 echo ' @../total_area.pl `find $* -name \*-all.ps` > $@' |
| 100 echo "%-ring3.weight:" `find $RING3 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sor
t | uniq` |
| 101 echo ' @../total_area.pl `find $* -name \*-all.ps` > $@' |
| 102 echo |
| 103 |
| 104 # Now rule to make the graphs of a function. |
| 105 #echo %.ps::% |
| 106 #echo ' @../function2ps `echo $< | sed '\''s/^.*\.\([^.]*\)\.\+.*$$/\1/'\''` > $
@ $<' |
| 107 ## Need the space. |
| 108 ##echo ' @rm -f $<' |
| 109 #echo |
| 110 |
| 111 # Rule to make all from constituent parts. |
| 112 echo %-all.ps: |
| 113 echo " @echo Rendering \$*.c" |
| 114 echo " @../conglomerate_functions.pl $FUNCTION_SCRUNCH $BOX_SCRUNCH \$^ > \$@" |
| 115 # Need the space. |
| 116 #echo ' @rm -f $^' |
| 117 echo |
| 118 |
| 119 # Generating outline, requires all the angles. |
| 120 echo outline.ps: ../make-outline.sh ring1.ps ring2.ps ring3.ps ring4.ps `for f i
n $RING2; do echo $f-ring2.angle; done` `for f in $RING3; do echo $f-ring3.angle
; done` |
| 121 echo " ../make-outline.sh $INNER_RADIUS $DIR_SPACING $RING_SPACING \"$RING1\" >
\$@" |
| 122 echo |
| 123 |
| 124 # Now all the rules to make each function. |
| 125 for d in `find . -type d`; do |
| 126 for f in `cd $d; ls *+.ps 2>/dev/null | sed 's/\.c\..*$//' | uniq`; do |
| 127 echo $d/$f-all.ps: `cd $d; ls $f.c.* | sed -e "s?^?$d/?"` |
| 128 done |
| 129 done |
OLD | NEW |