Defines | Functions | Variables

lua/luac.c File Reference

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lobject.h"
#include "lstate.h"
#include "lundump.h"
#include <ctype.h>
#include "ldebug.h"
#include "lopcodes.h"
Include dependency graph for luac.c:

Go to the source code of this file.

Defines

#define luac_c
#define LUA_CORE
#define luaU_print   PrintFunction
#define PROGNAME   "luac"
#define OUTPUT   PROGNAME ".out"
#define IS(s)   (strcmp(argv[i],s)==0)
#define FUNCTION   "(function()end)();"
#define toproto(L, i)   getproto(L->top+(i))
#define luac_c
#define LUA_CORE
#define VOID(p)   ((const void*)(p))
#define UPVALNAME(x)   ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-")
#define MYK(x)   (-1-(x))
#define SS(x)   ((x==1)?"":"s")
#define S(x)   (int)(x),SS(x)

Functions

static void PrintFunction (const Proto *f, int full)
static void fatal (const char *message)
static void cannot (const char *what)
static void usage (const char *message)
static int doargs (int argc, char *argv[])
static const char * reader (lua_State *L, void *ud, size_t *size)
static const Protocombine (lua_State *L, int n)
static int writer (lua_State *L, const void *p, size_t size, void *u)
static int pmain (lua_State *L)
int main (int argc, char *argv[])
static void PrintString (const TString *ts)
static void PrintConstant (const Proto *f, int i)
static void PrintCode (const Proto *f)
static void PrintHeader (const Proto *f)
static void PrintDebug (const Proto *f)

Variables

static int listing = 0
static int dumping = 1
static int stripping = 0
static char Output [] = { OUTPUT }
static const char * output = Output
static const char * progname = PROGNAME

Define Documentation

#define FUNCTION   "(function()end)();"

Definition at line 117 of file luac.c.

#define IS (   s  )     (strcmp(argv[i],s)==0)

Definition at line 67 of file luac.c.

Referenced by doargs(), and pmain().

#define LUA_CORE

Definition at line 215 of file luac.c.

#define LUA_CORE

Definition at line 215 of file luac.c.

#define luac_c

Definition at line 214 of file luac.c.

#define luac_c

Definition at line 214 of file luac.c.

#define luaU_print   PrintFunction

Definition at line 23 of file luac.c.

Referenced by pmain().

#define MYK (   x  )     (-1-(x))

Definition at line 275 of file luac.c.

Referenced by PrintCode().

#define OUTPUT   PROGNAME ".out"

Definition at line 26 of file luac.c.

#define PROGNAME   "luac"

Definition at line 25 of file luac.c.

Referenced by combine().

#define S (   x  )     (int)(x),SS(x)
#define SS (   x  )     ((x==1)?"":"s")

Definition at line 375 of file luac.c.

Referenced by PrintHeader().

#define toproto (   L,
  i 
)    getproto(L->top+(i))

Definition at line 134 of file luac.c.

Referenced by combine().

#define UPVALNAME (   x  )     ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-")

Definition at line 274 of file luac.c.

Referenced by PrintCode(), and PrintDebug().

#define VOID (   p  )     ((const void*)(p))

Definition at line 221 of file luac.c.

Referenced by PrintCode(), PrintDebug(), and PrintHeader().


Function Documentation

static void cannot ( const char *  what  )  [static]

Definition at line 41 of file luac.c.

References output, and progname.

Referenced by pmain().

Here is the caller graph for this function:

static const Proto* combine ( lua_State L,
int  n 
) [static]

Definition at line 136 of file luac.c.

References fatal(), Upvaldesc::instack, lua_load(), LUA_OK, lua_tostring, Proto::p, PROGNAME, reader(), Proto::sizelineinfo, Proto::sizeupvalues, toproto, and Proto::upvalues.

Referenced by pmain().

Here is the call graph for this function:

Here is the caller graph for this function:

static int doargs ( int  argc,
char *  argv[] 
) [static]

Definition at line 69 of file luac.c.

References dumping, IS, listing, LUA_COPYRIGHT, LUA_QL, Output, output, progname, stripping, usage(), and game_config::version.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void fatal ( const char *  message  )  [static]

Definition at line 35 of file luac.c.

References progname.

Referenced by combine(), main(), and pmain().

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 189 of file luac.c.

References doargs(), fatal(), lua_close(), LUA_OK, lua_pcall, lua_pushcfunction, lua_pushinteger(), lua_pushlightuserdata(), lua_tostring, luaL_newstate(), pmain(), and usage().

Here is the call graph for this function:

static int pmain ( lua_State L  )  [static]

Definition at line 162 of file luac.c.

References cannot(), combine(), dumping, fatal(), IS, listing, lua_checkstack(), lua_lock, LUA_OK, lua_tointeger, lua_tostring, lua_touserdata(), lua_unlock, luaL_loadfile, luaU_dump(), luaU_print, output, stripping, and writer().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void PrintCode ( const Proto f  )  [static]
static void PrintConstant ( const Proto f,
int  i 
) [static]

Definition at line 251 of file luac.c.

References bvalue, Proto::k, LUA_NUMBER_FMT, LUA_TBOOLEAN, LUA_TNIL, LUA_TNUMBER, LUA_TSTRING, nvalue, PrintString(), rawtsvalue, and ttype.

Referenced by PrintCode(), and PrintDebug().

Here is the call graph for this function:

Here is the caller graph for this function:

static void PrintDebug ( const Proto f  )  [static]

Definition at line 398 of file luac.c.

References LocVar::endpc, getstr, Upvaldesc::idx, Upvaldesc::instack, Proto::locvars, PrintConstant(), Proto::sizek, Proto::sizelocvars, Proto::sizeupvalues, LocVar::startpc, UPVALNAME, Proto::upvalues, LocVar::varname, and VOID.

Referenced by PrintFunction().

Here is the call graph for this function:

Here is the caller graph for this function:

static void PrintFunction ( const Proto f,
int  full 
) [static]

Definition at line 425 of file luac.c.

References Proto::p, PrintCode(), PrintDebug(), PrintHeader(), and Proto::sizep.

Here is the call graph for this function:

static void PrintHeader ( const Proto f  )  [static]
static void PrintString ( const TString ts  )  [static]

Definition at line 223 of file luac.c.

References getstr, TString::len, and TString::tsv.

Referenced by PrintConstant().

Here is the caller graph for this function:

static const char* reader ( lua_State L,
void *  ud,
size_t *  size 
) [static]

Definition at line 119 of file luac.c.

References UNUSED.

Referenced by combine().

Here is the caller graph for this function:

static void usage ( const char *  message  )  [static]

Definition at line 47 of file luac.c.

References LUA_QL, LUA_QS, Output, and progname.

Referenced by doargs(), main(), events::console_handler::register_command(), events::map_command_handler< chat_command_handler >::register_command(), and WML_HANDLER_FUNCTION().

Here is the caller graph for this function:

static int writer ( lua_State L,
const void *  p,
size_t  size,
void *  u 
) [static]

Definition at line 156 of file luac.c.

References UNUSED.

Referenced by pmain().

Here is the caller graph for this function:


Variable Documentation

int dumping = 1 [static]

Definition at line 29 of file luac.c.

Referenced by doargs(), and pmain().

int listing = 0 [static]

Definition at line 28 of file luac.c.

Referenced by doargs(), and pmain().

const char* output = Output [static]

Definition at line 32 of file luac.c.

Referenced by cannot(), doargs(), and pmain().

char Output[] = { OUTPUT } [static]

Definition at line 31 of file luac.c.

Referenced by doargs(), and usage().

const char* progname = PROGNAME [static]

Definition at line 33 of file luac.c.

Referenced by cannot(), doargs(), fatal(), and usage().

int stripping = 0 [static]

Definition at line 30 of file luac.c.

Referenced by doargs(), and pmain().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:08:18 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs