perm filename SAIPRN.FAI[S,AIL]1 blob sn#100438 filedate 1974-05-05 generic text, type T, neo UTF8
COMPIL(PRN,<$PRINT,$$PRIN>,<GOGTAB,X33,OUT,OUTSTR>,<STRING PRINTING ROUTINE>)
BEGIN STRPRN
UROUTB ←← 400000		; IF ON THEN JRST (CTRL)
RTNSTR ←← 200000		; IF ON THEN RETURN(S) ELSE RETURN (NULL)
TTYYES ←← 100000		; IF ON THEN ALWAYS DO OUTSTR
TTYNOT ←← 040000		; IF ON THEN DONT OUTSTR UNLESS TTYYES ON
CHNSPC ←← 020000		; IF ON THEN RH(CTRL) IS CHANNEL (OR JFN)
CHNNOT ←← 010000		; IF ON THEN DO NOT PUT OUT ANYTHING ON DEFAULT
HEREFK($$PRIN,$$PRI.)
	TDZA	A,A
HEREFK($PRINT,$PRIN.)
	MOVEI	A,1
	MOVE	C,-1(P)		;CONTROL BITS
	MOVE	USER,GOGTAB	;
	MOVE	B,PRNINF(USER)	;"DEFAULT" BITS
	JUMPE	A,SPRN.1	;CAME FROM STRPR1?
	TLNE	C,UROUTB	;USER ROUTINE?
	JRST	(C)		;YES
	TLNE	B,UROUTB	;USER SPEC ONE HERE?
	JRST	(B)		;YES
SPRN.1:			;STRPR1 COMES IN HERE
	TLNE	C,TTYYES	;DID HE DEMAND OUTSTR?
	JRST	.OSTRC		;YES
	TLNE	C,TTYNOT	;DID HE DEMAND NOT?
	JRST	SPRN.3		;YES
	TLNN	B,TTYNOT!TTYYES ;IS A DEFAULT ESTABLISHED?
	JSP	FF,PDFSET	;NO, DO SO
SPRN.2:	TLNN	B,TTYYES	;DOES HE WANT IT?
	JRST	SPRN.3		;NO
.OSTRC:	PUSH	SP,-1(SP)	;
	PUSH	SP,-1(SP)	;
	PUSHJ	P,OUTSTR	;OUTSTR(S);
SPRN.3:	TLNE	C,CHNSPC	;SPECIFIED CHANNEL?
	JSP	D,OUTFN		;OUT(SPEC CHAN,S);
	JUMP	(C)		;EFFECTIVE ADDRESS IS CHANNEL NO
SPRN.4:	TLNE	C,CHNNOT	;DID HE SAY THAT IS ALL?
	JRST	SPRN.5		;YES
	TLNN	B,CHNNOT!CHNSPC	;DEFAULTS SET YET?
	JSP	FF,PDFSET	;NOPE DO IT NOW
	TLNE	B,CHNSPC	;CHANNEL SPECIFIED NOW?
	JSP	D,OUTFN		;OUTPUT FUNCTION
	JUMP	(B)		;PASS CHANNEL NUMBER THIS WAY
SPRN.5:	TLNN	C,RTNSTR	;DID WE WANT S KEPT?
	SETZM	-1(SP)		;RETURN A NULL INSTEAD OF S
	SUB	P,X33		;RETURN
	JRST	@3(P)		;
OUTFN:	MOVEI	A,@(D)		;GET CHANNEL NUMBER
	PUSH	P,A		;PUSH IT
	PUSH	SP,-1(SP)	;
	PUSH	SP,-1(SP)	;COPY IS LIKELY FOOLISH
	PUSHJ	P,OUT		;
	JRST	1(D)		;RETURN --RELY ON OUT TO SAVE ACS
PDFSET:	ERR	<AUTOMATIC SETTING OF PRINT DEFAULTS NOT YET IMPLEMENTED.
WILL ASSUME TTY OUTPUT & NO FILES >,1
	HRLZI	B,TTYYES!CHNNOT
	MOVEM	PRNINF(USER)
	POPJ	P,
BEND STRPRN
ENDCOM(PRN)