Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:37:57

0001 /*
0002 ** $Id: lstring.h $
0003 ** String table (keep all strings handled by Lua)
0004 ** See Copyright Notice in lua.h
0005 */
0006 
0007 #ifndef lstring_h
0008 #define lstring_h
0009 
0010 #include "lgc.h"
0011 #include "lobject.h"
0012 #include "lstate.h"
0013 
0014 
0015 /*
0016 ** Memory-allocation error message must be preallocated (it cannot
0017 ** be created after memory is exhausted)
0018 */
0019 #define MEMERRMSG       "not enough memory"
0020 
0021 
0022 /*
0023 ** Size of a TString: Size of the header plus space for the string
0024 ** itself (including final '\0').
0025 */
0026 #define sizelstring(l)  (offsetof(TString, contents) + ((l) + 1) * sizeof(char))
0027 
0028 #define luaS_newliteral(L, s)   (luaS_newlstr(L, "" s, \
0029                                  (sizeof(s)/sizeof(char))-1))
0030 
0031 
0032 /*
0033 ** test whether a string is a reserved word
0034 */
0035 #define isreserved(s)   ((s)->tt == LUA_VSHRSTR && (s)->extra > 0)
0036 
0037 
0038 /*
0039 ** equality for short strings, which are always internalized
0040 */
0041 #define eqshrstr(a,b)   check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
0042 
0043 
0044 LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
0045 LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
0046 LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
0047 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
0048 LUAI_FUNC void luaS_clearcache (global_State *g);
0049 LUAI_FUNC void luaS_init (lua_State *L);
0050 LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
0051 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue);
0052 LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
0053 LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
0054 LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
0055 
0056 
0057 #endif