ref: f33ad9348d36f8809fc8af9b8d4dd03062b9bbc0
parent: 8eb100a3cf52ee288ba5643020152c1ff838ab4a
author: JeffBezanson <[email protected]>
date: Fri Dec 11 14:12:10 EST 2009
fixing some numeric typedefs to avoid conflicts in some environments
--- a/femtolisp/cvalues.c
+++ b/femtolisp/cvalues.c
@@ -242,7 +242,7 @@
static int cvalue_##ctype##_init(fltype_t *type, value_t arg, \
void *dest) \
{ \
- ctype##_t n=0; \
+ fl_##ctype##_t n=0; \
(void)type; \
if (isfixnum(arg)) { \
n = numval(arg); \
@@ -250,12 +250,12 @@
else if (iscprim(arg)) { \
cprim_t *cp = (cprim_t*)ptr(arg); \
void *p = cp_data(cp); \
- n = (ctype##_t)conv_to_##cnvt(p, cp_numtype(cp)); \
+ n = (fl_##ctype##_t)conv_to_##cnvt(p, cp_numtype(cp)); \
} \
else { \
return 1; \
} \
- *((ctype##_t*)dest) = n; \
+ *((fl_##ctype##_t*)dest) = n; \
return 0; \
}
num_init(int8, int32, T_INT8)
@@ -273,7 +273,7 @@
value_t cvalue_##typenam(value_t *args, u_int32_t nargs) \
{ \
if (nargs==0) { PUSH(fixnum(0)); args = &Stack[SP-1]; } \
- value_t cp = cprim(typenam##type, sizeof(ctype##_t)); \
+ value_t cp = cprim(typenam##type, sizeof(fl_##ctype##_t)); \
if (cvalue_##ctype##_init(typenam##type, \
args[0], cp_data((cprim_t*)ptr(cp)))) \
type_error(#typenam, "number", args[0]); \
@@ -281,10 +281,10 @@
}
#define num_ctor_ctor(typenam, ctype, tag) \
-value_t mk_##typenam(ctype##_t n) \
+value_t mk_##typenam(fl_##ctype##_t n) \
{ \
- value_t cp = cprim(typenam##type, sizeof(ctype##_t)); \
- *(ctype##_t*)cp_data((cprim_t*)ptr(cp)) = n; \
+ value_t cp = cprim(typenam##type, sizeof(fl_##ctype##_t)); \
+ *(fl_##ctype##_t*)cp_data((cprim_t*)ptr(cp)) = n; \
return cp; \
}
@@ -1005,7 +1005,7 @@
setc(emptystringsym, cvalue_static_cstring(""));
}
-#define RETURN_NUM_AS(var, type) return(mk_##type((type##_t)var))
+#define RETURN_NUM_AS(var, type) return(mk_##type((fl_##type##_t)var))
value_t return_from_uint64(uint64_t Uaccum)
{
--- a/femtolisp/flisp.h
+++ b/femtolisp/flisp.h
@@ -242,14 +242,22 @@
(iscprim(v) ? cp_data((cprim_t*)ptr(v)) : cv_data((cvalue_t*)ptr(v)))
/* C type names corresponding to cvalues type names */
-typedef unsigned long ulong;
-typedef unsigned int uint;
-typedef unsigned char uchar;
-typedef char char_t;
-typedef long long_t;
+typedef int8_t fl_int8_t;
+typedef uint8_t fl_uint8_t;
+typedef int16_t fl_int16_t;
+typedef uint16_t fl_uint16_t;
+typedef int32_t fl_int32_t;
+typedef uint32_t fl_uint32_t;
+typedef int64_t fl_int64_t;
+typedef uint64_t fl_uint64_t;
+typedef char fl_char_t;
+typedef char char_t;
+typedef long fl_long_t;
+typedef long long_t;
+typedef unsigned long fl_ulong_t;
typedef unsigned long ulong_t;
-typedef double double_t;
-typedef float float_t;
+typedef double fl_double_t;
+typedef float fl_float_t;
typedef value_t (*builtin_t)(value_t*, uint32_t);
@@ -293,8 +301,8 @@
fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab,
cvinitfunc_t init);
-value_t mk_double(double_t n);
-value_t mk_float(float_t n);
+value_t mk_double(fl_double_t n);
+value_t mk_float(fl_float_t n);
value_t mk_uint32(uint32_t n);
value_t mk_uint64(uint64_t n);
value_t mk_wchar(int32_t n);