From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  1-SEP-1989 20:24
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Apple LaserWriter Symbiont (10 of 12)

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri,  1 SEP 89 12:47:27 PDT
Received: from ecsgate.uncecs.edu by KL.SRI.COM with TCP; Fri, 1 Sep 89 12:24:02 PDT
Received: by ecsgate.uncecs.edu (5.59/UNCECS/8-30-88)
	id AA25178; Fri, 1 Sep 89 15:24:05 EDT
Message-Id: <8909011924.AA25178@ecsgate.uncecs.edu>
Date: Fri, 1 Sep 89 14:42 EDT
From: "Bill Bailey, 'The VAXman'" <BAILEYB@ATSUVAX1.BITNET>
Subject: Apple LaserWriter Symbiont (10 of 12)
To: INFO-VAX@KL.SRI.COM
X-Vms-To: INFOVAX

-+-+-+-+-+-+-+-+ START OF PART 10 -+-+-+-+-+-+-+-+
X`009iy ix atan rotate`009`009% rotate co-ordinates
X`009cw -6 mul 22 div ch -6 mul 22 div rmoveto % backup 1/2 char size
X`009cstr show`009`009`009% do string rel to new co-ord (dy=0)
X`009emit
X`009iy ix atan neg rotate`009`009% rotate back
X`009moveto`009`009`009`009% restore current point
X`009/pen false def`009`009`009% pick up pen
X`125 def
X
X
X% <length> <number of chars> dofont  -- set up font
X
X/dofont
X`123
X`009/nc exch def`009`009`009% define number of chars in string
X`009/zc exch def`009`009`009% define length of string`032
X`009zFont `123/ZetaFont findfont`125`009% get font
X`009      `123/Helvetica findfont`125 ifelse
X`009/cw zc nc div def`009`009% get character width
X`009cw 256. mul aspect div /ch exch def % get character height
X`009`091cw 0 0 ch 0 0`093 makefont`009% scale font
X`009setfont`009`009`009`009% set font
X`125 def
X
X
X%  process numeric vector
X
X/nVector
X`123
X`009getz`009`009`009`009% get vector control
X`009getxy`009`009`009`009% decode vector
X`0091 crb`009`009`009`009% get length
X`009dup string /cstr exch def`009% build string
X`009/cind 0 def`009`009`009% preset index
X`009`123
X`009`009zFont `1231 crb ztf exch get`125`009% convert to zeta font code
X`009`009      `1231 crb ztn exch get`125 ifelse % get ascii char code
X`009`009cstr cind 3 -1 roll put`009% put into string
X`009`009cind 1 add /cind exch def % advance index
X`009`125 repeat`009`009`009% length times
X
X`009/sn cstr length def`009`009% get string char count
X`009ix dup mul iy dup mul add sqrt /iz exch def % calc iz
X`009iz sn dofont`009`009`009% scale font
X`009cstr stringwidth `009`009% get string lengths
X`009/sy exch def /sx exch def
X`009iy ix atan rotate`009`009% rotate co-ordinates
X`009iz sx sub sn div 0 cstr ashow`009% do string rel to new co-ord (dy=0)
X`009emit
X`009iy ix atan neg rotate`009`009% rotate back
X`009/pen false def`009`009`009% pick up pen
X`125 def
X
X
X% doCircle
X
X/doCircle
X`123
X`009getz`009`009`009`009% get circle/arc control
X`009`123
X`009`009zb (0) eq zb (I) eq or `123% if arc
X`009`009`009zb (0) eq`009% save arc direction
X`009`009`009getz`009`009% get vector control
X`009`009`009getxy`009`009% get vector 1
X`009`009`009/x1 ix def
X`009`009`009/y1 iy def
X`009`009`009getz`009`009% get vector 2
X`009`009`009getxy
X`009`009`009/x2 ix def
X`009`009`009/y2 iy def
X`009`009`009currentpoint /y exch def /x exch def`009%get cur pt
X%`009`009`009x1 y1 rmoveto`009% start arc at end of 1st vector
X`009`009`009x1 dup mul `009% r = sqrt((x1-x)**2+(y1-y)**2)
X`009`009`009y1 dup mul
X`009`009`009add sqrt /r exch def
X`009`009`009y1 x1 atan /theta1 exch def %get angles
X`009`009`009y2 x2 atan /theta2 exch def
X`009`009`009x x1 sub y y1 sub r theta1 theta2`032
X`009`009 `0096 -1 roll `123 arc `125 `123 arcn `125 ifelse % use saved arc s
Vtate
X`009`009`009x x1 sub x2 add y y1 sub y2 add moveto`009% return to base
X`009`009`009exit
X`009`009`125 if
X
X`009`009% else we have a circle
X`009`009getxy`009`009`009% get vector
X`009`009currentpoint /y exch def /x exch def % get cur pt
X`009`009ix iy rmoveto`009`009% start circle at end of vector
X`009`009ix dup mul`009`009% r = sqrt(ix**2+iy**2)
X`009`009iy dup mul
X`009`009add sqrt /r exch def
X`009`009x y r 0. 360. arc`009% draw circle
X`009`009x y moveto`009`009% return to base
X`009`009exit
X`009`125 loop
X`125 def
X
X
X% <length> crb <integer number>   -  get crb number
X
X/crb
X`123
X`009/sum 0 def
X
X% repeat <length> sum = (sum shift 5) + zn
X`009dup `123 sum 5 bitshift getzv add /sum exch def`125 repeat
X
X% check for negative - if so then or in -1's mask
X`0095 mul 1 sub -1 exch bitshift dup sum and 0 ne `123sum or /sum exch def`1
V25
X`009`009`009`123pop`125 ifelse
X`009sum`009`009`009`009% return sum
X`125 def
X
X
X% getzv <integer>  -  convert NEXT zb to zeta binary number
X
X/getzv
X`123
X`009getz
X`009zn 16#41 lt `123zn 16#30 sub`125 `123zn 16#41 sub 8 add`125 ifelse
X`125 def
X
X
X%  getxy  -  ix,iy set to crb value
X
X/getxy
X`123
X`009zn 16#41 sub 1 add dup /ny exch def`009%ny = zn-'A'+1
X`0095 div cvi dup /nx exch def`009`009%nx = ny / 5
X`0095 mul ny exch sub cvi /ny exch def`009%ny = ny - 5*nx
X
X%  get x and y displacement
X`009nx crb /ix exch def`009`009`009%ix = crb(nx)
X`009ny crb /iy exch def`009`009`009%iy = crb(ny)
X`125 def
X
X
X% emit - draw the current path
X
X/emit
X`123
X`009currentpoint`009`009`009`009% save where we are
X`009stroke`009`009`009`009`009% draw current path
X`009moveto`009`009`009`009`009% position to where we are
X`125 def
X
X
X% <num> debugi  -  write debug integer
X
X/debugi
X`123
X`00916 10 string cvrs dbg exch writestring dbg (\n) writestring flush
X`125 def
X
X
X%  <string> debugs  -  write debug string
X
X/debugs
X`123
X`009dbg exch writestring dbg ( ) writestring flush
X`125 def
X
X
X%  executable initialization
X
X(%stdin) (r) file /inp exch def`009`009`009% define input file
X(%stdout) (w) file /dbg exch def`009`009% define debug file
X/zb 1 string def`009`009`009`009% zeta byte string
X
X/pencolor `0910. .35 .50 .70 0. .35 .50 .7`093 def`009% pen color shading
X
X16#3f 16#3f 16#3f 16#2b 16#3f 16#3f 16#3f 16#3f
X16#5a 16#3f 16#3f 16#2a 16#3f 16#3f 16#3f 16#3f
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#20 16#41 16#42 16#43 16#44 16#45 16#46 16#47
X16#48 16#49 16#3f 16#2e 16#3c 16#28 16#2b 16#7c
X16#26 16#4a 16#4b 16#4c 16#4d 16#4e 16#4f 16#50
X16#51 16#52 16#21 16#24 16#2a 16#29 16#3b 16#3f
X16#2d 16#2f 16#53 16#54 16#55 16#56 16#57 16#58
X16#59 16#5a 16#3f 16#2c 16#25 16#5f 16#3e 16#3f
X16#30 16#31 16#32 16#33 16#34 16#35 16#36 16#37
X16#38 16#39 16#3a 16#23 16#40 16#27 16#3d 16#22
X16#61 16#62 16#63 16#64 16#65 16#66 16#67 16#68
X16#69 16#6a 16#6b 16#6c 16#1d 16#6e 16#6f 16#70
X17#71 16#72 16#73 16#74 16#75 16#76 16#77 16#78
X16#79 16#7a 16#3f 16#3f 16#1f 16#3f 16#3f 16#3f
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f`032
X16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 16#3f 256 array astore /zta exch d
Vef
X
X16#30 16#31 16#32 16#33 16#34 16#35 16#36 16#37
X16#38 16#39 16#2d 16#2e 12 array astore /ztn exch def
X
X/ztf `09144 45 46 47 48 49 50 51 52 53 55 64`093 def % zeta numeric vector t
Vo font
X
X`091 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
X16 17 73 114 120 17 113 84 110 16 109 87 117 125 118 119 127`032
X126 91 92 93 94 95 96 97 98 99 100 101 102 16 16 88`032
X83 115 116 89 66 67 79 103 85 105 106 121 82 122 123 62`032
X18 19 20 21 22 23 24 25 26 108 64 75 58 54 86 72`032
X27 28 29 30 31 32 33 34 35 71 60 56 59 80 111 55`032
X57 36 37 38 39 40 41 42 43 107 63 74 16 76 78 44`032
X45 46 47 48 49 50 51 52 53 68 70 77 69 61 65 128`032
X129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144`032
X145 146 147 148 149 150 151 152 153 154 90 104 155 156 157 158`032
X159 81 124 160 161 162 163 164 165 166 167 112 168 169 170 171`032
X172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187`032
X188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203`032
X204 205 206 207 208 209 210 211 212 213 `093 /sym exch def
X
X/ZetaFontDict 8 dict def
X/$workingdict 100 dict def
XZetaFontDict begin
X`009/FontType 3 def
X`009/FontMatrix `091.04545 0 0 .04545 0 0`093 def
X`009/FontBBox `0910 0 22 22`093 def
X`009/Encoding 256 array def
X`0093 string 0 1 255 `123dup 10 3 index cvrs cvn Encoding 3 1 roll put`125 f
Vor
X`009 pop
X
X`009/CharArrays 214 dict dup begin
X/0 `091 16#10606 16#2060C 16#20C0C 16#20C00 16#20000 16#2000C 16#2060C`032
X     16#20606 `093 def
X/1 `091 16#10606 16#2060C 16#2030C 16#20009 16#20003 16#20300 16#20900`032
X     16#20C03 16#20C09 16#2090C 16#2060C 16#20606 `093 def
X/2 `091 16#1060C 16#20002 16#20C02 16#2060C 16#20606 `093 def
X/3 `091 16#10006 16#20606 16#2060C 16#20606 16#20C06 16#20606 16#20600`032
X     16#20606 `093 def
X/4 `091 16#1000C 16#20C00 16#20606 16#20C0C 16#20000 16#20606 `093 def
X/5 `091 16#10606 16#2060C 16#20006 16#20600 16#20C06 16#2060C 16#20606 `093
V def
X/6 `091 16#10600 16#2060C 16#20006 16#20C06 16#2060C 16#20606 16#20606 `093
V def
X/7 `091 16#10C00 16#2000C 16#20C0C 16#20000 16#20606 `093 def
X/8 `091 16#1000C 16#20C0C 16#20000 16#20C00 16#10906 16#20306 16#20606 `093
V def
X/9 `091 16#10600 16#20606 16#2000C 16#20606 16#20C0C 16#20606 `093 def
X/10 `091 16#10909 16#20903 16#20C00 16#20903 16#20303 16#20000 16#20303`032
X      16#20309 16#2000C 16#20309 16#20909 16#20C0C 16#20606 `093 def
X/11 `091 16#10006 16#20C06 16#20606 16#2060C 16#20600 16#20606 16#2000C`032
X      16#20C00 16#20606 16#20C0C 16#20000 16#20606 `093 def
X/12 `091 16#10606 16#2000C 16#20C0C 16#20000 16#20C00 16#20606 `093 def
X/13 `091 16#10600 16#2060C 16#20606 `093 def
X/14 `091 16#1060C 16#20003 16#20C03 16#2060C 16#20609 16#20009 16#20600`032
X      16#20C09 16#20609 16#20606 `093 def
X/15 `091 16#1070A 16#20F0A 16#11500 `093 def
X/16 `091 16#10400 16#20408 16#11500 `093 def
X/17 `091 16#11500 `093 def
X/18 `091 16#10000 16#20010 16#20415 16#20B15 16#20F10 16#20F00 16#10008`032
X      16#20F08 16#11500 `093 def
X/19 `091 16#10000 16#20015 16#20B15 16#20F12 16#20F0E 16#20B0B 16#2000B`032
X      16#10B0B 16#20F08 16#20F03 16#20B00 16#20000 16#11500 `093 def
X/20 `091 16#10F03 16#20B00 16#20400 16#20003 16#20012 16#20415 16#20B15`032
X      16#20F12 16#11500 `093 def
X/21 `091 16#20015 16#20C15 16#20F12 16#20F03 16#20C00 16#20000 16#11500 `093
V def
X/22 `091 16#10F15 16#20015 16#2000B 16#20A0B 16#2000B 16#20000 16#20F00`032
X      16#11500 `093 def
X/23 `091 16#10F15 16#20015 16#2000B 16#20B0B 16#2000B 16#20000 16#11500 `093
V def
X/24 `091 16#10F0F 16#20F12 16#20C15 16#20315 16#20012 16#20003 16#20300`032
X      16#20C00 16#20F03 16#20F09 16#20C09 16#21109 16#11500 `093 def
X/25 `091 16#20015 16#2000B 16#20F0B 16#20F15 16#20F00 16#11500 `093 def
X/26 `091 16#10400 16#20700 16#20715 16#20415 16#20A15 16#20715 16#20700`032
X      16#20A00 16#11500 `093 def
X/27 `091 16#10006 16#20003 16#20300 16#20C00 16#20F03 16#20F15 16#11500 `093
V def
X/28 `091 16#20015 16#20008 16#20F15 16#2070E 16#20F00 16#11500 `093 def
X/29 `091 16#10015 16#20000 16#20F00 16#11500 `093 def
X/30 `091 16#20015 16#2070B 16#20E15 16#20E00 16#11500 `093 def
X/31 `091 16#20015 16#20F00 16#20F15 16#11500 `093 def
X/32 `091 16#10300 16#20003 16#20012 16#20315 16#20C15 16#20F12 16#20C0F`032
X      16#20F12 16#20F03 16#20C00 16#20300 16#11500 `093 def
X/33 `091 16#20015 16#20C15 16#20F12 16#20F0E 16#20C0B 16#2000B 16#11500 `093
V def
X/34 `091 16#10808 16#20E02 16#20C00 16#20300 16#20003 16#20012 16#20315`032
X      16#20C15 16#20F12 16#20F03 16#20E02 16#20F00 16#11500 `093 def
X/35 `091 16#20015 16#20C15 16#20F12 16#20F0E 16#20C0B 16#2000B 16#2080B`032
X      16#20F00 16#11500 `093 def
X/36 `091 16#10006 16#20003 16#20300 16#20C00 16#20F03 16#20F08 16#20C0B`032
X      16#2030B 16#2000E 16#20012 16#20315 16#20C15 16#20F12 16#11500 `093 de
Vf
X/37 `091 16#10700 16#20715 16#20015 16#20E15 16#11500 `093 def
X/38 `091 16#10015 16#20003 16#20300 16#20C00 16#20F03 16#20F15 16#11500 `093
V def
X/39 `091 16#10015 16#20700 16#20E15 16#11500 `093 def
X/40 `091 16#10015 16#20000 16#2070A 16#20E00 16#20E15 16#11500 `093 def
X/41 `091 16#20F15 16#10015 16#20F00 16#11500 `093 def
X/42 `091 16#10700 16#2070B 16#20015 16#2070B 16#20E15 16#2070B 16#11500 `093
V def
X/43 `091 16#10015 16#20F15 16#2070A 16#2040A 16#20A0A 16#2070A 16#20000`032
X      16#20F00 16#11500 `093 def
X/44 `091 16#10F03 16#20B00 16#20400 16#20003 16#20012 16#20415 16#20B15`032
X      16#20F12 16#20F03 16#11500 `093 def
X/45 `091 16#10800 16#20815 16#20512 16#10500 16#20B00 16#20800 16#11500 `093
V def
X/46 `091 16#10F00 16#20000 16#20003 16#20F10 16#20F12 16#20C15 16#20315`032
X      16#20012 16#20010 16#11500 `093 def
X/47 `091 16#10012 16#20315 16#20C15 16#20F12 16#20F0E 16#20C0B 16#2030B`032
X      16#20C0B 16#20F08 16#20F03 16#20C00 16#20300 16#20003 16#11500 `093 de
Vf
X/48 `091 16#10C00 16#20C15 16#20006 16#20F06 16#11500 `093 def
X/49 `091 16#10005 16#20003 16#20300 16#20C00 16#20F03 16#20F08 16#20C0B`032
X      16#2000B 16#20015 16#20F15 16#11500 `093 def
X/50 `091 16#10008 16#2030B 16#20C0B 16#20F08 16#20F03 16#20C00 16#20300`032
X      16#20003 16#20012 16#20315 16#20C15 16#20F12 16#11500 `093 def
X/51 `091 16#10012 16#20015 16#20F15 16#20F12 16#20700 16#11500 `093 def
X/52 `091 16#10C00 16#20300 16#20003 16#20008 16#2030B 16#20C0B 16#20F0E`032
X      16#20F12 16#20C15 16#20315 16#20012 16#2000E 16#2030B 16#20C0B`032
X      16#20F08 16#20F03 16#20C00 16#11500 `093 def
X/53 `091 16#10003 16#20300 16#20C00 16#20F03 16#20F12 16#20C15 16#20315`032
X      16#20012 16#2000D 16#2030A 16#20C0A 16#20F0D 16#11500 `093 def
X/54 `091 16#10700 16#2070E 16#20707 16#20007 16#20E07 16#11500 `093 def
X/55 `091 16#10007 16#20E07 16#11500 `093 def
X/56 `091 16#20E0E 16#20707 16#2070E 16#20700 16#20707 16#2000E 16#20E00`032
X      16#20707 16#20007 16#20E07 16#11500 `093 def
X/57 `091 16#20F15 16#11500 `093 def
X/58 `091 16#10800 16#20504 16#20511 16#20815 16#11500 `093 def
X/59 `091 16#10700 16#20A04 16#20A11 16#20715 16#11500 `093 def
X/60 `091 16#10005 16#20302 16#20C02 16#20F05 16#20F09 16#20C0C 16#2030C`032
X      16#2000F 16#20313 16#20C13 16#20F0F 16#10815 16#20800 16#11500 `093 de
Vf
X/61 `091 16#10003 16#20F03 16#10F0A 16#2000A 16#11500 `093 def
X/62 `091 16#11500 `093 def
X/63 `091 16#10700 16#20903 16#20905 16#20705 16#20703 16#20903 16#11500 `093
V def
X/64 `091 16#10700 16#20702 16#20902 16#20900 16#20700 16#11500 `093 def
X/65 `091 16#10310 16#20015 16#20315 16#20310 16#10910 16#20615 16#20915`032
X      16#20910 16#11500 `093 def
X/66 `091 16#10B00 16#20400 16#20415 16#20B15 16#11500 `093 def
X/67 `091 16#10400 16#20B00 16#20B15 16#20415 16#11500 `093 def
X/68 `091 16#10703 16#20705 16#20905 16#20903 16#20703 16#1070A 16#2070C`032
+-+-+-+-+-+-+-+-  END  OF PART 10 +-+-+-+-+-+-+-+-

