summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-29 06:02:54 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-29 06:02:54 -0700
commit7322e0e52f4c8a0bc5311ffc3a5488826f37b96e (patch)
tree2c02f20cc43a4fc0f886aace153a897a0911bd21 /lisplib.c
parentf24104801a4a50ebdc5231755a62d1124e381c91 (diff)
downloadtxr-7322e0e52f4c8a0bc5311ffc3a5488826f37b96e.tar.gz
txr-7322e0e52f4c8a0bc5311ffc3a5488826f37b96e.tar.bz2
txr-7322e0e52f4c8a0bc5311ffc3a5488826f37b96e.zip
Adding function tracing support.
New variable *trace-output*, and macros trace and untrace. * lisplib.c (trace_set_entries, trace_instantiate): new static functions. (dlt_register): Register new functions to auto-load trace module. * share/txr/stdlib/trace.tl: New file. * txr.1: Documented.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index 56c97076..8b87d976 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -371,6 +371,21 @@ static val build_instantiate(val set_fun)
return nil;
}
+static val trace_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("*trace-output*"), lit("trace"), lit("untrace"), nil
+ };
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val trace_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~atrace.tl"), stdlib_path, nao));
+ return nil;
+}
val dlt_register(val dlt,
val (*instantiate)(val),
@@ -403,6 +418,7 @@ void lisplib_init(void)
#endif
dlt_register(dl_table, awk_instantiate, awk_set_entries);
dlt_register(dl_table, build_instantiate, build_set_entries);
+ dlt_register(dl_table, trace_instantiate, trace_set_entries);
}
val lisplib_try_load(val sym)