diff --git a/C/terms.c b/C/terms.c index a255881e7..ace0d9a6e 100644 --- a/C/terms.c +++ b/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) { Term ref, h, *s, *ostart; - bool pair = false; ssize_t n; // first time, create a new term + if (i==0) + return 0; if (IsVarTerm(t)) { 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); } n = 2; - pair = true; ostart = HR; ref = AbsPair(ostart); 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); if (IsVarTerm(ref)) { q[i].copy[j] = ref; - } else { - q[i].copy[j] = - q[me].parent[0] = - UNFOLD_LOOP(ref, tailp); + } else if (i == 0){ + Term p = TermNil; + Term v = UNFOLD_LOOP(ref,&p); + 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; return me; diff --git a/pl/boot.yap b/pl/boot.yap index 5fac68177..89188051e 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -28,8 +28,6 @@ */ -% be careful here not to generate an undefined exception.. - print_message(informational,_) :- yap_flag(verbose, silent), !. @@ -40,15 +38,15 @@ print_message(informational,E) :- % boot:print_message( Type, Error ) % print_message(Type,error(error(_,_),exception(Desc))) :- - !, - '$print_exception'(Desc). + !, + '$print_exception'(Desc). print_message(Type,error(warning(_,_),exception(Desc))) :- !, - '$print_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 * * Define a system module _Mod_. _ListOfPublicPredicates_ . Currentlt, all @@ -83,25 +81,25 @@ private(_). % % boootstrap predicates. % -:- system_module( '$_boot', - [ - !/0, - ':-'/1, - '?-'/1, - []/0, - bootstrap/1, - call/1, - catch/3, - catch_ball/2, - expand_term/2, - print_message/2, - import_system_module/2, - system_module/2, - private/1, - incore/1, - (not)/1, - repeat/0, - throw/1, +:- system_module( '$_boot', [ + !/0, + ':-'/1, + '?-'/1, + []/0, + bootstrap/1, + call/1, + catch/3, + catch_ball/2, + expand_term/2, + print_message/2, + import_system_module/2, + system_module/2, + private/1, + incore/1, + (not)/1, + repeat/0, + throw/1, + true/0, extensions_to_present_answer/1, fail/0, false/0, @@ -109,16 +107,16 @@ private(_). goal_expansion/3, otherwise/0, term_expansion/2, - version/2, - true/0], - [ + version/2], + [ '$do_log_upd_clause'/6, '$do_log_upd_clause0'/6, '$do_log_upd_clause_erase'/6, '$do_static_clause'/5, '$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), 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 ) * diff --git a/pl/consult.yap b/pl/consult.yap index ef4654cbd..b629500a4 100644 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -1450,9 +1450,7 @@ environment. Use initialization/2 for more flexible behavior. '$initialization_queue'(G) :- b_getval('$lf_status', TOpts), '$lf_opt'( initialization, TOpts, Ref), - writeln(G), nb:nb_queue_enqueue(Ref, G), - writeln(Ref), fail. '$initialization_queue'(_). diff --git a/pl/ground.yap b/pl/ground.yap index e3df5c1d5..e50b00990 100644 --- a/pl/ground.yap +++ b/pl/ground.yap @@ -33,7 +33,6 @@ /* % grounds all free variables % as terms of the form '$VAR'(N) -*/ _numbervars(Term, M, N) :- '$variables_in_term'(Term, [], L), '$numbermarked_vars'(L, M, N). diff --git a/pl/init.yap b/pl/init.yap index d783a7dc7..e88f2a0b1 100644 --- a/pl/init.yap +++ b/pl/init.yap @@ -97,7 +97,6 @@ set_prolog_flag(debug, false), % simple trick to find out if this is we are booting from Prolog. % boot from a saved state - writeln(ok), '$init_from_saved_state_and_args', %start_low_level_trace, '$db_clean_queues'(_), diff --git a/pl/top.yap b/pl/top.yap index 01e2fe3aa..6d214897a 100644 --- a/pl/top.yap +++ b/pl/top.yap @@ -878,7 +878,7 @@ gated_call(Setup, Goal, Catcher, Cleanup) :- '$expand_clause'(InputCl, C1, CO) :- '$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).