SIMPOL Documentation

Chapter 10. The Operating System Utilities (UTOS) Component

Provides the first version of types to interact with the operating system for the purpose of manageing files and directories

UTOSdirectory

Description

A UTOSdirectory object represents a directory in a file system, and gives basic access to the entries it contains. More complex management of the items represented by the entries in the directory is provided through the UTOSdirectoryentry object type. UTOSdirectory objects should be considered to be a snapshot of a directory as it was at the time the object was created as opposed than an active directory listing, since the objects are not updated when the directory contents are changed.

Type Tags

None

Object Value

The value of a UTOSdirectory object is the full specification of the directory it represents.

UTOSdirectory.new()

Description

Creates a new UTOSdirectory object for the specified directory.

Prototype

UTOSdirectory.new ( string name, integer error )

Parameters

ParameterDefault valueType nameDescription
nameNonestring Specifies the directory to create an object for. This may be either partially or fully specified, the interpretation of partially specified names being dependent on the operating system.
error.nulinteger Specifies an object which is used to output any error code generated during creation of the UTOSdirectory object. If error is not specified or is .nul then any error which occurs during object creation will halt the program. If an error object is specified and an error occurs during object creation then the error code is output into that object and the new method returns .nul.

Properties

PropertyTypeDescription
_type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided.
__type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property.
entrycountinteger Gives the number of entries in the directory. An entry is either a file or a subdirectory.
namestring Gives just the name of the directory, rather than the full specification of its location.
typetype Specifies the UTOSdirectory type object.

Methods

createdirectory()

Description

Creates a new subdirectory in the directory represented by the UTOSdirectory object for which the method is called. A UTOSdirectoryentry object representing the new subdirectory is returned.

Prototype

UTOSdirectoryvar.createdirectory ( string name, integer error )

Parameters
ParameterDefault valueType nameDescription
nameNonestring Specifies the name of the new subdirectory.
error.nulinteger Specifies an object which is used to output any error code generated during creation of the subdirectory and the corresponding UTOSdirectoryentry object. If error is not specified or is .nul then any error which occurs during object creation will halt the program. If an error object is specified and an error occurs during object creation then the error code is output into that object and the createdirectory method returns .nul.

deleteentry()

Description

Deletes an entry from the directory for which the method is called.

Prototype

UTOSdirectoryvar.deleteentry ( integer entry, integer error )

Parameters
ParameterDefault valueType nameDescription
entryNoneinteger Specifies the entry within the UTOSdirectory object to delete. This is given as a 1-based index.
error.nulinteger Specifies an object which is used to output any error code generated during deletion of the entry. If error is not specified or is .nul then any error which occurs during the deletion will halt the program. If an error object is specified and an error occurs during deletion then the error code is output into that object.

getdirectory()

Description

Creates a new UTOSdirectory object for the directory which contains the directory represented by the object for which this method is called. This can be considered to be the 'parent' directory. If there is no such directory, e.g. if the object for which the method is called represents a root directory, then no error is raised but .nul is returned.

Prototype

UTOSdirectoryvar.getdirectory ( integer error )

Parameters
ParameterDefault valueType nameDescription
error.nulinteger Specifies an object which is used to output any error code generated during creation of the UTOSdirectory object. If error is not specified or is .nul then any error which occurs during object creation will halt the program. If an error object is specified and an error occurs during object creation then the error code is output into that object and the getdirectory method returns .nul.

getentry()

Description

Creates a new UTOSdirectoryentry object for a specific directory entry.

Prototype

UTOSdirectoryvar.getentry ( integer entry, integer error )

Parameters
ParameterDefault valueType nameDescription
entryNoneinteger Specifies the entry within the UTOSdirectory object to create an object for. This is given as a 1-based index.
error.nulinteger Specifies an object which is used to output any error code generated during creation of the UTOSdirectoryentry object. If error is not specified or is .nul then any error which occurs during object creation will halt the program. If an error object is specified and an error occurs during object creation then the error code is output into that object and the getentry method returns .nul.