diff options
author | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-07-22 19:18:33 +0000 |
---|---|---|
committer | Peter Mikkelsen <peter@pmikkelsen.com> | 2021-07-22 19:18:33 +0000 |
commit | 77c7fea4cee74562ad60c7ce96ca830a7ebda8b7 (patch) | |
tree | 708b9ab3076a6c2a727b4303711ef90a242b367f | |
parent | 2bda2a9d61ff3c713beff623aceea143d0f814c6 (diff) |
Use addgoals to add the goal in catch/3 to the goalstack, allowing mod:pred goals too
-rw-r--r-- | builtins.c | 8 | ||||
-rw-r--r-- | loader.pl | 2 |
2 files changed, 2 insertions, 8 deletions
@@ -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; } @@ -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 ). |