From aacf701d451639f393d964e7bd60e18d24a7f68d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 19 Nov 2016 18:36:18 -0800 Subject: 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. --- share/txr/stdlib/place.tl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'share') 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 -- cgit v1.2.3