FACILITY:	REREAD
AUTHOR:		Neal Lippman

Topic:		Functional specification


	REREAD implements rereading, a la IBM. A user calls
the routine reread, passing in a logical unit number on
which rereading is enabled. When a FORTRAN read is done on 
that logical unit, the last buffer read (or written) is 
returned as the input.

	When the user calls subroutine REREAD, the following 
takes place:

	1) A temporary mailbox is created with the logical
		name <username>_REREAD
	2) A FORTRAN open is done on the mailbox with the 
logical unit number on which rereading is to be done.
	3) A read attention AST is set on the mailbox.

When the user issues a reread request (ie, a read on the 
logical unit number specified in the call to REREAD), the 
read attention AST handler gains control. It gets the RMS 
buffer that was last used by FORTRAN, and moves its contents 
into the mailbox; then the read attention AST is reset. The 
user's FORTRAN read is then allowed to continue, with the 
net effect that the last read buffer is returned.

Note that the mailbox is created with a buffer size of 512 
bytes, and a maximum message count of 1. The FORTRAN open on 
the mailbox is done with a recordtype of variable, a 
recordsize of 512, access sequential, and form is formatted.

	The FORTRAN I/O system routine FOR$IO_END is 
modified so that is will place the address of the RMS buffer 
used in the current I/O and its length into known global 
variables to be used by the AST handler. Because of this 
change to a routine in the RTL, programs using the REREAD 
system must link directly to SYS$LIBRARY:STARLET.OLB/LIB, in 
order to prevent incorrect reference resolution from 
VMSRTL.EXE.


Routines of REREAD:

File: 			REREAD.BLI
Source Language:	BLISS32

1) create_mbox (desc_addr) 
	
	This routine creates the mailbox and returns
		the logical name assigned to it. 

2) ast_handle

	This routine moves the RMS buffer into the
		REREAD mailbox. 

3) ast_set

	This routine sets a read-attention AST on
		the REREAD mailbox. 

4) length (string_addr)

	This routine returns the length of the input 
		parameter.

5) cancel_io

	This routine cancels outstanding I/O on the
		internal channel to the mailbox.


File:			REREADFOR.FOR
Source Language:	FORTRAN IV

1) reread(lu)

    	This routine is called to establish the logical 
    		unit on which rereading will be done.

2) reread_toggle

    	This routine toggles the reread unit from formatted 
    		to unformatted to formatted...
 

File:			REREADSUB.MAR
Source Language:	MACRO32

1) for$io_end

    	This routine replaces the RTL routine by the same 
    		name. It moves the addresses of the RMS 
    		buffer (RAB$L_UBF) and the size of the 
    		string read (RAB$W_RSZ) into the global 
    		symbols REREAD_BUFADR and REREAD_BUFLEN
    		which are defined in REREAD.BLI.

File:			REREADMSG.MSG
Source Language:	VAX 11 MESSAGE DEFINITION LANGUAGE

    	This file contains the definitions for the REREAD 
specific error message codes.


File:			REREADLNK.OBJ

    	This file is created by appending all of the objects
from the other reread modules. This allows for linking to just
one file (plus starlet.olb), instead of having to specify all
of the files.
