Google
 

Trailing-Edge - PDP-10 Archives - AP-D471B-SB_1978 - son.bli
There are no other files named son.bli in the archive.
!***COPYRIGHT (C) 1974, 1975, 1976, 1977 DIGITAL EQUIPMENT CORP., MAYNARD, MASS.***
MODULE SON(RESERVE(#11, #12, #13, #14), SREG = #17, FREG = #16,
 DREGS = 4, VREG = #15, MLIST, TIMER = EXTERNAL(SIX12), FSAVE , ENTRIES=(SON)) = 
    BEGIN
	REQUIRE	 DATA.BLI;			! EVERYONE NEEDS THIS

COMMENT;

!SPECIAL.BLI
!======= ===

! LAST MODIFIED:	13 SEPT 76  BY  CDO

	EXTERNAL
		SONLEAF,
		KILGROUP,
		FINDPORT,
		UNDEFER,
		GETREQUEST,
		MAKEMSG,
		SKIPCHUNKS,
		MAKEBP,
		COMPARE,
		MOVE,
		MONSON,
		RUNMSW,
		OUTMSG;
COMMENT;

! ROUTINE SON
! ======= ===

! THIS ROUTINE SIGNS ON A TERMINAL...

GLOBAL ROUTINE SON =
    BEGIN
	MACRO NEXTCHAR = BEGIN
				LABEL LOOP;
				LOOP: BEGIN
					WHILE ( CHARLEFT _ .CHARLEFT - 1 ) LSS 0 DO	! IF NO CHARACTERS LEFT
					    BEGIN
						IF ( MSGCHUNKS _ .MSGCHUNKS[C0LINK]) EQL 0 THEN
							LEAVE LOOP WITH CHAR _ 0;
						BPIN<RH> _ MSGCHUNKS[C0DATA];
						BPIN<POS> _ 36;
						CHARLEFT _ .MSGCHUNKS[C0BCNT]
					    END;
					CHAR _ SCANI(BPIN);
					IF .CHAR GEQ #141 AND .CHAR LEQ #172 THEN CHAR _ .CHAR - #40;
					IF (MAXCHAR _ .MAXCHAR - 1) LSS 0 THEN CHAR _ 0
				    END
			END$;
	MACRO STORECHAR = (REPLACEI(BPOUT, .CHAR))$;
	REGISTER
		BPIN,
		BPOUT,
		CHAR,
		MAXCHAR;

	LOCAL
		ASCTERM[SRCNAMLEN],
		SRCPTR,
		MSGCHUNKS,
		GHPTR,
		UDX,
		CHARLEFT,
		PORTADDR,
		OUTOK;

	LABEL	L1;

	MAP	FORMAT GHPTR;
	MAP	FORMAT SRCPTR;
	MAP	FORMAT PORTADDR;
	MAP	FORMAT MSGCHUNKS;

	IF (GHPTR _ GETREQUEST(SONLEAF)) EQL 0 THEN RETURN;

	IF .GHPTR[G0TYPEOFSENDER] EQL LEAFTYPE THEN RETURN;

	SRCPTR _ .GHPTR[G0SENDER];			! GET THE SENDER

	PORTADDR _ FINDPORT(UDX_.SRCPTR[S0PORTPTR]);	! GET PORT ADDRESS

	OUTOK _ FALSE;					! ASSUME THE WORST... DON'T SEND DEFERRED MESSAGES
	RUNMSW _ -1;					! START THE OUTPUT PROCESS IN CASE

	IF .PORTADDR[PT0SRCPTR] NEQ 0 THEN
		MSGCHUNKS _ MAKEMSG( PAZ 'YOU ARE ALREADY SIGNED ON AS TERMINAL:%0A%?M?J@',
			SRCPTR[S0ID],0,0,0,0)
	ELSE BEGIN
			SRCPTR _ .GHPTR[G0FMHPTR];	!USE SRCPTR AS A TEMP
			MSGCHUNKS _ .SRCPTR[M0INCHNK];	!STEP TO FIRST CHUNK OF TRANSACTION
			BPOUT _ ASCTERM<36,7>;
			MOVE(0,ASCTERM,SRCNAMLEN);
			IF ( MSGCHUNKS _ SKIPCHUNKS(.MSGCHUNKS,.SRCPTR[M0SOT],FALSE) ) NEQ 0 THEN
			  BEGIN
				CHARLEFT _ .MSGCHUNKS<LH>;
				BPIN _ MAKEBP(.MSGCHUNKS,.CHARLEFT);
				MAXCHAR _ SRCNAMCHR;
				CHARLEFT _ .MSGCHUNKS[C0BCNT] - .CHARLEFT;
				DO NEXTCHAR WHILE .CHAR EQL SPACECHAR OR .CHAR EQL TABCHAR;
				WHILE (.CHAR GEQ #101 AND .CHAR LEQ #132) OR
				  (.CHAR GEQ #60 AND .CHAR LEQ #71) DO
					BEGIN
					  STORECHAR;
					  NEXTCHAR;
					END;
			  END;
			SRCPTR _ .SRCTAB + 1;
		L1:	WHILE @@SRCPTR NEQ 0 DO IF COMPARE(ASCTERM,SRCPTR[S0ID],SRCNAMLEN) THEN
			 BEGIN
			   MSGCHUNKS _ .PORTTAB;
			   WHILE @@MSGCHUNKS NEQ 0 DO IF .MSGCHUNKS[PT0SRCPTR] EQL .SRCPTR THEN
			    LEAVE L1 WITH MSGCHUNKS_MAKEMSG(PAZ 'THAT TERMINAL IS ALREADY SIGNED ON?M?J@',0,0,0,0,0)
			    ELSE MSGCHUNKS _ .MSGCHUNKS + PT0SIZE;

			   SRCPTR[S0PORTPTR] _ .PORTADDR[PT0UDX];
			   PORTADDR[PT0SRCPTR] _ .SRCPTR;	! SIGN IT ON
			   OUTOK _ TRUE;			! SEND SOME DEFERRED MESSAGES IF SYSADM WANTS US TO
			   IF .MONSON THEN INFORM(PAZ '[MCSSON PORT %1S% signing on to TERMINAL %0A%]@',
				SRCPTR[S0ID],.PORTADDR[PT0NAMEW],0,0,0);
			   LEAVE L1 WITH MSGCHUNKS _ MAKEMSG( PAZ '%Z%?M?JSIGN ON CONFIRMED AS TERMINAL:%0A%?M?J@',
				SRCPTR[S0ID],0,0,0,0);
			 END
			 ELSE SRCPTR _ .SRCPTR + .S0SIZE;
			IF @@SRCPTR EQL 0 THEN MSGCHUNKS_MAKEMSG(PAZ 'UNKNOWN TERMINAL:%0A%?M?J@',
							ASCTERM<36,7>,0,0,0,0);
	     END;

	! IN ANY CASE DELETE THE GROUP
	KILGROUP(.GHPTR, -1);

	! SEND THE APPROPRIATE MESSAGE
	OUTMSG(.MSGCHUNKS,.UDX,FALSE,FALSE);

	! UNDEFER SOME MESSAGES?
	! ONLY IF GOOD SIGNON AND THE SYSTEM ADMINISTRATOR WANTS US TO
	IF .SDMO GTR 0 AND .OUTOK THEN UNDEFER( .SRCPTR, .SDMO);

	! ALL DONE

    END;



    END;				! END OF SON