diff --git a/C/atomic.c b/C/atomic.c index 4deea6b90..26c331754 100755 --- a/C/atomic.c +++ b/C/atomic.c @@ -906,7 +906,6 @@ restart_aux: if (Yap_HandleError("atom_concat/3")) { goto restart_aux; } - return false; } cut_fail(); } @@ -957,8 +956,6 @@ restart_aux: if (LOCAL_Error_TYPE) { if (Yap_HandleError("atom_concat/3")) { goto restart_aux; - } else { - return false; } } cut_fail(); @@ -2492,14 +2489,14 @@ static Int sub_atomic(bool sub_atom, bool sub_string USES_REGS) { } if (sz != minv+len+after) { cut_fail(); - } + } return do_cut(check_sub_string_at( minv, p, sm, len)); } else if ((mask & (SUB_ATOM_HAS_MIN | SUB_ATOM_HAS_VAL)) == (SUB_ATOM_HAS_MIN | SUB_ATOM_HAS_VAL)) { if (! Yap_unify(ARG4,MkIntegerTerm(sz-minv-len)) ) cut_fail(); - if (sub_atom) + if (sub_atom) return do_cut(check_sub_string_at( minv, p, RepAtom(AtomOfTerm(tout))->UStrOfAE, len)); else diff --git a/C/errors.c b/C/errors.c index 5b89c6939..38276d3e4 100755 --- a/C/errors.c +++ b/C/errors.c @@ -344,9 +344,7 @@ bool Yap_PrintWarning(Term twarning) { } ts[1] = twarning; ts[0] = MkAtomTerm(AtomWarning); - HB = B->cp_h = HR; - B->cp_tr = TR; - rc = Yap_execute_pred(pred, ts, true PASS_REGS); + rc = Yap_execute_pred(pred, ts, true PASS_REGS); LOCAL_within_print_message = false; LOCAL_PrologMode &= ~InErrorMode; return rc; @@ -403,7 +401,7 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno, default: if (LOCAL_PrologMode == UserMode) - Yap_Error__(false, file, function, lineno, err, TermNil, serr); + Yap_ThrowError__( file, function, lineno, err, LOCAL_RawTerm, serr); else LOCAL_PrologMode &= ~InErrorMode; return false; @@ -594,7 +592,7 @@ yap_error_descriptor_t *Yap_popErrorContext(bool mdnew, bool pass) { } else { if (e->errorNo) return e; - } + } return NULL; } diff --git a/C/exec.c b/C/exec.c index 60e439161..00ab8ddda 100755 --- a/C/exec.c +++ b/C/exec.c @@ -2032,8 +2032,8 @@ static Int JumpToEnv(USES_REGS1) { // DBTerm *dbt = Yap_RefToException(); while (handler && Yap_PredForChoicePt(handler, NULL) != PredDollarCatch - //&& LOCAL_CBorder < LCL0 - (CELL *)handler - //&& handler->cp_ap != NOCODE + && LOCAL_CBorder < LCL0 - (CELL *)handler + && handler->cp_ap != NOCODE && handler->cp_b != NULL ) { handler->cp_ap = TRUSTFAILCODE; diff --git a/C/text.c b/C/text.c index 072b6fece..627efd46a 100644 --- a/C/text.c +++ b/C/text.c @@ -417,6 +417,7 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) { LOCAL_Error_TYPE = TYPE_ERROR_TEXT; } } + LOCAL_ActiveError->errorRawTerm = inp->val.t; } if (LOCAL_Error_TYPE != YAP_NO_ERROR) return NULL; diff --git a/H/YapText.h b/H/YapText.h index 2c5738203..899acb8b8 100644 --- a/H/YapText.h +++ b/H/YapText.h @@ -1531,8 +1531,10 @@ static inline Atom UTF32ToAtom(const wchar_t *s USES_REGS) { inp.type = YAP_STRING_WCHARS; out.type = YAP_STRING_ATOM; out.max = -1; - if (!Yap_CVT_Text(&inp, &out PASS_REGS)) - return 0L; + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) { + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_ATOM : LOCAL_Error_TYPE ); + return NULL; + } return out.val.a; } @@ -1580,8 +1582,10 @@ static inline Term Yap_WCharsToString(const wchar_t *s USES_REGS) { inp.type = YAP_STRING_WCHARS; out.type = YAP_STRING_STRING; out.val.uc = NULL; - if (!Yap_CVT_Text(&inp, &out PASS_REGS)) + if (!Yap_CVT_Text(&inp, &out PASS_REGS)) { + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_STRING : LOCAL_Error_TYPE ); return 0L; + } return out.val.t; } @@ -1593,8 +1597,10 @@ static inline Atom Yap_ConcatAtoms(Term t1, Term t2 USES_REGS) { inpv[1].type = YAP_STRING_ATOM; out.type = YAP_STRING_ATOM; out.val.uc = NULL; - if (!Yap_Concat_Text(2, inpv, &out PASS_REGS)) - return (Atom)NULL; + if (!Yap_Concat_Text(2, inpv, &out PASS_REGS)) { + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_ATOM : LOCAL_Error_TYPE ); + return NULL; + } return out.val.a; } @@ -1621,8 +1627,10 @@ static inline Term Yap_ConcatStrings(Term t1, Term t2 USES_REGS) { inpv[1].type = YAP_STRING_STRING; out.type = YAP_STRING_STRING; - if (!Yap_Concat_Text(2, inpv, &out PASS_REGS)) + if (!Yap_Concat_Text(2, inpv, &out PASS_REGS)){ + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_STRING : LOCAL_Error_TYPE ); return 0L; + } return out.val.t; } @@ -1636,8 +1644,10 @@ static inline Atom Yap_SpliceAtom(Term t1, Atom ats[], size_t cut, inp.val.t = t1; outv[0].type = YAP_STRING_ATOM; outv[1].type = YAP_STRING_ATOM; - if (!Yap_Splice_Text(2, cuts, &inp, outv PASS_REGS)) - return (Atom)NULL; + if (!Yap_Splice_Text(2, cuts, &inp, outv PASS_REGS)) { + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_ATOM : LOCAL_Error_TYPE ); + return NULL; + } ats[0] = outv[0].val.a; ats[1] = outv[1].val.a; return ats[0]; @@ -1651,8 +1661,10 @@ static inline Atom Yap_SubtractHeadAtom(Term t1, Term th USES_REGS) { outv[0].val.t = th; outv[1].type = YAP_STRING_ATOM; outv[1].val.t = 0; - if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)) - return (Atom)NULL; + if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)) { + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_ATOM : LOCAL_Error_TYPE ); + return NULL; + } return outv[1].val.a; } @@ -1664,8 +1676,10 @@ static inline Atom Yap_SubtractTailAtom(Term t1, Term th USES_REGS) { outv[0].val.t = 0; outv[1].type = YAP_STRING_ATOM; outv[1].val.t = th; - if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)) - return (Atom)NULL; + if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)) { + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_ATOM : LOCAL_Error_TYPE ); + return 0L; + } return outv[0].val.a; } @@ -1679,8 +1693,10 @@ static inline Term Yap_SpliceString(Term t1, Term ts[], size_t cut, outv[1].type = YAP_STRING_STRING; cuts[0] = cut; cuts[1] = max; - if (!Yap_Splice_Text(2, cuts, &inp, outv PASS_REGS)) + if (!Yap_Splice_Text(2, cuts, &inp, outv PASS_REGS)){ + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_STRING : LOCAL_Error_TYPE ); return 0L; + } ts[0] = outv[0].val.t; ts[1] = outv[1].val.t; return ts[0]; @@ -1694,8 +1710,10 @@ static inline Term Yap_SubtractHeadString(Term t1, Term th USES_REGS) { outv[0].val.t = th; outv[1].type = YAP_STRING_STRING; outv[1].val.t = 0; - if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)) + if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)){ + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_STRING : LOCAL_Error_TYPE ); return 0L; + } return outv[1].val.t; } @@ -1707,8 +1725,10 @@ static inline Term Yap_SubtractTailString(Term t1, Term th USES_REGS) { outv[0].val.t = 0; outv[1].type = YAP_STRING_STRING; outv[1].val.t = th; - if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)) + if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, outv PASS_REGS)){ + LOCAL_Error_TYPE = (LOCAL_Error_TYPE == TYPE_ERROR_TEXT ? TYPE_ERROR_STRING : LOCAL_Error_TYPE ); return 0L; + } return outv[0].val.t; } diff --git a/YAP.cbp b/YAP.cbp index 09ed424ef..3855851fc 100644 --- a/YAP.cbp +++ b/YAP.cbp @@ -1585,7 +1585,7 @@ - + @@ -1627,7 +1627,7 @@ - + @@ -3619,9 +3619,6 @@ - - diff --git a/compile_commands.json b/compile_commands.json index 8bc8dc6d7..b83330409 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -726,7 +726,7 @@ }, { "directory": "/home/vsc/github/yap-6.3/packages/raptor", - "command": "/usr/bin/clang -DCOROUTINING=1 -DDEBUG=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H=1 -DLOW_LEVEL_TRACER=1 -DMYDDAS_SQLITE3=1 -DRATIONAL_TREES=1 -DTABLING=1 -DTHREADED_CODE=1 -DUSE_MYDDAS=1 -DUTF8PROC=1 -D_GNU_SOURCE -D_YAP_NOT_INSTALLED_=1 -Dlibxml2_EXPORTS -I/home/vsc/github/yap-6.3 -I/usr/include/x86_64-linux-gnu -I/home/vsc/github/yap-6.3/utf8proc -I/home/vsc/github/yap-6.3/packages/myddas -I/home/vsc/github/yap-6.3/packages/myddas/sqlite3/src -I/home/vsc/github/yap-6.3/H -I/home/vsc/github/yap-6.3/H/generated -I/home/vsc/github/yap-6.3/include -I/home/vsc/github/yap-6.3/os -I/home/vsc/github/yap-6.3/OPTYap -I/home/vsc/github/yap-6.3/JIT/HPP -I/home/vsc/github/yap-6.3/packages/raptor/../../H -I/home/vsc/anaconda3/conda-bld/yap4py_1522051601517/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/include/libxml2 -I/home/vsc/github/yap-6.3/packages/raptor -g3 -gdwarf-2 -fPIC -Wall -fexceptions -o CMakeFiles/libxml2.dir/xml2_yap.c.o -c /home/vsc/github/yap-6.3/packages/raptor/xml2_yap.c", + "command": "/usr/bin/clang -DCOROUTINING=1 -DDEBUG=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H=1 -DLOW_LEVEL_TRACER=1 -DMYDDAS_SQLITE3=1 -DRATIONAL_TREES=1 -DTABLING=1 -DTHREADED_CODE=1 -DUSE_MYDDAS=1 -DUTF8PROC=1 -D_GNU_SOURCE -D_YAP_NOT_INSTALLED_=1 -Dlibxml2_EXPORTS -I/home/vsc/github/yap-6.3 -I/usr/include/x86_64-linux-gnu -I/home/vsc/github/yap-6.3/utf8proc -I/home/vsc/github/yap-6.3/packages/myddas -I/home/vsc/github/yap-6.3/packages/myddas/sqlite3/src -I/home/vsc/github/yap-6.3/H -I/home/vsc/github/yap-6.3/H/generated -I/home/vsc/github/yap-6.3/include -I/home/vsc/github/yap-6.3/os -I/home/vsc/github/yap-6.3/OPTYap -I/home/vsc/github/yap-6.3/JIT/HPP -I/home/vsc/github/yap-6.3/packages/raptor/../../H -I/usr/include/libxml2 -I/home/vsc/github/yap-6.3/packages/raptor -g3 -gdwarf-2 -fPIC -Wall -fexceptions -o CMakeFiles/libxml2.dir/xml2_yap.c.o -c /home/vsc/github/yap-6.3/packages/raptor/xml2_yap.c", "file": "/home/vsc/github/yap-6.3/packages/raptor/xml2_yap.c" }, { diff --git a/console/yap.c b/console/yap.c index 5c7526c01..0e2b58e0a 100755 --- a/console/yap.c +++ b/console/yap.c @@ -119,7 +119,7 @@ static bool exec_top_level(int BootMode, YAP_init_args *iap) { // FILE *debugf; #ifdef LIGHT - + int _main(int argc, char **argv) #else int main(int argc, char **argv) diff --git a/dlocals.h b/dlocals.h index afd0fbcda..7d1014ea7 100644 --- a/dlocals.h +++ b/dlocals.h @@ -423,6 +423,9 @@ #define LOCAL_ActiveError (Yap_local.ActiveError) #define REMOTE_ActiveError(wid) (REMOTE(wid)->ActiveError) +#define LOCAL_CommittedError (Yap_local.CommittedError) +#define REMOTE_CommittedError(wid) (REMOTE(wid)->CommittedError) + /// pointer to an exception term, from throw #define LOCAL_IOBotch (Yap_local.IOBotch) #define REMOTE_IOBotch(wid) (REMOTE(wid)->IOBotch) @@ -508,6 +511,9 @@ #define LOCAL_mathstring (Yap_local.mathstring) #define REMOTE_mathstring(wid) (REMOTE(wid)->mathstring) +#define LOCAL_ctx (Yap_local.ctx) +#define REMOTE_ctx(wid) (REMOTE(wid)->ctx) + // grow.c #define LOCAL_heap_overflows (Yap_local.heap_overflows) #define REMOTE_heap_overflows(wid) (REMOTE(wid)->heap_overflows) diff --git a/packages/python/swig/setup.py b/packages/python/swig/setup.py index b6b7622cd..c5f217f6c 100644 --- a/packages/python/swig/setup.py +++ b/packages/python/swig/setup.py @@ -65,11 +65,11 @@ if platform.system() == 'Windows': win_libs = ['wsock32','ws2_32'] my_extra_link_args = ['-Wl,-export-all-symbols'] elif platform.system() == 'Darwin': - my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/home/vsc/anaconda3/conda-bld/yap4py_1522052049872/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib','-Wl,-rpath,../yap4py'] + my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/usr/local/lib','-Wl,-rpath,../yap4py'] win_libs = [] local_libs = ['Py4YAP'] elif platform.system() == 'Linux': - my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/home/vsc/anaconda3/conda-bld/yap4py_1522052049872/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib','-Wl,-rpath,'+join('/home/vsc/anaconda3/conda-bld/yap4py_1522052049872/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib','..'),'-Wl,-rpath,../yap4py'] + my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/usr/local/lib','-Wl,-rpath,'+join('/usr/local/lib','..'),'-Wl,-rpath,../yap4py'] win_libs = [] local_libs = ['Py4YAP'] @@ -90,10 +90,10 @@ extensions = [Extension('_yap', native_sources, ('YAP_PYTHON', '1'), ('_GNU_SOURCE', '1')], runtime_library_dirs=[ - abspath(join(sysconfig.get_path('platlib'),'yap4py')), abspath(sysconfig.get_path('platlib')),'/home/vsc/anaconda3/conda-bld/yap4py_1522052049872/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib'], + abspath(join(sysconfig.get_path('platlib'),'yap4py')), abspath(sysconfig.get_path('platlib')),'/usr/local/lib'], swig_opts=['-modern', '-c++', '-py3', '-DX_API', '-Iyap4py/include' ], - library_dirs=[".",'../../..','/home/vsc/anaconda3/conda-bld/yap4py_1522052049872/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib'], + library_dirs=[".",'../../..','/usr/local/lib'], extra_link_args=my_extra_link_args, libraries=['Yap','gmp']+win_libs+local_libs, include_dirs=['/home/vsc/github/yap-6.3/H', diff --git a/packages/python/swig/yap4py/__init__.py b/packages/python/swig/yap4py/__init__.py index d5e08469a..e6f73887c 100644 --- a/packages/python/swig/yap4py/__init__.py +++ b/packages/python/swig/yap4py/__init__.py @@ -7,7 +7,7 @@ import platform import sys global yap_lib_path -yap_lib_path = "/home/vsc/anaconda3/conda-bld/yap4py_1522052049872/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib" +yap_lib_path = "/usr/local/lib" if platform.system() == 'Windows': def load( dll ): diff --git a/packages/raptor/YAP_RAPTOR.cbp b/packages/raptor/YAP_RAPTOR.cbp index f200288ff..1d51ca681 100644 --- a/packages/raptor/YAP_RAPTOR.cbp +++ b/packages/raptor/YAP_RAPTOR.cbp @@ -49,7 +49,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/pl/messages.yap b/pl/messages.yap index b84204973..af64436ea 100644 --- a/pl/messages.yap +++ b/pl/messages.yap @@ -256,7 +256,7 @@ location(error(syntax_error(_),info(between(_,LN,_), FileName, _ChrPos, _Err)), location(style_check(_,LN,FileName,_ ), Level , LC) --> !, display_consulting( FileName, Level, LC ), - [ '~a:~d:0 ~s ' - [FileName,LN,Level] ] . + [ '~a:~d:0 ~a ' - [FileName,LN,Level] ] . location( error(_,Info), Level, LC ) --> { '$error_descriptor'(Info, Desc) }, { @@ -286,20 +286,20 @@ main_message( error(syntax_error(Msg),info(between(L0,LM,LF),_Stream, _Pos, Term [' ~a: failed_processing syntax error term ~q' - [Level,Term]], [nl] ). -main_message(style_check(singleton(SVs),_Pos,_File,P), Level, _LC) --> +main_message(style_check(singleton(SVs),_Pos,_File,P), _Level, _LC) --> !, % {writeln(ci)}, { clause_to_indicator(P, I) }, - [ ' ~a: singleton variable~*c ~s in ~q.' - [ Level, NVs, 0's, SVsL, I] ], + [ nl, ' singleton variable~*c ~w in ~q.' - [ NVs, 0's, SVsL, I] ], { svs(SVs,SVs,SVsL), ( SVs = [_] -> NVs = 0 ; NVs = 1 ) }. -main_message(style_check(multiple(N,A,Mod,I0),_Pos,File,_P), Level, _LC) --> +main_message(style_check(multiple(N,A,Mod,I0),_Pos,File,_P), _Level, _LC) --> !, - [ ' ~a: ~a redefines ~q from ~a.' - [Level,File, Mod:N/A, I0] ]. -main_message(style_check(discontiguous(N,A,Mod),_S,_W,_P) , Level, _LC)--> + [ ' ~a redefines ~q, originally defined in ~a.' - [File, Mod:N/A, I0] ]. +main_message(style_check(discontiguous(N,A,Mod),_S,_W,_P) , _Level, _LC)--> !, - [ ' ~a: discontiguous definition for ~p.' - [Level,Mod:N/A] ]. + [ ' discontiguous definition for ~p.' - [Mod:N/A] ]. main_message(error(consistency_error(Who)), Level, _LC) --> !, [ ' ~a: has argument ~a not consistent with type.'-[Level,Who] ].