Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/libsim/ptyche.mac
There is 1 other file named ptyche.mac in the archive. Click here to see a list.
COMMENT * SIMULA specification;
OPTIONS(/E:QUICK,ptycheck);
INTEGER PROCEDURE ptycheck(ptyin,timelimit);
REF(Infile)ptyin; REAL timelimit;
COMMENT Returns JOBSTS if PTY can accept input or has output within
the time limit, otherwise zero.
Interpretation of returned value:
JB.UJA	8R400000 000000	(negative) Job number is assigned.
JB.ULI	8R200000 000000 Job is logged in.
JB.UML	8R100000 000000 TTY is at monitor level.
JB.UOA	8R040000 000000	TTY output is available.
JB.UDI	8R020000 000000	TTY at user level in input wait, or at monitor level
			and can accept a command.
JB.UJC	8R010000 000000 JACCT is set. In particular, ^C^C will not work.
JB.UJN	8R000000 777777	Job number or zero.
If 0<timelimit<0.001, ptycheck does not wait. If timelimit <=0, it waits
indefinitely.
;

!*;! MACRO-10 code !*;!

	TITLE	ptycheck
	ENTRY	ptycheck
	SUBTTL	SIMULA utility, Lars Enderin August 1977

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


	sall
	search	simmac,simmcr,simrpa
	macinit

	;! Local definitions ;!

qw==(HB.RPT) ;! Wake bits for HIBER

ptycheck:PROC
	L	X1,(XTAC)
	CAIN	X1,NONE
	 GOTO	 L7
	IFOFF	ZFIOPN(X1)
	 GOTO	 L7
	LF	,ZFICHN(X1)
	ST	X1
	DEVTYP
	 GOTO	 L7
	ANDI	TY.DEV
	CAIE	.TYPTY
	 GOTO	 L7
	SKIPG	X1,1(XTAC)
	SETZB	X1,1(XTAC)
	IF	;! small positive limit
		JUMPLE	X1,FALSE
		CAML	[1.0E-3]
		GOTO	FALSE
	THEN
		GOTO	L5
	FI
	SETO
	WAKE
	MOVSI	X1,qw
	HIBER	X1,	;! Clear wake conditions
	 GOTO	L7	;! Error
	L X1,(XTAC)
	LF X1,ZFICHN(X1)
	JOBSTS	X1,
	 GOTO	 L7
	TLNE	X1,(JB.UOA+JB.UDI)
	 GOTO	 L8
	L	1(XTAC)
	FMPRI	(1.0E3)	;! Convert to millisecs
	FIXR	X1,
	HRLI	X1,qw
	HIBER	X1,
	 GOTO	 L7
L5():!	L	X1,(XTAC)
	LF X1,ZFICHN(X1)
	JOBSTS	X1,
	 GOTO	 L7
	TLNN	X1,(JB.UOA+JB.UDI)
L7():!	 SETZ	 X1,
L8():!	ST	X1,(XTAC)
	RET
	EPROC
	LIT
	END;