From 7883a5de0b22fcb25d78e333d740bad8153004d4 Mon Sep 17 00:00:00 2001 From: JeffBezanson Date: Tue, 24 Feb 2009 18:31:05 +0000 Subject: [PATCH] fixing ambiguity in reading hex numbers and floating point making print robust against the undefined value --- femtolisp/print.c | 1 + femtolisp/read.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/femtolisp/print.c b/femtolisp/print.c index 670d333..955c6a9 100644 --- a/femtolisp/print.c +++ b/femtolisp/print.c @@ -375,6 +375,7 @@ void fl_print_child(ios_t *f, value_t v, int princ) break; case TAG_CVALUE: case TAG_CPRIM: + if (v == UNBOUND) { HPOS+=ios_printf(f, "#"); break; } case TAG_VECTOR: case TAG_CONS: if ((label=(value_t)ptrhash_get(&printconses, (void*)v)) != diff --git a/femtolisp/read.c b/femtolisp/read.c index 32c331a..3ef5dbe 100644 --- a/femtolisp/read.c +++ b/femtolisp/read.c @@ -26,7 +26,8 @@ static int isnumtok_base(char *tok, value_t *pval, int base) 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);