include privitf to support new pl-file.c

This commit is contained in:
Costa Vitor 2009-06-01 16:43:27 -05:00
parent 01f80f8116
commit 4a823a5065
3 changed files with 39 additions and 6 deletions

View File

@ -40,7 +40,7 @@ HEADERS=$(srcdir)/atoms.h $(srcdir)/pl-buffer.h $(srcdir)/pl-ctype.h \
$(srcdir)/pl-mswchar.h \ $(srcdir)/pl-mswchar.h \
$(srcdir)/pl-opts.h \ $(srcdir)/pl-opts.h \
$(srcdir)/pl-os.h \ $(srcdir)/pl-os.h \
$(srcdir)/pl-privit.h \ $(srcdir)/pl-privitf.h \
$(srcdir)/pl-stream.h \ $(srcdir)/pl-stream.h \
$(srcdir)/pl-table.h \ $(srcdir)/pl-table.h \
$(srcdir)/pl-text.h $(srcdir)/pl-utf8.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 \ C_SOURCES=$(srcdir)/pl-buffer.c $(srcdir)/pl-ctype.c \
$(srcdir)/pl-error.c $(srcdir)/pl-feature.c \ $(srcdir)/pl-error.c $(srcdir)/pl-feature.c \
$(srcdir)/pl-file.c $(srcdir)/pl-os.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-stream.c $(srcdir)/pl-string.c \
$(srcdir)/pl-table.c \ $(srcdir)/pl-table.c \
$(srcdir)/pl-text.c $(srcdir)/pl-utf8.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 $(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 \ 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-stream.o pl-string.o pl-table.o pl-text.o pl-utf8.o \
pl-yap.o @ENABLE_WINCONSOLE@ utf8.o uxnt.o pl-yap.o @ENABLE_WINCONSOLE@ utf8.o uxnt.o
SOBJS=plstream@SHLIB_SUFFIX@ SOBJS=plstream@SHLIB_SUFFIX@

View File

@ -26,6 +26,8 @@
#undef LD #undef LD
#define LD LOCAL_LD #define LD LOCAL_LD
#ifdef __SWI_PROLOG__
#define setHandle(h, w) (*valTermRef(h) = (w)) #define setHandle(h, w) (*valTermRef(h) = (w))
#define valHandleP(h) valTermRef(h) #define valHandleP(h) valTermRef(h)
@ -39,6 +41,7 @@ valHandle__LD(term_t r ARG_LD)
return *p; return *p;
} }
#endif
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This module defines extensions to pl-fli.c that are used internally, but 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 * * 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 int
allocList(size_t maxcells, list_ctx *ctx) allocList(size_t maxcells, list_ctx *ctx)
{ GET_LD { GET_LD
@ -174,3 +204,5 @@ unifyDiffList(term_t head, term_t tail, list_ctx *ctx)
return TRUE; return TRUE;
} }
#endif

View File

@ -59,14 +59,15 @@ avoid using term-references to address the list.
#if __YAP_PROLOG__ #if __YAP_PROLOG__
typedef struct list_ctx typedef struct list_ctx
{ Word lp; {
Word gstore; YAP_Term gstore;
YAP_Term start;
} list_ctx; } list_ctx;
static inline void static inline void
addSmallIntList(list_ctx *ctx, int value) addSmallIntList(list_ctx *ctx, int value)
{ {
ctx->gstore = YAP_AddSmallIntToList(value); ctx->gstore = YAP_ExtendList(YAP_MkIntTerm(value),ctx->gstore);
} }
#else #else