file_ifc.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------


abstract class $OPSYS_FILE_LABEL

abstract class $OPSYS_FILE_LABEL is -- This class models the concept of a label attached to a file -- containing various properties. In addition to the attributes specified -- here it is likely that any implementation class for a particular operating -- system will have additional features. -- Version 1.0 Feb 99. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 3 Feb 99 kh Original device_code : $OB ; -- A device code indicating the particular file-system involved. file_code : $OB ; -- A file code indicating the number of the fyle as known to the file -- system. mode : NUM_BITS ; -- A modes code bit-pattern which will need to be coded/decoded in an -- implementation-defined way for setting access permissions to the file. file_size : CARD ; -- The size of the file in octets. created_time : OS_FSTIME ; -- The time-stamp when the operating system file was created. -- NOTE For any operating system there may well be additional (therefore not -- portable) time properties. block_size : CARD ; -- The block-size on the device where the file is stored. This may be -- used to optimise buffering if required. block_count : CARD ; -- The count of device blocks which is currently allocated to the file. end ; -- $OPSYS_FILE_LABEL

abstract class $OPSYS_FILE_SYS

abstract class $OPSYS_FILE_SYS is -- This abstract class models the interface to an underlying file -- system. It specifies file system/pipe operations which have to be -- implemented in terms of any underlying operating system services. -- Version 1.0 Feb 99. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 3 Feb 99 kh Original open( name : STR, mode : FILE_MODES ) : REFERENCE ; -- This routine attempts to open the named file and return the operating -- system specific reference to the opened file. If the attempt was -- unsuccessful then void is returned. create_file( name : STR, mode : FILE_MODES ) : REFERENCE ; -- This routine attempts to create the named file and return the -- operating system specific reference to the file. If unsuccessful then -- void is returned. rename_file( old_name : STR, new_name : STR ) : BOOL ; -- This routine returns true if and only if the attempt to rename -- the file having the old name was successful. delete_file( name : STR ) : BOOL ; -- This routine deletes the named file, returning true if and only if -- deletion has been successful. The file must be closed before attempting -- to delete. create_tempfile : REFERENCE ; -- This routine attempts to create a temporary file and return the -- operating system specific reference to the opened file. If unsuccessful -- then void is returned. error( fyle : REFERENCE ) : BOOL ; -- This routine returns true if and only if the latest file operation -- resulted in an error, or the file is in an error state. clearerr( fyle : REFERENCE ) ; -- This routine sets the error indication to void for the indicated file. error_msg( fyle : REFERENCE ) : STR ; -- This routine returns an operating system specific string error -- message using the current repertoire and encoding. This may or may not -- include the name by which the file is known. close( fyle : REFERENCE ) ; -- This routine closes fyle in an operating system dependent manner. -- Any subsequent attempted use of the argument reference will result in -- an error. open_throw_back : REFERENCE ; -- This routine attempts to set up the throwback mechanism for error -- reporting. If this is successfully done then the channel identity is -- returned, otherwise void. Any underlying system need not, therefore, have -- any concept of throwback, merely returning void! throw( chan : REFERENCE, fyle_ident : STR, msg : STR, warn_only : BOOL ) ; -- This routine sends the throw-back messsage to the given channel in -- respect of the given file (identified by its OS dependent name). close_throw_back( chan : REFERENCE ) ; -- This routine closes the throwback channel in an operating system -- dependent manner. exists( name : STR ) : BOOL ; -- This routine returns true if and only if the named file/directory -- currently exists. flush( fyle : REFERENCE ) ; -- This routine flushes the file buffers as necessary. flush( chan : REFERENCE, direction : FLUSH_CMDS ) ; -- This routine flushes the buffers associated with chan in the -- direction indicated, which, if the channel is uni-directional must -- correspond to the channel direction. size( fyle : REFERENCE, out size : CARD ) : BOOL ; -- This routine returns true if and only if it has been possible to -- determine the size of the given file - when the out parameter size is -- valid, otherwise false is returned and size is not valid. kind( code_val : CARD ) : FILE_KINDS ; -- This routine provides the operating system dependent mapping between -- the code value returned by some operating system service and the portable -- class FILE_KINDS! file_type( full_name : STR, leaf_name : STR ) : STR ; -- This routine returns the string name of the file type as known to -- the operating system. set_type( full_name : STR, leaf_name : STR, new_type : STR ) : STR ; -- This routine sets the file type of the fileof full and leaf name given -- to have the required new type, returning the resultant leaf name (which -- may or may not be the same as leaf_name)! seek( fyle : REFERENCE, offset : INT, relative_to : FILE_LOCS ) : BOOL ; -- This routine returns true if and only if it has been possible to -- set the current file position to be offset relative to the given point, -- otherwise false. position( fyle : REFERENCE ) : CARD ; -- This routine returns the index in the file of the current position -- at which reading or writing will commence (in the absence of any -- intervening seek operation). putchar( item : OCTET, chan : REFERENCE ) : BOOL ; -- This routine returns true if and only if it has successfully sent -- the single character item to the specified channel. getchar( out item : OCTET, chan : REFERENCE ) : BOOL ; -- This routine returns true if and only if it has successfully put -- a single character item from the specified channel into the item buffer. file_read( buff : FBINSTR, size : CARD, -- of each item! inout cnt : CARD, -- count of items in the buffer fyle : REFERENCE ) : BOOL ; -- This routine returns true if and only if it has been possible to read -- something from the file specified into the buffer provided. If successful -- then cnt is set to be the number of items read (NOT the number of bytes!). file_read( buff : FBINSTR, size : CARD, inout cnt : CARD, -- in the buffer offset : CARD, fyle : REFERENCE ) : BOOL ; -- This routine returns true if and only if it has been possible to read -- something from the file specified into the buffer provided starting to -- store at the given offset. If successful then cnt is set to be the number -- of items (NOT bytes) read. file_write( buff : REFERENCE, size : CARD, -- of the item to be written inout cnt : CARD, -- No of items to write fyle : REFERENCE ) : BOOL ; -- This routine returns true if and only if all of the specified output -- data (in the buffer referred to) has been successfully written to the -- given file starting at the current file position. The parameter cnt then -- indicates the number of items written -- NOT the number of bytes. file_write( buff : BINSTR, size : CARD, -- of the item to be written inout cnt : CARD, -- No of items to write fyle : REFERENCE ) : BOOL ; -- This routine returns true if and only if all of the specified output -- data (in the buffer) has been successfully written to the given file -- starting at the current file position. The parameter cnt then indicates -- the number of items written ----- NOT the number of bytes. current_dir( path : STR ) : BOOL ; -- This routine returns true if and only is it has been possible to -- change the current directory to the one named by path. current_dir : STR ; -- This routine returns the string name of the current working directory -- in the current repertoire and encoding. If the operation fails then void -- is returned. make_dir( name : STR, access_code : ACCESS_SET ) : BOOL ; -- This routine returns true if and only if its attempt to create -- a directory with the given name and access permissions was successful. delete_dir( name : STR ) : BOOL ; -- This routine returns true if and only if the attempt to delete -- the named directory was successful. open_dir( name : STR ) : REFERENCE ; -- This routine returns the operating system provided handle for -- the directory object. If the attempt was unsuccessful then void -- is returned. close_dir( handle : REFERENCE ) : BOOL ; -- This routine returns true if and only if the attempt to close -- the indicated directory was successful. Any subsequent attempt to make -- use of the handle for directory operations will result in an error. rewind_dir( handle : REFERENCE, out offset : CARD ) : BOOL ; -- This routine returns true if and only if the attempt to rewind -- the indicated directory was successful. read_dir( handle : REFERENCE, inout offset : CARD ) : STR ; -- This routine returns the string provided by the operating system -- if there is another sequential entry in the directory, otherwise void. rename_dir( old_name : STR, new_name : STR ) : BOOL ; -- This routine returns true if and only if the attempt to rename -- the directory having the old name was successful. get_label( name : STR, label : REFERENCE ) : BOOL ; -- This routine fills in the file label and, if this was possible, -- then returns true, otherwise false and the label has not been set. change_access( name : STR, access_mask : ACCESS_SET ) : BOOL ; -- This routine attempts to alter the access permissions for the named -- file. The mask should have an element CLEARED if that permission is to -- be allowed! end ; -- $OPSYS_FILE_SYS