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);
}
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;
}
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;
}
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 {
#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
/* 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
** 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. */
terminate process (default action) */
lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
}
+#endif
static void print_usage(void)
{
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);
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] == '@')