fixes
This commit is contained in:
parent
c4b78e161b
commit
76b4ddee9c
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;
|
||||||
|
54
pl/boot.yap
54
pl/boot.yap
@ -28,6 +28,25 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
print_message(informational,_) :-
|
||||||
|
yap_flag(verbose, silent),
|
||||||
|
!.
|
||||||
|
print_message(informational,E) :-
|
||||||
|
format('informational message ~q.~n',[E]),
|
||||||
|
!.
|
||||||
|
%%
|
||||||
|
% boot:print_message( Type, Error )
|
||||||
|
%
|
||||||
|
print_message(Type,error(error(_,_),exception(Desc))) :-
|
||||||
|
!,
|
||||||
|
'$print_exception'(Desc).
|
||||||
|
print_message(Type,error(warning(_,_),exception(Desc))) :-
|
||||||
|
!,
|
||||||
|
'$print_exception'(Desc).
|
||||||
|
print_message(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
|
||||||
@ -63,6 +82,10 @@ private(_).
|
|||||||
% boootstrap predicates.
|
% boootstrap predicates.
|
||||||
%
|
%
|
||||||
:- system_module( '$_boot', [
|
:- system_module( '$_boot', [
|
||||||
|
!/0,
|
||||||
|
':-'/1,
|
||||||
|
'?-'/1,
|
||||||
|
[]/0,
|
||||||
bootstrap/1,
|
bootstrap/1,
|
||||||
call/1,
|
call/1,
|
||||||
catch/3,
|
catch/3,
|
||||||
@ -76,12 +99,7 @@ private(_).
|
|||||||
(not)/1,
|
(not)/1,
|
||||||
repeat/0,
|
repeat/0,
|
||||||
throw/1,
|
throw/1,
|
||||||
true/0]).
|
true/0,
|
||||||
|
|
||||||
:- system_module( '$_init', [!/0,
|
|
||||||
':-'/1,
|
|
||||||
'?-'/1,
|
|
||||||
[]/0,
|
|
||||||
extensions_to_present_answer/1,
|
extensions_to_present_answer/1,
|
||||||
fail/0,
|
fail/0,
|
||||||
false/0,
|
false/0,
|
||||||
@ -94,34 +112,12 @@ private(_).
|
|||||||
'$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..
|
% be careful here not to generate an undefined exception..
|
||||||
|
|
||||||
print_message(informational,_) :-
|
|
||||||
yap_flag(verbose, silent),
|
|
||||||
!.
|
|
||||||
print_message(informational,E) :-
|
|
||||||
format('informational message ~q.~n',[E]),
|
|
||||||
!.
|
|
||||||
%%
|
|
||||||
% boot:print_message( Type, Error )
|
|
||||||
%
|
|
||||||
print_message(Type,error(_,exception(Desc))) :-
|
|
||||||
'$get_exception'(Desc),
|
|
||||||
print_boot_message(Type,Error,Desc),
|
|
||||||
'$print_exception'(Desc),
|
|
||||||
print_message(Type,warning(_,exception(Desc))) :-
|
|
||||||
'$get_exception'(Desc),
|
|
||||||
print_boot_message(Type,Error,Desc),
|
|
||||||
'$print_exception'(Desc),
|
|
||||||
!.
|
|
||||||
print_message(Type,Error) :-
|
|
||||||
format( user_error, '~w while bootstraping: event is ~q~n',[Type,Error]).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print_boot_message(Type,Error,Desc) :-
|
print_boot_message(Type,Error,Desc) :-
|
||||||
|
@ -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