From 12fe06aa2e1debfef6cfc4c58ece0bc7f68ea88c Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 15 Jul 2010 23:35:04 +0100 Subject: [PATCH] extensions to interface --- packages/PLStream/pl-incl.h | 1 - packages/PLStream/pl-yap.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/PLStream/pl-incl.h b/packages/PLStream/pl-incl.h index fd3c605ff..9bfbc5937 100755 --- a/packages/PLStream/pl-incl.h +++ b/packages/PLStream/pl-incl.h @@ -531,7 +531,6 @@ extern int PL_get_text(term_t l, PL_chars_t *text, int flags); extern void PL_cleanup_fork(void); extern int PL_rethrow(void); extern void PL_get_number(term_t l, number *n); -extern int PL_write_term(IOSTREAM *s, term_t term, int precedence, int flags); extern int PL_unify_atomic(term_t t, PL_atomic_t a); #define _PL_get_arg(X,Y,Z) PL_get_arg(X,Y,Z) diff --git a/packages/PLStream/pl-yap.c b/packages/PLStream/pl-yap.c index 88a9d2a13..e3aff0132 100644 --- a/packages/PLStream/pl-yap.c +++ b/packages/PLStream/pl-yap.c @@ -3,6 +3,14 @@ #include #include "pl-incl.h" + +#define Quote_illegal_f 1 +#define Ignore_ops_f 2 +#define Handle_vars_f 4 +#define Use_portray_f 8 +#define To_heap_f 16 +#define Unfold_cyclics_f 32 + #ifdef HAVE_LIMITS_H #include #endif @@ -128,7 +136,16 @@ callProlog(module_t module, term_t goal, int flags, term_t *ex) int PL_write_term(IOSTREAM *s, term_t term, int precedence, int flags) { - + int nflags = 0; + if (flags & PL_WRT_QUOTED) + nflags |= Quote_illegal_f; + if (flags & PL_WRT_IGNOREOPS) + nflags |= Ignore_ops_f; + if (flags & PL_WRT_NUMBERVARS) + nflags |= Handle_vars_f; + if (flags & PL_WRT_PORTRAY) + nflags |= Use_portray_f; + /* ignore other flags for now */ YAP_Write(YAP_GetFromSlot(term), (void (*)(int))Sputc, flags); return TRUE; }