
Module: ppl/ppl Branch: master Commit: 382be0e6948d88ea54482025a7226f61e26aebde URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=382be0e6948d8...
Author: Roberto Bagnara roberto.bagnara@bugseng.com Date: Sat Mar 29 11:04:25 2014 +0100
Added Prolog_get_nil() and Prolog_put_nil().
---
interfaces/Prolog/GNU/gprolog_cfli.hh | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/interfaces/Prolog/GNU/gprolog_cfli.hh b/interfaces/Prolog/GNU/gprolog_cfli.hh index 2c4c64f..f6bddd1 100644 --- a/interfaces/Prolog/GNU/gprolog_cfli.hh +++ b/interfaces/Prolog/GNU/gprolog_cfli.hh @@ -252,6 +252,16 @@ Prolog_construct_cons(Prolog_term_ref& c, }
/*! + Assign to \p t the list terminator <CODE>[]</CODE> (which needs not + be an atom). +*/ +inline int +Prolog_put_nil(Prolog_term_ref& t) { + t = Mk_Atom(atom_nil); + return 1; +} + +/*! Assign to \p t a term representing the address contained in \p p. */ inline int @@ -432,6 +442,21 @@ Prolog_get_arg(int i, Prolog_term_ref t, Prolog_term_ref& a) { }
/*! + Succeeds if and only if \p t represents the list terminator <CODE>[]</CODE> + (which needs not be an atom). +*/ +inline int +Prolog_get_nil(Prolog_term_ref t) { + if (Blt_Atom(t) == FALSE) { + return 0; + } + else { + int a = atom_nil; + return Rd_Atom_Check(t) == a; + } +} + +/*! If \p c is a Prolog cons (list constructor), assign its head and tail to \p h and \p t, respectively. The behavior is undefined if \p c is not a Prolog cons.