Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/gethdr.b36
There are no other files named gethdr.b36 in the archive.
MODULE GETHDR=
!Special instructions: Compile with /VARIANT:8 if using image mode throughout
! on TOPS-10.  This will skip any null bytes trailing the end of a message
BEGIN
LIBRARY 'DAPLIB';
REQUIRE 'INTR.REQ';

FORWARD ROUTINE
MGETHDR;

GLOBAL ROUTINE MGETHDR(NB)=
!Get the DAP message header for the next message
!Argument: NB addr of NDB
!Returns:  DAP message type
		BEGIN
		MAP NB:REF NDB;
		EXTD(XINPUT);
		LOCAL MFLAGS: EX[1];
		LOCAL MTYPE;	!This will be returned as the value

		CLEARV(MFLAGS);
		IF .N[NSPMLENGTH] LEQ 0 THEN XINPUT(.NB);
		!Get new buffer if needed (do it here to avoid DAPEOM)
%IF (%VARIANT AND 8) NEQ 0
	%THEN	WHILE (MTYPE=GET_BYTE) EQL 0 DO
		IF .N[NSPMLENGTH] LEQ 0 THEN XINPUT(.NB);
		!Get new buffer if needed (do it here to avoid DAPEOM)

	%ELSE	MTYPE=GET_BYTE;	!Message type
	%FI
		GETEX(MFLAGS,1);!Flags for length field, etc
		N[MFLAG_STM]=.MFLAGS[MFLAGS_STREAMID];
		N[MFLAG_LEN]=.MFLAGS[MFLAGS_LENGTH];
		IF .MFLAGS[MFLAGS_LENGTH]
			THEN N[MLENGTH]=GET_BYTE
			ELSE N[MLENGTH]=.N[NSPMLENGTH]+.INOEOR(NB);
		.MTYPE	!Returned as value
		END;

END ELUDOM