(cat <<\End %!PS-Adobe-3.0 %%BoundingBox: 24 24 588 768 %%Orientation: Landscape %%Pages: (atend) %%DocumentMedia: Letter 612 792 0 () () %%DocumentNeededResources: (atend) %%EndComments /titlecolor { .7 .95 .95 } def /definecolor { 0 1 .95 } def /examplecolor { .35 1 .7 } def /dotA { 0 .95 .95 sethsbcolor currentpoint 3 0 360 arc fill } def /dotB { .3 1 1 } def /rightmargin 648 def /leftmargin 72 def /indentamount 27 def /progboxwidth { rightmargin leftmargin sub lineskip sub } def /lecture 0 def /line {/lineno lineno 1 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto show } def /defineline {/lineno lineno 1 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto 0 0 rmoveto definecolor sethsbcolor show 0 setgray show } def /exampleline {/lineno lineno 1 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto 0 0 rmoveto examplecolor sethsbcolor show 0 setgray show } def /indentedline {/lineno lineno 1 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto dup 1 eq indentamount 6 ne and { gsave dup .4 add indentamount mul 4 rmoveto dotA grestore } if indentamount 6 eq { gsave 0 lineskip .65 mul neg rlineto progboxwidth 0 rlineto 0 lineskip 1.3 mul rlineto progboxwidth neg 0 rlineto .8 setgray fill grestore } if indentamount mul 0 rmoveto show } def /ttline {/lineno lineno 1 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto prog 0 0 rmoveto show endprog } def /centerline {/lineno lineno 1 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto dup stringwidth pop rightmargin leftmargin sub exch sub 2 div 0 rmoveto show } def /title {/boxy 12 def /boxx rightmargin leftmargin sub 2 div def /boxarc 12 def newpath /lineno lineno 3 add def lineno 1 sub lines exch sub lineskip mul leftmargin exch moveto gsave currentpoint translate 0 0 0 boxy neg boxx boxy neg boxarc arcto pop pop pop pop boxx dup add boxy neg boxx dup add 0 boxarc arcto pop pop pop pop boxx dup add boxy dup add boxx boxy dup add boxarc arcto pop pop pop pop 0 boxy boxy add 0 0 boxarc arcto pop pop pop pop closepath % gsave .99 setgray fill grestore 2 setlinewidth stroke % gsave 0 setgray 2 setlinewidth stroke grestore newpath gsave titlecolor sethsbcolor 3 setlinewidth stroke grestore newpath 0 setgray moveto dup stringwidth pop boxx dup add exch sub 2 div 0 rmoveto show grestore } def /redbox { /boxright exch def /boxleft exch def /boxcnt exch def /boxline exch def /boxy 10.5 boxcnt mul def /boxx boxright boxleft sub 2 div def /boxarc 18 def newpath boxline 3 add lines exch sub lineskip mul boxleft exch moveto gsave currentpoint translate 0 0 0 boxy neg boxx boxy neg boxarc arcto pop pop pop pop boxx dup add boxy neg boxx dup add 0 boxarc arcto pop pop pop pop boxx dup add boxy dup add boxx boxy dup add boxarc arcto pop pop pop pop 0 boxy boxy add 0 0 boxarc arcto pop pop pop pop closepath % gsave .99 setgray fill grestore 2 setlinewidth stroke % gsave 0 setgray 2 setlinewidth stroke grestore newpath gsave definecolor sethsbcolor 3 setlinewidth stroke grestore newpath grestore } def /newpage {/lineno 0 def /lineskip 610 lines 1 add div def 90 rotate 24 -588 translate newpath } def /fat findfont 18 scalefont setfont /prog { /Courier-Bold findfont 18 scalefont setfont /indentamount 6 def} def /endprog { /fat findfont 18 scalefont setfont /indentamount 27 def} def /footer { lecture 0 gt { gsave /fat findfont 10 scalefont setfont 670 10 moveto (.) lecture 2 string cvs show show show grestore } if } def /ps { lineno exch add /lineno exch def gsave leftmargin lines lineno sub lineskip mul translate} def /endps {grestore } def /hback{/lineno lineno .7 sub def} def /qback{/lineno lineno .3 sub def} def /linesreset{/lines 20 def} def linesreset /barmax 1000 def %! CS insignia /inch {72 mul} def /insignia {newpath 0 6 18{ /i exch def 32 -27 i add moveto 9 i add -27 i add lineto -27 i add 9 i add lineto -32 9 i add lineto -32 -27 i add moveto -9 i sub -27 i add lineto 27 i sub 9 i add lineto 32 9 i add lineto} for 0 -30 moveto 30 0 lineto 0 30 lineto -30 0 lineto 0 -30 lineto 32 -27 moveto 32 27 lineto -32 -27 moveto -32 27 lineto closepath} def newpage End count=1 if test "$2" then count=$2 fi nawk -v count=$count ' BEGIN {title=1; program=0} /^\// {print} /^-----/ {print "stroke (" count ") footer showpage newpage"; count=count+1; title=1} /^%include/ {print } /^%ps/ {print " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 " " } /^%%/ && !/^%%%/ {print $2 " ps"} /^%%%/ && !/^%%%%/{print "endps"} /^--/ && !/^---/ {print "prog"} /^---/ && !/^----/{print "endprog"} title!=0 && /^ / {print "(" $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 ") title"} /^Ex: / {print "(" $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 ") " "(" $1 " ) exampleline"} /^1 / {print "(" $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 ") " "(" $2 " ) defineline"} /^2 / {print "(" $4 " " $5 " " $6 " " $7 " " $8 " " $9 ") " "(" $2 " " $3 " ) defineline"} /^3 / {print "(" $5 " " $6 " " $7 " " $8 " " $9 ") " "(" $2 " " $3 " " $4 " ) defineline"} /^ / && !/^ / {print "(" $0 ") ttline"} /^ / && !/^ / {print "(" $0 ") centerline"} /^ / && !/^ / {print "(" $0 ") 1 indentedline"} /^ / && !/^ / {print "(" $0 ") 2 indentedline"} /^ / && !/^ / {print "(" $0 ") 3 indentedline"} /^ / && !/^ / {print "(" $0 ") 4 indentedline"} title==0 && /^ / {print "(" $0 ") 5 indentedline"} !/^-----/ {title=0} !/^\// && !/^[0-9]/ && !/^Ex:/ && !/^ / && !/^--/ && !/^%/ {print "(" $0 ") line"} END {print "stroke (" count ") footer showpage"} ' $1.sl cat <<\End %%Trailer %%DocumentNeededResources: font Courier-Bold fat %%EOF End ) | loom > $1.ps echo -n "Want to make a .pdf or look with gs? (p or g) " read ans if test $ans = "p" then cat /cmnusr/local/lib/ps/localfonts/fat.ps > ps/$1.ps cat $1.ps >> ps/$1.ps (cd pdf; cp ../ps/$1.ps .; distill $1.ps; rm $1.ps) fi if test $ans = "g" then cat /cmnusr/local/lib/ps/localfonts/fat.ps > ps/$1.ps cat $1.ps >> ps/$1.ps gv ps/$1.ps fi echo -n "Want to put a copy out on the home page? (y or n) " read ans if test $ans = "y" then cp pdf/$1.pdf /u/rs/public_html/cs226/lectures/$1.pdf cat /cmnusr/local/lib/ps/localfonts/fat.ps > ps/$1.4up.ps psmulti -geom 2x2 -btot -nodecor $1.ps >> ps/$1.4up.ps (cd pdf; cp ../ps/$1.4up.ps .; distill $1.4up.ps; rm $1.4up.ps) cp pdf/$1.4up.pdf /u/rs/public_html/cs226/lectures/$1.4up.pdf fi rm $1.ps