User guide

3.3. GLOBAL FUNCTIONS 71
otherwise it returns pollingch (=-3). If the input stream is exhausted it returns
endstreamch (= -1). Unlike sardch, the character is not echoed to the standard output
stream.
res := sys(Sys
putsysval, addr, val) CIN:y, POS:y, NAT:n
This function set the contents of the m achine memory location whose address is
addr to val returning its previous setting.
sys(Sys
quit, code) CIN:y, POS:y, NAT:n
This saves the Cintcode register s in the vector of registers given to the interpreter
when it was invoked an d returns with the result code to the (C) program that called
this invocation of the interpreter. This is normally used to exit from the Cintcode
system, but can also be used to return from recursive invocations of the interpreter
(see sys(Sys
interpret,regs) above). A code of zero denotes successful completion
and, i f invoked at the out e r most level, cause s the BCPL Cintcode Syst em to terminate.
n := sys(Sys
read, fp, buf, len) CIN:y, POS:y, NAT:y
This reads upto len bytes from the file specified by the file pointer f p into
the byte buffer buf. The file pointer fp must have been created by a call of
sys(Sys
openread,...). The number of bytes actually read is returned as the re-
sult.
res := sys(Sys
renamefile, old, new) CIN:y, POS:y, NAT:y
This renames file old to new. It return 0 if successful.
sys(Sys
rti, regs) CIN:n, POS:y, NAT:n
Under Cintpos, this returns from an interrupt by setting the Cintcode registe r s to
the values speci fie d by regs.
ch := sys(Sys
sardch) CIN:y, POS:y, NAT:y
This returns the next character from standard input (normally the keyboard). The
character is echoed to standard output (normally the sc r e en) . If the -c or -- command
options are given when cintsys or cintpos is invoked, standard input is prefixed with
text from the command line. For details, see Section 12.2 on page 208.
sys(Sys
saveregs, regs) CIN:n, POS:y, NAT:n
Under Cintpos, this saves the current Cintcode registers in regs.
sys(Sys
sawrch, ch) CIN:y, POS:y, NAT:y
This sends character repesented by the least significant 8 bi t of ch to the standard
output (normally the screen). If ch=10, the characters carriage retu r n followed by
linefeed are transmitted.
res := sys(Sys seek, fd, pos) CIN:y, POS:y, NAT:y
This wil l set the file position pointer of the opened file whose descriptor is fd to
pos. The fil e descriptor is normally in the scb
fd field of the stream c ontrol block for
that file. See Section 3.4 for more information about random access files.