This commit is contained in:
Vitor Santos Costa 2018-11-24 10:25:05 +00:00
commit 4f7a5809d5
9 changed files with 35 additions and 29 deletions

View File

@ -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; \

View File

@ -1,7 +1,10 @@
extern "C" {
#include "inline-only.h"
#define _EXPORT_KERNEL 1
}
#include "yapi.hh"

View File

@ -13,21 +13,22 @@
#include <vector>
extern "C" {
#include "YapConfig.h"
}
#if HAVE_GMPXX_H || defined(__ANDROID__)
#include <gmpxx.h>
#elif HAVE_GMP_H
#include <gmp.h>
#endif
/*!
*
* @ingroup fli_c_cxx
* @defgroup yap-cplus-interface An object oriented interface for YAP.
*
* @{
1 * @{
*
*
* @brief C++ wrapper to terms, predicates and queries

View File

@ -398,6 +398,8 @@ INLINE_ONLY bool IsBigIntTerm(Term t) {
#if !defined(__cplusplus)
#include <gmp.h>
#else
#include <gmpxx.h>
#endif

View File

@ -833,7 +833,7 @@ static inline Term Yap_CharsToTBQ(const char *s, Term mod,
static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS;
inp.type = YAP_STRING_ATOMS|YAP_STRING_CODES;
out.type = YAP_STRING_ATOM;
out.val.uc = NULL;
out.enc = ENC_ISO_UTF8;
@ -845,7 +845,7 @@ static inline Atom Yap_ListOfAtomsToAtom(Term t0 USES_REGS) {
static inline Term Yap_ListOfAtomsToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS;
inp.type = YAP_STRING_ATOMS|YAP_STRING_CODES;
out.type =
YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG | YAP_STRING_TERM;
out.val.uc = NULL;
@ -858,7 +858,7 @@ static inline Term Yap_ListOfAtomsToNumber(Term t0 USES_REGS) {
static inline Term Yap_ListOfAtomsToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOMS;
inp.type = YAP_STRING_ATOMS|YAP_STRING_CODES;
out.type = YAP_STRING_STRING;
out.val.uc = NULL;
out.enc = ENC_ISO_UTF8;
@ -870,7 +870,7 @@ static inline Term Yap_ListOfAtomsToString(Term t0 USES_REGS) {
static inline Atom Yap_ListOfCodesToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_CODES;
inp.type = YAP_STRING_CODES|YAP_STRING_ATOMS;
out.type = YAP_STRING_ATOM;
out.val.uc = NULL;
out.enc = ENC_ISO_UTF8;
@ -882,7 +882,7 @@ static inline Atom Yap_ListOfCodesToAtom(Term t0 USES_REGS) {
static inline Term Yap_ListOfCodesToNumber(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_CODES;
inp.type = YAP_STRING_CODES|YAP_STRING_ATOMS;
out.type = YAP_STRING_INT | YAP_STRING_FLOAT | YAP_STRING_BIG;
out.enc = ENC_ISO_UTF8;
out.val.uc = NULL;
@ -895,7 +895,7 @@ static inline Term Yap_ListOfCodesToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_CODES;
inp.type = YAP_STRING_CODES|YAP_STRING_ATOMS;
out.val.uc = NULL;
out.type = YAP_STRING_STRING;
out.enc = ENC_ISO_UTF8;

View File

@ -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).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -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),

View File

@ -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

View File

@ -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).