The Battle for Wesnoth  1.15.1+dev
Classes | Macros | Functions
ldump.cpp File Reference
#include "lprefix.h"
#include <stddef.h>
#include "lua.h"
#include "lobject.h"
#include "lstate.h"
#include "lundump.h"
Include dependency graph for ldump.cpp:

Go to the source code of this file.

Classes

struct  DumpState
 

Macros

#define ldump_c
 
#define LUA_CORE
 
#define DumpVector(v, n, D)   DumpBlock(v,(n)*sizeof((v)[0]),D)
 
#define DumpLiteral(s, D)   DumpBlock(s, sizeof(s) - sizeof(char), D)
 
#define DumpVar(x, D)   DumpVector(&x,1,D)
 

Functions

static void DumpBlock (const void *b, size_t size, DumpState *D)
 
static void DumpByte (int y, DumpState *D)
 
static void DumpInt (int x, DumpState *D)
 
static void DumpNumber (lua_Number x, DumpState *D)
 
static void DumpInteger (lua_Integer x, DumpState *D)
 
static void DumpString (const TString *s, DumpState *D)
 
static void DumpCode (const Proto *f, DumpState *D)
 
static void DumpFunction (const Proto *f, TString *psource, DumpState *D)
 
static void DumpConstants (const Proto *f, DumpState *D)
 
static void DumpProtos (const Proto *f, DumpState *D)
 
static void DumpUpvalues (const Proto *f, DumpState *D)
 
static void DumpDebug (const Proto *f, DumpState *D)
 
static void DumpHeader (DumpState *D)
 
int luaU_dump (lua_State *L, const Proto *f, lua_Writer w, void *data, int strip)
 

Macro Definition Documentation

◆ DumpLiteral

#define DumpLiteral (   s,
 
)    DumpBlock(s, sizeof(s) - sizeof(char), D)

Definition at line 37 of file ldump.cpp.

Referenced by DumpHeader().

◆ DumpVar

#define DumpVar (   x,
 
)    DumpVector(&x,1,D)

Definition at line 49 of file ldump.cpp.

Referenced by DumpByte(), DumpInt(), DumpInteger(), DumpNumber(), and DumpString().

◆ DumpVector

#define DumpVector (   v,
  n,
 
)    DumpBlock(v,(n)*sizeof((v)[0]),D)

Definition at line 35 of file ldump.cpp.

Referenced by DumpCode(), DumpDebug(), and DumpString().

◆ ldump_c

#define ldump_c

Definition at line 7 of file ldump.cpp.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file ldump.cpp.

Function Documentation

◆ DumpBlock()

static void DumpBlock ( const void *  b,
size_t  size,
DumpState D 
)
static

◆ DumpByte()

static void DumpByte ( int  y,
DumpState D 
)
static

Definition at line 52 of file ldump.cpp.

References DumpVar.

Referenced by DumpConstants(), DumpFunction(), DumpHeader(), DumpString(), DumpUpvalues(), and luaU_dump().

◆ DumpCode()

static void DumpCode ( const Proto f,
DumpState D 
)
static

Definition at line 90 of file ldump.cpp.

References Proto::code, DumpFunction(), DumpInt(), DumpVector, f, and Proto::sizecode.

Referenced by DumpFunction().

◆ DumpConstants()

static void DumpConstants ( const Proto f,
DumpState D 
)
static

◆ DumpDebug()

static void DumpDebug ( const Proto f,
DumpState D 
)
static

◆ DumpFunction()

static void DumpFunction ( const Proto f,
TString psource,
DumpState D 
)
static

◆ DumpHeader()

static void DumpHeader ( DumpState D)
static

◆ DumpInt()

static void DumpInt ( int  x,
DumpState D 
)
static

Definition at line 58 of file ldump.cpp.

References DumpVar.

Referenced by DumpCode(), DumpConstants(), DumpDebug(), DumpFunction(), DumpProtos(), and DumpUpvalues().

◆ DumpInteger()

static void DumpInteger ( lua_Integer  x,
DumpState D 
)
static

Definition at line 68 of file ldump.cpp.

References DumpVar.

Referenced by DumpConstants(), and DumpHeader().

◆ DumpNumber()

static void DumpNumber ( lua_Number  x,
DumpState D 
)
static

Definition at line 63 of file ldump.cpp.

References DumpVar.

Referenced by DumpConstants(), and DumpHeader().

◆ DumpProtos()

static void DumpProtos ( const Proto f,
DumpState D 
)
static

Definition at line 128 of file ldump.cpp.

References DumpFunction(), DumpInt(), i, n, Proto::p, Proto::sizep, and Proto::source.

Referenced by DumpFunction().

◆ DumpString()

static void DumpString ( const TString s,
DumpState D 
)
static

Definition at line 73 of file ldump.cpp.

References cast_int, DumpByte(), DumpVar, DumpVector, getstr, utf8::size(), and tsslen.

Referenced by DumpConstants(), DumpDebug(), and DumpFunction().

◆ DumpUpvalues()

static void DumpUpvalues ( const Proto f,
DumpState D 
)
static

Definition at line 137 of file ldump.cpp.

References DumpByte(), DumpInt(), i, Upvaldesc::idx, Upvaldesc::instack, n, Proto::sizeupvalues, and Proto::upvalues.

Referenced by DumpFunction().

◆ luaU_dump()

int luaU_dump ( lua_State L,
const Proto f,
lua_Writer  w,
void *  data,
int  strip 
)