shithub: femtolisp

Download patch

ref: 7883a5de0b22fcb25d78e333d740bad8153004d4
parent: 115b2843fb2d208616971f8554961bd9d2f1275a
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Tue Feb 24 13:31:05 EST 2009

fixing ambiguity in reading hex numbers and floating point
making print robust against the undefined value


--- a/femtolisp/print.c
+++ b/femtolisp/print.c
@@ -375,6 +375,7 @@
         break;
     case TAG_CVALUE:
     case TAG_CPRIM:
+      if (v == UNBOUND) { HPOS+=ios_printf(f, "#<undefined>"); break; }
     case TAG_VECTOR:
     case TAG_CONS:
         if ((label=(value_t)ptrhash_get(&printconses, (void*)v)) !=
--- a/femtolisp/read.c
+++ b/femtolisp/read.c
@@ -26,7 +26,8 @@
     double d;
     if (*tok == '\0')
         return 0;
-    if (strpbrk(tok, ".eEpP")) {
+    if (!((tok[0]=='0' && tok[1]=='x') || (base >= 15)) &&
+        strpbrk(tok, ".eEpP")) {
         d = strtod(tok, &end);
         if (*end == '\0') {
             if (pval) *pval = mk_double(d);