diff options
author | Mike Pall <mike> | 2012-06-09 20:54:34 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-06-09 20:54:34 +0200 |
commit | 37be8a54785b893f531679adb0b479a426938504 (patch) | |
tree | 933b0320e158361c69fa5f4332247d201eb02187 /src | |
parent | 9f443e8b8919e094100bf1eb94981aec905be783 (diff) | |
download | luajit-37be8a54785b893f531679adb0b479a426938504.tar.gz luajit-37be8a54785b893f531679adb0b479a426938504.tar.bz2 luajit-37be8a54785b893f531679adb0b479a426938504.zip |
CONSOLE: Handle unimplemented features for console toolchains.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib_io.c | 4 | ||||
-rw-r--r-- | src/lib_os.c | 8 | ||||
-rw-r--r-- | src/lib_package.c | 4 | ||||
-rw-r--r-- | src/lj_def.h | 2 | ||||
-rw-r--r-- | src/lj_jit.h | 10 | ||||
-rw-r--r-- | src/luajit.c | 15 |
6 files changed, 41 insertions, 2 deletions
diff --git a/src/lib_io.c b/src/lib_io.c index 6078e74d..90bc863b 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
@@ -412,7 +412,11 @@ LJLIB_CF(io_popen) | |||
412 | LJLIB_CF(io_tmpfile) | 412 | LJLIB_CF(io_tmpfile) |
413 | { | 413 | { |
414 | IOFileUD *iof = io_file_new(L); | 414 | IOFileUD *iof = io_file_new(L); |
415 | #if LJ_TARGET_PS3 | ||
416 | iof->fp = NULL; errno = ENOSYS; | ||
417 | #else | ||
415 | iof->fp = tmpfile(); | 418 | iof->fp = tmpfile(); |
419 | #endif | ||
416 | return iof->fp != NULL ? 1 : io_pushresult(L, 0, NULL); | 420 | return iof->fp != NULL ? 1 : io_pushresult(L, 0, NULL); |
417 | } | 421 | } |
418 | 422 | ||
diff --git a/src/lib_os.c b/src/lib_os.c index a3c951ba..e968d5d5 100644 --- a/src/lib_os.c +++ b/src/lib_os.c | |||
@@ -47,7 +47,11 @@ static int os_pushresult(lua_State *L, int i, const char *filename) | |||
47 | 47 | ||
48 | LJLIB_CF(os_execute) | 48 | LJLIB_CF(os_execute) |
49 | { | 49 | { |
50 | #if LJ_TARGET_CONSOLE | ||
51 | lua_pushinteger(L, -1); | ||
52 | #else | ||
50 | lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); | 53 | lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); |
54 | #endif | ||
51 | return 1; | 55 | return 1; |
52 | } | 56 | } |
53 | 57 | ||
@@ -86,7 +90,11 @@ LJLIB_CF(os_tmpname) | |||
86 | 90 | ||
87 | LJLIB_CF(os_getenv) | 91 | LJLIB_CF(os_getenv) |
88 | { | 92 | { |
93 | #if LJ_TARGET_CONSOLE | ||
94 | lua_pushnil(L); | ||
95 | #else | ||
89 | lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ | 96 | lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ |
97 | #endif | ||
90 | return 1; | 98 | return 1; |
91 | } | 99 | } |
92 | 100 | ||
diff --git a/src/lib_package.c b/src/lib_package.c index e8ea740f..57344cd4 100644 --- a/src/lib_package.c +++ b/src/lib_package.c | |||
@@ -519,7 +519,11 @@ static int lj_cf_package_seeall(lua_State *L) | |||
519 | static void setpath(lua_State *L, const char *fieldname, const char *envname, | 519 | static void setpath(lua_State *L, const char *fieldname, const char *envname, |
520 | const char *def) | 520 | const char *def) |
521 | { | 521 | { |
522 | #if LJ_TARGET_CONSOLE | ||
523 | const char *path = NULL; | ||
524 | #else | ||
522 | const char *path = getenv(envname); | 525 | const char *path = getenv(envname); |
526 | #endif | ||
523 | if (path == NULL) { | 527 | if (path == NULL) { |
524 | lua_pushstring(L, def); | 528 | lua_pushstring(L, def); |
525 | } else { | 529 | } else { |
diff --git a/src/lj_def.h b/src/lj_def.h index e00ed939..876ce95f 100644 --- a/src/lj_def.h +++ b/src/lj_def.h | |||
@@ -120,7 +120,7 @@ typedef uintptr_t BloomFilter; | |||
120 | #define LJ_NOINLINE __attribute__((noinline)) | 120 | #define LJ_NOINLINE __attribute__((noinline)) |
121 | 121 | ||
122 | #if defined(__ELF__) || defined(__MACH__) | 122 | #if defined(__ELF__) || defined(__MACH__) |
123 | #if !((defined(__sun__) && defined(__svr4__)) || defined(__solaris__)) | 123 | #if !((defined(__sun__) && defined(__svr4__)) || defined(__solaris__) || defined(__CELLOS_LV2__)) |
124 | #define LJ_NOAPI extern __attribute__((visibility("hidden"))) | 124 | #define LJ_NOAPI extern __attribute__((visibility("hidden"))) |
125 | #endif | 125 | #endif |
126 | #endif | 126 | #endif |
diff --git a/src/lj_jit.h b/src/lj_jit.h index dd0c08d8..6d317a9e 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h | |||
@@ -34,6 +34,16 @@ | |||
34 | /* Names for the CPU-specific flags. Must match the order above. */ | 34 | /* Names for the CPU-specific flags. Must match the order above. */ |
35 | #define JIT_F_CPU_FIRST JIT_F_ARMV6 | 35 | #define JIT_F_CPU_FIRST JIT_F_ARMV6 |
36 | #define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7" | 36 | #define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7" |
37 | #elif LJ_TARGET_PPC | ||
38 | #define JIT_F_PPC64 0x00000010 | ||
39 | #define JIT_F_SQRT 0x00000020 | ||
40 | #define JIT_F_ROUND 0x00000040 | ||
41 | #define JIT_F_CELL 0x00000080 | ||
42 | #define JIT_F_XENON 0x00000100 | ||
43 | |||
44 | /* Names for the CPU-specific flags. Must match the order above. */ | ||
45 | #define JIT_F_CPU_FIRST JIT_F_PPC64 | ||
46 | #define JIT_F_CPUSTRING "\5PPC64\4SQRT\5ROUND\4CELL\5XENON" | ||
37 | #elif LJ_TARGET_MIPS | 47 | #elif LJ_TARGET_MIPS |
38 | #define JIT_F_MIPS32R2 0x00000010 | 48 | #define JIT_F_MIPS32R2 0x00000010 |
39 | 49 | ||
diff --git a/src/luajit.c b/src/luajit.c index b4044d22..b7d9d0c1 100644 --- a/src/luajit.c +++ b/src/luajit.c | |||
@@ -6,7 +6,6 @@ | |||
6 | ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h | 6 | ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <signal.h> | ||
10 | #include <stdio.h> | 9 | #include <stdio.h> |
11 | #include <stdlib.h> | 10 | #include <stdlib.h> |
12 | #include <string.h> | 11 | #include <string.h> |
@@ -34,9 +33,14 @@ | |||
34 | #define lua_stdin_is_tty() 1 | 33 | #define lua_stdin_is_tty() 1 |
35 | #endif | 34 | #endif |
36 | 35 | ||
36 | #if !LJ_TARGET_CONSOLE | ||
37 | #include <signal.h> | ||
38 | #endif | ||
39 | |||
37 | static lua_State *globalL = NULL; | 40 | static lua_State *globalL = NULL; |
38 | static const char *progname = LUA_PROGNAME; | 41 | static const char *progname = LUA_PROGNAME; |
39 | 42 | ||
43 | #if !LJ_TARGET_CONSOLE | ||
40 | static void lstop(lua_State *L, lua_Debug *ar) | 44 | static void lstop(lua_State *L, lua_Debug *ar) |
41 | { | 45 | { |
42 | (void)ar; /* unused arg. */ | 46 | (void)ar; /* unused arg. */ |
@@ -53,6 +57,7 @@ static void laction(int i) | |||
53 | terminate process (default action) */ | 57 | terminate process (default action) */ |
54 | lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); | 58 | lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); |
55 | } | 59 | } |
60 | #endif | ||
56 | 61 | ||
57 | static void print_usage(void) | 62 | static void print_usage(void) |
58 | { | 63 | { |
@@ -122,9 +127,13 @@ static int docall(lua_State *L, int narg, int clear) | |||
122 | int base = lua_gettop(L) - narg; /* function index */ | 127 | int base = lua_gettop(L) - narg; /* function index */ |
123 | lua_pushcfunction(L, traceback); /* push traceback function */ | 128 | lua_pushcfunction(L, traceback); /* push traceback function */ |
124 | lua_insert(L, base); /* put it under chunk and args */ | 129 | lua_insert(L, base); /* put it under chunk and args */ |
130 | #if !LJ_TARGET_CONSOLE | ||
125 | signal(SIGINT, laction); | 131 | signal(SIGINT, laction); |
132 | #endif | ||
126 | status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); | 133 | status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); |
134 | #if !LJ_TARGET_CONSOLE | ||
127 | signal(SIGINT, SIG_DFL); | 135 | signal(SIGINT, SIG_DFL); |
136 | #endif | ||
128 | lua_remove(L, base); /* remove traceback function */ | 137 | lua_remove(L, base); /* remove traceback function */ |
129 | /* force a complete garbage collection in case of errors */ | 138 | /* force a complete garbage collection in case of errors */ |
130 | if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); | 139 | if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); |
@@ -484,7 +493,11 @@ static int runargs(lua_State *L, char **argv, int n) | |||
484 | 493 | ||
485 | static int handle_luainit(lua_State *L) | 494 | static int handle_luainit(lua_State *L) |
486 | { | 495 | { |
496 | #if LJ_TARGET_CONSOLE | ||
497 | const char *init = NULL; | ||
498 | #else | ||
487 | const char *init = getenv(LUA_INIT); | 499 | const char *init = getenv(LUA_INIT); |
500 | #endif | ||
488 | if (init == NULL) | 501 | if (init == NULL) |
489 | return 0; /* status OK */ | 502 | return 0; /* status OK */ |
490 | else if (init[0] == '@') | 503 | else if (init[0] == '@') |