diff --git a/packages/PLStream/Makefile.in b/packages/PLStream/Makefile.in index 503fe12bf..fc2d39fc4 100644 --- a/packages/PLStream/Makefile.in +++ b/packages/PLStream/Makefile.in @@ -40,7 +40,7 @@ HEADERS=$(srcdir)/atoms.h $(srcdir)/pl-buffer.h $(srcdir)/pl-ctype.h \ $(srcdir)/pl-mswchar.h \ $(srcdir)/pl-opts.h \ $(srcdir)/pl-os.h \ - $(srcdir)/pl-privit.h \ + $(srcdir)/pl-privitf.h \ $(srcdir)/pl-stream.h \ $(srcdir)/pl-table.h \ $(srcdir)/pl-text.h $(srcdir)/pl-utf8.h \ @@ -48,13 +48,13 @@ HEADERS=$(srcdir)/atoms.h $(srcdir)/pl-buffer.h $(srcdir)/pl-ctype.h \ C_SOURCES=$(srcdir)/pl-buffer.c $(srcdir)/pl-ctype.c \ $(srcdir)/pl-error.c $(srcdir)/pl-feature.c \ $(srcdir)/pl-file.c $(srcdir)/pl-os.c \ - $(srcdir)/pl-privit.c \ + $(srcdir)/pl-privitf.c \ $(srcdir)/pl-stream.c $(srcdir)/pl-string.c \ $(srcdir)/pl-table.c \ $(srcdir)/pl-text.c $(srcdir)/pl-utf8.c \ $(srcdir)/pl-yap.c @ENABLE_WINCONSOLE@ $(srcdir)/popen.c $(srcdir)/uxnt/utf8.c $(srcdir)/uxnt/uxnt.c OBJS=pl-buffer.o pl-ctype.o pl-error.o pl-feature.o \ - pl-file.o pl-os.o \ + pl-file.o pl-os.o pl-privitf.o \ pl-stream.o pl-string.o pl-table.o pl-text.o pl-utf8.o \ pl-yap.o @ENABLE_WINCONSOLE@ utf8.o uxnt.o SOBJS=plstream@SHLIB_SUFFIX@ diff --git a/packages/PLStream/pl-privitf.c b/packages/PLStream/pl-privitf.c index de60b7da1..91d664d94 100644 --- a/packages/PLStream/pl-privitf.c +++ b/packages/PLStream/pl-privitf.c @@ -26,6 +26,8 @@ #undef LD #define LD LOCAL_LD +#ifdef __SWI_PROLOG__ + #define setHandle(h, w) (*valTermRef(h) = (w)) #define valHandleP(h) valTermRef(h) @@ -39,6 +41,7 @@ valHandle__LD(term_t r ARG_LD) return *p; } +#endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This module defines extensions to pl-fli.c that are used internally, but @@ -125,6 +128,33 @@ PL_unify_char(term_t chr, int c, int how) * LIST BUILDING * *******************************/ +#if __YAP_PROLOG__ + +int +allocList(size_t maxcells, list_ctx *ctx) +{ + ctx->gstore = ctx->start = YAP_OpenList(maxcells); + return (ctx->gstore != 0L); +} + +int +unifyList(term_t term, list_ctx *ctx) +{ + if (!YAP_CloseList(ctx->gstore, YAP_TermNil())) + return FALSE; + return YAP_Unify(YAP_GetFromSlot(term), ctx->start); +} + +int +unifyDiffList(term_t head, term_t tail, list_ctx *ctx) +{ + if (!YAP_CloseList(ctx->gstore, YAP_GetFromSlot(tail))) + return FALSE; + return YAP_Unify(YAP_GetFromSlot(head), ctx->start); +} + +#else + int allocList(size_t maxcells, list_ctx *ctx) { GET_LD @@ -174,3 +204,5 @@ unifyDiffList(term_t head, term_t tail, list_ctx *ctx) return TRUE; } + +#endif diff --git a/packages/PLStream/pl-privitf.h b/packages/PLStream/pl-privitf.h index 575d574f2..d9156a19c 100644 --- a/packages/PLStream/pl-privitf.h +++ b/packages/PLStream/pl-privitf.h @@ -59,14 +59,15 @@ avoid using term-references to address the list. #if __YAP_PROLOG__ typedef struct list_ctx -{ Word lp; - Word gstore; +{ + YAP_Term gstore; + YAP_Term start; } list_ctx; static inline void addSmallIntList(list_ctx *ctx, int value) { - ctx->gstore = YAP_AddSmallIntToList(value); + ctx->gstore = YAP_ExtendList(YAP_MkIntTerm(value),ctx->gstore); } #else