shithub: femtolisp

Download patch

ref: c2cff341a39d3182820a0fc1f5462207cf78a6c2
parent: 9139fb180c76413d036311a8e2b02178a72e557f
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Dec 26 16:03:47 EST 2024

untrace: fix wrong index

--- a/flisp.boot
+++ b/flisp.boot
@@ -426,12 +426,13 @@
 											print-stack-trace
 											#fn(stacktrace)))
 							  #fn("6000n1A50420061:" #(#fn(raise)))) top-level-exception-handler)
-	    trace #fn("A000n1200512150728551Ig0230742586262728290e286e3e22:e12;2985e286e3e4e35152@30O^1^142<:" #(#fn(top-level-value)
-  #fn(gensym) traced? #fn(set-top-level-value!) eval λ begin write cons quote newline apply ok) trace)
+	    trace #fn("A000n1200512150728551Ig0230742586262728290e286e3e22:e12;2985e286e3e4e35152@30O^1^147<60:" #(#fn(top-level-value)
+  #fn(gensym) traced? #fn(set-top-level-value!) eval λ begin write cons quote newline apply void) trace)
 	    traced? #fn("7000n170051;3?042105121A<51d:" #(closure? #fn(function:code)) #((#fn("9000z020210P51472504230}2:" #(#fn(write)
   x newline #.apply)))))
-	    untrace #fn("9000n1200517185513A0220238551r2G62:O:" #(#fn(top-level-value) traced? #fn(set-top-level-value!)
-								  #fn(function:vals)) untrace)
+	    untrace #fn("9000n1200517185513C0220238551r3G52@30O^147460:" #(#fn(top-level-value)
+									   traced? #fn(set-top-level-value!)
+									   #fn(function:vals) void) untrace)
 	    value-get-doc #fn("8000n10<0=208551;3=0486B;350485:" #(#fn(string?)) value-get-doc)
 	    values #fn("8000z00B3:00=J500<:A0P:" #() #(#3#)) vars-to-env
 	    #fn(":000n32021182>2072230515163:" #(#fn(map)
--- a/system.lsp
+++ b/system.lsp
@@ -616,20 +616,21 @@
 (define (trace sym)
   (let* ((func (top-level-value sym))
          (args (gensym)))
-    (if (not (traced? func))
-        (set-top-level-value! sym
-                              (eval
-                               `(λ ,args
+    (when (not (traced? func))
+      (set-top-level-value! sym
+                            (eval
+                              `(λ ,args
                                   (begin (write (cons ',sym ,args))
                                          (newline)
                                          (apply ',func ,args)))))))
-  'ok)
+  (void))
 
 (define (untrace sym)
   (let ((func (top-level-value sym)))
-    (if (traced? func)
-        (set-top-level-value! sym
-                              (aref (function:vals func) 2)))))
+    (when (traced? func)
+      (set-top-level-value! sym
+                            (aref (function:vals func) 3))))
+  (void))
 
 (define-macro (time expr)
   (let ((t0 (gensym)))