From 3e71d171e71f86c8c39e9af217ca6d430c4551ea Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 20 Feb 2018 22:59:17 +0000 Subject: [PATCH] small --- packages/jpl/jpl.pl | 16 ++++++++-------- packages/python/py2pl.c | 2 +- pl/boot.yap | 2 +- pl/grammar.yap | 15 +++++++-------- pl/load_foreign.yap | 8 +++++++- pl/meta.yap | 8 ++++---- pl/top.yap | 15 +++++++++++---- swi/library/debug.pl | 4 ++-- swi/library/prolog_xref.pl | 15 ++++++--------- 9 files changed, 47 insertions(+), 38 deletions(-) diff --git a/packages/jpl/jpl.pl b/packages/jpl/jpl.pl index f5d9ccd8b..89c9488b4 100644 --- a/packages/jpl/jpl.pl +++ b/packages/jpl/jpl.pl @@ -4470,7 +4470,7 @@ add_search_path(Path, Dir) :- % =CLASSPATH=, etc. search_path_separator((;)) :- - current_prolog_flag(windows, true), !. + current_prolog_flag(windo/.... ,,,,,,,,,,,,,,,,,, :l'p[KIO)_"?ws, true), !. search_path_separator(:). /******************************* @@ -4499,14 +4499,14 @@ check_java_libs(JVM, Java) :- libfile( java, Root, Java), !. % try JAVA_HOME, registry, etc.. -location( java_root, _, Home) :- +location( java_root, _, Home) :- getenv( 'JAVA_HOME', Home ). location(java_root, _, JRE) :- % OS well-known member(Root, [ '/usr/lib', '/usr/local/lib', '/opt/lib', - '/Library/Java/JavaVirtualMachines', + '/Library/Java/JavaVirtual hines', '/System/Library/Frameworks' ]), exists_directory(Root), @@ -4517,13 +4517,13 @@ jdk_jre( Home, J ) :- absolute_file_name( Extension, [expand(true), relative_to(Home), access(exists), file_type( directory ), file_errors(fail), solutions(all) ], J0 ), pick_jdk_jre(J0, J). - + pick_jdk_jre(J, J). pick_jdk_jre(J0, J) :- absolute_file_name( 'jre*', [expand(true), relative_to(J0), access(exists), file_type( directory ), file_errors(fail), solutions(all) ], J ). pick_jdk_jre(J0, J) :- absolute_file_name( 'jdk*', [expand(true), relative_to(J0), access(exists), file_type( directory ), file_errors(fail), solutions(all) ], J ). - + libfile(Base, HomeLib, File) :- java_arch( Arch ), @@ -4534,7 +4534,7 @@ libfile(Base, HomeLib, File) :- jlib(Base, LBase), atom_concat(['lib',LBase], Lib), absolute_file_name( Lib, [relative_to(HomeLib), access(read), file_type( executable), expand(true), file_errors(fail), solutions(all)], File ). - + jlib( jvm, '/server/libjvm' ). jlib( jvm, '/client/libjvm' ). jlib( java, '/libjava' ). @@ -4616,10 +4616,10 @@ add_jpl_to_ldpath(JPL, File) :- % This appears to work on Windows. Unfortunately most Unix systems % appear to inspect the content of LD_LIBRARY_PATH only once. -add_java_to_ldpath(_LIBJAVA, LIBJVM) :- +add_java_to_ldpath(_LIBJAVA, LIBJVM) :- add_lib_to_ldpath(LIBJVM), fail. -add_java_to_ldpath(LIBJAVA, _LIBJVM) :- +add_java_to_ldpath(LIBJAVA, _LIBJVM) :- add_lib_to_ldpath(LIBJAVA), fail. add_java_to_ldpath(_,_). diff --git a/packages/python/py2pl.c b/packages/python/py2pl.c index 7e7ccfad1..5828bb850 100644 --- a/packages/python/py2pl.c +++ b/packages/python/py2pl.c @@ -150,7 +150,7 @@ foreign_t python_to_term(PyObject *pVal, term_t t) { for (i = 0; i < sz; i++) { PyObject *obj; rc = rc && PL_unify_list(t, to, t); - if ((obj = PyList_GetItem(pVal, i - 1)) == NULL) { + if ((obj = PyList_GetItem(pVal, i)) == NULL) { obj = Py_None; } rc = rc && python_to_term(obj, to); diff --git a/pl/boot.yap b/pl/boot.yap index 6a540075f..3d093a5c2 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -212,7 +212,7 @@ print_message(L,E) :- '$yap_strip_module'(C, EM, EG), '$execute_command'(EG,EM,VL,Pos,Con,C), ! ; % do term expansion - '$expand_term'(C, EC), + '$expand_term'(C, Con, EC), '$yap_strip_module'(EC, EM, EG), % execute a list of commands '$execute_commands'(EG,EM,VL,Pos,Con,_Source), diff --git a/pl/grammar.yap b/pl/grammar.yap index c7586c6cb..bdcaa9fb7 100644 --- a/pl/grammar.yap +++ b/pl/grammar.yap @@ -67,7 +67,6 @@ right hand side of a grammar rule Grammar related built-in predicates: */ -/* :- system_module( '$_grammar', [!/2, (',')/4, (->)/4, @@ -81,7 +80,7 @@ Grammar related built-in predicates: phrase/3, {}/3, ('|')/4], ['$do_error'/2]). -*/ + % :- meta_predicate ^(?,0,?). % ^(Xs, Goal, Xs) :- call(Goal). @@ -121,7 +120,7 @@ t_hgoal(V, _, _, _, G0) :- var(V), !, t_hgoal(M:H, M:NH, S, SR, G0) :- !, t_hgoal(H, NH, S, SR, G0). t_hgoal(H, NH, S, SR, _) :- - extend([S,SR],H,NH). + dcg_extend([S,SR],H,NH). t_hlist(V, _, _, _, G0) :- var(V), !, '$do_error'(instantiation_error,G0). @@ -174,10 +173,10 @@ t_body((T|R), _ToFill, _, S, SR, (Tt;Rt)) :- !, t_body(M:G, ToFill, Last, S, SR, M:NG) :- !, t_body(G, ToFill, Last, S, SR, NG). t_body(T, filled_in, _, S, SR, Tt) :- - extend([S,SR], T, Tt). + dcg_extend([S,SR], T, Tt). -extend(More, OldT, NewT) :- +dcg_extend(More, OldT, NewT) :- OldT =.. OldL, lists:append(OldL, More, NewL), NewT =.. NewL. @@ -232,7 +231,7 @@ prolog:phrase(V, S0, S) :- '$do_error'(instantiation_error,phrase(V,S0,S)). prolog:phrase([H|T], S0, S) :- !, - S0 = [H|S1], + S0 = [H|S1], '$phrase_list'(T, S1, S). prolog:phrase([], S0, S) :- !, @@ -313,10 +312,10 @@ prolog:'\\+'(A, S0, S) :- do_c_built_in('C'(A,B,C), _, _, (A=[B|C])) :- !. -do_c_built_in(phrase(NT,Xs0, Xs),Mod, _, NewGoal) :- +do_c_built_in(phrase(NT,Xs0, Xs),Mod, _, NewGoal) :- nonvar(NT), nonvar(Mod), !, '$c_built_in_phrase'(NT, Xs0, Xs, Mod, NewGoal). - + do_c_built_in(phrase(NT,Xs),Mod,_,NewGoal) :- nonvar(NT), nonvar(Mod), '$c_built_in_phrase'(NT, Xs, [], Mod, NewGoal). diff --git a/pl/load_foreign.yap b/pl/load_foreign.yap index 0d2b58dbe..3e8eef8f3 100644 --- a/pl/load_foreign.yap +++ b/pl/load_foreign.yap @@ -98,7 +98,13 @@ load_foreign_files(Objs,Libs,Entry) :- Loads object files produced by the C compiler. It is useful when no search should be performed and instead one has the full paths to the _Files_ and _Libs_. */ -load_absolute_foreign_files(_Objs,_Libs,_Entry). +load_absolute_foreign_files(Objs,Libs,Entry) :- + source_module(M), + '$load_foreign_files'(Objs,Libs,Entry), + !, + prolog_load_context(file, F), + ignore( recordzifnot( '$load_foreign_done', [F, M], _) ). + '$checklib_prefix'(F,F) :- is_absolute_file_name(F), !. '$checklib_prefix'(F, F) :- sub_atom(F, 0, _, _, lib), !. diff --git a/pl/meta.yap b/pl/meta.yap index b98eb772e..380969f00 100644 --- a/pl/meta.yap +++ b/pl/meta.yap @@ -73,7 +73,7 @@ meta_predicate declaration retractall(prolog:'$meta_predicate'(F,M2,N,_)), fail. '$install_meta_predicate'(P,M,F,N) :- - ( M = prolog -> M2 = _ ; M2 = M), + ( M = prolog -> M2 = _ ; M2 = M), assertz('$meta_predicate'(F,M2,N,P)). % comma has its own problems. @@ -591,8 +591,8 @@ meta_predicate(P) :- spy(:), stash_predicate(:), use_module(:), - use_module(:,?), - use_module(?,:,?), + use_module(:,+), + use_module(?,:,+), when(+,0), with_mutex(+,0), with_output_to(?,0), @@ -606,5 +606,5 @@ meta_predicate(P) :- '|'(2,2,?,?), ->(2,2,?,?), \+(2,?,?), - \+( 0 ) + \+( 0 ) . diff --git a/pl/top.yap b/pl/top.yap index 6bcd942a1..b00dce43f 100644 --- a/pl/top.yap +++ b/pl/top.yap @@ -231,14 +231,21 @@ current_prolog_flag(break_level, BreakLevel), '$continue_with_command'(Option, VL, Pos, M:G, Source). '$expand_term'(T,O) :- - catch( '$expand_term0'(T,O), _,( '$disable_debugging', fail) ), + '$expand_term'(T,top,O). + +'$expand_term'(T,Con,O) :- + catch( '$expand_term0'(T,Con,O), _,( '$disable_debugging', fail) ), !. -'$expand_term0'(T,O) :- - expand_term( T, T1), + '$expand_term0'(T,consult,O) :- + expand_term( T, O). + '$expand_term0'(T,reconsult,O) :- + expand_term( T, O). + '$expand_term0'(T,top,O) :- + expand_term( T, T1), !, '$expand_term1'(T1,O). -'$expand_term0'(T,T). +'$expand_term0'(T,_,T). '$expand_term1'(T,O) :- '$expand_meta_call'(T, [], O), diff --git a/swi/library/debug.pl b/swi/library/debug.pl index bae82edee..ecb3c007d 100644 --- a/swi/library/debug.pl +++ b/swi/library/debug.pl @@ -116,8 +116,8 @@ debugging(Topic) :- debugging(Topic, Bool) :- debugging(Topic, Bool, _To). -%% debug(+Topic) is det. -%% nodebug(+Topic) is det. +%% @pred debug(+Topic) is det. +%% @pred nodebug(+Topic) is det. % % Add/remove a topic from being printed. nodebug(_) removes all % topics. Gives a warning if the topic is not defined unless it is diff --git a/swi/library/prolog_xref.pl b/swi/library/prolog_xref.pl index 4265a407a..bbb5a2847 100644 --- a/swi/library/prolog_xref.pl +++ b/swi/library/prolog_xref.pl @@ -55,9 +55,7 @@ :- use_module(library(lists), [append/3, member/2]). :- use_module(library(operators), [pop_operators/0, push_op/3, push_operators/1]). -:- if(current_prolog_flag(dialect, swi)). :- use_module(library(shlib), [current_foreign_library/2]). -:- endif. :- use_module(library(prolog_source)). :- use_module(library(option)). :- use_module(library(error)). @@ -121,12 +119,12 @@ called_by(on_signal(_,_,New), [New+1]) :- :- expects_dialect(swi). -:- if(current_prolog_flag(dialect, swi)). -system_predicate(Goal) :- - functor(Goal, Name, Arity), - current_predicate(system:Name/Arity), % avoid autoloading - predicate_property(system:Goal, built_in), !. -:-endif. +% :- if(current_prolog_flag(dialect, swi)). +% system_predicate(Goal) :- +% functor(Goal, Name, Arity), +% current_predicate(system:Name/Arity), % avoid autoloading +% predicate_property(system:Goal, built_in), !. +% :-endif. /******************************** * TOPLEVEL * @@ -1452,4 +1450,3 @@ do_xref_source_file(Spec, File, Options) :- access(read), file_errors(fail) ], File), !. -