From b5c65705ca78560cd2735778737122ea5f858bd0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 31 Mar 2023 11:47:31 -0300 Subject: New year (2023) Also, small tweak in makefile. (-Wsign-compare is already enabled by -Wextra.) --- manual/2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manual') diff --git a/manual/2html b/manual/2html index a4d860dd..43fd8913 100755 --- a/manual/2html +++ b/manual/2html @@ -30,7 +30,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes

Copyright -© 2022 Lua.org, PUC-Rio. All rights reserved. +© 2023 Lua.org, PUC-Rio. All rights reserved.


-- cgit v1.2.3-55-g6feb From e15f1f2bb7a38a3c94519294d031e48508d65006 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 18 Apr 2023 09:44:10 -0300 Subject: Details Typos in comments and details in the manual. --- ldebug.c | 4 ++-- llex.c | 2 +- llimits.h | 2 +- lparser.c | 8 ++++---- lstrlib.c | 2 +- lua.c | 2 +- manual/manual.of | 8 ++++---- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'manual') diff --git a/ldebug.c b/ldebug.c index 7a61a780..28b1caab 100644 --- a/ldebug.c +++ b/ldebug.c @@ -659,7 +659,7 @@ static const char *funcnamefromcall (lua_State *L, CallInfo *ci, ** Check whether pointer 'o' points to some value in the stack frame of ** the current function and, if so, returns its index. Because 'o' may ** not point to a value in this stack, we cannot compare it with the -** region boundaries (undefined behaviour in ISO C). +** region boundaries (undefined behavior in ISO C). */ static int instack (CallInfo *ci, const TValue *o) { int pos; @@ -848,7 +848,7 @@ static int changedline (const Proto *p, int oldpc, int newpc) { if (p->lineinfo == NULL) /* no debug information? */ return 0; if (newpc - oldpc < MAXIWTHABS / 2) { /* not too far apart? */ - int delta = 0; /* line diference */ + int delta = 0; /* line difference */ int pc = oldpc; for (;;) { int lineinfo = p->lineinfo[++pc]; diff --git a/llex.c b/llex.c index b0dc0acc..5fc39a5c 100644 --- a/llex.c +++ b/llex.c @@ -128,7 +128,7 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) { ** ensuring there is only one copy of each unique string. The table ** here is used as a set: the string enters as the key, while its value ** is irrelevant. We use the string itself as the value only because it -** is a TValue readly available. Later, the code generation can change +** is a TValue readily available. Later, the code generation can change ** this value. */ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { diff --git a/llimits.h b/llimits.h index 251a2702..1c826f7b 100644 --- a/llimits.h +++ b/llimits.h @@ -82,7 +82,7 @@ typedef signed char ls_byte; #if defined(UINTPTR_MAX) /* even in C99 this type is optional */ #define L_P2I uintptr_t #else /* no 'intptr'? */ -#define L_P2I uintmax_t /* use the largerst available integer */ +#define L_P2I uintmax_t /* use the largest available integer */ #endif #else /* C89 option */ #define L_P2I size_t diff --git a/lparser.c b/lparser.c index 24668c24..b745f236 100644 --- a/lparser.c +++ b/lparser.c @@ -521,12 +521,12 @@ static l_noret jumpscopeerror (LexState *ls, Labeldesc *gt) { /* ** Solves the goto at index 'g' to given 'label' and removes it -** from the list of pending goto's. +** from the list of pending gotos. ** If it jumps into the scope of some variable, raises an error. */ static void solvegoto (LexState *ls, int g, Labeldesc *label) { int i; - Labellist *gl = &ls->dyd->gt; /* list of goto's */ + Labellist *gl = &ls->dyd->gt; /* list of gotos */ Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */ lua_assert(eqstr(gt->name, label->name)); if (l_unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */ @@ -580,7 +580,7 @@ static int newgotoentry (LexState *ls, TString *name, int line, int pc) { /* ** Solves forward jumps. Check whether new label 'lb' matches any ** pending gotos in current block and solves them. Return true -** if any of the goto's need to close upvalues. +** if any of the gotos need to close upvalues. */ static int solvegotos (LexState *ls, Labeldesc *lb) { Labellist *gl = &ls->dyd->gt; @@ -601,7 +601,7 @@ static int solvegotos (LexState *ls, Labeldesc *lb) { /* ** Create a new label with the given 'name' at the given 'line'. ** 'last' tells whether label is the last non-op statement in its -** block. Solves all pending goto's to this new label and adds +** block. Solves all pending gotos to this new label and adds ** a close instruction if necessary. ** Returns true iff it added a close instruction. */ diff --git a/lstrlib.c b/lstrlib.c index 0b4fdbb7..03167161 100644 --- a/lstrlib.c +++ b/lstrlib.c @@ -570,7 +570,7 @@ static const char *match_capture (MatchState *ms, const char *s, int l) { static const char *match (MatchState *ms, const char *s, const char *p) { if (l_unlikely(ms->matchdepth-- == 0)) luaL_error(ms->L, "pattern too complex"); - init: /* using goto's to optimize tail recursion */ + init: /* using goto to optimize tail recursion */ if (p != ms->p_end) { /* end of pattern? */ switch (*p) { case '(': { /* start capture */ diff --git a/lua.c b/lua.c index 715430a0..0ff88454 100644 --- a/lua.c +++ b/lua.c @@ -666,7 +666,7 @@ int main (int argc, char **argv) { l_message(argv[0], "cannot create state: not enough memory"); return EXIT_FAILURE; } - lua_gc(L, LUA_GCSTOP); /* stop GC while buidling state */ + lua_gc(L, LUA_GCSTOP); /* stop GC while building state */ lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ lua_pushinteger(L, argc); /* 1st argument */ lua_pushlightuserdata(L, argv); /* 2nd argument */ diff --git a/manual/manual.of b/manual/manual.of index 6d19e251..ac1d7e60 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -20,7 +20,7 @@ making it ideal for configuration, scripting, and rapid prototyping. Lua is implemented as a library, written in @emphx{clean C}, -the common subset of @N{Standard C} and C++. +the common subset of @N{standard C} and C++. The Lua distribution includes a host program called @id{lua}, which uses the Lua library to offer a complete, standalone Lua interpreter, @@ -2963,7 +2963,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, return realloc(ptr, nsize); } } -Note that @N{Standard C} ensures +Note that @N{ISO C} ensures that @T{free(NULL)} has no effect and that @T{realloc(NULL,size)} is equivalent to @T{malloc(size)}. @@ -5780,7 +5780,7 @@ with @id{tname} in the registry. Creates a new Lua state. It calls @Lid{lua_newstate} with an -allocator based on the @N{standard C} allocation functions +allocator based on the @N{ISO C} allocation functions and then sets a warning function and a panic function @see{C-error} that print messages to the standard error output. @@ -6898,7 +6898,7 @@ including if necessary a path and an extension. @id{funcname} must be the exact name exported by the @N{C library} (which may depend on the @N{C compiler} and linker used). -This function is not supported by @N{Standard C}. +This functionality is not supported by @N{ISO C}. As such, it is only available on some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix systems that support the @id{dlfcn} standard). -- cgit v1.2.3-55-g6feb From 6443185167c77adcc8552a3fee7edab7895db1a9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 2 May 2023 16:41:43 -0300 Subject: "Emergency" new version 5.4.6 'lua_resetthread' is back to its original signature, to avoid incompatibilities in the ABI between releases of the same version. New function 'lua_closethread' added with the "correct" signature. --- lcorolib.c | 4 ++-- lstate.c | 10 +++++++++- ltests.c | 2 +- lua.h | 7 ++++--- manual/manual.of | 40 +++++++++++++++++++++++++--------------- 5 files changed, 41 insertions(+), 22 deletions(-) (limited to 'manual') diff --git a/lcorolib.c b/lcorolib.c index 40b880b1..c64adf08 100644 --- a/lcorolib.c +++ b/lcorolib.c @@ -76,7 +76,7 @@ static int luaB_auxwrap (lua_State *L) { if (l_unlikely(r < 0)) { /* error? */ int stat = lua_status(co); if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ - stat = lua_resetthread(co, L); /* close its tbc variables */ + stat = lua_closethread(co, L); /* close its tbc variables */ lua_assert(stat != LUA_OK); lua_xmove(co, L, 1); /* move error message to the caller */ } @@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) { int status = auxstatus(L, co); switch (status) { case COS_DEAD: case COS_YIELD: { - status = lua_resetthread(co, L); + status = lua_closethread(co, L); if (status == LUA_OK) { lua_pushboolean(L, 1); return 1; diff --git a/lstate.c b/lstate.c index 1fbefb4b..1e925e5a 100644 --- a/lstate.c +++ b/lstate.c @@ -339,7 +339,7 @@ int luaE_resetthread (lua_State *L, int status) { } -LUA_API int lua_resetthread (lua_State *L, lua_State *from) { +LUA_API int lua_closethread (lua_State *L, lua_State *from) { int status; lua_lock(L); L->nCcalls = (from) ? getCcalls(from) : 0; @@ -349,6 +349,14 @@ LUA_API int lua_resetthread (lua_State *L, lua_State *from) { } +/* +** Deprecated! Use 'lua_closethread' instead. +*/ +LUA_API int lua_resetthread (lua_State *L) { + return lua_closethread(L, NULL); +} + + LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { int i; lua_State *L; diff --git a/ltests.c b/ltests.c index 4a0a6af1..7d184c0d 100644 --- a/ltests.c +++ b/ltests.c @@ -1533,7 +1533,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { lua_newthread(L1); } else if EQ("resetthread") { - lua_pushinteger(L1, lua_resetthread(L1, L)); + lua_pushinteger(L1, lua_resetthread(L1)); /* deprecated */ } else if EQ("newuserdata") { lua_newuserdata(L1, getnum); diff --git a/lua.h b/lua.h index 01927c6d..fd16cf80 100644 --- a/lua.h +++ b/lua.h @@ -18,10 +18,10 @@ #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MINOR "4" -#define LUA_VERSION_RELEASE "5" +#define LUA_VERSION_RELEASE "6" #define LUA_VERSION_NUM 504 -#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 5) +#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6) #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE @@ -163,7 +163,8 @@ extern const char lua_ident[]; LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); LUA_API void (lua_close) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L); -LUA_API int (lua_resetthread) (lua_State *L, lua_State *from); +LUA_API int (lua_closethread) (lua_State *L, lua_State *from); +LUA_API int (lua_resetthread) (lua_State *L); /* Deprecated! */ LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); diff --git a/manual/manual.of b/manual/manual.of index ac1d7e60..f8d8ddd4 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -3167,6 +3167,27 @@ when called through this function. } +@APIEntry{int lua_closethread (lua_State *L, lua_State *from);| +@apii{0,?,-} + +Resets a thread, cleaning its call stack and closing all pending +to-be-closed variables. +Returns a status code: +@Lid{LUA_OK} for no errors in the thread +(either the original error that stopped the thread or +errors in closing methods), +or an error status otherwise. +In case of error, +leaves the error object on the top of the stack. + +The parameter @id{from} represents the coroutine that is resetting @id{L}. +If there is no such coroutine, +this parameter can be @id{NULL}. + +(This function was introduced in @N{release 5.4.6}.) + +} + @APIEntry{int lua_compare (lua_State *L, int index1, int index2, int op);| @apii{0,0,e} @@ -4160,23 +4181,12 @@ and then pops the top element. } -@APIEntry{int lua_resetthread (lua_State *L, lua_State *from);| +@APIEntry{int lua_resetthread (lua_State *L);| @apii{0,?,-} -Resets a thread, cleaning its call stack and closing all pending -to-be-closed variables. -Returns a status code: -@Lid{LUA_OK} for no errors in the thread -(either the original error that stopped the thread or -errors in closing methods), -or an error status otherwise. -In case of error, -leaves the error object on the top of the stack. - -The parameter @id{from} represents the coroutine that is resetting @id{L}. -If there is no such coroutine, -this parameter can be @id{NULL}. -(This parameter was introduced in @N{release 5.4.5}.) +This function is deprecated; +it is equivalent to @Lid{lua_closethread} with +@id{from} being @id{NULL}. } -- cgit v1.2.3-55-g6feb