! ACCESS FILE
! Opens the file and returns in SIZE the number of bytes in the file,
! and in REF a token which must be passed to DEACCESS FILE, READ REGION,
! and WRITE REGION.  The token is in fact the address of a record (NEWed
! by ACCESS FILE and DISPOSEd by DEACCESS FILE) which contains the
! transaction number and the file size.
! MODE=0: Read-only, MODE=1: Read-modify.

%externalroutinespec access file(%string(255)filename,%integer mode,
                             %integername ref,size)

! DEACCESS FILE
! Closes the file and throws away the token

%externalroutinespec deaccess file(%integer ref)

! READ REGION
! Reads BYTES bytes from the file specified by REF into store at BUFFER,
! starting with byte BYTE of the file (BYTE=0 means beginning of file).

%externalroutinespec read region(%integer ref,byte,bytes,%bytename buffer)

%externalroutinespec funny or region(%integer ref,byte,bytes,shifts,%halfname buffer)

%externalroutinespec write region(%integer ref,byte,bytes,%bytename buffer)

%endoffile
