*DECK NVFOPHC
USETEXT TEXTNVF
USETEXT TEXTSS
USETEXT TXCMDNV
USETEXT TXTAPSS
PROC NVFOPHC;
# TITLE NVFOPHC - PROCESS HISTORY COMMAND #
BEGIN # NVFOPHC #
#
** NVFOPHC - PERFORM HISTORY COMMAND.
*
* A. LIM. 82/04/07.
*
* THIS PROCEDURE-S MAIN FUNCTION IS TO PERFORM A HOP HISTORY
* COMMAND. IT IS CALLED INTO EXECUTION BY:
* *NVFODHC* *NVFOAPE*
*
* PROC NVFOPHC
*
* ENTRY HOP HISTORY COMMAND IN *WCBUF[1]*, *HDRCMD[1]*, AND
* *PARMS[0]* WITH *WCBUF* DEFINED IN TEXTSS, AND
* *HDRCMD* AND *PARMS* DEFINED IN TXCMDNV.
*
* EXIT TERMINAL-TEXT LINES SENT TO CONNECTION-TRAFFIC-QUEUE
* *CTQ*.
*
* METHOD IF COMMAND IS "HISTORY,ALL", SEND THE ENTIRE HISTORY
* BUFFER TEXT LINES TO *CTQ*.
* IF COMMAND IS "HISTORY", SEND ONLY THE LAST PAGE OF
* HISTORY BUFFER TO *CTQ*
#
#
**** PROC NVFOPHC XREF LIST
#
XREF
BEGIN
PROC SSTAQE; # SS- ACCEPT A QUEUE ENTRY #
END
#
****
#
ITEM HPTR I; # HISTORY BUF PTR (PER CM WORD) #
ITEM I I; # LOOP INDUCTION VAR #
ITEM J I; # LOOP INDUCTION VAR #
ITEM NLINES I; # LOOP EXIT VAR #
# BLANKLN - A BLANK LINE. #
ARRAY BLANKLN[00:00] S(1);
BEGIN
ITEM BLK$BLANK C(00,00,08) = [" "];
ITEM BLK$ZERO U(00,48,12) = [0];
END
CONTROL EJECT;
WCB$WORD[1] = 0; # CLEAR WC WORD 1 #
ABHWORD[1] = 0; # CLEAR ABH WORD 1 #
ABHABT[1] = HOPTX$; # PRESET ABT TO HOP TEXT #
#
* IF HISTORY BUFFER EMPTY, SEND A NULL TEXT WITH INPUT ALLOW FLAG
* SET TO CONNECTION-TRAFFIC-QUEUE, AND QUIT.
#
IF HSBL EQ 0
THEN
BEGIN # HISTORY BUFFER EMPTY, SEND A NULL TEXT TO CTQ #
WCB$WC[1] = 2;
WCB$IAF[1] = TRUE; # SET INPUT-ALLOW-FLAG #
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],MSGBUF[0]);
RETURN; # EXIT #
END
# DETERMINE IF "HISTORY,ALL" OR "HISTORY" COMMAND #
IF HDR$SPCNT[1] GR 2
THEN
BEGIN # "HISTORY,ALL", SEND HEADERS #
WCB$WC[1] = SSBUILD$ + 2; # SEND NVF BUILD MSG #
SBD$ANAME[0] = "NVF ";
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],SBUILD[0]);
WCB$WORD[1] = 0; # CLEAR WC WORD 1 #
WCB$WC[1] = LCFVRN$ + 2; # SEND LCF VERSION MSG #
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],LCFVRN[0]);
WCB$WORD[1] = 0;
WCB$WC[1] = 3; # SEND A BLANK LINE #
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],BLANKLN[0]);
HPTR = 0; # SET HIS-BUF PTR TO BEGINNING OF BUF #
END
ELSE
BEGIN # "HISTORY" #
IF HSBCNT LQ LEFTPL
THEN
HPTR = 0; # H-BUF CONTAINS ONLY 1 PAGE OR LESS LINES#
ELSE
BEGIN # MORE THAN 1 PAGE #
NLINES = 0;
FOR HPTR = HSBL-1 STEP -1 WHILE (NLINES LQ LEFTPL)
DO
BEGIN # SKIP BACKWARD LEFTPL LINES #
IF HSB$ZERO[HPTR] EQ 0
THEN
NLINES = NLINES + 1; # END OF A LINE #
END
HPTR = HPTR + 2; # ADJUST HPTR #
END
END
J = 0;
WCB$WORD[1] = 0;
FOR I = HPTR STEP 1 WHILE I LS HSBL
DO
BEGIN # PROCESS ALL LINES IN H-BUF #
MSG$WORD[J] = HSB$WORD[I]; # MOVE 1 WORD FR H-BUF TO M-BUF #
J = J + 1; # INCREMENT INDEX #
WCB$WC[1] = WCB$WC[1] + 1; # INCREMENT WC COUNT #
IF HSB$ZERO[I] EQ 0
THEN
BEGIN # END OF LINE #
IF I EQ HSBL - 1
THEN
BEGIN # LAST LINE #
WCB$IAF[1] = TRUE; # SET IAF TRUE #
END
WCB$WC[1] = WCB$WC[1] + 2; # ADD WC AND ABH WORDS #
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],MSGBUF[0]); # SEND TEXT #
J = 0; # RESET INDEX #
WCB$WORD[1] = 0; # CLEAR WC WORD #
END
END
END # NVFOPHC #
TERM