*DECK,NP$RECV
*IF,DEF,XFR
USETEXT NX$ACBF
USETEXT AIPDEF
USETEXT HEADER
USETEXT NP$STAT
USETEXT NP$DB
USETEXT NP$NWL
USETEXT NP$MODE
USETEXT NP$GETS
USETEXT NX$ACBX
PROC NP$RECV(NBACKTRIG);
BEGIN
#
*1DC NP$RECV
*
* 1. PROC NAME AUTHOR DATE
* NP$RECV Y. C. YIP 02/19/1985
*
* 2. FUNCTIONAL DESCRIPTION
* THIS PROCEDURE ACTS AS THE RECEIVER OF A CHARACTER MODE
* FILE TRANSFER OR OF AN INTRAHOST FILE TRANSFER.
*
* 3. METHOD USED
* SET BASED ARRAY OF CHARACTER MODE BUFFER, DISKFET,
* AND NETWORK FET TO THEIR CORRESPONDING LOCATIONS
* RESPECTIVELY.
* CHECK TBN FROM TBH TO SEE IF THERE IS ANY BLOCK SEQUENCE
* ERROR.
* IF THERE IS A BSN ERROR
* SET NBACKTRIG TO BAD-DATA-TRIGGER
* ELSE
* INCREMENT TBN IN FTT
* LOOP UNTIL NETBUF IS EMPTY
* IF TRANSLATION IS NEEDED
* CALL NP$N2D
* IF MFACIL SPECIFIED
* UPDATE PRU NUMBER BY CALLING NP$UPRU
* ENDIF
* ELSE
* INTRAHOST FILE XFR (NO TRANSLATION IS NEEDED)
* SET NETBUF EMPTY FLAG SINCE CIO BUFFER IS FILLED
* BY THE PROCESS NP$DATA
* ENDIF
* CALL PUTDISK TO FLUSH THE CIO BUFFER
* END - LOOP
* CLEAR NETBUF EMPTY FLAG
* RESET NETBUF FET POINTERS
* RETURN
*
* 4. ENTRY CONDITIONS
* FTTINDEX SET TO THE CURRENT FILE TRANSFER INDEX
* IN FTT
* NETBUF CONTAINS FILE TRANSFER DATA FILLED
* BY A NEGETL
*
* 5. EXIT CONDITONS
* DISKBUFF ARE FLUSHED
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* NX$ACBX, NP$NWL
*
* 7. ROUTINES CALLED
* NP$CIO - PERFORMS CIO ACTIONS
* NP$UPRU - UPDATES PRU NUMBER DURING FILE TRANSFER
* NP$N2D - TRANSLATION SERVICE
*
* 8. DAYFILE MESSAGES
* NONE
*
#
#
****
#
XREF
BEGIN
PROC NP$CIO; # ROUTINE THAT MAKES CIO FUNCTION #
# CALLS #
PROC NP$N2D; # TRANSLATION SERVICE FROM NETWORK #
PROC NP$UPRU; # PROC TO UPDATE PRU,WORD AND DBIT #
# IN FTT #
# DATA TO DISK DATA #
END
#
****
#
ITEM NBACKTRIG; # BACK TRIGGER #
ITEM INDEX; # LOOP INDEX #
ITEM OLDDISKIN; # OLD VALUE OF DISK IN POINTER #
ITEM ITEMP; # INTEGER TEMPORARY #
CONTROL EJECT;
PROC PUTDISK(PUTBTRIG);
BEGIN
#
*
* 1. PROC NAME AUTHOR DATE
* PUTDISK Y. C. YIP 02/19/1985
*
* 2. FUNCTIONAL DESCRIPTION
* THIS PROCEDURE PERFORMS WRITE ACTION ON THE DISK
*
* 3. METHOD USED
* PROC PUTDISK FIRST CALLS NP$CIO TO PERFORM A WRITE CIO
* OPERATION WITH RECALL. IT THEN CHECKS FOR EOR AND EOI
* FLAGS IN THE FILE TRANSFER TABLE AND CALLS NP$CIO WITH
* WRITER AND WRITEF RESPECTIVELY IF THOSE TWO FLAGS ARE
* SET TO TRUE. ALL CIO CALLS ARE ALSO CHECKED FOR INTERNAL
* PROCESSING ERROR AND THE PUTBTRIG IS SET TO INTERNAL ERROR
* TRIGGER IF THE FIELD FETEC IS NON-ZERO AFTER THE CIO CALL
* IS MADE.
*
* 4. ENTRY CONDITIONS
*
* PUTDISK IS ONLY CALLED AFTER THE TRANSLATION SERVICE
* IS CALLED TO MOVE DATA FROM NETBUF TO DISKBUF ACCORDING
* TO THE DD INDICATED IN THE FTT
* PUTBTRIG - RETURN PARAMETER
*
* 5. EXIT CONDITONS
* DATA FLUSHED FROM DISKBUF TO DISK STORAGE
* PUTBTRIG - SET TO INTERNAL ERROR TRIGGER IF THERE
* IS ERROR ENCOUNTERED DURING THE CIO ACTIONS
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* NX$ACBX,NP$NWL
*
* 7. ROUTINES CALLED
* NP$CIO - PERFORMS CIO ACTIONS
*
* 8. DAYFILE MESSAGES
* NONE
*
#
ITEM PUTBTRIG; # RETURN TRIGGER #
BASED ARRAY COPYAREA[0:0] S(1);
BEGIN
ITEM WORD U(00,00,60);
END
CONTROL EJECT;
# #
# CODE OF PUTDISK BEGINS HERE #
# #
NP$CIO(CIO$WRITE); # CALLS NP$CIO WITH RECALL TO #
# PERFORM A WRITE OPERATION #
IF FETEC[0] NQ 0 # IF ERROR CODE PRODUCED DURING #
THEN # PROCESSING THE CIO CALL #
BEGIN
PUTBTRIG = NRCTITR; # SET RETURN TRIGGER TO INTERNAL #
END # TRIGGER #
ELSE
BEGIN
IF CMB$NBUF[0] NQ 0 AND TBH$EORI[0] GR 0 #IF NETBUF EMPTY FLAG#
THEN # SET AND EOR OR EOI FLAG SET #
BEGIN
FETLEVEL[0] = TBH$LEV[0]; # SET LEVEL NUMBER IN DISK FET #
# TO BE THAT IN TBC #
IF NOT FTTNOTRAN[FTTINDEX] # IF TRANSLATION NEEDED #
THEN
BEGIN
IF CMB$DBIT[0] NQ (WORDLENGTH - CMB$STEP[0])
THEN
BEGIN
FETIN[0] = FETIN[0] + 1; # BUMP IN POINTER OF FET #
IF FETIN[0] EQ FETLIM[0] # IF IN POINTER EQ LIMIT #
THEN
BEGIN
FETIN[0] = FETFIR[0]; # SET IN POINTER EQ FIRST PTR #
END
END
END # END OF TRANSLATION NEEDED #
IF TBH$EOI[0] # IF EOI BIT SET #
THEN
BEGIN
IF (FETIN[0] NQ FETOUT[0]) OR # STUFF LEFT IN DISKFET #
( CMB$DBIT[0] NQ (WORDLENGTH - CMB$STEP[0]))
THEN
BEGIN
FETLEVEL[0] = 0; # CLEAR FET LEVEL #
NP$CIO(CIO$WRITER); # FLUSH BUFFER #
END
END
ELSE
BEGIN
NP$CIO(CIO$WRITER); # CALLS NP$CIO WITH WRITER #
END
IF FETEC[0] NQ 0 # IF ERROR CODE EXISTS #
THEN
BEGIN
PUTBTRIG = NRCTITR; # SET RETURN TRIGGER TO INTERNAL #
# ERROR #
END
FETIN[0] = FETFIR[0]; # RESET IN POINTER OF DISK FET #
FETOUT[0] = FETFIR[0]; # RESET OUT POINTER OF DISK FET #
P<COPYAREA> = 0;
WORD[FETIN[0]] = 0; # ZERO OUT WORD POINTED TO BY IN PTR#
IF NOT FTTNOTRAN[FTTINDEX] # IF TRANSLATION NEEDED #
THEN
BEGIN
CMB$DBIT[0] = WORDLENGTH - CMB$STEP[0]; # RESET DBIT #
CMB$STATE[0] = 0; # CLEAR STATE #
END
END
END
RETURN; # RETURN TO CALLER #
END # END OF PROC PUTDISK #
CONTROL EJECT;
# #
# CODE OF NP$RECV BEGINS HERE #
# #
P<CMB> = FTTCMV$BLK[FTTINDEX]; # USING CHARACTER MODE BUFFER #
P<FET$CIO> = FTTFETADR[FTTINDEX]; # USING DISK FET #
P<FET$WORK> = FTTFETW[FTTINDEX]; # USING NETWORK FET #
IF NOT FTTNOTRAN[FTTINDEX] # IF TRANSLATION NEEDED #
THEN
BEGIN
P<TBH$HDR> = FETWFIRST[0]+1; # PUT TBH TEMPLATE TO SECOND WORD #
END # ADDRESS OF DATA #
ELSE
BEGIN # INTRAHOST BINARY #
P<TBH$HDR> = LOC(DATA$WORD[1]);
END
IF TBH$TBN[0] NQ FTTTBN[FTTINDEX] # IF SERIAL NUMBERS DO NOT#
THEN # MATCH #
BEGIN
NBACKTRIG = NRCTBDA; # SET NACK TRIG TO BAD DATA TRIGGER #
END
ELSE
BEGIN
FTTTBN[FTTINDEX] = FTTTBN[FTTINDEX] + 1; # BUMP BLOCK COUNTER #
# IN THE FTT #
FOR INDEX = 0 WHILE CMB$NBUF[0] EQ 0
DO # LOOP UNTIL NETBUF-EMPTY FLAG IS #
BEGIN # FOR CMB #
IF FTTMFACIL[FTTINDEX] # IF MFACIL SPECIFIED #
THEN
BEGIN
OLDDISKIN = FETIN[0]; # SAVE OLD IN POINTER OF DISK FET #
END
IF NOT FTTNOTRAN[FTTINDEX] # IF TRANSLATION NEEDED #
THEN
BEGIN
NP$N2D(LOC(FETWFIRST[0]),LOC(FETFIR[0]),P<CMB>);
# CALLS TRANSLATION SERVICE #
# ROUTINE TO TRANSLATE NETWORK8 CHAR#
# INTO FORMAT INDICATED BY THE DD #
IF FTTMFACIL[FTTINDEX] # IF MFACIL SPECIFIED #
THEN
BEGIN
ITEMP = FETIN[0]; # REGISTER LAST VALUE OF FETIN #
IF CMB$NBUF[0] NQ 0 AND TBH$EORI[0] GR 0
THEN
BEGIN # IF NETBUF EMPTY AND EOR OR EOI #
IF CMB$DBIT[0] NQ (WORDLENGTH - CMB$STEP[0])
THEN
BEGIN # NO MORE ROOM FOR ONE BYTE #
ITEMP = FETIN[0] + 1;
END
END
NP$UPRU(OLDDISKIN,ITEMP); # UPDATE PRU NUMBER IN FTT #
END
END # END OF TRANSLATION NEEDED #
ELSE
BEGIN # NO TRANSLATION #
CMB$NBUF[0] = 1; # SET NETBUF EMPTY FLAG SINCE #
END # CIO BUFFER FILLED IN NP$DATA #
PUTDISK(NBACKTRIG); # CALLS PUTDISK TO WRITE INFO INTO #
# DISK #
END
END # END OF CORRECT TBN #
CMB$NBUF[0] = 0; # CLEAR NETBUF EMPTY FLAG #
FETWIN[0] = FETWFIRST[0]; # RESET IN POINTER OF NETBUF #
FETWOUT[0] = FETWFIRST[0]; # RESET OUT POINTER OF NETBUF #
RETURN; # RETURN TO CALLER #
END # END OF PROC NP$RECV #
TERM
*ENDIF