QP_pred()

Synopsis

     #include <quintus/quintus.h>
     
     QP_pred_ref QP_pred(name_atom, arity, module_atom)
     QP_atom name_atom;
     int     arity;
     QP_atom module_atom;
     

Looks up a callable Prolog predicate.

QP_pred() is faster, but less convenient, than QP_predicate()

Description

Differences from QP_predicate(): Name and module arguments passed as Prolog atoms. These may have been returned to C from Prolog, or may have been built in the foreign language using QP_atom_from_string().

The name passed is not the name of the Prolog predicate to be called, but rather the name of the interface predicate constructed when the Prolog predicate was made callable from foreign code (see fli-ffp-ppc).

Much of the cost of QP_predicate() is from having to look up Prolog atoms for its name and module arguments. By avoiding doing this unnecessarily, what QP_pred() gives up in convenience is returned in performance.

Return Value


QP_pred_ref
a valid predicate reference
QP_ERROR
if the predicate called hasn't been declared callable or doesn't exist

See Also

QP_predicate(), QP_query(), QP_open_query(), QP_next_solution(), QP_cut_query(), QP_close_query(), fli-ffp