summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile1
-rw-r--r--match.c3
-rw-r--r--share/txr/stdlib/ver.txr1
-rw-r--r--txr.c3
5 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 96b919d5..d0d803d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/Makefile b/Makefile
index c5234a92..8dc2862f 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/match.c b/match.c
index 4d21b583..e393e9b3 100644
--- a/match.c
+++ b/match.c
@@ -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))
diff --git a/txr.c b/txr.c
index 80a902b7..aa3ab885 100644
--- a/txr.c
+++ b/txr.c
@@ -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);