summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-21 18:30:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-21 18:30:13 -0700
commit47cd15b970892e2dae29e825fadaf31c6d84835d (patch)
treeed34c519095f6cc351d90b91c90887c1c491c9a4 /share
parent969b24f06ad615f56f452c87cf2735b5978c754f (diff)
downloadtxr-47cd15b970892e2dae29e825fadaf31c6d84835d.tar.gz
txr-47cd15b970892e2dae29e825fadaf31c6d84835d.tar.bz2
txr-47cd15b970892e2dae29e825fadaf31c6d84835d.zip
compiler: tighter code for quasiliterals.
Give the sys:fmt-simple function argument defaulting so the generated code doesn't have to call it with all five arguments present, four of them nil being much of the time. * eval.c (fmt_simple): Default all but the first four arguments. (eval_init): Re-register sys:fmt-simple as having only one required argument. * parser.c (read_file_common): Load version 1 or 2 files. We are bumping the object file version to 2 because now when we compile files, they won't work with older TXR in which all five arguments to sys:fmt-simple are required. * share/txr/stdlib/compiler.tl (expand-quasi-mods): Generate the sys:fmt-simple call with just enough arguments to express the modifiers that were decoded. (sexpand-quasi-args): Reduce the trivial modifier-less sys:fmt-simple calls to just one argument. (%tlo-ver%): Bump major version to 2.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/compiler.tl13
1 files changed, 9 insertions, 4 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 5ae8fb93..087e9848 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1143,7 +1143,12 @@
^(rcons ,rng-ix nil)
rng-ix)
(nreverse flex))))
- ^(sys:fmt-simple ,obj ,num ,sep, rng-ix ',plist)))))))
+ (cond
+ (plist ^(sys:fmt-simple ,obj ,num ,sep, rng-ix ',plist))
+ (rng-ix ^(sys:fmt-simple ,obj ,num ,sep, rng-ix))
+ (sep ^(sys:fmt-simple ,obj ,num ,sep))
+ (num ^(sys:fmt-simple ,obj ,num))
+ (t ^(sys:fmt-simple ,obj ,num)))))))))
(defun expand-quasi-args (form)
(append-each ((el (cdr form)))
@@ -1153,9 +1158,9 @@
(sys:var (mac-param-bind form (sym exp : mods) el
(list (expand-quasi-mods exp mods))))
(sys:quasi (expand-quasi-mods el))
- (t (list ^(sys:fmt-simple ,el nil nil nil nil)))))
+ (t (list ^(sys:fmt-simple ,el)))))
((bindable el)
- (list ^(sys:fmt-simple ,el nil nil nil nil)))
+ (list ^(sys:fmt-simple ,el)))
(t
(list el)))))
@@ -1406,7 +1411,7 @@
(defvarl %big-endian% (equal (ffi-put 1 (ffi uint32)) #b'00000001'))
-(defvarl %tlo-ver% ^(1 0 ,%big-endian%))
+(defvarl %tlo-ver% ^(2 0 ,%big-endian%))
(defun open-compile-streams (in-path out-path)
(let* ((rsuff (r$ %file-suff-rx% in-path))