From 0230ff35d10f9bf0c0d8839f21fba39ee25d70c7 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 23 Nov 2018 14:00:20 +0000 Subject: [PATCH] debugger --- C/stack.c | 3 +++ CXX/yapi.cpp | 3 +++ CXX/yapi.hh | 11 ++++++----- H/TermExt.h | 2 ++ packages/myddas/pl/myddas.ypp | 6 +++--- packages/myddas/sqlite3/sqlitest.yap | 12 ++++++------ pl/debug.yap | 12 ++++-------- swi/library/plunit.pl | 3 ++- 8 files changed, 29 insertions(+), 23 deletions(-) diff --git a/C/stack.c b/C/stack.c index fb3ca3a6e..bba9ad55d 100644 --- a/C/stack.c +++ b/C/stack.c @@ -1745,6 +1745,7 @@ static int legal_env(CELL *ep USES_REGS) { return (TRUE); } +#if 0 static bool handled_exception(USES_REGS1) { yamop *pos = NEXTOP(PredDollarCatch->cs.p_code.TrueCodeOfPred, l); bool found_handler = false; @@ -1767,6 +1768,8 @@ static bool handled_exception(USES_REGS1) { return !found_handler; } +#endif + #define ADDBUF( CMD ) { \ while (true) { \ size_t sz = CMD; \ diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index c0859d0dd..cff2c3d47 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -1,7 +1,10 @@ +extern "C" { + #include "inline-only.h" #define _EXPORT_KERNEL 1 +} #include "yapi.hh" diff --git a/CXX/yapi.hh b/CXX/yapi.hh index 599ae7cf1..4154cc55b 100755 --- a/CXX/yapi.hh +++ b/CXX/yapi.hh @@ -13,21 +13,22 @@ #include extern "C" { + #include "YapConfig.h" + } -#if HAVE_GMPXX_H || defined(__ANDROID__) #include -#elif HAVE_GMP_H -#include -#endif + + + /*! * * @ingroup fli_c_cxx * @defgroup yap-cplus-interface An object oriented interface for YAP. * - * @{ +1 * @{ * * * @brief C++ wrapper to terms, predicates and queries diff --git a/H/TermExt.h b/H/TermExt.h index d6ffa0f79..fed59fcbd 100755 --- a/H/TermExt.h +++ b/H/TermExt.h @@ -398,6 +398,8 @@ INLINE_ONLY bool IsBigIntTerm(Term t) { #if !defined(__cplusplus) #include +#else +#include #endif diff --git a/packages/myddas/pl/myddas.ypp b/packages/myddas/pl/myddas.ypp index d8ac3e667..dcc33c499 100644 --- a/packages/myddas/pl/myddas.ypp +++ b/packages/myddas/pl/myddas.ypp @@ -263,9 +263,9 @@ db_open(odbc,Connection,ODBCEntry,User,Password) :- %% sqlite3 db_open(sqlite3,Connection,File,User,Password) :- - absolute_file_name(File,DB,[extensions(db),access(write),file_type(myddas),expand(true)]), - '$error_checks'(db_open(sqlite3,Connection,File,User,Password)), - c_sqlite3_connect(File,User,Password,Con), + absolute_file_name(File,Db,[extensions(db),access(write),file_type(myddas),expand(true)]), + '$error_checks'(db_open(sqlite3,Connection,Db,User,Password)), + c_sqlite3_connect(Db,User,Password,Con), set_value(Connection,Con). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/packages/myddas/sqlite3/sqlitest.yap b/packages/myddas/sqlite3/sqlitest.yap index 531c48bbf..3a99d7cb2 100644 --- a/packages/myddas/sqlite3/sqlitest.yap +++ b/packages/myddas/sqlite3/sqlitest.yap @@ -7,13 +7,13 @@ :- begin_tests(sqlite3). -:- if( yap_flag(android,true) ). -test(open) :- - db_open(sqlite3, '/data/user/0/pt.up.yap/files/chinook.db', _, _). -:- else. +%:- if( yap_flag(android,true) ). +%test(open) :- +% db_open(sqlite3, '/data/user/0/pt.up.yap/files/chinook.db', _, _). +%:- else. test(open) :- db_open(sqlite3,dataset('chinook'),_,_). -:-endif. +%:-endif. test(schema0, all((Tables ==[(table albums), (table artists), @@ -40,7 +40,7 @@ test(all_artists, all(( 273-'C. Monteverdi, Nigel Rogers - Chiaroscuro; London Baroque; London Cornett & Sackbu', 274-'Nash Ensemble', 275-'Philip Glass Ensemble'] ))) :- - artists(X,Y). + findall(X-Y,artists(X,Y),L). test(cut_artists, true((X-Y == 1-'AC/DC'))) :- artists(X, Y), diff --git a/pl/debug.yap b/pl/debug.yap index 5a8575fb9..04223319d 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -846,16 +846,12 @@ be lost. '$scan_number'(ScanNumber), ( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ), '__NB_setval__'('$debug_status', state(leap, Goal, stop)). -'$action'(z,_,CallNumber,_,_,_H) :- !, % 'z zip, fast leap - '$scan_number'(ScanNumber), - ( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ), - '__NB_setval__'('$debug_status', state(zip, Goal, stop)). +'$action'(z,_,_allNumber,_,_,_H) :- !, % 'z zip, fast leap + '__NB_setval__'('$debug_status', state(zip, 0, stop)). % skip first call (for current goal), % stop next time. -'$action'(k,_,CallNumber,_,_,_) :- !, % 'k zip, fast leap - '$scan_number'(ScanNumber), - ( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ), - '__NB_setval__'('$debug_status', state(zip, Goal, ignore)). +'$action'(k,_,_CallNumber,_,_,_) :- !, % 'k zip, fast leap + '__NB_setval__'('$debug_status', state(zip, 0, stop)). % skip first call (for current goal), % stop next time. '$action'(n,_,_,_,_,_) :- !, % 'n nodebug diff --git a/swi/library/plunit.pl b/swi/library/plunit.pl index 73aef14d9..e6b4586dd 100644 --- a/swi/library/plunit.pl +++ b/swi/library/plunit.pl @@ -102,7 +102,8 @@ user:term_expansion(In, Out) :- if_expansion(In, Out). swi :- catch(current_prolog_flag(dialect, swi), _, fail), !. -swi :- catch(current_prolog_flag(dialect, yap), _, fail). +swi :- catch(current_prolog_flag(dialect, yap), _, fail), !. +yap :- catch(current_prolog_flag(dialect, yap), _, fail), !. sicstus :- catch(current_prolog_flag(system_type, _), _, fail).