From d35f039ca17a5f509ab73b432b63d5edd53595cd Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Wed, 26 Nov 2008 05:03:16 -0500 Subject: [PATCH] ikrt_last_errno moved to ikarus-runtime where it belongs --- scheme/last-revision | 2 +- src/ikarus-data.h | 3 +++ src/ikarus-ffi.c | 11 ++--------- src/ikarus-pointers.c | 2 +- src/ikarus-runtime.c | 5 +++++ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/scheme/last-revision b/scheme/last-revision index 6c77d6a..9cc2f9d 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1693 +1694 diff --git a/src/ikarus-data.h b/src/ikarus-data.h index 1170308..7495abb 100644 --- a/src/ikarus-data.h +++ b/src/ikarus-data.h @@ -224,6 +224,9 @@ ikptr ik_safe_alloc(ikpcb* pcb, int size); ikptr u_to_number(unsigned long, ikpcb*); ikptr ull_to_number(unsigned long long, ikpcb*); ikptr normalize_bignum(long int limbs, int sign, ikptr r); +ikptr s_to_number(signed long x, ikpcb* pcb); +ikptr d_to_number(double x, ikpcb* pcb); +ikptr make_pointer(long x, ikpcb* pcb); #define IK_HEAP_EXT_SIZE (32 * 4096) #define IK_HEAPSIZE (1024 * ((wordsize==4)?1:2) * 4096) /* 4/8 MB */ diff --git a/src/ikarus-ffi.c b/src/ikarus-ffi.c index 781dc77..610a675 100644 --- a/src/ikarus-ffi.c +++ b/src/ikarus-ffi.c @@ -139,10 +139,6 @@ scheme_to_ffi_value_cast(ffi_type* t, ikptr nptr, ikptr p, void* r) { } -extern ikptr u_to_number(unsigned long x, ikpcb* pcb); -extern ikptr s_to_number(signed long x, ikpcb* pcb); -extern ikptr d_to_number(double x, ikpcb* pcb); -extern ikptr make_pointer(void* x, ikpcb* pcb); static ikptr ffi_to_scheme_value_cast(int n, void* p, ikpcb* pcb) { switch (n & 0xF) { @@ -157,7 +153,7 @@ ffi_to_scheme_value_cast(int n, void* p, ikpcb* pcb) { case 9: return s_to_number(*((signed long*)p), pcb); case 10: return d_to_number(*((float*)p), pcb); case 11: return d_to_number(*((double*)p), pcb); - case 12: return make_pointer(*((void**)p), pcb); + case 12: return make_pointer((long)*((void**)p), pcb); default: fprintf(stderr, "INVALID ARG %d", n); exit(-1); @@ -362,10 +358,7 @@ ikrt_ffi_call(ikptr data, ikptr argsvec, ikpcb* pcb) { return val; } -ikptr -ikrt_last_errno(ikpcb* pcb){ - return s_to_number(pcb->last_errno, pcb); -} + /* diff --git a/src/ikarus-pointers.c b/src/ikarus-pointers.c index b45c7a3..a47bb4e 100644 --- a/src/ikarus-pointers.c +++ b/src/ikarus-pointers.c @@ -37,7 +37,7 @@ ikrt_pointer_to_int(ikptr x, ikpcb* pcb) { } ikptr -make_pointer(long int x, ikpcb* pcb) { +make_pointer(long x, ikpcb* pcb) { ikptr r = ik_safe_alloc(pcb, pointer_size); ref(r, 0) = pointer_tag; ref(r, wordsize) = (ikptr)x; diff --git a/src/ikarus-runtime.c b/src/ikarus-runtime.c index 9120058..0e3456f 100644 --- a/src/ikarus-runtime.c +++ b/src/ikarus-runtime.c @@ -1096,3 +1096,8 @@ ikrt_rename_file(ikptr src, ikptr dst /* ikpcb* pcb */){ return ik_errno_to_code(); } } + +ikptr +ikrt_last_errno(ikpcb* pcb){ + return s_to_number(pcb->last_errno, pcb); +}