ppl_yap.cc File Reference

#include "ppl.hh"
#include "pwl.hh"
#include <Yap/YapInterface.h>
#include <cassert>
#include <climits>
#include "../exceptions.hh"
#include "../ppl_prolog.icc"

Include dependency graph for ppl_yap.cc:

Go to the source code of this file.

Defines

#define YAP_STUB_0(name)
#define YAP_STUB_1(name)
#define YAP_STUB_2(name)
#define YAP_STUB_3(name)
#define YAP_STUB_4(name)
#define YAP_STUB_5(name)
#define YAP_STUB_6(name)
#define YAP_USER_C_PREDICATE(name, arity)   YAP_UserCPredicate(#name, reinterpret_cast<int(*)()>(yap_stub_##name), arity)

Typedefs

typedef YAP_Term Prolog_term_ref
typedef YAP_Atom Prolog_atom
typedef YAP_Bool Prolog_foreign_return_type

Functions

void ppl_Prolog_sysdep_init ()
void ppl_Prolog_sysdep_deinit ()
Prolog_term_ref Prolog_new_term_ref ()
int Prolog_put_term (Prolog_term_ref &t, Prolog_term_ref u)
int Prolog_put_long (Prolog_term_ref &t, long l)
int Prolog_put_ulong (Prolog_term_ref &t, unsigned long ul)
int Prolog_put_atom_chars (Prolog_term_ref &t, const char *s)
int Prolog_put_atom (Prolog_term_ref &t, Prolog_atom a)
int Prolog_put_address (Prolog_term_ref &t, void *p)
Prolog_atom Prolog_atom_from_string (const char *s)
int Prolog_construct_compound (Prolog_term_ref &t, Prolog_atom f, Prolog_term_ref a1)
int Prolog_construct_compound (Prolog_term_ref &t, Prolog_atom f, Prolog_term_ref a1, Prolog_term_ref a2)
int Prolog_construct_compound (Prolog_term_ref &t, Prolog_atom f, Prolog_term_ref a1, Prolog_term_ref a2, Prolog_term_ref a3)
int Prolog_construct_compound (Prolog_term_ref &t, Prolog_atom f, Prolog_term_ref a1, Prolog_term_ref a2, Prolog_term_ref a3, Prolog_term_ref a4)
int Prolog_construct_cons (Prolog_term_ref &c, Prolog_term_ref h, Prolog_term_ref t)
void Prolog_raise_exception (Prolog_term_ref t)
int Prolog_is_variable (Prolog_term_ref t)
int Prolog_is_atom (Prolog_term_ref t)
int Prolog_is_integer (Prolog_term_ref t)
int Prolog_is_address (Prolog_term_ref t)
int Prolog_is_compound (Prolog_term_ref t)
int Prolog_is_cons (Prolog_term_ref t)
int Prolog_get_long (Prolog_term_ref t, long *lp)
int Prolog_get_address (Prolog_term_ref t, void **vpp)
int Prolog_get_atom_name (Prolog_term_ref t, Prolog_atom *ap)
int Prolog_get_compound_name_arity (Prolog_term_ref t, Prolog_atom *ap, int *ip)
int Prolog_get_arg (int i, Prolog_term_ref t, Prolog_term_ref &a)
int Prolog_get_cons (Prolog_term_ref c, Prolog_term_ref &h, Prolog_term_ref &t)
int Prolog_unify (Prolog_term_ref t, Prolog_term_ref u)
PPL::Coefficient integer_term_to_Coefficient (Prolog_term_ref t)
Prolog_term_ref Coefficient_to_integer_term (const PPL::Coefficient &n)
void init ()

Variables

const Prolog_foreign_return_type PROLOG_SUCCESS = TRUE
const Prolog_foreign_return_type PROLOG_FAILURE = FALSE
Prolog_atom a_throw
bool Prolog_has_unbounded_integers
long Prolog_min_integer
long Prolog_max_integer
mpz_class tmp_mpz_class
Prolog_term_ref args [4]


Define Documentation

#define YAP_STUB_0 ( name   ) 

Value:

extern "C" Prolog_foreign_return_type \
yap_stub_##name() { \
  return name(); \
}

Definition at line 415 of file ppl_yap.cc.

#define YAP_STUB_1 ( name   ) 

Value:

extern "C" Prolog_foreign_return_type \
yap_stub_##name() { \
  Prolog_term_ref arg1 = YAP_ARG1; \
  return name(arg1); \
}

Definition at line 421 of file ppl_yap.cc.

#define YAP_STUB_2 ( name   ) 

Definition at line 428 of file ppl_yap.cc.

#define YAP_STUB_3 ( name   ) 

Definition at line 436 of file ppl_yap.cc.

#define YAP_STUB_4 ( name   ) 

Definition at line 445 of file ppl_yap.cc.

#define YAP_STUB_5 ( name   ) 

Definition at line 455 of file ppl_yap.cc.

#define YAP_STUB_6 ( name   ) 

Definition at line 466 of file ppl_yap.cc.

#define YAP_USER_C_PREDICATE ( name,
arity   )     YAP_UserCPredicate(#name, reinterpret_cast<int(*)()>(yap_stub_##name), arity)

Definition at line 597 of file ppl_yap.cc.

Referenced by init().


Typedef Documentation

typedef YAP_Atom Prolog_atom

Definition at line 31 of file ppl_yap.cc.

typedef YAP_Bool Prolog_foreign_return_type

Definition at line 32 of file ppl_yap.cc.

typedef YAP_Term Prolog_term_ref

Definition at line 30 of file ppl_yap.cc.


Function Documentation

Prolog_term_ref @203::Coefficient_to_integer_term ( const PPL::Coefficient &  n  )  [static]

Definition at line 399 of file ppl_yap.cc.

References Parma_Polyhedra_Library::assign_r(), and tmp_mpz_class.

00399                                                      {
00400   if (n >= LONG_MIN && n <= LONG_MAX) {
00401     long l = 0;
00402     PPL::assign_r(l, n, PPL::ROUND_NOT_NEEDED);
00403     return YAP_MkIntTerm(l);
00404   }
00405   else {
00406     PPL::assign_r(tmp_mpz_class, n, PPL::ROUND_NOT_NEEDED);
00407     return YAP_MkBigNumTerm(tmp_mpz_class.get_mpz_t());
00408   }
00409 }

void init (  ) 

Definition at line 601 of file ppl_yap.cc.

References ppl_banner(), ppl_Coefficient_is_bounded(), ppl_Coefficient_max(), ppl_Coefficient_min(), ppl_delete_LP_Problem(), ppl_delete_Polyhedron(), ppl_finalize(), ppl_initialize(), ppl_LP_Problem_add_constraint(), ppl_LP_Problem_add_constraints(), ppl_LP_Problem_clear(), ppl_LP_Problem_constraints(), ppl_LP_Problem_evaluate_objective_function(), ppl_LP_Problem_feasible_point(), ppl_LP_Problem_is_satisfiable(), ppl_LP_Problem_objective_function(), ppl_LP_Problem_OK(), ppl_LP_Problem_optimal_value(), ppl_LP_Problem_optimization_mode(), ppl_LP_Problem_optimizing_point(), ppl_LP_Problem_set_objective_function(), ppl_LP_Problem_set_optimization_mode(), ppl_LP_Problem_solve(), ppl_LP_Problem_space_dimension(), ppl_LP_Problem_swap(), ppl_max_space_dimension(), ppl_new_C_Polyhedron_from_bounding_box(), ppl_new_C_Polyhedron_from_C_Polyhedron(), ppl_new_C_Polyhedron_from_constraints(), ppl_new_C_Polyhedron_from_generators(), ppl_new_C_Polyhedron_from_NNC_Polyhedron(), ppl_new_C_Polyhedron_from_space_dimension(), ppl_new_LP_Problem(), ppl_new_LP_Problem_from_LP_Problem(), ppl_new_LP_Problem_trivial(), ppl_new_NNC_Polyhedron_from_bounding_box(), ppl_new_NNC_Polyhedron_from_C_Polyhedron(), ppl_new_NNC_Polyhedron_from_constraints(), ppl_new_NNC_Polyhedron_from_generators(), ppl_new_NNC_Polyhedron_from_NNC_Polyhedron(), ppl_new_NNC_Polyhedron_from_space_dimension(), ppl_Polyhedron_add_constraint(), ppl_Polyhedron_add_constraint_and_minimize(), ppl_Polyhedron_add_constraints(), ppl_Polyhedron_add_constraints_and_minimize(), ppl_Polyhedron_add_generator(), ppl_Polyhedron_add_generator_and_minimize(), ppl_Polyhedron_add_generators(), ppl_Polyhedron_add_generators_and_minimize(), ppl_Polyhedron_add_space_dimensions_and_embed(), ppl_Polyhedron_add_space_dimensions_and_project(), ppl_Polyhedron_affine_dimension(), ppl_Polyhedron_affine_image(), ppl_Polyhedron_affine_preimage(), ppl_Polyhedron_BHRZ03_widening_assign(), ppl_Polyhedron_BHRZ03_widening_assign_with_tokens(), ppl_Polyhedron_bounded_affine_image(), ppl_Polyhedron_bounded_affine_preimage(), ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign(), ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign_with_tokens(), ppl_Polyhedron_bounded_H79_extrapolation_assign(), ppl_Polyhedron_bounded_H79_extrapolation_assign_with_tokens(), ppl_Polyhedron_bounds_from_above(), ppl_Polyhedron_bounds_from_below(), ppl_Polyhedron_concatenate_assign(), ppl_Polyhedron_contains_Polyhedron(), ppl_Polyhedron_equals_Polyhedron(), ppl_Polyhedron_expand_space_dimension(), ppl_Polyhedron_fold_space_dimensions(), ppl_Polyhedron_generalized_affine_image(), ppl_Polyhedron_generalized_affine_image_lhs_rhs(), ppl_Polyhedron_generalized_affine_preimage(), ppl_Polyhedron_generalized_affine_preimage_lhs_rhs(), ppl_Polyhedron_get_bounding_box(), ppl_Polyhedron_get_constraints(), ppl_Polyhedron_get_generators(), ppl_Polyhedron_get_minimized_constraints(), ppl_Polyhedron_get_minimized_generators(), ppl_Polyhedron_H79_widening_assign(), ppl_Polyhedron_H79_widening_assign_with_tokens(), ppl_Polyhedron_intersection_assign(), ppl_Polyhedron_intersection_assign_and_minimize(), ppl_Polyhedron_is_bounded(), ppl_Polyhedron_is_disjoint_from_Polyhedron(), ppl_Polyhedron_is_empty(), ppl_Polyhedron_is_topologically_closed(), ppl_Polyhedron_is_universe(), ppl_Polyhedron_limited_BHRZ03_extrapolation_assign(), ppl_Polyhedron_limited_BHRZ03_extrapolation_assign_with_tokens(), ppl_Polyhedron_limited_H79_extrapolation_assign(), ppl_Polyhedron_limited_H79_extrapolation_assign_with_tokens(), ppl_Polyhedron_map_space_dimensions(), ppl_Polyhedron_maximize(), ppl_Polyhedron_maximize_with_point(), ppl_Polyhedron_minimize(), ppl_Polyhedron_minimize_with_point(), ppl_Polyhedron_OK(), ppl_Polyhedron_poly_difference_assign(), ppl_Polyhedron_poly_hull_assign(), ppl_Polyhedron_poly_hull_assign_and_minimize(), ppl_Polyhedron_relation_with_constraint(), ppl_Polyhedron_relation_with_generator(), ppl_Polyhedron_remove_higher_space_dimensions(), ppl_Polyhedron_remove_space_dimensions(), ppl_Polyhedron_space_dimension(), ppl_Polyhedron_strictly_contains_Polyhedron(), ppl_Polyhedron_swap(), ppl_Polyhedron_time_elapse_assign(), ppl_Polyhedron_topological_closure_assign(), ppl_reset_timeout(), ppl_set_timeout(), ppl_set_timeout_exception_atom(), ppl_timeout_exception_atom(), ppl_version(), ppl_version_beta(), ppl_version_major(), ppl_version_minor(), ppl_version_revision(), and YAP_USER_C_PREDICATE.

00601        {
00602   ppl_initialize();
00603   YAP_USER_C_PREDICATE(ppl_version_major, 1);
00604   YAP_USER_C_PREDICATE(ppl_version_minor, 1);
00605   YAP_USER_C_PREDICATE(ppl_version_revision, 1);
00606   YAP_USER_C_PREDICATE(ppl_version_beta, 1);
00607   YAP_USER_C_PREDICATE(ppl_version, 1);
00608   YAP_USER_C_PREDICATE(ppl_banner, 1);
00609   YAP_USER_C_PREDICATE(ppl_max_space_dimension, 1);
00610   YAP_USER_C_PREDICATE(ppl_Coefficient_is_bounded, 0);
00611   YAP_USER_C_PREDICATE(ppl_Coefficient_max, 1);
00612   YAP_USER_C_PREDICATE(ppl_Coefficient_min, 1);
00613   YAP_USER_C_PREDICATE(ppl_initialize, 0);
00614   YAP_USER_C_PREDICATE(ppl_finalize, 0);
00615   YAP_USER_C_PREDICATE(ppl_set_timeout_exception_atom, 1);
00616   YAP_USER_C_PREDICATE(ppl_timeout_exception_atom, 1);
00617   YAP_USER_C_PREDICATE(ppl_set_timeout, 1);
00618   YAP_USER_C_PREDICATE(ppl_reset_timeout, 0);
00619   YAP_USER_C_PREDICATE(ppl_new_C_Polyhedron_from_space_dimension, 3);
00620   YAP_USER_C_PREDICATE(ppl_new_NNC_Polyhedron_from_space_dimension, 3);
00621   YAP_USER_C_PREDICATE(ppl_new_C_Polyhedron_from_C_Polyhedron, 2);
00622   YAP_USER_C_PREDICATE(ppl_new_C_Polyhedron_from_NNC_Polyhedron, 2);
00623   YAP_USER_C_PREDICATE(ppl_new_NNC_Polyhedron_from_C_Polyhedron, 2);
00624   YAP_USER_C_PREDICATE(ppl_new_NNC_Polyhedron_from_NNC_Polyhedron, 2);
00625   YAP_USER_C_PREDICATE(ppl_new_C_Polyhedron_from_constraints, 2);
00626   YAP_USER_C_PREDICATE(ppl_new_NNC_Polyhedron_from_constraints, 2);
00627   YAP_USER_C_PREDICATE(ppl_new_C_Polyhedron_from_generators, 2);
00628   YAP_USER_C_PREDICATE(ppl_new_NNC_Polyhedron_from_generators, 2);
00629   YAP_USER_C_PREDICATE(ppl_new_C_Polyhedron_from_bounding_box, 2);
00630   YAP_USER_C_PREDICATE(ppl_new_NNC_Polyhedron_from_bounding_box, 2);
00631   YAP_USER_C_PREDICATE(ppl_Polyhedron_swap, 2);
00632   YAP_USER_C_PREDICATE(ppl_delete_Polyhedron, 1);
00633   YAP_USER_C_PREDICATE(ppl_Polyhedron_space_dimension, 2);
00634   YAP_USER_C_PREDICATE(ppl_Polyhedron_affine_dimension, 2);
00635   YAP_USER_C_PREDICATE(ppl_Polyhedron_get_constraints, 2);
00636   YAP_USER_C_PREDICATE(ppl_Polyhedron_get_minimized_constraints, 2);
00637   YAP_USER_C_PREDICATE(ppl_Polyhedron_get_generators, 2);
00638   YAP_USER_C_PREDICATE(ppl_Polyhedron_get_minimized_generators, 2);
00639   YAP_USER_C_PREDICATE(ppl_Polyhedron_relation_with_constraint, 3);
00640   YAP_USER_C_PREDICATE(ppl_Polyhedron_relation_with_generator, 3);
00641   YAP_USER_C_PREDICATE(ppl_Polyhedron_get_bounding_box, 3);
00642   YAP_USER_C_PREDICATE(ppl_Polyhedron_is_empty, 1);
00643   YAP_USER_C_PREDICATE(ppl_Polyhedron_is_universe, 1);
00644   YAP_USER_C_PREDICATE(ppl_Polyhedron_is_bounded, 1);
00645   YAP_USER_C_PREDICATE(ppl_Polyhedron_bounds_from_above, 2);
00646   YAP_USER_C_PREDICATE(ppl_Polyhedron_bounds_from_below, 2);
00647   YAP_USER_C_PREDICATE(ppl_Polyhedron_maximize, 5);
00648   YAP_USER_C_PREDICATE(ppl_Polyhedron_maximize_with_point, 6);
00649   YAP_USER_C_PREDICATE(ppl_Polyhedron_minimize, 5);
00650   YAP_USER_C_PREDICATE(ppl_Polyhedron_minimize_with_point, 6);
00651   YAP_USER_C_PREDICATE(ppl_Polyhedron_is_topologically_closed, 1);
00652   YAP_USER_C_PREDICATE(ppl_Polyhedron_contains_Polyhedron, 2);
00653   YAP_USER_C_PREDICATE(ppl_Polyhedron_strictly_contains_Polyhedron, 2);
00654   YAP_USER_C_PREDICATE(ppl_Polyhedron_is_disjoint_from_Polyhedron, 2);
00655   YAP_USER_C_PREDICATE(ppl_Polyhedron_equals_Polyhedron, 2);
00656   YAP_USER_C_PREDICATE(ppl_Polyhedron_OK, 1);
00657   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_constraint, 2);
00658   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_constraint_and_minimize, 2);
00659   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_generator, 2);
00660   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_generator_and_minimize, 2);
00661   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_constraints, 2);
00662   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_constraints_and_minimize, 2);
00663   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_generators, 2);
00664   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_generators_and_minimize, 2);
00665   YAP_USER_C_PREDICATE(ppl_Polyhedron_intersection_assign, 2);
00666   YAP_USER_C_PREDICATE(ppl_Polyhedron_intersection_assign_and_minimize, 2);
00667   YAP_USER_C_PREDICATE(ppl_Polyhedron_poly_hull_assign, 2);
00668   YAP_USER_C_PREDICATE(ppl_Polyhedron_poly_hull_assign_and_minimize, 2);
00669   YAP_USER_C_PREDICATE(ppl_Polyhedron_poly_difference_assign, 2);
00670   YAP_USER_C_PREDICATE(ppl_Polyhedron_affine_image, 4);
00671   YAP_USER_C_PREDICATE(ppl_Polyhedron_affine_preimage, 4);
00672   YAP_USER_C_PREDICATE(ppl_Polyhedron_bounded_affine_image, 5);
00673   YAP_USER_C_PREDICATE(ppl_Polyhedron_bounded_affine_preimage, 5);
00674   YAP_USER_C_PREDICATE(ppl_Polyhedron_generalized_affine_image, 5);
00675   YAP_USER_C_PREDICATE(ppl_Polyhedron_generalized_affine_preimage, 5);
00676   YAP_USER_C_PREDICATE(ppl_Polyhedron_generalized_affine_image_lhs_rhs, 4);
00677   YAP_USER_C_PREDICATE(ppl_Polyhedron_generalized_affine_preimage_lhs_rhs, 4);
00678   YAP_USER_C_PREDICATE(ppl_Polyhedron_time_elapse_assign, 2);
00679   YAP_USER_C_PREDICATE(ppl_Polyhedron_topological_closure_assign, 1);
00680   YAP_USER_C_PREDICATE(ppl_Polyhedron_BHRZ03_widening_assign_with_tokens, 4);
00681   YAP_USER_C_PREDICATE(ppl_Polyhedron_BHRZ03_widening_assign, 2);
00682   YAP_USER_C_PREDICATE(
00683           ppl_Polyhedron_limited_BHRZ03_extrapolation_assign_with_tokens, 5);
00684   YAP_USER_C_PREDICATE(ppl_Polyhedron_limited_BHRZ03_extrapolation_assign, 3);
00685   YAP_USER_C_PREDICATE(
00686           ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign_with_tokens, 5);
00687   YAP_USER_C_PREDICATE(ppl_Polyhedron_bounded_BHRZ03_extrapolation_assign, 3);
00688   YAP_USER_C_PREDICATE(ppl_Polyhedron_H79_widening_assign_with_tokens, 4);
00689   YAP_USER_C_PREDICATE(ppl_Polyhedron_H79_widening_assign, 2);
00690   YAP_USER_C_PREDICATE(
00691           ppl_Polyhedron_limited_H79_extrapolation_assign_with_tokens, 5);
00692   YAP_USER_C_PREDICATE(ppl_Polyhedron_limited_H79_extrapolation_assign, 3);
00693   YAP_USER_C_PREDICATE(
00694           ppl_Polyhedron_bounded_H79_extrapolation_assign_with_tokens, 5);
00695   YAP_USER_C_PREDICATE(ppl_Polyhedron_bounded_H79_extrapolation_assign, 3);
00696   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_space_dimensions_and_project, 2);
00697   YAP_USER_C_PREDICATE(ppl_Polyhedron_add_space_dimensions_and_embed, 2);
00698   YAP_USER_C_PREDICATE(ppl_Polyhedron_concatenate_assign, 2);
00699   YAP_USER_C_PREDICATE(ppl_Polyhedron_remove_space_dimensions, 2);
00700   YAP_USER_C_PREDICATE(ppl_Polyhedron_remove_higher_space_dimensions, 2);
00701   YAP_USER_C_PREDICATE(ppl_Polyhedron_expand_space_dimension, 3);
00702   YAP_USER_C_PREDICATE(ppl_Polyhedron_fold_space_dimensions, 3);
00703   YAP_USER_C_PREDICATE(ppl_Polyhedron_map_space_dimensions, 2);
00704   YAP_USER_C_PREDICATE(ppl_new_LP_Problem_trivial, 1);
00705   YAP_USER_C_PREDICATE(ppl_new_LP_Problem, 4);
00706   YAP_USER_C_PREDICATE(ppl_new_LP_Problem_from_LP_Problem, 2);
00707   YAP_USER_C_PREDICATE(ppl_LP_Problem_swap, 2);
00708   YAP_USER_C_PREDICATE(ppl_delete_LP_Problem, 1);
00709   YAP_USER_C_PREDICATE(ppl_LP_Problem_space_dimension, 2);
00710   YAP_USER_C_PREDICATE(ppl_LP_Problem_constraints, 2);
00711   YAP_USER_C_PREDICATE(ppl_LP_Problem_objective_function, 2);
00712   YAP_USER_C_PREDICATE(ppl_LP_Problem_optimization_mode, 2);
00713   YAP_USER_C_PREDICATE(ppl_LP_Problem_clear, 1);
00714   YAP_USER_C_PREDICATE(ppl_LP_Problem_add_constraint, 2);
00715   YAP_USER_C_PREDICATE(ppl_LP_Problem_add_constraints, 2);
00716   YAP_USER_C_PREDICATE(ppl_LP_Problem_set_objective_function, 2);
00717   YAP_USER_C_PREDICATE(ppl_LP_Problem_set_optimization_mode, 2);
00718   YAP_USER_C_PREDICATE(ppl_LP_Problem_is_satisfiable, 1);
00719   YAP_USER_C_PREDICATE(ppl_LP_Problem_solve, 2);
00720   YAP_USER_C_PREDICATE(ppl_LP_Problem_feasible_point, 2);
00721   YAP_USER_C_PREDICATE(ppl_LP_Problem_optimizing_point, 2);
00722   YAP_USER_C_PREDICATE(ppl_LP_Problem_optimal_value, 3);
00723   YAP_USER_C_PREDICATE(ppl_LP_Problem_evaluate_objective_function, 4);
00724   YAP_USER_C_PREDICATE(ppl_LP_Problem_OK, 1);
00725 }

PPL::Coefficient @203::integer_term_to_Coefficient ( Prolog_term_ref  t  )  [static]

Definition at line 387 of file ppl_yap.cc.

References tmp_mpz_class.

00387                                                {
00388   PPL::Coefficient n;
00389   if (YAP_IsBigNumTerm(t) != FALSE) {
00390     YAP_BigNumOfTerm(t, tmp_mpz_class.get_mpz_t());
00391     n = tmp_mpz_class;
00392   }
00393   else
00394     n = YAP_IntOfTerm(t);
00395   return n;
00396 }

void @203::ppl_Prolog_sysdep_deinit (  )  [static]

Perform system-dependent de-itialization.

Definition at line 89 of file ppl_yap.cc.

00089                            {
00090 }

void @203::ppl_Prolog_sysdep_init (  )  [static]

Performs system-dependent initialization.

Definition at line 77 of file ppl_yap.cc.

References a_throw, Prolog_has_unbounded_integers, Prolog_max_integer, and Prolog_min_integer.

00077                          {
00078   Prolog_has_unbounded_integers = true;
00079   Prolog_min_integer = 0;
00080   Prolog_max_integer = 0;
00081 
00082   a_throw = YAP_LookupAtom("throw");
00083 }

Prolog_atom @203::Prolog_atom_from_string ( const char *  s  )  [static]

Return an atom whose name is given by the null-terminated string s.

Definition at line 165 of file ppl_yap.cc.

00165                                        {
00166   return YAP_FullLookupAtom(s);
00167 }

int @203::Prolog_construct_compound ( Prolog_term_ref t,
Prolog_atom  f,
Prolog_term_ref  a1,
Prolog_term_ref  a2,
Prolog_term_ref  a3,
Prolog_term_ref  a4 
) [inline, static]

Assign to t a compound term whose principal functor is f of arity 4 with arguments a1, a2, a3 and a4.

Definition at line 216 of file ppl_yap.cc.

References args.

00218                                                                   {
00219   args[0] = a1;
00220   args[1] = a2;
00221   args[2] = a3;
00222   args[3] = a4;
00223   t = YAP_MkApplTerm(YAP_MkFunctor(f, 4), 4, args);
00224   return 1;
00225 }

int @203::Prolog_construct_compound ( Prolog_term_ref t,
Prolog_atom  f,
Prolog_term_ref  a1,
Prolog_term_ref  a2,
Prolog_term_ref  a3 
) [inline, static]

Assign to t a compound term whose principal functor is f of arity 3 with arguments a1, a2 and a3.

Definition at line 201 of file ppl_yap.cc.

References args.

00203                                               {
00204   args[0] = a1;
00205   args[1] = a2;
00206   args[2] = a3;
00207   t = YAP_MkApplTerm(YAP_MkFunctor(f, 3), 3, args);
00208   return 1;
00209 }

int @203::Prolog_construct_compound ( Prolog_term_ref t,
Prolog_atom  f,
Prolog_term_ref  a1,
Prolog_term_ref  a2 
) [inline, static]

Assign to t a compound term whose principal functor is f of arity 2 with arguments a1 and a2.

Definition at line 188 of file ppl_yap.cc.

References args.

00189                                                                   {
00190   args[0] = a1;
00191   args[1] = a2;
00192   t = YAP_MkApplTerm(YAP_MkFunctor(f, 2), 2, args);
00193   return 1;
00194 }

int @203::Prolog_construct_compound ( Prolog_term_ref t,
Prolog_atom  f,
Prolog_term_ref  a1 
) [inline, static]

Assign to t a compound term whose principal functor is f of arity 1 with argument a1.

Definition at line 176 of file ppl_yap.cc.

References args.

00177                                               {
00178   args[0] = a1;
00179   t = YAP_MkApplTerm(YAP_MkFunctor(f, 1), 1, args);
00180   return 1;
00181 }

int @203::Prolog_construct_cons ( Prolog_term_ref c,
Prolog_term_ref  h,
Prolog_term_ref  t 
) [inline, static]

Assign to c a Prolog list whose head is h and tail is t.

Definition at line 231 of file ppl_yap.cc.

00232                                                             {
00233   c = YAP_MkPairTerm(h, t);
00234   return 1;
00235 }

int @203::Prolog_get_address ( Prolog_term_ref  t,
void **  vpp 
) [inline, static]

If t is the Prolog representation for a memory address, return true and store that address into v; return false otherwise. The behavior is undefined if t is not an address.

Definition at line 320 of file ppl_yap.cc.

References Prolog_is_address().

00320                                                   {
00321   assert(Prolog_is_address(t));
00322   *vpp = reinterpret_cast<void*>(YAP_IntOfTerm(t));
00323   return 1;
00324 }

int @203::Prolog_get_arg ( int  i,
Prolog_term_ref  t,
Prolog_term_ref a 
) [inline, static]

If t is a Prolog compound term and i is a positive integer less than or equal to its arity, return true and assign to a the i-th (principal) argument of t. The behavior is undefined if t is not a Prolog compound term.

Definition at line 358 of file ppl_yap.cc.

References Prolog_is_compound().

00358                                                              {
00359   assert(Prolog_is_compound(t));
00360   a = YAP_ArgOfTerm(i, t);
00361   return 1;
00362 }

int @203::Prolog_get_atom_name ( Prolog_term_ref  t,
Prolog_atom ap 
) [inline, static]

If t is a Prolog atom, return true and store its name into name. The behavior is undefined if t is not a Prolog atom.

Definition at line 331 of file ppl_yap.cc.

References Prolog_is_atom().

00331                                                          {
00332   assert(Prolog_is_atom(t));
00333   *ap = YAP_AtomOfTerm(t);
00334   return 1;
00335 }

int @203::Prolog_get_compound_name_arity ( Prolog_term_ref  t,
Prolog_atom ap,
int *  ip 
) [inline, static]

If t is a Prolog compound term, return true and store its name and arity into name and arity, respectively. The behavior is undefined if t is not a Prolog compound term.

Definition at line 343 of file ppl_yap.cc.

References Prolog_is_compound().

00343                                                                             {
00344   assert(Prolog_is_compound(t));
00345   YAP_Functor f = YAP_FunctorOfTerm(t);
00346   *ap = YAP_NameOfFunctor(f);
00347   *ip = YAP_ArityOfFunctor(f);
00348   return 1;
00349 }

int @203::Prolog_get_cons ( Prolog_term_ref  c,
Prolog_term_ref h,
Prolog_term_ref t 
) [inline, static]

If c is a Prolog cons (list constructor), assign its head and tail to h and t, respectively. The behavior is undefined if c is not a Prolog cons.

Definition at line 370 of file ppl_yap.cc.

References Prolog_is_cons().

00370                                                                            {
00371   assert(Prolog_is_cons(c));
00372   h = YAP_HeadOfTerm(c);
00373   t = YAP_TailOfTerm(c);
00374   return 1;
00375 }

int @203::Prolog_get_long ( Prolog_term_ref  t,
long *  lp 
) [inline, static]

Assuming t is a Prolog integer, return true if its value fits in a long, in which case the value is assigned to v, return false otherwise. The behavior is undefined if t is not a Prolog integer.

Definition at line 300 of file ppl_yap.cc.

References Parma_Polyhedra_Library::assign_r(), Prolog_is_integer(), and tmp_mpz_class.

00300                                              {
00301   assert(Prolog_is_integer(t));
00302   if (YAP_IsBigNumTerm(t) != FALSE) {
00303     YAP_BigNumOfTerm(t, tmp_mpz_class.get_mpz_t());
00304     if (tmp_mpz_class >= LONG_MIN && tmp_mpz_class <= LONG_MAX)
00305       PPL::assign_r(*lp, tmp_mpz_class, PPL::ROUND_NOT_NEEDED);
00306     else
00307       return 0;
00308   }
00309   else
00310     *lp = YAP_IntOfTerm(t);
00311   return 1;
00312 }

int @203::Prolog_is_address ( Prolog_term_ref  t  )  [inline, static]

Return true if t is the representation of an address, false otherwise.

Definition at line 273 of file ppl_yap.cc.

00273                                      {
00274   return YAP_IsIntTerm(t) != FALSE;
00275 }

int @203::Prolog_is_atom ( Prolog_term_ref  t  )  [inline, static]

Return true if t is a Prolog atom, false otherwise.

Definition at line 257 of file ppl_yap.cc.

00257                                   {
00258   return YAP_IsAtomTerm(t) != FALSE;
00259 }

int @203::Prolog_is_compound ( Prolog_term_ref  t  )  [inline, static]

Return true if t is a Prolog compound term, false otherwise.

Definition at line 281 of file ppl_yap.cc.

00281                                       {
00282   return YAP_IsApplTerm(t) != FALSE;
00283 }

int @203::Prolog_is_cons ( Prolog_term_ref  t  )  [inline, static]

Return true if t is a Prolog list, false otherwise.

Definition at line 289 of file ppl_yap.cc.

00289                                   {
00290   return YAP_IsPairTerm(t) != FALSE;
00291 }

int @203::Prolog_is_integer ( Prolog_term_ref  t  )  [inline, static]

Return true if t is a Prolog integer, false otherwise.

Definition at line 265 of file ppl_yap.cc.

00265                                      {
00266   return YAP_IsIntTerm(t) != FALSE || YAP_IsBigNumTerm(t) != FALSE;
00267 }

int @203::Prolog_is_variable ( Prolog_term_ref  t  )  [inline, static]

Return true if t is a Prolog variable, false otherwise.

Definition at line 249 of file ppl_yap.cc.

00249                                       {
00250   return YAP_IsVarTerm(t) != FALSE;
00251 }

Prolog_term_ref @203::Prolog_new_term_ref (  )  [inline, static]

Return a new term reference.

Definition at line 96 of file ppl_yap.cc.

00096                       {
00097   return 0;
00098 }

int @203::Prolog_put_address ( Prolog_term_ref t,
void *  p 
) [inline, static]

Assign to t a term representing the address contained in p.

Definition at line 156 of file ppl_yap.cc.

00156                                                 {
00157   t = YAP_MkIntTerm(reinterpret_cast<long>(p));
00158   return 1;
00159 }

int @203::Prolog_put_atom ( Prolog_term_ref t,
Prolog_atom  a 
) [inline, static]

Assign to t the Prolog atom a.

Definition at line 147 of file ppl_yap.cc.

00147                                                    {
00148   t = YAP_MkAtomTerm(a);
00149   return 1;
00150 }

int @203::Prolog_put_atom_chars ( Prolog_term_ref t,
const char *  s 
) [inline, static]

Assign to t an atom whose name is given by the null-terminated string s.

Definition at line 138 of file ppl_yap.cc.

00138                                                          {
00139   t = YAP_MkAtomTerm(YAP_FullLookupAtom(s));
00140   return 1;
00141 }

int @203::Prolog_put_long ( Prolog_term_ref t,
long  l 
) [inline, static]

Assign to t a Prolog integer with value l.

Definition at line 114 of file ppl_yap.cc.

00114                                             {
00115   t = YAP_MkIntTerm(l);
00116   return 1;
00117 }

int @203::Prolog_put_term ( Prolog_term_ref t,
Prolog_term_ref  u 
) [inline, static]

Make t be a reference to the same term referenced by u, i.e., assign u to t.

Definition at line 105 of file ppl_yap.cc.

00105                                                        {
00106   t = u;
00107   return 1;
00108 }

int @203::Prolog_put_ulong ( Prolog_term_ref t,
unsigned long  ul 
) [inline, static]

Assign to t a Prolog integer with value ul.

Definition at line 123 of file ppl_yap.cc.

References tmp_mpz_class.

00123                                                        {
00124   if (ul <= LONG_MAX)
00125     t = YAP_MkIntTerm(ul);
00126   else {
00127     tmp_mpz_class = ul;
00128     t = YAP_MkBigNumTerm(tmp_mpz_class.get_mpz_t());
00129   }
00130   return 1;
00131 }

void @203::Prolog_raise_exception ( Prolog_term_ref  t  )  [inline, static]

Raise a Prolog exception with t as the exception term.

Definition at line 241 of file ppl_yap.cc.

00241                                           {
00242   YAP_Throw(t);
00243 }

int @203::Prolog_unify ( Prolog_term_ref  t,
Prolog_term_ref  u 
) [inline, static]

Unify the terms referenced by t and u and return true if the unification is successful; return false otherwise.

Definition at line 382 of file ppl_yap.cc.

00382                                                    {
00383   return YAP_Unify(t, u) != FALSE;
00384 }


Variable Documentation

Prolog_atom a_throw [static]

Definition at line 47 of file ppl_yap.cc.

Prolog_term_ref args[4] [static]

Definition at line 169 of file ppl_yap.cc.

Definition at line 37 of file ppl_yap.cc.

True if and only if the Prolog engine supports unbounded integers.

Definition at line 52 of file ppl_yap.cc.

long Prolog_max_integer [static]

If Prolog_has_unbounded_integers is false, holds the maximum integer value representable by a Prolog integer. Holds zero otherwise.

Definition at line 66 of file ppl_yap.cc.

long Prolog_min_integer [static]

If Prolog_has_unbounded_integers is false, holds the minimum integer value representable by a Prolog integer. Holds zero otherwise.

Definition at line 59 of file ppl_yap.cc.

Definition at line 36 of file ppl_yap.cc.

mpz_class tmp_mpz_class [static]

Temporary used to communicate big integers between C++ and Prolog.

Definition at line 71 of file ppl_yap.cc.


Generated on Wed Jul 16 22:55:27 2008 for PPL by  doxygen 1.5.6