perm filename FINDPR.MAC[SIM,SYS] blob sn#460059 filedate 1979-07-20 generic text, type T, neo UTF8
Comment * SIMULA specification;
OPTIONS(/E:CODE,findprintfile);
REF(Printfile)PROCEDURE findprintfile(filespec);
VALUE filespec; TEXT filespec;
COMMENT If a Printfile according to the specification can be opened,
then return a file ref, otherwise NONE;

! *;! MACRO-10 code *;!

	TITLE	findprintfile
	SUBTTL	SIMULA utility, Lars Enderin Oct 1975

;!*** Copyright 1975 by the Swedish Defence Research Institute. ***
;!*** Copying is allowed.					***

	ENTRY	findprintfile
	sall
	search	simmac,simmcr,simrpa
	macinit

	result==ZBI%S
	filespec==result+1

findprintfile:
	PROC
	EXEC	CPNE	;! Allocate a file object
	XWD	0,IOPF	;! Printfile prototype
	SETON	ZFIFND(XWAC1)	;! Flag special case
	LD	filespec(XCB)	;! Copy the parameter
	STD	OFFSET(ZFISPC)(XWAC1)
	EXEC	CSEN
	IF	;! No luck
		IFON	ZIFEND(XWAC1)
		GOTO	FALSE
	THEN	;! Close the channel etc
		EXEC	IOCL
	ELSE
		ST	XWAC1,result(XCB)
		SETOFF	ZFIFND(XWAC1)
	FI
	BRANCH	CSEP
	EPROC
	END;