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) LJLIB_CF(io_tmpfile) { IOFileUD *iof = io_file_new(L); +#if LJ_TARGET_PS3 + iof->fp = NULL; errno = ENOSYS; +#else iof->fp = tmpfile(); +#endif return iof->fp != NULL ? 1 : io_pushresult(L, 0, NULL); } 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) LJLIB_CF(os_execute) { +#if LJ_TARGET_CONSOLE + lua_pushinteger(L, -1); +#else lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); +#endif return 1; } @@ -86,7 +90,11 @@ LJLIB_CF(os_tmpname) LJLIB_CF(os_getenv) { +#if LJ_TARGET_CONSOLE + lua_pushnil(L); +#else lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ +#endif return 1; } 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) static void setpath(lua_State *L, const char *fieldname, const char *envname, const char *def) { +#if LJ_TARGET_CONSOLE + const char *path = NULL; +#else const char *path = getenv(envname); +#endif if (path == NULL) { lua_pushstring(L, def); } 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; #define LJ_NOINLINE __attribute__((noinline)) #if defined(__ELF__) || defined(__MACH__) -#if !((defined(__sun__) && defined(__svr4__)) || defined(__solaris__)) +#if !((defined(__sun__) && defined(__svr4__)) || defined(__solaris__) || defined(__CELLOS_LV2__)) #define LJ_NOAPI extern __attribute__((visibility("hidden"))) #endif #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 @@ /* Names for the CPU-specific flags. Must match the order above. */ #define JIT_F_CPU_FIRST JIT_F_ARMV6 #define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7" +#elif LJ_TARGET_PPC +#define JIT_F_PPC64 0x00000010 +#define JIT_F_SQRT 0x00000020 +#define JIT_F_ROUND 0x00000040 +#define JIT_F_CELL 0x00000080 +#define JIT_F_XENON 0x00000100 + +/* Names for the CPU-specific flags. Must match the order above. */ +#define JIT_F_CPU_FIRST JIT_F_PPC64 +#define JIT_F_CPUSTRING "\5PPC64\4SQRT\5ROUND\4CELL\5XENON" #elif LJ_TARGET_MIPS #define JIT_F_MIPS32R2 0x00000010 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 @@ ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h */ -#include #include #include #include @@ -34,9 +33,14 @@ #define lua_stdin_is_tty() 1 #endif +#if !LJ_TARGET_CONSOLE +#include +#endif + static lua_State *globalL = NULL; static const char *progname = LUA_PROGNAME; +#if !LJ_TARGET_CONSOLE static void lstop(lua_State *L, lua_Debug *ar) { (void)ar; /* unused arg. */ @@ -53,6 +57,7 @@ static void laction(int i) terminate process (default action) */ lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); } +#endif static void print_usage(void) { @@ -122,9 +127,13 @@ static int docall(lua_State *L, int narg, int clear) int base = lua_gettop(L) - narg; /* function index */ lua_pushcfunction(L, traceback); /* push traceback function */ lua_insert(L, base); /* put it under chunk and args */ +#if !LJ_TARGET_CONSOLE signal(SIGINT, laction); +#endif status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); +#if !LJ_TARGET_CONSOLE signal(SIGINT, SIG_DFL); +#endif lua_remove(L, base); /* remove traceback function */ /* force a complete garbage collection in case of errors */ if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); @@ -484,7 +493,11 @@ static int runargs(lua_State *L, char **argv, int n) static int handle_luainit(lua_State *L) { +#if LJ_TARGET_CONSOLE + const char *init = NULL; +#else const char *init = getenv(LUA_INIT); +#endif if (init == NULL) return 0; /* status OK */ else if (init[0] == '@')