Merge branch 'master' of ssh://ssh.dcc.fc.up.pt:31064/home/vsc/yap
This commit is contained in:
commit
71940dec67
21
C/terms.c
21
C/terms.c
@ -1380,9 +1380,10 @@ static Int t_ref(cl_connector *d, cl_connector * q, int max) {
|
|||||||
|
|
||||||
static Int create_entry(Term t, Int i, Int j, cl_connector * q, Int max) {
|
static Int create_entry(Term t, Int i, Int j, cl_connector * q, Int max) {
|
||||||
Term ref, h, *s, *ostart;
|
Term ref, h, *s, *ostart;
|
||||||
bool pair = false;
|
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
// first time, create a new term
|
// first time, create a new term
|
||||||
|
if (i==0)
|
||||||
|
return 0;
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1393,7 +1394,6 @@ static Int create_entry(Term t, Int i, Int j, cl_connector * q, Int max) {
|
|||||||
return t_ref((cl_connector*)AtomOfTerm(h),q,max);
|
return t_ref((cl_connector*)AtomOfTerm(h),q,max);
|
||||||
}
|
}
|
||||||
n = 2;
|
n = 2;
|
||||||
pair = true;
|
|
||||||
ostart = HR;
|
ostart = HR;
|
||||||
ref = AbsPair(ostart);
|
ref = AbsPair(ostart);
|
||||||
HR += 2;
|
HR += 2;
|
||||||
@ -1439,12 +1439,19 @@ Int cp_link(Term t, Int i, Int j, cl_connector * q, Int max, CELL * tailp) {
|
|||||||
Term ref = Deref(q[me].reference);
|
Term ref = Deref(q[me].reference);
|
||||||
if (IsVarTerm(ref)) {
|
if (IsVarTerm(ref)) {
|
||||||
q[i].copy[j] = ref;
|
q[i].copy[j] = ref;
|
||||||
} else {
|
} else if (i == 0){
|
||||||
q[i].copy[j] =
|
Term p = TermNil;
|
||||||
q[me].parent[0] =
|
Term v = UNFOLD_LOOP(ref,&p);
|
||||||
UNFOLD_LOOP(ref, tailp);
|
q[i].reference = HeadOfTerm(p);
|
||||||
|
q[i].copy[j] = v;
|
||||||
}
|
}
|
||||||
return max;
|
else if (tailp && q[me].parent) {
|
||||||
|
Term v = UNFOLD_LOOP(ref, tailp);
|
||||||
|
q[i].copy[j] = v;
|
||||||
|
q[me].parent[0] = v;
|
||||||
|
q[i].reference = v;
|
||||||
|
}
|
||||||
|
return max;
|
||||||
}
|
}
|
||||||
q[i].copy[j] = t;
|
q[i].copy[j] = t;
|
||||||
return me;
|
return me;
|
||||||
|
63
pl/boot.yap
63
pl/boot.yap
@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
% be careful here not to generate an undefined exception..
|
|
||||||
|
|
||||||
print_message(informational,_) :-
|
print_message(informational,_) :-
|
||||||
yap_flag(verbose, silent),
|
yap_flag(verbose, silent),
|
||||||
!.
|
!.
|
||||||
@ -40,15 +38,15 @@ print_message(informational,E) :-
|
|||||||
% boot:print_message( Type, Error )
|
% boot:print_message( Type, Error )
|
||||||
%
|
%
|
||||||
print_message(Type,error(error(_,_),exception(Desc))) :-
|
print_message(Type,error(error(_,_),exception(Desc))) :-
|
||||||
!,
|
!,
|
||||||
'$print_exception'(Desc).
|
'$print_exception'(Desc).
|
||||||
print_message(Type,error(warning(_,_),exception(Desc))) :-
|
print_message(Type,error(warning(_,_),exception(Desc))) :-
|
||||||
!,
|
!,
|
||||||
'$print_exception'(Desc),
|
'$print_exception'(Desc).
|
||||||
!.
|
|
||||||
print_message(Type,Error) :-
|
print_message(Type,Error) :-
|
||||||
format( user_error, '~w while bootstraping: event is ~q~n',[Type,Error]).
|
format( user_error, '~w while bootstraping: event is ~q~n',[Type,Error]).
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pred system_module( _Mod_, _ListOfPublicPredicates, ListOfPrivatePredicates *
|
* @pred system_module( _Mod_, _ListOfPublicPredicates, ListOfPrivatePredicates *
|
||||||
* Define a system module _Mod_. _ListOfPublicPredicates_ . Currentlt, all
|
* Define a system module _Mod_. _ListOfPublicPredicates_ . Currentlt, all
|
||||||
@ -83,25 +81,25 @@ private(_).
|
|||||||
%
|
%
|
||||||
% boootstrap predicates.
|
% boootstrap predicates.
|
||||||
%
|
%
|
||||||
:- system_module( '$_boot',
|
:- system_module( '$_boot', [
|
||||||
[
|
!/0,
|
||||||
!/0,
|
':-'/1,
|
||||||
':-'/1,
|
'?-'/1,
|
||||||
'?-'/1,
|
[]/0,
|
||||||
[]/0,
|
bootstrap/1,
|
||||||
bootstrap/1,
|
call/1,
|
||||||
call/1,
|
catch/3,
|
||||||
catch/3,
|
catch_ball/2,
|
||||||
catch_ball/2,
|
expand_term/2,
|
||||||
expand_term/2,
|
print_message/2,
|
||||||
print_message/2,
|
import_system_module/2,
|
||||||
import_system_module/2,
|
system_module/2,
|
||||||
system_module/2,
|
private/1,
|
||||||
private/1,
|
incore/1,
|
||||||
incore/1,
|
(not)/1,
|
||||||
(not)/1,
|
repeat/0,
|
||||||
repeat/0,
|
throw/1,
|
||||||
throw/1,
|
true/0,
|
||||||
extensions_to_present_answer/1,
|
extensions_to_present_answer/1,
|
||||||
fail/0,
|
fail/0,
|
||||||
false/0,
|
false/0,
|
||||||
@ -109,16 +107,16 @@ private(_).
|
|||||||
goal_expansion/3,
|
goal_expansion/3,
|
||||||
otherwise/0,
|
otherwise/0,
|
||||||
term_expansion/2,
|
term_expansion/2,
|
||||||
version/2,
|
version/2],
|
||||||
true/0],
|
[
|
||||||
[
|
|
||||||
'$do_log_upd_clause'/6,
|
'$do_log_upd_clause'/6,
|
||||||
'$do_log_upd_clause0'/6,
|
'$do_log_upd_clause0'/6,
|
||||||
'$do_log_upd_clause_erase'/6,
|
'$do_log_upd_clause_erase'/6,
|
||||||
'$do_static_clause'/5,
|
'$do_static_clause'/5,
|
||||||
'$system_module'/1]).
|
'$system_module'/1]).
|
||||||
|
|
||||||
:- use_system_module( '$_boot', ['$cut_by'/1]).
|
|
||||||
|
% be careful here not to generate an undefined exception..
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -136,6 +134,13 @@ print_boot_message(Type,Error,Desc) :-
|
|||||||
'$query_exception'(errorLine, Desc, FilePos),
|
'$query_exception'(errorLine, Desc, FilePos),
|
||||||
format(user_error,'~a:~d: ~a: ~q~n', [File,FilePos,Type,Error]).
|
format(user_error,'~a:~d: ~a: ~q~n', [File,FilePos,Type,Error]).
|
||||||
|
|
||||||
|
'$undefp0'([M|G], _Action) :-
|
||||||
|
functor(G,N,A),
|
||||||
|
print_message( error, error(error(unknown, M:N/A),M:G)),
|
||||||
|
fail.
|
||||||
|
|
||||||
|
:- '$undefp_handler'('$undefp0'(_,_),prolog).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pred $system_meta_predicates'( +L )
|
* @pred $system_meta_predicates'( +L )
|
||||||
*
|
*
|
||||||
|
@ -1450,9 +1450,7 @@ environment. Use initialization/2 for more flexible behavior.
|
|||||||
'$initialization_queue'(G) :-
|
'$initialization_queue'(G) :-
|
||||||
b_getval('$lf_status', TOpts),
|
b_getval('$lf_status', TOpts),
|
||||||
'$lf_opt'( initialization, TOpts, Ref),
|
'$lf_opt'( initialization, TOpts, Ref),
|
||||||
writeln(G),
|
|
||||||
nb:nb_queue_enqueue(Ref, G),
|
nb:nb_queue_enqueue(Ref, G),
|
||||||
writeln(Ref),
|
|
||||||
fail.
|
fail.
|
||||||
'$initialization_queue'(_).
|
'$initialization_queue'(_).
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
/*
|
/*
|
||||||
% grounds all free variables
|
% grounds all free variables
|
||||||
% as terms of the form '$VAR'(N)
|
% as terms of the form '$VAR'(N)
|
||||||
*/
|
|
||||||
_numbervars(Term, M, N) :-
|
_numbervars(Term, M, N) :-
|
||||||
'$variables_in_term'(Term, [], L),
|
'$variables_in_term'(Term, [], L),
|
||||||
'$numbermarked_vars'(L, M, N).
|
'$numbermarked_vars'(L, M, N).
|
||||||
|
@ -97,7 +97,6 @@
|
|||||||
set_prolog_flag(debug, false),
|
set_prolog_flag(debug, false),
|
||||||
% simple trick to find out if this is we are booting from Prolog.
|
% simple trick to find out if this is we are booting from Prolog.
|
||||||
% boot from a saved state
|
% boot from a saved state
|
||||||
writeln(ok),
|
|
||||||
'$init_from_saved_state_and_args', %start_low_level_trace,
|
'$init_from_saved_state_and_args', %start_low_level_trace,
|
||||||
|
|
||||||
'$db_clean_queues'(_),
|
'$db_clean_queues'(_),
|
||||||
|
@ -878,7 +878,7 @@ gated_call(Setup, Goal, Catcher, Cleanup) :-
|
|||||||
|
|
||||||
'$expand_clause'(InputCl, C1, CO) :-
|
'$expand_clause'(InputCl, C1, CO) :-
|
||||||
'$yap_strip_clause'(InputCl, M, ICl),
|
'$yap_strip_clause'(InputCl, M, ICl),
|
||||||
'$expand_a_clause'( M:ICl, SM, C1, CO),
|
'$expand_a_clause'( M:ICl, M, C1, CO),
|
||||||
!.
|
!.
|
||||||
'$expand_clause'(Cl, Cl, Cl).
|
'$expand_clause'(Cl, Cl, Cl).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user