*DECK NP$PUTF
USETEXT AIPDEF
USETEXT NP$GETS
USETEXT NP$NWL
USETEXT NP$PUTS
USETEXT NP$TAA
PROC NP$PUTF;
*IF DEF,IMS
#
*1DC NP$PUTF
*
* 1. PROC NAME AUTHOR DATE
* NP$PUTF J.C. LEE 78/10/10
*
* 2. FUNCTIONAL DESCRIPTION
* THIS ROUTINE IS CALLED BY NP$PUT TO BUILD A PUTF REQUEST IN
* THE WORKLIST AND SEND THE WORKLIST TO NIP WHEN APPROPRIATE.
*
* 3. METHOD USED
* FORMAT A NETPUTF ENTRY IN THE WORKLIST. THERE ARE THREE CASES:
* CASE 1: THE MESSAGE TEXT FITS IN THE WORKLIST - A NETPUT
* REQUEST IS FORMATTED IN THE WORKLIST. THE MESSAGE TEXT IS
* COPIED FROM THE TEXT AREAS TO THE WORKLIST. THE WORKLIST NEED
* ONLY BE SENT TO NIP IF IT IS FULL OR IF THE MESSAGE IS A
* SUPERVISORY MESSAGE.
* CASE 2: THE MESSAGE TEXT DOES NOT FIT INTO THE WORKLIST BUT
* TAA (TEXT AREA ARRAY) DOES - A NETPUTF ENTRY IS FORMATTED IN
* THE WORKLIST WITH A NONZERO TAA. THE TEXT ARRAY IS COPIED
* TO THE WORKLIST. THE WORKLIST IS THEN SENT TO NIP.
* CASE 3: NEITHER THE MESSAGE TEXT NOR THE TEXT AREA ARRAY
* CAN FIT INTO THE WORKLIST - A NETPUTF ENTRY IS FORMATTED IN
* THE WORKLIST WITH NONZERO TA AND TAA. THE WORKLIST IS THEN
* SENT TO NIP.
*
* 4. ENTRY CONDITIONS
* ACLN - NUMBER OF FRAGMENTED BUFFERS
* LOC$HA - ADDRESS OF HEADER AREA
* LOC$TA - ADDRESS OF TEXT AREA ARRAY
* NEXT - NEXT AVAILABLE SPACE POINTER IN WORKLIST
* SPACE$LEFT - NUMBER OF AVAILBLE WORKLIST CELLS
*
* 5. EXIT CONDITIONS
* NEXT - UPDATED TO NEXT AVAILABLE SPACE POINTER IF NWL NOT SENT
* SPACE$LEFT - NUMBER OF WORKLIST CELLS AVAILABLE IF NWL NOT SENT
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* AIPDEF NP$CRT NP$GETS NP$NWL
* NP$PUTS NP$TAA
*
* 7. ROUTINES CALLED
* NONE
*
* 8. DAYFILE MESSAGES
* NONE
*
#
*ENDIF
BEGIN
*CALL NP$CRT
#
LOCAL VARIABLES
#
ITEM
K I, # TEMPORARY VARIBLE #
L I, # TEMPORARY VARIABLE #
NAA I, # SET TO NO OF FRAGMENTS #
WR I; # WORDS REMAINING IN TEXT #
BASED ARRAY MEM P(1);
ITEM MEMWORD I;
#**********************************************************************#
#
NP$PUTF EXECUTION BEGINS HERE
#
NAA = ACLN; # NO OF FRAGMENTED BUFFERS #
IF NAA GR MAXNA OR NAA LQ 0
THEN
NAA = MAXNA + 1; # NIP WILL SEND ERR/LGL #
IF TLW LQ (SPACE$LEFT - GMMESIZE - NXTSIZE) AND (NAA LQ MAXNA)
THEN
BEGIN # ROOM FOR OP, ABH, TEXT, GSM #
J = NEXT + OPABHSIZ; # BEGINNING ADDR FOR TEXT IN WL#
WR = TLW; # WORDS TO BE TRANSFERRED TO WL#
P<TAA> = LOC$TA; # TEXT AREA ADDRESS #
FOR K=1 STEP 1 UNTIL NAA DO
BEGIN # COPY TEXT TO WL FROM FRA BUF #
P<MEM> = TAADDR[K]; # ADDR OF KTH FRAGMENT #
ACT = TAASIZE[K]; # SIZE OF KTH SEGMENT #
L = ACT - 1;
IF L GR WR
THEN
L = WR - 1;
WR = WR - ACT; # WORDS REMAINING IN TEXT #
FOR I = 0 STEP 1 UNTIL L DO
NWL[I+J] = MEMWORD[I]; # COPY TEXT TO NWL #
J = J + ACT;
END
BS = TLW + OPABHSIZ; # RESET NWL ENTRY SIZE #
#
WORKLIST IS SENT TO NIP IF THERE IS NO ROOM FOR ANOTHER PUT ENTRY
PLUS A GSM ENTRY OR IF IT IS A PUT FROM A SUPERVISOR.
#
ISSUE = (SPACE$LEFT - BS) LS (NXTSIZE + GMMESIZE);
END
ELSE
BEGIN # NO SPACE FOR TEXT #
NWL$TA[NEXT] = LOC$TA; # IF NWL CANNOT HOLD TAA #
NWL$OP[NEXT] = OP$PUTF; # SET OPCODE TO PUTF #
NWL$LTAA[NEXT] = NAA; # SET NO OF FRAGMENTS #
IF ACLN LQ (SPACE$LEFT - NTRYSIZ3 - GMMESIZE - OPABHSIZ) AND
NAA LQ MAXNA
THEN
BEGIN # IF TAA CAN FIT INTO NWL #
NWL$TA[NEXT] = 0; # CLEAR TAA ADDRESS IN NWL #
BS = ACLN + NTRYSIZ3; # RESET NWL ENTRY SIZE #
I = NEXT + NTRYSIZ3 - 1;
P<TAA> = LOC$TA; # TAA ADDRESS #
FOR J=1 STEP 1 UNTIL ACLN DO
NWL[I+J] = TAAWORD[J]; # COPY TAA TO NWL #
END
END
RETURN;
END # NP$PUTF #
TERM