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

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri,  1 SEP 89 11:18:15 PDT
Received: from ecsgate.uncecs.edu by KL.SRI.COM with TCP; Fri, 1 Sep 89 10:49:19 PDT
Received: by ecsgate.uncecs.edu (5.59/UNCECS/8-30-88)
	id AA24544; Fri, 1 Sep 89 13:49:26 EDT
Message-Id: <8909011749.AA24544@ecsgate.uncecs.edu>
Date: Fri, 1 Sep 89 13:43 EDT
From: "Bill Bailey, 'The VAXman'" <BAILEYB@ATSUVAX1.BITNET>
Subject: Apple LaserWriter Symbiont (9 of 12)
To: INFO-VAX@KL.SRI.COM
X-Vms-To: INFOVAX

-+-+-+-+-+-+-+-+ START OF PART 9 -+-+-+-+-+-+-+-+
X#define`009SMBMSG$V_ALIGNMENT_MASK`0090
X#define`009SMBMSG$V_PAUSE_COMPLETE`0091
X#define`009SMBMSG$V_RESTARTING`0092
X#define`009SMBMSG$V_TOP_OF_FILE`0093
X#define`009SMBMSG$M_FILE_BURST`0091
X#define`009SMBMSG$M_FILE_FLAG`0092
X#define`009SMBMSG$M_FILE_TRAILER`0094
X#define`009SMBMSG$M_FILE_TRAILER_ABORT`0098
X#define`009SMBMSG$M_JOB_FLAG`00916
X#define`009SMBMSG$M_JOB_BURST`00932
X#define`009SMBMSG$M_JOB_RESET`00964
X#define`009SMBMSG$M_JOB_RESET_ABORT`009128
X#define`009SMBMSG$M_JOB_TRAILER`009256
X#define`009SMBMSG$M_JOB_TRAILER_ABORT`009512
X#define`009SMBMSG$M_FIRST_FILE_OF_JOB`0091024
X#define`009SMBMSG$M_LAST_FILE_OF_JOB`0092048
X#define`009SMBMSG$S_SEPARATION_CONTROL`0094
X#define`009SMBMSG$L_SEPARATION_FLAGS`0090
X#define`009SMBMSG$V_FILE_BURST`0090
X#define`009SMBMSG$V_FILE_FLAG`0091
X#define`009SMBMSG$V_FILE_TRAILER`0092
X#define`009SMBMSG$V_FILE_TRAILER_ABORT`0093
X#define`009SMBMSG$V_JOB_FLAG`0094
X#define`009SMBMSG$V_JOB_BURST`0095
X#define`009SMBMSG$V_JOB_RESET`0096
X#define`009SMBMSG$V_JOB_RESET_ABORT`0097
X#define`009SMBMSG$V_JOB_TRAILER`0098
X#define`009SMBMSG$V_JOB_TRAILER_ABORT`0099
X#define`009SMBMSG$V_FIRST_FILE_OF_JOB`00910
X#define`009SMBMSG$V_LAST_FILE_OF_JOB`00911
$ CALL UNPACK [.LASER_DIST]SMBDEF.H;1 139502730
$ create/nolog 'f'
X$!Last Modified:  27-JUN-1988 10:36:26.63 by WILTS`032
X$!
X$!`009LASER configuration and startup file.  Change T??? to whatever
X$!`009port you connect your LaserWriter to.
X$!
X$`009set term /perm /speed=9600 /nomodem /notype /nohang TXD2:
X$`009set term /perm /hostsync /pasthru /ttsync /eightbit /nobroad TXD2:
X$`009set term /perm /noauto /dma TXD2:
X$`009set prot=o:rwlp /dev TXD2:
X$`009set device /spooled=(sys$sysdevice:) TXD2:
X$!
X$`009define /form POST 2 /stock=default
X$`009define /form ZETA 3 /stock=default /setup=zeta
X$`009define /form LETTER 4 /stock=default /setup=headers_str
X$`009define /form LANDSCAPE 6 /stock=default /setup=headers_str
X$`009define /form HEADERS 7 /stock=default /setup=headers_str
X$`009define /form BITIMAGE 9 /stock=default /setup=bitimage_hex
X$`009define /form PAINT 10 /stock=default /setup=paint_hex
X$`009define /form 2UP 11 /stock=default /setup=headers_str
X$!
X$`009define/system LASER$LOG sys$sysdevice:`091laser`093
X$!
X$`009delete /before="today-1-00:00:00" LASER$LOG:*.*.*
X$!
X$!   Note that /default=form=headers is VMS v4.4 and later only.
X$!
X$`009initialize/queue/start -
X`009/default=(noburst,nofeed,noflag,notrailer,form=headers) -
X`009/separate=(noburst,noflag,trailer) -`032
X`009/library=laser /base_prio=8 /form=headers -
X`009/processor=laser /on=TXD2: laser
$ CALL UNPACK [.LASER_DIST]SYST.COM;2 640894321
$ create/nolog 'f'
X%!PS-Adobe-1.0
X`004
X/inch `12372 mul`125 def
X
X/setuppage `123
X`009initgraphics
X`0090 11 inch  translate -90 rotate
X    `009/x 1 inch def
X    `009/y 7 inch def
X`009.5 inch .5 inch moveto  10 inch 0 rlineto 0 7.5 inch rlineto
X`009 -10 inch 0 rlineto closepath stroke
X`125 def`009
X
X/h-user `123
X`009/Helvetica findfont .4 inch scalefont setfont
X`009x y moveto
X`009(User: ) show show
X`009/y y .75 inch sub def
X`125 def
X
X/h-job `123
X`009/Helvetica findfont .4 inch scalefont setfont
X`009x y moveto
X
X`009statusdict /printername known `123`009`009% if we know about printer nam
Ves
X`009`00950 string statusdict /printername get exec /p-printername exch def
X
X`009`009statusdict /product known `123`009`009% if we know our product
X`009`009`009statusdict /product get exec /p-product exch def
X`009`009`009p-product show
X`009`009`009p-printername p-product ne `123`009`009% if not same name as by
V default
X`009`009`009`009(: ) show
X`009`009`009`009p-printername show
X`009`009`009`125 if
X`009`009`125 `123
X`009`009`009p-printername show
X`009`009`125 ifelse
X`009`125 `123
X`009`009(LASER) show
X`009`125 ifelse
X
X`009/y y .75 inch sub def
X`009x y moveto
X`009(Job:   ) show show
X`009/y y .75 inch sub def
X`125 def
X
X/h-file `123
X`009/Helvetica findfont .4 inch scalefont setfont
X`009x y moveto
X       (File:   ) show
X       dup stringwidth pop 8 inch exch div % get space/length
X       dup 1 lt `123 .4 inch mul % if less space than length
X`009`009/Helvetica findfont exch scalefont setfont `125 % resize the font
X`009`009`123 pop `125 ifelse % else leave font alone
X`009       show
X`009/y y .75 inch sub def
X`125 def
X
X/h-time `123
X`009/Helvetica findfont .4 inch scalefont setfont
X`009x y moveto
X`009(Date: ) show show
X`009/y y .75 inch sub def
X`125 def
X
X/h-error `123
X`009/Helvetica findfont .4 inch scalefont setfont
X`009x y moveto
X`009(Error: ) show
X`009dup stringwidth pop 8 inch exch div % get space/length
X`009dup 1 lt `123 .4 inch mul % if less space than length
X`009`009/Helvetica findfont exch scalefont setfont `125 % resize the font
X`009`009`123 pop `125 ifelse % else leave font alone
X`009       show
X`009/y y .75 inch sub def
X`125 def
X
X/h-pages `123
X`009/Helvetica findfont .4 inch scalefont setfont
X`009x y moveto
X`009(Pages: ) show
X`009cvi statusdict /pagecount get exec exch sub 1 add 10 string cvs show
X`009/y y .75 inch sub def
X`125 def
X
X/h-logline `123
X`009/Helvetica findfont 12 scalefont setfont
X`009x y moveto
X`009show
X`009/y y 12 sub def
X`125 def
$ CALL UNPACK [.LASER_DIST]TRAILER.PS;1 1365116560
$ create/nolog 'f'
X%!
X%%%`009PostScript program to plot Zeta plot files
X%
X%`009R. Watson 31-Jan-85
X%
X%`009inputs:`009/param1 or /#copies - number of copies (default 1)
X%`009`009/param2 or /scalefact - scale factor (default 1)
X%`009`009/param3 or /zFont - use Zeta font (default true)
X%`009`009/param4 or /penscale - scaling to apply to pen (default 1)
X%`009`009/param5 or /usepens - use pen color if nz (default 0)
X%
X%`009Not supported yet:
X%
X%`0091. Shaded characters
X%`0092. Aspect characters
X%
X%`00909/13/85 add pre-processed definitions
X%`009`009zFont defaults to true
X%`009`009scalefact defaults to 1
X%`00905/30/86 Ignore level one "6" commands (whatever they are)
X%`00906/20/86 J.Knox Fix problems with circle command
X%`00902/15/87 R.Watson add default parameters
X%`00902/20/87 R.Watson add default table, remove debug print, remove`032
X%`009`009 input timeout avoidance.
X%`00903/06/87 M. Kaczmarczik/J. Taylor add scaling factor for pen
X%`00904/01/87 R. Watson Opcode 6 is alternate pen select.
X%`009`009 Added parameter usepens to select pen color/shading.`032
X%`009`009 Default changed to no shading.
X%
X
X/lTime usertime def`009`009`009`009% save load start time
X
X%%`009initialization.
X%
X/init
X`123
X%%%`009dbg 1 string dup 0 7 put writestring flush % ring bell
X`009newpath
X`009/aspect 256 def`009`009`009% preset default aspect
X`0090 0 moveto`009`009`009% preset starting location on page
X`009/pen false def`009`009`009% preset pen up
X`009/sTime usertime def`009`009% save start time
X`125 def
X
X
X%  read a zeta byte
X
X/getz `123`009`009`009`009`009`009
X`009`123
X`009`009inp read not `123eofError`125 if`009% if EOF
X`009`009dup 32 gt `123exit`125 `123pop`125 ifelse`009% exit loop if not <= s
Vpace
X`009`125 loop
X`009dup /zn exch def`009`009`009% define zeta number
X`009zb 0 3 -1 roll put`009`009`009% put char code in string
X`125 def
X
X
X%%  check for 9 more Z's
X%
X/checkZeta `123
X`0099 `123 getz zb (Z) ne `123notZerror`125 if `125 repeat
X`125 def
X
X
X%%  main program
X%
X/main
X`123
X`009`123
X`009`009gsave
X`009`009init
X`009`009waitBytes`009`009`009`009% wait for a job
X`009`009not `123grestore exit`125 if`009`009`009% if waitBytes false
X`009`009checkZeta
X`009`009levelOne
X`009`009grestore
X`009`125 loop
X`125 def
X
X
X%%`009waitBytes - waits until there is a "Z" on stdin.
X%
X%`009return true if Z found, false if EOF
X/waitBytes
X`123
X`009`123
X%%% % uncomment these lines to wait forever for plots with no timeout
X%%% `009`009inp bytesavailable 0 ne `123
X`009`009`009inp read not `123 false exit `125 if`009`009% if EOF
X`009`009`00916#5A eq `123true exit`125 if`009`009`009% if Z
X%%%`009`009`125 if
X`009`125 loop
X`125 def
X
X
X%  levelOne - process level 1 commands
X
X/levelOne
X`123
X`009`123
X`009`009getz `009`009`009`009`009%get a byte
X
X`009`009zb (Z) eq `123`009`009`009`009% Z
X`009`009`009stroke
X%%% debug`009`009usertime sTime sub 1000 div 10 20 string cvrs
X%%% debug`009`009 dbg exch writestring dbg ( seconds\n)
X%%% debug`009`009 writestring flush
X%%% debug`009`009lTime 1000 div 10 20 string cvrs`032
X%%% debug`009`009 dbg exch writestring dbg ( load time\n)
X%%% debug`009`009 writestring flush
X`009`009`009showpage
X`009`009`009exit
X`009`009`125 if
X
X`009`009`123`009
X`009`009`009zb (0) eq `123`009`009`009% 0 - nop
X`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (1) eq `123`009`009`009% 1 - pen up
X`009`009`009`009/pen false def
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (2) eq `123`009`009`009% 2 - pen down
X`009`009`009`009/pen true def
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (3) eq `123`009`009`009% 3 - character vector
X`009`009`009`009cVector
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (4) eq `123`009`009`009% 4 - center char vect
X`009`009`009`009ccVector
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (5) eq `123`009`009`009% 5 - numeric vector
X`009`009`009`009nVector
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (6) eq `123`009`009`009% 6 - pen select
X`009`009`009`0091 crb`009`009`009% get pen
X`009`009`009`009usepens 0 ne`123`009`009% if shading enabled
X`009`009`009`009`009pencolor exch get setgray
X`009`009`009`009`125 `123
X`009`009`009`009`009pop
X`009`009`009`009`125 ifelse
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009zb (7) eq `123`009`009`009% 7 - level 2
X`009`009`009`009levelTwo
X`009`009`009`009exit
X`009`009`009`125 if
X
X`009`009`009vector
X`009`009`009exit
X`009`009`125 loop
X
X`009`125 loop %do this one forever`009`009
X`125 def
X
X
X%  level two commands
X
X/levelTwo
X`123
X`009getz `009`009`009`009`009% get level 2 type
X
X`009`123
X`009`009zb (1) eq `123`009`009`009% 1 - pen 1
X`009`009`009/pen false def
X`009`009`009emit
X`009`009`009pencolor 0 get setgray
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (2) eq `123`009`009`009% 2 - pen 2
X`009`009`009/pen false def
X`009`009`009emit
X`009`009`009pencolor 1 get setgray
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (3) eq `123`009`009`009% 3 - pen 3
X`009`009`009/pen false def
X`009`009`009emit
X`009`009`009pencolor 2 get setgray
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (4) eq `123`009`009`009% 4 - pen 4
X`009`009`009/pen false def
X`009`009`009emit
X`009`009`009pencolor 3 get setgray
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (7) eq `123`009`009`009% 7 - enter level 3
X`009`009`009levelThree
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (B) eq `123`009`009`009% B - enter dash
X`009`009`009emit
X`009`009`009dashes 0. setdash`009% enter dash mode
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (C) eq `123`009`009`009% C - exit dash
X`009`009`009emit
X`009`009`009`091`093 0. setdash
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (D) eq `123`009`009`009% D - define dash
X`009`009`009emit`009`009`009% close current path
X`009`009`009getz getxy`009`009% get dash definition
X`009`009`009/d1 ix def /d2 iy def`009% save first 2 parts
X`009`009`009getz getxy
X`009`009`009/dashes `091d1 d2 ix d2`093 def % define dash array
X`009`009`009dashes 0. setdash`009% enter dash mode
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (E) eq `123`009`009`009% E - define slant
X`009`009`009getz getxy`009`009% eat slant
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (F) eq `123`009`009`009% F - define aspect
X`009`009`009getz getxy`009`009% eat aspect
X`009`009`009/aspect ix def
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (G) eq `123`009`009`009% G - circle/arc
X`009`009`009doCircle
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (H) eq `123`009`009`009% H - terminal msg
X`009`009`009termMsg
X`009`009`009exit
X`009`009`125 if
X
X`009`009zb (I) eq `123`009`009`009% I - shade
X`009`009`009getz getxy
X`009`009`009exit
X`009`009`125 if
X
X
X%  process rest of level 2
X`009`009exit
X
X
X
X`009`125 loop
X`125 def
X
X
X%  process line vector
X
X/vector
X`123
X`009getxy`009`009`009`009`009% get crb x y
X`009pen `123ix iy rlineto`125 `123ix iy rmoveto emit`125 ifelse %do the vect
Vor
X`125 def
X
X
X%  process character vector
X
X/cVector
X`123
X`009getz`009`009`009`009% get vector control
X`009getxy`009`009`009`009% decode vector
X`0092 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`0092 crb`032
X`009`009dup 0 lt `123pop 0`125 if`009% DEBUG if negative
X`009`009dup 127 gt `123pop 0`125 if`009% DEBUG if too big
X`009`009zFont `123sym exch get`125`009% map zeta to zeta code
X`009`009      `123zta 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`009% 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%  process centered character vector
X
X/ccVector
X`123
X`009getz`009`009`009`009% get vector control
X`009getxy`009`009`009`009% decode vector
X`009/cstr 1 string def`009`009% define 1 char string
X`0091 crb abs
X`009zFont `123sym exch get`125`009`009% map zeta to zeta code
X`009      `123zta exch get`125 ifelse `009% get ascii char code
X`009cstr 0 3 -1 roll put`009`009% insert character into string
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`009currentpoint`009`009`009% save current point
+-+-+-+-+-+-+-+-  END  OF PART 9 +-+-+-+-+-+-+-+-

