From 83bf0ec7047349e035a956b8e29a8ebcc82804e9 Mon Sep 17 00:00:00 2001 From: ccremers Date: Fri, 7 Oct 2005 14:02:46 +0000 Subject: [PATCH] - Added tuple_to_termlist function. --- src/termlist.c | 23 +++++++++++++++++++++++ src/termlist.h | 1 + 2 files changed, 24 insertions(+) diff --git a/src/termlist.c b/src/termlist.c index 51aed1b..5373259 100644 --- a/src/termlist.c +++ b/src/termlist.c @@ -858,3 +858,26 @@ termlist_to_tuple (Termlist tl) } } } + +//! Split a tuple term into termlist components. +Termlist +tuple_to_termlist (Term t) +{ + t = deVar (t); + if (t == NULL) + { + return NULL; + } + else + { + if (realTermTuple (t)) + { + return termlistConcat (tuple_to_termlist (TermOp1 (t)), + tuple_to_termlist (TermOp2 (t))); + } + else + { + return termlistAdd (NULL, t); + } + } +} diff --git a/src/termlist.h b/src/termlist.h index 254c809..f7783be 100644 --- a/src/termlist.h +++ b/src/termlist.h @@ -56,5 +56,6 @@ Termlist termlistForward (Termlist tl); int termlistOrder (Termlist tl1, Termlist tl2); int termlist_iterate (Termlist tl, int (*func) ()); Term termlist_to_tuple (Termlist tl); +Termlist tuple_to_termlist (Term t); #endif