Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-06 - decus/20-154/spr.mac
There are no other files named spr.mac in the archive.
Subttl	Table of contents for SPR

;	   -- Subtitle --					   -- Page --
;
;  1.	Table of contents............................................. 1
;  2.	Edit history.................................................. 2
;  3.	Definitions................................................... 2
;  4.	Macro Definitions............................................. 4
;  5.	Data Storage.................................................. 5
;  6.	Startup procedure............................................. 6
;  7.	Non-priveleged user operations................................ 7
;  8.	Read an SPR into the buffer................................... 8
;  9.	give user help................................................ 9
;  10.	Privileged user help message.................................. 10
;  11.	generate a number and fix the beginning of the spr buffer..... 11
;  12.	write (append) an spr to the file............................. 12
;  13.	Buffer handling subroutines................................... 13
;  14.	input a field from tty to spr buffer.......................... 14
;  15.	processing for privileged users............................... 15
;  16.	here on EXIT or QUIT commands................................. 16
;  17.	SUBMIT an SPR................................................. 17
;  18.	INPUT from what file?......................................... 18
;  19.	read the input file........................................... 19
;  20.	build the symbol table of pointers............................ 20
;  21.	Handle various fields in data................................. 21
;  22.	 header listings.............................................. 22
;  23.	write a header................................................ 23
;  24.	review an spr................................................. 24
;  25.	dispose of an spr............................................. 25
;  26.	type out an SPR............................................... 28
;  27.	write out an SPR.............................................. 29
;  28.	OUTPUT command................................................ 30
;  29.	PRINT command................................................. 31
;  30.	input a sequence of spr numbers to be typed/printed/etc....... 32
;  31.	sequence keyword subroutines.................................. 33
;  32.	generate the sequence of spr numbers.......................... 34
;  33.	get the next spr in the selection group....................... 35
;  34.	check the spr named in t1..................................... 36
;  35.	check to see if this spr has been reviewed.................... 37
;  36.	no sprs selected by print/header/type command................. 38
;  37.	parsing tables and file/symbol table allocation............... 39
;
;		     (End of table of contents)
	Subttl	Edit history

;	SPR.MAC
;	this program maintains a database of problem reports
;	it also provides systems personel facilities for examining
;	and commenting on these problems
;
;	Written July, 1980 by S. Berlin, Wesleyan University
;
;	Installation instructions -
;	As written - the program may reside anywhere, but the
;	database is maintained in the area SPR:
;	the database file is SPR:SPR.DATA
;	sequential SPR numbers are provided from the file SPR:SPR.number
;	world access to SPR.DATA should allow append access
;	world access to SPR.NUMBER should allow read/write access.
;
;	Problem reports may be sent to:
;	Computer Center, Wesleyan University
;	Middletown, CT   06457
;

;
;[W1]	Make SPR command mode available only to wheels who give the
;	command "$SPR/COMMAND" (or $SPR/C).	[DHB 8/6/80]
;[W2]	Create a copy of the SPR for the person who submitted it, and
;	append it to the file "SPR.SUBMITTER-COPY".	[DHB 8/8/80]
;[W3]	Change "ALL" subcommand to indicate undisposed SPRs only.  Remove
;	"UNDISPOSED" subcommand, and add "COMPLETE" subcommand to take
;	meaning of "ALL" previously.  Also create a help file for
;	privileged users.	[DHB 8/8/80]
;[W4]	Ignore illegal symbols in data without warning message [stb 30-sep-80]
;[W5]	Correct bug in review subroutine that was not allowing any reviews.
;	[DHB 9-Dec-80]
;[W6]	Change the directory name containing SPR data to logical device SPR:,
;	so other sites can use it just by creating a system-wide logical name.
;	This is being submitted to DECUS as of this patch.	[DHB 30-Apr-81]
TITLE SPR - User and System program to submit and/or review SPR submissions

	subttl	Definitions

	sall				;clean up listing
	search cmd,macsym,monsym
	.require sys:macrel
	.require sys:cmd

Major==1			;major version number
Minor==2			;minor version number
Vedit==134			;edit level
Vwho==2				;who edited (2=wcc)

Pgver.	Major,Minor,Vedit,Vwho	;set up the version
;accumulator definitions

	f==0
	a==1
	b==2
	c==3
	d==4
	q1==5
	q2==6
	q3==7
	t1==10
	t2==11
	t3==12
	t4==13
	t5=14
	buff==15
	p=17

;definitions of fields in spr file
;in the file, these are stored as fld,,-1
;always as full words to facilitate searching, and 
;they will always be able to null-delimit the previous field
	sprfld==0
	timfld==1
	whofld==2
	absfld==3		;abstract
	prgfld==4		;programs affected
	prifld==5		;priority
	desfld==6		;description of problem
	filfld==7		;related files needed
	fixfld==10		;known fix
	repfld==11		;reproducible?
	revfld==12		;review of ths spr
	endfld==13		;end of this spr
	disfld==14		;disposition
	maxfld==14		;value of highest defined

;flag bit definitions

	f.all==1b0	;all sprs
	f.rev==1b1	;reviewed only
	f.und==1b2	;undisposed only
	f.unr==1b3	;unreviewed only
	f.las==1b4	;last (n) sprs
	f.dis==1b5	;diposed only
	f.rvs==1b6	;reverse order output
	f.one==1b7	;one spr only
	Subttl	Macro Definitions

;read a field into the buffer - ac buff must be byte pointer into buffer

	define getfld(type,prompt,nchars)	<
	hrloi	t1,type		;get type
	hrroi	a,[asciz/prompt/]	;prompt
	movei	t2,nchars	;number of characters
	call	input
>
;invoke dump to put a word into buffer

	define	putwrd	(arg)	<
	move	t1,arg
	call	dump
>
;write a crlf to a
	define	crlf	<
	hrroi	b,[asciz/
/]
	setz	c,
	sout
>
	Subttl	Data Storage

sprwrd:	sprfld,,-1
timwrd:	timfld,,-1
whowrd:	whofld,,-1
abswrd:	absfld,,-1		;abstract
prgwrd:	prgfld,,-1		;programs affected
priwrd:	prifld,,-1		;priority
deswrd:	desfld,,-1		;description of problem
filwrd:	filfld,,-1		;related files needed
fixwrd:	fixfld,,-1		;known fix
repwrd:	repfld,,-1		;reproducible?
revwrd:	revfld,,-1
endwrd:	endfld,,-1		;end of this spr
diswrd:	disfld,,-1		;disposition

	stksiz==200
stack:	block stksiz
	bufsiz== ^d80*^d20/5	;20 lines of 80 characters
buffer:	block bufsiz
filsiz:	block 1			;save file page count
count:	block 1			;number of spr's read in
sprmax:	block 1			;biggest spr number read
sprnum:	block 1			;saved spr number searching for
lastn:	block 1			;argument for last command
outfil:	block 1			;jfn for output to file
inpbuf:	asciz\SPR:spr.data\	;[W3]
	block	50		;[W3] storage for file name

;[W3] special storage
disfil:	ascii\dsk:disposed-spr-no.\	;[W3] !!don't change this length!!
disnum:	block	2		;[W3] for number of spr

	cmdstg			;create storage block for comnd jsys
	subttl	Startup procedure

start:	reset
	move	p,[iowd stksiz,stack]
	call	cmdini		;init comnd jsys
	movei	a,.fhslf	;get my capabilities
	rpcap
	txne	c,sc%whl	;wheel enabled?
	 jrst	wheel		;yes - do special stuff
Notcmd:	call	user		;[W1] wheel may return us to here

usrdon:	haltf			;all done
	jrst	start		;but can ride again
	subttl	Non-priveleged user operations

user:	call	rspr		;read an spr into buffer
	call	getnum		;give it a number
	push	p,t2		;[W2] save the number
	call	wspr		;write it out
	tmsg	<
Thank you -- this is SPR number >
	movei	a,.priout	;[W2] get tty jfn
	hrrz	b,(p)		;[W2] get spr number
	movei	c,12		;[W2] radix 10
	nout			;[W2] tell user the number
	 jfcl			;[W2] can't

;[W2] Now make a copy for the user, too
	hrrz	t1,buff		;[W3] construct some pointers
	subi	t1,obuff	;[W3] length of area
	movns	t1		;[W3] negated
	movei	q1,obuff	;[W3] start of buffer
	hrl	q1,t1		;[W3] length in left
	call	symusr		;[W3] construct a user symbol-table
	movx	a,gj%sht	;[W2] now open an output file
	hrroi	b,[asciz\dsk:spr.submitter-copy\]	;[W2]
	gtjfn			;[W2] get a jfn for that one
	 jshlt			;[W2] can't
	movx	b,fld(7,of%bsz)!of%wr!of%app	;[W2] select mode
	openf			;[W2] and open file
	 jshlt			;[W2] can't
	movei	b,14		;[W2] start with a form feed
	bout			;[W2] in case we're appending
	pop	p,t1		;[W2] restore spr number
	call	sprout		;[W2] type the spr
	seto	a,		;[W2] close all files
	closf			;[W2]
	 jshlt			;[W2] can't
	ret			;[W2] finally return
	subttl	Read an SPR into the buffer

rspr:	move	buff,[point 7,obuff+2]	;leave space at beginning for number
	putwrd	timwrd		;flag for time indicator
	move	a,buff		;get pointer again for date/time
	seto	b,		;-1 means now,today
	setz	c,		;straight format
	odtim
	movem	a,buff		;save pointer again
	putwrd	whowrd
	seto	a,		;-1 means me
	hrroi	b,t1		;address for answer
	movei	c,.jiuno	;user number
	getji
	 jshlt			;fatal trouble
	move	b,t1		;get user number
	move	a,buff		;pointer
	dirst			;get info
	 jshlt			;more trouble?
	movem	a,buff		;save pointer one more time

	hrroi	a,[asciz/
Software Problem Reporting System
======== ======= ========= ======

/]
	psout

	hrroi	a,[asciz/Do you want instructions? /]
	call	dpromp
	movei	a,[flddb. .cmfld,,,<Yes or No>,<no>]
	call	cfield
deb:	ldb	a,[point 7,atmbuf,6]
	caie	a,"y"		;is it a y
	cain	a,"Y"		;or cpital Y?
	 call	help		;give help
	getfld	absfld,<Brief synopsis of problem: >,^d70
	getfld	prgfld,<System program(s) affected: >,^d70
	getfld	prifld,<Suggested priority: >,^d70
	getfld	desfld,<Description of problem: (end with ^Z or ESC)
>,1500
	hrroi	a,[asciz/
/]
	psout			;give a crlf
	getfld	filfld,<Files needed to reproduce problem: >,^d70
	getfld	fixfld,<Please describe any known fix or get-around: (end with ^Z or ESC)
>,1500
	putwrd	endwrd		;flag end of this spr
	ret
	subttl	give user help

Define usrhlp,<
xlist				;;[W3] don't list the ascii expansion
asciz\This program will ask six questions.  Any of the answers may be blank.

(1) Brief synopsis of problem - expects a one-line response.
(2) System program(s) affected - one line.
(3) Suggested priority - one line - eg low, high, critical.
(4) Description of problem - a full description of the problem
    or suggestion - may be up to 19 lines long.
(5) Files needed to reproduce problem - one line
(6) Known fix or get-around - Is there a way to avoid the
    consequences of this problem?  Describe fully -
    up to 19 lines.

Please address any comments to <WCC.S-BERLIN>.

\
list				;;[W3] restore normal listing mode
>				;[W3] end of macro


Help:	hrroi	a,uhelp		;[W3] get address of help message
	psout			;[W3] type it
	ret			;[W3] and return

;[W3] help message here
Uhelp:	usrhlp			;[W3] invoke the macro
Subttl	Privileged user help message

Define	Prvhlp,<
xlist				;;[W3] don't list the ascii expansion
asciz\SPR commands:
	DISPOSE		Dispose of an spr - this will create a disk file
			to be printed for the records.
	EXIT		Leave the program.
	HEADERS		Type the spr headers to the terminal.
	INPUT		Use a non-standard input file for spr data.
	LIST		Type this list of commands.
	OUTPUT		Designate an output file specification.
	PRINT		Print the specified spr(s).
	QUIT		Same as exit.
	REVIEW		Add a review of a specific spr.
	SUBMIT		Submit an spr.
	TYPE 		Type the specified spr(s) to the terminal.
Subcommands to these are:
	ALL		All sprs.
	COMPLETE	All sprs and all disposed sprs.
	DISPOSED	Disposed sprs only.
	LAST n		Last n sprs only.
	REVIEWED	Reviewed sprs only.
	UNREVIEWED	Unreviewed sprs only.
Switches:
	REVERSE		Lists, prints or types sprs in reverse order.

\
list				;;[W3] restore normal listing mode
>				;[W3] end of macro


.lis:	hrroi	a,phelp		;[W3] get help message
	psout			;[W3] type it
	ret			;[W3] and return

;[W3] invoke the macro here
Phelp:	prvhlp			;[W3]
	subttl	generate a number and fix the beginning of the spr buffer

getnum:	move	a,[gj%sht!gj%old]	;open the old file
	hrroi	b,[asciz/SPR:spr.number/]	;
	gtjfn
	 jrst	usedef		;default
	move	b,[fld(1,of%rd)!fld(1,of%thw)!fld(1,of%wr)!fld(7,of%bsz)]
	openf
	 jrst	usedef
	movei	c,5+5		;radix
	nin			;read it in
	 jrst	usedef		;default
	caig	b,^d99999
	caige	b,0		;number in range? (5 digits)
	 jrst	usedef		;nope...
	movem	b,t1		;answer
	movei	b,60		;ascii 0
	setz	c,		;byte 0
	rout
	movei	b,1(t1)		;1 + old number
	movei	c,5+5		;radix
	nout
	 jfcl			;ignore errors
	soj	b,		;original for spr
get.ex:	move	t2,t1		;[W2] save the spr number
	seto	a,		;-1 means everything
	closf
	 jfcl
	move	t1,sprwrd
	movem	t1,obuff	;flag beginning of it all
	move	a,[point 7,obuff+1]	;place for number
	move	c,[5,,5+5]	;5 cols, radix 5+5
	nout
	 jfcl			;cant fail?
	ret

usedef:	movei	t1,^d7777		;default spr number
	jrst	get.ex		;exit with close
	subttl	write (append) an spr to the file

;on entry - 	buff points just beyond last byte used in buffer

wspr:	seto	a,
	closf
	 jfcl			;close everything first
	move	a,[fld(1,gj%sht)]
	hrroi	b,inpbuf	;[W3]
	gtjfn
	 jrst	try2		;failed, try other choice
	move	b,[fld(1,of%app)!fld(17,of%mod)!fld(1,of%thw)] ;append dump
	openf
	 jrst	try2		;try other option
	call	outit		;try for output
	 jrst	try2		;failed

done:	seto	a,		;-1 means everything
	closf
	 jfcl
	ret

try2:	tmsg	<
Sorry - unable to process your SPR - please speak with system personel.
>
	call	done
	retskp

outit:	hrrz	t1,buff		;get final address
	subi	t1,obuff	;minus start
	movn	t1,t1		;negate it
	hrlz	t1,t1		;and put into left half
	hrri	t1,obuff-1	;address in right
	setz	t2,		;terminate list
	movei	b,t1		;address of command word
	dumpo			;dump it out
	 ret			;error return
	retskp			;ok return
	subttl	Buffer handling subroutines

;Dump a 36-bit word into buffer, leave pointer aimed at next byte

dump:	hrrz	buff,buff	;clear left half
	aoj	buff,		;bumo by one
	movem	t1,(buff)	;put word in
	aoj	buff,		;bumo again
	hll	buff,[point 7,]	;regain pointer
	ret			;return
	subttl	input a field from tty to spr buffer

;on entry -	a points to prompt
;		t1 is field flag
;		t2 is number of characters
;		buff points to recieving buffer
;on output -	buff is updated
;		a,b,c,d,t1,t2 are undefined

input:	call	dump		;store type
inp1:	setz	c,
	caig	t2,^d80		;no re-type buffer if long input
	movem	a,c		;else save prompt address for re-type
retry:	psout			;now prompt
	move	a,buff		;get pointer into ac1 for rdtty
	move	b,[1b3]		;assume break on crlf
	caile	t2,^d80		;but if input is long
	 move	b,[1b0]		;then break on esc or ^Z only
	hrr	b,t2		;get max count
	rdtty
	 jrst	[	jserr
			move	a,c
			jrst	retry	]
	txne	b,1b0		;was it esc or ^z?
	 jrst	[	movni	t1,2	;backup 2 bytes
			adjbp	t1,a
			ildb	a,t1	;get the char before terminator
			cain	a,12	;is it a line feed?
			 skipa	a,[0]	;yes - use null terminator
			movei	a,12	;no - put in a lf
			idpb	a,t1
			setz	a,	;followed by null
			idpb	a,t1
			move	a,t1	;and restore pointer
			jrst	.+1	]
	movem	a,buff		;save new pointer
	ret
	subttl	processing for privileged users

wheel:	setz	a,		;[W1] see if in command mode
	rscan			;[W1] rescan input
	 jrst	notcmd		;[W1] can't
Wh.a:	pbin			;[W1] get a byte
	cain	a,12		;[W1] line feed?
	 jrst	notcmd		;[W1] yes, quit
	caie	a,"/"		;[W1] look for a switch
	 jrst	wh.a		;[W1] loop until found
	pbin			;[W1] get next byte
	push	p,a		;[W1] store the char
	move	a,[point 7,[0]]	;[W1] byte pointer to null string
	rscan			;[W1] clear the rescan buffer
	 jfcl			;[W1] ignore errors
	pop	p,a		;[W1] restore the char
	caie	a,"c"		;[W1] lower case c?
	cain	a,"C"		;[W1] or upper?
	 trna			;[W1] yes, proceed
	jrst	notcmd		;[W1] no good - don't enter command mode
	movei	a,.priout	;default for print
	movem	a,outfil	;output
	Tmsg	<SPR program -- type LIST for a list of commands
>
	call	getdta		;[W3] do an input on the data file
	call	cntspr		;[W3] count the sprs
loop:	hrroi	a,[asciz/SPR>/]
	call	dpromp		;prompt
	movei	a,[flddb. .cmkey,,comtab]
	call	rfield
	hrrz	a,(b)		;get answer
	call	@a		;and dispatch
	jrst	loop
	subttl	here on EXIT or QUIT commands

.exi:	noise <from program>
	confrm
	seto	a,		;-1 means all open files
	closf
	 jserr
	haltf
	jrst	start
	subttl	SUBMIT an SPR

.sub:	noise	<an SPR>
	confrm
	call	user		;pretend we're not privileged
	call	getdta		;[W3] do an input
	ret			;[W3]
	subttl	INPUT from what file?

.inp:	noise	<from SPR data file: >
	movei	a,[	fld(.cmifi,cm%fnc)!cm%dpp
			exp	0,0
			point 7,[asciz\SPR:spr.data\]
			0	]
	call	cfield		;[W3] get field and confirm
	hrrz	a,b		;[W3] get the jfn
	move	t1,[point 7,atmbuf]	;[W3] pointer to file used
	move	t2,[point 7,inpbuf]	;[W3] pointer to storage
	ildb	t3,t1		;[W3] get a byte
	idpb	t3,t2		;[W3] deposit it
	jumpn	t3,.-2		;[W3] and loop until null is found
	call	def.a		;[W3] do an input
	call	cntspr		;[W3] count the sprs
	ret			;[W3] and return

;[W3] here for a default input
getdta:	movx	a,gj%old!gj%sht	;[W3] old file, short form of gtjfn
	hrroi	b,inpbuf	;[W3] storage area for input file
	gtjfn			;[W3] get the jfn
	 jshlt			;[W3] can't
Def.a:	call	rdfile		;read in the file
	seto	a,		;close all files now
	closf
	 jfcl
	ret			;[W3] return

;[W3] here to count sprs read in
Cntspr:	movei	a,.priout
	move	b,count
	movei	c,5+5
	nout
	 jfcl
	tmsg	< SPRS read, latest was number >
	movei	a,.priout
	move	b,sprmax
	movei	c,5+5
	nout
	 jfcl
	tmsg	<
>
	ret
	subttl	read the input file

;on entry -	a contains the jfn of the file (not opened)

rdfile:	movx	b,fld(1,of%rd)!fld(1,of%thw)!fld(36,of%bsz)!fld(17,of%mod)
	openf
	 jrst	[	jserr
			ret	]
	move 	b,[1,,11]	;word 11 is page count
	movei	c,t1		;dump it to t1
	gtfdb
	hrrz	t1,t1		;clear left-half junk
	movem	t1,filsiz	;save page count
	movei	b,[iowd 177777,filepg*1000
			z	]
	dumpi
	 jrst	[	cain	a,iox4	;eof 'error' ?
			 jrst	.+1	;yes - no error at all
			jserr
			ret	]
	seto	a,
	closf			;close the file
	 erjmp	[	jserr
			ret	]
	callret	symbol		;scan file, build symbol table
	subttl	build the symbol table of pointers

;symbol table is array of 6-word blocks
;
;		tim,,who
;		abs,,prg
;		pri,,des
;		fil,,fix
;		dis,,rev2
;		rev2,,rev3

symbol:	movei	q1,1000*filepg	;address of beginning
	movn	t2,filsiz	;size of file in pages
	ash	t2,^d9		;number of words on those pages
	hrl	q1,t2		;make aobjn in q1

;[W3] alternate entry on submit command
symusr:	setzm	count		;start with 0 count
	setzm	sympag		;first clear old symbols
	move	t1,[sympag,,sympag+1]	;prepare for blt
	blt	t1,sympag+7777	;8 pages for now
	setzm	sprmax		;biggest number to date is 0
symlup:	hrro	t2,(q1)		;start reading words
	aoje	t2,gotone	;look for -1 in right half
symret:	aobjn	q1,symlup	;scan entire file
	ret			;return when finished

;here when we find a flag in the file
gotone:	hlrz	t2,(q1)		;get the left half (flag type)
	cain	t2,77		;old style end mark?
	 jrst	symret		;yes - ignore it
	caile	t2,maxfld	;is it a valid symbol?
;[w4] ignore bad word without msg	 jrst	[	tmsg <Illegal symbol ignored in data
;[w4]>
;[w4]			jrst	symret	]	;ignore bad data
	 jrst	symret
	call	@symtab(t2)	;dispatch
	jrst	symret		;and return

symtab:	gospr		;dispatch routines must be in numerical order!!!
	gotim		;these routines assume q1 points to flag word
	gowho
	goabs
	goprg
	gopri
	godes
	gofil
	gofix
	gorep
	gorev
	goend
	godis
	subttl	Handle various fields in data

;all these routines must preserve q1!!!
;q2 is maintained as pointer to first word of current spr block

gospr:	hrroi	a,1(q1)		;get address of data
	movei	c,5+5		;radix
	nin
	 jrst	[	jserr
			tmsg	<error in data file format
>
			ret	]
	movem	b,q2		;save this number as new current
	camle	b,sprmax	;big as what we had?
	 movem	b,sprmax	;bigger!
	imuli	q2,6		;make into block offset
	addi	q2,sympag	;start at symtab
	ret			;and return

gotim:	hrrzi	t1,1(q1)	;get address
	hrlm	t1,(q2)		;store away
	aos	count		;use time field to count spr's
	ret

gowho:	hrrzi	t1,1(q1)	;get address
	hrrm	t1,(q2)		;store
	ret

goabs:	hrrzi	t1,1(q1)
	hrlm	t1,1(q2)
	ret

goprg:	hrrzi	t1,1(q1)
	hrrm	t1,1(q2)
	ret

gopri:	hrrzi	t1,1(q1)
	hrlm	t1,2(q2)
	ret

godes:	hrrzi	t1,1(q1)
	hrrm	t1,2(q2)
	ret

gofil:	hrrzi	t1,1(q1)
	hrlm	t1,3(q2)
	ret

gofix:	hrrzi	t1,1(q1)
	hrrm	t1,3(q2)
	ret

godis:	hrrzi	t1,1(q1)
	hrlm	t1,4(q2)
	ret

gorev:	hrrz	t1,4(q2)	;get review 1
	jumpe	t1,ok1
	hlrz	t1,5(q2)	;try review 2
	jumpe	t1,ok2		;none entered til now
	hrrz	t1,5(q2)	;third one?
	jumpe	t1,ok3		;was blank, use it
	tmsg	<Too many reviews found, ignored
>
	ret
ok1:	hrrzi	t1,1(q1)
	hrrm	t1,4(q2)
	ret
ok2:	hrrzi	t1,1(q1)
	hrlm	t1,5(q2)
	ret
ok3:	hrrzi	t1,1(q1)
	hrrm	t1,5(q2)
	ret
gorep:				;as yet undefined
goend:	ret			;no processing at end
	subttl	 header listings

.hea:	call	sprseq		;read a sequence
	setz	t1,		;signal we haven't seen any yet
	call	getseq		;get the first
	 jrst	none		;none selected (or read?)
	movei	a,.priout	;write to tty
healup:	call	wrthdr		;write out the header
	call	getseq		;get next number
	 ret			;no more
	jrst	healup		;more
	subttl write a header

;on entry -	a is output designator
;		t1 is spr number

wrthdr:	fmsg	<SPR # >
	move	b,t1
	movei	c,5+5
	nout
	 jfcl
	fmsg	< - >
	move	t2,t1		;make a block pinter
	imuli	t2,6
	hlro	b,sympag+1(t2)	;get pointer to abstract
	setzb	c,d
	sout
	ret
	subttl	review an spr

.rev:	noise	<SPR #>
	movei	a,[flddb. .cmnum,,5+5]
	call	cfield
	camle	b,sprmax	;could we have read it?
	 jrst	[	tmsg <I haven't seen an SPR that big
>
			ret	]
	move	t1,b		;save number
	imuli	b,6		;into block count
	skipn	sympag(b)	;any pointers there?
	 jrst	[	tmsg <I have no SPR by that number
>
			ret	]
	movei	a,.priout	;output to tty
	push	p,b		;[W5] preserve b across call to wrthdr
	call	wrthdr		;do up a header
	pop	p,b		;[W5] restore old value
	hrrz	t2,sympag+4(b)	;get review 1
	jumpe	t2,ok
	hlrz	t2,sympag+5(b)	;get review 1
	jumpe	t2,ok
	hrrz	t2,sympag+5(b)	;get review 1
	jumpe	t2,ok
	tmsg	<Sorry - this SPR has been reviewed enough
>
	ret
ok:	move	a,sprwrd	;put in the spr flag
	movem	a,obuff
	move	a,[point 7,obuff+1]
	move	b,t1
	move	c,[5,,5+5]	;5 cols,,radix
	nout
	 jfcl
	move	a,revwrd
	movem	a,obuff+2	;flag review start
	seto	a,
	hrroi	b,t2		;get user number into t2
	movei	c,.jiuno
	getji
	 jfcl			;odd?
	move	b,t2
	move	a,[point 7,obuff+3]
	dirst			;put user name in buffer
	 jfcl			;if we can
	fmsg	< on >
	seto	b,
	setz	c,		;get current time in standard format
	odtim
	crlf
	movem	a,buff		;restore pointer to buff
	hrroi	a,[asciz/Review: (end with ^Z or esc)
/]
	movei	t2,^d1500	;max chars
	call	inp1		;read stuff in
	hrloi	t1,endfld	;terminate it
	call	dump
	call	wspr		;write out the review
	call	getdta		;[W3] do an input - we changed the file
	ret			;[W3] and return
	subttl	dispose of an spr

.dis:	noise	<SPR #>
	movei	a,[flddb. .cmnum,,5+5]
	call	cfield
	camle	b,sprmax	;could we have read it?
	 jrst	[	tmsg <I haven't seen an SPR that big
>
			ret	]
	move	t1,b		;save number
	movem	t1,sprnum	;[W3] save the number
	imuli	b,6		;into block count
	skipn	sympag(b)	;any pointers there?
	 jrst	[	tmsg <I have no SPR by that number
>
			ret	]
	hlrz	t2,sympag+4(b)	;disposed already?
	jumpe	t2,disok	;no...
	tmsg	<Sorry - this SPR has been disposed already
>
	ret

;continued on next page
disok:	movei	a,.priout	;output to tty
	call	wrthdr		;do up a header
	move	a,sprwrd	;put in the spr flag
	movem	a,obuff
	move	a,[point 7,obuff+1]
	move	b,t1
	move	c,[5,,5+5]	;5 cols,,radix
	nout
	 jfcl
	move	a,diswrd
	movem	a,obuff+2	;flag Disposition start
	seto	a,
	hrroi	b,t2		;get user number into t2
	movei	c,.jiuno
	getji
	 jfcl			;odd?
	move	b,t2
	move	a,[point 7,obuff+3]
	dirst			;put user name in buffer
	 jfcl			;if we can
	fmsg	< on >
	seto	b,
	setz	c,		;get current time in standard format
	odtim
	crlf
	movem	a,buff		;restore pointer to buff
	hrroi	a,[asciz/Disposition: (end with ^Z or esc)
/]
	movei	t2,^d1500	;max chars
	call	inp1		;read stuff in
	hrloi	t1,endfld	;terminate it
	call	dump
	call	wspr		;write out the disposition
	call	getdta		;[W3] do an input after changing file

;continued on next page
;[W3] and also create a hard copy for records
	hrroi	a,disnum	;[W3] place to put disposed file number
	hrrz	b,sprnum	;[W3] get number
	movei	c,12		;[W3] in decimal
	nout			;[W3] put the number into the extension
	 setzm	disnum		;[W3] couldn't
	movx	a,gj%fou!gj%sht	;[W3] new file to be created
	hrroi	b,disfil	;[W3] filename
	gtjfn			;[W3] get a jfn
	 jshlt			;[W3] can't
	movx	b,fld(7,of%bsz)!of%wr	;[W3] write access
	openf			;[W3] open the file
	 jshlt			;[W3] can't
	move	t1,sprnum	;[W3] get the spr number
	call	sprout		;[W3] print it
	seto	a,		;[W3] all files
	closf			;[W3] are to be closed
	 jshlt			;[W3] can't
	ret			;[W3] return
	subttl	type out an SPR

.typ:	call	sprseq		;read a sequence
	setz	t1,		;signal we haven't seen any yet
	call	getseq		;get the first
	 jrst	none		;none selected (or read?)
	movei	a,.priout	;write to tty
typlup:	push	p,t1
	call	sprout		;write out the spr
	pop	p,t1		;restore last number for sequence check
	call	getseq		;get next number
	 ret			;no more
	jrst	typlup		;more
	subttl	write out an SPR

;on entry -	t1 is spr number
;		a is output designator

sprout:	call	wrthdr		;write out header first
	crlf
	imuli	t1,6		;now count blocks
	fmsg	<Submitted by >
	hrro	b,sympag(t1)	;get who
	setz	c,
	sout
	fmsg	< at >
	hlro	b,sympag(t1)	;gwet when
	setz	c,
	sout
	crlf
	fmsg	<Programs affected - >
	hrro	b,sympag+1(t1)
	setz	c,
	sout
	crlf
	fmsg	<Suggested priority - >
	hlro	b,sympag+2(t1)	;get priority
	setz	c,
	sout
	crlf
	fmsg	<Description of problem:
>
	hrro	b,sympag+2(t1)
	setz	c,
	sout
	crlf
	fmsg	<Files to recreate problem - >
	hlro	b,sympag+3(t1)
	setz	c,
	sout
	crlf
	fmsg	<Known fix:
>
	hrro	b,sympag+3(t1)
	setz	c,
	sout
	hrrz	t3,sympag+4(t1)		;get first review
	jumpe	t3,rok			;none
	crlf
	fmsg	<Reviewed by >
	hrro	b,t3			;make pointer
	setz	c,
	sout
	crlf
	hlrz	t3,sympag+5(t1)		;get first review
	jumpe	t3,rok			;none
	crlf
	fmsg	<Reviewed by >
	hrro	b,t3			;make pointer
	setz	c,
	sout
	crlf
	hrrz	t3,sympag+5(t1)		;get first review
	jumpe	t3,rok			;none
	crlf
	fmsg	<Reviewed by >
	hrro	b,t3			;make pointer
	setz	c,
	sout
	crlf
rok:	hlrz	t3,sympag+4(t1)		;get disposition
	jumpe	t3,nodis		;none enterred
	crlf
	fmsg	<Final Disposition by >
	hrro	b,t3			;get pointer
	setz	c,			;no limit
	sout
	crlf
nodis:	ret
	subttl	OUTPUT command

.out:	noise	<to file>
	movei	a,[flddb. .cmofi]	;parse output file
	call	cfield			;with confrm
	push	p,b		;save new jfn
	hrrz	a,outfil	;first close old file
	closf
	 jserr			;with error message
	movx	b,fld(7,of%bsz)!fld(1,of%wr)!fld(1,of%thw)
	pop	p,a		;now get new jfn
	openf
	 jrst	[jserr
		ret	]
	hrrzm	a,outfil
	ret
	subttl	PRINT command
.pri:	call	sprseq		;read a sequence
	setz	t1,		;signal we haven't seen any yet
	call	getseq		;get the first
	 jrst	none		;none selected (or read?)
	move	a,outfil
prilup:	push	p,t1		;save last spr number
	movei	b,14		;form feed
	bout
	call	sprout		;write out the spr
	pop	p,t1		;pop last spr for sequencing
	call	getseq		;get next number
	 ret			;no more
	jrst	prilup		;more
	subttl	input a sequence of spr numbers to be typed/printed/etc.

;this routine is called when the program needs to know which sprs are
;to be used.  calling sequence is:
;	call	sprseq
;this routine requires terminal input
;
;	on entry t1 should contain the last spr returned
;	or 0 the first time
;	on return, t1 will contain the next spr in the selected sequence
;	no ac's are preserved

sprseq:	noise	<SPR sequence>
	setz	f,		;no flags seen yet
	movei	a,fldseq
	call	rfield		;read a keyword or number
	hrrz	c,c		;get the address of block used
	cain	c,fldnum	;was it a single number?
	 jrst	[	confrm
			movem	b,lastn	;save the number
			txo	f,f.one	;flag just one wanted
			ret	]	;easy case - one number
	hrrz	a,(b)		;get dispatch address
	jrst	@a		;and go handle this keyword
	subttl	sequence keyword subroutines

%all:	noise	<SPRS read>
	txo	f,f.all			;flag all needed
	jrst	revers			;check reverse,confrm,and process

%dis:	noise <SPRS only>
	txo	f,f.dis
	jrst	revers

%rev:	noise	<SPRS only>
	txo	f,f.rev
	jrst	revers

%und:	noise	<SPRS only>
	txo	f,f.und
	jrst	revers

%unr:	noise	<SPRS only>
	txo	f,f.unr
	jrst	revers

%las:	noise	<n SPRS >
	movei	a,fldnum		;need a number now
	call	rfield
	txo	f,f.las!f.rvs		;last n forces reverse list
	movem	b,lastn			;save the argument
;	jrst	revers			;and find out if straight
revers:	movei	a,fldsw		;switch o confirm
	call	rfield
	hrrz	c,c		;isolate address of table actually used
	cain	c,fldsw		;actually parsed a switch?
	 txo	f,f.rvs		;yes - reverse order is only switch
	txnn	a,fld(1,cm%eoc)	;was confirmed?
	 confrm			;now insure confirmation
	ret			;flag bits are now all set
	subttl	generate the sequence of spr numbers

;on entry t1 contains the last one gotten
; or 0 for the first time
;skip return with next in t1, or ret when none left in seletion group
getseq:	txnn	f,f.one		;just wanted one?
	 jrst	get.1		;not so easy
	move	t1,lastn	;yup - thats easy
	cail	t1,1		;too smalll
	caile	t1,sprmax	;or too big?
	 ret			;yes - error return
	setzm	lastn		;dont allow next time
	callret	check		;check it out and return true/false
get.1:	call	getone		;try for the first one
	 ret			;non-skip when selection group empty
	call	check		;got a good one?
	 jrst	getseq		;not valid, try next
	txnn	f,f.las		;looking for last n only?
	 retskp			;no - so we're ok
	sosge	lastn		;yes - decrement count and see if ran out
	 ret			;just ran out of lastn's
	retskp			;no - good return with numbe in t1
	subttl get the next spr in the selection group

getone:	skipn	t1		;0 is first time through
	 jrst	firstm		;special case
	txnn	f,f.rvs		;reverse order?
	 aosa	t1		;no, increment
	sos	t1		;reverse - decrement
	caile	t1,0		;too small?
	 caile	t1,sprmax	;or too big?
	  ret			;either is error return
	retskp			;otherwise we win

firstm:	skipn	t1,sprmax	;any in at all?
	 ret			;no - return 0
	txnn	f,f.rvs		;reverse scan?
	 movei	t1,1		;no - start with 1 instead
	retskp			;and return
	subttl	check the spr named in t1

;ret means does not meet criteria, retskp is good

check:	move	t2,t1		;get copy
	imuli	t2,6		;index into blocks
	skipn	sympag(t2)	;null pointers?
	 ret			;yes - return false
	txne	f,f.rev!f.unr!f.dis!f.und!f.las	;if no flags, return true
	txne	f,f.all		;want all of them?
	 retskp			;yes - so return true
	hlrz	t3,sympag+4(t2)	;get disposition pointer if it exists
	txnn	f,f.dis		;disposed only?
	 jrst	ch.1		;no - continue on
	skipe	t3		;dispose pointers?
	 retskp			;yes - return true
	ret			;no - return false
ch.1:	txnn	f,f.und!f.las	;undisposed only?
	 jrst	ch.2		;no - carry on
	skipe	t3		;dispose pointers?
	 ret			;yes - return false
	retskp			;no - return true
ch.2:	call	chkrev		;check for reviewed
	 skipa	t3,[0]		;0 means unreviewed
	  seto	t3,		;non-zero means reviewed
	txnn	f,f.rev		;want reviewed only?
	 jrst	ch.3		;no, skip some code
	skipe	t3		;any review pointers?
	 retskp			;yes - so return true
	ret			;return false
ch.3:	txnn	f,f.unr		;want unreviewed only?
	 jrst	ch.4		;no - skip on farther
	skipe	t3		;pointers exist to reviews?
	 ret			;yes - dont want this one
	retskp			;no - that makes a winner
ch.4:	tmsg	<error - selection routine entered with no selection criteria
>
	ret			;return false
	subttl	check to see if this spr has been reviewed

;return +1 if not, +2 if so
;assumes block pointer in t2

chkrev:	hrrz	t3,sympag+4(t2)		;get rev1 pointer
	skipn	sympag+5(t2)		;any rev2 or rev3 pointers?
	 skipe	t3			;or rev1?
	  retskp			;found a pointer
	ret
	subttl	no sprs selected by print/header/type command

none:	skiple	count		;positive count?
	 jrst	none.1		;yes...
	call	getdta		;[W3] do a default input
	ret
none.1:	tmsg	<
No SPRS meet the selection criteria.
>
	ret
	subttl	parsing tables and file/symbol table allocation

fldcnf:	flddb.	.cmcfm		;confirm block
fldseq:	flddb.	.cmkey,,seqtab,,,fldnum		;keyword or number
fldnum:	flddb.	.cmnum,,5+5		;just a number
fldsw:	flddb.	.cmswi,,swtab,,,fldcnf	;switch or confirm

seqtab:	numend-.-1,,numend-.-1
	t	ALL,%und		;[W3] undisposed sprs only
	t	COMPLETE,%all		;[W3] all sprs
	t	DISPOSED,%dis
	t	LAST,%las
	t	REVIEWED,%rev
;;	t	UNDISPOSED,%und		;[W3] now "ALL" command does this
	t	UNREVIEWED,%unr
	numend==.
swtab:	1,,1
	[asciz/REVERSE/],,0

	define	table <
	x DISPOSE,.dis
	x EXIT,.exi
	x HEADERS,.hea
	x INPUT,.inp
	x LIST,.lis			;[W3] list command
	x OUTPUT,.out
	x PRINT,.pri
	x QUIT,.exi
	x REVIEW,.rev
	x SUBMIT,.sub
	x TYPE,.typ
>
	define x (a,b) <
	xwd [asciz/a/],b
>
comtab:	xwd tabend-.-1,tabend-.-1
	table
	tabend==.

	loc 7000
ibuff:	block 1000		;input buffer

	sympg==20		;symbol table is pages 20-117
	sympag==20000

	filepg==120		;file goes to page 120-320 if need be

	loc 321000		;big page
obuff:	block 4000		;save 4 pages here

	end start