diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | match.c | 3 | ||||
-rw-r--r-- | share/txr/stdlib/ver.txr | 1 | ||||
-rw-r--r-- | txr.c | 3 |
5 files changed, 20 insertions, 1 deletions
@@ -1,5 +1,18 @@ 2014-06-12 Kaz Kylheku <kaz@kylheku.com> + * Makefile: Install share/txr/stdlib/*.txr material. + + * match.c (do_txeval): If a variable is not in the bindings, fall + back on treating it as a TXR Lisp dynamic variable. This allows + us to refer to the stdlib variable from a quasistring in a + @(load ...) directive. + + * txr.c (sysroot_init): Register new variable, *txr-version*. + + * share/txr/stdlib/ver.txr: New file. + +2014-06-12 Kaz Kylheku <kaz@kylheku.com> + * match.c (v_load): use the abs_path_p function instead of checking for leading slash. @@ -168,6 +168,7 @@ install: $(PROG) $(PREINSTALL) $(call INSTALL,0755,txr,$(DESTDIR)$(bindir)) $(call INSTALL,0444,$(top_srcdir)/txr.1,$(DESTDIR)$(mandir)/man1) + $(call INSTALL,0444,$(top_srcdir)/share/txr/stdlib/*.txr,$(DESTDIR)$(datadir)/stdlib) .PHONY: unixtar tar zip @@ -1432,6 +1432,7 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound) { val ret = nil; uw_mark_frame; + uses_or2; uw_catch_begin (cons(query_error_s, nil), exc_sym, exc); if (!form) @@ -1441,7 +1442,7 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound) if (!form) { ret = form; } else if (bindable(form)) { - val binding = assoc(form, bindings); + val binding = or2(assoc(form, bindings), lookup_var(nil, form)); if (!binding) { if (allow_unbound) ret = noval_s; diff --git a/share/txr/stdlib/ver.txr b/share/txr/stdlib/ver.txr new file mode 100644 index 00000000..b3a9fdb6 --- /dev/null +++ b/share/txr/stdlib/ver.txr @@ -0,0 +1 @@ +@(do (defvar *lib-version* 91)) @@ -52,6 +52,7 @@ #include "syslog.h" #include "eval.h" #include "regex.h" +#include "arith.h" #include "txr.h" const wchli_t *version = wli(TXR_VER); @@ -235,6 +236,8 @@ static void sysroot_init(void) #endif reg_var(intern(lit("stdlib"), user_package), sysroot(lit("share/txr/stdlib"))); + reg_var(intern(lit("*txr-version*"), user_package), + toint(lit(TXR_VER), nil)); } int txr_main(int argc, char **argv); |