The Battle for Wesnoth  1.17.0-dev
Macros | Functions
lstring.h File Reference
#include "lgc.h"
#include "lobject.h"
#include "lstate.h"
Include dependency graph for lstring.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MEMERRMSG   "not enough memory"
 
#define sizelstring(l)   (offsetof(TString, contents) + ((l) + 1) * sizeof(char))
 
#define luaS_newliteral(L, s)
 
#define isreserved(s)   ((s)->tt == LUA_VSHRSTR && (s)->extra > 0)
 
#define eqshrstr(a, b)   check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
 

Functions

LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed)
 
LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts)
 
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b)
 
LUAI_FUNC void luaS_resize (lua_State *L, int newsize)
 
LUAI_FUNC void luaS_clearcache (global_State *g)
 
LUAI_FUNC void luaS_init (lua_State *L)
 
LUAI_FUNC void luaS_remove (lua_State *L, TString *ts)
 
LUAI_FUNC UdataluaS_newudata (lua_State *L, size_t s, int nuvalue)
 
LUAI_FUNC TStringluaS_newlstr (lua_State *L, const char *str, size_t l)
 
LUAI_FUNC TStringluaS_new (lua_State *L, const char *str)
 
LUAI_FUNC TStringluaS_createlngstrobj (lua_State *L, size_t l)
 

Macro Definition Documentation

◆ eqshrstr

#define eqshrstr (   a,
  b 
)    check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))

Definition at line 41 of file lstring.h.

Referenced by lua_error(), luaH_getshortstr(), and luaV_equalobj().

◆ isreserved

#define isreserved (   s)    ((s)->tt == LUA_VSHRSTR && (s)->extra > 0)

Definition at line 35 of file lstring.h.

Referenced by llex().

◆ luaS_newliteral

#define luaS_newliteral (   L,
  s 
)
Value:
(luaS_newlstr(L, "" s, \
(sizeof(s)/sizeof(char))-1))
LUAI_FUNC TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
Definition: lstring.cpp:221
static map_location::DIRECTION s

Definition at line 28 of file lstring.h.

Referenced by breakstat(), leaveblock(), luaD_seterrorobj(), luaS_init(), luaX_init(), luaX_setinput(), test_then_block(), and undefgoto().

◆ MEMERRMSG

#define MEMERRMSG   "not enough memory"

Definition at line 19 of file lstring.h.

Referenced by luaS_init().

◆ sizelstring

#define sizelstring (   l)    (offsetof(TString, contents) + ((l) + 1) * sizeof(char))

Definition at line 26 of file lstring.h.

Referenced by createstrobj(), and freeobj().

Function Documentation

◆ luaS_clearcache()

LUAI_FUNC void luaS_clearcache ( global_State g)

Definition at line 110 of file lstring.cpp.

References i, iswhite, global_State::memerrmsg, global_State::strcache, STRCACHE_M, and STRCACHE_N.

Referenced by atomic().

◆ luaS_createlngstrobj()

LUAI_FUNC TString* luaS_createlngstrobj ( lua_State L,
size_t  l 
)

Definition at line 157 of file lstring.cpp.

References createstrobj(), G, TString::lnglen, LUA_VLNGSTR, and TString::u.

Referenced by loadStringN(), luaS_newlstr(), and luaV_concat().

◆ luaS_eqlngstr()

LUAI_FUNC int luaS_eqlngstr ( TString a,
TString b 
)

Definition at line 34 of file lstring.cpp.

References getstr, TString::lnglen, lua_assert, LUA_VLNGSTR, and TString::u.

Referenced by equalkey(), and luaV_equalobj().

◆ luaS_hash()

LUAI_FUNC unsigned int luaS_hash ( const char *  str,
size_t  l,
unsigned int  seed 
)

Definition at line 43 of file lstring.cpp.

References cast_byte, cast_uint, and h.

Referenced by internshrstr(), luai_makeseed(), and luaS_hashlongstr().

◆ luaS_hashlongstr()

LUAI_FUNC unsigned int luaS_hashlongstr ( TString ts)

Definition at line 51 of file lstring.cpp.

References TString::extra, getstr, TString::hash, TString::lnglen, lua_assert, LUA_VLNGSTR, luaS_hash(), and TString::u.

Referenced by mainposition().

◆ luaS_init()

LUAI_FUNC void luaS_init ( lua_State L)

◆ luaS_new()

LUAI_FUNC TString* luaS_new ( lua_State L,
const char *  str 
)

◆ luaS_newlstr()

LUAI_FUNC TString* luaS_newlstr ( lua_State L,
const char *  str,
size_t  l 
)

◆ luaS_newudata()

LUAI_FUNC Udata* luaS_newudata ( lua_State L,
size_t  s,
int  nuvalue 
)

◆ luaS_remove()

LUAI_FUNC void luaS_remove ( lua_State L,
TString ts 
)

Definition at line 164 of file lstring.cpp.

References G, stringtable::hash, TString::hash, TString::hnext, lmod, stringtable::nuse, p, stringtable::size, and TString::u.

Referenced by freeobj().

◆ luaS_resize()

LUAI_FUNC void luaS_resize ( lua_State L,
int  newsize 
)

Definition at line 85 of file lstring.cpp.

References G, stringtable::hash, luaM_reallocvector, stringtable::size, tablerehash(), and unlikely.

Referenced by checkSizes(), and growstrtab().