diff --git a/CXX/CMakeLists.txt b/CXX/CMakeLists.txt index cb277c05f..ba026fd43 100644 --- a/CXX/CMakeLists.txt +++ b/CXX/CMakeLists.txt @@ -1,5 +1,13 @@ -add_library (Yap++ SHARED yapi.cpp) +add_library (Yap++ SHARED + yapa.hh + yapdb.hh + yapi.cpp + yapi.hh + yapie.hh + yapq.hh + yapt.hh + ) include_directories (H include ${CMAKE_BINARY_DIR} ${GMP_INCLUDE_DIR}) diff --git a/CXX/yapdb.hh b/CXX/yapdb.hh index ef9aef6d3..6b15d39c6 100644 --- a/CXX/yapdb.hh +++ b/CXX/yapdb.hh @@ -128,7 +128,7 @@ protected: // Yap_DebugPlWrite(out); // delete [] ns; if (out == 0L) - throw YAPError::YAP_SYNTAX_ERROR; + throw YAPError(SYNTAX_ERROR); ap = getPred( out, outp); RECOVER_MACHINE_REGS(); } diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index 5020c81b3..02fdc5628 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -327,9 +327,15 @@ YAPTerm *YAPTerm::vars() } */ -YAPTerm::YAPTerm(void *ptr) { CACHE_REGS mk( MkIntegerTerm( (Int)ptr ) );} +YAPTerm::YAPTerm(void *ptr) { + CACHE_REGS + mk( MkIntegerTerm( (Int)ptr ) ); +} -YAPTerm::YAPTerm(intptr_t i) { CACHE_REGS Term tn = MkIntegerTerm( i ); mk( tn ); } +YAPTerm::YAPTerm(intptr_t i) { + CACHE_REGS Term tn = MkIntegerTerm( i ); + mk( tn ); +} YAPTerm YAPListTerm::car() { @@ -338,10 +344,13 @@ YAPTerm YAPListTerm::car() if (IsPairTerm(to)) return YAPTerm(HeadOfTerm(to)); else - throw YAPError::YAP_DOMAIN_ERROR; + throw YAPError(TYPE_ERROR_LIST); } -YAPVarTerm::YAPVarTerm() { CACHE_REGS mk( MkVarTerm( ) ); } +YAPVarTerm::YAPVarTerm() { + CACHE_REGS + mk( MkVarTerm( ) ); +} char *YAPAtom::getName(void) { @@ -381,6 +390,19 @@ void YAPQuery::initOpenQ() { q_cp = CP; } +int +YAPError::get( ) +{ + return errNo; +} + +const char * +YAPError::text() +{ + return "YAP Error"; +} + + void YAPQuery::initQuery( Term t ) { @@ -590,11 +612,12 @@ YAPEngine::YAPEngine( char *savedState, init_args.YapPrologTopLevelGoal = topLevel; init_args.HaltAfterConsult = script; init_args.FastBoot = fastBoot; + yerror = YAPError(); delYAPCallback(); if (cb) setYAPCallback(cb); curren = this; if (YAP_Init( &init_args ) == YAP_BOOT_ERROR) - throw(YAPError::YAP_OTHER_ERROR); + throw(YAPError(INTERNAL_ERROR)); } @@ -619,7 +642,7 @@ PredEntry *YAPPredicate::getPred( Term &t, Term* &outp ) { Term m = Yap_CurrentModule() ; t = Yap_StripModule(t, &m); if (IsVarTerm(t) || IsNumTerm(t)) { - throw YAPError::YAP_TYPE_ERROR; + throw YAPError(TYPE_ERROR_NUMBER); } if (IsAtomTerm(t)) { ap = RepPredProp(PredPropByAtom(AtomOfTerm(t), m)); @@ -633,7 +656,7 @@ PredEntry *YAPPredicate::getPred( Term &t, Term* &outp ) { } Functor f = FunctorOfTerm(t); if (IsExtensionFunctor(f)) { - throw YAPError::YAP_TYPE_ERROR; + throw YAPError(TYPE_ERROR_NUMBER); } else { ap = RepPredProp(PredPropByFunc(f, m)); outp = RepAppl(t)+1; diff --git a/CXX/yapi.hh b/CXX/yapi.hh index c3424f591..7a671b672 100644 --- a/CXX/yapi.hh +++ b/CXX/yapi.hh @@ -66,16 +66,16 @@ extern "C" { // taken from yap_structs.h #include "iopreds.h" - + extern void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity); - + /* void UserCPredicateWithArgs(const char *name, int *fn(), unsigned int arity) */ extern void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity, YAP_Term); - + /* void UserBackCPredicate(const char *name, int *init(), int *cont(), int arity, int extra) */ extern void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_Arity, unsigned int); - + extern Term Yap_StringToTerm(const char *s, size_t len, encoding_t enc, int prio, Term *bindings_p); diff --git a/CXX/yapie.hh b/CXX/yapie.hh index 126007572..a657da499 100644 --- a/CXX/yapie.hh +++ b/CXX/yapie.hh @@ -1,16 +1,11 @@ class YAPError { + int errNo; public: - static const int YAP_SYNTAX_ERROR = 0x10000; //> syntax error - static const int YAP_DOMAIN_ERROR = 0x20000; //> usually illegal parameter, like asin( 2 ) - static const int YAP_TYPE_ERROR = 0x40000; //> usually illegal parameter in the language, like ( 2 mod 3.0 ) - static const int YAP_PERMISSION_ERROR = 0x80000; //> wrong para,eter - static const int YAP_EVALUATION_ERROR = 0x100000; //> bad arithmetic expressions - static const int YAP_RESOURCE_ERROR = 0x200000; //> no resource available, like MEM - static const int YAP_REPRESENTATION_ERROR = 0x400000; //> bad UTF-8 strings, etc - static const int YAP_EXISTENCE_ERROR = 0x800000; //> object not found - static const int YAP_PROFILER = 0x100000; //> improve profiling support. - static const int YAP_OTHER_ERROR = 0x2000000; //> anything + YAPError() { errNo = YAP_NO_ERROR; }; + YAPError(int err) { errNo = err; }; + int get(); + const char *text(); }; diff --git a/CXX/yapq.hh b/CXX/yapq.hh index 16478897f..d914769de 100644 --- a/CXX/yapq.hh +++ b/CXX/yapq.hh @@ -100,7 +100,7 @@ public: bool script = FALSE, bool fastBoot = FALSE, YAPCallback *callback=(YAPCallback *)NULL); /// construct a new engine, including aaccess to callbacks - /// kill engine + /// kill engine ~YAPEngine() { delYAPCallback(); } /// remove current callback void delYAPCallback() { _callback = 0; } @@ -111,7 +111,7 @@ public: /// execute the callback with a text argument. void run( char *s) { if (_callback) _callback->run(s); } /// execute the callback with a text argument. - YAPError hasError( ) { return yerror; } + YAPError hasError( ) { return yerror.get(); } /// build a query on the engine YAPQuery *query( const char *s ) { return new YAPQuery( s ); diff --git a/CXX/yapt.hh b/CXX/yapt.hh index 64cb1d760..8b36e03c2 100644 --- a/CXX/yapt.hh +++ b/CXX/yapt.hh @@ -230,7 +230,7 @@ public: else if ( to == TermNil) return YAPListTerm( ); /* error */ - throw YAPError::YAP_TYPE_ERROR; + throw YAPError(TYPE_ERROR_LIST); } /// Check if the list is empty. diff --git a/H/Foreign.h b/H/Foreign.h index d745c48dc..68803ebff 100644 --- a/H/Foreign.h +++ b/H/Foreign.h @@ -14,6 +14,9 @@ #define NO_DYN 1 +#ifndef FOREIGN_H +#define FOREIGN_H + /* Currently load_foreign_files works for the following machines: AIX: should work for 3.2 and 4.1 at least, using ECOFF; @@ -110,3 +113,5 @@ void Yap_ShutdownLoadForeign(void); #define EAGER_LOADING 1 #define GLOBAL_LOADING 2 + +#endif diff --git a/H/ScannerTypes.h b/H/ScannerTypes.h index ec5cc133c..38b09f804 100644 --- a/H/ScannerTypes.h +++ b/H/ScannerTypes.h @@ -4,7 +4,8 @@ typedef enum TokenKinds { Var_tok, String_tok, WString_tok, - StringTerm_tok, + BQString_tok, + WBQString_tok, Ponctuation_tok, Error_tok, QuasiQuotes_tok, diff --git a/H/YapText.h b/H/YapText.h index 43d7cc73b..1a27553f0 100644 --- a/H/YapText.h +++ b/H/YapText.h @@ -14,9 +14,8 @@ * comments: Term conversion C implemented support * * * *************************************************************************/ -#ifdef SCCS -static char SccsId[] = "%W% %G%"; -#endif +#ifndef YAP_TEXT_H +#define YAP_TEXT_H #if SIZEOF_WCHAR_T == 2 #define CHARCODE_MAX 0xffff @@ -50,7 +49,7 @@ typedef enum { } enum_seq_type_t; -#define YAP_STRING_TERM 0x1000 // joint with other flags that define possible values +#define YAP_STRING_TERM 0x1000 // joint with other flags that define possible values #define YAP_STRING_DIFF 0x2000 // difference list #define YAP_STRING_NCHARS 0x4000 // size of input/result #define YAP_STRING_TRUNC 0x8000 // truncate on maximum size of input/result @@ -59,7 +58,7 @@ typedef enum { typedef UInt seq_type_t; -#define YAP_TYPE_MASK 0xFFFF +#define YAP_TYPE_MASK 0x0FFF typedef union { Float f; @@ -86,7 +85,7 @@ typedef struct text_cvt { // string construction #ifdef HR static inline Term -init_tstring( USES_REGS1 ) { +init_tstring( USES_REGS1 ) { Term t = AbsAppl(HR); HR[0] = (CELL)FunctorString; @@ -94,13 +93,13 @@ init_tstring( USES_REGS1 ) { } static inline char * -buf_from_tstring( CELL *p ) { +buf_from_tstring( CELL *p ) { char *out = (char *)(p + 2); return out; } static inline void -close_tstring( char *p USES_REGS ) { +close_tstring( char *p USES_REGS ) { CELL *szp = HR+1; HR = (CELL *)ALIGN_BY_TYPE( p ,CELL); *szp = (HR - szp)-1; @@ -112,14 +111,8 @@ close_tstring( char *p USES_REGS ) { static inline seq_type_t mod_to_type( Term mod USES_REGS ) { - + // see pl-incl.h -#ifndef DBLQ_CHARS -#define DBLQ_CHARS (0x0004) /* "ab" --> ['a', 'b'] */ -#define DBLQ_ATOM (0x0008) /* "ab" --> 'ab' */ -#define DBLQ_STRING (0x0010) /* "ab" --> "ab" */ -#define DBLQ_MASK (DBLQ_CHARS|DBLQ_ATOM|DBLQ_STRING) -#endif unsigned int flags = Yap_GetModuleEntry(mod)->flags; if (flags & DBLQ_ATOM) { return YAP_STRING_ATOM; @@ -131,6 +124,23 @@ mod_to_type( Term mod USES_REGS ) return YAP_STRING_CODES; } +// string type depends on current module +static inline seq_type_t +mod_to_bqtype( Term mod USES_REGS ) +{ + + // see pl-incl.h + unsigned int flags = Yap_GetModuleEntry(mod)->flags; + if (flags & BCKQ_ATOM) { + return YAP_STRING_ATOM; + } else if (flags & BCKQ_STRING) { + return YAP_STRING_STRING; + } else if (flags & BCKQ_CHARS) { + return YAP_STRING_ATOMS; + } + return YAP_STRING_CODES; +} + // the routines extern void *Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *lengp USES_REGS); @@ -221,7 +231,7 @@ Yap_AtomSWIToListOfAtoms(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_ATOM|YAP_STRING_STRING|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_ATOMS_CODES|YAP_STRING_TERM; out.type = YAP_STRING_ATOMS; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -260,7 +270,7 @@ Yap_AtomToString(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_ATOM; out.type = YAP_STRING_STRING; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -274,7 +284,7 @@ Yap_AtomSWIToString(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_ATOM|YAP_STRING_STRING|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_ATOMS_CODES|YAP_STRING_TERM; out.type = YAP_STRING_STRING; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -288,7 +298,7 @@ Yap_AtomicToString(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_STRING|YAP_STRING_ATOM|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_TERM; out.type = YAP_STRING_STRING; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -298,7 +308,7 @@ static inline Term Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) { seq_tv_t inp, out; - + inp.val.t = t0; inp.type = YAP_STRING_STRING|YAP_STRING_ATOM|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_TERM; out.type = mod_to_type(mod PASS_REGS); @@ -310,6 +320,22 @@ Yap_AtomicToTDQ(Term t0, Term mod USES_REGS) return out.val.t; } +static inline Term +Yap_AtomicToTBQ(Term t0, Term mod USES_REGS) +{ + seq_tv_t inp, out; + + inp.val.t = t0; + inp.type = YAP_STRING_STRING|YAP_STRING_ATOM|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_TERM; + out.type = mod_to_bqtype(mod PASS_REGS); + + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + return 0L; + if (out.type == YAP_STRING_ATOM) + return MkAtomTerm( out.val.a); + return out.val.t; +} + static inline Atom Yap_CharsToAtom( const char *s USES_REGS ) { @@ -360,7 +386,7 @@ Yap_CharsToDiffListOfCodes( const char *s, Term tail USES_REGS ) inp.val.c = s; inp.sz = 0; inp.type = YAP_STRING_CHARS; - out.type = YAP_STRING_DIFF; + out.type = YAP_STRING_DIFF|YAP_STRING_CODES; out.dif = tail; if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; @@ -385,7 +411,7 @@ static inline Term Yap_CharsToTDQ( const char *s, Term mod USES_REGS ) { seq_tv_t inp, out; - + inp.val.c = s; inp.sz = 0; inp.type = YAP_STRING_CHARS; @@ -398,6 +424,23 @@ Yap_CharsToTDQ( const char *s, Term mod USES_REGS ) return out.val.t; } +static inline Term +Yap_CharsToTBQ( const char *s, Term mod USES_REGS ) +{ + seq_tv_t inp, out; + + inp.val.c = s; + inp.sz = 0; + inp.type = YAP_STRING_CHARS; + inp.mod = mod; + out.type = mod_to_bqtype(mod PASS_REGS); + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + return 0L; + if (out.type == YAP_STRING_ATOM) + return MkAtomTerm( out.val.a ); + return out.val.t; +} + static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) { @@ -502,7 +545,7 @@ Yap_ListToNumber(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_STRING|YAP_STRING_ATOMS_CODES|YAP_STRING_TERM; out.type = YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_TERM; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -517,7 +560,7 @@ Yap_ListToString(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_STRING|YAP_STRING_ATOMS_CODES|YAP_STRING_TERM; out.type = YAP_STRING_STRING; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -532,7 +575,7 @@ Yap_ListSWIToString(Term t0 USES_REGS) inp.val.t = t0; inp.type = YAP_STRING_STRING|YAP_STRING_ATOM|YAP_STRING_ATOMS_CODES|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_BIG|YAP_STRING_TERM; out.type = YAP_STRING_STRING; - + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; return out.val.t; @@ -543,12 +586,29 @@ static inline Term YapListToTDQ(Term t0, Term mod USES_REGS) { seq_tv_t inp, out; - + inp.val.t = t0; inp.type = YAP_STRING_STRING|YAP_STRING_ATOMS_CODES|YAP_STRING_TERM; out.type = mod_to_type(mod PASS_REGS); - if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + return 0L; + if (out.type == YAP_STRING_ATOM) { + return MkAtomTerm( out.val.a); + } + return out.val.t; +} + +static inline Term +YapListToTBQ(Term t0, Term mod USES_REGS) +{ + seq_tv_t inp, out; + + inp.val.t = t0; + inp.type = YAP_STRING_STRING|YAP_STRING_ATOMS_CODES|YAP_STRING_TERM; + out.type = mod_to_bqtype(mod PASS_REGS); + + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) return 0L; if (out.type == YAP_STRING_ATOM) { return MkAtomTerm( out.val.a); @@ -620,7 +680,7 @@ static inline Term Yap_NCharsToTDQ( const char *s, size_t len, Term mod USES_REGS ) { seq_tv_t inp, out; - + inp.val.c = s; inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS; inp.sz = len; @@ -634,6 +694,24 @@ Yap_NCharsToTDQ( const char *s, size_t len, Term mod USES_REGS ) return out.val.t; } +static inline Term +Yap_NCharsToTBQ( const char *s, size_t len, Term mod USES_REGS ) +{ + seq_tv_t inp, out; + + inp.val.c = s; + inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS; + inp.sz = len; + inp.mod = mod; + out.type = mod_to_bqtype(mod PASS_REGS); + out.max = len; + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + return 0L; + if (out.type == YAP_STRING_ATOM) + return MkAtomTerm( out.val.a ); + return out.val.t; +} + static inline Atom Yap_NumberToAtom(Term t0 USES_REGS) { @@ -686,7 +764,7 @@ static inline Atom Yap_NWCharsToAtom( const wchar_t *s, size_t len USES_REGS ) { seq_tv_t inp, out; - + inp.val.w = s; inp.sz = len; inp.type = YAP_STRING_WCHARS|YAP_STRING_NCHARS; @@ -875,7 +953,7 @@ static inline Term Yap_WCharsToTDQ( wchar_t *s, Term mod USES_REGS ) { seq_tv_t inp, out; - + inp.val.w = s; inp.type = YAP_STRING_WCHARS; inp.sz = 0; @@ -888,6 +966,23 @@ Yap_WCharsToTDQ( wchar_t *s, Term mod USES_REGS ) return out.val.t; } +static inline Term +Yap_WCharsToTBQ( wchar_t *s, Term mod USES_REGS ) +{ + seq_tv_t inp, out; + + inp.val.w = s; + inp.type = YAP_STRING_WCHARS; + inp.sz = 0; + inp.mod = mod; + out.type = mod_to_bqtype(mod PASS_REGS); + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + return 0L; + if (out.type == YAP_STRING_ATOM) + return MkAtomTerm( out.val.a); + return out.val.t; +} + static inline Term Yap_WCharsToString(const wchar_t *s USES_REGS) { @@ -1062,4 +1157,4 @@ Yap_SubtractTailString(Term t1, Term th USES_REGS) return outv[0].val.t; } - +#endif // ≈YAP_TEXT_H diff --git a/H/Yapproto.h b/H/Yapproto.h index 7a8cf0858..26e0918d4 100755 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -168,6 +168,7 @@ Yap_PrintPredName( struct pred_entry *ap ); void Yap_RestartYap(int); void Yap_exit(int); bool Yap_Warning( const char *s, ... ); +bool Yap_PrintWarning( Term t ); yamop *Yap_Error(yap_error_number,Term,const char *msg, ...); yamop *Yap_NilError(yap_error_number,const char *msg, ...); int Yap_HandleError( const char *msg, ... ); @@ -191,6 +192,8 @@ void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS); int Yap_execute_pred(struct pred_entry *ppe, CELL *pt, bool pass_exception USES_REGS); int Yap_dogc( int extra_args, Term *tp USES_REGS ); Term Yap_PredicateIndicator(Term t, Term mod); +bool Yap_Execute(Term t USES_REGS); + /* exo.c */ void Yap_InitExoPreds(void); void Yap_udi_Interval_init(void); diff --git a/H/Yatom.h b/H/Yatom.h index 4952b70d7..af0a26508 100755 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -427,12 +427,17 @@ IsModProperty (int flags) #define DBLQ_CHARS (0x0004) /* "ab" --> ['a', 'b'] */ #define DBLQ_ATOM (0x0008) /* "ab" --> 'ab' */ #define DBLQ_STRING (0x0010) /* "ab" --> "ab" */ +#define DBLQ_CODES (0x0020) /* "ab" --> [0'a, 0'b] */ #define DBLQ_MASK (DBLQ_CHARS|DBLQ_ATOM|DBLQ_STRING|DBLQ_CODES) -#define UNKNOWN_FAIL (0x0020) /* module */ -#define UNKNOWN_WARNING (0x0040) /* module */ -#define UNKNOWN_ERROR (0x0080) /* module */ +#define BCKQ_CHARS (0x0040) /* `ab` --> ['a', 'b'] */ +#define BCKQ_ATOM (0x0080) /* `ab` --> 'ab' */ +#define BCKQ_STRING (0x0100) /* `ab` --> "ab" */ +#define BCKQ_CODES (0x0200) /* `ab` --> [0'a, 0'b] */ +#define BCKQ_MASK (BCKQ_CHARS|BCKQ_ATOM|BCKQ_STRING|BCKQ_CODES) +#define UNKNOWN_FAIL (0x0400) /* module */ +#define UNKNOWN_WARNING (0x0800) /* module */ +#define UNKNOWN_ERROR (0x1000) /* module */ #define UNKNOWN_MASK (UNKNOWN_ERROR|UNKNOWN_WARNING|UNKNOWN_FAIL) -#define DBLQ_CODES (0x0008) /* "ab" --> [0'a, 0'b] */ Term Yap_getUnknownModule(ModEntry *m); void Yap_setModuleFlags(ModEntry *n, ModEntry *o); diff --git a/H/clause.h b/H/clause.h index ea0286696..f1aa0fd4a 100644 --- a/H/clause.h +++ b/H/clause.h @@ -15,6 +15,9 @@ * * *************************************************************************/ +#ifndef CLAUSE_H +#define CLAUSE_H 1 + #include "Yatom.h" #include "YapHeap.h" @@ -453,3 +456,5 @@ void Yap_dump_code_area_for_profiler(void); #else #define Yap_InformOfRemoval(X) #endif + +#endif diff --git a/H/dlocals.h b/H/dlocals.h index 9d6a43200..5d6855527 100644 --- a/H/dlocals.h +++ b/H/dlocals.h @@ -19,6 +19,8 @@ #define REMOTE_c_error_stream(wid) REMOTE(wid)->c_error_stream_ #define LOCAL_sockets_io LOCAL->sockets_io_ #define REMOTE_sockets_io(wid) REMOTE(wid)->sockets_io_ +#define LOCAL_within_print_message LOCAL->within_print_message_ +#define REMOTE_within_print_message(wid) REMOTE(wid)->within_print_message_ diff --git a/H/hlocals.h b/H/hlocals.h index c5bbf0fa4..ebe95e865 100644 --- a/H/hlocals.h +++ b/H/hlocals.h @@ -12,6 +12,7 @@ typedef struct worker_local { int c_output_stream_; int c_error_stream_; bool sockets_io_; + bool within_print_message_; diff --git a/H/iatoms.h b/H/iatoms.h index 4d47bbbc5..701d2a24f 100644 --- a/H/iatoms.h +++ b/H/iatoms.h @@ -337,6 +337,7 @@ AtomSwi = Yap_LookupAtom("swi"); AtomSymbolChar = Yap_LookupAtom("symbol_char"); AtomSyntaxError = Yap_LookupAtom("syntax_error"); + AtomSyntaxErrors = Yap_LookupAtom("syntax_errors"); AtomSyntaxErrorHandler = Yap_LookupAtom("syntax_error_handler"); AtomSystem = Yap_LookupAtom("system"); AtomSystemError = Yap_LookupAtom("system_error"); diff --git a/H/ilocals.h b/H/ilocals.h index 881c81791..6a3c3c7f7 100755 --- a/H/ilocals.h +++ b/H/ilocals.h @@ -12,6 +12,7 @@ static void InitWorker(int wid) { REMOTE_c_output_stream(wid) = 1; REMOTE_c_error_stream(wid) = 2; REMOTE_sockets_io(wid) = false; + REMOTE_within_print_message(wid) = false; diff --git a/H/ratoms.h b/H/ratoms.h index 00c54e4dc..d7a239996 100644 --- a/H/ratoms.h +++ b/H/ratoms.h @@ -337,6 +337,7 @@ AtomSwi = AtomAdjust(AtomSwi); AtomSymbolChar = AtomAdjust(AtomSymbolChar); AtomSyntaxError = AtomAdjust(AtomSyntaxError); + AtomSyntaxErrors = AtomAdjust(AtomSyntaxErrors); AtomSyntaxErrorHandler = AtomAdjust(AtomSyntaxErrorHandler); AtomSystem = AtomAdjust(AtomSystem); AtomSystemError = AtomAdjust(AtomSystemError); diff --git a/H/rheap.h b/H/rheap.h index 1e2530f0d..32b9cc5ad 100644 --- a/H/rheap.h +++ b/H/rheap.h @@ -1628,6 +1628,7 @@ RestoreEntries(PropEntry *pp, int int_key USES_REGS) } } + static void RestoreAtom(AtomEntry *at USES_REGS) { diff --git a/H/rlocals.h b/H/rlocals.h index d7cf7155e..a56db1b19 100644 --- a/H/rlocals.h +++ b/H/rlocals.h @@ -66,6 +66,7 @@ static void RestoreWorker(int wid USES_REGS) { + REMOTE_GlobalArena(wid) = TermToGlobalOrAtomAdjust(REMOTE_GlobalArena(wid)); diff --git a/H/tatoms.h b/H/tatoms.h index 61c94c5e6..121d93034 100644 --- a/H/tatoms.h +++ b/H/tatoms.h @@ -672,6 +672,8 @@ #define AtomSymbolChar Yap_heap_regs->AtomSymbolChar_ Atom AtomSyntaxError_; #define AtomSyntaxError Yap_heap_regs->AtomSyntaxError_ + Atom AtomSyntaxErrors_; +#define AtomSyntaxErrors Yap_heap_regs->AtomSyntaxErrors_ Atom AtomSyntaxErrorHandler_; #define AtomSyntaxErrorHandler Yap_heap_regs->AtomSyntaxErrorHandler_ Atom AtomSystem_;