#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Go to the source code of this file.
Macros | |
#define | lua_c |
#define | LUA_PROMPT "> " |
#define | LUA_PROMPT2 ">> " |
#define | LUA_PROGNAME "lua" |
#define | LUA_MAXINPUT 512 |
#define | LUA_INIT "LUA_INIT" |
#define | LUA_INITVERSION LUA_INIT "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR |
#define | lua_stdin_is_tty() 1 /* assume stdin is a tty */ |
#define | lua_readline(L, b, p) |
#define | lua_saveline(L, idx) { (void)L; (void)idx; } |
#define | lua_freeline(L, b) { (void)L; (void)b; } |
#define | EOFMARK "<eof>" |
#define | marklen (sizeof(EOFMARK)/sizeof(char) - 1) |
#define | noextrachars(x) {if ((x)[2] != '\0') return -1;} |
#define | has_i 0 /* -i */ |
#define | has_v 1 /* -v */ |
#define | has_e 2 /* -e */ |
#define | has_E 3 /* -E */ |
#define | num_has 4 /* number of 'has_*' */ |
Functions | |
static void | lstop (lua_State *L, lua_Debug *ar) |
static void | laction (int i) |
static void | print_usage (const char *badoption) |
static void | l_message (const char *pname, const char *msg) |
static int | report (lua_State *L, int status) |
static void | finalreport (lua_State *L, int status) |
static int | traceback (lua_State *L) |
static int | docall (lua_State *L, int narg, int nres) |
static void | print_version (void) |
static int | getargs (lua_State *L, char **argv, int n) |
static int | dofile (lua_State *L, const char *name) |
static int | dostring (lua_State *L, const char *s, const char *name) |
static int | dolibrary (lua_State *L, const char *name) |
static const char * | get_prompt (lua_State *L, int firstline) |
static int | incomplete (lua_State *L, int status) |
static int | pushline (lua_State *L, int firstline) |
static int | loadline (lua_State *L) |
static void | dotty (lua_State *L) |
static int | handle_script (lua_State *L, char **argv, int n) |
static int | collectargs (char **argv, int *args) |
static int | runargs (lua_State *L, char **argv, int n) |
static int | handle_luainit (lua_State *L) |
static int | pmain (lua_State *L) |
int | main (int argc, char **argv) |
Variables | |
static lua_State * | globalL = NULL |
static const char * | progname = LUA_PROGNAME |
#define EOFMARK "<eof>" |
Definition at line 243 of file lua.cpp.
Referenced by incomplete().
#define has_e 2 /* -e */ |
Definition at line 350 of file lua.cpp.
Referenced by collectargs(), and pmain().
#define has_E 3 /* -E */ |
Definition at line 351 of file lua.cpp.
Referenced by collectargs(), and pmain().
#define has_i 0 /* -i */ |
Definition at line 348 of file lua.cpp.
Referenced by collectargs(), and pmain().
#define has_v 1 /* -v */ |
Definition at line 349 of file lua.cpp.
Referenced by collectargs(), and pmain().
Definition at line 80 of file lua.cpp.
Referenced by pushline().
#define LUA_INIT "LUA_INIT" |
Definition at line 34 of file lua.cpp.
Referenced by handle_luainit().
#define LUA_INITVERSION LUA_INIT "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR |
Definition at line 37 of file lua.cpp.
Referenced by handle_luainit().
#define LUA_MAXINPUT 512 |
Definition at line 30 of file lua.cpp.
Referenced by pushline().
#define LUA_PROMPT "> " |
Definition at line 21 of file lua.cpp.
Referenced by get_prompt().
#define LUA_PROMPT2 ">> " |
Definition at line 22 of file lua.cpp.
Referenced by get_prompt().
Definition at line 79 of file lua.cpp.
Referenced by loadline().
#define lua_stdin_is_tty | ( | ) | 1 /* assume stdin is a tty */ |
#define marklen (sizeof(EOFMARK)/sizeof(char) - 1) |
Definition at line 244 of file lua.cpp.
Referenced by incomplete().
Definition at line 344 of file lua.cpp.
Referenced by collectargs().
#define num_has 4 /* number of 'has_*' */ |
Definition at line 171 of file lua.cpp.
References laction(), lua_gettop(), lua_insert(), lua_pcall, lua_pushcfunction, lua_remove(), and traceback().
Referenced by dofile(), dolibrary(), dostring(), dotty(), and handle_script().
Definition at line 209 of file lua.cpp.
References docall(), LUA_OK, luaL_loadfile, and report().
Referenced by handle_luainit(), and pmain().
Definition at line 223 of file lua.cpp.
References docall(), lua_getglobal(), LUA_OK, lua_pushstring(), lua_setglobal(), and report().
Referenced by runargs().
Definition at line 216 of file lua.cpp.
References docall(), LUA_OK, luaL_loadbuffer, and report().
Referenced by handle_luainit(), and runargs().
Definition at line 302 of file lua.cpp.
References docall(), l_message(), loadline(), lua_getglobal(), lua_gettop(), lua_insert(), LUA_MINSTACK, LUA_MULTRET, LUA_OK, lua_pcall, lua_pushfstring(), LUA_QL, lua_settop(), lua_tostring, luaL_checkstack(), progname, and report().
Referenced by pmain().
Definition at line 148 of file lua.cpp.
References l_message(), LUA_OK, lua_pop, lua_tostring, LUA_TSTRING, lua_type(), game_logic::msg(), and progname.
Referenced by main().
Definition at line 234 of file lua.cpp.
References lua_getglobal(), LUA_PROMPT, LUA_PROMPT2, and lua_tostring.
Referenced by pushline().
Definition at line 191 of file lua.cpp.
References i, lua_createtable(), lua_pushstring(), lua_rawseti(), and luaL_checkstack().
Referenced by handle_script().
Definition at line 422 of file lua.cpp.
References dofile(), dostring(), ai::registry::init(), LUA_INIT, LUA_INITVERSION, and LUA_OK.
Referenced by pmain().
Definition at line 325 of file lua.cpp.
References docall(), getargs(), lua_insert(), LUA_MULTRET, LUA_OK, lua_pop, lua_setglobal(), luaL_loadfile, and report().
Referenced by pmain().
Definition at line 246 of file lua.cpp.
References EOFMARK, LUA_ERRSYNTAX, lua_pop, lua_tolstring(), marklen, and game_logic::msg().
Referenced by loadline().
|
static |
Definition at line 128 of file lua.cpp.
References luai_writestringerror.
Referenced by dotty(), finalreport(), main(), and report().
Definition at line 100 of file lua.cpp.
References lstop(), LUA_MASKCALL, LUA_MASKCOUNT, LUA_MASKRET, and lua_sethook().
Referenced by docall().
Definition at line 280 of file lua.cpp.
References incomplete(), lua_concat(), lua_insert(), lua_pushliteral, lua_remove(), lua_saveline, lua_settop(), lua_tolstring(), luaL_loadbuffer, and pushline().
Referenced by dotty().
Definition at line 93 of file lua.cpp.
References lua_sethook(), and luaL_error().
Referenced by laction().
Definition at line 479 of file lua.cpp.
References finalreport(), l_message(), lua_close(), LUA_OK, lua_pcall, lua_pushcfunction, lua_pushinteger(), lua_pushlightuserdata(), lua_toboolean(), luaL_newstate(), and pmain().
Definition at line 437 of file lua.cpp.
References collectargs(), dofile(), dotty(), handle_luainit(), handle_script(), has_e, has_E, has_i, has_v, int(), lua_gc(), LUA_GCRESTART, LUA_GCSTOP, LUA_OK, lua_pushboolean(), LUA_REGISTRYINDEX, lua_setfield(), lua_stdin_is_tty, lua_tointeger, lua_touserdata(), luaL_checkversion, luaL_openlibs(), num_has, print_usage(), print_version(), progname, and runargs().
Referenced by main().
|
static |
Definition at line 259 of file lua.cpp.
References get_prompt(), lua_freeline, LUA_MAXINPUT, lua_pop, lua_pushfstring(), lua_pushstring(), and lua_readline.
Referenced by loadline().
Definition at line 134 of file lua.cpp.
References l_message(), lua_gc(), LUA_GCCOLLECT, lua_isnil, LUA_OK, lua_pop, lua_tostring, game_logic::msg(), and progname.
Referenced by events::console_handler::do_controller(), dofile(), dolibrary(), dostring(), dotty(), handle_script(), game_config_manager::load_addons_cfg(), display::refresh_report(), campaign_controller::show_carryover_message(), and unit_side().
Definition at line 394 of file lua.cpp.
References dolibrary(), dostring(), i, lua_assert, and LUA_OK.
Referenced by pmain().
Definition at line 159 of file lua.cpp.
References lua_isnoneornil, lua_pushliteral, lua_tostring, luaL_callmeta(), luaL_traceback(), and game_logic::msg().
Referenced by docall().
|
static |
Definition at line 89 of file lua.cpp.
Referenced by dotty(), finalreport(), pmain(), print_usage(), and report().