PROCEDURE	<SPLFIL -- Spool output files>,010000
;+
; Copyright (c) not at all
; Clinical Computing Facility
; Duke University Medical Center
;
; Runoff output spooling for IAS V3.0 or later,
;			     RSX-11M V3.1 or later.
;
; Abstract:	This module performs the output spooling for
;		IAS or RSX-11M. If on IAS, then the features 
;		of the IAS spooler are used and the following
;		switches /NOBA.
;
; Written: 12-Jan-80, -1.0.0-, Henry R. Tumblin
;
; Modified:
;
; Verified: 12-Jan-80, -1.0.0-, Henry R. Tumblin
;-

	.sbttl	Mcalls and other definitions
 
	.MCALL	SAVE,UNSAVE,CLOSE$

	.IF	DF	I$$AS
	.MCALL	SPRSY$,PRINT$
	.IFF
	.MCALL	PRINT$
	.ENDC	;R$$11M

 
	.GLOBL	ALLOC			; Free space allocator
	.GLOBL	FREE			; Return buffer to pool
	.GLOBL	LSTBLK			; Output file FDB
	.GLOBL	SPLFIL			; Module entry point
	.GLOBL	TOCBLK			; TOC file FDB

	.SBTTL	SPLFIL -- Spool output file to printer
 
	CODE	SPLFIL

SPLFIL:	SAVE	R0,R1,R2,R3,R4,R5 ; Save registers

	BITEQ	#SPLSW,$TOCSW,10$	; spool toc ?
	PRINT$	#TOCBLK			; Spool file
	BR	20$
10$:	CLOSE$	#TOCBLK			; Close TOC file

20$:	BITEQ	#SPLSW,$OUSW,30$	; spool doc ?
	PRINT$	#LSTBLK
	BR	40$
30$:	CLOSE$	#LSTBLK			; Close LST file

40$:	UNSAVE	R0,R1,R2,R3,R4,R5 ; Restore registers
	RETURN			; Return to caller

	.END
