[GIT] ppl/ppl(master): Added Prolog_get_nil() and Prolog_put_nil().

Module: ppl/ppl Branch: master Commit: e24eb663ed59187529cabc314f77c2623af08c16 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e24eb663ed591...
Author: Roberto Bagnara roberto.bagnara@bugseng.com Date: Sat Mar 29 10:20:25 2014 +0100
Added Prolog_get_nil() and Prolog_put_nil().
---
interfaces/Prolog/XSB/xsb_cfli.hh | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/interfaces/Prolog/XSB/xsb_cfli.hh b/interfaces/Prolog/XSB/xsb_cfli.hh index 4032f06..1acdb52 100644 --- a/interfaces/Prolog/XSB/xsb_cfli.hh +++ b/interfaces/Prolog/XSB/xsb_cfli.hh @@ -93,6 +93,16 @@ Prolog_put_ulong(Prolog_term_ref& t, unsigned long ul) { }
/*! + Assign to \p t the list terminator <CODE>[]</CODE> (which needs not + be an atom). +*/ +inline int +Prolog_put_nil(Prolog_term_ref& t) { + assert(is_var(t) == TRUE); + return c2p_nil(t) != FALSE; +} + +/*! Assign to \p t an atom whose name is given by the null-terminated string \p s. */ @@ -325,6 +335,15 @@ 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) { + return is_nil(t) != FALSE; +} + +/*! 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.
participants (1)
-
Roberto Bagnara