summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-19 18:36:18 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-19 18:36:18 -0800
commitaacf701d451639f393d964e7bd60e18d24a7f68d (patch)
tree16a00d2efb6fe171fdcdb81ddbd32edde2bba763 /share
parent72c88930b62b9bc64804048b9759bc7ed95cd789 (diff)
downloadtxr-aacf701d451639f393d964e7bd60e18d24a7f68d.tar.gz
txr-aacf701d451639f393d964e7bd60e18d24a7f68d.tar.bz2
txr-aacf701d451639f393d964e7bd60e18d24a7f68d.zip
Allow global macros to be denoted by (macro sym).
In this patch we allow (symbol-function '(macro sym)), (defun (macro sym) (form env) ...), and (trace (macro sym)). * eval.c (macro_s): New symbol variable. (lookup_fun, func_get_name, op_defun): Support (macro sym) syntax. (builtin_reject_test): Pass through (macro sym) syntax. (eval_init); Initialize macro_s. * share/txr/stdlib/place.tl (sys:get-fun-getter-setter): Support macro place. * txr.1: Documented verything.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/place.tl8
1 files changed, 8 insertions, 0 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index a61fb99b..48e4843c 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -795,6 +795,14 @@
(cons (op static-slot struct slot)
(op static-slot-set struct slot @1))
:))
+ ((type sym)
+ (if (eq type 'macro)
+ (let ((cell (gethash sys:top-mb sym)))
+ (unless cell
+ (sys:eval-err "unbound macro ~s" sym))
+ (cons (op cdr)
+ (op sys:rplacd cell @1)))
+ :))
(else
(let ((cell (gethash sys:top-fb sym)))
(unless cell