Merge ../yap-6.2

This commit is contained in:
Vitor Santos Costa 2010-11-28 11:53:16 +00:00
commit d1a05d2fb4
5 changed files with 52 additions and 41 deletions

View File

@ -1034,11 +1034,6 @@ init_stack(int arity, CELL *pt, int top, choiceptr saved_b)
}
B = (choiceptr)ASP;
B--;
#ifdef TABLING
if (top && GLOBAL_root_dep_fr) {
DepFr_cons_cp(GLOBAL_root_dep_fr) = B;
}
#endif /* TABLING */
B->cp_h = H;
B->cp_tr = TR;
B->cp_cp = CP;

View File

@ -239,6 +239,9 @@ void make_root_frames(void) {
/* root dependency frame */
if (!GLOBAL_root_dep_fr) {
new_dependency_frame(GLOBAL_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
#ifdef TABLING
DepFr_cons_cp(GLOBAL_root_dep_fr) = B;
#endif /* TABLING */
}
#endif /* TABLING */
}

View File

@ -6,7 +6,6 @@
:- module(system, [concat_atom/2,
concat_atom/3,
setenv/2,
prolog_to_os_filename/2,
is_absolute_file_name/1,
read_clause/1,
string/1,
@ -224,7 +223,6 @@ goal_expansion(rename_file(A,B),system:swi_rename_file(A,B)) :- swi_io.
goal_expansion(is_absolute_file_name(A), is_absolute_file_name(A)) :- swi_io.
goal_expansion(file_base_name(A,B),system:swi_file_base_name(A,B)) :- swi_io.
goal_expansion(file_directory_name(A,B),system:swi_file_directory_name(A,B)) :- swi_io.
goal_expansion(prolog_to_os_filename(A,B),system:swi_prolog_to_os_filename(A,B)) :- swi_io.
goal_expansion('$mark_executable'(A), system:'swi_is_absolute_file_name'(A)) :- swi_io.
goal_expansion('$absolute_file_name'(A,B),system:'swi_$absolute_file_name'(A,B)) :- swi_io.
@ -281,8 +279,6 @@ concat_atom(List, New) :-
setenv(X,Y) :- unix(putenv(X,Y)).
prolog_to_os_filename(X,X).
is_absolute_file_name(X) :-
absolute_file_name(X,X).

View File

@ -1129,7 +1129,7 @@ X_API int PL_cons_functor(term_t d, functor_t f,...)
{
va_list ap;
int arity, i;
Term *tmp = (Term *)SWI_buffers[0];
Term *tmp, t;
Functor ff = SWIFunctorToFunctor(f);
if (IsAtomTerm((Term)ff)) {
@ -1137,46 +1137,55 @@ X_API int PL_cons_functor(term_t d, functor_t f,...)
return TRUE;
}
arity = ArityOfFunctor(ff);
if (arity > SWI_TMP_BUF_SIZE/sizeof(YAP_CELL)) {
fprintf(stderr,"PL_cons_functor: arity too large (%d)\n", arity);
return FALSE;
while (Unsigned(H+arity) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
return FALSE;
}
}
if (arity == 2 && ff == FunctorDot) {
t = Yap_MkNewPairTerm();
tmp = RepPair(t);
} else {
t = Yap_MkNewApplTerm(ff, arity);
tmp = RepAppl(t)+1;
}
va_start (ap, f);
for (i = 0; i < arity; i++) {
tmp[i] = Yap_GetFromSlot(va_arg(ap, term_t));
Yap_unify(tmp[i],Yap_GetFromSlot(va_arg(ap, term_t)));
}
va_end (ap);
if (arity == 2 && ff == FunctorDot)
Yap_PutInSlot(d,MkPairTerm(tmp[0],tmp[1]));
else
Yap_PutInSlot(d,Yap_MkApplTerm(ff,arity,tmp));
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
return FALSE;
}
}
Yap_PutInSlot(d,t);
return TRUE;
}
X_API int PL_cons_functor_v(term_t d, functor_t f,term_t a0)
X_API int PL_cons_functor_v(term_t d, functor_t f, term_t a0)
{
int arity;
int arity, i;
Term *tmp, t;
Functor ff = SWIFunctorToFunctor(f);
if (IsAtomTerm((Term)ff)) {
Yap_PutInSlot(d,(Term)ff);
Yap_PutInSlot(d, (YAP_Term)f);
return TRUE;
}
arity = ArityOfFunctor(ff);
if (arity == 2 && ff == FunctorDot)
Yap_PutInSlot(d,MkPairTerm(Yap_GetFromSlot(a0),Yap_GetFromSlot(a0+1)));
else
Yap_PutInSlot(d,Yap_MkApplTerm(ff,arity,Yap_AddressFromSlot(a0)));
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
while (Unsigned(H+arity) > Unsigned(ASP)-CreepFlag) {
if (!Yap_gc(0, ENV, CP)) {
return FALSE;
}
}
if (arity == 2 && ff == FunctorDot) {
t = Yap_MkNewPairTerm();
tmp = RepPair(t);
} else {
t = Yap_MkNewApplTerm(ff, arity);
tmp = RepAppl(t)+1;
}
for (i = 0; i < arity; i++) {
Yap_unify(tmp[i],Yap_GetFromSlot(a0));
a0++;
}
Yap_PutInSlot(d,t);
return TRUE;
}

View File

@ -127,6 +127,10 @@
(rdf_meta)/1, % +Heads
op(1150, fx, (rdf_meta))
]).
:- expects_dialect(swi).
:- assert(system:swi_io).
:- use_module(library(rdf)).
:- use_module(library(lists)).
:- use_module(library(shlib)).
@ -153,6 +157,16 @@
:- discontiguous
term_expansion/2.
:- meta_predicate
rdf_transaction(0),
rdf_transaction(0, +),
rdf_monitor(1, +),
rdf_save(+, :),
rdf_load(+, :).
:- thread_local
named_anon/2. % +Resource, -Id
/** <module> Core RDF database
@see Documentation for semweb package
@ -1369,16 +1383,6 @@ rdf_reset_db :-
% file-url (=|file://path|=) or a stream wrapped
% in a term stream(Out).
:- meta_predicate
rdf_transaction(0),
rdf_transaction(0, +),
rdf_monitor(1, +),
rdf_save(+, :),
rdf_load(+, :).
:- thread_local
named_anon/2. % +Resource, -Id
rdf_save(File) :-
rdf_save2(File, []).
@ -2183,3 +2187,7 @@ into(_, _) --> []. % TBD
in_time(Triples, ParseTime) -->
[ ' in ~2f sec; ~D triples'-[ParseTime, Triples]
].
:- retract(system:swi_io).