fix excessive pruning in meta-calls
fix Term->int breakage in compiler improve JPL (at least it does something now for amd64). git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1264 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
7f481cef24
commit
59561e2688
@ -10,8 +10,11 @@
|
|||||||
* *
|
* *
|
||||||
* File: absmi.c *
|
* File: absmi.c *
|
||||||
* comments: Portable abstract machine interpreter *
|
* comments: Portable abstract machine interpreter *
|
||||||
* Last rev: $Date: 2005-03-07 17:49:14 $,$Author: vsc $ *
|
* Last rev: $Date: 2005-03-13 06:26:09 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.160 2005/03/07 17:49:14 vsc
|
||||||
|
* small fixes
|
||||||
|
*
|
||||||
* Revision 1.159 2005/03/04 20:29:55 ricroc
|
* Revision 1.159 2005/03/04 20:29:55 ricroc
|
||||||
* bug fixes for YapTab support
|
* bug fixes for YapTab support
|
||||||
*
|
*
|
||||||
@ -12505,7 +12508,7 @@ Yap_absmi(int inp)
|
|||||||
Atom at = AtomOfTerm(d0);
|
Atom at = AtomOfTerm(d0);
|
||||||
arity = 0;
|
arity = 0;
|
||||||
if (at == AtomCut) {
|
if (at == AtomCut) {
|
||||||
choiceptr cut_pt = (choiceptr)ENV[E_CB];
|
choiceptr cut_pt = (choiceptr)pt0[E_CB];
|
||||||
/* find where to cut to */
|
/* find where to cut to */
|
||||||
if (SHOULD_CUT_UP_TO(B,cut_pt)) {
|
if (SHOULD_CUT_UP_TO(B,cut_pt)) {
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
@ -12595,7 +12598,7 @@ Yap_absmi(int inp)
|
|||||||
ENDP(pt1);
|
ENDP(pt1);
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
} else if ((Atom)(pen->FunctorOfPred) == AtomCut) {
|
} else if ((Atom)(pen->FunctorOfPred) == AtomCut) {
|
||||||
choiceptr cut_pt = (choiceptr)ENV[E_CB];
|
choiceptr cut_pt = (choiceptr)pt0[E_CB];
|
||||||
/* find where to cut to */
|
/* find where to cut to */
|
||||||
if (SHOULD_CUT_UP_TO(B,cut_pt)) {
|
if (SHOULD_CUT_UP_TO(B,cut_pt)) {
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
@ -10,8 +10,11 @@
|
|||||||
* File: c_interface.c *
|
* File: c_interface.c *
|
||||||
* comments: c_interface primitives definition *
|
* comments: c_interface primitives definition *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-03-04 20:30:10 $,$Author: ricroc $ *
|
* Last rev: $Date: 2005-03-13 06:26:10 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.63 2005/03/04 20:30:10 ricroc
|
||||||
|
* bug fixes for YapTab support
|
||||||
|
*
|
||||||
* Revision 1.62 2005/03/02 18:35:44 vsc
|
* Revision 1.62 2005/03/02 18:35:44 vsc
|
||||||
* try to make initialisation process more robust
|
* try to make initialisation process more robust
|
||||||
* try to make name more robust (in case Lookup new atom fails)
|
* try to make name more robust (in case Lookup new atom fails)
|
||||||
@ -217,7 +220,7 @@ X_API Term STD_PROTO(YAP_CreateModule,(Atom));
|
|||||||
X_API int STD_PROTO(YAP_ThreadSelf,(void));
|
X_API int STD_PROTO(YAP_ThreadSelf,(void));
|
||||||
X_API int STD_PROTO(YAP_GetThreadRefCount,(int));
|
X_API int STD_PROTO(YAP_GetThreadRefCount,(int));
|
||||||
X_API void STD_PROTO(YAP_SetThreadRefCount,(int,int));
|
X_API void STD_PROTO(YAP_SetThreadRefCount,(int,int));
|
||||||
X_API int STD_PROTO(YAP_ThreadCreateEngine,(thread_attr *));
|
X_API CELL STD_PROTO(YAP_ThreadCreateEngine,(thread_attr *));
|
||||||
X_API int STD_PROTO(YAP_ThreadAttachEngine,(int));
|
X_API int STD_PROTO(YAP_ThreadAttachEngine,(int));
|
||||||
X_API int STD_PROTO(YAP_ThreadDetachEngine,(int));
|
X_API int STD_PROTO(YAP_ThreadDetachEngine,(int));
|
||||||
X_API int STD_PROTO(YAP_ThreadDestroyEngine,(int));
|
X_API int STD_PROTO(YAP_ThreadDestroyEngine,(int));
|
||||||
@ -1405,7 +1408,7 @@ YAP_ThreadSelf(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
X_API int
|
X_API CELL
|
||||||
YAP_ThreadCreateEngine(thread_attr *attr)
|
YAP_ThreadCreateEngine(thread_attr *attr)
|
||||||
{
|
{
|
||||||
#if USE_THREADS
|
#if USE_THREADS
|
||||||
|
@ -11,8 +11,11 @@
|
|||||||
* File: compiler.c *
|
* File: compiler.c *
|
||||||
* comments: Clause compiler *
|
* comments: Clause compiler *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-03-04 20:30:11 $,$Author: ricroc $ *
|
* Last rev: $Date: 2005-03-13 06:26:10 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.63 2005/03/04 20:30:11 ricroc
|
||||||
|
* bug fixes for YapTab support
|
||||||
|
*
|
||||||
* Revision 1.62 2005/02/21 16:49:39 vsc
|
* Revision 1.62 2005/02/21 16:49:39 vsc
|
||||||
* amd64 fixes
|
* amd64 fixes
|
||||||
* library fixes
|
* library fixes
|
||||||
@ -1454,7 +1457,7 @@ c_goal(Term Goal, int mod, compiler_struct *cglobs)
|
|||||||
}
|
}
|
||||||
else if (f == FunctorComma) {
|
else if (f == FunctorComma) {
|
||||||
int save = cglobs->onlast;
|
int save = cglobs->onlast;
|
||||||
int t2 = ArgOfTerm(2, Goal);
|
Term t2 = ArgOfTerm(2, Goal);
|
||||||
|
|
||||||
cglobs->onlast = FALSE;
|
cglobs->onlast = FALSE;
|
||||||
c_goal(ArgOfTerm(1, Goal), mod, cglobs);
|
c_goal(ArgOfTerm(1, Goal), mod, cglobs);
|
||||||
|
@ -373,7 +373,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
|||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (Yap_heap_regs && !(Yap_PrologMode & BootMode))
|
if (Yap_heap_regs && !(Yap_PrologMode & BootMode))
|
||||||
fprintf(stderr,"***** Processing Error %d (%x,%x) %s***\n", type, ActiveSignals,Yap_PrologMode,format);
|
fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)ActiveSignals,Yap_PrologMode,format);
|
||||||
else
|
else
|
||||||
fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_PrologMode,format);
|
fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_PrologMode,format);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2061,7 +2061,9 @@ static void
|
|||||||
sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
||||||
{
|
{
|
||||||
tr_fr_ptr trail_ptr, dest;
|
tr_fr_ptr trail_ptr, dest;
|
||||||
|
#if !USE_MALLOC
|
||||||
Int OldHeapUsed = HeapUsed;
|
Int OldHeapUsed = HeapUsed;
|
||||||
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Int hp_entrs = 0, hp_erased = 0, hp_not_in_use = 0,
|
Int hp_entrs = 0, hp_erased = 0, hp_not_in_use = 0,
|
||||||
hp_in_use_erased = 0, code_entries = 0;
|
hp_in_use_erased = 0, code_entries = 0;
|
||||||
|
@ -11,8 +11,12 @@
|
|||||||
* File: stdpreds.c *
|
* File: stdpreds.c *
|
||||||
* comments: General-purpose C implemented system predicates *
|
* comments: General-purpose C implemented system predicates *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2005-03-02 19:48:02 $,$Author: vsc $ *
|
* Last rev: $Date: 2005-03-13 06:26:11 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.85 2005/03/02 19:48:02 vsc
|
||||||
|
* Fix some possible errors in name/2 and friends, and cleanup code a bit
|
||||||
|
* YAP_Error changed.
|
||||||
|
*
|
||||||
* Revision 1.84 2005/03/02 18:35:46 vsc
|
* Revision 1.84 2005/03/02 18:35:46 vsc
|
||||||
* try to make initialisation process more robust
|
* try to make initialisation process more robust
|
||||||
* try to make name more robust (in case Lookup new atom fails)
|
* try to make name more robust (in case Lookup new atom fails)
|
||||||
@ -501,7 +505,7 @@ showprofres(UInt type) {
|
|||||||
if (InUnify>0) printf("%p sys: Unify -> %lu (%3.1f%c)\n",(void *) UnifyMode,(unsigned long int)InUnify,(float) InUnify*100/ProfCalls,'%');
|
if (InUnify>0) printf("%p sys: Unify -> %lu (%3.1f%c)\n",(void *) UnifyMode,(unsigned long int)InUnify,(float) InUnify*100/ProfCalls,'%');
|
||||||
if (InCCall>0) printf("%p sys: C Code -> %lu (%3.1f%c)\n",(void *) CCallMode,(unsigned long int)InCCall,(float) InCCall*100/ProfCalls,'%');
|
if (InCCall>0) printf("%p sys: C Code -> %lu (%3.1f%c)\n",(void *) CCallMode,(unsigned long int)InCCall,(float) InCCall*100/ProfCalls,'%');
|
||||||
if (count>0) printf("Unknown:Unknown -> %lu (%3.1f%c)\n",(unsigned long int)count,(float) count*100/ProfCalls,'%');
|
if (count>0) printf("Unknown:Unknown -> %lu (%3.1f%c)\n",(unsigned long int)count,(float) count*100/ProfCalls,'%');
|
||||||
printf("Total of Calls=%u \n",ProfCalls);
|
printf("Total of Calls=%lu \n",(unsigned long int)ProfCalls);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2219,6 +2219,12 @@ p_host_type(void) {
|
|||||||
return(Yap_unify(out,ARG1));
|
return(Yap_unify(out,ARG1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Int
|
||||||
|
p_yap_home(void) {
|
||||||
|
Term out = MkAtomTerm(Yap_LookupAtom(YAP_HOME_DIR));
|
||||||
|
return(Yap_unify(out,ARG1));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is responsable for the initialization of all machine dependant
|
* This is responsable for the initialization of all machine dependant
|
||||||
* predicates
|
* predicates
|
||||||
@ -2391,6 +2397,7 @@ Yap_InitSysPreds(void)
|
|||||||
Yap_InitCPred ("$system", 1, p_system, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
Yap_InitCPred ("$system", 1, p_system, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||||
Yap_InitCPred ("$rename", 2, p_mv, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
Yap_InitCPred ("$rename", 2, p_mv, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||||
Yap_InitCPred ("$cd", 1, p_cd, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
Yap_InitCPred ("$cd", 1, p_cd, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||||
|
Yap_InitCPred ("$yap_home", 1, p_yap_home, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||||
Yap_InitCPred ("$getcwd", 1, p_getcwd, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
Yap_InitCPred ("$getcwd", 1, p_getcwd, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||||
Yap_InitCPred ("$dir_separator", 1, p_dir_sp, SafePredFlag|HiddenPredFlag);
|
Yap_InitCPred ("$dir_separator", 1, p_dir_sp, SafePredFlag|HiddenPredFlag);
|
||||||
Yap_InitCPred ("$alarm", 2, p_alarm, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
Yap_InitCPred ("$alarm", 2, p_alarm, SafePredFlag|SyncPredFlag|HiddenPredFlag);
|
||||||
|
10
C/threads.c
10
C/threads.c
@ -201,7 +201,7 @@ p_thread_self(void)
|
|||||||
return Yap_unify(MkIntegerTerm(worker_id), ARG1);
|
return Yap_unify(MkIntegerTerm(worker_id), ARG1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
Int
|
||||||
Yap_thread_self(void)
|
Yap_thread_self(void)
|
||||||
{
|
{
|
||||||
if (pthread_getspecific(Yap_yaamregs_key) == NULL)
|
if (pthread_getspecific(Yap_yaamregs_key) == NULL)
|
||||||
@ -209,7 +209,7 @@ Yap_thread_self(void)
|
|||||||
return worker_id;
|
return worker_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
CELL
|
||||||
Yap_thread_create_engine(thread_attr *ops)
|
Yap_thread_create_engine(thread_attr *ops)
|
||||||
{
|
{
|
||||||
int new_id = allocate_new_tid();
|
int new_id = allocate_new_tid();
|
||||||
@ -225,7 +225,7 @@ Yap_thread_create_engine(thread_attr *ops)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
Int
|
||||||
Yap_thread_attach_engine(int wid)
|
Yap_thread_attach_engine(int wid)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
|
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
|
||||||
@ -241,7 +241,7 @@ Yap_thread_attach_engine(int wid)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
Int
|
||||||
Yap_thread_detach_engine(int wid)
|
Yap_thread_detach_engine(int wid)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
|
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
|
||||||
@ -252,7 +252,7 @@ Yap_thread_detach_engine(int wid)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
Int
|
||||||
Yap_thread_destroy_engine(int wid)
|
Yap_thread_destroy_engine(int wid)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
|
pthread_mutex_lock(&(ThreadHandle[wid].tlock));
|
||||||
|
@ -1579,7 +1579,7 @@ static int subsumes_complex(register CELL *pt0, register CELL *pt0_end, register
|
|||||||
{
|
{
|
||||||
register CELL **to_visit = (CELL **)ASP;
|
register CELL **to_visit = (CELL **)ASP;
|
||||||
tr_fr_ptr OLDTR = TR, new_tr;
|
tr_fr_ptr OLDTR = TR, new_tr;
|
||||||
int write_mode = TRUE;
|
UInt write_mode = TRUE;
|
||||||
|
|
||||||
|
|
||||||
HBREG = H;
|
HBREG = H;
|
||||||
|
@ -7,7 +7,7 @@ typedef struct{
|
|||||||
Int STD_PROTO(Yap_thread_self,(void));
|
Int STD_PROTO(Yap_thread_self,(void));
|
||||||
int STD_PROTO(Yap_get_thread_ref_count,(int));
|
int STD_PROTO(Yap_get_thread_ref_count,(int));
|
||||||
void STD_PROTO(Yap_set_thread_ref_count,(int,int));
|
void STD_PROTO(Yap_set_thread_ref_count,(int,int));
|
||||||
Int STD_PROTO(Yap_thread_create_engine,(thread_attr *));
|
CELL STD_PROTO(Yap_thread_create_engine,(thread_attr *));
|
||||||
Int STD_PROTO(Yap_thread_attach_engine,(int));
|
Int STD_PROTO(Yap_thread_attach_engine,(int));
|
||||||
Int STD_PROTO(Yap_thread_detach_engine,(int));
|
Int STD_PROTO(Yap_thread_detach_engine,(int));
|
||||||
Int STD_PROTO(Yap_thread_destroy_engine,(int));
|
Int STD_PROTO(Yap_thread_destroy_engine,(int));
|
||||||
|
@ -23,7 +23,7 @@ INSTALL_DATA=@INSTALL_DATA@
|
|||||||
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
||||||
srcdir=@srcdir@
|
srcdir=@srcdir@
|
||||||
|
|
||||||
PROGRAMS= $(srcdir)/jpl.yap
|
PROGRAMS= $(srcdir)/jpl.yap jpl_paths.yap
|
||||||
|
|
||||||
install: $(PROGRAMS)
|
install: $(PROGRAMS)
|
||||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
|
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: jpl.yap,v 1.1 2004-08-27 20:27:56 vsc Exp $
|
/* $Id: jpl.yap,v 1.2 2005-03-13 06:26:12 vsc Exp $
|
||||||
|
|
||||||
Part of JPL -- SWI-Prolog/Java interface
|
Part of JPL -- SWI-Prolog/Java interface
|
||||||
|
|
||||||
@ -27,6 +27,9 @@
|
|||||||
by the GNU General Public License. This exception does not however
|
by the GNU General Public License. This exception does not however
|
||||||
invalidate any other reasons why the executable file might be covered by
|
invalidate any other reasons why the executable file might be covered by
|
||||||
the GNU General Public License.
|
the GNU General Public License.
|
||||||
|
|
||||||
|
Adapted to YAP by Vitor Santos Costa.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- module(jpl,
|
:- module(jpl,
|
||||||
@ -79,9 +82,10 @@
|
|||||||
:- use_module(library(swi)).
|
:- use_module(library(swi)).
|
||||||
|
|
||||||
% suppress debugging this library
|
% suppress debugging this library
|
||||||
:- set_prolog_flag(generate_debug_info, false).
|
%:- set_prolog_flag(generate_debug_info, false).
|
||||||
|
|
||||||
|
:- initialization(load_jpl_lib).
|
||||||
|
|
||||||
:- load_foreign_files([jpl], ['/opt/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so'], jpl_install).
|
|
||||||
%:- load_foreign_files([jpl], [], jpl_install).
|
%:- load_foreign_files([jpl], [], jpl_install).
|
||||||
|
|
||||||
%------------------------------------------------------------------------------
|
%------------------------------------------------------------------------------
|
||||||
@ -4080,7 +4084,8 @@ prolog:error_message(java_exception(Ex)) -->
|
|||||||
:- multifile user:file_search_path/2.
|
:- multifile user:file_search_path/2.
|
||||||
:- dynamic user:file_search_path/2.
|
:- dynamic user:file_search_path/2.
|
||||||
|
|
||||||
user:file_search_path(jar, swi(lib)).
|
user:(file_search_path(jar, Dir) :-
|
||||||
|
file_search_path(library, Dir)).
|
||||||
|
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
@ -4251,5 +4256,39 @@ report_java_setup_problem(E) :-
|
|||||||
print_message(error, E),
|
print_message(error, E),
|
||||||
check_java_environment.
|
check_java_environment.
|
||||||
|
|
||||||
|
:- include(jpl_paths).
|
||||||
|
|
||||||
|
load_jpl_lib :-
|
||||||
|
jpl_java_home(JavaHome),
|
||||||
|
fetch_arch(Arch),
|
||||||
|
gen_jvm_lib(JavaHome,Arch,JLib),
|
||||||
|
write(JLib),nl,
|
||||||
|
load_foreign_files([jpl], [JLib], jpl_install), !.
|
||||||
|
|
||||||
|
fetch_arch(Arch) :-
|
||||||
|
current_prolog_flag(host_type,Name),
|
||||||
|
atom_codes(Name,Codes),
|
||||||
|
gen_arch(Codes,Arch).
|
||||||
|
|
||||||
|
gen_arch([0'x,0'8,0'6,0'_,0'6,0'4|_],amd64).
|
||||||
|
gen_arch([0'i,_,0'8,0'6|_],i386). % take all versions of X86
|
||||||
|
gen_arch([0's,0'p,0'a,0'r,0'c|_],sparc).
|
||||||
|
|
||||||
|
gen_jvm_lib(JavaHome,Arch,JLib) :-
|
||||||
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/client/libjvm.so'],JLib),
|
||||||
|
exists(JLib), !.
|
||||||
|
gen_jvm_lib(JavaHome,Arch,JLib) :-
|
||||||
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/server/libjvm.so'],JLib),
|
||||||
|
exists(JLib), !.
|
||||||
|
gen_jvm_lib(JavaHome,Arch,JLib) :-
|
||||||
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/classic/libjvm.so'],JLib),
|
||||||
|
exists(JLib), !.
|
||||||
|
gen_jvm_lib(JavaHome,Arch,JLib) :-
|
||||||
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/libjvm.so'],JLib),
|
||||||
|
exists(JLib), !.
|
||||||
|
|
||||||
|
|
||||||
|
:- load_jpl_lib.
|
||||||
|
|
||||||
:- initialization
|
:- initialization
|
||||||
setup_jvm.
|
setup_jvm.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: jpl.c,v 1.1 2004-08-27 20:27:32 vsc Exp $
|
/* $Id: jpl.c,v 1.2 2005-03-13 06:26:12 vsc Exp $
|
||||||
|
|
||||||
Part of JPL -- SWI-Prolog/Java interface
|
Part of JPL -- SWI-Prolog/Java interface
|
||||||
|
|
||||||
@ -20,6 +20,8 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Ported to YAP by Vitor Santos Costa.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// this source file (jpl.c) combines my Prolog-calls-Java stuff (mostly prefixed 'JNI' or 'jni' here)
|
// this source file (jpl.c) combines my Prolog-calls-Java stuff (mostly prefixed 'JNI' or 'jni' here)
|
||||||
@ -754,18 +756,6 @@ jpl_c_lib_version(void)
|
|||||||
%T jpl_c_lib_version( -atom)
|
%T jpl_c_lib_version( -atom)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ...
|
|
||||||
//
|
|
||||||
static foreign_t
|
|
||||||
jpl_c_java_home(
|
|
||||||
term_t ta
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
return PL_unify_atom_chars(ta,JAVA_HOME);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
//
|
//
|
||||||
static foreign_t
|
static foreign_t
|
||||||
@ -3394,7 +3384,6 @@ PL_extension predspecs[] =
|
|||||||
{ "jni_func", 6, jni_func_4_plc, 0 },
|
{ "jni_func", 6, jni_func_4_plc, 0 },
|
||||||
{ "jpl_c_lib_version", 1, jpl_c_lib_version_1_plc, 0 },
|
{ "jpl_c_lib_version", 1, jpl_c_lib_version_1_plc, 0 },
|
||||||
{ "jpl_c_lib_version", 4, jpl_c_lib_version_4_plc, 0 },
|
{ "jpl_c_lib_version", 4, jpl_c_lib_version_4_plc, 0 },
|
||||||
{ "jpl_java_home", 1, jpl_c_java_home, 0 },
|
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ stdpreds.o: $(srcdir)/C/stdpreds.c
|
|||||||
$(CC) -c $(CFLAGS) $(srcdir)/C/stdpreds.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/C/stdpreds.c -o $@
|
||||||
|
|
||||||
sysbits.o: $(srcdir)/C/sysbits.c
|
sysbits.o: $(srcdir)/C/sysbits.c
|
||||||
$(CC) -c $(CFLAGS) -DLIB_DIR=\"$(YAPLIBDIR)\" -DSHARE_DIR=\"$(SHAREDIR)\" $(srcdir)/C/sysbits.c -o $@
|
$(CC) -c $(CFLAGS) -DYAP_HOME_DIR=\"$(ROOTDIR)\" -DLIB_DIR=\"$(YAPLIBDIR)\" -DSHARE_DIR=\"$(SHAREDIR)\" $(srcdir)/C/sysbits.c -o $@
|
||||||
|
|
||||||
threads.o: $(srcdir)/C/threads.c
|
threads.o: $(srcdir)/C/threads.c
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/C/threads.c -o $@
|
$(CC) -c $(CFLAGS) $(srcdir)/C/threads.c -o $@
|
||||||
@ -558,11 +558,11 @@ install_library: @YAPLIB@
|
|||||||
$(INSTALL_DATA) libYap.a $(DESTDIR)$(LIBDIR)/libYap.a
|
$(INSTALL_DATA) libYap.a $(DESTDIR)$(LIBDIR)/libYap.a
|
||||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||||
for h in $(HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done
|
for h in $(HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done
|
||||||
@ENABLE_JPL@ (cd LGPL/JPL/java; make install)
|
|
||||||
|
|
||||||
install_data:
|
install_data:
|
||||||
(cd library ; make install)
|
(cd library ; make install)
|
||||||
@ENABLE_JPL@ (cd LGPL/JPL ; make install)
|
@ENABLE_JPL@ (cd LGPL/JPL ; make install)
|
||||||
|
@ENABLE_JPL@ (cd LGPL/JPL/java; make install)
|
||||||
$(INSTALL_DATA) $(srcdir)/LGPL/pillow/icon_address.pl $(DESTDIR)$(SHAREDIR)/Yap/
|
$(INSTALL_DATA) $(srcdir)/LGPL/pillow/icon_address.pl $(DESTDIR)$(SHAREDIR)/Yap/
|
||||||
$(INSTALL_DATA) $(srcdir)/LGPL/pillow/pillow.pl $(DESTDIR)$(SHAREDIR)/Yap/
|
$(INSTALL_DATA) $(srcdir)/LGPL/pillow/pillow.pl $(DESTDIR)$(SHAREDIR)/Yap/
|
||||||
(cd CLPQR ; make install)
|
(cd CLPQR ; make install)
|
||||||
|
3
configure
vendored
3
configure
vendored
@ -13550,7 +13550,7 @@ mkdir -p LGPL/JPL/java/jpl
|
|||||||
mkdir -p LGPL/JPL/java/jpl/fli
|
mkdir -p LGPL/JPL/java/jpl/fli
|
||||||
mkdir -p LGPL/JPL/src
|
mkdir -p LGPL/JPL/src
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile CHR/Makefile CLPBN/Makefile CLPQR/Makefile library/Tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile"
|
ac_config_files="$ac_config_files Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile CHR/Makefile CLPBN/Makefile CLPQR/Makefile library/Tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile LGPL/JPL/jpl_paths.yap"
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
# tests run on this system so they can be shared between configure
|
# tests run on this system so they can be shared between configure
|
||||||
@ -14090,6 +14090,7 @@ do
|
|||||||
"LGPL/JPL/Makefile" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/Makefile" ;;
|
"LGPL/JPL/Makefile" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/Makefile" ;;
|
||||||
"LGPL/JPL/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/src/Makefile" ;;
|
"LGPL/JPL/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/src/Makefile" ;;
|
||||||
"LGPL/JPL/java/Makefile" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/java/Makefile" ;;
|
"LGPL/JPL/java/Makefile" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/java/Makefile" ;;
|
||||||
|
"LGPL/JPL/jpl_paths.yap" ) CONFIG_FILES="$CONFIG_FILES LGPL/JPL/jpl_paths.yap" ;;
|
||||||
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
|
||||||
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
|
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
|
||||||
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
||||||
|
@ -1092,7 +1092,7 @@ mkdir -p LGPL/JPL/java/jpl
|
|||||||
mkdir -p LGPL/JPL/java/jpl/fli
|
mkdir -p LGPL/JPL/java/jpl/fli
|
||||||
mkdir -p LGPL/JPL/src
|
mkdir -p LGPL/JPL/src
|
||||||
|
|
||||||
AC_OUTPUT(Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile CHR/Makefile CLPBN/Makefile CLPQR/Makefile library/Tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile)
|
AC_OUTPUT(Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile CHR/Makefile CLPBN/Makefile CLPQR/Makefile library/Tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile LGPL/JPL/jpl_paths.yap)
|
||||||
|
|
||||||
make depend
|
make depend
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ extern X_API YAP_Module PROTO(YAP_CreateModule,(YAP_Atom));
|
|||||||
|
|
||||||
/* thread stuff */
|
/* thread stuff */
|
||||||
extern X_API int PROTO(YAP_ThreadSelf,(void));
|
extern X_API int PROTO(YAP_ThreadSelf,(void));
|
||||||
extern X_API int PROTO(YAP_ThreadCreateEngine,(YAP_thread_attr *));
|
extern X_API YAP_CELL PROTO(YAP_ThreadCreateEngine,(YAP_thread_attr *));
|
||||||
extern X_API int PROTO(YAP_ThreadAttachEngine,(int));
|
extern X_API int PROTO(YAP_ThreadAttachEngine,(int));
|
||||||
extern X_API int PROTO(YAP_ThreadDetachEngine,(int));
|
extern X_API int PROTO(YAP_ThreadDetachEngine,(int));
|
||||||
extern X_API int PROTO(YAP_ThreadDestroyEngine,(int));
|
extern X_API int PROTO(YAP_ThreadDestroyEngine,(int));
|
||||||
|
@ -6,7 +6,40 @@
|
|||||||
nth1/3,
|
nth1/3,
|
||||||
forall/2,
|
forall/2,
|
||||||
between/3,
|
between/3,
|
||||||
concat_atom/2]).
|
concat_atom/2,
|
||||||
|
volatile/1]).
|
||||||
|
|
||||||
|
|
||||||
|
:- multifile user:file_search_path/2.
|
||||||
|
|
||||||
|
:- dynamic user:file_search_path/2.
|
||||||
|
|
||||||
|
user:file_search_path(swi, Home) :-
|
||||||
|
current_prolog_flag(home, Home).
|
||||||
|
user:file_search_path(foreign, swi(ArchLib)) :-
|
||||||
|
current_prolog_flag(arch, Arch),
|
||||||
|
atom_concat('lib/', Arch, ArchLib).
|
||||||
|
user:file_search_path(foreign, swi(lib)).
|
||||||
|
|
||||||
|
%
|
||||||
|
% maybe a good idea to eventually support this in YAP.
|
||||||
|
% but for now just ignore it.
|
||||||
|
%
|
||||||
|
:- meta_predicate volatile(:).
|
||||||
|
|
||||||
|
:- op(1150, fx, 'volatile').
|
||||||
|
|
||||||
|
volatile(P) :- var(P),
|
||||||
|
throw(error(instantiation_error,volatile(P))).
|
||||||
|
volatile(M:P) :-
|
||||||
|
do_volatile(P,M).
|
||||||
|
volatile((G1,G2)) :-
|
||||||
|
volatile(G1),
|
||||||
|
volatile(G2).
|
||||||
|
volatile(P) :-
|
||||||
|
do_volatile(P,_).
|
||||||
|
|
||||||
|
do_volatile(_,_).
|
||||||
|
|
||||||
:- meta_predicate forall(+,:).
|
:- meta_predicate forall(+,:).
|
||||||
|
|
||||||
|
14
pl/boot.yap
14
pl/boot.yap
@ -950,8 +950,8 @@ break :-
|
|||||||
S =.. [Name,File], !,
|
S =.. [Name,File], !,
|
||||||
'$dir_separator'(D),
|
'$dir_separator'(D),
|
||||||
atom_codes(A,[D]),
|
atom_codes(A,[D]),
|
||||||
( user:file_search_path(Name, Dir), '$do_not_creep' ; '$do_not_creep'),
|
( user:file_search_path(Name, Dir), '$do_not_creep' ; '$do_not_creep', fail),
|
||||||
atom_concat([Dir,A,File],NFile),
|
'$extend_path'(Dir,A,File,NFile),
|
||||||
'$search_in_path'(NFile, NewFile).
|
'$search_in_path'(NFile, NewFile).
|
||||||
'$find_in_path'(File,NewFile,_) :- atom(File), !,
|
'$find_in_path'(File,NewFile,_) :- atom(File), !,
|
||||||
'$search_in_path'(File,NewFile),!.
|
'$search_in_path'(File,NewFile),!.
|
||||||
@ -965,6 +965,16 @@ break :-
|
|||||||
atom_concat([Path,File],New),
|
atom_concat([Path,File],New),
|
||||||
'$exists'(New,'$csult').
|
'$exists'(New,'$csult').
|
||||||
|
|
||||||
|
'$extend_path'(Dir,A,File,NFile) :-
|
||||||
|
atom(Dir), !,
|
||||||
|
atom_concat([Dir,A,File],NFile).
|
||||||
|
'$extend_path'(Name,A,File,NFile) :-
|
||||||
|
nonvar(Name),
|
||||||
|
Name =.. [Dir1,Dir2],
|
||||||
|
( user:file_search_path(Dir1, Dir), '$do_not_creep' ; '$do_not_creep', fail),
|
||||||
|
'$extend_path'(Dir2,A,File,EFile),
|
||||||
|
atom_concat([Dir,A,EFile],NFile).
|
||||||
|
|
||||||
% term expansion
|
% term expansion
|
||||||
%
|
%
|
||||||
% return two arguments: Expanded0 is the term after "USER" expansion.
|
% return two arguments: Expanded0 is the term after "USER" expansion.
|
||||||
|
@ -194,9 +194,6 @@ yap_flag(dollar_as_lower_case,on) :- !,
|
|||||||
yap_flag(dollar_as_lower_case,off) :-
|
yap_flag(dollar_as_lower_case,off) :-
|
||||||
'$change_type_of_char'(36,7).
|
'$change_type_of_char'(36,7).
|
||||||
|
|
||||||
yap_flag(profiling,X) :- (var(X); X = on; X = off), !,
|
|
||||||
'$is_profiled'(X).
|
|
||||||
|
|
||||||
yap_flag(call_counting,X) :- (var(X); X = on; X = off), !,
|
yap_flag(call_counting,X) :- (var(X); X = on; X = off), !,
|
||||||
'$is_call_counted'(X).
|
'$is_call_counted'(X).
|
||||||
|
|
||||||
@ -220,6 +217,9 @@ yap_flag(index,X) :-
|
|||||||
yap_flag(index,X) :-
|
yap_flag(index,X) :-
|
||||||
'$do_error'(domain_error(flag_value,index+X),yap_flag(index,X)).
|
'$do_error'(domain_error(flag_value,index+X),yap_flag(index,X)).
|
||||||
|
|
||||||
|
yap_flag(home,X) :-
|
||||||
|
'$yap_home'(X).
|
||||||
|
|
||||||
% should match definitions in Yap.h.m4
|
% should match definitions in Yap.h.m4
|
||||||
'$transl_to_index_mode'(0, off).
|
'$transl_to_index_mode'(0, off).
|
||||||
'$transl_to_index_mode'(1, single).
|
'$transl_to_index_mode'(1, single).
|
||||||
@ -323,6 +323,9 @@ yap_flag(n_of_integer_keys_in_bb,X) :- integer(X), X > 0, !,
|
|||||||
yap_flag(n_of_integer_keys_in_bb,X) :-
|
yap_flag(n_of_integer_keys_in_bb,X) :-
|
||||||
'$do_error'(domain_error(flag_value,n_of_integer_keys_in_bb+X),yap_flag(n_of_integer_keys_in_bb,X)).
|
'$do_error'(domain_error(flag_value,n_of_integer_keys_in_bb+X),yap_flag(n_of_integer_keys_in_bb,X)).
|
||||||
|
|
||||||
|
yap_flag(profiling,X) :- (var(X); X = on; X = off), !,
|
||||||
|
'$is_profiled'(X).
|
||||||
|
|
||||||
yap_flag(strict_iso,OUT) :-
|
yap_flag(strict_iso,OUT) :-
|
||||||
var(OUT), !,
|
var(OUT), !,
|
||||||
'$access_yap_flags'(9,X),
|
'$access_yap_flags'(9,X),
|
||||||
@ -585,6 +588,7 @@ yap_flag(host_type,X) :-
|
|||||||
V = gc_margin ;
|
V = gc_margin ;
|
||||||
V = gc_trace ;
|
V = gc_trace ;
|
||||||
% V = hide ;
|
% V = hide ;
|
||||||
|
V = home ;
|
||||||
V = host_type ;
|
V = host_type ;
|
||||||
V = index ;
|
V = index ;
|
||||||
V = informational_messages ;
|
V = informational_messages ;
|
||||||
|
Reference in New Issue
Block a user