*DECK NS$HHI
USETEXT COM$NS
USETEXT DEF$NS
USETEXT HIS$NS
USETEXT HOC$NS
USETEXT LIN$NS
PROC NS$HHI; # HISTORY DISPLAY COMMAND PROCESSOR #
# TITLE NS$HHI - HISTORY DISPLAY COMMAND PROCESSOR. #
BEGIN # NS$HHI #
#
** NS$HHI - HISTORY DISPLAY COMMAND PROCESSROR.
*
* J.C. LEE 1981
*
* THIS ROUTINE PROCESS THE HISTORY COMMAND.
*
* PROC NS$HHI
*
* ENTRY:
* NONE.
*
* EXIT:
* NONE.
*
* METHOD:
* IF COMMAND IS "HISTORY", SEND ONLY THE LAST PAGE OF
* HISTORY BUFFER TEXT LINES TO *KDB*.
* IF COMMAND IS "HISTORY,ALL", SEND THE ENTIRE HISTORY
* BUFFER TEXT LINES TO *KDB*.
*
#
$BEGIN
XREF
BEGIN
PROC NS$DBG; # TRACE CALL #
END
$END
XREF
BEGIN
PROC MOVEOK; # ALLOW TSB TO MOVE #
PROC NS$TKD; # TRANSFER DISPLAY DATA TO K DISPLAY BUFF #
PROC TSBINFO; # LOCATE TSB #
END
DEF HISDSPSIZE # MAX$PW - 1 #; # SIZE OF HISTORY DISPLAY #
ITEM DISLC U; # HISTORY DISPLAY LINE COUNT #
ITEM I I; # LOOP VARIABLE #
ITEM HISTFWA U; # FWA OF FIRST LINE OF HISTORY DISPLAY #
ITEM HISTLC U; # HISTORY DISPLAY LINE COUNT #
ITEM HISTWC U; # HISTORY DISPLAY WORD COUNT #
ITEM TSBFWA U; # TSB FWA #
ITEM TSBSIZE U; # TSB SIZE #
CONTROL EJECT;
$BEGIN
NS$DBG("HHI"); # TRACE CALL #
$END
TSBINFO(TSBSIZE,TSBFWA,HISTSBN); # LOCATE HISTORY BUFFER #
P<HIS$BUFFER> = TSBFWA; # FWA OF HISTORY BUFFER #
HISTLC = HIS$LC[0]; # HISTORY BUFFER LINE COUNT #
HISTWC = HIS$WC[0] - HIS$HDRWDL; # HISTORY LINES WORD COUNT #
HISTFWA = P<HIS$BUFFER> + HIS$HDRWDL; # FWA OF FIRST LINE #
IF HISTLC GR HISDSPSIZE # LINES EXCEED HISTORY PAGE SIZE #
AND CMD$WORD[PAR$ALL] EQ 0 # NOT HISTORY,ALL COMMAND #
THEN # DISPLAY ONLY THE MOST RECENT 30 LINES IN BUFFER #
BEGIN
IF CMD$WORD[PAR$CMD] EQ 0
THEN # DEFAULT HISTORY DISPLAY IN RESPONSE TO HOP/START #
DISLC = HISDSPSIZE; # HISTORY DISPLAY LINE COUNT #
ELSE # HISTORY COMMAND #
DISLC = HISDSPSIZE - 1;
HISTLC = 0; # RESET LINE COUNT #
P<LIN$HEADER> = 0;
FOR I=P<HIS$BUFFER>+HISTWC STEP -1 WHILE HISTLC LS DISLC
DO # SCAN HISTORY BUFFER BACKWARD 30 LINES #
BEGIN
IF LIN$ID[I] EQ LIN$IDENT
THEN # A LINE HEADER FOUND #
HISTLC = HISTLC + 1; # INCREMENT LINE COUNT #
END
HISTFWA = I + 1; # FWA OF FIRST HISTORY LINE TO DISPLAY #
HISTWC = P<HIS$BUFFER> + HISTWC - I; # DISPLAY WORD COUNT #
END
DCW$F$HIS[0] = TRUE; # SET DISPLAY ASSIGNED TO HISTORY DISPLAY #
P<HIS$BUFFER> = HISTFWA; # FWA OF FIRST LINE TO DISPLAY #
NS$TKD(HIS$BUFFER,HISTWC,HISTLC); # SEND DISPLAY TO KDB #
MOVEOK(HISTSBN); # ALLOW HISTORY BUFFER TO MOVE #
RETURN;
END # NS$HHI #
TERM