]> Repositorios git - scryer-prolog.git/commitdiff
correct and generalize current_predicate/1
authorMark <[email protected]>
Wed, 28 Jun 2023 23:31:43 +0000 (17:31 -0600)
committerMark <[email protected]>
Wed, 28 Jun 2023 23:31:43 +0000 (17:31 -0600)
src/lib/builtins.pl
src/lib/files.pl
src/lib/iso_ext.pl
src/machine/system_calls.rs

index ab821f4ba7cc7736f52f3ba600c439fe3b8bc32e..904d2f690cc31d67d6310e0485dda69f887a7c2d 100644 (file)
@@ -1252,14 +1252,13 @@ abolish(Pred) :-
 % It can be used to check for existence of a predicate or to enumerate all loaded predicates
 current_predicate(Pred) :-
     (  var(Pred) ->
-       '$get_db_refs'(_, _, PIs),
+       '$get_db_refs'(_, _, _, PIs),
        lists:member(Pred, PIs)
     ;  '$strip_module'(Pred, Module, UnqualifiedPred),
        (  var(Module),
           \+ functor(Pred, (:), 2)
        ;  atom(Module)
        ),
-       nonvar(UnqualifiedPred),
        UnqualifiedPred = Name/Arity ->
        (  (  nonvar(Name), \+ atom(Name)
           ;  nonvar(Arity), \+ integer(Arity)
index 90c1307dbd3120155d638521f5d2d00284af7ae9..6d89eaad7f6061e7bf39e06651d89f49f89dd3bd 100644 (file)
@@ -70,9 +70,9 @@ _lists of characters_. This is an ideal representation:
                   file_exists/1,
                   directory_exists/1,
                   delete_file/1,
-                 rename_file/2,
-                 file_copy/2,
-                 delete_directory/1,
+                         rename_file/2,
+                         file_copy/2,
+                         delete_directory/1,
                   make_directory/1,
                   make_directory_path/1,
                   working_directory/2,
index d6f13df095bb0d753f4e26ca8b418799f0b88a45..0af55c99e14e72dd4d023e53d3d4954a172a9848 100644 (file)
@@ -16,8 +16,8 @@ but they're not part of the ISO Prolog standard at the moment.
                     setup_call_cleanup/3,
                     call_nth/2,
                     copy_term_nat/2,
-                   asserta/2,
-                   assertz/2]).
+                           asserta/2,
+                           assertz/2]).
 
 :- use_module(library(error), [can_be/2,
                                domain_error/3,
index 48741974ce43ad3587590854ae463f41861465ec..7dbaf43b1e1b677f6c8b15c51176cb8c5816044b 100644 (file)
@@ -3774,7 +3774,7 @@ impl Machine {
             (HeapCellValueTag::Atom, (module_name, _arity)) => {
                 module_name
             }
-            (HeapCellValueTag::AttrVar | HeapCellValueTag::Var) => {
+            (HeapCellValueTag::AttrVar | HeapCellValueTag::Var | HeapCellValueTag::StackVar) => {
                 atom!("user")
             }
             _ => {
@@ -3845,9 +3845,9 @@ impl Machine {
                 (0 .. num_functors).map(|i| str_loc_as_cell!(h + 3 * i)),
             );
 
-            unify!(self.machine_st, heap_loc_as_cell!(h), self.machine_st.registers[3]);
+            unify!(self.machine_st, heap_loc_as_cell!(h), self.machine_st.registers[4]);
         } else {
-            unify!(self.machine_st, empty_list_as_cell!(), self.machine_st.registers[3]);
+            unify!(self.machine_st, empty_list_as_cell!(), self.machine_st.registers[4]);
         }
     }