User guide

3.3. GLOBAL FUNCTIONS 53
name is the string "*" then it opens the standard output stream which is normally to
the screen. If the file name is relative and the prefix string is set, it is prepended to
the name before attempti n g to open the str e am. If the stream cannot be opened the
result is zero. If the stream cannot be opened, the result is zero. See Section 3.3.2 for
information abou t the treatment of filenames.
res := get record(v, recno, scb) CIN:y, POS:y, NAT:y
This attempts to read the record numbered recno fr om the fil e whose st r eam control
block is scb into the vector v. The record length must have bee n set already by a call
of setrecordlength. If get
record is s uc ce ss ful it returns TRUE, otherwise it returns
FALSE possibly because the end of file was reached before the whole record had been
read.
v := getlogname(logname) CIN:y, POS:y, NAT:y
This function searches the list of logical variab l es held in the root node and returns
its value if found, otherwise it returns zero.
v := getvec(upb) CIN:y, POS:y, NAT:y
This function allocates space using a first fit algorithm based on a list of blocks
chained together in memory order. Word zero of each block in the chain contains a flag
in its least significant bit indicating whether the block is allocated or free. The rest of
the word is an even number giving the size of the bl ock in words. A pointer to the first
block in the chain is held in the rootnode.
getvec allocates a vector with upper bound upb fr om the first large enough free
block on the block list. If no such block exists it returns zero. A vector previously
allocated by getvec can be freed by the above call of freevec. Coalescing of adjacent
free blocks is performed by getvec.
An extra word is allocated just before the start of each block to hold its size, and
four or five words are added to the end of each block and filled with special data that
is checked when the block is returned to free store. This catches many common space
allocation errors.
res := globin(segl) CIN:y, POS:y, NAT:y
This funct i on initialises the global vari abl e s defined i n the li s t of program modules
given by its ar gume nt segl. It returns zero if the global vector was too small, otherwise
it returns segl.
res := hold(taskid) CIN:n, POS:y, NAT:n
This Cintpos function sets the HOLD bit in the task control block of the specifie d
task. It returns a non zero value if successful. If there i s an error, it returns zero with
result2 set to 101 if taskid was invalid, and 110 if the specified task was already in
HOLD state. If the task holds it se l f control is given to next lower priority r u nnabl e
task.