shithub: femtolisp

Download patch

ref: 3bac64cbd7fd550f2741bf533dfa7d54f6f6708b
parent: 271cf34e9911bc44c7dd0777c7ad4491d3a9580b
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Tue May 4 19:54:07 EDT 2010

print improvements


--- a/femtolisp/print.c
+++ b/femtolisp/print.c
@@ -168,7 +168,8 @@
         return (u8_strwidth(symbol_name(v)) < SMALL_STR_LEN);
     if (fl_isstring(v))
         return (cv_len((cvalue_t*)ptr(v)) < SMALL_STR_LEN);
-    return (isfixnum(v) || isbuiltin(v));
+    return (isfixnum(v) || isbuiltin(v) || v==FL_F || v==FL_T || v==FL_NIL ||
+            v == FL_EOF);
 }
 
 static int smallp(value_t v)
@@ -757,5 +758,8 @@
         memset(consflags, 0, 4*bitvector_nwords(heapsize/sizeof(cons_t)));
     }
 
-    htable_reset(&printconses, 32);
+    if ((iscons(v) || isvector(v) || isfunction(v) || iscvalue(v)) &&
+        !fl_isstring(v) && v!=FL_T && v!=FL_F && v!=FL_NIL) {
+        htable_reset(&printconses, 32);
+    }
 }
--- a/femtolisp/todo
+++ b/femtolisp/todo
@@ -1189,3 +1189,11 @@
 - bitwise and logical ops
 - making a closure in a default value expression for an optional arg
 - gc during a catch block, then get stack trace
+
+-----------------------------------------------------------------------------
+
+5/4/10 todo:
+
+- flush and close open files on exit
+- make function versions of opcode builtins by wrapping in a lambda,
+  stored in a table indexed by opcode. use in _applyn