*DECK CSOGHL
USETEXT TEXTCS;
USETEXT TEXTSS;
USETEXT TXTSMCS;
USETEXT TXTSUSS;
USETEXT TXTAPSS;
USETEXT TXCMDCS;
PROC CSOGHL;
# TITLE CSOGHL - GENERATE HISTORY LINES #
BEGIN # CSOGHL #
#
** CSOGHL - GENERATE HISTORY LINES.
*
* C. BRION 82/05/24.
*
* THIS PROCEDURE GENERATES THE HISTORY LINES TO AN OPERATOR.
* THE HISTORY REQUEST QUEUE IS NON-EMPTY ON ENTRY.
*
* PROC CSOGHL
*
* ENTRY
* ENTRIES IN THE HISTORY REQUEST QUEUE.
*
* EXIT
* CONTENTS OF THE HISTORY BUFFER IN THE FORM OF TERMINAL TEXT
* TO THE CONNECTION TRAFFIC QUEUE.
*
#
#
**** PROC CSOGHL XREF LIST
#
XREF
BEGIN
PROC MOVE; # MOVE A BLOCK OF CM WORDS #
PROC SSBTBW; # TEST BIT IN WORD #
PROC SSTRQE; # SS-REMOVE QUEUE ENTRY #
PROC SSTAQE; # SS-ACCEPT QUEUE ENTRY #
END
#
****
#
#
* AGSWTCH - SWITCH LIST USED TO SELECT THE APPROPRIATE PARAGRAPH
* TO EXECUTE BASED ON THE AUDIENCE GROUP OF THE MESSAGE.
#
SWITCH AGSWTCH ENDCASE,
AUDGR1,
AUDGR2,
AUDGR3,
AUDGR4,
ENDCASE,
AUDGR6;
#
* PROC CSOGHL ITEMS
#
ITEM CSHSBLCNT; # HISTORY BUFFER LINE COUNT #
ITEM I;
ITEM BEGSPIX U; # ALL KEYWORD INDEX #
ITEM LITOPASS U; # LINES TO PASS #
ITEM LILOC U; # LINE PTR IN HISTORY BUFFER #
ITEM ALLON B; # ALL INDICATOR #
ITEM NLINES U; # LINE COUNTER #
ITEM MSGINDEX U; # INDEX INTO MSGBUF #
ITEM REPORT B; # REPORT FLAG #
ITEM DVAR U;
#
* BLINE - BLANK LINE MESSAGE ARRAY.
#
ARRAY BLINE [00:00] S(1);
BEGIN
ITEM BLI$TXT1 C(00,00,01) = [" "];
ITEM BLI$ZERO U(00,06,54) = [0];
END
#
* NCHDR - NCF VERSION HEADER FOR HISTORY,ALL CMD.
#
ARRAY NCHDR [00:00] S(3);
BEGIN
ITEM NCH$TXT C(00,00,04) = ["NCF "];
ITEM NCH$VER C(00,24,20);
ITEM NCH$ZERO U(02,24,36) = [0];
END
#
* PROC CSOGHL EXECUTION STARTS HERE.
#
#
* THE MAIN LOOP OF THIS PROC CONTINUES UNTIL THE HISTORY REQUEST
* QUEUE HAS BEEN EXHAUSTED.
#
FOR I = 0 STEP 1 WHILE HRQL NQ 0
DO
BEGIN
SSTRQE(P<HRQ>,WCBUF[0],HDRCMD[0],PARMS[0]);
#
* INITIALIZE THE OUTGOING TTEXT ENTRY AREAS.
#
WCB$WORD[1] = 0;
ABHWORD[1] = 0;
WCB$SMID[1] = SMID"TTEXT";
WCB$IAF[1] = FALSE;
WCB$HAF[1] = FALSE;
ABHADR[1] = HDR$OPORD[0];
#
* THE STATE OF THE CONNECTION TO THE OPERATOR MUST BE ACTIVE FOR
* THE HISTORY REQUEST TO BE PROCESSED.
#
IF OC$STATE[HDR$OPORD[0]]
THEN
BEGIN
#
* CHECK IF HISTORY BUFFER EMPTY. IF SO, SIMPLY GENERATE A NULL
* TTEXT ENTRY TO CAUSE THE READY.. MESSAGE TO OPERATOR.
#
IF HBFQL EQ 0
THEN
BEGIN
WCB$WC[1] = 2;
WCB$IAF[1] = TRUE;
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],CSSM[1]);
GOTO ENDEXIT;
END
#
* THE OCB IS STILL ACTIVE. CHECK IF AN HISTORY, ALL REQUEST BY THE
* PRESENCE OF THE ALL KEYWORD. IF ALL REQUEST, SET UP TO ISSUE THE
* ENTIRE BUFFER.
#
CSHSBLCNT = HBFQL / HBFESIZ$;
BEGSPIX = HDR$TXWCNT[0] + 1; # SET ALL INDEX LOCATION #
ALLON = FALSE;
IF PAR$PCODE[BEGSPIX] EQ "ALL"
THEN
BEGIN
LITOPASS = CSHSBLCNT; # SET FOR ALL LINES TO GO #
LILOC = 0;
ALLON = TRUE;
END
ELSE
#
* JUST HISTORY COMMAND. SET UP TO ISSUE LAST PAGE OF BUFFER TO
* THE OPERATOR BASED ON THE PAGE LENGTH. IT IS POSSIBLE THAT
* THE BUFFER DOES NOT CONTAIN MORE LINES THAN PAGE LENGTH SO
* THEN SET UP AS IF ALL REQUEST EXCEPT FOR HEADER.
#
BEGIN
IF OC$PL[HDR$OPORD[0]] EQ 0 # NO PAGE LENGTH DEFINED #
THEN
LITOPASS = DEFPL$; # USE DEFAULT #
ELSE
LITOPASS = OC$PL[HDR$OPORD[0]];
IF LITOPASS GR CSHSBLCNT # HSB LESS THAN PL #
THEN
BEGIN
LITOPASS = CSHSBLCNT;
END
END # IF ALL #
#
* BEGINNING WITH THE LAST ENTRY IN THE HISTORY BUFFER QUEUE, SELECT
* THE PARAGRAPH TO APPLY BASED ON AUDIENCE GROUP. DO THE UNTIL
* THE NUMBER OF LINES TO SEND TO THE OPERATOR IS REACHED OR THE
* ENTIRE HISTORY BUFFER IS SCANNED.
#
NLINES = 0;
FOR I=CSHSBLCNT STEP -1 WHILE NLINES LS LITOPASS AND
I GR 0
DO
BEGIN
HBF$LFLG[I] = FALSE;
GOTO AGSWTCH[HBF$AGRP[I]];
#
* AUDIENCE GROUP ONE -- SET THE LIST FLAG AND INCREMENT THE SEND
* LINE COUNT.
#
AUDGR1:
HBF$LFLG[I] = TRUE;
NLINES = NLINES + 1;
GOTO ENDCASE;
# AUDIENCE GROUP TWO -- IF THIS OPERATOR IS NOT A DOP, THEN SET
* THE LIST FLAG AND INCREMENT THE SEND LINE COUNT.
#
AUDGR2:
IF OC$TYPE[HDR$OPORD[0]] NQ OPTYP"DOP"
THEN
BEGIN
HBF$LFLG[I] = TRUE;
NLINES = NLINES + 1;
END
GOTO ENDCASE;
#
* AUDIENCE GROUP THREE -- IF REPORT IS TO BE RECEIVED BY THIS
* OPERATOR, THEN SET THE LIST FLAG AND INCREMENT THE SEND LINE
* COUNT.
#
AUDGR3:
SSBTBW( NPU$RFLGS[HBF$NORD[I]] , HDR$OPORD[0] , REPORT );
IF REPORT
THEN
BEGIN
HBF$LFLG[I] = TRUE;
NLINES = NLINES + 1;
END
GOTO ENDCASE;
#
* AUDIENCE GROUP FOUR -- IF THIS OPERATOR IS THE HOP OR CONTROLLING
* NOP, THEN SET THE LIST FLAG AND INCREMENT THE SEND LINE COUNT.
#
AUDGR4:
IF HDR$OPORD[0] EQ HOPORD$ OR
HDR$OPORD[0] EQ NPU$CNOP[HBF$NORD[I]]
THEN
BEGIN
HBF$LFLG[I] = TRUE;
NLINES = NLINES + 1;
END
GOTO ENDCASE;
#
* AUDIENCE GROUP SIX -- IF THIS OPERATOR IS THE HOP, THEN SET
* THE LIST FLAG AND INCREMENT THE LINE COUNT.
#
AUDGR6:
IF HDR$OPORD[0] EQ HOPORD$
THEN
BEGIN
HBF$LFLG[I] = TRUE;
NLINES = NLINES + 1;
END
GOTO ENDCASE;
ENDCASE:
END # I LOOP #
#
* IF HISTORY ALL REQUEST, ISSUE HEADER TEXT FIRST.
#
IF ALLON
THEN
BEGIN
WCB$WC[1] = 6;
SBD$ANAME[0] = "CS "; # SET HDR PRG NAME #
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],SBUILD[0]);
WCB$WC[1] = 5;
NCH$VER[0] = CSNCFVER;
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],NCHDR[0]);
WCB$WC[1] = 3;
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],BLINE[0]);
END
#
* BEGINNING WITH THE FIRST HISTORY LINE TO SEND, SEND EACH LINE
* THAT HAS THE LIST FLAG SET UNTIL THE END OF THE HISTORY BUFFER.
#
WCB$WORD[1] = 0;
WCB$SMID[1] = SMID"TTEXT";
ABHWORD[1] = 0;
ABHADR[1] = HDR$OPORD[0];
FOR I=I+1 STEP 1 UNTIL CSHSBLCNT
DO
BEGIN
IF HBF$LFLG[I]
THEN
BEGIN
WCB$WC[1] = HBF$WC[I] + 2;
MOVE(HBF$WC[I],HBFQ[I],MSGBUF[1]);
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],MSGBUF[1]);
END
END
#
* SEND EMPTY TERMINAL TEXT WITH THE INPUT ALLOWED FLAG SET.
#
WCB$WORD[1] = 2;
WCB$SMID[1] = SMID"TTEXT";
WCB$IAF[1] = TRUE;
ABHWORD[1] = 0;
ABHADR[1] = HDR$OPORD[0];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],MSGBUF[1]);
END # IF OC$STATE #
END # FOR LOOP HRQL #
ENDEXIT:
DVAR = 1;
END # CSOGHL #
TERM