GenericFile Module Interface Specification

Informal Introduction

From the logical point of view directories differ from regular files, however Unix
treates them in the same way. Generic file is used to specify the 'general' file
which may be either directory or regular file.

(0) CHARACTERISTICS

-type specified: genericfile

-features: deterministic, non-parameterized

-foreign types: directory, sequence, byte, global, mystring

(1) SYNTAX

ACCESS-PROGRAMS

Program Name
Arg#1Arg#2Arg#3Result Type
CREATESEQgenericfile:VOsequence:V   
CREATEDIRgenericfile:VOdirectory:V   
RELEASEgenericfile:VO     
TYPEgenericfile:V    int
PUTgenericfile:VOint:Vbyte:V 
GETgenericfile:Vint:Vbyte:VO 
TRUNCgenericfile:VOint:V   
SIZEgenericfile:V    int
CREATEgenericfile:VOmystring:Vint:V 
REMOVEgenericfile:VOmystring:V   
GETINODETABLEINDEXgenericfile:Vmystring:V  int
EXISTSgenericfile:Vmystring:V  bool
ISFULLgenericfile:V    bool

(2) CANONICAL TRACES

canonical(T) T = _ ( s:<sequence> [T = CREATESEQ(*, s) ] d:<directory> [T = CREATEDIR(*, d) ])

AUXILIARY FUNCTIONS

interrorval: <int>

interrorval() = -1

errorval: <byte>

errorval() = -1

t_empty: <int>

t_empty() = -1

t_seq: <int>

t_seq() = 0

t_dir: <int>

t_dir() = 1

type: <genericfile> <int>

type(gf) =

ConditionValue
gf = _ t_empty()
s:<sequence> [gf = CREATESEQ(*, s) ]t_seq()
d:<directory> [gf = CREATEDIR(*, d) ]t_dir()

getseq: <genericfile> <sequence>

getseq(gf) =

ConditionValue
type(gf) t_seq()sequence::_
type(gf) = t_seq() s where s:<sequence> [gf = CREATESEQ(*, s) ]

getdir: <genericfile> <directory>

getdir(gf) =

ConditionValue
type(gf) t_dir()directory::_
type(gf) = t_dir() d where d:<directory> [gf = CREATEDIR(*, d) ]

get: <genericfile> × <int> <byte>

get(gf, pos) =

ConditionValue
type(gf) t_seq() (pos < 0 pos global::G_sequence_size())errorval()
type(gf) = t_seq() (pos 0 pos < global::G_sequence_size())sequence::get(getseq(gf), pos)

size: <genericfile> <int>

size(gf) =

ConditionValue
type(gf) t_seq()interrorval()
type(gf) = t_seq() sequence::size(getseq(gf))

exists: <genericfile> × <mystring> <bool>

exists(gf, name) =

ConditionValue
type(gf) t_dir()false
type(gf) = t_dir() directory::exists(getdir(gf), name)

getinodetableindex: <genericfile> × <mystring> <int>

getinodetableindex(gf, name) =

ConditionValue
type(gf) t_dir()interrorval()
type(gf) = t_dir() directory::getinodetableindex(getdir(gf), name)

isfull: <genericfile> <bool>

isfull(gf) =

ConditionValue
type(gf) t_dir()false
type(gf) = t_dir() directory::isfull(getdir(gf))

(3) SEMANTICS

ACCESS-PROGRAMS

Legality(CREATESEQ((n, T), s)) =

ConditionValue
type(T) t_seq() type(T) t_empty()%illegal operation%
type(T) = t_seq() type(T) = t_empty() %legal%

CREATESEQ((n, T) , s) = CREATESEQ(*, s)

Legality(CREATEDIR((n, T), d)) =

ConditionValue
type(T) t_seq() type(T) t_empty()%illegal operation%
type(T) = t_seq() type(T) = t_empty() %legal%

CREATEDIR((n, T) , d) = CREATEDIR(*, d)

Legality(RELEASE((n, T))) = %legal%

RELEASE((n, T) ) = _

Legality(TYPE(T)) = %legal%

TYPE(T) = type(T)

Legality(PUT((n, T), pos, b)) =

ConditionValue
type(T) t_seq() (pos < 0 pos global::G_sequence_size())%type mismatch or invalid position%
type(T) = t_seq() (pos 0 pos < global::G_sequence_size())%legal%

PUT((n, T) , pos, b) = CREATESEQ(*, sequence::PUT((*1,getseq(T)) , pos, b))

Legality(GET(T, pos, (n, b))) =

ConditionValue
type(T) t_seq() (pos < 0 pos global::G_sequence_size())%type mismatch or invalid position%
type(T) = t_seq() (pos 0 pos < global::G_sequence_size())%legal%

GET(T, pos, (n, b) ) = get(T, pos)

Legality(TRUNC((n, T), pos)) =

ConditionValue
type(T) t_seq() (pos < 0 pos global::G_sequence_size())%type mismatch or invalid position%
type(T) = t_seq() (pos 0 pos < global::G_sequence_size())%legal%

TRUNC((n, T) , pos) = CREATESEQ(*, sequence::TRUNC((*1,getseq(T)) , pos))

Legality(SIZE(T)) = %legal%

SIZE(T) = size(T)

Legality(CREATE((n, T), name, v)) =

ConditionValue
type(T) t_dir() (exists(T, name) (¬mystring::iscorrectfilename(name) (v < 0 length(T) = global::G_directory_size() )))%type mismatch, invalid file name or i-node number%
type(T) = t_dir() ¬(exists(T, name) (mystring::iscorrectfilename(name) (v 0 length(T) < global::G_directory_size())))%legal%

CREATE((n, T) , name, v) = CREATEDIR(*, directory::CREATE((*1,getdir(T)) , name, v))

Legality(REMOVE((n, T), name)) =

ConditionValue
type(T) t_dir() ¬exists(T, name)%type mismatch or file doesn't exist%
type(T) = t_dir() exists(T, name)%legal%

REMOVE((n, T) , name) = CREATEDIR(*, directory::REMOVE((*1,getdir(T)) , name))

Legality(GETINODETABLEINDEX(T, name)) = %legal%

GETINODETABLEINDEX(T, name) = getinodetableindex(T, name)

Legality(EXISTS(T, name)) =

ConditionValue
type(T) t_dir()%type mismatch%
type(T) = t_dir() %legal%

EXISTS(T, name) = exists(T, name)

Legality(ISFULL(T)) =

ConditionValue
type(T) t_dir()%type mismatch%
type(T) = t_dir() %legal%

ISFULL(T) = isfull(T)