This commit is contained in:
Vítor Santos Costa 2019-01-23 18:16:13 +00:00
commit e0467d95d4
18 changed files with 784 additions and 1009 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ static char SccsId[] = "%W% %G%";
#include "YapHeap.h"
#include "Yatom.h"
static Int currgent_module(USES_REGS1);
static Int current_module(USES_REGS1);
static Int current_module1(USES_REGS1);
static ModEntry *LookupModule(Term a);
static ModEntry *LookupSystemModule(Term a);

View File

@ -2134,7 +2134,7 @@ static void shortstack( choiceptr b_ptr, CELL * env_ptr , buf_struct_t *bufp) {
void DumpActiveGoals(USES_REGS1) {
/* try to dump active goals */
void *ep = YENV; /* and current environment */
void *cp;
void *cp ;
PredEntry *pe;
struct buf_struct_t buf0, *bufp = &buf0;

File diff suppressed because it is too large Load Diff

View File

@ -175,7 +175,7 @@ static bool load_file(const char *b_file USES_REGS) {
__android_log_print(
ANDROID_LOG_INFO, "YAPDroid", "done init_consult %s ",b_file);
if (c_stream < 0) {
fprintf(stderr, "[ FATAL ERROR: could not open file %s ]\n", b_file);
fprintf(stderr, "[ FATAL ERROR: could not open file %s\n", b_file);
pop_text_stack(lvl);
exit(1);
}
@ -185,7 +185,7 @@ static bool load_file(const char *b_file USES_REGS) {
}
__android_log_print(
ANDROID_LOG_INFO, "YAPDroid", "do reset %s ",b_file);
t = 0;
while (t != TermEof) {
CACHE_REGS
YAP_Reset(YAP_FULL_RESET, false);

View File

@ -111,10 +111,9 @@ typedef struct cp_frame {
CELL *start_cp;
CELL *end_cp;
CELL *to;
#ifdef RATIONAL_TREES
CELL *curp;
CELL oldv;
int ground;
#endif
} copy_frame;
#ifdef COROUTINING

View File

@ -477,6 +477,9 @@ extern void Yap_InitUserCPreds(void);
extern void Yap_InitUserBacks(void);
/* utilpreds.c */
int Yap_copy_complex_term(register CELL *pt0, register CELL *pt0_end,
bool share, Term *split, bool copy_att_vars, CELL *ptf,
CELL *HLow USES_REGS);
extern Term Yap_CopyTerm(Term);
extern bool Yap_Variant(Term, Term);
extern size_t Yap_ExportTerm(Term, char *, size_t, UInt);

View File

@ -418,6 +418,12 @@ extern void Yap_WakeUp(CELL *v);
*(VP) = (D); \
}
#define TrailedMaBind(VP, D) \
{ \
DO_MATRAIL((VP), *(VP), (D)); \
*(VP) = (D); \
}
/************************************************************
Unification Routines

View File

@ -62,7 +62,7 @@
[
class_drop/2
]).

do_checks(Y,Ty,St,Li,Or,Cl,No,Later) :-
numbers_only(Y),
verify_nonzero(No,Y),
@ -76,7 +76,7 @@ numbers_only(Y) :-
; throw(type_error(_X = Y,2,'a rational number',Y))
),
!.
ø
% verify_nonzero(Nonzero,Y)
%
% if Nonzero = nonzero, then verify that Y is not zero

View File

@ -43,6 +43,10 @@
project_nonlin/3,
collect_nonlin/3
]).
:- use_module(library(maplist),
[
maplist/2
]).
% l2conj(List,Conj)
%

View File

@ -47,6 +47,10 @@
dump_nonzero/3,
clp_type/2
]).
:- use_module(library(maplist),
[
maplist/2
]).
clp_type(Var,Type) :-

View File

@ -63,6 +63,10 @@
[
class_drop/2
]).
:- use_module(library(maplist),
[
maplist/2
]).
do_checks(Y,Ty,St,Li,Or,Cl,No,Later) :-
numbers_only(Y),

View File

@ -1,5 +1,6 @@
# set(CMAKE_MACOSX_RPATH 1)
add_library(jplYap jpl.c)
include_directories (${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_PATH} )

View File

@ -48,12 +48,12 @@ refactoring (trivial):
#define JPL_C_LIB_VERSION_PATCH 4
#define JPL_C_LIB_VERSION_STATUS "alpha"
#define JPL_DEBUG
//#define JPL_DEBUG
#ifndef JPL_DEBUG
/*#define DEBUG(n, g) ((void)0) */
#define DEBUG_LEVEL 4
#define JPL_DEBUG(n, g) ( n >= DEBUG_LEVEL ? g : (void)0 )
#define JPL_DEBUG(n, g) ( false && n >= DEBUG_LEVEL ? g : (void)0 )
#endif
/* disable type-of-ref caching (at least until GC issues are resolved) */
@ -642,7 +642,7 @@ static JNIEnv*
jni_env(void) /* economically gets a JNIEnv pointer, valid for this thread */
{ JNIEnv *env;
switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_9) )
switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_2) )
{ case JNI_OK:
return env;
case JNI_EDETACHED:
@ -1826,7 +1826,7 @@ jni_create_jvm_c(
JNIEnv *env;
JPL_DEBUG(1, Sdprintf( "[creating JVM with 'java.class.path=%s']\n", classpath));
vm_args.version = JNI_VERSION_1_6zzzz; /* "Java 1.2 please" */
vm_args.version = JNI_VERSION_1_2; /* "Java 1.2 please" */
if ( classpath )
{
cpoptp = (char *)malloc(strlen(classpath) + strlen("-Djava.class.path=")+1);

View File

@ -635,8 +635,9 @@ PyObject *term_to_nametuple(const char *s, arity_t arity, PyObject *tuple) {
typp = (PyTypeObject *)d;
} else {
PyStructSequence_Desc *desc = PyMem_Calloc(sizeof(PyStructSequence_Desc), 1);
desc->name = PyMem_Malloc(strlen(s) + 1);
strcpy((char *)desc->name, s);
char *tnp;
desc->name = tnp = PyMem_Malloc(strlen(s) + 1);
strcpy(tnp, s);
desc->doc = "YAPTerm";
desc->fields = pnull;
desc->n_in_sequence = arity;

View File

@ -1,4 +1,15 @@
#include "Yap.h"
#include "py4yap.h"

View File

@ -1,8 +1,6 @@
%:- start_low_level_trace.
%:- module(android,
% [text_to_query/2]).
:- module(android,
[text_to_query/2]).
:- initialization(yap_flag(verbose,_,normal)).

View File

@ -67,21 +67,9 @@ followed by the failure of that call.
:- multifile user:unknown_predicate_handler/3.
undefined_query(G0, M0, Cut) :-
recorded('$import','$import'(M,M0,G,G0,_,_),_),
'$call'(G, Cut, G, M).
recorded('$import','$import'(M,M0,G,G0,_,_),_),
'$call'(G, Cut, G, M).
'$handle_error'(error,Goal,Mod) :-
functor(Goal,Name,Arity),
'$do_error'(existence_error(procedure,Name/Arity), Mod:Goal).
'$handle_error'(warning,Goal,Mod) :-
functor(Goal,Name,Arity),
'program_continuation'(PMod,PName,PAr),
print_message(warning,error(existence_error(procedure,Name/Arity), context(Mod:Goal,PMod:PName/PAr))),
fail.
'$handle_error'(fail,_Goal,_Mod) :-
fail.
:- '$set_no_trace'('$handle_error'(_,_,_), prolog).
/**
* @pred '$undefp_search'(+ M0:G0, -MG)
@ -103,43 +91,48 @@ undefined_query(G0, M0, Cut) :-
user:unknown_predicate_handler(GM0,EM0,MG),
!.
'$undefp_search'(M0:G0, MG) :-
'$get_undefined_predicates'(M0:G0, MG), !.
'$get_undefined_predicates'(M0:G0, MG), !.
% undef handler
'$undefp'([M0|G0],MG) :-
% make sure we do not loop on undefined predicates
'$undef_set'(Action,Debug,Current),
'$search_def'(M0:G0,MG,Action,Debug,Current).
'$undef_setup'(Action,Debug,Current),
('$get_undefined_predicates'(M0:G0, MG)
->
true
;
'$undef_error'(M0:G0, MG)
),
'$undef_cleanup'(Action,Debug,Current).
'$undef_set'(Action,Debug,Current) :-
yap_flag( unknown, Action, fail),
'$undef_error'(M0:G0, MG) :-
'$pred_exists'(unknown_predicate_handler(_,_,_,_), user),
'$yap_strip_module'(M0:G0, EM0, GM0),
user:unknown_predicate_handler(GM0,EM0,MG),
!.
'$handle_error'(Mod:Goal,_) :-
functor(Goal,Name,Arity),
'$do_error'(existence_error(procedure,Name/Arity), Mod:Goal).
'$handle_error'(warning,Goal,Mod) :-
functor(Goal,Name,Arity),
'program_continuation'(PMod,PName,PAr),
print_message(warning,error(existence_error(procedure,Name/Arity), context(Mod:Goal,PMod:PName/PAr))),
fail.
'$handle_error'(fail,_Goal,_Mod) :-
fail.
'$undef_setup'(Action,Debug,Current) :-
yap_flag( unknown, Action, fail),
yap_flag( debug, Debug, false),
'$stop_creeping'(Current).
'$search_def'(M0:G0,NM:NG,Action,Debug,Current) :-
'$undefp_search'(M0:G0, NM:NG),
'$pred_exists'(NG,NM),
!,
'$undef_cleanup'(Action,Debug,_Current) :-
yap_flag( unknown, _, Action),
yap_flag( debug, _, Debug),
nonvar(NG),
nonvar(NM),
(
Current == true
->
% carry on signal processing
'$start_creep'([NM|NG], creep)
;
'$execute0'(NG, NM)
).
'$search_def'(M0:G0,_,Action,Debug,_Current) :-
yap_flag( unknown, _, Action),
yap_flag( debug, _, Debug),
'$start_creep'([prolog|true], creep),
'$handle_error'(Action,G0,M0).
'$start_creep'([prolog|true], creep).
:- '$undefp_handler'('$undefp'(_,_), prolog).
:- '$undefp_handler'('$undefp'(_,_), prolog).
/** @pred unknown(- _O_,+ _N_)