From 101bdf0f6c787849f80e0d597d82c15cdea9ea96 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Wed, 11 Jul 2018 22:15:54 +0100 Subject: [PATCH 1/3] autoload --- H/YapGFlagInfo.h | 7 ++--- pl/consult.yap | 72 +++++++++++++++++++++++++----------------------- pl/imports.yap | 1 - pl/init.yap | 20 ++++++-------- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/H/YapGFlagInfo.h b/H/YapGFlagInfo.h index 26f1db738..8a35204b3 100644 --- a/H/YapGFlagInfo.h +++ b/H/YapGFlagInfo.h @@ -70,13 +70,12 @@ opportunity. Initial value is 10,000. May be changed. A value of 0 #endif YAP_FLAG(ARCH_FLAG, "arch", false, isatom, YAP_ARCH, NULL), /**< read-only atom, it describes the ISA used in this version of YAP. - Available from YAP_AEH. + Available from YAP_ARCH. */ - YAP_FLAG(ARGV_FLAG, "argv", false, argv, "@boot", NULL), YAP_FLAG(ARITHMETIC_EXCEPTIONS_FLAG, "arithmetic_exceptions", true, booleanFlag, "true", NULL), - /**< `arithmetic_exceptions` + /**< Read-write flag telling whether arithmetic exceptions generate Prolog exceptions. If enabled: @@ -97,7 +96,7 @@ opportunity. Initial value is 10,000. May be changed. A value of 0 ProbLog. */ YAP_FLAG(BACK_QUOTES_FLAG, "back_quotes", true, isatom, "true", bqs), - /**> + /**< If _Value_ is unbound, tell whether a back quoted list of characters token is converted to a list of atoms, `chars`, to a list of integers, `codes`, or to a single atom, `atom`. If _Value_ is bound, set to diff --git a/pl/consult.yap b/pl/consult.yap index 9a7dcf8b5..dc7c8ff6e 100644 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -274,40 +274,44 @@ load_files(_Files,_Opts). setarg( Id, TOpts, Val ). '$load_files'(Files, Opts, Call) :- - ( '__NB_getval__'('$lf_status', OldTOpts, fail), nonvar(OldTOpts) - '$lf_opt'(autoload, OldTOpts, OldAutoload) - ; - '$lf_option'(last_opt, LastOpt), - functor( OldTOpts, opt, LastOpt ), - '$lf_opt'('$context_module', OldTOpts, user) - ), - '$lf_option'(last_opt, LastOpt), - functor( TOpts, opt, LastOpt ), - ( source_location(ParentF, Line) -> true ; ParentF = user_input, Line = -1 ), - '$lf_opt'('$location', TOpts, ParentF:Line), - '$lf_opt'('$files', TOpts, Files), - '$lf_opt'('$call', TOpts, Call), - '$lf_opt'('$options', TOpts, Opts), - '$lf_opt'('$parent_topts', TOpts, OldTOpts), - '$process_lf_opts'(Opts,TOpts,Files,Call), - '$lf_default_opts'(1, LastOpt, TOpts), - '$lf_opt'(stream, TOpts, Stream), - ( nonvar(Stream) -> - '$set_lf_opt'('$from_stream', TOpts, true ) - ; - '$check_files'(Files,load_files(Files,Opts)) - ), - '$check_use_module'(Call,UseModule), - '$lf_opt'('$use_module', TOpts, UseModule), - '$current_module'(M0), - ( '$lf_opt'(autoload, TOpts, Autoload), - var(Autoload) -> - Autoload = OldAutoload - ; - true - ), - % make sure we can run consult - '$init_consult', - '$lf'(Files, M0, Call, TOpts). + '$lf_option'(last_opt, LastOpt), + ( '__NB_getval__'('$lf_status', OldTOpts, fail), + nonvar(OldTOpts) + -> + '$lf_opt'(autoload, OldTOpts, OldAutoload) + ; + current_prolog_flag(autoload, OldAutoload), + functor( OldTOpts, opt, LastOpt ), + '$lf_opt'(autoload, OldTOpts, OldAutoload), + '$lf_opt'('$context_module', OldTOpts, user) + ), + functor( TOpts, opt, LastOpt ), + ( source_location(ParentF, Line) -> true ; ParentF = user_input, Line = -1 ), + '$lf_opt'('$location', TOpts, ParentF:Line), + '$lf_opt'('$files', TOpts, Files), + '$lf_opt'('$call', TOpts, Call), + '$lf_opt'('$options', TOpts, Opts), + '$lf_opt'('$parent_topts', TOpts, OldTOpts), + '$process_lf_opts'(Opts,TOpts,Files,Call), + '$lf_default_opts'(1, LastOpt, TOpts), + '$lf_opt'(stream, TOpts, Stream), + ( nonvar(Stream) -> + '$set_lf_opt'('$from_stream', TOpts, true ) + ; + '$check_files'(Files,load_files(Files,Opts)) + ), + '$check_use_module'(Call,UseModule), + '$lf_opt'('$use_module', TOpts, UseModule), + '$current_module'(M0), + ( '$lf_opt'(autoload, TOpts, Autoload), + var(Autoload) -> + Autoload = OldAutoload + ; + true + ), + % make sure we can run consult + '$init_consult', + '$lf'(Files, M0, Call, TOpts). '$check_files'(Files, Call) :- var(Files), !, diff --git a/pl/imports.yap b/pl/imports.yap index 46dc2a7f6..caa4ba296 100644 --- a/pl/imports.yap +++ b/pl/imports.yap @@ -22,7 +22,6 @@ '$pred_exists'(G, user). % autoload '$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :- - recorded('$dialect',swi,_), prolog_flag(autoload, true), prolog_flag(unknown, OldUnk, fail), ( diff --git a/pl/init.yap b/pl/init.yap index c7c1bcb89..b110ba974 100644 --- a/pl/init.yap +++ b/pl/init.yap @@ -33,17 +33,15 @@ nb_setval('$chr_toplevel_show_store',false). '$init_consult' :- - set_value('$open_expands_filename',true), - nb_setval('$assert_all',off), - nb_setval('$if_level',0), - nb_setval('$endif',off), - nb_setval('$initialization_goals',off), - nb_setval('$included_file',[]), - nb_setval('$loop_streams',[]), - \+ '$undefined'('$init_preds',prolog), - '$init_preds', - fail. -'$init_consult'. + set_value('$open_expands_filename',true), + nb_setval('$assert_all',off), + nb_setval('$if_level',0), + nb_setval('$endif',off), + nb_setval('$initialization_goals',off), + nb_setval('$included_file',[]), + nb_setval('$loop_streams',[]), + \+ '$undefined'('$init_preds',prolog), + '$init_preds'. '$init_win_graphics' :- '$undefined'(window_title(_,_), system), !. From 4de58e0fe48f377b14629e18b512177e1e24ee78 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 12 Jul 2018 11:02:09 +0100 Subject: [PATCH 2/3] load_file --- os/charsio.c | 7 +--- os/streams.c | 13 ++++---- pl/consult.yap | 82 +++++++++++++++++++++++++++-------------------- pl/directives.yap | 1 - pl/hacks.yap | 6 ++-- pl/init.yap | 9 ++++-- pl/modules.yap | 6 ++-- 7 files changed, 68 insertions(+), 56 deletions(-) diff --git a/os/charsio.c b/os/charsio.c index f2205d8c5..f531d312e 100644 --- a/os/charsio.c +++ b/os/charsio.c @@ -990,16 +990,11 @@ leaving the current stream position unaltered. */ static Int peek_code(USES_REGS1) { /* at_end_of_stream */ /* the next character is a EOF */ - int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek/2"); + int sno = Yap_CheckTextStream(ARG1, Input_Stream_f, "peek_code/2"); Int ch; if (sno < 0) return FALSE; - if (GLOBAL_Stream[sno].status & Binary_Stream_f) { - UNLOCK(GLOBAL_Stream[sno].streamlock); - Yap_Error(PERMISSION_ERROR_INPUT_TEXT_STREAM, ARG1, "peek_code/2"); - return FALSE; - } if ((ch = Yap_peek(sno)) < 0) { #ifdef PEEK_EOF UNLOCK(GLOBAL_Stream[sno].streamlock); diff --git a/os/streams.c b/os/streams.c index 5ec3a1410..8e5baa2bc 100644 --- a/os/streams.c +++ b/os/streams.c @@ -683,7 +683,7 @@ static xarg *generate_property(int sno, Term t2, } static Int cont_stream_property(USES_REGS1) { /* current_stream */ - bool det; + bool det = false; xarg *args; int i = IntOfTerm(EXTRA_CBACK_ARG(2, 1)); stream_property_choices_t p = STREAM_PROPERTY_END; @@ -705,7 +705,7 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */ if (LOCAL_Error_TYPE != YAP_NO_ERROR) { if (LOCAL_Error_TYPE == DOMAIN_ERROR_GENERIC_ARGUMENT) LOCAL_Error_TYPE = DOMAIN_ERROR_STREAM_PROPERTY_OPTION; - Yap_Error(LOCAL_Error_TYPE, t2, NULL); + Yap_ThrowError(LOCAL_Error_TYPE, t2, NULL); return false; } cut_fail(); @@ -714,16 +714,17 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */ if (IsAtomTerm(args[STREAM_PROPERTY_ALIAS].tvalue)) { // one solution only i = Yap_CheckAlias(AtomOfTerm(args[STREAM_PROPERTY_ALIAS].tvalue)); - free(args) UNLOCK(GLOBAL_Stream[i].streamlock); + UNLOCK(GLOBAL_Stream[i].streamlock); if (i < 0 || !Yap_unify(ARG1, Yap_MkStream(i))) { + free(args); cut_fail(); } - cut_succeed(); + det = true; } LOCK(GLOBAL_Stream[i].streamlock); rc = do_stream_property(i, args PASS_REGS); UNLOCK(GLOBAL_Stream[i].streamlock); - if (IsVarTerm(t1)) { + if (!det && IsVarTerm(t1)) { if (rc) rc = Yap_unify(ARG1, Yap_MkStream(i)); if (p == STREAM_PROPERTY_END) { @@ -743,7 +744,7 @@ static Int cont_stream_property(USES_REGS1) { /* current_stream */ } } else { // done - det = (p == STREAM_PROPERTY_END); + det = det || (p == STREAM_PROPERTY_END); } free(args); if (rc) { diff --git a/pl/consult.yap b/pl/consult.yap index dc7c8ff6e..c00331f1d 100644 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -220,10 +220,10 @@ SWI-compatible option where if _Autoload_ is `true` undefined % compilation_mode(compact,source,assert_all) => implemented % register(true, false) => implemented % -load_files(Files,Opts) :- - once( '$load_files'(Files,Opts,load_files(Files,Opts)) ), - fail. -load_files(_Files,_Opts). +load_files(Files0,Opts) :- + '$yap_strip_module'(Files0,M,Files), + '$load_files'(Files,M,Opts,M:load_files(Files,Opts)). + '$lf_option'(autoload, 1, false). '$lf_option'(derived_from, 2, false). @@ -234,7 +234,14 @@ load_files(_Files,_Opts). '$lf_option'(qcompile, 7, Current) :- '__NB_getval__'('$qcompile', Current, Current = never). '$lf_option'(silent, 8, _). -'$lf_option'(skip_unix_header, 9, true). +'$lf_option'(skip_unix_header, 9, Skip) :- + stream_property(Stream,[alias(loop_stream),tty(TTy),reposition(Rep)]), + ( Rep == true + -> + (TTy = true -> Skip = false ; Skip = true) + ; + Skip = false + ). '$lf_option'(compilation_mode, 10, Flag) :- current_prolog_flag(source, YFlag), ( YFlag == false -> Flag = compact ; Flag = source ). @@ -273,17 +280,43 @@ load_files(_Files,_Opts). '$lf_option'(Op, Id, _), setarg( Id, TOpts, Val ). -'$load_files'(Files, Opts, Call) :- +'$load_files'([user], M,Opts, Call) :- + current_input(S), + '$load_files__'(user, M, [stream(S)|Opts], Call). +'$load_files'(user, M,Opts, Call) :- + current_input(S), + '$load_files__'(user, M, [stream(S)|Opts], Call). +'$load_files'([-user], M,Opts, Call) :- + current_input(S), + '$load_files__'(user, M, [consult(reconsult),stream(S)|Opts], Call). +'$load_files'(-user, M,Opts, Call) :- + current_input(S), + '$load_files__'(user, M, [consult(reconsult),stream(S)|Opts], Call). +'$load_files'([user_input], M,Opts, Call) :- + current_input(S), + '$load_files__'(user_input, M, [stream(S)|Opts], Call). +'$load_files'(user_input, M,Opts, Call) :- + current_input(S), + '$load_files__'(user_input, M, [stream(S)|Opts], Call). +'$load_files'([-user_input], M,Opts, Call) :- + current_input(S), + '$load_files__'(user_input, M, [consult(reconsult),stream(S)|Opts], Call). +'$load_files'(-user_input, M,Opts, Call) :- + '$load_files__'(user_input, M, [consult(reconsult),stream(S)|Opts], Call). +'$load_files'(Files, M, Opts, Call) :- + '$load_files__'(Files, M, Opts, Call). +'$load_files__'(Files, M, Opts, Call) :- '$lf_option'(last_opt, LastOpt), ( '__NB_getval__'('$lf_status', OldTOpts, fail), nonvar(OldTOpts) -> - '$lf_opt'(autoload, OldTOpts, OldAutoload) + '$lf_opt'(autoload, OldTOpts, OldAutoload), + '$lf_opt'('$context_module', OldTOpts, OldContextModule) ; current_prolog_flag(autoload, OldAutoload), functor( OldTOpts, opt, LastOpt ), '$lf_opt'(autoload, OldTOpts, OldAutoload), - '$lf_opt'('$context_module', OldTOpts, user) + '$lf_opt'('$context_module', OldTOpts, OldContextModule) ), functor( TOpts, opt, LastOpt ), ( source_location(ParentF, Line) -> true ; ParentF = user_input, Line = -1 ), @@ -302,7 +335,6 @@ load_files(_Files,_Opts). ), '$check_use_module'(Call,UseModule), '$lf_opt'('$use_module', TOpts, UseModule), - '$current_module'(M0), ( '$lf_opt'(autoload, TOpts, Autoload), var(Autoload) -> Autoload = OldAutoload @@ -311,7 +343,7 @@ load_files(_Files,_Opts). ), % make sure we can run consult '$init_consult', - '$lf'(Files, M0, Call, TOpts). + '$lf'(Files, M, Call, TOpts). '$check_files'(Files, Call) :- var(Files), !, @@ -433,32 +465,12 @@ load_files(_Files,_Opts). '$lf'(V,_,Call, _ ) :- var(V), !, '$do_error'(instantiation_error,Call). '$lf'([], _, _, _) :- !. -'$lf'(M:X, _, Call, TOpts) :- !, - ( - atom(M) - -> - '$lf'(X, M, Call, TOpts) - ; - '$do_error'(type_error(atom,M),Call) - ). '$lf'([F|Fs], Mod, Call, TOpts) :- !, % clean up after each consult ( '$lf'(F,Mod,Call, TOpts), fail; '$lf'(Fs, Mod, Call, TOpts), fail; true ). -'$lf'(user, Mod, Call, TOpts) :- - !, - stream_property( S, alias( user_input )), - '$set_lf_opt'('$from_stream', TOpts, true), - '$set_lf_opt'( stream , TOpts, S), - '$lf'(S, Mod, Call, TOpts). -'$lf'(user_input, Mod, Call, TOpts ) :- - !, - stream_property( S, alias( user_input )), - '$set_lf_opt'('$from_stream', TOpts, true), - '$set_lf_opt'( stream , TOpts, S), - '$lf'(S, Mod, Call, TOpts). '$lf'(File, Mod, Call, TOpts) :- '$lf_opt'(stream, TOpts, Stream), b_setval('$user_source_file', File), @@ -1104,7 +1116,7 @@ just goes through every loaded file and verifies whether reloading is needed. make :- recorded('$lf_loaded','$lf_loaded'(F1,_M,reconsult,_,_,_,_),_), - '$load_files'(F1, [if(changed)],make), + load_files(F1, [if(changed)]), fail. make. @@ -1265,11 +1277,11 @@ use_module(M,F,Is) :- '$use_module'(M,M1,F,Is) :- nonvar(F), !, ( var(M) -> - '$load_files'(M1:F, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)), + load_files(M1:F, [if(not_loaded),must_be_module(true),imports(Is)]), absolute_file_name( F, F1, [expand(true),file_type(prolog)] ), recorded('$module','$module'(F1,M,_,_,_),_) ; -'$load_files'(M1:F, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)) +load_files(M1:F, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)) ). '$use_module'(M,M1,F,Is) :- nonvar(M), !, @@ -1277,11 +1289,11 @@ use_module(M,F,Is) :- ( recorded('$module','$module'(F0,M,_,_,_),_) -> - '$load_files'(M1:F0, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)) + load_files(M1:F0, [if(not_loaded),must_be_module(true),imports(Is)]) ; nonvar(F0) -> - '$load_files'(M1:F, [if(not_loaded),must_be_module(true),imports(Is)], use_module(M,F,Is)) + load_files(M1:F, [if(not_loaded),must_be_module(true),imports(Is)]) ; '$do_error'(instantiation_error,use_module(M,F,Is)) ). diff --git a/pl/directives.yap b/pl/directives.yap index 877d3542f..38540758b 100644 --- a/pl/directives.yap +++ b/pl/directives.yap @@ -45,7 +45,6 @@ '$include'/2, '$initialization'/1, '$initialization'/2, - '$load_files'/3, '$require'/2, '$set_encoding'/1, '$use_module'/3]). diff --git a/pl/hacks.yap b/pl/hacks.yap index 0b0c299cd..62692dbed 100644 --- a/pl/hacks.yap +++ b/pl/hacks.yap @@ -232,9 +232,9 @@ beautify_hidden_goal('$process_directive'(Gs,_Mode,_VL),prolog) --> [(:- Gs)]. beautify_hidden_goal('$loop'(Stream,Option),prolog) --> [execute_load_file(Stream, consult=Option)]. -beautify_hidden_goal('$load_files'(Files,Opts,?),prolog) --> - [load_files(Files,Opts)]. -beautify_hidden_goal('$load_files'(_,_,Name),prolog) --> +beautify_hidden_goal('$load_files'(Files,M,Opts,?),prolog) --> + [load_files(M:Files,Opts)]. +beautify_hidden_goal('$load_files'(_,_,_,Name),prolog) --> [Name]. beautify_hidden_goal('$reconsult'(Files,Mod),prolog) --> [reconsult(Mod:Files)]. diff --git a/pl/init.yap b/pl/init.yap index b110ba974..330bc76c4 100644 --- a/pl/init.yap +++ b/pl/init.yap @@ -40,8 +40,13 @@ nb_setval('$initialization_goals',off), nb_setval('$included_file',[]), nb_setval('$loop_streams',[]), - \+ '$undefined'('$init_preds',prolog), - '$init_preds'. + ( + '$undefined'('$init_preds',prolog) + -> + true + ; + '$init_preds' + ). '$init_win_graphics' :- '$undefined'(window_title(_,_), system), !. diff --git a/pl/modules.yap b/pl/modules.yap index 5747add74..6aba25b45 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -201,8 +201,8 @@ The state of the module system after this error is undefined. **/ -use_module(F) :- '$load_files'(F, - [if(not_loaded),must_be_module(true)], use_module(F)). +use_module(F) :- load_files(F, + [if(not_loaded),must_be_module(true)]). /** @@ -235,7 +235,7 @@ Unfortunately it is still not possible to change argument order. **/ use_module(F,Is) :- - '$load_files'(F, [if(not_loaded),must_be_module(true),imports(Is)], use_module(F,Is)). + load_files(F, [if(not_loaded),must_be_module(true),imports(Is)]). '$module'(O,N,P,Opts) :- !, '$module'(O,N,P), From 4fff3634363b3f36e176f9b1b69c675d2880bc5a Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 12 Jul 2018 15:17:01 +0100 Subject: [PATCH 3/3] fixes --- C/text.c | 6 ++++-- C/yap-args.c | 2 +- CXX/yapi.cpp | 4 ++-- packages/python/yap_kernel/yap_ipython/prolog/jupyter.yap | 3 +-- pl/boot.yap | 8 +++++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/C/text.c b/C/text.c index 5f225cde7..af2cfeee4 100644 --- a/C/text.c +++ b/C/text.c @@ -532,8 +532,10 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) { } #endif if (inp->type & YAP_STRING_TERM) { - // Yap_DebugPlWriteln(inp->val.t); - char *s = (char *)Yap_TermToBuffer(inp->val.t, 0); + // Yap_DebugPlWriteln(inp->val.t + return inp->val.c = (char *)Yap_TermToBuffer(inp->val.t, 0); + pop_text_stack(lvl); + return inp->val.c; } if (inp->type & YAP_STRING_CHARS) { pop_text_stack(lvl); diff --git a/C/yap-args.c b/C/yap-args.c index b1abc3ae9..e7be80153 100755 --- a/C/yap-args.c +++ b/C/yap-args.c @@ -203,13 +203,13 @@ static bool consult(const char *b_file USES_REGS) { } else { YAP_CompileClause(t); } - } while (true); yap_error_descriptor_t *errd; if ((errd = Yap_GetException(LOCAL_ActiveError))) { fprintf(stderr, "%s:%ld:0: Error %s %s Found\n", errd->errorFile, (long int) errd->errorLine, errd->classAsText, errd->errorAsText); } + } while (true); BACKUP_MACHINE_REGS(); YAP_EndConsult(c_stream, &osno, full); if (!Yap_AddAlias(AtomLoopStream, osno)) { diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index 3d9e0d9df..d955eada6 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -519,7 +519,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) { #if YAP_PYTHON // PyThreadState *_save; - std::cerr << "mgoal " << YAPTerm(t).text() << "\n"; + //std::cerr << "mgoal " << YAPTerm(t).text() << "\n"; // _save = PyEval_SaveThread(); #endif CACHE_REGS @@ -553,7 +553,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) { //__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec "); result = (bool)YAP_EnterGoal(ap, nullptr, &q); - std::cerr << "mgoal " << YAPTerm(t).text() << "\n"; + //std::cerr << "mgoal " << YAPTerm(t).text() << "\n"; YAP_LeaveGoal(result && !release, &q); // PyEval_RestoreThread(_save); diff --git a/packages/python/yap_kernel/yap_ipython/prolog/jupyter.yap b/packages/python/yap_kernel/yap_ipython/prolog/jupyter.yap index c758bcf40..c82125571 100644 --- a/packages/python/yap_kernel/yap_ipython/prolog/jupyter.yap +++ b/packages/python/yap_kernel/yap_ipython/prolog/jupyter.yap @@ -41,7 +41,6 @@ jupyter_cell( Caller, _, Line ) :- E=error(A,B), system_error(A,B) ). -jupyter_cell(_,_,_). restreams(call) :- streams(true). @@ -207,4 +206,4 @@ plot_inline :- :- endif. -:- ( start_low_level_trace ). +%:- ( start_low_level_trace ). diff --git a/pl/boot.yap b/pl/boot.yap index 94ebc41d8..390c3e10a 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -121,9 +121,11 @@ print_message(L,E) :- ). '$undefp0'([M|G], _Action) :- - stream_property( loop_stream, file_name(F)), - stream_property( loop_stream, line_number(L)), - format(user_error,'~a:~d error undefined: call to ~w~n',[F,L,M:G]), + stream_property( loop_stream, [file_name(F), line_number(L)]), + format(user_error,'~a:~d error undefined:',[F,L]), + fail + ; + format(user_error,' call to ~w~n',[M:G]), fail. :- '$undefp_handler'('$undefp0'(_,_),prolog).