Go to the documentation of this file.
30 #if !defined(MAX_SIZET)
32 #define MAX_SIZET ((size_t)(~(size_t)0))
62 else if (
findfield(L, objidx, level - 1)) {
85 if (strncmp(name,
LUA_GNAME ".", 3) == 0) {
107 else if (*ar->
what ==
'm')
109 else if (*ar->
what !=
'C')
132 const char *
msg,
int level) {
144 if (limit2show-- == 0) {
145 int n = last - level -
LEVELS2 + 1;
178 return luaL_error(L,
"bad argument #%d (%s)",
arg, extramsg);
180 if (strcmp(ar.
namewhat,
"method") == 0) {
183 return luaL_error(L,
"calling '%s' on bad self (%s)",
188 return luaL_error(L,
"bad argument #%d to '%s' (%s)",
199 typearg =
"light userdata";
263 #if !defined(l_inspectstat)
265 #if defined(LUA_USE_POSIX)
267 #include <sys/wait.h>
272 #define l_inspectstat(stat,what) \
273 if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \
274 else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; }
278 #define l_inspectstat(stat,what)
286 if (stat != 0 && errno != 0)
289 const char *what =
"exit";
291 if (*what ==
'e' && stat == 0)
361 const char *
const lst[]) {
365 for (i=0; lst[i]; i++)
366 if (strcmp(lst[i], name) == 0)
410 const char *def,
size_t *len) {
413 *len = (def ? strlen(def) : 0);
423 if (l_unlikely(!isnum))
445 if (l_unlikely(!isnum)) {
477 void *temp = allocf(ud, box->
box, box->
bsize, newsize);
478 if (l_unlikely(temp == NULL && newsize > 0)) {
483 box->
bsize = newsize;
515 #define buffonstack(B) ((B)->b != (B)->init.b)
522 #define checkbufferlevel(B,idx) \
523 lua_assert(buffonstack(B) ? lua_touserdata(B->L, idx) != NULL \
524 : lua_touserdata(B->L, idx) == (void*)B)
532 size_t newsize =
B->size * 2;
535 if (newsize < B->n + sz)
548 if (
B->size -
B->n >= sz)
556 newbuff = (
char *)
resizebox(L, boxidx, newsize);
562 newbuff = (
char *)
resizebox(L, boxidx, newsize);
563 memcpy(newbuff,
B->b,
B->n *
sizeof(
char));
567 return newbuff +
B->n;
582 memcpy(b,
s, l *
sizeof(
char));
623 memcpy(b,
s, len *
sizeof(
char));
653 #define freelist (LUA_RIDX_LAST + 1)
726 if (feof(lf->
f))
return NULL;
734 const char *serr = strerror(errno);
743 const char *p =
"\xEF\xBB\xBF";
748 if (c == EOF || c != *(
const unsigned char *)p++)
return c;
749 lf->
buff[lf->
n++] = c;
750 }
while (*p !=
'\0');
768 }
while (c != EOF && c !=
'\n');
779 int status, readstatus;
782 if (filename == NULL) {
788 lf.
f = fopen(filename,
"r");
789 if (lf.
f == NULL)
return errfile(L,
"open", fnameindex);
792 lf.
buff[lf.
n++] =
'\n';
794 lf.
f = freopen(filename,
"rb", lf.
f);
795 if (lf.
f == NULL)
return errfile(L,
"reopen", fnameindex);
801 readstatus = ferror(lf.
f);
802 if (filename) fclose(lf.
f);
805 return errfile(L,
"read", fnameindex);
821 if (ls->
size == 0)
return NULL;
829 const char *name,
const char *mode) {
876 if (l_unlikely(!isnum))
877 luaL_error(L,
"object length is not an integer");
886 luaL_error(L,
"'__tostring' must return a string");
928 for (; l->
name != NULL; l++) {
933 for (i = 0; i < nup; i++)
988 const char *p,
const char *r) {
990 size_t l = strlen(p);
991 while ((wild = strstr(
s, p)) != NULL) {
1001 const char *p,
const char *r) {
1010 static void *
l_alloc (
void *ud,
void *
ptr,
size_t osize,
size_t nsize) {
1017 return realloc(
ptr, nsize);
1023 if (
msg == NULL)
msg =
"error object is not a string";
1036 static void warnfoff (
void *ud,
const char *message,
int tocont);
1037 static void warnfon (
void *ud,
const char *message,
int tocont);
1038 static void warnfcont (
void *ud,
const char *message,
int tocont);
1046 if (tocont || *(message++) !=
'@')
1049 if (strcmp(message,
"off") == 0)
1051 else if (strcmp(message,
"on") == 0)
1058 static void warnfoff (
void *ud,
const char *message,
int tocont) {
1067 static void warnfcont (
void *ud,
const char *message,
int tocont) {
1079 static void warnfon (
void *ud,
const char *message,
int tocont) {
1100 luaL_error(L,
"core and library have incompatible numeric types");
1102 luaL_error(L,
"version mismatch: app. needs %f, Lua core provides %f",
1103 (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)v);
#define luaL_optstring(L, n, d)
LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *pisnum)
LUALIB_API int luaL_callmeta(lua_State *L, int obj, const char *event)
#define lua_pushliteral(L, s)
LUALIB_API int luaL_getmetafield(lua_State *L, int obj, const char *event)
LUALIB_API void luaL_addstring(luaL_Buffer *B, const char *s)
LUA_API void lua_setglobal(lua_State *L, const char *name)
static void interror(lua_State *L, int arg)
static void pushfuncname(lua_State *L, lua_Debug *ar)
#define lua_tostring(L, i)
#define luaL_checkstring(L, n)
LUALIB_API void luaL_pushresultsize(luaL_Buffer *B, size_t sz)
LUA_API int lua_checkstack(lua_State *L, int n)
#define lua_replace(L, idx)
LUA_API int lua_getfield(lua_State *L, int idx, const char *k)
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)
static int findfield(lua_State *L, int objidx, int level)
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
static const char * getF(lua_State *L, void *ud, size_t *size)
LUALIB_API int luaL_loadbufferx(lua_State *L, const char *buff, size_t size, const char *name, const char *mode)
LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
LUALIB_API int luaL_ref(lua_State *L, int t)
static void * l_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
#define lua_remove(L, idx)
LUA_API void lua_toclose(lua_State *L, int idx)
LUALIB_API int luaL_loadstring(lua_State *L, const char *s)
#define luaL_typename(L, i)
const LUA_API char * lua_pushfstring(lua_State *L, const char *fmt,...)
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
LUALIB_API int luaL_checkoption(lua_State *L, int arg, const char *def, const char *const lst[])
LUA_API void lua_concat(lua_State *L, int n)
LUA_API lua_Unsigned lua_rawlen(lua_State *L, int idx)
#define lua_isnoneornil(L, n)
LUALIB_API void luaL_addlstring(luaL_Buffer *B, const char *s, size_t l)
#define luaL_loadbuffer(L, s, sz, n)
LUA_API int lua_isstring(lua_State *L, int idx)
LUA_API lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf)
LUA_API int lua_type(lua_State *L, int idx)
const LUALIB_API char * luaL_checklstring(lua_State *L, int arg, size_t *len)
LUA_API int lua_setmetatable(lua_State *L, int objindex)
const LUA_API char * lua_pushstring(lua_State *L, const char *s)
LUA_API int lua_isinteger(lua_State *L, int idx)
LUALIB_API void luaL_pushresult(luaL_Buffer *B)
#define luaL_argexpected(L, cond, arg, tname)
LUA_API int lua_isnumber(lua_State *L, int idx)
LUALIB_API void * luaL_testudata(lua_State *L, int ud, const char *tname)
const LUALIB_API char * luaL_optlstring(lua_State *L, int arg, const char *def, size_t *len)
LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname)
#define lua_istable(L, n)
LUA_API lua_Number lua_version(lua_State *L)
static void * resizebox(lua_State *L, int idx, size_t newsize)
void *(* lua_Alloc)(void *ud, void *ptr, size_t osize, size_t nsize)
static void newbox(lua_State *L)
#define luaL_getmetatable(L, n)
const LUA_API char * lua_pushvfstring(lua_State *L, const char *fmt, va_list argp)
char short_src[LUA_IDSIZE]
span_constexpr std::size_t size(span< T, Extent > const &spn)
LUALIB_API int luaL_newmetatable(lua_State *L, const char *tname)
LUA_API void lua_len(lua_State *L, int idx)
void lua_setwarnf(lua_State *L, lua_WarnFunction f, void *ud)
#define lua_insert(L, idx)
LUA_API int lua_rawget(lua_State *L, int idx)
#define lua_tointeger(L, i)
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n)
static int skipcomment(LoadF *lf, int *cp)
#define l_inspectstat(stat, what)
LUA_API lua_State * lua_newstate(lua_Alloc f, void *ud)
LUALIB_API int luaL_execresult(lua_State *L, int stat)
LUA_API int lua_rawgeti(lua_State *L, int idx, lua_Integer n)
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
LUALIB_API void luaL_checkany(lua_State *L, int arg)
static char * prepbuffsize(luaL_Buffer *B, size_t sz, int boxidx)
static const luaL_Reg boxmt[]
#define LUA_REGISTRYINDEX
LUALIB_API char * luaL_buffinitsize(lua_State *L, luaL_Buffer *B, size_t sz)
LUA_API void * lua_touserdata(lua_State *L, int idx)
static void warnfcont(void *ud, const char *message, int tocont)
const LUA_API char * lua_typename(lua_State *L, int t)
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
#define luaL_opt(L, f, n, d)
#define luaL_addchar(B, c)
LUA_API int lua_gettop(lua_State *L)
LUALIB_API void * luaL_checkudata(lua_State *L, int ud, const char *tname)
LUA_API lua_Alloc lua_getallocf(lua_State *L, void **ud)
LUA_API void lua_settop(lua_State *L, int idx)
LUA_API void lua_pushboolean(lua_State *L, int b)
LUA_API void lua_pushvalue(lua_State *L, int idx)
LUALIB_API lua_Integer luaL_len(lua_State *L, int idx)
LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename, const char *mode)
LUALIB_API void luaL_checktype(lua_State *L, int arg, int t)
LUA_API void lua_closeslot(lua_State *L, int idx)
#define lua_pushcfunction(L, f)
LUA_API int lua_getmetatable(lua_State *L, int objindex)
static int errfile(lua_State *L, const char *what, int fnameindex)
#define LUA_TLIGHTUSERDATA
#define lua_call(L, n, r)
LUA_API int lua_rawequal(lua_State *L, int index1, int index2)
LUALIB_API char * luaL_prepbuffsize(luaL_Buffer *B, size_t sz)
static void warnfon(void *ud, const char *message, int tocont)
#define checkbufferlevel(B, idx)
const LUA_API char * lua_pushlstring(lua_State *L, const char *s, size_t len)
static const char * getS(lua_State *L, void *ud, size_t *size)
LUA_API void lua_rawseti(lua_State *L, int idx, lua_Integer n)
LUALIB_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
LUALIB_API lua_Integer luaL_optinteger(lua_State *L, int arg, lua_Integer def)
LUALIB_API void luaL_unref(lua_State *L, int t, int ref)
LUA_API int lua_next(lua_State *L, int idx)
LUALIB_API void luaL_checkstack(lua_State *L, int space, const char *msg)
LUALIB_API void luaL_traceback(lua_State *L, lua_State *L1, const char *msg, int level)
#define lua_tonumber(L, i)
static int boxgc(lua_State *L)
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int arg)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
LUALIB_API void luaL_where(lua_State *L, int level)
#define lua_writestringerror(s, p)
static size_t newbuffsize(luaL_Buffer *B, size_t sz)
LUALIB_API void luaL_requiref(lua_State *L, const char *modname, lua_CFunction openf, int glb)
const LUALIB_API char * luaL_gsub(lua_State *L, const char *s, const char *p, const char *r)
LUALIB_API lua_Number luaL_optnumber(lua_State *L, int arg, lua_Number def)
LUA_API void * lua_newuserdatauv(lua_State *L, size_t size, int nuvalue)
LUALIB_API lua_Integer luaL_checkinteger(lua_State *L, int arg)
static void tag_error(lua_State *L, int arg, int tag)
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *pisnum)
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)
const LUA_API char * lua_tolstring(lua_State *L, int idx, size_t *len)
int(* lua_CFunction)(lua_State *L)
LUA_API void lua_pushnil(lua_State *L)
LUA_API int lua_toboolean(lua_State *L, int idx)
LUALIB_API lua_State * luaL_newstate(void)
LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode)
LUALIB_API void luaL_addvalue(luaL_Buffer *B)
LUALIB_API void luaL_addgsub(luaL_Buffer *b, const char *s, const char *p, const char *r)
static int pushglobalfuncname(lua_State *L, lua_Debug *ar)
static int lastlevel(lua_State *L)
LUA_API int lua_absindex(lua_State *L, int idx)
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
static void warnfoff(void *ud, const char *message, int tocont)
LUALIB_API int luaL_typeerror(lua_State *L, int arg, const char *tname)
#define luaL_addsize(B, s)
LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
static int checkcontrol(lua_State *L, const char *message, int tocont)
static int skipBOM(LoadF *lf)
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx)
LUALIB_API void luaL_checkversion_(lua_State *L, lua_Number ver, size_t sz)
const LUALIB_API char * luaL_tolstring(lua_State *L, int idx, size_t *len)
static int panic(lua_State *L)
LUALIB_API void luaL_setmetatable(lua_State *L, const char *tname)
LUA_API int lua_error(lua_State *L)
const LUA_API void * lua_topointer(lua_State *L, int idx)
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44