[ Reference Manual | Alphabetic Index ]library(cprolog)
C-Prolog compatibility package
[more]
Predicates
- .(?, ?, ?)
- No description available
- abolish(?, ?)
- No description available
- arg(?, ?, ?)
- No description available
- consult(?)
- No description available
- current_functor(?, ?)
- No description available
- current_predicate(?, ?)
- No description available
- db_reference(?)
- No description available
- erased(?)
- No description available
- fileerrors
- No description available
- get(?)
- No description available
- get0(?)
- No description available
- heapused(?)
- No description available
- instance(?, ?)
- No description available
- leash(?)
- No description available
- log(?, ?)
- No description available
- log10(?, ?)
- No description available
- nofileerrors
- No description available
- primitive(?)
- No description available
- prompt(?, ?)
- No description available
- put(?)
- No description available
- reconsult(?)
- No description available
- sh
- No description available
Reexports
- reexport cio
- reexport eclipse_language
- except get / 1, put / 1, instance / 2, abolish / 1, arg / 3, macro(if / 2, _, _)
Other Exports
- export op(0, xfx, of)
- export op(0, xfx, with)
- export op(0, xfy, do)
- export op(0, xfx, @)
- export op(0, fx, -?->)
- export macro(with / 2, = / 2, [])
- export macro(of / 2, = / 2, [])
- export syntax_option(nl_in_quotes)
- export syntax_option(no_blanks)
- export syntax_option(no_array_subscripts)
- export syntax_option(limit_arg_precedence)
- export syntax_option(doubled_quote_is_quote)
- export syntax_option(bar_is_no_atom)
- export syntax_option(bar_is_semicolon)
- export syntax_option(no_attributes)
- export syntax_option(no_curly_arguments)
- export syntax_option(blanks_after_sign)
- export chtab(36, lower_case)
- export chtab(92, symbol)
- export chtab(128, string_quote)
- export chtab(34, list_quote)
- export chtab(96, symbol)
- export op(300, xfx, mod)
- export op(500, fx, +)
- export op(500, fx, -)
- export op(900, fy, spy)
- export op(900, fy, nospy)
Description
One of the requirements during the development of ECLiPSe has been the
aim of minimising the work required to port traditional Prolog
programs to ECLiPSe. A de-facto standard for many years was the
C-Prolog dialect, often referred to as Edinburgh Prolog. Therefore,
many of the non standard predicates in C-Prolog have also been
included in ECLiPSe. It is of course impossible to achieve total
compatibility between the two systems. To assist in making the
changes necessary to run a C-Prolog program on the current version of
ECLiPSe, we describve here the predicates available in the
C-Prolog compatibility library and summarise the principal
differences between ECLiPSe Prolog and C-Prolog.
Most of the C-Prolog predicates are also ECLiPSe built-in predicates
and so they can be always accessed.
Please note that this text does not detail the functionality of
C-Prolog, refer to the C-Prolog documentation for this information.
The effect of the compatibility library is local to the module where
it is loaded. For maximum compatibility, a C-Prolog program should
be wrapped in a separate module starting with a directive like
:- module(mymodule, [], cprolog).
In this case, Eclipse-specific language constructs will not be available.
If the compatibility package is loaded into a standard module, e.g. like
:- module(mymixedmdule).
:- use_module(library(cprolog)).
then C-Prolog and Eclipse language features can be used together.
However, ambiguities must be resolved explicitly and confusion may
arise from the different meaning of quotes in Eclipse vs C-Prolog.
Note that the C-Prolog compatibility package includes the cio
library (for see/1, seeing/1, seen/0, skip/1, tab/1, tell/1, telling/1,
told/0).
The following C-Prolog predicates are not available in ECLiPSe, or
the corresponding predicates have a different semantics:
- assert/2, asserta/2, assertz/2, clause/3
- ECLiPSe does not support database references for clauses.
- expand_term/2
- This is not supported. ECLiPSe provides the macro facility
for transforming input terms (see chapter 13).
- 'LC'/0, 'NOLC'/0
- These are not supported in ECLiPSe.
The following differences remain even with the compatibility package:
- Database References
- ECLiPSe provides database references only for terms in the indexed database, not for program clauses.
- Numbers
- C-Prolog has a tendency to "prefer" integers over real
numbers. For instance, under C-Prolog when the call X is
4.0/2.0 is made, X is instantiated to an integer. This
behaviour does not occur in ECLiPSe. The order of integers
and reals in the standard order is different.
- Operators
- In C-Prolog there is a bug regarding the operator not -- it
binds closer than its precedence declaration.
- Strings
- Strings are simulated in C-Prolog by lists. Under C-Prolog
mode, ECLiPSe provides this functionality -- double-quoted
strings are parsed as lists of integers. This can cause
confusion when pure ECLiPSe predicates are used in C-Prolog
mode, e.g. substring/3 will not accept double-quoted items,
since they are lists, not ECLiPSe strings. The built-in
string_list/2 converts between both representations.
- consult/1, reconsult/1
- These are implemented by simply calling the ECLiPSe predicate
compile/1. By default all compiled procedures are static.
Procedures on which assert/1 etc. will be applied, have to be
declared as dynamic using dynamic/1. The notation [-File] for
reconsult/1 is not supported.
- get/1
- This is similar to the ECLiPSe predicate get/1, but
control characters and blank spaces are skipped.
- put/1
- This is similar to the ECLiPSe predicate put/1, but it
first applies arithmetic evaluation to its argument.
- heapused/1
- Needed for evaluating heapused in arithmetic expressions.
It returns the sum of code heap and general heap usage.
- instance/2
- Note that this compatibility predicate redefines the
ECLiPSe builtin of the same name but different meaning (which
is no longer available in C-Prolog mode). It is implemented
using the ECLiPSe predicate referenced_record/2.
- log/2, log10/2
- These are not predicates in C-Prolog (arithmetic
functors), but in ECLiPSe they are needed for evaluating log/1
and log10/1 in arithmetic expressions.
- ttyput/1
- corresponds to the DEC-10 Prolog predicate
The list below describes the syntax differences between ECLiPSe
and C-Prolog. The following C-Prolog properties are simulated by
the compatibility package:
- single (resp. double) quote must be doubled between single (resp. double) quotes.
- $ is a normal character.
- the symbol | is not an atom.
The following properties of original C-Prolog are not simulated by
the compatibility package:
- a clause can not be ended by end of file.
- based integers are not accepted.
- comments are not a delimiter (just ignored).
- {} is not an atom.
- [] can not be a functor.
About
- Author: Various, ECRC Munich
- Copyright © Cisco Systems, Inc
- Date: $Date: 2016/10/07 02:13:06 $
See Also
library(cio), library(quintus)
Generated from cprolog.eci on 2022-09-03 14:26