Permalink
Browse files

Add support for complex numbers

  • Loading branch information...
1 parent 74e621b commit 43f7560a3e16c3a58396e09253c31fc0384034f3 @jmckaskill jmckaskill committed Apr 10, 2012
Showing with 873 additions and 367 deletions.
  1. +1 −1 Makefile
  2. +12 −23 call.c
  3. +172 −46 call_x86.dasc
  4. +3 −3 ctype.c
  5. +518 −267 ffi.c
  6. +54 −14 ffi.h
  7. +2 −2 msvcbuild.bat
  8. +14 −2 parser.c
  9. +50 −4 test.c
  10. +47 −5 test.lua
View
@@ -8,7 +8,7 @@ LUA=../lua-5.2.0/src/lua
LUA_CFLAGS=-I../lua-5.2.0/src
SOCFLAGS=-fPIC
SOCC=$(CC) -shared $(SOCFLAGS)
-CFLAGS=-fPIC -g -Wall -Werror $(LUA_CFLAGS) -fvisibility=hidden -Wno-unused-function
+CFLAGS=-O2 -fPIC -g -Wall -Werror $(LUA_CFLAGS) -fvisibility=hidden -Wno-unused-function --std=gnu99
MODNAME=ffi
MODSO=$(MODNAME).so
View
35 call.c
@@ -17,18 +17,6 @@ static void push_uint(lua_State* L, unsigned int val)
static void push_float(lua_State* L, float val)
{ lua_pushnumber(L, val); }
-static void print(lua_State* L, int** p, size_t sz)
-{
- size_t i;
- lua_getglobal(L, "print");
- lua_pushfstring(L, "%p", p);
- for (i = 0; i < sz; i++) {
- lua_pushfstring(L, " %p", p[i]);
- }
- lua_concat(L, (int) sz + 1);
- lua_call(L, 1, 0);
-}
-
#ifndef _WIN32
static int GetLastError(void)
{ return errno; }
@@ -157,17 +145,18 @@ static void* reserve_code(struct jit* jit, lua_State* L, size_t sz)
lua_pushcfunction(L, (lua_CFunction) func); \
lua_rawset(L, -3)
- ADDFUNC(NULL, print);
- ADDFUNC(NULL, to_double);
- ADDFUNC(NULL, to_float);
- ADDFUNC(NULL, to_uint64);
- ADDFUNC(NULL, to_int64);
- ADDFUNC(NULL, to_int32);
- ADDFUNC(NULL, to_uint32);
- ADDFUNC(NULL, to_uintptr);
- ADDFUNC(NULL, to_enum);
- ADDFUNC(NULL, to_typed_pointer);
- ADDFUNC(NULL, to_typed_cfunction);
+ ADDFUNC(NULL, check_double);
+ ADDFUNC(NULL, check_float);
+ ADDFUNC(NULL, check_uint64);
+ ADDFUNC(NULL, check_int64);
+ ADDFUNC(NULL, check_int32);
+ ADDFUNC(NULL, check_uint32);
+ ADDFUNC(NULL, check_uintptr);
+ ADDFUNC(NULL, check_enum);
+ ADDFUNC(NULL, check_typed_pointer);
+ ADDFUNC(NULL, check_typed_cfunction);
+ ADDFUNC(NULL, check_complex_double);
+ ADDFUNC(NULL, check_complex_float);
ADDFUNC(NULL, unpack_varargs_stack);
ADDFUNC(NULL, unpack_varargs_stack_skip);
ADDFUNC(NULL, unpack_varargs_reg);
Oops, something went wrong.

0 comments on commit 43f7560

Please sign in to comment.