]> Repositorios git - scryer-prolog.git/commitdiff
call attribute variable goals with module resolution
authorMark Thom <[email protected]>
Mon, 1 Feb 2021 21:48:13 +0000 (14:48 -0700)
committerMark Thom <[email protected]>
Mon, 1 Feb 2021 21:48:13 +0000 (14:48 -0700)
src/indexing.rs
src/loader.pl
src/machine/attributed_variables.pl

index 8a231514882516954534bae9c437d06fe534c34c..9359e18cdc9b394fc1f3224f949fe369c37f63c1 100644 (file)
@@ -1019,7 +1019,6 @@ impl CodeOffsets {
             .or_insert(sdeq![]);
 
         let is_initial_index = code.is_empty();
-
         code.push_back(compute_index(is_initial_index, index));
 
         for constant in &overlapping_constants {
index f8f766f7a62a032e4401968c6d76595b3eecbf1c..88d65770939775139e68f1f222d1a76d47144752 100644 (file)
@@ -56,6 +56,7 @@ load_loop(Stream, Evacuable) :-
     ;  var(Term) ->
        instantiation_error(load/1)
     ;  expand_terms_and_goals(Term, Terms),
+       nl, write('Terms:'), write(Terms), nl, nl,
        !,
        (  var(Terms) ->
           instantiation_error(load/1)
index 386ff10128d7fbf205a2689221974c2fdde77522..b5049e3a0003be50e4e9d3386daf7040e79ccc24 100644 (file)
@@ -1,5 +1,6 @@
 :- module('$atts', []).
 
+
 driver(Vars, Values) :-
     iterate(Vars, Values, ListOfListsOfGoalLists),
     !,
@@ -13,12 +14,6 @@ iterate([Var|VarBindings], [Value|ValueBindings], [ListOfGoalLists | ListsCubed]
     iterate(VarBindings, ValueBindings, ListsCubed).
 iterate([], [], []).
 
-/*
-gather_modules(Attrs, []) :- var(Attrs), !.
-gather_modules([Attr|Attrs], [Module|Modules]) :-
-    '$module_of'(Module, Attr),  % write the owning module of Attr to Module.
-    gather_modules(Attrs, Modules).
-*/
 
 gather_modules(Attrs, []) :- var(Attrs), !.
 gather_modules([Module:_|Attrs], [Module|Modules]) :-
@@ -30,38 +25,32 @@ call_verify_attributes([], _, _, []).
 call_verify_attributes([Attr|Attrs], Var, Value, ListOfGoalLists) :-
     gather_modules([Attr|Attrs], Modules0),
     sort(Modules0, Modules),
-    verify_attrs(Modules, Var, Value, ListOfGoalLists). % verify_attrs(Modules, Var, Value, ListOfGoalLists).
-
-verify_attrs([Module|Modules], Var, Value, [Goals|ListOfGoalLists]) :-
-    catch(Module:verify_attributes(Var, Value, Goals),
-          error(evaluation_error((Module:verify_attributes)/3), verify_attributes/3),
-          Goals = []),
     verify_attrs(Modules, Var, Value, ListOfGoalLists).
-verify_attrs([], _, _, []).
 
-/*
-verify_attrs([Module|Modules], Var, Value, [Goals|ListOfGoalLists]) :-
+
+verify_attrs([Module|Modules], Var, Value, [Module-Goals|ListOfGoalLists]) :-
     catch(Module:verify_attributes(Var, Value, Goals),
           error(evaluation_error((Module:verify_attributes)/3), verify_attributes/3),
           Goals = []),
     verify_attrs(Modules, Var, Value, ListOfGoalLists).
 verify_attrs([], _, _, []).
-*/
+
 
 call_goals([ListOfGoalLists | ListsCubed]) :-
     call_goals_0(ListOfGoalLists),
     call_goals(ListsCubed).
 call_goals([]).
 
-call_goals_0([GoalList | GoalLists]) :-
-    (  var(GoalList), throw(error(instantiation_error, call_goals_0/1))
+call_goals_0([Module-GoalList | GoalLists]) :-
+    (  var(GoalList),
+       throw(error(instantiation_error, call_goals_0/1))
     ;  true
     ),
-    call_goals_1(GoalList),
+    call_goals_1(GoalList, Module),
     call_goals_0(GoalLists).
 call_goals_0([]).
 
-call_goals_1([Goal | Goals]) :-
-    call(Goal),
-    call_goals_1(Goals).
-call_goals_1([]).
+call_goals_1([Goal | Goals], Module) :-
+    call(Module:Goal),
+    call_goals_1(Goals, Module).
+call_goals_1([], _).