The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Functions
lundump.cpp File Reference
#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstring.h"
#include "lundump.h"
#include "lzio.h"
Include dependency graph for lundump.cpp:

Go to the source code of this file.

Classes

struct  LoadState
 

Macros

#define lundump_c
 
#define LUA_CORE
 
#define LoadMem(S, b, n, size)   LoadBlock(S,b,(n)*(size))
 
#define LoadByte(S)   (lu_byte)LoadChar(S)
 
#define LoadVar(S, x)   LoadMem(S,&x,1,sizeof(x))
 
#define LoadVector(S, b, n, size)   LoadMem(S,b,n,size)
 
#define luai_verifycode(L, b, f)   /* empty */
 
#define N0   LUAC_HEADERSIZE
 
#define N1   (sizeof(LUA_SIGNATURE)-sizeof(char))
 
#define N2   N1+2
 
#define N3   N2+6
 
#define MYINT(s)   (s[0]-'0')
 
#define VERSION   MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)
 
#define FORMAT   0 /* this is the official format */
 

Functions

static l_noret error (LoadState *S, const char *why)
 
static void LoadBlock (LoadState *S, void *b, size_t size)
 
static int LoadChar (LoadState *S)
 
static int LoadInt (LoadState *S)
 
static lua_Number LoadNumber (LoadState *S)
 
static TStringLoadString (LoadState *S)
 
static void LoadCode (LoadState *S, Proto *f)
 
static void LoadFunction (LoadState *S, Proto *f)
 
static void LoadConstants (LoadState *S, Proto *f)
 
static void LoadUpvalues (LoadState *S, Proto *f)
 
static void LoadDebug (LoadState *S, Proto *f)
 
static void LoadHeader (LoadState *S)
 
ClosureluaU_undump (lua_State *L, ZIO *Z, Mbuffer *buff, const char *name)
 
void luaU_header (lu_byte *h)
 

Macro Definition Documentation

#define FORMAT   0 /* this is the official format */

Definition at line 236 of file lundump.cpp.

Referenced by luaU_header().

#define LoadByte (   S)    (lu_byte)LoadChar(S)

Definition at line 36 of file lundump.cpp.

Referenced by LoadFunction(), and LoadUpvalues().

#define LoadMem (   S,
  b,
  n,
  size 
)    LoadBlock(S,b,(n)*(size))

Definition at line 35 of file lundump.cpp.

#define LoadVar (   S,
  x 
)    LoadMem(S,&x,1,sizeof(x))

Definition at line 37 of file lundump.cpp.

Referenced by LoadChar(), LoadInt(), LoadNumber(), and LoadString().

#define LoadVector (   S,
  b,
  n,
  size 
)    LoadMem(S,b,n,size)

Definition at line 38 of file lundump.cpp.

Referenced by LoadCode(), and LoadDebug().

#define LUA_CORE

Definition at line 9 of file lundump.cpp.

#define luai_verifycode (   L,
  b,
  f 
)    /* empty */

Definition at line 41 of file lundump.cpp.

Referenced by luaU_undump().

#define lundump_c

Definition at line 8 of file lundump.cpp.

#define MYINT (   s)    (s[0]-'0')

Definition at line 234 of file lundump.cpp.

#define N0   LUAC_HEADERSIZE

Definition at line 184 of file lundump.cpp.

Referenced by LoadHeader().

#define N1   (sizeof(LUA_SIGNATURE)-sizeof(char))

Definition at line 185 of file lundump.cpp.

Referenced by LoadHeader().

#define N2   N1+2

Definition at line 186 of file lundump.cpp.

Referenced by LoadHeader().

#define N3   N2+6

Definition at line 187 of file lundump.cpp.

Referenced by LoadHeader().

#define VERSION   MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)

Definition at line 235 of file lundump.cpp.

Referenced by luaU_header().

Function Documentation

static l_noret error ( LoadState S,
const char *  why 
)
static

Definition at line 29 of file lundump.cpp.

References LoadState::L, LUA_ERRSYNTAX, luaD_throw(), luaO_pushfstring(), and LoadState::name.

Referenced by unit_type_data::add_advancement(), config::add_child_at(), game_config::add_color_info(), suh::add_user(), config::apply_diff(), check_error(), unit_type::check_id(), suh::check_name(), suh::check_password(), suh::check_realname(), check_timeout(), config::check_valid(), tconfig_implementation::child(), config::clear_diff_track(), wesnothd::client_address(), game_config::color_info(), ng::configure_engine::configure_engine(), mp::connect::connect(), mp::create::create(), default_map_generator_job::default_generate_map(), enter_lobby_mode(), preprocessor_streambuf::error(), ai::formula_ai::execute_variant(), preprocessor_data::get_chunk(), get_connection_details(), network_worker_pool::get_received_data(), get_resolution(), get_unit_type(), glewGetErrorString(), GPU_PushErrorCode(), font::manager::init(), team_builder::init(), game_launcher::init_lua_script(), mp::initial_level_config(), CVideo::initSDL(), unit_map::insert(), mp::wait::join_game(), load_fake_units(), gui::button::load_images(), LoadBlock(), LoadHeader(), LoadInt(), main(), font::manager::manager(), network::manager::manager(), simple_wml::node::node(), open_connection(), simple_wml::document::output(), wesnothd::parse_ip(), network_asio::connection::poll(), process_command_args(), t_translation::read_game_map(), network::receive_data(), suh::remove_user(), ng::flg_manager::resolve_random(), schema_validation::schema_validator::schema_validator(), user_handler::send_mail(), suh::set_user_detail(), lua_gui2::show_message_dialog(), addons_client::update_last_error(), suh::user_info(), and write_internal().

static void LoadBlock ( LoadState S,
void b,
size_t  size 
)
static

Definition at line 44 of file lundump.cpp.

References error(), luaZ_read(), and LoadState::Z.

Referenced by LoadHeader(), and LoadString().

static int LoadChar ( LoadState S)
static

Definition at line 49 of file lundump.cpp.

References LoadVar.

Referenced by LoadConstants().

static void LoadCode ( LoadState S,
Proto f 
)
static

Definition at line 85 of file lundump.cpp.

References Proto::code, LoadState::L, LoadInt(), LoadVector, luaM_newvector, and Proto::sizecode.

Referenced by LoadFunction().

static void LoadConstants ( LoadState S,
Proto f 
)
static
static void LoadDebug ( LoadState S,
Proto f 
)
static
static void LoadFunction ( LoadState S,
Proto f 
)
static
static void LoadHeader ( LoadState S)
static

Definition at line 189 of file lundump.cpp.

References error(), LoadBlock(), LUAC_HEADERSIZE, luaU_header(), N0, N1, N2, and N3.

Referenced by luaU_undump().

static int LoadInt ( LoadState S)
static

Definition at line 56 of file lundump.cpp.

References error(), and LoadVar.

Referenced by LoadCode(), LoadConstants(), LoadDebug(), LoadFunction(), and LoadUpvalues().

static lua_Number LoadNumber ( LoadState S)
static

Definition at line 64 of file lundump.cpp.

References LoadVar.

Referenced by LoadConstants().

static TString* LoadString ( LoadState S)
static

Definition at line 71 of file lundump.cpp.

References LoadState::b, LoadState::L, LoadBlock(), LoadVar, luaS_newlstr(), and luaZ_openspace().

Referenced by LoadConstants(), and LoadDebug().

static void LoadUpvalues ( LoadState S,
Proto f 
)
static
void luaU_header ( lu_byte h)

Definition at line 243 of file lundump.cpp.

References cast_byte, FORMAT, LUA_SIGNATURE, LUAC_TAIL, and VERSION.

Referenced by DumpHeader(), and LoadHeader().

Closure* luaU_undump ( lua_State L,
ZIO Z,
Mbuffer buff,
const char *  name 
)