shithub: femtolisp

Download patch

ref: 71a1cb6f091796b398430a05850ae2b14d52ea05
parent: 2bc8ab38fd19b309fb68fb277456caf21b3a9620
author: Jeff Bezanson <[email protected]>
date: Thu Oct 11 19:00:29 EDT 2012

update tiny/lisp.c for 64-bit

--- a/tiny/lisp.c
+++ b/tiny/lisp.c
@@ -26,8 +26,13 @@
 #include <ctype.h>
 #include <sys/types.h>
 
+#ifdef __LP64__
+typedef u_int64_t value_t;
+typedef int64_t number_t;
+#else
 typedef u_int32_t value_t;
 typedef int32_t number_t;
+#endif
 
 typedef struct {
     value_t car;
@@ -496,7 +501,7 @@
     value_t cd;
 
     switch (tag(v)) {
-    case TAG_NUM: fprintf(f, "%d", numval(v)); break;
+    case TAG_NUM: fprintf(f, "%ld", numval(v)); break;
     case TAG_SYM: fprintf(f, "%s", ((symbol_t*)ptr(v))->name); break;
     case TAG_BUILTIN: fprintf(f, "#<builtin %s>",
                               builtin_names[intval(v)]); break;
@@ -558,7 +563,7 @@
             lerror("eval: error: variable %s has no value\n", sym->name);
         return v;
     }
-    if ((unsigned)(char*)&nargs < (unsigned)stack_bottom || SP>=(N_STACK-100))
+    if ((unsigned long)(char*)&nargs < (unsigned long)stack_bottom || SP>=(N_STACK-100))
         lerror("eval: error: stack overflow\n");
     saveSP = SP;
     PUSH(e);