|
|
DataMuseum.dkPresents historical artifacts from the history of: RC3500 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC3500 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 16896 (0x4200)
Types: TextFileVerbose
Names: »tlf3502env«
└─⟦da1afb338⟧ Bits:30008156 SW2020 - RC3502 - File system - Rel. 1.0
└─⟦bcdac339f⟧
└─⟦this⟧ »tlf3502env«
(**************************************************************************)
--
-- RC3502 Local File System Access Method
--
-- Name: Local File system on rc3502 ENVironment
-- Author: Bo Bagger /bb
--
(**************************************************************************)
lf3502env;
-- 861125 bb 1.1 First version.
-- 870306 bb 1.2 Lf_init introduced.
-- 870317 bb 1.3 Lf_entry_info_type and lf_file_info_type opened.
-- 870319 bb 1.4 Lf_exceptions extended to 16 exceptions.
-- 870320 bb 1.5 Lf_reset and lf_rewrite changed to set the filepointer
-- to zero.
-- 870327 bb 1.6 Lf_set_mode introduced.
-- 870511 bb 1.7 Lf_test introduced.
-- 871215 bb 1.8 Lf_conname introduced.
-- Position outside file trickers exception now,
-- no rounding takes place.
-- Patname_size extended from 40 to 64 bytes (FTAM).
-- The 'bytes' parameter removed from lf_create.
-- The type of lf_ioresult changed from integer to byte.
-- Besides the sequence in declarations is reorganized .
-- 890512 bb 1.9 The type lf_entry_info_type for user scan of catalogs
-- extended to correct size.
-- User programs using this type and lf_lookup and lf_set_tail
-- must recompile.
(**************************************************************************)
--
-- SHORT DESCRIPTION
--
(**************************************************************************)
-- The LF3502 access method defines a datafile
-- as a sequence of bytes numbered according
-- to the bufferconventions 0 .. length-1.
-- The access method is built on top of the
-- block oriented RC-FS File System Nucleus.
-- Files are controlled via objects of type ZONE,
-- which are defined in IOENVIR.
-- The environment IOENVIR must occur before LF3502ENV
-- when compiling.
-- An open file is associated a file pointer,
-- which points to the byte position,
-- where the next read- or write operation
-- will be commenced.
-- After the operation, the file pointer will
-- be updated accordingly.
-- The following routines realizes both sequential
-- and random access.
-- It should be noticed, that besides the read- and write routines
-- mentioned below, the existing zone procedures for
-- character reading and writing,
-- defined in IOENVIR, may be used.
-- A pathname is a sequence of entrynames separated by "/".
-- If a pathname begins with a "/", the first entryname
-- is searched for in the rootcatalog, i.e. the pathname is absolute.
-- If a pathname doesn't begin with a "/", the pathname is relativ
-- to the current catalog (curcat).
-- Some entrynames are especial:
-- . refers to current catalog (lf_ownname).
-- .. refers to the parent catalog (lf_parentname).
-- 'con' refers to the RC3502 console (lf_conname).
-- A file is automatically extended during writing.
-- If extension is impossible by various reasons,
-- you may be hit by an exception. To avoid that,
-- a file may be explicitly extended by a call of
-- the routine LF_EXTEND before writing.
-- I/O control may be defined at run time. The procedures
-- LF_DISABLE and LF_ENABLE switches I/O exceptions off and on
-- during run time.
-- If exceptions are disabled the latest I/O result on a zone
-- may be optained by a call of LF_IORESULT.
--
-- Note however, that LF_DISABLE and LF_ENABLE has no effect in
-- the current version of LF3502.
(**************************************************************************)
--
-- CONSTANTS AND TYPES
--
(**************************************************************************)
const
lf_identifier_size = 16;
type
lf_identifier = array(1..lf_identifier_size) of char;
const
lf_noname = lf_identifier (lf_identifier_size *** " ");
lf_ownname = '. ';
lf_parentname = '..';
lf_conname = 'con';
lf_delimiter = "/";
const
lf_pathname_size = 64;
type
lf_pathname = array (1..lf_pathname_size) of char;
type
lf_authorities = (lf_read_authority,
lf_write_authority,
lf_adjust_authority,
lf_delete_authority,
lf_authorize_authority);
lf_authority_type =
record
authorizations,
inheritable,
protections: set of lf_authorities;
end;
const
lf_maxauthorities= (.lf_read_authority,
lf_write_authority,
lf_adjust_authority,
lf_delete_authority,
lf_authorize_authority.);
lf_maxauthority =
lf_authority_type (lf_maxauthorities,
lf_maxauthorities,
lf_maxauthorities);
type
lf_accessmode = (lf_read,lf_write,lf_exclusive);
type
lf_entrytype_type = (lf_datafile, lf_catalog);
type
lf_exceptions =(lf_exception1 ,lf_exception2 ,lf_exception3 ,lf_exception4,
lf_exception5 ,lf_exception6 ,lf_exception7 ,lf_exception8,
lf_exception9 ,lf_exception10,lf_exception11,lf_exception12,
lf_exception13,lf_exception14,lf_exception15,lf_exception16);
type
lf_time =
record
date: coded_date;
time: coded_time;
end;
const
lf_entry_tail_size = 5; (* bytes *)
type
lf_entry_tail_type = array(1..lf_entry_tail_size) of byte;
lf_entry_info_type =
record
name : lf_identifier;
authority : lf_authority_type;
?, ? : integer;
entrytype : lf_entrytype_type;
tail : lf_entry_tail_type;
end;
const
-- size of an entry in a catalog file
lf_entry_info_size = typesize (lf_entry_info_type);
const
lf_file_tail_size = 8;
type
lf_file_tail_type =
record
length : double;
contents : integer;
not_used : array ((typesize (double)+typesize (integer)+1)..lf_file_tail_size) of byte;
end;
lf_file_info_type =
record
written: double;
allocated: double;
creation: lf_time;
last_write: lf_time;
tail: lf_file_tail_type;
end;
(**************************************************************************)
--
-- INITIALIZATION
--
(**************************************************************************)
procedure lf_init
(max_files : integer);
external;
-- Configurates the access method to the requested
-- maximum number of simultanously opened files.
-- If zero is specified a default number is taken.
-- If not called before the first file is opened,
-- lf_init is implicitly called.
(**************************************************************************)
--
-- CATALOG HANDLING
--
(**************************************************************************)
procedure lf_select
(var pathname : ! lf_pathname;
mode : set of lf_accessmode;
var result : byte);
external;
-- Places the current catalog pointer (curcat)
-- at a new catalog described by pathname.
-- The already opened files are not disturbed.
procedure lf_deselect;
external;
-- Sets the curcat pointer to nil.
procedure lf_lookup
(var name : ! lf_identifier;
var entry: lf_entry_info_type;
var descriptor: lf_file_info_type;
var result: byte);
external;
-- The entry identified by 'name' is looked up in curcat.
-- Exception if the curcat pointer is nil.
(**************************************************************************)
--
-- FILE HANDLING
--
(**************************************************************************)
procedure lf_open
(var file: zone;
var name : ! lf_identifier;
mode: set of lf_accessmode);
external;
-- If exception is disabled the result may be obtained
-- by a call of LF_IORESULT.
-- If mode contains lf_write and the file does not
-- exist in curcat, the file is created in curcat.
-- Otherwise exception 'file does not exist' will occur.
-- Exception if already opened.
-- Catalogs may be opened for reading, not for writing.
-- After the call the filepointer equals zero.
procedure lf_reset
(var file: zone);
external;
-- The zonestate is changed to read_mode.
-- Current filepointer is set to zero.
-- Exception if the file is not opened.
procedure lf_rewrite
(var file: zone);
external;
-- The zonestate is changed to write_mode.
-- Current filepointer and length are set to zero.
-- Exception if the file is not opened.
procedure lf_set_mode
(var file : zone;
mode : lf_accessmode);
external;
-- The zonestate is changed to mode.
-- Current filepointer is not changed.
-- Exception if the file is not opened.
procedure lf_close
(var file: zone);
external;
-- The file is closed.
-- The call is dummy if the file is already closed.
-- The routine LF_FLUSH must be called prior to the
-- call of LF_CLOSE, if you want to ensure, that
-- all data is written to disc.
procedure lf_create
(var name: ! lf_identifier;
authority: lf_authority_type;
entrytype: lf_entrytype_type;
var result: byte);
external;
-- A file of type 'entrytype' is created in curcat.
procedure lf_delete
(var name : ! lf_identifier;
var result: byte);
external;
-- The entry identified by 'name' is deleted from curcat.
procedure lf_link
(var name : ! lf_identifier;
var pathname: ! lf_pathname;
var result: byte);
external;
-- In curcat an entry is inserted, pointing
-- to the same file as 'pathname'.
procedure lf_rename
(var name: ! lf_identifier;
var oldname : ! lf_identifier;
var result: byte);
external;
-- Renaming of a file in curcat.
procedure lf_extend
(var name : ! lf_identifier;
bytes: double;
var result: byte);
external;
-- Extends a file in curcat with 'bytes' bytes.
-- The file must be closed.
procedure lf_truncate
(var name : ! lf_identifier;
bytes: double;
var result: byte);
external;
-- Truncates the file in curcat with 'bytes' bytes.
-- The file must be closed.
procedure lf_set_tail
(var name : ! lf_identifier;
var entry: ! lf_entry_info_type;
var descriptor: ! lf_file_info_type;
var result: byte);
external;
(**************************************************************************)
--
-- FILE POSITIONING
--
(**************************************************************************)
function lf_eof
(var file: zone): boolean;
external;
-- True if current filepointer is at the end of the file,
-- i.e. points at position 'length',
-- otherwise false.
-- Exception if the file is not opened.
function lf_length
(var file : zone) : double;
external;
-- Returns the length of the file in bytes.
-- The length may also be obtained by a call
-- of LF_LOOKUP.
-- Exception if the file is not opened.
procedure lf_offset
(var file : zone;
offset : double);
external;
-- Relative updating of current filepointer.
-- Exception if 'position' is outside the file.
-- Exception if the file is not opened.
function lf_position
(var file : zone) : double;
external;
-- Returns the current value of the filepointer.
-- Exception if the file is not opened.
procedure lf_seek
(var file : zone;
position : double);
external;
-- Sets the current filepointer to the value 'position'.
-- The first byte in the file has position 0.
-- The last byte in the file has position length-1.
-- Exception if 'position' is outside the file.
-- Exception if the file is not opened.
(**************************************************************************)
--
-- FILE READING AND WRITING
--
(**************************************************************************)
function lf_readblock
(var file : zone;
var to_ref : reference;
to_index : integer;
bytes : integer) : integer;
external;
-- A maximum of 'bytes' bytes is read to the message 'to_ref'
-- starting at position 'to_index'.
-- The resulting number of bytes is returned.
-- Exception if not read_mode.
-- Exception if the file is not opened.
procedure lf_readbyte
(var file: zone;
var b: byte);
external;
-- Exception if reading is past 'end_of_file.
-- Exception if not read_mode
-- Exception if the file is not opened.
-- If exception is disabled LF_IORESULT gives the reason.
procedure lf_readinteger
(var file: zone;
var j: integer);
external;
-- Exception if reading is past 'end_of_file.
-- Exception if not read_mode
-- Exception if the file is not opened.
-- If exception is disabled LF_IORESULT gives the reason.
function lf_writeblock
(var file : zone;
var from_ref : reference;
from_index,
bytes : integer) : integer;
external;
-- The resulting number of bytes is returned.
-- Exception if the file cannot be extended.
-- If exception is disabled, the result
-- may be obtained by a call of LF_IORESULT.
-- Exception if not write_mode.
-- Exception if file is not opened.
procedure lf_writebyte
(var file: zone;
b: byte);
external;
-- Exception if the file cannot be extended.
-- If exception is disabled, the result
-- may be obtained by a call of LF_IORESULT.
-- Exception if not write_mode.
-- Exception if file is not opened.
procedure lf_writeinteger
(var file: zone;
j: integer);
external;
-- Exception if the file cannot be extended.
-- If exception is disabled, the result
-- may be obtained by a call of LF_IORESULT.
-- Exception if not write_mode.
-- Exception if file is not opened.
(**************************************************************************)
--
-- AUTHORIZATION ENFORCEMENT
--
(**************************************************************************)
procedure lf_set_authority
(var name : ! lf_identifier;
authorization: set of lf_authorities;
var result: byte);
external;
-- If LF_AUTHORIZE_AUTHORITY is contained in the set
-- of authorizations for the entry named 'name',
-- the authorizations are redefined to 'authorization'.
procedure lf_set_inheritance
(var name : ! lf_identifier;
inheritable: set of lf_authorities;
var result: byte);
external;
-- The subset of 'inheritable' authorizations
-- for the entry named 'name' are set to 'inheritable'.
procedure lf_set_protection
(var name : ! lf_identifier;
protections: set of lf_authorities;
var result: byte);
external;
-- The temporary set of protections for the
-- entry named 'name' are redefined to 'protections'.
(**************************************************************************)
--
-- FILE INPUT/OUTPUT CONTROL
--
(**************************************************************************)
procedure lf_flush
(var file : zone);
external;
-- After return all the buffers of the file are written to disc.
-- If exception is disabled, the result may be obtained
-- by a call of LF_IORESULT.
-- Dummy if not write_mode.
-- Dummy if not opened.
function lf_ioresult
(var file : zone) : byte;
external;
-- Returns the result af the last I/O operation
-- performed on the file.
-- If not 'end_of_file', the current result is set to OK,
-- after the call,
procedure lf_disable
(mask : set of lf_exceptions);
external;
-- Suppresses lf_exceptions by NOTOK results
-- after I/O operations.
-- The result may be obtained by a call of LF_IORESULT.
procedure lf_enable
(mask : set of lf_exceptions);
external;
-- Enables exceptions by NOTOK results
-- after I/O operations.
-- All lf_exceptions are enabled as a default.
(**************************************************************************)
--
-- MISCELLANEOUS ROUTINES
--
(**************************************************************************)
procedure lf_test
(onoff : boolean);
external;
-- Controls generation of testoutput
-- from the lf3502 access methode
-- Default is no testoutput (onoff = false).
(**************************************************************************)
--
-- RESULTS
--
(**************************************************************************)
(* error codes *)
const
ok=0;
lf_catconnection = 35; lf_fileconnection = 36;
lf_name_inexisting = 6; lf_name_exists = 5;
lf_name_error = 12; lf_unauthorized = 30;
lf_deleted = 7; lf_filelimit = 29;
lf_buffersize = 21; lf_catalog_full = 13;
lf_rejected = 28; lf_mount_error = 9;
lf_openlimit = 17; lf_includelimit = 18;
lf_indexlimit = 15; lf_flt_overflow = 8;
lf_volumelimit = 16;
lf_parity = 2; lf_harderror = 3;
lf_disconnected = 25;
lf_version = 22; lf_not_implemented = 23;
lf_software = 14;
(***** end lf3502env *****)
.
«eof»