The Battle for Wesnoth  1.15.12+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(D, v, n)   dumpBlock(D,v,(n)*sizeof((v)[0]))
 
#define dumpLiteral(D, s)   dumpBlock(D,s,sizeof(s) - sizeof(char))
 
#define dumpVar(D, x)   dumpVector(D,&x,1)
 
#define DIBS   ((sizeof(size_t) * 8 / 7) + 1)
 

Functions

static void dumpBlock (DumpState *D, const void *b, size_t size)
 
static void dumpByte (DumpState *D, int y)
 
static void dumpSize (DumpState *D, size_t x)
 
static void dumpInt (DumpState *D, int x)
 
static void dumpNumber (DumpState *D, lua_Number x)
 
static void dumpInteger (DumpState *D, lua_Integer x)
 
static void dumpString (DumpState *D, const TString *s)
 
static void dumpCode (DumpState *D, const Proto *f)
 
static void dumpFunction (DumpState *D, const Proto *f, TString *psource)
 
static void dumpConstants (DumpState *D, const Proto *f)
 
static void dumpProtos (DumpState *D, const Proto *f)
 
static void dumpUpvalues (DumpState *D, const Proto *f)
 
static void dumpDebug (DumpState *D, const Proto *f)
 
static void dumpHeader (DumpState *D)
 
int luaU_dump (lua_State *L, const Proto *f, lua_Writer w, void *data, int strip)
 

Macro Definition Documentation

◆ DIBS

#define DIBS   ((sizeof(size_t) * 8 / 7) + 1)

Definition at line 59 of file ldump.cpp.

Referenced by dumpSize().

◆ dumpLiteral

#define dumpLiteral (   D,
  s 
)    dumpBlock(D,s,sizeof(s) - sizeof(char))

Definition at line 37 of file ldump.cpp.

Referenced by dumpHeader().

◆ dumpVar

#define dumpVar (   D,
 
)    dumpVector(D,&x,1)

Definition at line 49 of file ldump.cpp.

Referenced by dumpByte(), dumpInteger(), and dumpNumber().

◆ dumpVector

#define dumpVector (   D,
  v,
  n 
)    dumpBlock(D,v,(n)*sizeof((v)[0]))

Definition at line 35 of file ldump.cpp.

Referenced by dumpCode(), dumpDebug(), dumpSize(), 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 ( DumpState D,
const void *  b,
size_t  size 
)
static

◆ dumpByte()

static void dumpByte ( DumpState D,
int  y 
)
static

Definition at line 52 of file ldump.cpp.

References dumpVar.

Referenced by dumpConstants(), dumpFunction(), dumpHeader(), dumpUpvalues(), and luaU_dump().

◆ dumpCode()

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

Definition at line 100 of file ldump.cpp.

References Proto::code, dumpFunction(), dumpInt(), dumpVector, f, and Proto::sizecode.

Referenced by dumpFunction().

◆ dumpConstants()

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

◆ dumpDebug()

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

◆ dumpFunction()

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

◆ dumpHeader()

static void dumpHeader ( DumpState D)
static

◆ dumpInt()

static void dumpInt ( DumpState D,
int  x 
)
static

Definition at line 73 of file ldump.cpp.

References dumpSize().

Referenced by dumpCode(), dumpConstants(), dumpDebug(), dumpFunction(), dumpProtos(), and dumpUpvalues().

◆ dumpInteger()

static void dumpInteger ( DumpState D,
lua_Integer  x 
)
static

Definition at line 83 of file ldump.cpp.

References dumpVar.

Referenced by dumpConstants(), and dumpHeader().

◆ dumpNumber()

static void dumpNumber ( DumpState D,
lua_Number  x 
)
static

Definition at line 78 of file ldump.cpp.

References dumpVar.

Referenced by dumpConstants(), and dumpHeader().

◆ dumpProtos()

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

Definition at line 134 of file ldump.cpp.

References dumpFunction(), dumpInt(), i, n, Proto::p, Proto::sizep, and Proto::source.

Referenced by dumpFunction().

◆ dumpSize()

static void dumpSize ( DumpState D,
size_t  x 
)
static

Definition at line 61 of file ldump.cpp.

References SParser::buff, DIBS, dumpVector, and n.

Referenced by dumpInt(), and dumpString().

◆ dumpString()

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

Definition at line 88 of file ldump.cpp.

References dumpSize(), dumpVector, getstr, utf8::size(), and tsslen.

Referenced by dumpConstants(), dumpDebug(), and dumpFunction().

◆ dumpUpvalues()

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

◆ luaU_dump()

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