interplane.Get Omega
Read in your language

lua

[Ported from github.com/lua/lua] Cast in 'rl_readline_name'

Brought by drakestapleton

branch master Branches Tags History

lua / lstring.h

73 lines · 2100 bytes Raw Blame History
1/*
2** $Id: lstring.h $
3** String table (keep all strings handled by Lua)
4** See Copyright Notice in lua.h
5*/
6
7#ifndef lstring_h
8#define lstring_h
9
10#include "lgc.h"
11#include "lobject.h"
12#include "lstate.h"
13
14
15/*
16** Memory-allocation error message must be preallocated (it cannot
17** be created after memory is exhausted)
18*/
19#define MEMERRMSG "not enough memory"
20
21
22/*
23** Maximum length for short strings, that is, strings that are
24** internalized. (Cannot be smaller than reserved words or tags for
25** metamethods, as these strings must be internalized;
26** #("function") = 8, #("__newindex") = 10.)
27*/
28#if !defined(LUAI_MAXSHORTLEN)
29#define LUAI_MAXSHORTLEN 40
30#endif
31
32
33/*
34** Size of a short TString: Size of the header plus space for the string
35** itself (including final '\0').
36*/
37#define sizestrshr(l) \
38 (offsetof(TString, contents) + ((l) + 1) * sizeof(char))
39
40
41#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
42 (sizeof(s)/sizeof(char))-1))
43
44
45/*
46** test whether a string is a reserved word
47*/
48#define isreserved(s) (strisshr(s) && (s)->extra > 0)
49
50
51/*
52** equality for short strings, which are always internalized
53*/
54#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
55
56
57LUAI_FUNC unsigned luaS_hashlongstr (TString *ts);
58LUAI_FUNC int luaS_eqstr (TString *a, TString *b);
59LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
60LUAI_FUNC void luaS_clearcache (global_State *g);
61LUAI_FUNC void luaS_init (lua_State *L);
62LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
63LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s,
64 unsigned short nuvalue);
65LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
66LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
67LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
68LUAI_FUNC TString *luaS_newextlstr (lua_State *L,
69 const char *s, size_t len, lua_Alloc falloc, void *ud);
70LUAI_FUNC size_t luaS_sizelngstr (size_t len, int kind);
71LUAI_FUNC TString *luaS_normstr (lua_State *L, TString *ts);
72
73#endif