Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/dapmac.req
There are 6 other files named dapmac.req in the archive. Click here to see a list.
!DAPMAC.REQ -- System Independant Macros for DAP,FAL,REMJOB,LOCJOB...

!THIS_IS[DAPM]	VERSION[1]	EDIT[5]		DATE[6,FEB,78]

MACRO	GET_BYTE=
		BEGIN
		EXTD(XBIN);
		MAP NB: REF NDB;
		XBIN(.NB)		!Get the next message character
		END %,
	GET_2BYTE=(LOCAL T;T=GET_BYTE AND %O'377';
		T=.T+((GET_BYTE AND %O'377')*%O'400');.T) %,
		!GET_2BYTE gets a 2 byte field & returns it as its value
	GET_18BYTE(B)=	BEGIN
			EXTD(XBIN);
			LOCAL PTR;
			PTR=CH$PTR(B);
			DECR I FROM 17 TO 0 DO CH$WCHAR_A(XBIN(.NB),PTR);
			END%,
	GET_HDR=
			BEGIN
			EXTD(MGETHDR);

			%IF %DECLARED(MTYPE)
			%THEN MTYPE= %FI MGETHDR(.NB)
			END
%,
%(
	N(X)=NB[%NAME(NDB$,X)] %,	!N[FOO] becomes NB[NDB$FOO]
	F(X)=FB[%NAME(FILE$,X)] %,	!F[FOO] becomes FB[FILE$FOO]
					! referencing file block: .N[FB]
)%

	N(X)=%IF %DECLARED(%NAME(NDB$,X)) %THEN NB[%NAME(NDB$,X)]
	%ELSE %IF %DECLARED(%NAME(FILE$,X)) %THEN NB[%NAME(FILE$,X)]
	%ELSE 0 %QUOTE %ERRORMACRO('Undeclared FIELD NDB$',X) %FI%FI%,

	F(X)=%IF %DECLARED(%NAME(FILE$,X)) %THEN FB[%NAME(FILE$,X)]
	%ELSE 0 %QUOTE %ERRORMACRO('Undeclared FIELD FILE$',X) %FI%,

	GETEX(ADDR,LEN)=(EXTD(MGETEX);MGETEX(.NB,CH$PTR(ADDR,0,9),LEN))%,

	GETVAR(ADDR,LEN,SIZ)=	!Convert variable-length field to ASCIZ
		BEGIN
		EXTD(MGETVAR);
		MGETVAR(.NB,LEN,CH$PTR(ADDR,0,
				%IF %NULL(SIZ) %THEN CH$SIZE() %ELSE SIZ %FI))
		END%,
	GETVC(ADDR,LEN,SIZ)=	!Copy a variable-length field including count
		BEGIN
		EXTD(MGETVC);
		MGETVC(.NB,LEN,CH$PTR(ADDR,0,
				%IF %NULL(SIZ) %THEN 8 %ELSE SIZ %FI))
		END%,
	ACKNOWLEDGE=	BEGIN
			EXTD(XMTMSG,XOUTPUT);
			XMTMSG(.NB,ACK_MESSAGE,2);
			XOUTPUT(.NB);
			END%,
	SEND_STATUS(MAC,MIC,STVAR)=
			BEGIN
			EXTD(XOUTPUT);
			PUT_BYTE(DAP_STS);	!Message type
			PUT_BYTE(0);		!0 flag word (never blocked)
			PUT_2BYTE((MAC)+(MIC));
			PUT_BYTE(0);		!0 RFA
			PUT_BYTE(0);		!0 RECNUM
			%IF %NULL(STVAR)
				%THEN PUT_BYTE(0);	!No STV field specified
				%ELSE PUTVAR(STVAR,8,8);!There was one, send it
				%FI
			XOUTPUT(.NB);
			END%,
	SET_EX_BITS[EXF]=(EXTD(SETEXB);SETEXB(EXF,%ALLOCATION(EXF)*4))%,
	PUT_BYTE(B)=(EXTD(XBOUT);XBOUT(.NB,B))%,
	PUT_2BYTE(B)	=BEGIN
			EXTD(XBOUT);			XBOUT(.NB,B);
			XBOUT(.NB,(B)^-8)
			END%,
	PUT_18BYTE(B)=	BEGIN
			EXTD(XBOUT);
			LOCAL PTR;
			PTR=CH$PTR(B);
			DECR I FROM 17 TO 0 DO XBOUT(.NB,CH$RCHAR_A(PTR))
			END%,
	PUTEX(FOO)=	BEGIN
			EXTD(XBOUT);
			LOCAL PTR,T;
			PTR=CH$PTR(FOO,0,9);
			DO XBOUT(.NB,(T=CH$RCHAR_A(PTR)))
				UNTIL (.T AND %O'200') EQL 0
			END%,
	PUTVAR(FOO,SIZ)=BEGIN
			LOCAL PTR;
			EXTD(XBOUT);
			PTR=CH$PTR(FOO,0,%IF %NULL(SIZ) %THEN 8 %ELSE SIZ %FI);
			DECR I FROM CH$RCHAR(.PTR) TO 0 DO
				XBOUT(.NB,CH$RCHAR_A(PTR))
			END%;