User guide

52 CHAPTER 3. THE LIBRARY
block (TCB) is unlinked from the priority chain and removed from tasktab. Finally
its segment list and the TCB itself return ed to free store. It returns a non zero value
if successful. On failure, it returns zero with result2 set t o 101 if taskid is invalid, or
to 108 i f the task is not deletabl e.
res := dqpkt(id, pkt) CIN:n, POS:y, NAT:n
This Cintpos function attempts to dequeue the given packet from the task or device
specified by id. If not found there, it may have already been returned to the current
task so its work queue is searched. The result is the id of the task or device whose
work queue contained the packet. If there is an error, the resu l t is zero with result2
set to 101 for invalid id or 109 if the packet was not found. The id field of the packet
is set to the id of the task or device whose work queue contained the packet provided
that this is not the id of the current task .
endread() CIN:y, POS:y, NAT:y
This routine closes the currently s el e c te d input stream by calling endstream(cis).
endstream(scb) CIN:y, POS:y, NAT:y
This routine closes the stream whose control block is scb.
endwrite() CIN:y, POS:y, NAT:y
This routine closes the currently selected output stream by cal l i ng endstream(cos).
scb := findappend(name) CIN:y, POS:y, NAT:y
This function opens an output stream specified by the file name name in append
mode causing all output t o b e appended onto the end of the file. If the file name is
relative and the prefix string is set, it is prepended to the name before attempting to
open the stream. If the file does not exist a zero length file of the given name is created.
If there is an error the result is zero.
n := findarg(keys, item) CIN:y, POS:y, NAT:y
The function findarg was primari l y designed for use by rdargs but since it is
sometimes use fu l on its own, it is publicly available. Its first argument, keys, i s a string
of keys of the form used by rdargs and item is a stri ng. If t he result is positive, it
is the argument number of the keyword that matches item, otherwise the result is -1.
During matching all letters are converted to uppercase, but this convention may change
in future.
scb := findinput(name) CIN:y, POS:y, NAT:y
This function opens an input stream. If name is the string "*" then it opens the
standard input stream which is normally from the keyboard, otherwise name is taken
to be a device or file name. If the file name is relative and the prefix string is s et , it
is prepended to the name before attempting to open the stream. If the stream cannot
be opened the result i s zero. See Section 3.3.2 for information about the treatment of
filenames.
scb := findoutput(name) CIN:y, POS:y, NAT:y
This function opens an output stream specified by the device or file name name. I f