This commit is contained in:
Vitor Santos Costa 2018-06-27 11:38:42 +01:00
parent 8911fea5ae
commit 0c946038d5
8 changed files with 27 additions and 16 deletions

View File

@ -2043,7 +2043,7 @@ static Int p_compile(USES_REGS1) { /* '$compile'(+C,+Flags,+C0,-Ref) */
Yap_addclause(t, code_adr, t1, mod, &ARG5);
YAPLeaveCriticalSection();
}
if (LOCAL_ErrorMessage) {
if (LOCAL_ErrorMessage ) {
Yap_Error(LOCAL_Error_TYPE, ARG1, LOCAL_ErrorMessage);
YAPLeaveCriticalSection();
return false;

View File

@ -874,6 +874,7 @@ static Int close_error(USES_REGS1) {
if (!LOCAL_CommittedError)
return true;
LOCAL_CommittedError->errorNo = YAP_NO_ERROR;
LOCAL_ErrorMessage = NULL;
free(LOCAL_CommittedError);
LOCAL_CommittedError = NULL;
return true;

View File

@ -92,7 +92,7 @@ void *pop_output_text_stack__(int i, const void *export) {
struct mblock *np = p->next;
if (p + 1 == export) {
size_t sz = p->sz - sizeof(struct mblock);
memcpy(p, p + 1, sz);
memmove(p, p + 1, sz);
export = p;
} else {
free(p);
@ -458,7 +458,6 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
return at->UStrOfAE;
}
size_t sz = strlen(at->StrOfAE);
inp->type |= YAP_STRING_IN_TMP;
void *o = Malloc(sz + 1);
strcpy(o, at->StrOfAE);
return pop_output_text_stack(lvl, o);

View File

@ -1345,9 +1345,9 @@ static inline const unsigned char *Yap_TextToUTF8Buffer(Term t0 USES_REGS) {
inp.val.t = t0;
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES |
YAP_STRING_ATOMS_CODES | YAP_STRING_MALLOC;
YAP_STRING_ATOMS_CODES;
out.val.uc = NULL;
out.type = YAP_STRING_CHARS;
out.type = YAP_STRING_CHARS | YAP_STRING_MALLOC;
out.enc = ENC_ISO_UTF8;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))

View File

@ -135,12 +135,12 @@
:- use_module(myddas_sqlite3,[
% myddas_mysql.ypp
c_sqlite3_connect/4,
c_sqlite3_disconnect/1,
c_sqlite3_query/5,
%c_sqlite3_connect/4,
%c_sqlite3_disconnect/1,
%c_sqlite3_query/5,
sqlite3_result_set/1,
c_sqlite3_number_of_fields/3,
c_sqlite3_get_attributes_types/3,
%c_sqlite3_number_of_fields/3,
%c_sqlite3_get_attributes_types/3,
sqlite3_describe/3,
sqlite3_show_tables/2,
sqlite3_row/3
@ -242,7 +242,7 @@ db_open(odbc,Connection,ODBCEntry,User,Password) :-
%% sqlite3
db_open(sqlite3,Connection,File,User,Password) :-
'$error_checks'(db_open(sqlite3,Connection,File,User,Password)),
myddas_sqlite3:c_sqlite3_connect(File,User,Password,Con),
c_sqlite3_connect(File,User,Password,Con),
set_value(Connection,Con).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -19,27 +19,28 @@
#define DBMS(x) sqlite3_##x
#define c_DBMS(x) c_sqlite3_##x
#define NAME() 'libYapsqlite3'
#define MODULE() myddas_sqlite3
#define MODULE() user
#define INIT() init_sqlite3
#elif defined( odbc )
#undef odbc
#define DBMS(x) odbc_##x
#define c_DBMS(x) c_odbc_##x
#define NAME() 'libYapodbc'
#define MODULE() myddas_odbc
#define MODULE() user
#define INIT() init_odbc
#elif defined( postgres )
#undef postgres
#define DBMS(x) postgres_##x
#define c_DBMS(x) c_postgres_##x
#define NAME() 'libYappostgres'
#define MODULE() myddas_postgres
#define MODULE() user
#define INIT() init_odbc
#endif
#if defined(DBMS)
:- module(MODULE(),[
/*
c_DBMS(change_database)/2,
c_DBMS(connect)/4,
c_DBMS(disconnect)/1,
@ -49,6 +50,7 @@
c_DBMS(get_next_result_set)/3,
c_DBMS(query)/5,
c_DBMS(number_of_fields)/3,
*/
DBMS(describe)/3,
DBMS(show_tables)/2,
DBMS(row)/3

View File

@ -29,7 +29,7 @@
:- module(system('$messages',[]),
[system_message/4,
prefix/2,
prefix/5,
%prefix/5,
file_location/3]).
/**
@ -1043,9 +1043,11 @@ prolog:print_message(Severity, Term) :-
),
!.
prolog:print_message(_Severity, _Term) :-
format(user_error,'failed to print ~w: ~w~n` ,[ _Severity, _Term]).
format(user_error,'failed to print ~w: ~w~n' ,[ _Severity, _Term]).
'$error_descriptor'( Info, Info ).
/**
@}
*/

View File

@ -309,6 +309,13 @@ meta_predicate(P) :-
'$expand_goals'(\+A,\+A1,(AO-> false;true),HM,SM,BM,HVars) :- !,
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
'$clean_cuts'(AOO, AO).
'$expand_goals'(not(G),not(G),A\=B,_HM,_BM,_SM,_HVars) :-
nonvar(G),
G = (A = B),
!.
'$expand_goals'(not(A),not(A1),(AO-> false;true),HM,SM,BM,HVars) :- !,
'$expand_goals'(A,A1,AOO,HM,SM,BM,HVars),
'$clean_cuts'(AOO, AO).
'$expand_goals'(once(A),once(A1),
('$current_choice_point'(CP),AO,'$$cut_by'(CP)),HM,SM,BM,HVars) :- !,
'$expand_goals'(A,A1,AO0,HM,SM,BM,HVars),