diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-05-08 18:02:07 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-05-08 18:02:07 +0200 |
commit | bb8ae12f4f94189fd1540b201e2aea78f485de97 (patch) | |
tree | 276278bd85ffa1571950669656cbdffe1b8fd68a /source/luametatex | |
parent | 51156ffe8b1434d9c1896f12a59554cbe877ee3d (diff) | |
download | context-bb8ae12f4f94189fd1540b201e2aea78f485de97.tar.gz |
2023-05-08 17:39:00
Diffstat (limited to 'source/luametatex')
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/lcorolib.c | 4 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/ldebug.c | 4 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/llex.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/llimits.h | 2 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/lparser.c | 8 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/lstate.c | 10 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/lstrlib.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/lua.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/lua.h | 7 | ||||
-rw-r--r-- | source/luametatex/source/luametatex.h | 2 | ||||
-rw-r--r-- | source/luametatex/source/luarest/lmtposit.c | 6 | ||||
-rw-r--r-- | source/luametatex/source/tex/texmaincontrol.c | 4 | ||||
-rw-r--r-- | source/luametatex/source/tex/texscanning.c | 10 | ||||
-rw-r--r-- | source/luametatex/source/utilities/auxposit.h | 5 |
14 files changed, 39 insertions, 29 deletions
diff --git a/source/luametatex/source/luacore/lua54/src/lcorolib.c b/source/luametatex/source/luacore/lua54/src/lcorolib.c index 40b880b14..c64adf08a 100644 --- a/source/luametatex/source/luacore/lua54/src/lcorolib.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/ldebug.c b/source/luametatex/source/luacore/lua54/src/ldebug.c index 7a61a780e..28b1caabf 100644 --- a/source/luametatex/source/luacore/lua54/src/ldebug.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/llex.c b/source/luametatex/source/luacore/lua54/src/llex.c index b0dc0acc2..5fc39a5cd 100644 --- a/source/luametatex/source/luacore/lua54/src/llex.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/llimits.h b/source/luametatex/source/luacore/lua54/src/llimits.h index 251a27021..1c826f7be 100644 --- a/source/luametatex/source/luacore/lua54/src/llimits.h +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/lparser.c b/source/luametatex/source/luacore/lua54/src/lparser.c index 24668c248..b745f236f 100644 --- a/source/luametatex/source/luacore/lua54/src/lparser.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/lstate.c b/source/luametatex/source/luacore/lua54/src/lstate.c index 1fbefb4b1..1e925e5ad 100644 --- a/source/luametatex/source/luacore/lua54/src/lstate.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/lstrlib.c b/source/luametatex/source/luacore/lua54/src/lstrlib.c index 0b4fdbb7b..03167161d 100644 --- a/source/luametatex/source/luacore/lua54/src/lstrlib.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/lua.c b/source/luametatex/source/luacore/lua54/src/lua.c index 715430a0d..0ff884545 100644 --- a/source/luametatex/source/luacore/lua54/src/lua.c +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luacore/lua54/src/lua.h b/source/luametatex/source/luacore/lua54/src/lua.h index 01927c6d9..fd16cf805 100644 --- a/source/luametatex/source/luacore/lua54/src/lua.h +++ b/source/luametatex/source/luacore/lua54/src/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/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h index fe9893e98..2e3b53e71 100644 --- a/source/luametatex/source/luametatex.h +++ b/source/luametatex/source/luametatex.h @@ -92,7 +92,7 @@ # define luametatex_version 210 # define luametatex_revision 9 # define luametatex_version_string "2.10.09" -# define luametatex_development_id 20230507 +# define luametatex_development_id 20230508 # define luametatex_name_camelcase "LuaMetaTeX" # define luametatex_name_lowercase "luametatex" diff --git a/source/luametatex/source/luarest/lmtposit.c b/source/luametatex/source/luarest/lmtposit.c index e7f12b7d2..0344df5cb 100644 --- a/source/luametatex/source/luarest/lmtposit.c +++ b/source/luametatex/source/luarest/lmtposit.c @@ -100,11 +100,7 @@ static posit_t *positlib_get(lua_State *L, int i) case LUA_TNUMBER: { posit p = positlib_push(L); - if (lua_isinteger(L, i)) { - *p = i64_to_posit(lua_tointeger(L, 1)); - } else { - *p = double_to_posit(lua_tonumber(L, i)); - } + *p = lua_isinteger(L, i) ? integer_to_posit(lua_tointeger(L, i)) : double_to_posit(lua_tonumber(L, i)); lua_replace(L, i); return p; } diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c index d043209e5..3989dfff0 100644 --- a/source/luametatex/source/tex/texmaincontrol.c +++ b/source/luametatex/source/tex/texmaincontrol.c @@ -3737,7 +3737,7 @@ static void tex_aux_arithmic_register(int a, int code) value = tex_multiply_integers(original, amount); break; case posit_val_level: - value = tex_posit_mul(original, amount); + value = tex_posit_mul_by(original, amount); break; case dimen_val_level: value = tex_nx_plus_y(original, amount, 0); @@ -3782,7 +3782,7 @@ static void tex_aux_arithmic_register(int a, int code) value = tex_x_over_n(original, amount); break; case posit_val_level: - value = tex_posit_div(original, amount); + value = tex_posit_div_by(original, amount); break; case glue_val_level: case mu_val_level: diff --git a/source/luametatex/source/tex/texscanning.c b/source/luametatex/source/tex/texscanning.c index 2b9d6a110..675186681 100644 --- a/source/luametatex/source/tex/texscanning.c +++ b/source/luametatex/source/tex/texscanning.c @@ -6095,9 +6095,9 @@ halfword tex_scan_posit(int optional_equal) tex_back_input(cur_tok); goto DONE; } - if (b >= max_posit_size) { - goto TOOBIG; - } + if (b >= max_posit_size) { + goto TOOBIG; + } } DECIMALEXPONENT: if (tex_token_is_exponent(cur_tok)) { @@ -6192,10 +6192,12 @@ halfword tex_scan_posit(int optional_equal) } tex_back_input(cur_tok); DONE: - { + if (b) { double d = strtof(buffer, NULL); cur_val = tex_double_to_posit(d).v; return cur_val; + } else { + tex_aux_missing_number_error(); } TOOBIG: cur_val = tex_integer_to_posit(0).v; diff --git a/source/luametatex/source/utilities/auxposit.h b/source/luametatex/source/utilities/auxposit.h index cc18dae2a..6abeae2c9 100644 --- a/source/luametatex/source/utilities/auxposit.h +++ b/source/luametatex/source/utilities/auxposit.h @@ -113,7 +113,10 @@ typedef posit32_t tex_posit; # define tex_posit_mul(p,q) (halfword) posit_mul((tex_posit) { .v = (uint32_t) p }, (tex_posit) { .v = (uint32_t) q }).v # define tex_posit_div(p,q) (halfword) posit_div((tex_posit) { .v = (uint32_t) p }, (tex_posit) { .v = (uint32_t) q }).v # define tex_posit_sqrt(p) (halfword) posit_sqrt((tex_posit) { .v = (uint32_t) p }.v - + +# define tex_posit_mul_by(p,q) (halfword) posit_mul((tex_posit) { .v = (uint32_t) p }, tex_integer_to_posit(q)).v +# define tex_posit_div_by(p,q) (halfword) posit_div((tex_posit) { .v = (uint32_t) p }, tex_integer_to_posit(q)).v + # define tex_posit_is_NaR(p) posit_is_NaR((tex_posit) { .v = (uint32_t) p }) # define tex_posit_eq_zero(p) posit_eq_zero((tex_posit) { .v = (uint32_t) p }) |