[PPL-devel] [GIT] ppl/ppl(master): Added Prolog_get_nil() and Prolog_put_nil().
Roberto Bagnara
roberto.bagnara at bugseng.com
Sat Mar 29 10:27:51 CET 2014
Module: ppl/ppl
Branch: master
Commit: 2e5601a314b73d6f66821ed753d604f6fccc62d3
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=2e5601a314b73d6f66821ed753d604f6fccc62d3
Author: Roberto Bagnara <roberto.bagnara at bugseng.com>
Date: Sat Mar 29 10:26:51 2014 +0100
Added Prolog_get_nil() and Prolog_put_nil().
---
interfaces/Prolog/YAP/yap_cfli.hh | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/interfaces/Prolog/YAP/yap_cfli.hh b/interfaces/Prolog/YAP/yap_cfli.hh
index f04aa4c..d8428e0 100644
--- a/interfaces/Prolog/YAP/yap_cfli.hh
+++ b/interfaces/Prolog/YAP/yap_cfli.hh
@@ -86,6 +86,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) {
+ t = YAP_TermNil();
+ return 1;
+}
+
+/*!
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 YAP_IsTermNil(t);
+}
+
+/*!
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.
More information about the PPL-devel
mailing list