*DECK SSFCBS
PROC SSFCBS( FET, AVAIL, DATA );
# TITLE SSFCBS - CHECK BUFFER SPACE. #
BEGIN # SSFCBS #
#
** SSFCBS - CHECK BUFFER SPACE.
*
* S. H. FISCHER. 81/10/08.
*
* THIS PROCEDURE COMPUTES THE NUMBER OF 60 BIT WORDS AVAILABLE
* IN THE SPECIFIED CIO BUFFER AND THE NUMBER OF DATA WORDS PRESENT.
*
* PROC SSFCBS( FET, AVAIL, DATA)
*
* ENTRY:
* FET = FILE ENVIRONMENT TABLE.
*
* EXIT:
* AVAIL = NUMBER OF 60 BIT WORDS FREE IN BUFFER.
* DATA = NUMBER OF 60 BIT WORDS VALID IN BUFFER.
*
* NOTES:
* THIS PROCEEDURE IS USEFUL WHEN *READW* AND *WRITEW* ARE BEING US
* AND THE CALLER MUST HAVE AN IMMEDIATE RETURN WITH NO DELAY
* (CIO CALL) FROM THESE ROUTINES.
*
* METHOD:
* THE SPACE BETWEEN IN AND OUT IS THE VALID DATA, SUBTRACTING
* THIS FROM THE TOTAL BUFFER SIZE GIVES FREE SPACE.
*
#
ARRAY FET [00:00] S(5);
BEGIN
ITEM FET$FIRST U(01,42,18); # ADDRESS OF FIRST WORD OF BUF #
ITEM FET$IN U(02,00,60); # IN POINTER #
ITEM FET$OUT U(03,00,60); # OUT POINTER #
ITEM FET$LIMIT U(04,42,18); # LINIT POINTER #
END
ITEM D I;
ITEM S I;
ITEM DATA I;
ITEM AVAIL I;
D = FET$IN[0] - FET$OUT[0];
S = FET$LIMIT[0] - FET$FIRST[0];
IF D GQ 0
THEN
BEGIN
DATA = D;
AVAIL = S - D - 1;
RETURN;
END
ELSE
BEGIN
AVAIL = -D - 1;
DATA = S - AVAIL - 1;
RETURN;
END
END # SSFCBS #
TERM