diff --git a/H/Yapproto.h b/H/Yapproto.h index 043dfbf52..2a1ad4843 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -321,9 +321,6 @@ Term Yap_MkNewPairTerm(void); Term Yap_Globalise(Term); -/* parser.c */ -Term Yap_Parse(void); - /* readutil.c */ void Yap_InitReadUtil(void); diff --git a/H/Yatom.h b/H/Yatom.h index 018816227..b2df9b8b8 100644 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -653,7 +653,7 @@ IsValProperty (int flags) */ typedef enum { - QuasiQuotationPredFlag = ((UInt)0x80000000 << EXTRA_FLAG_BASE), /* SWI-like quasi quotations */ + QuasiQuotationPredFlag = ((UInt)0x00000001 << EXTRA_FLAG_BASE), /* SWI-like quasi quotations */ MegaClausePredFlag = 0x80000000L, /* predicate is implemented as a mega-clause */ ThreadLocalPredFlag = 0x40000000L, /* local to a thread */ MultiFileFlag = 0x20000000L, /* is multi-file */ @@ -719,7 +719,7 @@ typedef struct pred_entry CELL PredFlags, ExtraPredFlags; #else CELL PredFlags; -#define ExtraPredFlags PredFlags; +#define ExtraPredFlags PredFlags #endif UInt ArityOfPE; /* arity of property */ union diff --git a/H/iopreds.h b/H/iopreds.h index 6b842d5c7..59e468219 100644 --- a/H/iopreds.h +++ b/H/iopreds.h @@ -54,4 +54,3 @@ typedef int (*GetsFunc)(int, UInt, char *); void Yap_InitStdStreams(void); Term Yap_StreamPosition(struct io_stream *); void Yap_InitPlIO(void); - diff --git a/H/pl-incl.h b/H/pl-incl.h index 6bfeba051..d22978422 100755 --- a/H/pl-incl.h +++ b/H/pl-incl.h @@ -59,6 +59,14 @@ typedef struct pred_entry * Procedure; /* predicate */ #undef H #endif +// used by swi +#ifdef SIZEOF_INT_P +#define SIZEOF_VOIDP SIZEOF_INT_P +#define SIZEOF_LONG SIZEOF_LONG_INT +#else +bad config +#endif + /* swi code called from pl-incl.h */ /* should have messages here */ #ifdef DEBUG diff --git a/H/pl-read.h b/H/pl-read.h index 1e9340b5f..9b6d931dc 100644 --- a/H/pl-read.h +++ b/H/pl-read.h @@ -1,3 +1,16 @@ + +typedef struct vlist_struct_t { + struct VARSTRUCT *ve; + struct vlist_struct_t *next; +} vlist_t; + +typedef struct qq_struct_t { + unsigned char *text; + IOPOS start, mid, end; + vlist_t *vlist; + struct qq_struct_t *next; +} qq_t; + typedef unsigned char * ucharp; typedef const unsigned char * cucharp; @@ -72,7 +85,7 @@ extern IOFUNCTIONS Sstringfunctions; #define NULL_ATOM 0 #endif -static void +static inline void setCurrentSourceLocation(ReadData _PL_rd ARG_LD) { atom_t a; IOSTREAM *s = rb.stream; @@ -98,3 +111,8 @@ setCurrentSourceLocation(ReadData _PL_rd ARG_LD) } extern int Yap_read_term(term_t t, IOSTREAM *st, struct read_data_t *rdt); +/* parser.c */ +extern Term Yap_Parse( struct read_data_t *); +extern void init_read_data( struct read_data_t *, IOSTREAM *st ARG_LD); +extern void free_read_data( struct read_data_t *); + diff --git a/H/pl-shared.h b/H/pl-shared.h index ebef7851d..56b34ab30 100755 --- a/H/pl-shared.h +++ b/H/pl-shared.h @@ -8,6 +8,8 @@ #define __YAP_PROLOG__ 1 #endif +#include + // SWI stuff that is needed everywhere #ifndef __unix__ @@ -29,7 +31,7 @@ // SWI Options #define O_STRING 1 #define O_QUASIQUOTATIONS 1 -//#define O_LOCALE 1 +#define O_LOCALE 1 //#define O_ATOMGC 1 //#define O_CLAUSEGC 1 #ifdef HAVE_GMP_H @@ -263,6 +265,18 @@ COMMON(int) tracemode(debug_type new, debug_type *old); COMMON(void) Yap_setCurrentSourceLocation(IOSTREAM **s); #define SWIAtomToAtom(X) SWI_Atoms[(X)>>1] +Atom YAP_AtomFromSWIAtom(atom_t at); +atom_t YAP_SWIAtomFromAtom(Atom at); + + +/* This is silly, but let's keep it like that for now */ +static inline Functor +SWIFunctorToFunctor(functor_t f) +{ + if ((CELL)(f) & 2 && ((CELL)f) < N_SWI_FUNCTORS*4+2) + return SWI_Functors[((CELL)f)/4]; + return (Functor)f; +} static inline Term OpenList(int n USES_REGS) diff --git a/H/pl-yap.h b/H/pl-yap.h index 14875b3bc..320cf5fbf 100644 --- a/H/pl-yap.h +++ b/H/pl-yap.h @@ -115,8 +115,6 @@ extern word globalWString(size_t size, wchar_t *s); #define valHandle(r) valHandle__LD(r PASS_LD) Int YAP_PLArityOfSWIFunctor(functor_t f); -Atom YAP_AtomFromSWIAtom(atom_t at); -atom_t YAP_SWIAtomFromAtom(Atom at); struct PL_blob_t* YAP_find_blob_type(Atom at); void PL_license(const char *license, const char *module);