]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
CONSOLE: Handle unimplemented features for console toolchains.
authorMike Pall <mike>
Sat, 9 Jun 2012 18:54:34 +0000 (20:54 +0200)
committerMike Pall <mike>
Sat, 9 Jun 2012 18:54:34 +0000 (20:54 +0200)
src/lib_io.c
src/lib_os.c
src/lib_package.c
src/lj_def.h
src/lj_jit.h
src/luajit.c

index 6078e74d38b375ffa548064815dcde39d13e0edd..90bc863bc2174d316921120f1faffc9c2e9c4fcf 100644 (file)
@@ -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);
 }
 
index a3c951baa25d00f8194c087b55f55e69a0e9c346..e968d5d5f6b67f496664bc1c193daca315a7dabe 100644 (file)
@@ -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;
 }
 
index e8ea740ff7f24b47c404c97fe68f49d3133ea29d..57344cd407769e52e07c6d85b59fa51cb1027d63 100644 (file)
@@ -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 {
index e00ed939626070076337aad4677156b3d9c81aea..876ce95fb783c99dfcea9fbc819439b23b3ffe5e 100644 (file)
@@ -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
index dd0c08d8492fbe30f210a0c3c990bb597505359d..6d317a9e79cbbcc8ac2b89d0f33a7be8394b2b03 100644 (file)
 /* 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
 
index b4044d22695e2b442b92d1d628435b326c50a0c4..b7d9d0c131508cf8004a7b963e11456604307dfe 100644 (file)
@@ -6,7 +6,6 @@
 ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
 */
 
-#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #define lua_stdin_is_tty()     1
 #endif
 
+#if !LJ_TARGET_CONSOLE
+#include <signal.h>
+#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] == '@')