etc/protocols - sync with NetBSD-8
[minix.git] / external / mit / lua / dist / src / lstring.h
blobbf0e6c70ea83a6940c2d00d7180bf9676fda5c14
1 /* $NetBSD: lstring.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */
3 /*
4 ** Id: lstring.h,v 1.59 2015/03/25 13:42:19 roberto Exp
5 ** String table (keep all strings handled by Lua)
6 ** See Copyright Notice in lua.h
7 */
9 #ifndef lstring_h
10 #define lstring_h
12 #include "lgc.h"
13 #include "lobject.h"
14 #include "lstate.h"
17 #define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char))
19 #define sizeludata(l) (sizeof(union UUdata) + (l))
20 #define sizeudata(u) sizeludata((u)->len)
22 #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
23 (sizeof(s)/sizeof(char))-1))
27 ** test whether a string is a reserved word
29 #define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0)
33 ** equality for short strings, which are always internalized
35 #define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b))
38 LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
39 LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
40 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
41 LUAI_FUNC void luaS_clearcache (global_State *g);
42 LUAI_FUNC void luaS_init (lua_State *L);
43 LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
44 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s);
45 LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
46 LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
49 #endif