next up previous contents index
Next: 11.4 Backtraces Up: 11. Exception Handling Previous: 11.2.2 Predicates to Handle   Contents   Index

11.3 Convenience Predicates

The following convenience predicates are provided to make a commonly used check and throw an ISO error if the check is not satisfied. All these predicates must be imported from the module error_handler.

check_atom(?Term,+Predicate,+Arg)
error_handler
Checks that Term is an atom. If so, the predicate succeeds; if not it throws a type error.

check_ground(?Term,+Predicate,+Arg)
error_handler
Checks that Term is ground. If so, the predicate succeeds; if not it throws an instantiation error.

check_integer(?Term,+Predicate,+Arg)
error_handler
Checks that Term is an integer. If so, the predicate succeeds; if not it throws a type error.

check_nonvar(?Term,+Predicate,+Arg)
error_handler
Checks that Term is not a variable. If not, the predicate succeeds; if Term is a variable, it throws an instantiation error.

check_var(?Term,+Predicate,+Arg)
error_handler
Checks that Term is a variable. If so, the predicate succeeds; if not it throws an instantiation error.

check_nonvar_list(?Term,+Predicate,+Arg)
error_handler
Checks that Term is a list, each of whose elements is ground. If so, the predicate succeeds; if not it throws an instantiation error.

check_stream(?Stream,+Predicate,+Arg)
error_handler
Checks that Stream is a stream. If so, the predicate succeeds; if not it throws an instantiation error 11.5.

check_one_thread(+Operation,+Object_Type,+Predicate)
error_handler
In the Multi-Threaded Engine, checks that there is only one active thread: if not, a miscellaneous error is thrown indicating that Operation is not permitted on ObjectType as called by Predicate, when more than one thread is active. This check provides a convenient way to allow inclusion of certain operations that are difficult to make thread-safe by other means.

In the single-threaded engine this predicate always succeeds.


next up previous contents index
Next: 11.4 Backtraces Up: 11. Exception Handling Previous: 11.2.2 Predicates to Handle   Contents   Index
Terrance Swift 2007-10-05