summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-22 19:18:33 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-22 19:18:33 +0000
commit77c7fea4cee74562ad60c7ce96ca830a7ebda8b7 (patch)
tree708b9ab3076a6c2a727b4303711ef90a242b367f
parent2bda2a9d61ff3c713beff623aceea143d0f814c6 (diff)
Use addgoals to add the goal in catch/3 to the goalstack, allowing mod:pred goals too
-rw-r--r--builtins.c8
-rw-r--r--loader.pl2
2 files changed, 2 insertions, 8 deletions
diff --git a/builtins.c b/builtins.c
index 43215f8..d1f70b9 100644
--- a/builtins.c
+++ b/builtins.c
@@ -622,13 +622,7 @@ builtincatch(Term *goal, Binding **bindings, Module *module)
catchframe->next = goalstack;
goalstack = catchframe;
- Goal *g = gmalloc(sizeof(Goal));
- g->goal = catchgoal;
- g->module = module;
- g->catcher = nil;
- g->next = goalstack;
- goalstack = g;
-
+ goalstack = addgoals(goalstack, catchgoal, module);
return 1;
}
diff --git a/loader.pl b/loader.pl
index cf0fcf3..0a9f8df 100644
--- a/loader.pl
+++ b/loader.pl
@@ -21,7 +21,7 @@ load_module_from_file(File) :-
run_initialization_goals(Module) :-
( retract(initialization_goals(Module, Goal)),
- Module:catch(Goal, E, loader:print_initialization_goal_error(Module, Goal, E)),
+ catch(Module:Goal, E, print_initialization_goal_error(Module, Goal, E)),
fail % Backtrack to find more goals
; true
).