© Jørgen Steensgaard-Madsen, Copenhagen, 2006
File operations                                                  

The following type operators are defined internally for all Howard languages:
void int real string Text Output void NONE
Other type operators are globally bound, with predefined support in some contributions. A number before a type operator name tells how many types are needed to form a type of the named kind - e.g. one type (the element type) is required to determine a list type.
Input complex  1 Array  1 List 2 Tuple  1 Option  1 Tree

Operation overview

An operation signature associates a name with a list of clause descriptions and possibly a result type. An application of an operation is called a command.
Function arguments are simple examples of clauses, as are the branches of a conditional command. In more complex cases a clause may be the scope of some descendants of the command operation. Different clauses will usually have different descendants.
A clause description is a signature itself: it associates a name of the clause with a list of signatures of descendants. Detailed information about the language of signatures and commands will have to be found elsewhere.


[ scantext OF W
     [Body ... : W] ]

Clause   Body of operation scantext
The Body clause is evaluated once for each line of source, until it is exhausted or an explicit termination is requested. Member operations are


[ is_file
     [Kind ... : Attr] : int ]

Files have attributes that classify their use. A computation can test whether a file has a given attribute. A result of 1 tells that it has, 0 that it has not the given attribute.
Clause   Kind of operation is_file
The following type is locally bound, i.e. abstract types.

The clause computes the attribute to check for. The possible values are of a type defined for the Kind clause only.


[ scandir OF T
     [Entry ... : T] : T ]

Simple applications of scandir evaluate the Entry clause once for each file in the directory given as name. Each evaluation will provide the name of one entry in the directory.
Evaluation of Entry may also ask for names of a fixed (maximum) number of entries of a list of all entry names..
Clause   Entry of operation scandir
Clause   SubEntry of operation subscan


[ open_in OF U
     [Body ... : U] ]

Evaluates Body and provides an input stream from filename during the evaluation.
open_in F ("/tmp/data",scantext(F,stdout << ~line));

Note that F is considered a label of Body as well as of filename in this case.
Clause   Body of operation open_in


[ open_out OF U
     [Body ... : U] ]

Evaluates Body and provides an output stream to filename during the evaluation.
Clause   Body of operation open_out


[ tempfile OF U[Body ... : U] ]

Generates a pathname that can be used for a temporary file and makes it available during evaluation of Body (once only).
Clause   Body of operation tempfile


[ inp_channel OF U
     [Body ... : U] ]

Given a valid input file descriptor, fd, an application of inp_channel evaluate Body once and provides an input stream for data from fd.
Clause   Body of operation inp_channel


[ out_channel OF U
     [Body ... : U] ]

Given a valid output file descriptor, fd, an application of out_channel evaluate Body once and provides an input stream for data from fd.
Clause   Body of operation out_channel


[ lock_update OF W
     [Action ... : W] : W ]

Allows a file identified by name to be updated under a simple protection scheme, where competitors respect not to access name when a file name.lock is present.
Clause   Action of operation lock_update
Action is active only after a lock-file has succesfully been created, possibly after awaiting termination of competitors. When it has terminated, the lock-file is removed.


·Demo language
Implementation tool

General properties

Somefix operators
Predefined type operators
Mutable variables
Functions for mathematics
·File operations
Processes and connections
Misc. utilities
New type operators
Top-level entities

File translated from TEX by TTH, version 3.33.
On 18 Oct 2006, 16:47.
SourceForge.net Logo