- Documentation
- Reference manual
- Foreign Language Interface
- The Foreign Include File
- Argument Passing and Control
- Atoms and functors
- Analysing Terms via the Foreign Interface
- Constructing Terms
- Unifying data
- Convenient functions to generate Prolog exceptions
- Foreign language wrapper support functions
- Serializing and deserializing Prolog terms
- BLOBS: Using atoms to store arbitrary binary data
- Exchanging GMP numbers
- Calling Prolog from C
- Discarding Data
- String buffering
- Foreign Code and Modules
- Prolog exceptions in foreign code
- Catching Signals (Software Interrupts)
- Miscellaneous
- Errors and warnings
- Environment Control from Foreign Code
- Querying Prolog
- Registering Foreign Predicates
- Foreign Code Hooks
- Storing foreign data
- Embedding SWI-Prolog in other applications
- The Foreign Include File
- Foreign Language Interface
- Packages
- Reference manual
query.
qid_t PL_current_query(void) Returns the query id of the current query or
PL_engine_t PL_query_engine(qid_t
qid) Return the engine to which qid belongs. Note that interacting
with a query or the Prolog terms associated with a query requires the
engine to be current. See PL_set_engine().
int PL_call_predicate(module_t
m, int flags, predicate_t pred, term_t +t0) Shorthand for PL_open_query(), PL_next_solution(), PL_cut_query(),
generating a single solution. The arguments are the same as for
PL_open_query(),
the return value is the same as PL_next_solution().
int PL_call(term_t
t, module_t m) Call term t just like the Prolog predicate once/1. t
is called in the module m, or in the context module if m
== NULL. Returns
0
if the
current thread is not executing any queries.TRUE
if the call succeeds, FALSE
otherwise. If the goal raises an exception the return value is
FALSE
and the exception term is available using
PL_exception(0).226Up
to version 9.1.11 the debugger was started and the exception was not
propagated.
Figure 7 shows
an example to obtain the number of defined atoms.