lua.cpp File Reference

#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.

Classes

struct  Smain

Defines

#define lua_c
#define notail(x)   {if ((x)[2] != '\0') return -1;}

Functions

static void lstop (lua_State *L, lua_Debug *ar)
static void laction (int i)
static void print_usage (void)
static void l_message (const char *pname, const char *msg)
static int report (lua_State *L, int status)
static int traceback (lua_State *L)
static int docall (lua_State *L, int narg, int clear)
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 *pi, int *pv, int *pe)
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_StateglobalL = NULL
static const char * progname = LUA_PROGNAME


Define Documentation

#define lua_c

Definition at line 13 of file lua.cpp.

#define notail ( x   )     {if ((x)[2] != '\0') return -1;}

Definition at line 256 of file lua.cpp.

Referenced by collectargs().


Function Documentation

static int collectargs ( char **  argv,
int *  pi,
int *  pv,
int *  pe 
) [static]

Definition at line 259 of file lua.cpp.

References notail, and NULL.

Referenced by pmain().

static int docall ( lua_State L,
int  narg,
int  clear 
) [static]

Definition at line 94 of file lua.cpp.

References laction(), lua_gc(), LUA_GCCOLLECT, lua_gettop(), lua_insert(), LUA_MULTRET, lua_pcall(), lua_pushcfunction, lua_remove(), and traceback().

Referenced by dofile(), dostring(), dotty(), and handle_script().

static int dofile ( lua_State L,
const char *  name 
) [static]

Definition at line 132 of file lua.cpp.

References docall(), luaL_loadfile(), and report().

Referenced by handle_luainit(), and pmain().

static int dolibrary ( lua_State L,
const char *  name 
) [static]

Definition at line 144 of file lua.cpp.

References lua_getglobal, lua_pcall(), lua_pushstring(), and report().

Referenced by runargs().

static int dostring ( lua_State L,
const char *  s,
const char *  name 
) [static]

Definition at line 138 of file lua.cpp.

References docall(), luaL_loadbuffer(), report(), and LangStringUtil::strlen().

Referenced by handle_luainit(), and runargs().

static void dotty ( lua_State L  )  [static]

Definition at line 214 of file lua.cpp.

References docall(), l_message(), loadline(), lua_getglobal, lua_gettop(), lua_insert(), lua_pcall(), lua_pushfstring(), LUA_QL, lua_settop(), lua_tostring, NULL, progname, and report().

Referenced by pmain().

static const char* get_prompt ( lua_State L,
int  firstline 
) [static]

Definition at line 151 of file lua.cpp.

References lua_getfield(), LUA_GLOBALSINDEX, lua_pop, lua_tostring, and NULL.

Referenced by pushline().

static int getargs ( lua_State L,
char **  argv,
int  n 
) [static]

Definition at line 114 of file lua.cpp.

References lua_createtable(), lua_pushstring(), lua_rawseti(), and luaL_checkstack().

Referenced by handle_script().

static int handle_luainit ( lua_State L  )  [static]

Definition at line 321 of file lua.cpp.

References dofile(), dostring(), LUA_INIT, and NULL.

Referenced by pmain().

static int handle_script ( lua_State L,
char **  argv,
int  n 
) [static]

Definition at line 237 of file lua.cpp.

References docall(), getargs(), lua_insert(), lua_pop, lua_setglobal, luaL_loadfile(), NULL, report(), and LangStringUtil::strcmp().

Referenced by pmain().

static int incomplete ( lua_State L,
int  status 
) [static]

Definition at line 161 of file lua.cpp.

References LUA_ERRSYNTAX, lua_pop, LUA_QL, lua_tolstring(), and LangStringUtil::strstr().

Referenced by loadline().

static void l_message ( const char *  pname,
const char *  msg 
) [static]

Definition at line 58 of file lua.cpp.

Referenced by dotty(), main(), print_version(), and report().

static void laction ( int  i  )  [static]

Definition at line 35 of file lua.cpp.

References lstop(), LUA_MASKCALL, LUA_MASKCOUNT, LUA_MASKRET, and lua_sethook().

Referenced by docall().

static int loadline ( lua_State L  )  [static]

Definition at line 194 of file lua.cpp.

References incomplete(), lua_concat(), lua_insert(), lua_pushliteral, lua_remove(), lua_settop(), lua_strlen, lua_tostring, luaL_loadbuffer(), and pushline().

Referenced by dotty().

static void lstop ( lua_State L,
lua_Debug ar 
) [static]

Definition at line 28 of file lua.cpp.

References lua_sethook(), luaL_error(), and NULL.

Referenced by laction().

int main ( int  argc,
char **  argv 
)

Definition at line 375 of file lua.cpp.

References Smain::argc, Smain::argv, l_message(), lua_close(), lua_cpcall(), lua_open, NULL, pmain(), report(), and Smain::status.

static int pmain ( lua_State L  )  [static]

Definition at line 338 of file lua.cpp.

References Smain::argc, Smain::argv, collectargs(), dofile(), dotty(), handle_luainit(), handle_script(), lua_gc(), LUA_GCRESTART, LUA_GCSTOP, lua_touserdata(), luaL_openlibs(), NULL, print_usage(), print_version(), progname, runargs(), and Smain::status.

Referenced by main().

static void print_usage ( void   )  [static]

Definition at line 42 of file lua.cpp.

References LUA_QL, and progname.

Referenced by pmain().

static void print_version ( void   )  [static]

Definition at line 109 of file lua.cpp.

References l_message(), LUA_COPYRIGHT, LUA_RELEASE, and NULL.

Referenced by pmain().

static int pushline ( lua_State L,
int  firstline 
) [static]

Definition at line 175 of file lua.cpp.

References get_prompt(), lua_pushfstring(), lua_pushstring(), and LangStringUtil::strlen().

Referenced by loadline().

static int report ( lua_State L,
int  status 
) [static]

Definition at line 65 of file lua.cpp.

References l_message(), lua_isnil, lua_pop, lua_tostring, NULL, and progname.

Referenced by dofile(), dolibrary(), dostring(), dotty(), handle_script(), and main().

static int runargs ( lua_State L,
char **  argv,
int  n 
) [static]

Definition at line 292 of file lua.cpp.

References chunk(), dolibrary(), dostring(), lua_assert, and NULL.

Referenced by pmain().

static int traceback ( lua_State L  )  [static]

Definition at line 76 of file lua.cpp.

References lua_call(), lua_getfield(), LUA_GLOBALSINDEX, lua_isfunction, lua_istable, lua_pop, lua_pushinteger(), and lua_pushvalue().

Referenced by docall().


Variable Documentation

lua_State* globalL = NULL [static]

Definition at line 22 of file lua.cpp.

const char* progname = LUA_PROGNAME [static]

Definition at line 24 of file lua.cpp.

Referenced by cannot(), doargs(), dotty(), fatal(), pmain(), print_usage(), report(), and usage().


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3