Google
 

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

;	   -- Section --					   -- Page --
;
;  1.   Table of contents............................................. 1
;  2.	Macros and program storage.................................... 3
;  3.	CMD program blocks............................................ 4
;  4.	Start of main routine......................................... 5
;  5.	Exit command - leave the program.............................. 6
;  6.	Help command - type the following message..................... 6
;  7.	List command - list all available sysbuls..................... 7
;  8.	Type and Print commands....................................... 8
;  9.	Output routine for type and print............................. 9
;  10.	Delete and Enter commands..................................... 10
;  11.	Subroutines
;	  11.1   Sysbul output........................................ 11
;	  11.2   Wild card JFN handling subroutines................... 12
;	  11.3   General purpose...................................... 13
;
;		     (End of table of contents)
Title	SYSBUL - Program to list and read systems bulletins
Sall

Search	MACSYM,MONSYM,CMD
.Require SYS:MACREL		;general routines
.Require SYS:CMD		;command input routines

;Version information
Vmajor==1
Vminor==0
Vedit==102
Vcust==2
	PGVER.	(vmajor,vminor,vedit,vcust)

Comment	%
	Systems bulletins are created with RUNOFF and must start with
	a one-line synopsis of the bulletin.  The sysbul number and date
	are handled by the sysbul program and should not be included in
	the file.  The finished file will be renamed into the SYSBUL area
	as file SYSTEMS.BULLETIN.XX, where it will join other files with the
	same name and lower generation numbers.

	Written by DHB, 25-Jul-80
	%

;Accumulators
	A==1
	B==2
	C==3
	D==4
	Ff==5
	Sbn==6
	Jfn==7
	Rev==10
	Ojfn==11
	Jptr==12
	J==13
	P==17
Subttl	Macros and program storage
;Macro definitions

Define	crlf,<
	hrroi	a,[asciz\
\]
	psout	>

Define	Crtab,<
	hrrz	a,ojfn
	hrroi	b,[asciz\
	\]
	setz	c,
	sout		>

Define	Table,<
	xlist				;;don't expand
	setsec	DELETE,%dele		;;delete command (secret)
	setup	EXIT,%exit		;;exit command
	setup	HELP,%help		;;help message
	setup	LIST,%list		;;list sysbuls
	setsec	NEW,%new		;;enter command (secret)
	setup	PRINT,%prin		;;print a sysbul
	setup	TYPE,%type		;;type a sysbul
	list				;;resume normal listing mode
			>

Define	Setup(comand,dispat),<
	xwd	[asciz\comand\],dispat	;;command table entry
			>

Define	Setsec(comand,dispat),<
	xwd	[cm%fw!cm%inv
		asciz\comand\],dispat	;;secret command entry
			>

;Symbols
	Stksiz==50
	Strsiz==10

;Storage
	Array	String[strsiz]		;string storage
	Array	Stack[stksiz]		;push down stack
	Array	Jfnstk[stksiz]		;jfn stack
Subttl	CMD program blocks

Cmdstg				;cmd program storage

Comtab:	xwd	tabend-.-1,tabend-.-1	;tells length of table
	table			;invoke the macro
	tabend==.		;end of table

Keyfld:	flddb.	.cmkey,,alltab,,,numfld	;accept a keyword
Numfld:	flddb.	.cmnum,,12		;accept a number
Swtfld:	flddb.	.cmswi,,swttab,<Optional switch,>,,cmffld	;accept a switch
Cmffld:	flddb.	.cmcfm			;confirm

Alltab:	xwd	1,1		;one entry
	[asciz\ALL\],,0		;no dispatch address

Swttab:	xwd	2,2		;two switches
	[asciz\FORWARD\],,0	;forward order
	[asciz\REVERSE\],,-1	;reverse order

;Block for accepting an output spec with a default
Ospec:	fld(.cmofi,cm%fnc)!cm%dpp	;output file
	0
	0
	point	7,[asciz\LPT:SYSBUL.LST\]
	0
Subttl	Start of main routine

Sysbul:	reset			;clear everything
	move	p,[iowd stksiz,stack]	;set up the pdl
	call	cmdini##	;initialize the command scanner
	tmsg	<Systems bulletin review program -- type H for help>
	crlf

;Here to execute repeated commands
Nxtcmd:	move	j,[xwd -stksiz,jfnstk]	;set up the jfn stack
	setzm	jfnstk			;clear the jfn storage
	move	a,[jfnstk,,jfnstk+1]	;prepare for a blt
	blt	a,jfnstk+stksiz-1	;clear the memory
	hrroi	a,[asciz\Sysbul>\]	;the prompt
	seto	rev,			;assume reverse listing
	call	dpromp##	;prompt the user
	movei	a,[flddb. .cmkey,,comtab,<Command,>]
	call	rfield		;read the returned field
	hrrz	a,(b)		;get the dispatch address
	setz	ff,		;zero the form feed flag
	call	(a)		;and execute the command
	crlf			;type a crlf after last line
	seto	a,		;close all files
	closf
	 jshlt			;can't
	jrst	nxtcmd		;go do the next command
Subttl	Exit command - leave the program

%Exit:	noise	<from program>	;for user comsumption
	confrm			;get the carriage return
	seto	a,		;close all files
	closf			;do the close
	 jserr			;error closing files
	haltf			;halt this fork
	jrst	sysbul		;restart address


Subttl	Help command - type the following message

%Help:	noise	<with Sysbul program>
	confrm			;await crlf
	hrroi	a,[asciz \Sysbul commands:

	EXIT (from program)
	HELP (output this message to terminal)
	LIST (of all sysbul titles to terminal)
	TYPE (sysbul <number> to terminal)	(or TYPE ALL)
	PRINT (sysbul <number> to <filespec>)	(or PRINT ALL)
	      (default specification is LPT:SYSBUL.LST)
\]
	psout			;long literal - list in two parts
	hrroi	a,[asciz\
Switches available for LIST, TYPE ALL and PRINT ALL commands:
	/FORWARD to review sysbuls in chronological order
	/REVERSE to review them in reverse order  (default)
\]
	psout			;type the help message
	ret			;and return
Subttl	List command - list all available sysbuls

%List:	noise	<of all SYSBULs>	;tell user what's going on
	call	getswt		;check for a switch
	movx	a,.priou	;terminal output
	hrrz	ojfn,a		;save the jfn
	movx	b,fld(7,of%bsz)!of%app	;write 7bit bytes
	openf			;open the file
	 jshlt			;no good
	call	fstfil		;set up the first file
	 ret			;it wasn't there

;Now loop for all files
%Li.a:	call	header		;setup the sysbul
	call	synops		;type the synopsis
	call	newfil		;and get next jfn
	 ret			;no more left
	jrst	%li.a		;loop for more
Subttl	Type and Print commands

;Type command
%Type:	noise	<Sysbul number or "ALL">	;tell user if asked
	movei	a,keyfld	;accept a number or "all"
	call	rfield		;get field
	hrrzs	c		;get address of table used
	caie	c,numfld	;was a number returned?
	 setz	b,		;no, use 0 for keyword "all"
	movem	b,sbn		;store the number
	movx	a,.priou	;terminal output
	hrrz	ojfn,a		;save the jfn
	movx	b,fld(7,of%bsz)!of%app	;write 7bit bytes
	openf			;open the file
	 jshlt			;no good
	setz	ff,		;clear the form feed flag
	jrst	output		;go to common routine

;Print command
%Prin:	noise	<Sysbul number or "ALL">	;tell user
	movei	a,keyfld	;get number or keyword "all"
	call	rfield		;get field
	hrrzs	c		;get address of table used
	caie	c,numfld	;was a number input?
	 setz	b,		;no, use 0 for keyword "all"
	movem	b,sbn		;store the number
	noise	<to file>	;explanation of next field
	movei	a,ospec		;command block
	call	rfield		;get spec
	hrrz	ojfn,b		;save the jfn
	hrrz	a,b		;get the jfn of the output file
	movx	b,fld(7,of%bsz)!of%app	;allow append access
	openf			;open the file
	 jshlt			;no good
	seto	ff,		;plan for form feed before each sysbul
	jrst	output		;continue with common routine
Subttl	Output routine for type and print

Output:	jumpe	sbn,outall	;if 0, do all sysbuls
	confrm			;confirm the command
	movx	a,gj%old!gj%sht	;old file
	hrr	a,sbn		;generation number
	hrroi	b,[asciz \sysbul:systems.bulletin\]
	gtjfn			;get a jfn
	 erjmp	outerr		;not available
	movem	a,jfn		;save it
	call	header		;setup the header
	call	synops		;do the synopsis
	call	conten		;follow up with the rest
	ret			;and return

;Here if the specified file didn't exist
Outerr:	tmsg	<?No such systems bulletin>
	crlf			;cr follows
	ret			;return to try again
;Here if we want all sysbuls done

Outall:	call	getswt		;check for switches
	call	fstfil		;get first file
	 ret			;wasn't there
Outa.a:	call	header		;title line
	call	synops		;synopsis
	call	conten		;and the rest
	call	newfil		;get next jfn
	 ret			;no more
	jumpn	ff,outa.a	;printing?
	hrroi	a,[asciz \
		-------------------------------------

\]
	psout			;type seperator to terminal
	jrst	outa.a		;and loop
Subttl	Delete and Enter commands

;Note that these commands are "secret" - ie not listed on a "?".

%Dele:	noise	<Sysbul number>	;user info
	movei	a,[flddb. .cmnum,,12]	;get a number
	call	cfield		;get and confirm field
	move	sbn,b		;save the number
	call	chkusr		;see if legal
	 ret			;it isn't
	movx	a,gj%old!gj%sht	;old file
	hrr	a,sbn		;get generation number
	hrroi	b,[asciz\sysbul:systems.bulletin\]
	gtjfn			;get a jfn for it
	 erjmp	outerr		;can't
	hrrzs	a		;clear left half
	tlo	a,(df%exp)	;expunge the file
	delf			;delete the file
	 jshlt			;can't
	ret			;return

;Enter a new systems bulletin
%New:	noise	<filename of new bulletin>	;tell user
	movei	a,[flddb. .cmifi]	;existing file
	call	cfield		;get the jfn
	hrrz	ojfn,b		;save it
	call	chkusr		;legal user?
	 ret			;it isn't
	movx	a,gj%fou!gj%sht	;new generation flag
	hrroi	b,[asciz\sysbul:systems.bulletin\]
	gtjfn			;get a jfn
	 jshlt			;can't
	hrrz	b,a		;get new jfn into b
	hrrz	a,ojfn		;and old into a
	rnamf			;rename the file
	 jshlt			;can't
	ret			;return
Subttl	Subroutines -- Sysbul output

;Output the title line
Header:	jumpe	ff,head.a	;are we printing or typing?
	hrrz	a,ojfn		;get output jfn
	movei	b,.chffd	;yes, output a form feed
	bout			;at top of sysbul
Head.a:	hrrz	a,ojfn		;get output jfn
	fmsg	<Sysbul No.>	;first part
	hrrz	a,ojfn		;selected output jfn
	hrrz	b,jfn		;get jfn
	movx	c,fld(1,js%gen)!js%cdr!js%tbp	;specific file info
	jfns			;type generation and date
	hrrz	a,jfn		;get jfn again
	movx	b,fld(7,of%bsz)!of%rd	;seven bit byte input
	openf			;open the file
	 jshlt			;no good
	crtab			;generate cr and tab
	ret			;return to caller

;Synopsis routine
Synops:	hrrz	a,jfn		;get the jfn
	bin			;get a byte
	jumpe	b,r##		;null means eof
	move	a,ojfn		;get output designator
	bout			;and print the byte
	cain	b,12		;line feed?
	 ret			;yes, do next
	jrst	synops		;and loop

;Contents printing routine
Conten:	hrrz	a,jfn		;get jfn
	bin			;get a byte
	jumpe	b,r##		;return when eof
	hrrz	a,ojfn		;output jfn
	bout			;output the byte
	jrst	conten		;and loop
Subttl	Subroutines -- Wild card JFN handling subroutines

;Initialize the first file
Fstfil:	movx	a,gj%old!gj%ifg!gj%sht!	;get first of many generations
	hrri	a,-3		;indicates first generation
	hrroi	b,[asciz \sysbul:systems.bulletin.*\]
	gtjfn			;get a jfn
	 ret			;can't
	movem	a,jfn		;save it
	jrst	fst.b		;join main stream

Fst.a:	gnjfn			;get next jfn
	 jrst	fst.c		;no more
Fst.b:	hrroi	a,string	;address of string
	hrrz	b,jfn		;jfn
	move	c,[fld(.jsaof,js%gen)!js%siz!js%tbp]
	jfns			;get generation
	hrroi	a,string	;string address back
	movei	c,12		;radix 10
	nin			;get number into b
	 jshlt			;can't
	push	j,b		;stack the generation number
	move	a,jfn		;get wildcard flags back
	jrst	fst.a		;loop until done

;Here when all sysbuls have stacked generation numbers
Fst.c:	movei	jptr,jfnstk+1	;address of first
	skipe	rev		;or do we want last instead?
	 hrrz	jptr,j		;get address of last
	jrst	newjfn		;get the jfn and return success

;Newfile routine - here to obtain next stacked jfn
Newfil:	hrrz	a,jfn		;get the current jfn
	closf			;close the file
	 jfcl			;don't worry about errors here
	addi	jptr,1		;assume forward order
	skipe	rev		;but check for reverse
	 subi	jptr,2		;it's reverse - go backwards

;Here to assign the jfn
Newjfn:	hrrz	a,(jptr)	;get the generation number
	jumpe	a,r##		;end of list if blank
	hrli	a,(gj%sht!gj%old)	;file flags
	hrroi	b,[asciz\sysbul:systems.bulletin\]
	gtjfn			;get the jfn
	 jshlt			;can't
	movem	a,jfn		;save the jfn
	retskp			;more to go
Subttl	Subroutines -- General purpose

;Check user subroutine
Chkusr:	gjinf			;get directory number in b
	hrroi	a,string	;where to write the info
	dirst			;translate number to string
	 jshlt			;no good
	hrroi	b,string	;base pointer
	hrroi	a,[asciz \PS:<SST.\]	;test pointer
	stcmp			;compare the strings
	txne	a,sc%sub	;is test string a subset of base?
	retskp			;yes, we're legal
	tmsg	<?Not privileged to enter or delete sysbuls>
	ret

;Getswt routine - check for switches on command lines
Getswt:	movei	a,swtfld	;field says switch or confirm
	call	rfield		;get the field
	hrrzs	c		;address of table used
	cain	c,swtfld	;was there actually a switch?
	 hrrz	rev,(b)		;yes, load the appropriate value
	txnn	a,cm%eoc	;was the line ended?
	 confrm			;nope, do it
	ret			;and return


;End of program
	end	Sysbul