Next: Reading data from a
Up: Analysing Terms via the
Previous: Analysing Terms via the
  Contents
  Index
- intPL_term_typeterm_t
Obtain the type of a term, which should be a term returned by
one of the other interface predicates or passed as an argument. The
function returns the type of the Prolog term. The type identifiers are
listed below. Note that the extraction functions PL_ge_t*() also
validate the type and thus the two sections below are equivalent.
| PL_VARIABLE |
An unbound variable. The value of term as such
is a unique identifier for the variable. |
| PL_ATOM |
A Prolog atom. |
| PL_STRING |
A Prolog string. |
| PL_INTEGER |
A Prolog integer. |
| PL_FLOAT |
A Prolog floating point number. |
| PL_TERM |
A compound term. Note that a list is a
compound term 2. |
The functions PL_is_type are an alternative to PL_term_type. The
test PL_is_variableterm is equivalent to
PL_term_typeterm == PL_VARIABLE, but the first is considerably
faster. On the other hand, using a switch over PL_term_type is faster
and more readable then using an if-then-else using the functions below.
All these functions return either TRUE or FALSE.
- intPL_is_variableterm_t
Returns non-zero if term is a variable.
intPL_is_atomterm_t
Returns non-zero if term is an atom.
intPL_is_stringterm_t
Returns non-zero if term is a string.
intPL_is_integerterm_t
Returns non-zero if term is an integer.
intPL_is_floatterm_t
Returns non-zero if term is a float.
intPL_is_compoundterm_t
Returns non-zero if term is a compound term.
intPL_is_functorterm_t, functor_t
Returns non-zero if term is compound and its functor is functor.
This test is equivalent to PL_get_functor, followed by testing the
functor, but easier to write and faster.
intPL_is_listterm_t
Returns non-zero if term is a compound term with functor ./2 or
the atom [].
intPL_is_atomicterm_t
Returns non-zero if term is atomic (not variable or compound).
intPL_is_numberterm_t
Returns non-zero if term is an integer or float.
Next: Reading data from a
Up: Analysing Terms via the
Previous: Analysing Terms via the
  Contents
  Index
Dr. Richard Botting
2001-12-12