--- a/interfaces/Prolog/Ciao/ciao_cfli.hh +++ b/interfaces/Prolog/Ciao/ciao_cfli.hh @@ -296,7 +296,7 @@ Prolog_get_atom_name(Prolog_term_ref t, The behavior is undefined if \p t is not a Prolog compound term. */ inline int -Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, int* ip) { +Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, size_t* ip) { assert(Prolog_is_compound(t)); *ap = ciao_structure_name(t); *ip = ciao_structure_arity(t); --- a/interfaces/Prolog/GNU/gprolog_cfli.hh +++ b/interfaces/Prolog/GNU/gprolog_cfli.hh @@ -420,9 +420,11 @@ Prolog_get_atom_name(Prolog_term_ref t, The behavior is undefined if \p t is not a Prolog compound term. */ inline int -Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, int* ip) { +Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, size_t* ip) { + int i; assert(Prolog_is_compound(t)); - Rd_Compound_Check(t, ap, ip); + Rd_Compound_Check(t, ap, &i); + *ip = (size_t)i; return 1; } --- a/interfaces/Prolog/ppl_interface_generator_prolog_cc_code.m4 +++ b/interfaces/Prolog/ppl_interface_generator_prolog_cc_code.m4 @@ -1934,7 +1934,7 @@ m4_define(`ppl_@CLASS@_map_space_dimensi while (Prolog_is_cons(t_pfunc)) { Prolog_get_cons(t_pfunc, t_pair, t_pfunc); Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t_pair, &functor, &arity); if (arity != 2 || functor != a_minus) return PROLOG_FAILURE; --- a/interfaces/Prolog/ppl_prolog_common.cc +++ b/interfaces/Prolog/ppl_prolog_common.cc @@ -937,7 +937,7 @@ build_linear_expression(Prolog_term_ref return Linear_Expression(integer_term_to_Coefficient(t)); else if (Prolog_is_compound(t)) { Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t, &functor, &arity); switch (arity) { case 1: @@ -1000,7 +1000,7 @@ Constraint build_constraint(Prolog_term_ref t, const char* where) { if (Prolog_is_compound(t)) { Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t, &functor, &arity); if (arity == 2) { Prolog_term_ref arg1 = Prolog_new_term_ref(); @@ -1073,7 +1073,7 @@ Congruence build_congruence(Prolog_term_ref t, const char* where) { if (Prolog_is_compound(t)) { Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t, &functor, &arity); if (arity == 2) { Prolog_term_ref arg1 = Prolog_new_term_ref(); @@ -1084,7 +1084,7 @@ build_congruence(Prolog_term_ref t, cons // / if (Prolog_is_integer(arg2)) { Prolog_atom functor1; - int arity1; + size_t arity1; Prolog_get_compound_name_arity(arg1, &functor1, &arity1); if (arity1 == 2) { if (functor1 == a_is_congruent_to) { @@ -1137,7 +1137,7 @@ Generator build_generator(Prolog_term_ref t, const char* where) { if (Prolog_is_compound(t)) { Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t, &functor, &arity); if (arity == 1) { Prolog_term_ref arg = Prolog_new_term_ref(); @@ -1174,7 +1174,7 @@ Grid_Generator build_grid_generator(Prolog_term_ref t, const char* where) { if (Prolog_is_compound(t)) { Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t, &functor, &arity); if (arity == 1) { Prolog_term_ref arg = Prolog_new_term_ref(); @@ -1406,7 +1406,7 @@ Variable term_to_Variable(Prolog_term_ref t, const char* where) { if (Prolog_is_compound(t)) { Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t, &functor, &arity); if (functor == a_dollar_VAR && arity == 1) { Prolog_term_ref arg = Prolog_new_term_ref(); @@ -1554,7 +1554,7 @@ term_to_boundary(Prolog_term_ref t_b, Bo return false; Prolog_atom functor; - int arity; + size_t arity; Prolog_get_compound_name_arity(t_b, &functor, &arity); // A boundary term is either of the form c(Limit) or o(Limit). --- a/interfaces/Prolog/SICStus/sicstus_cfli.h +++ b/interfaces/Prolog/SICStus/sicstus_cfli.h @@ -134,7 +134,7 @@ Prolog_get_atom_name(Prolog_term_ref t, PCFLI_DECLSPEC int Prolog_get_compound_name_arity(Prolog_term_ref t, - Prolog_atom& name, int& arity); + Prolog_atom& name, size_t& arity); PCFLI_DECLSPEC int Prolog_get_arg(int i, Prolog_term_ref t, Prolog_term_ref a); --- a/interfaces/Prolog/SICStus/sicstus_cfli.ic +++ b/interfaces/Prolog/SICStus/sicstus_cfli.ic @@ -262,9 +262,12 @@ Prolog_get_atom_name(Prolog_term_ref t, The behavior is undefined if \p t is not a Prolog compound term. */ PCFLI_EXTERN_INLINE int -Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, int* ip) { +Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, size_t* ip) { + int i, ret; assert(Prolog_is_compound(t)); - return SP_get_functor(t, ap, ip); + ret = SP_get_functor(t, ap, &i); + *ip = i; + return ret; } /*! --- a/interfaces/Prolog/SWI/swi_cfli.hh +++ b/interfaces/Prolog/SWI/swi_cfli.hh @@ -346,7 +346,7 @@ Prolog_get_atom_name(Prolog_term_ref t, The behavior is undefined if \p t is not a Prolog compound term. */ inline int -Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, int* ip) { +Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, size_t* ip) { assert(Prolog_is_compound(t)); return PL_get_name_arity(t, ap, ip); } --- a/interfaces/Prolog/XSB/xsb_cfli.hh +++ b/interfaces/Prolog/XSB/xsb_cfli.hh @@ -314,10 +314,10 @@ Prolog_get_atom_name(Prolog_term_ref t, The behavior is undefined if \p t is not a Prolog compound term. */ inline int -Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, int* ip) { +Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, size_t* ip) { assert(Prolog_is_compound(t)); *ap = p2c_functor(t); - *ip = p2c_arity(t); + *ip = (size_t)p2c_arity(t); return 1; } --- a/interfaces/Prolog/YAP/yap_cfli.hh +++ b/interfaces/Prolog/YAP/yap_cfli.hh @@ -313,7 +313,7 @@ Prolog_get_atom_name(Prolog_term_ref t, The behavior is undefined if \p t is not a Prolog compound term. */ inline int -Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, int* ip) { +Prolog_get_compound_name_arity(Prolog_term_ref t, Prolog_atom* ap, size_t* ip) { assert(Prolog_is_compound(t)); YAP_Functor f = YAP_FunctorOfTerm(t); *ap = YAP_NameOfFunctor(f); --- a/m4/ac_check_swi_prolog.m4 +++ b/m4/ac_check_swi_prolog.m4 @@ -45,11 +45,11 @@ then fi if test x$swi_prolog != x then - swi_prolog_base=`$swi_prolog -dump-runtime-variables | grep PLBASE= | sed 's/PLBASE="\([[a-z]]:\)\{0,1\}\(.*\)";.*/\2/'` - swi_prolog_version=`$swi_prolog -dump-runtime-variables | grep PLVERSION= | sed 's/PLVERSION="\(.*\)";.*/\1/'` - swi_prolog_arch=`$swi_prolog -dump-runtime-variables | grep PLARCH= | sed 's/PLARCH="\(.*\)";.*/\1/'` - swi_prolog_libs=`$swi_prolog -dump-runtime-variables | grep PLLIBS= | sed 's/PLLIBS="\(.*\)";.*/\1/'` - swi_prolog_lib=`$swi_prolog -dump-runtime-variables | grep PLLIB= | sed 's/PLLIB="\(.*\)";.*/\1/'` + swi_prolog_base=`$swi_prolog --dump-runtime-variables | grep PLBASE= | sed 's/PLBASE="\([[a-z]]:\)\{0,1\}\(.*\)";.*/\2/'` + swi_prolog_version=`$swi_prolog --dump-runtime-variables | grep PLVERSION= | sed 's/PLVERSION="\(.*\)";.*/\1/'` + swi_prolog_arch=`$swi_prolog --dump-runtime-variables | grep PLARCH= | sed 's/PLARCH="\(.*\)";.*/\1/'` + swi_prolog_libs=`$swi_prolog --dump-runtime-variables | grep PLLIBS= | sed 's/PLLIBS="\(.*\)";.*/\1/'` + swi_prolog_lib=`$swi_prolog --dump-runtime-variables | grep PLLIB= | sed 's/PLLIB="\(.*\)";.*/\1/'` dnl Additional version checks could be inserted here, if necessary.