summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/luametatex/source/lua/lmttokenlib.c20
-rw-r--r--source/luametatex/source/luametatex.h6
-rw-r--r--source/luametatex/source/tex/texcommands.c2
-rw-r--r--source/luametatex/source/tex/texscanning.c3
4 files changed, 25 insertions, 6 deletions
diff --git a/source/luametatex/source/lua/lmttokenlib.c b/source/luametatex/source/lua/lmttokenlib.c
index 1b50f18d2..c8f7f9039 100644
--- a/source/luametatex/source/lua/lmttokenlib.c
+++ b/source/luametatex/source/lua/lmttokenlib.c
@@ -1291,6 +1291,21 @@ static int tokenlib_scan_dimen(lua_State *L)
}
}
+static int tokenlib_scan_posit(lua_State *L)
+{
+ saved_tex_scanner texstate = tokenlib_aux_save_tex_scanner();
+ int eq = lua_toboolean(L, 1);
+ int fl = lua_toboolean(L, 1);
+ halfword val = tex_scan_posit(eq);
+ if (fl) {
+ lua_pushnumber(L, tex_posit_to_double(val));
+ } else {
+ lua_pushinteger(L, val);
+ }
+ tokenlib_aux_unsave_tex_scanner(texstate);
+ return 1;
+}
+
static int tokenlib_gobble_dimen(lua_State *L)
{
saved_tex_scanner texstate = tokenlib_aux_save_tex_scanner();
@@ -3597,6 +3612,7 @@ static const struct luaL_Reg tokenlib_function_list[] = {
{ "scanluacardinal", tokenlib_scan_luacardinal },
{ "scanscale", tokenlib_scan_scale },
{ "scandimen", tokenlib_scan_dimen },
+ { "scanposit", tokenlib_scan_posit },
{ "scanskip", tokenlib_scan_skip },
{ "scanglue", tokenlib_scan_glue },
{ "scantoks", tokenlib_scan_toks },
@@ -3867,6 +3883,10 @@ int lmt_function_call_by_category(int slot, int property, halfword *value)
break;
}
case lua_value_float_code:
+ {
+ *value = tex_double_to_posit(lua_tonumber(L, -1)).v;
+ break;
+ }
case lua_value_string_code:
{
category = lua_value_none_code;
diff --git a/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h
index eac028cb2..8d5aa4e9a 100644
--- a/source/luametatex/source/luametatex.h
+++ b/source/luametatex/source/luametatex.h
@@ -90,9 +90,9 @@
# include "tex/textypes.h"
# define luametatex_version 210
-# define luametatex_revision 8
-# define luametatex_version_string "2.10.08"
-# define luametatex_development_id 20230426
+# define luametatex_revision 9
+# define luametatex_version_string "2.10.09"
+# define luametatex_development_id 20230427
# define luametatex_name_camelcase "LuaMetaTeX"
# define luametatex_name_lowercase "luametatex"
diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c
index 73f509a96..91e6d75b8 100644
--- a/source/luametatex/source/tex/texcommands.c
+++ b/source/luametatex/source/tex/texcommands.c
@@ -621,7 +621,7 @@ void tex_initialize_commands(void)
tex_primitive(etex_command, "mutoglue", some_item_cmd, mu_to_glue_code, 0);
tex_primitive(etex_command, "gluetomu", some_item_cmd, glue_to_mu_code, 0);
tex_primitive(etex_command, "numexpr", some_item_cmd, numexpr_code, 0);
- tex_primitive(luatex_command, "posexpr", some_item_cmd, posexpr_code, 0);
+ tex_primitive(luatex_command, "floatexpr", some_item_cmd, posexpr_code, 0);
tex_primitive(etex_command, "dimexpr", some_item_cmd, dimexpr_code, 0);
tex_primitive(etex_command, "glueexpr", some_item_cmd, glueexpr_code, 0);
tex_primitive(etex_command, "muexpr", some_item_cmd, muexpr_code, 0);
diff --git a/source/luametatex/source/tex/texscanning.c b/source/luametatex/source/tex/texscanning.c
index 5b60c15c0..8ae7090cf 100644
--- a/source/luametatex/source/tex/texscanning.c
+++ b/source/luametatex/source/tex/texscanning.c
@@ -354,8 +354,7 @@ static void tex_aux_set_cur_val_by_lua_value_cmd(halfword index, halfword proper
cur_val_level = int_val_level;
break;
case lua_value_float_code:
- /*tex We assume a proper print back. */
- cur_val_level = tok_val_level;
+ cur_val_level = posit_val_level;
break;
case lua_value_string_code:
cur_val_level = no_val_level;