The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
luac.cpp 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.cpp:

Go to the source code of this file.

Macros

#define luac_c
 
#define LUA_CORE
 
#define luaU_print   PrintFunction
 
#define PROGNAME   "luac" /* default program name */
 
#define OUTPUT   PROGNAME ".out" /* default output file */
 
#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
 

Macro Definition Documentation

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

Definition at line 116 of file luac.cpp.

Referenced by reader().

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

Definition at line 66 of file luac.cpp.

Referenced by doargs(), and pmain().

#define LUA_CORE

Definition at line 213 of file luac.cpp.

#define LUA_CORE

Definition at line 213 of file luac.cpp.

#define luac_c

Definition at line 212 of file luac.cpp.

#define luac_c

Definition at line 212 of file luac.cpp.

#define luaU_print   PrintFunction

Definition at line 22 of file luac.cpp.

Referenced by pmain().

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

Definition at line 273 of file luac.cpp.

Referenced by PrintCode().

#define OUTPUT   PROGNAME ".out" /* default output file */

Definition at line 25 of file luac.cpp.

#define PROGNAME   "luac" /* default program name */

Definition at line 24 of file luac.cpp.

Referenced by combine().

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

Definition at line 373 of file luac.cpp.

Referenced by PrintHeader().

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

Definition at line 133 of file luac.cpp.

Referenced by combine().

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

Definition at line 272 of file luac.cpp.

Referenced by PrintCode(), and PrintDebug().

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

Definition at line 219 of file luac.cpp.

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

Function Documentation

static void cannot ( const char *  what)
static

Definition at line 40 of file luac.cpp.

References output, and progname.

Referenced by pmain().

static const Proto* combine ( lua_State L,
int  n 
)
static
static int doargs ( int  argc,
char *  argv[] 
)
static

Definition at line 68 of file luac.cpp.

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

Referenced by main().

static void fatal ( const char *  message)
static

Definition at line 34 of file luac.cpp.

References progname.

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

int main ( int  argc,
char *  argv[] 
)
static int pmain ( lua_State L)
static
static void PrintCode ( const Proto f)
static
static void PrintConstant ( const Proto f,
int  i 
)
static
static void PrintDebug ( const Proto f)
static
static void PrintFunction ( const Proto f,
int  full 
)
static

Definition at line 423 of file luac.cpp.

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

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

Definition at line 221 of file luac.cpp.

References getstr, i, int(), TString::len, and TString::tsv.

Referenced by PrintConstant().

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

Definition at line 118 of file luac.cpp.

References FUNCTION, and UNUSED.

Referenced by combine(), and luaZ_init().

static void usage ( const char *  message)
static

Definition at line 46 of file luac.cpp.

References LUA_QL, LUA_QS, Output, and progname.

Referenced by doargs(), and main().

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

Definition at line 155 of file luac.cpp.

References UNUSED.

Referenced by pmain().

Variable Documentation

int dumping =1
static

Definition at line 28 of file luac.cpp.

Referenced by doargs(), and pmain().

int listing =0
static

Definition at line 27 of file luac.cpp.

Referenced by doargs(), and pmain().

char Output[] ={ OUTPUT }
static

Definition at line 30 of file luac.cpp.

Referenced by doargs(), and usage().

const char* output =Output
static

Definition at line 31 of file luac.cpp.

Referenced by cannot(), util::create_hash(), doargs(), pmain(), and tod_manager::resolve_random().

const char* progname =PROGNAME
static

Definition at line 32 of file luac.cpp.

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

int stripping =0
static

Definition at line 29 of file luac.cpp.

Referenced by doargs(), and pmain().