QP_open_query()

Synopsis

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

Initiates a nondeterminate Prolog query.

Description

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 arguments passed to QP_open_query() are identical to those that would be passed to QP_query(); however, QP_open_query() does not compute a solution to the query. Its effect is to prepare Prolog for the computation of solutions to the query, which must be initiated using QP_next_solution(). For consistency checking, QP_open_query() returns a QP_qid, which represents the Prolog query. The type definition for QP_qid is found in the file <quintus/quintus.h>.

The QP_qid returned by a call to QP_open_query() must be passed to each call to QP_next_solution() for that query, as well as to QP_cut_query() or QP_close_query() when terminating the query.

When requesting solutions from an open nondeterminate query, input and output parameters are not passed. The effect of QP_open_query() is to pass inputs to Prolog, which subsequently maintains them. It also tells Prolog where storage for outputs has been reserved. This storage will be written to when solutions are returned.

Return Value


QP_qid
query was opened successfully
QP_ERROR
an error occurred when attempting to open the query and the query was automatically terminated

See Also

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