From: notoria Date: Fri, 19 Jun 2020 15:18:59 +0000 (+0200) Subject: Added library(debug) X-Git-Tag: v0.8.127~25^2~1 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=94eddd3b425fe944bb1e2bc228e903cc3d4b6253;p=scryer-prolog.git Added library(debug) --- diff --git a/src/lib/debug.pl b/src/lib/debug.pl new file mode 100644 index 00000000..bc9f9df8 --- /dev/null +++ b/src/lib/debug.pl @@ -0,0 +1,22 @@ +% Source: https://stackoverflow.com/a/30791637 + +:- module(debug, [ + op(900, fx, $), + op(900, fx, $-), + op(950, fy, *), + (*)/1, + ($)/1, + ($-)/1 +]). + +:- use_module(library(format), [portray_clause/1]). + +$-(G_0) :- + catch(G_0, Ex, ( portray_clause(exception:Ex:G_0), throw(Ex) ) ). + +$(G_0) :- + portray_clause(call:G_0), + $-G_0, + portray_clause(exit:G_0). + +*(_).