#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"
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 Proto * | combine (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 IS | ( | s | ) | (strcmp(argv[i],s)==0) |
| #define MYK | ( | x | ) | (-1-(x)) |
Definition at line 275 of file luac.c.
Referenced by PrintCode().
| #define S | ( | x | ) | (int)(x),SS(x) |
Definition at line 376 of file luac.c.
Referenced by floating_point_emulation::detail::tscale< Sint32, S, typename boost::enable_if_c< S!=0 >::type >::down(), floating_point_emulation::operator<<(), and PrintHeader().
| #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)) |
| #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().
| static void cannot | ( | const char * | what | ) | [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().


| static int doargs | ( | int | argc, | |
| char * | argv[] | |||
| ) | [static] |
| static void fatal | ( | const char * | message | ) | [static] |
| 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().

| 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().


| static void PrintCode | ( | const Proto * | f | ) | [static] |
Definition at line 277 of file luac.c.
References Proto::code, GET_OPCODE, GETARG_A, GETARG_Ax, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, getBMode, getCMode, getfuncline, getOpMode, iABC, iABx, iAsBx, iAx, INDEXK, ISK, luaP_opnames, MYK, OP_ADD, OP_CLOSURE, OP_DIV, OP_EQ, OP_EXTRAARG, OP_FORLOOP, OP_FORPREP, OP_GETTABLE, OP_GETTABUP, OP_GETUPVAL, OP_JMP, OP_LE, OP_LOADK, OP_LT, OP_MUL, OP_POW, OP_SELF, OP_SETLIST, OP_SETTABLE, OP_SETTABUP, OP_SETUPVAL, OP_SUB, OP_TFORLOOP, OpArgK, OpArgN, OpArgU, Proto::p, PrintConstant(), Proto::sizecode, UPVALNAME, and VOID.
Referenced by PrintFunction().


| 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().


| 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().


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

| static void PrintHeader | ( | const Proto * | f | ) | [static] |
Definition at line 378 of file luac.c.
References getstr, Proto::is_vararg, Proto::lastlinedefined, Proto::linedefined, LUA_SIGNATURE, Proto::maxstacksize, Proto::numparams, S, Proto::sizecode, Proto::sizek, Proto::sizelocvars, Proto::sizep, Proto::sizeupvalues, Proto::source, SS, and VOID.
Referenced by PrintFunction().

| 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().

| static const char* reader | ( | lua_State * | L, | |
| void * | ud, | |||
| size_t * | size | |||
| ) | [static] |
| 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().

| static int writer | ( | lua_State * | L, | |
| const void * | p, | |||
| size_t | size, | |||
| void * | u | |||
| ) | [static] |
const char* output = Output [static] |
char Output[] = { OUTPUT } [static] |
const char* progname = PROGNAME [static] |
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:08:18 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |