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.

  1. PROC l sqrt = (L REAL x)L REAL:
    Yields the square root of x provided that x ≥ 0.
  2. PROC l exp = (L REAL x)L REAL:
    Yields ex if such a value exists.
  3. 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).
  4. PROC l log = (L REAL x)L REAL:
    Yields the logarithm of x to base 10.
  5. PROC l cos = (L REAL x)L REAL:
    Yields the cosine of x, where x is in radians.
  6. 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).
  7. PROC l sin = (L REAL x)L REAL:
    Yields the sine of x, where x is in radians.
  8. 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).
  9. PROC l tan = (L REAL x)L REAL:
    Yields the tangent of x, where x is in radians.
  10. 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.
  11. 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 $ \leq$ x < 1 obtained by a uniform mapping of a.
  12. INT last random
    LONG INT long last random
    Names initialised to fixed values and used by other random procedures as a seed.
  13. PROC random = REAL:
    A call of next random(last random).
  14. PROC short random = SHORT REAL:
    As for random with the yield shortened.
  15. 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).

  1. PROC l bits pack = ([]BOOL a)L BITS:
    Packs l bits width booleans into a value of mode L BITS.
  2. 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.

  1. erange err is one Linux system error used in the QAD standard prelude.
  2. The following integer values are used in the transput.
    1. INT posix seek cur
      Used in posix lseek to specify the current position.
    2. INT posix seek end
      Used in posix lseek to specify the end of the file.
    3. INT posix seek set
      Used in posix lseek to specify a direct offset.
  3. These values are used in the manipulation of the kbd channel.
    1. INT termios vtime
      The offset in the termios structure.
    2. INT termios vmin
      The offset in the termios structure.
    3. INT tcsanow
      Used in the call to linux tc set attr.
    4. INT isig
      Used in the call to linux tc set attr.
    5. INT icanon
      Used in the call to linux tc set attr.
    6. INT echo
      Used in the call to linux tc set attr.
  4. nil func ptr has mode CPTR and is used to provide a NIL pointer to C functions.
  5. null c charptr is equivalent to the C value NULL.
  6. prelude is a dummy declaration used to access the parameters provided to a program when called. It should not be used.
  7. 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.
  8. 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

  1. PROC(INT)INT ansi raise
    See raise(3).
  2. PROC(INT,CPTR)CPTR ansi signal
    See signal(2).
  3. PROC(VECTOR[]CHARJ)REAL ansi strtod
    See strtod(3).


Routines conforming to BSD4.4

  1. PROC(INT,VECTOR[]CHAR,REF INT)INT bsd accept
    See accept(2).
  2. PROC(INT,VECTOR[]CHAR,INT)INT bsd bind
    See bind(2).
  3. PROC(VECTOR[]CHAR,INT)INT bsd chmod
    See chmod(2).
  4. PROC(INT,VECTOR[]INT,INT)INT bsd connect
    See connect(2).
  5. PROC(INT,INT)INT fchmod
    See fchmod(2).
  6. PROC(VECTOR[]CHAR)CCHARPTRPTR bsd gethostbyname
    See gethostbyname(3).
  7. PROC(VECTOR[]CHAR,REF BITS)INT bsd inet aton
    See inet_aton(3).
  8. PROC(INT)INT bsd is a tty
    See isatty(3).
  9. PROC(INT,INT)INT bsd listen
    See listen(2).
  10. PROC(VECTOR[]CHAR)INT bsd mkstemp
    See mkstemp(3).
  11. 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).
  12. PROC(INT,INT)INT bsd shutdown
    See shutdown(2).
  13. PROC(INT,INT,INT)INT bsd socket
    See socket(2).

Routines conforming to an ISO standard

  1. PROC(CPTR)INT iso at exit
    See atexit(3).

Routines peculiar to Linux

  1. PROC(CPTR,CSTR)INT linux on exit
    See on_exit(3).
  2. PROC(INT,CCHARPTR)INT linux tc get attr
    See tcgetattr(3).
  3. PROC(INT,BITS,CCHARPTR)INT linux tc set attr
    See tcsetattr(3).


Routines conforming to POSIX

  1. PROC(INT)INT posix close
    See close(2).
  2. PROC(VECTOR[]CHAR,INT)INT posix creat
    See creat(2).
  3. PROC(INT)VOID posix exit
    See exit(2).
  4. PROC(VECTOR[]CHAR)CSTR posix get env
    See getenv(3).
  5. PROC INT posix getpid
    See getpid(2).
  6. PROC(INT,INT,INT)INT posix lseek
    See lseek(2).
  7. PROC(VECTOR[]CHAR,INT,INT)INT posix open
    See open(2).
  8. PROC(INT,VECTOR[]CHAR,INT)INT posix read
    See read(2).
  9. PROC(VECTOR[]CHAR,VECTOR[]CHAR)INT posix rename
    See rename(2).
  10. PROC(INT)CSTR posix strerror
    See strerror(3).
  11. PROC(CSTR)INT posix strlen
    See strlen(3).
  12. PROC(REF INT)INT posix time
    See time(2).
  13. PROC(VECTOR[]CHAR)INT posix unlink
    See unlink(2).
  14. PROC(INT,VECTOR[]CHAR,INT)INT posix write
    See write(2).

Local routines

  1. PROC(REF SHORT BITS)VOID get fpu cw
    Gets the control word of the floating point unit.
  2. PROC(SHORT BITS)VOID set fpu cw
    Sets the control word of the floating point unit.
  3. PROC(REAL,REF INT)VOID ph round
    Rounds a REAL to an INT.
Sian Mountbatten 2012-01-19