#include <quintus/quintus.h>
     int QP_query(pred_ref, arg1,...,arg255)
     QP_pred_ref pred_ref;

Make a determinate query in a single C function call.


The first argument passed to QP_query() is a reference to the Prolog predicate to be called. QP_query() accepts between 0 and 255 arguments after its first argument. Any arguments after the first represent parameters to be passed to and from the Prolog predicate. For the types of arguments that may be passed between C and Prolog predicates, see fli-ffp.

The foreign language interface will interpret arguments passed to the Prolog predicate according to the call specification given when the predicate was made callable. Hence, it is important that the arguments to be passed to and from the Prolog predicate should correspond with that call specification. In certain cases (passing Prolog atoms in canonical form) it is possible to detect inconsistencies between data supplied to QP_query() and the call specification, but for the most part this is impossible. Calls that are inconsistent with their call specifications will produce undefined results.

Only when the return value is QP_SUCCESS are the values in variables passed as outputs from Prolog valid. Otherwise, their contents are undefined.

Return Value

query was made and a solution to the query was computed
query was made but no solution could be found
either the query could not be made, or that an exception was signaled from Prolog but not caught.

See Also

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