Embeddability
Embeddability means the ability to embed a Prolog sub-program in a
program written in some other language or languages. It is
described in fli-emb. The specific features of this
release that contribute towards embeddability are:
- Callable Prolog: In earlier releases, Prolog could call routines
written in other languages but the reverse was not possible. Now
each language can call the other, allowing much greater freedom in the
way that multi-language programs can be organized (see fli-ffp).
- Terms in C: Compound terms can be passed to and from C. Routines
are provided for testing, unifying, comparing and constructing terms in
C. (See fli-p2f-trm)
- Access to C data structures: Arithmetic evaluation has been extended
so that elements of C data structures can be accessed. Also, there is a
new built-in predicate
assign/2
, which allows assignment into
C data structures (see mpg).
- Open OS Interface: The main interfaces between the Prolog system
and the operating system are now open. That is, the I/O and memory
management interfaces are a set of documented functions, which can
be replaced by user-defined functions. Source code is supplied for the
default versions of these functions. (See fli-emb)
- Discontiguous Memory Management: As in previous releases, the
system requests memory from the operating system only as it needs it,
and it frees it up again when possible. (This contrasts with many other
Prolog implementations in which all needed memory must be
pre-allocated.) An important difference with this release is that the
allocated memory need not be contiguous. This allows Prolog to better
co-exist with other components that share its process' address space.
- User-defined
main()
: There is no longer any necessity to use the
default main()
routine. An application may call
individual Prolog predicates and may never need to start an
interactive Prolog session (See fli-emb).
- Signal Handling: Prolog used to trap all signals and then call
any signal handler that had been specified by a user. release 3
does not intercept signals that are being handled by the user's code.