Subsections
Standard procedures
These mainly consist of mathematical procedures. All the procedures
associated with interfacing with alien procedures appear in the a68toc
section and all the transput procedures appear in the transput section.
Procedures associated with floating-point, process and
garbage-collector control appear in
section 13.6.
Mathematical procedures
Strictly speaking, there are as many precisions of each of the
mathematical functions as there are for real numbers. However, in the
standard prelude provided with the a68toc compiler, the only extra
precision implemented is that for short real
. The L
shorthand is used to simplify the list of procedures. All these
procedures depend on the corresponding C library functions, so consult
the manual pages for details.
- PROC l sqrt = (L REAL x)L REAL:
Yields the square root of
x provided that x ≥ 0.
- PROC l exp = (L REAL x)L REAL:
Yields ex if such a value exists.
- PROC l ln = (L REAL x)L REAL:
Yields the natural (or Napierian) logarithm of x
provided that x > 0, otherwise the procedure fails and errno
is set (see section 13.6 for details).
- PROC l log = (L REAL x)L REAL:
Yields the logarithm of x
to base 10.
- PROC l cos = (L REAL x)L REAL:
Yields the cosine of x, where x is in radians.
- PROC l arccos = (L REAL x)L REAL:
Yields the inverse cosine of x as a value
between L 0
and 2 l pi
inclusive. If ABS x > 1
then the procedure yields an erroneous result, but errno
is
set (see section 13.6 for details).
- PROC l sin = (L REAL x)L REAL:
Yields the sine of x, where x is in radians.
- PROC l arcsin = (L REAL x)L REAL:
Yields the inverse sine of x as a value
between L 0
and 2 l pi
inclusive. If ABS x > 1
then the procedure yields an erroneous result, but errno
is
set (see section 13.6 for details).
- PROC l tan = (L REAL x)L REAL:
Yields the tangent of x, where x is in radians.
- PROC l arctan = (L REAL x)L REAL:
Yields the inverse tangent of x as a value
between L 0
and 2 l pi
inclusive.
- PROC next random = (REF INT a)REAL:
The next INT
value after a in a pseudo-random sequence
uniformly distributed in the range L 0
to max int
is
assigned to a. The yield x is in the range 0
x < 1 obtained by
a uniform mapping of a.
- INT last random
LONG INT long last random
Names initialised to fixed values and used by other random procedures
as a seed.
- PROC random = REAL:
A call of next random(last random)
.
- PROC short random = SHORT REAL:
As for random
with the yield shortened.
- PROC l random int = (L INT n)L INT:
Yields a
pseudo-random sequence of
integers in the range 1 ≤ x ≤ n
Other procedures
The procedures whole
, fixed
and
float
are dealt with in the transput section
(13.7).
- PROC l bits pack = ([]BOOL a)L BITS:
Packs l bits width
booleans into
a value of mode L BITS
.
- PROC char in string =
(CHAR c,REF INT i,STRING s)BOOL:
If the character i>c occurs in the string s, the procedure
yields TRUE
and assigns the position of c in
s to i, otherwise it yields FALSE
when no
assignment to i takes place.
ALIEN declarations
This section contains all those values which are declared as
ALIEN
values, but which are not mentioned in the Revised
Report.
- erange err is one Linux system error used in the QAD
standard prelude.
- The following integer values are used in the transput.
- INT posix seek cur
Used in posix lseek
to specify the current position.
- INT posix seek end
Used in posix lseek
to specify the end of the file.
- INT posix seek set
Used in posix lseek
to specify a direct offset.
- These values are used in the manipulation of the kbd channel.
- INT termios vtime
The offset in the termios
structure.
- INT termios vmin
The offset in the termios
structure.
- INT tcsanow
Used in the call to linux tc set attr.
- INT isig
Used in the call to linux tc set attr.
- INT icanon
Used in the call to linux tc set attr.
- INT echo
Used in the call to linux tc set attr.
- nil func ptr has mode
CPTR
and is used to provide
a NIL
pointer to C functions.
- null c charptr is equivalent to the C value
NULL
.
- prelude is a dummy declaration used to access the
parameters provided to a program when called. It should not be used.
- The signal names in Linux are given in the following table:
sighup |
sigstkflt |
sigint |
sigchld |
sigquit |
sigcont |
sigill |
sigstop |
sigtrap |
sigtstp |
sigabrt |
sigttin |
sigbus |
sigttou |
sigfpe |
sigurg |
sigkill |
sigxcpu |
sigusr1 |
sigxfsz |
sigsegv |
sigvtalrm |
sigusr2 |
sigprof |
sigpipe |
sigwinch |
sigalrm |
sigio |
sigterm |
sigpwr |
|
|
See signal(7)
for details of each signal.
- errno identifies a value of mode
REF INT
and
contains the error number of the latest Linux system error.
ALIEN routines
All the ALIEN
routines made available by the QAD
standard prelude can be found in this section. No attempt has been
made to give details of their function: consult the “man”
pages on your Linux system for that (the appropriate page is given
after the header of each routine with the section of the Linux
programming manual given in parentheses). The ALIEN
declarations have been classified by the first word of their
identifiers which gives the standard which specifies them. For
example, the routine bsd mkstemp is
specified by the BSD4.4 standard.
Many of the routines are used in the definition of other,
higher-level routines. They are made available so that implementers of
other preludes will not have to redefine them.
Routines conforming to Ansi C
- PROC(INT)INT ansi raise
See raise(3)
.
- PROC(INT,CPTR)CPTR ansi signal
See signal(2)
.
- PROC(VECTOR[]CHARJ)REAL ansi strtod
See strtod(3)
.
Routines conforming to BSD4.4
- PROC(INT,VECTOR[]CHAR,REF INT)INT bsd accept
See accept(2)
.
- PROC(INT,VECTOR[]CHAR,INT)INT bsd bind
See bind(2)
.
- PROC(VECTOR[]CHAR,INT)INT bsd chmod
See chmod(2)
.
- PROC(INT,VECTOR[]INT,INT)INT bsd connect
See connect(2)
.
- PROC(INT,INT)INT fchmod
See fchmod(2)
.
- PROC(VECTOR[]CHAR)CCHARPTRPTR bsd gethostbyname
See gethostbyname(3)
.
- PROC(VECTOR[]CHAR,REF BITS)INT bsd inet aton
See inet_aton(3)
.
- PROC(INT)INT bsd is a tty
See isatty(3)
.
- PROC(INT,INT)INT bsd listen
See listen(2)
.
- PROC(VECTOR[]CHAR)INT bsd mkstemp
See mkstemp(3)
.
- PROC(VECTOR[]CHAR,VECTOR[]CHAR,REAL,INT,INT)INT bsd real snprintf
Although the underlying routine can be used for the transput of any
plain value, it is used here for the transput of a REAL
only.
See snprintf(3)
.
- PROC(INT,INT)INT bsd shutdown
See shutdown(2)
.
- PROC(INT,INT,INT)INT bsd socket
See socket(2)
.
Routines conforming to an ISO standard
- PROC(CPTR)INT iso at exit
See atexit(3)
.
Routines peculiar to Linux
- PROC(CPTR,CSTR)INT linux on exit
See on_exit(3)
.
- PROC(INT,CCHARPTR)INT linux tc get attr
See tcgetattr(3)
.
- PROC(INT,BITS,CCHARPTR)INT linux tc set attr
See tcsetattr(3)
.
Routines conforming to POSIX
- PROC(INT)INT posix close
See close(2)
.
- PROC(VECTOR[]CHAR,INT)INT posix creat
See creat(2)
.
- PROC(INT)VOID posix exit
See exit(2)
.
- PROC(VECTOR[]CHAR)CSTR posix get env
See getenv(3)
.
- PROC INT posix getpid
See getpid(2)
.
- PROC(INT,INT,INT)INT posix lseek
See lseek(2)
.
- PROC(VECTOR[]CHAR,INT,INT)INT posix open
See open(2)
.
- PROC(INT,VECTOR[]CHAR,INT)INT posix read
See read(2)
.
- PROC(VECTOR[]CHAR,VECTOR[]CHAR)INT posix rename
See rename(2)
.
- PROC(INT)CSTR posix strerror
See strerror(3)
.
- PROC(CSTR)INT posix strlen
See strlen(3)
.
- PROC(REF INT)INT posix time
See time(2)
.
- PROC(VECTOR[]CHAR)INT posix unlink
See unlink(2)
.
- PROC(INT,VECTOR[]CHAR,INT)INT posix write
See write(2)
.
Local routines
- PROC(REF SHORT BITS)VOID get fpu cw
Gets the control word of the floating point unit.
- PROC(SHORT BITS)VOID set fpu cw
Sets the control word of the floating point unit.
- PROC(REAL,REF INT)VOID ph round
Rounds a REAL
to an INT
.
Sian Mountbatten
2012-01-19