diff options
Diffstat (limited to 'source/luametatex/source/lua')
-rw-r--r-- | source/luametatex/source/lua/lmtcallbacklib.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtenginelib.c | 6 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtfontlib.c | 115 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtinterface.h | 150 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtlibrary.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtlibrary.h | 2 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtluaclib.c | 2 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtmplib.c | 19 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmtnodelib.c | 37 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmttexlib.c | 44 | ||||
-rw-r--r-- | source/luametatex/source/lua/lmttokenlib.c | 33 |
11 files changed, 208 insertions, 204 deletions
diff --git a/source/luametatex/source/lua/lmtcallbacklib.c b/source/luametatex/source/lua/lmtcallbacklib.c index 8724cdd6f..a971b5e57 100644 --- a/source/luametatex/source/lua/lmtcallbacklib.c +++ b/source/luametatex/source/lua/lmtcallbacklib.c @@ -151,8 +151,8 @@ static int callbacklib_aux_run(lua_State *L, int id, int special, const char *va } else if (special == 2) { narg++; } + lmt_lua_state.saved_callback_count++; { - lmt_lua_state.saved_callback_count++; int i = lua_pcall(L, narg, nres, base); if (i) { /*tex diff --git a/source/luametatex/source/lua/lmtenginelib.c b/source/luametatex/source/lua/lmtenginelib.c index f8df06657..fef2ed819 100644 --- a/source/luametatex/source/lua/lmtenginelib.c +++ b/source/luametatex/source/lua/lmtenginelib.c @@ -320,8 +320,8 @@ static void enginelib_show_credits(void) "and has been extended in many aspects.\n" "\n" "There is a lightweight subsystem for optional libraries but here we also delegate as much\n" - "as possibe to Lua. A few interfaces are provided bny default, others can be added using a\n" - "simple foreign interface subsystem. Although this is provided an dconsidered part of the\n" + "as possible to Lua. A few interfaces are provided by default, others can be added using a\n" + "simple foreign interface subsystem. Although this is provided and considered part of the\n" "LuaMetaTeX engine it is not something ConTeXt depends (and will) depend on.\n" "\n" "version : " luametatex_version_string " | " LMT_TOSTRING(luametatex_development_id) "\n" @@ -433,7 +433,7 @@ static void enginelib_check_option(char **options, int i) */ -const char *suffixes[] = { "lmt", "lua", NULL }; +static const char *suffixes[] = { "lmt", "lua", NULL }; static void enginelib_parse_options(void) { diff --git a/source/luametatex/source/lua/lmtfontlib.c b/source/luametatex/source/lua/lmtfontlib.c index 5004a9710..953d3bcd1 100644 --- a/source/luametatex/source/lua/lmtfontlib.c +++ b/source/luametatex/source/lua/lmtfontlib.c @@ -248,11 +248,13 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int { if (lua_istable(L, -1)) { /*tex We need an intermediate veriable: */ - scaled target; - int state; + int target; + const char *starget; charinfo *co = tex_get_charinfo(f, i); - set_any_field_by_index(state, callback); - set_charinfo_tag(co, state ? callback_tag : 0); + set_numeric_field_by_index(target, tag, 0); + set_charinfo_tag(co, target ? tex_char_checked_tag(target) : 0); + set_any_field_by_index(target, callback); + set_charinfo_tag(co, target ? callback_tag : 0); set_numeric_field_by_index(target, width, 0); set_charinfo_width(co, target); set_numeric_field_by_index(target, height, 0); @@ -263,19 +265,20 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int set_charinfo_italic(co, target); set_numeric_field_by_index(target, expansion, 1000); set_charinfo_expansion(co, target); + set_numeric_field_by_index(target, compression, target); + set_charinfo_compression(co, target); set_numeric_field_by_index(target, leftprotrusion, 0); set_charinfo_leftprotrusion(co, target); set_numeric_field_by_index(target, rightprotrusion, 0); set_charinfo_rightprotrusion(co, target); - set_charinfo_tag(co, 0); if (has_math) { tex_char_malloc_mathinfo(co); set_numeric_field_by_index(target, smaller, 0); set_charinfo_smaller(co, target); set_numeric_field_by_index(target, mirror, 0); set_charinfo_mirror(co, target); - set_numeric_field_by_index(target, vitalic, 0); - set_charinfo_vertical_italic(co, target); + set_numeric_field_by_index(target, flataccent, INT_MIN); + set_charinfo_flat_accent(co, target); /* */ set_numeric_field_by_index(target, topleft, 0); set_charinfo_top_left_kern(co, target); @@ -304,83 +307,58 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int set_charinfo_top_anchor(co, target); set_numeric_field_by_index(target, bottomanchor, INT_MIN); set_charinfo_bottom_anchor(co, target); - set_numeric_field_by_index(target, flataccent, INT_MIN); - set_charinfo_flat_accent(co, target); + /* */ + set_string_field_by_index(starget, innerlocation); + if (lua_key_eq(starget, left)) { + set_charinfo_tag(co, inner_left_tag); + } else if (lua_key_eq(starget, right)) { + set_charinfo_tag(co, inner_right_tag); + } + set_numeric_field_by_index(target, innerxoffset, INT_MIN); + set_charinfo_inner_x_offset(co, target); + set_numeric_field_by_index(target, inneryoffset, INT_MIN); + set_charinfo_inner_y_offset(co, target); + /* */ set_numeric_field_by_index(target, next, -1); if (target >= 0) { set_charinfo_tag(co, list_tag); - set_charinfo_remainder(co, target); + set_charinfo_next(co, target); } - lua_push_key(extensible); - switch (lua_rawget(L, -2)) { - case LUA_TTABLE: - { - int top, bottom, middle, extender; - set_numeric_field_by_index(top, top, 0); - set_numeric_field_by_index(bottom, bottom, 0); - set_numeric_field_by_index(middle, middle, 0); - set_numeric_field_by_index(extender, extender, 0); - if (top || bottom || middle || extender) { - set_charinfo_tag(co, extension_tag); - tex_set_charinfo_extensible(co, top, bottom, middle, extender); - } else { - tex_formatted_warning("font", "lua-loaded font %s char U+%X has an invalid extensible field", font_name(f), (int) i); - } - } - break; - case LUA_TBOOLEAN: - if (lua_toboolean(L, -2)) { - set_charinfo_tag(co, extend_last_tag); - } - break; - } - lua_pop(L, 1); - lua_push_key(hparts); + set_boolean_field_by_index(target, extensible, 0); + if (target) { + set_charinfo_tag(co, extend_last_tag); + } + lua_push_key(parts); if (lua_rawget(L, -2) == LUA_TTABLE) { - set_charinfo_tag(co, extension_tag); - tex_set_charinfo_horizontal_parts(co, NULL); + set_charinfo_tag(co, extensible_tag); + tex_set_charinfo_extensible_recipe(co, NULL); for (lua_Integer k = 1; ; k++) { if (lua_rawgeti(L, -1, k) == LUA_TTABLE) { int glyph, startconnect, endconnect, advance, extender; - extinfo *h; set_numeric_field_by_index(glyph, glyph, 0); set_numeric_field_by_index(extender, extender, 0); set_numeric_field_by_index(startconnect, start, 0); set_numeric_field_by_index(endconnect, end, 0); set_numeric_field_by_index(advance, advance, 0); - h = tex_new_charinfo_part(glyph, startconnect, endconnect, advance, extender); - tex_add_charinfo_horizontal_part(co, h); - lua_pop(L, 1); - } else { - lua_pop(L, 1); - break; - } - } - } - lua_pop(L, 1); - lua_push_key(vparts); - if (lua_rawget(L, -2) == LUA_TTABLE) { - set_charinfo_tag(co, extension_tag); - tex_set_charinfo_vertical_parts(co, NULL); - for (lua_Integer k = 1; ; k++) { - if (lua_rawgeti(L, -1, k) == LUA_TTABLE) { - int glyph, startconnect, endconnect, advance, extender; - extinfo *h; - set_numeric_field_by_index(glyph, glyph, 0); - set_numeric_field_by_index(extender, extender, 0); - set_numeric_field_by_index(startconnect, start, 0); - set_numeric_field_by_index(endconnect, end, 0); - set_numeric_field_by_index(advance, advance, 0); - h = tex_new_charinfo_part(glyph, startconnect, endconnect, advance, extender); - tex_add_charinfo_vertical_part(co, h); + tex_append_charinfo_extensible_recipe(co, glyph, startconnect, endconnect, advance, extender); lua_pop(L, 1); } else { lua_pop(L, 1); break; } } + lua_pop(L, 1); + set_numeric_field_by_index(target, partsitalic, 0); + set_charinfo_extensible_italic(co, target); + set_string_field_by_index(starget, partsorientation); + if (lua_key_eq(starget, horizontal)) { + set_charinfo_tag(co, horizontal_tag); + } else if (lua_key_eq(starget, vertical)) { + set_charinfo_tag(co, vertical_tag); + } + } else { + lua_pop(L, 1); } - lua_pop(L, 1); lua_push_key(mathkerns); if (lua_rawget(L, -2) == LUA_TTABLE) { fontlib_aux_store_math_kerns(L, lua_key_index(topleft), co, top_left_kern); @@ -399,6 +377,7 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int kerninfo *ckerns = lmt_memory_calloc((size_t) count + 1, sizeof(kerninfo)); if (ckerns) { int ctr = 0; + set_charinfo_tag(co, kerns_tag); /*tex Traverse the hash. */ lua_pushnil(L); while (lua_next(L, -2)) { @@ -454,6 +433,7 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int ligatureinfo *cligs = lmt_memory_calloc((size_t) count + 1, sizeof(ligatureinfo)); if (cligs) { int ctr = 0; + set_charinfo_tag(co, ligatures_tag); /*tex Traverse the hash. */ lua_pushnil(L); while (lua_next(L, -2)) { @@ -702,7 +682,7 @@ static int lmt_characters_from_lua(lua_State *L, int f) int i = lmt_tointeger(L, -2); if (i >= 0 && lua_istable(L, -1)) { todo++; - if (! quick_char_exists(f, i)) { + if (! tex_char_exists(f, i)) { num++; if (i > ec) { ec = i; @@ -728,13 +708,12 @@ static int lmt_characters_from_lua(lua_State *L, int f) if (lua_type(L, -2) == LUA_TNUMBER) { int i = lmt_tointeger(L, -2); if (i >= 0) { - if (quick_char_exists(f, i)) { + if (tex_char_exists(f, i)) { charinfo *co = tex_get_charinfo(f, i); set_charinfo_ligatures(co, NULL); set_charinfo_kerns(co, NULL); set_charinfo_math(co, NULL); - tex_set_charinfo_vertical_parts(co, NULL); - tex_set_charinfo_horizontal_parts(co, NULL); + tex_set_charinfo_extensible_recipe(co, NULL); } fontlib_aux_font_char_from_lua(L, f, i, ! no_math); } diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h index e761252a8..707d3aefb 100644 --- a/source/luametatex/source/lua/lmtinterface.h +++ b/source/luametatex/source/lua/lmtinterface.h @@ -392,33 +392,29 @@ make_lua_key(L, above);\ make_lua_key(L, abovedisplayshortskip);\ make_lua_key(L, abovedisplayskip);\ make_lua_key(L, accent);\ -make_lua_key(L, AccentBaseHeight);\ +make_lua_key(L, accentbasedepth);\ make_lua_key(L, AccentBaseDepth);\ make_lua_key(L, accentbaseheight);\ -make_lua_key(L, accentbasedepth);\ -make_lua_key(L, AccentTopShiftUp);\ -make_lua_key(L, accenttopshiftup);\ -make_lua_key(L, AccentTopOvershoot);\ -make_lua_key(L, accenttopovershoot);\ -make_lua_key(L, adapted);\ -make_lua_key(L, FlattenedAccentTopShiftUp);\ -make_lua_key(L, flattenedaccenttopshiftup);\ -make_lua_key(L, AccentBottomShiftDown);\ -make_lua_key(L, accentbottomshiftdown);\ -make_lua_key(L, AccentBottomOvershoot);\ +make_lua_key(L, AccentBaseHeight);\ make_lua_key(L, accentbottomovershoot);\ -make_lua_key(L, AccentSuperscriptDrop);\ -make_lua_key(L, accentsuperscriptdrop);\ -make_lua_key(L, AccentSuperscriptPercent);\ -make_lua_key(L, accentsuperscriptpercent);\ -make_lua_key(L, AccentExtendMargin);\ +make_lua_key(L, AccentBottomOvershoot);\ +make_lua_key(L, accentbottomshiftdown);\ +make_lua_key(L, AccentBottomShiftDown);\ make_lua_key(L, accentextendmargin);\ -make_lua_key(L, FlattenedAccentBottomShiftDown);\ -make_lua_key(L, flattenedaccentbottomshiftdown);\ +make_lua_key(L, AccentExtendMargin);\ make_lua_key(L, accentkern);\ +make_lua_key(L, accentsuperscriptdrop);\ +make_lua_key(L, AccentSuperscriptDrop);\ +make_lua_key(L, accentsuperscriptpercent);\ +make_lua_key(L, AccentSuperscriptPercent);\ +make_lua_key(L, accenttopovershoot);\ +make_lua_key(L, AccentTopOvershoot);\ +make_lua_key(L, accenttopshiftup);\ +make_lua_key(L, AccentTopShiftUp);\ make_lua_key(L, accentvariant);\ make_lua_key(L, active);\ make_lua_key(L, active_char);\ +make_lua_key(L, adapted);\ make_lua_key(L, adapttoleftsize);\ make_lua_key(L, adapttorightsize);\ make_lua_key(L, additional);\ @@ -437,12 +433,12 @@ make_lua_key(L, afterdisplaypenalty);\ make_lua_key(L, afteroutput);\ make_lua_key(L, aliased);\ make_lua_key(L, align);\ -make_lua_key(L, alignrecord);\ -make_lua_key(L, alignstack);\ make_lua_key(L, alignhead);\ make_lua_key(L, alignment);\ make_lua_key(L, alignment_tab);\ +make_lua_key(L, alignrecord);\ make_lua_key(L, alignset);\ +make_lua_key(L, alignstack);\ make_lua_key(L, alsosimple);\ make_lua_key(L, anchor);\ make_lua_key(L, argument);\ @@ -483,16 +479,16 @@ make_lua_key(L, binpunctspacing);\ make_lua_key(L, binradspacing);\ make_lua_key(L, binrelspacing);\ make_lua_key(L, boolean);\ -make_lua_key(L, bottomaccent);\ -make_lua_key(L, bottomanchor);\ -make_lua_key(L, bottomaccentvariant);\ make_lua_key(L, bothflexible);\ make_lua_key(L, bottom);\ +make_lua_key(L, bottomaccent);\ +make_lua_key(L, bottomaccentvariant);\ +make_lua_key(L, bottomanchor);\ make_lua_key(L, bottomleft);\ make_lua_key(L, bottomlevel);\ make_lua_key(L, bottommargin);\ -make_lua_key(L, bottomright);\ make_lua_key(L, bottomovershoot);\ +make_lua_key(L, bottomright);\ make_lua_key(L, boundary);\ make_lua_key(L, box);\ make_lua_key(L, broken);\ @@ -504,8 +500,8 @@ make_lua_key(L, callback);\ make_lua_key(L, cancel);\ make_lua_key(L, cardinal);\ make_lua_key(L, case_shift);\ -make_lua_key(L, catalog);\ make_lua_key(L, Catalog);\ +make_lua_key(L, catalog);\ make_lua_key(L, catcode_table);\ make_lua_key(L, category);\ make_lua_key(L, cell);\ @@ -539,6 +535,7 @@ make_lua_key(L, command);\ make_lua_key(L, comment);\ make_lua_key(L, compactmath);\ make_lua_key(L, compound);\ +make_lua_key(L, compression);\ make_lua_key(L, condition);\ make_lua_key(L, conditional);\ make_lua_key(L, conditionalmathskip);\ @@ -567,16 +564,16 @@ make_lua_key(L, define_font);\ make_lua_key(L, define_lua_call);\ make_lua_key(L, degree);\ make_lua_key(L, degreevariant);\ +make_lua_key(L, delimited);\ make_lua_key(L, DelimitedSubFormulaMinHeight);\ make_lua_key(L, delimiter);\ -make_lua_key(L, delimited);\ make_lua_key(L, delimiter_number);\ -make_lua_key(L, delimiterpercent);\ -make_lua_key(L, DelimiterPercent);\ -make_lua_key(L, delimitershortfall);\ -make_lua_key(L, DelimiterShortfall);\ make_lua_key(L, delimiterover);\ make_lua_key(L, delimiterovervariant);\ +make_lua_key(L, DelimiterPercent);\ +make_lua_key(L, delimiterpercent);\ +make_lua_key(L, DelimiterShortfall);\ +make_lua_key(L, delimitershortfall);\ make_lua_key(L, delimiterunder);\ make_lua_key(L, delimiterundervariant);\ make_lua_key(L, delta);\ @@ -657,11 +654,15 @@ make_lua_key(L, fixedboth);\ make_lua_key(L, fixedbottom);\ make_lua_key(L, fixedtop);\ make_lua_key(L, flags);\ -make_lua_key(L, FlattenedAccentBaseHeight);\ -make_lua_key(L, flattenedaccentbaseheight);\ -make_lua_key(L, FlattenedAccentBaseDepth);\ -make_lua_key(L, flattenedaccentbasedepth);\ make_lua_key(L, flataccent);\ +make_lua_key(L, flattenedaccentbasedepth);\ +make_lua_key(L, FlattenedAccentBaseDepth);\ +make_lua_key(L, flattenedaccentbaseheight);\ +make_lua_key(L, FlattenedAccentBaseHeight);\ +make_lua_key(L, flattenedaccentbottomshiftdown);\ +make_lua_key(L, FlattenedAccentBottomShiftDown);\ +make_lua_key(L, flattenedaccenttopshiftup);\ +make_lua_key(L, FlattenedAccentTopShiftUp);\ make_lua_key(L, float);\ make_lua_key(L, followedbyspace);\ make_lua_key(L, font);\ @@ -735,15 +736,14 @@ make_lua_key(L, horizontalmathkern);\ make_lua_key(L, hrule);\ make_lua_key(L, hsize);\ make_lua_key(L, hskip);\ -make_lua_key(L, hparts);\ make_lua_key(L, hyphenate);\ make_lua_key(L, hyphenated);\ make_lua_key(L, hyphenation);\ make_lua_key(L, hyphenationmode);\ make_lua_key(L, hyphenchar);\ make_lua_key(L, id);\ -make_lua_key(L, ifstack);\ make_lua_key(L, if_test);\ +make_lua_key(L, ifstack);\ make_lua_key(L, ignore);\ make_lua_key(L, ignore_something);\ make_lua_key(L, ignorebounds);\ @@ -754,13 +754,14 @@ make_lua_key(L, immutable);\ make_lua_key(L, indent);\ make_lua_key(L, indentskip);\ make_lua_key(L, index);\ -make_lua_key(L, Info);\ make_lua_key(L, info);\ +make_lua_key(L, Info);\ make_lua_key(L, inner);\ make_lua_key(L, innerbinspacing);\ make_lua_key(L, innerclosespacing);\ make_lua_key(L, innerfracspacing);\ make_lua_key(L, innerinnerspacing);\ +make_lua_key(L, innerlocation);\ make_lua_key(L, innermiddlespacing);\ make_lua_key(L, inneropenspacing);\ make_lua_key(L, inneropspacing);\ @@ -768,6 +769,8 @@ make_lua_key(L, innerordspacing);\ make_lua_key(L, innerpunctspacing);\ make_lua_key(L, innerradspacing);\ make_lua_key(L, innerrelspacing);\ +make_lua_key(L, innerxoffset);\ +make_lua_key(L, inneryoffset);\ make_lua_key(L, input);\ make_lua_key(L, insert);\ make_lua_key(L, insertheights);\ @@ -791,8 +794,8 @@ make_lua_key(L, internal_mu_glue_reference);\ make_lua_key(L, internal_toks);\ make_lua_key(L, internal_toks_reference);\ make_lua_key(L, internaldimension);\ -make_lua_key(L, internalinteger);\ make_lua_key(L, internalgluespec);\ +make_lua_key(L, internalinteger);\ make_lua_key(L, internalmugluespec);\ make_lua_key(L, invalid_char);\ make_lua_key(L, italic);\ @@ -801,7 +804,6 @@ make_lua_key(L, italiccorrection);\ make_lua_key(L, iterator_value);\ make_lua_key(L, kern);\ make_lua_key(L, kerns);\ -make_lua_key(L, noadstate);\ make_lua_key(L, language);\ make_lua_key(L, largechar);\ make_lua_key(L, largefamily);\ @@ -863,7 +865,6 @@ make_lua_key(L, make_box);\ make_lua_key(L, mark);\ make_lua_key(L, match);\ make_lua_key(L, math);\ -make_lua_key(L, mathspec);\ make_lua_key(L, math_accent);\ make_lua_key(L, math_char_number);\ make_lua_key(L, math_choice);\ @@ -876,7 +877,6 @@ make_lua_key(L, math_script);\ make_lua_key(L, math_shift);\ make_lua_key(L, math_shift_cs);\ make_lua_key(L, math_style);\ -make_lua_key(L, mathtextchar);\ make_lua_key(L, mathchar);\ make_lua_key(L, mathchoice);\ make_lua_key(L, mathcomponent);\ @@ -885,20 +885,22 @@ make_lua_key(L, mathcontrol);\ make_lua_key(L, mathdir);\ make_lua_key(L, mathfence);\ make_lua_key(L, mathfraction);\ -make_lua_key(L, mathradical);\ make_lua_key(L, mathkerns);\ make_lua_key(L, MathLeading);\ make_lua_key(L, mathoperator);\ make_lua_key(L, mathpack);\ make_lua_key(L, mathpostpenalty);\ make_lua_key(L, mathprepenalty);\ +make_lua_key(L, mathradical);\ make_lua_key(L, mathshapekern);\ make_lua_key(L, mathshift);\ make_lua_key(L, mathsimple);\ make_lua_key(L, mathskip);\ +make_lua_key(L, mathspec);\ make_lua_key(L, mathstack);\ -make_lua_key(L, mathsubformula);\ make_lua_key(L, mathstyle);\ +make_lua_key(L, mathsubformula);\ +make_lua_key(L, mathtextchar);\ make_lua_key(L, medmuskip);\ make_lua_key(L, message);\ make_lua_key(L, middle);\ @@ -934,21 +936,22 @@ make_lua_key(L, nil);\ make_lua_key(L, no);\ make_lua_key(L, no_expand);\ make_lua_key(L, noad);\ +make_lua_key(L, noadstate);\ make_lua_key(L, noalign);\ make_lua_key(L, noaligned);\ make_lua_key(L, noaxis);\ make_lua_key(L, nocheck);\ -make_lua_key(L, nooverflow);\ make_lua_key(L, node);\ make_lua_key(L, nodelist);\ make_lua_key(L, noindent);\ make_lua_key(L, nolimits);\ -make_lua_key(L, nolimitsubfactor);\ make_lua_key(L, NoLimitSubFactor);\ -make_lua_key(L, nolimitsupfactor);\ +make_lua_key(L, nolimitsubfactor);\ make_lua_key(L, NoLimitSupFactor);\ +make_lua_key(L, nolimitsupfactor);\ make_lua_key(L, nomath);\ make_lua_key(L, none);\ +make_lua_key(L, nooverflow);\ make_lua_key(L, normal);\ make_lua_key(L, norule);\ make_lua_key(L, noruling);\ @@ -1024,26 +1027,29 @@ make_lua_key(L, overlayaccent);\ make_lua_key(L, overlayaccentvariant);\ make_lua_key(L, overlinevariant);\ make_lua_key(L, overloaded);\ -make_lua_key(L, page);\ make_lua_key(L, package);\ +make_lua_key(L, page);\ make_lua_key(L, pagediscardshead);\ make_lua_key(L, pagehead);\ make_lua_key(L, pageinserthead);\ -make_lua_key(L, Pages);\ make_lua_key(L, pages);\ +make_lua_key(L, Pages);\ make_lua_key(L, par);\ make_lua_key(L, parameter);\ make_lua_key(L, parameter_reference);\ make_lua_key(L, parameters);\ make_lua_key(L, parfillleftskip);\ make_lua_key(L, parfillrightskip);\ -make_lua_key(L, parinitleftskip);\ -make_lua_key(L, parinitrightskip);\ make_lua_key(L, parfillskip);\ make_lua_key(L, parindent);\ +make_lua_key(L, parinitleftskip);\ +make_lua_key(L, parinitrightskip);\ make_lua_key(L, parshape);\ make_lua_key(L, parskip);\ make_lua_key(L, passive);\ +make_lua_key(L, parts);\ +make_lua_key(L, partsitalic);\ +make_lua_key(L, partsorientation);\ make_lua_key(L, pdfe);\ make_lua_key(L, penalty);\ make_lua_key(L, permanent);\ @@ -1080,25 +1086,25 @@ make_lua_key(L, prevgraf);\ make_lua_key(L, prime);\ make_lua_key(L, PrimeBaselineDropMax);\ make_lua_key(L, primeraise);\ -make_lua_key(L, PrimeRaisePercent);\ make_lua_key(L, primeraisecomposed);\ make_lua_key(L, PrimeRaiseComposedPercent);\ +make_lua_key(L, PrimeRaisePercent);\ make_lua_key(L, primeshiftdrop);\ -make_lua_key(L, PrimeShiftUp);\ make_lua_key(L, primeshiftup);\ +make_lua_key(L, PrimeShiftUp);\ make_lua_key(L, PrimeShiftUpCramped);\ -make_lua_key(L, primespaceafter);\ make_lua_key(L, PrimeSpaceAfter);\ +make_lua_key(L, primespaceafter);\ +make_lua_key(L, primevariant);\ make_lua_key(L, primewidth);\ make_lua_key(L, PrimeWidthPercent);\ -make_lua_key(L, primevariant);\ make_lua_key(L, primitive);\ +make_lua_key(L, properties);\ +make_lua_key(L, proportional);\ make_lua_key(L, protected);\ make_lua_key(L, protected_call);\ make_lua_key(L, protrudechars);\ make_lua_key(L, protrusion);\ -make_lua_key(L, properties);\ -make_lua_key(L, proportional);\ make_lua_key(L, ptr);\ make_lua_key(L, punct);\ make_lua_key(L, punctbinspacing);\ @@ -1119,17 +1125,17 @@ make_lua_key(L, radfracspacing);\ make_lua_key(L, radical);\ make_lua_key(L, radicaldegreeafter);\ make_lua_key(L, radicaldegreebefore);\ -make_lua_key(L, radicalextensibleafter);\ -make_lua_key(L, radicalextensiblebefore);\ -make_lua_key(L, RadicalKernAfterExtensible);\ -make_lua_key(L, RadicalKernBeforeExtensible);\ make_lua_key(L, RadicalDegreeBottomRaisePercent);\ make_lua_key(L, radicaldegreeraise);\ make_lua_key(L, RadicalDisplayStyleVerticalGap);\ +make_lua_key(L, radicalextensibleafter);\ +make_lua_key(L, radicalextensiblebefore);\ make_lua_key(L, RadicalExtraAscender);\ make_lua_key(L, radicalkern);\ make_lua_key(L, RadicalKernAfterDegree);\ +make_lua_key(L, RadicalKernAfterExtensible);\ make_lua_key(L, RadicalKernBeforeDegree);\ +make_lua_key(L, RadicalKernBeforeExtensible);\ make_lua_key(L, radicalrule);\ make_lua_key(L, RadicalRuleThickness);\ make_lua_key(L, radicalvariant);\ @@ -1160,8 +1166,8 @@ make_lua_key(L, register_mu_glue_reference);\ make_lua_key(L, register_toks);\ make_lua_key(L, register_toks_reference);\ make_lua_key(L, registerdimension);\ -make_lua_key(L, registerinteger);\ make_lua_key(L, registergluespec);\ +make_lua_key(L, registerinteger);\ make_lua_key(L, registermugluespec);\ make_lua_key(L, regular);\ make_lua_key(L, rel);\ @@ -1227,18 +1233,18 @@ make_lua_key(L, set_specification);\ make_lua_key(L, shapingpenaltiesmode);\ make_lua_key(L, shapingpenalty);\ make_lua_key(L, shift);\ -make_lua_key(L, shiftedsubscript);\ -make_lua_key(L, shiftedsuperscript);\ make_lua_key(L, shiftedsubprescript);\ +make_lua_key(L, shiftedsubscript);\ make_lua_key(L, shiftedsuperprescript);\ +make_lua_key(L, shiftedsuperscript);\ make_lua_key(L, shorthand_def);\ make_lua_key(L, shrink);\ make_lua_key(L, shrinkorder);\ make_lua_key(L, simple);\ make_lua_key(L, size);\ make_lua_key(L, skewchar);\ -make_lua_key(L, skeweddelimitertolerance);\ make_lua_key(L, SkewedDelimiterTolerance);\ +make_lua_key(L, skeweddelimitertolerance);\ make_lua_key(L, skewedfractionhgap);\ make_lua_key(L, SkewedFractionHorizontalGap);\ make_lua_key(L, SkewedFractionVerticalGap);\ @@ -1252,10 +1258,10 @@ make_lua_key(L, smallfamily);\ make_lua_key(L, some_item);\ make_lua_key(L, source);\ make_lua_key(L, space);\ -make_lua_key(L, SpaceAfterScript);\ make_lua_key(L, spaceafterscript);\ -make_lua_key(L, spacebeforescript);\ +make_lua_key(L, SpaceAfterScript);\ make_lua_key(L, SpaceBeforeScript);\ +make_lua_key(L, spacebeforescript);\ make_lua_key(L, spacefactor);\ make_lua_key(L, spacer);\ make_lua_key(L, spaceshrink);\ @@ -1333,6 +1339,7 @@ make_lua_key(L, supshiftup);\ make_lua_key(L, supsubbottommax);\ make_lua_key(L, surround);\ make_lua_key(L, syllable);\ +make_lua_key(L, tag);\ make_lua_key(L, tabskip);\ make_lua_key(L, tail);\ make_lua_key(L, target);\ @@ -1357,17 +1364,17 @@ make_lua_key(L, tolerant_call);\ make_lua_key(L, tolerant_protected_call);\ make_lua_key(L, top);\ make_lua_key(L, topaccent);\ -make_lua_key(L, topanchor);\ make_lua_key(L, topaccentvariant);\ +make_lua_key(L, topanchor);\ make_lua_key(L, topleft);\ make_lua_key(L, topmargin);\ +make_lua_key(L, topovershoot);\ make_lua_key(L, topright);\ make_lua_key(L, topskip);\ -make_lua_key(L, topovershoot);\ make_lua_key(L, total);\ make_lua_key(L, tracingparagraphs);\ -make_lua_key(L, trailer);\ make_lua_key(L, Trailer);\ +make_lua_key(L, trailer);\ make_lua_key(L, type);\ make_lua_key(L, uchyph);\ make_lua_key(L, uleaders);\ @@ -1413,7 +1420,6 @@ make_lua_key(L, vertical);\ make_lua_key(L, verticalmathkern);\ make_lua_key(L, vextensible);\ make_lua_key(L, vextensiblevariant);\ -make_lua_key(L, vitalic);\ make_lua_key(L, vlist);\ make_lua_key(L, vmode);\ make_lua_key(L, vmodepar);\ @@ -1422,7 +1428,6 @@ make_lua_key(L, void);\ make_lua_key(L, vrule);\ make_lua_key(L, vskip);\ make_lua_key(L, vtop);\ -make_lua_key(L, vparts);\ make_lua_key(L, whatsit);\ make_lua_key(L, widowpenalties);\ make_lua_key(L, widowpenalty);\ @@ -1605,7 +1610,6 @@ extern lmt_keys_info lmt_keys; # define lmt_rounded(d) (lua_Integer) (llround(d)) # define lmt_roundedfloat(f) (lua_Integer) (llround((double) f)) - # define lmt_tolong(L,i) (long) lua_tointeger(L,i) # define lmt_checklong(L,i) (long) luaL_checkinteger(L,i) # define lmt_optlong(L,i,j) (long) luaL_optinteger(L,i,j) diff --git a/source/luametatex/source/lua/lmtlibrary.c b/source/luametatex/source/lua/lmtlibrary.c index ff6822a02..cb51273b5 100644 --- a/source/luametatex/source/lua/lmtlibrary.c +++ b/source/luametatex/source/lua/lmtlibrary.c @@ -71,7 +71,7 @@ int lmt_library_okay(lmt_library lib) /* experiment */ -int librarylib_load(lua_State *L) +static int librarylib_load(lua_State *L) { /* So we permit it in mtxrun (for now, when we test). */ if (lmt_engine_state.lua_only || lmt_engine_state.permit_loadlib) { diff --git a/source/luametatex/source/lua/lmtlibrary.h b/source/luametatex/source/lua/lmtlibrary.h index 40f5f47f4..8367d66ea 100644 --- a/source/luametatex/source/lua/lmtlibrary.h +++ b/source/luametatex/source/lua/lmtlibrary.h @@ -18,7 +18,7 @@ /* void : dlclose(lib) | string: dlerror() */ -typedef void (*lmt_library_function); +typedef void *lmt_library_function; # ifdef _WIN32 diff --git a/source/luametatex/source/lua/lmtluaclib.c b/source/luametatex/source/lua/lmtluaclib.c index 797585aba..bf8888add 100644 --- a/source/luametatex/source/lua/lmtluaclib.c +++ b/source/luametatex/source/lua/lmtluaclib.c @@ -31,7 +31,7 @@ static TString **tmname = NULL; -# define toproto(L,i) getproto(s2v(L->top+(i))) +# define toproto(L,i) getproto(s2v(L->top.p+(i))) # define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") # define LUACVOID(p) ((const void*)(p)) # define eventname(i) (getstr(tmname[i])) diff --git a/source/luametatex/source/lua/lmtmplib.c b/source/luametatex/source/lua/lmtmplib.c index 74d684c3f..ecbfd46b6 100644 --- a/source/luametatex/source/lua/lmtmplib.c +++ b/source/luametatex/source/lua/lmtmplib.c @@ -765,7 +765,7 @@ static char *mplib_aux_run_script(MP mp, const char *str, size_t len, int n) return NULL; } -void mplib_aux_run_internal(MP mp, int action, int n, int type, const char *name) +static void mplib_aux_run_internal(MP mp, int action, int n, int type, const char *name) { if (mp->run_internal_id) { lua_State *L = (lua_State *) mp_userdata(mp); @@ -2754,13 +2754,6 @@ static int mplib_getcallbackstate(lua_State *L) This assumes that the top of the stack is a table or nil already in the case. */ -# define mplib_set_color_objects(pq) \ -object_color_model = pq->color_model; \ -object_color_a = pq->color.a_val; \ -object_color_b = pq->color.b_val; \ -object_color_c = pq->color.c_val; \ -object_color_d = pq->color.d_val; - static void mplib_aux_push_color(lua_State *L, struct mp_graphic_object *p) { if (p) { @@ -2771,11 +2764,19 @@ static void mplib_aux_push_color(lua_State *L, struct mp_graphic_object *p) case mp_stroked_code: { mp_shape_object *h = (mp_shape_object *) p; - mplib_set_color_objects(h); + object_color_model = h->color_model; + object_color_a = h->color.a_val; + object_color_b = h->color.b_val; + object_color_c = h->color.c_val; + object_color_d = h->color.d_val; } break; default: object_color_model = mp_no_model; + object_color_a = 0.0; + object_color_b = 0.0; + object_color_c = 0.0; + object_color_d = 0.0; break; } switch (object_color_model) { diff --git a/source/luametatex/source/lua/lmtnodelib.c b/source/luametatex/source/lua/lmtnodelib.c index eb29611e2..caa9da065 100644 --- a/source/luametatex/source/lua/lmtnodelib.c +++ b/source/luametatex/source/lua/lmtnodelib.c @@ -231,7 +231,7 @@ static void nodelib_push_attribute_data(lua_State* L, halfword n) inline static singleword nodelib_getdirection(lua_State *L, int i) { - return ((lua_type(L, i) == LUA_TNUMBER) ? checked_direction_value(lmt_tohalfword(L, i)) : direction_def_value); + return ((lua_type(L, i) == LUA_TNUMBER) ? (singleword) checked_direction_value(lmt_tohalfword(L, i)) : direction_def_value); } /*tex @@ -1892,7 +1892,7 @@ static int nodelib_direct_getdisc(lua_State *L) if (lua_isboolean(L, 2) && lua_toboolean(L, 2)) { nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_pre_break(n))); nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_post_break(n))); - nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_post_break(n))); + nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_no_break(n))); return 6; } else { return 3; @@ -4504,7 +4504,7 @@ static int nodelib_direct_dimensions(lua_State *L) { int top = lua_gettop(L); if (top > 0) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; glueratio g_mult = normal_glue_multiplier; int vertical = 0; int g_sign = normal_glue_sign; @@ -4545,7 +4545,7 @@ static int nodelib_direct_rangedimensions(lua_State *L) /* parent, first, last * { int top = lua_gettop(L); if (top > 1) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; int vertical = 0; halfword l = nodelib_valid_direct_from_index(L, 1); /* parent */ halfword n = nodelib_valid_direct_from_index(L, 2); /* first */ @@ -5379,8 +5379,8 @@ static int nodelib_direct_setglue(lua_State *L) case vlist_node: case unset_node: box_glue_set(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? (glueratio) lua_tonumber(L, 2) : 0; - box_glue_order(n) = tex_checked_glue_sign((top > 2 && lua_type(L, 3) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 3) : 0); - box_glue_sign(n) = tex_checked_glue_order((top > 3 && lua_type(L, 4) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 4) : 0); + box_glue_order(n) = tex_checked_glue_order((top > 2 && lua_type(L, 3) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 3) : 0); + box_glue_sign(n) = tex_checked_glue_sign((top > 3 && lua_type(L, 4) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 4) : 0); break; case math_node: math_amount(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? (halfword) lmt_roundnumber(L, 2) : 0; @@ -7117,9 +7117,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, shrink)) { glue_shrink(n) = (halfword) lmt_roundnumber(L, 3); } else if (lua_key_eq(s, stretchorder)) { - glue_stretch_order(n) = lmt_tohalfword(L, 3); + glue_stretch_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, shrinkorder)) { - glue_shrink_order(n) = lmt_tohalfword(L, 3); + glue_shrink_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, leader)) { glue_leader_ptr(n) = nodelib_direct_or_node_from_index(L, direct, 3); } else if (lua_key_eq(s, font)) { @@ -7265,9 +7265,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, shrink)) { math_shrink(n) = (halfword) lmt_roundnumber(L, 3); } else if (lua_key_eq(s, stretchorder)) { - math_stretch_order(n) = lmt_tohalfword(L, 3); + math_stretch_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, shrinkorder)) { - math_shrink_order(n) = lmt_tohalfword(L, 3); + math_shrink_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, penalty)) { math_penalty(n) = lmt_tohalfword(L, 3); } else { @@ -7320,7 +7320,7 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, options)) { noad_options(n) = lmt_tohalfword(L, 3); } else if (lua_key_eq(s, scriptorder)) { - noad_script_order(n) = lmt_tohalfword(L, 3); + noad_script_order(n) = lmt_tosingleword(L, 3); } else if (lua_key_eq(s, class)) { halfword c = lmt_tohalfword(L, 3); set_noad_main_class(n, c); @@ -7469,7 +7469,7 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) /* just ignored */ return 0; } - break; + // break; case adjust_node: if (lua_key_eq(s, list) || lua_key_eq(s, head)) { adjust_list(n) = nodelib_direct_or_node_from_index(L, direct, 3); @@ -7522,9 +7522,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, shrink)) { glue_shrink(n) = (halfword) lmt_roundnumber(L, 3); } else if (lua_key_eq(s, stretchorder)) { - glue_stretch_order(n) = lmt_tohalfword(L, 3); + glue_stretch_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, shrinkorder)) { - glue_shrink_order(n) = lmt_tohalfword(L, 3); + glue_shrink_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else { goto CANTSET; } @@ -9093,8 +9093,9 @@ static halfword lmt_direct_migrate_locate(halfword head, halfword *first, halfwo case insert_node: { if (inserts) { + halfword list; head = nodelib_aux_migrate_decouple(head, current, next, first, last); - halfword list = insert_list(current); + list = insert_list(current); if (list) { insert_list(current) = lmt_direct_migrate_locate(list, first, last, inserts, marks); } @@ -9196,7 +9197,7 @@ static int nodelib_direct_hasglyphoption(lua_State *L) halfword current = nodelib_valid_direct_from_index(L, 1); int result = 0; if (current && node_type(current) == glyph_node) { - int option = lua_tointeger(L, 2); + int option = lmt_tointeger(L, 2); switch (option) { case glyph_option_normal_glyph: // 0x00 break; @@ -9332,9 +9333,9 @@ static int nodelib_direct_getnodes(lua_State *L) /* maybe count */ lua_newtable(L); if (lua_type(L, 2) == LUA_TNUMBER) { - int t = lua_tonumber(L, 2); + int t = lmt_tointeger(L, 2); if (lua_type(L, 3) == LUA_TNUMBER) { - int s = lua_tonumber(L, 3); + int s = lmt_tointeger(L, 3); while (n) { if (node_type(n) == t && node_subtype(n) == s) { lua_pushinteger(L, n); diff --git a/source/luametatex/source/lua/lmttexlib.c b/source/luametatex/source/lua/lmttexlib.c index afafb068b..c88d13490 100644 --- a/source/luametatex/source/lua/lmttexlib.c +++ b/source/luametatex/source/lua/lmttexlib.c @@ -1402,9 +1402,9 @@ static halfword texlib_aux_make_glue(lua_State *L, int top, int slot) if (slot <= top) { glue_shrink(value) = lmt_toroundnumber(L, slot++); if (slot <= top) { - glue_stretch_order(value) = lmt_tohalfword(L, slot++); + glue_stretch_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot++)); if (slot <= top) { - glue_shrink_order(value) = lmt_tohalfword(L, slot++); + glue_shrink_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot++)); } } } @@ -2466,9 +2466,9 @@ static int texlib_set_item(lua_State* L, int index, int prefixes) if (slot <= top) { glue_shrink(value) = lmt_toroundnumber(L, slot++); if (slot <= top) { - glue_stretch_order(value) = lmt_tohalfword(L, slot++); + glue_stretch_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot++)); if (slot <= top) { - glue_shrink_order(value) = lmt_tohalfword(L, slot); + glue_shrink_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot)); } } } @@ -2877,8 +2877,8 @@ static int texlib_setmath(lua_State *L) glue_amount(p) = lmt_optroundnumber(L, slot++, 0); glue_stretch(p) = lmt_optroundnumber(L, slot++, 0); glue_shrink(p) = lmt_optroundnumber(L, slot++, 0); - glue_stretch_order(p) = lmt_optroundnumber(L, slot++, 0); - glue_shrink_order(p) = lmt_optroundnumber(L, slot, 0); + glue_stretch_order(p) = tex_checked_glue_order(lmt_optroundnumber(L, slot++, 0)); + glue_shrink_order(p) = tex_checked_glue_order(lmt_optroundnumber(L, slot, 0)); tex_def_math_parameter(style, param, (scaled) p, level, indirect_math_regular); break; } @@ -4385,7 +4385,7 @@ static int texlib_setboxdir(lua_State *L) { int index = lmt_tointeger(L, 1); if (index >= 0 && index <= max_box_register_index) { - tex_set_box_dir(index, lmt_tointeger(L, 2)); + tex_set_box_dir(index, lmt_tosingleword(L, 2)); } else { texlib_aux_show_box_index_error(L); } @@ -4536,8 +4536,8 @@ static int texlib_mathchardef(lua_State *L) if (tex_define_permitted(cs, flags)) { mathcodeval m; mathdictval d; - m.class_value = lmt_tointeger(L, 2); - m.family_value = lmt_tointeger(L, 3); + m.class_value = (short) lmt_tointeger(L, 2); + m.family_value = (short) lmt_tointeger(L, 3); m.character_value = lmt_tointeger(L, 4); d.properties = lmt_optquarterword(L, 6, 0); d.group = lmt_optquarterword(L, 7, 0); @@ -5002,6 +5002,27 @@ static int texlib_getkerneloptionvalues(lua_State *L) return 1; } +static int texlib_getcharactertagvalues(lua_State *L) +{ + lua_createtable(L, 2, 12); + lua_set_string_by_index(L, no_tag, "normal"); + lua_set_string_by_index(L, ligatures_tag, "ligatures"); + lua_set_string_by_index(L, kerns_tag, "kerns"); + lua_set_string_by_index(L, list_tag, "list"); + lua_set_string_by_index(L, callback_tag, "callback"); + lua_set_string_by_index(L, extensible_tag, "extensible"); + lua_set_string_by_index(L, horizontal_tag, "horizontal"); + lua_set_string_by_index(L, vertical_tag, "vertical"); + lua_set_string_by_index(L, extend_last_tag, "extendlast"); + lua_set_string_by_index(L, inner_left_tag, "innerleft"); + lua_set_string_by_index(L, inner_right_tag, "innerright"); + lua_set_string_by_index(L, italic_tag, "italic"); + lua_set_string_by_index(L, n_ary_tag, "nary"); + lua_set_string_by_index(L, radical_tag, "radical"); + lua_set_string_by_index(L, punctuation_tag, "punctuation"); + return 1; +} + static int texlib_getshapingpenaltiesvalues(lua_State *L) { lua_createtable(L, 2, 2); @@ -5139,7 +5160,7 @@ static int texlib_getdiscstatevalues(lua_State *L) static int texlib_getmathcontrolvalues(lua_State *L) { - lua_createtable(L, 2, 21); + lua_createtable(L, 2, 23); lua_set_string_by_index(L, math_control_use_font_control, "usefontcontrol"); lua_set_string_by_index(L, math_control_over_rule, "overrule"); lua_set_string_by_index(L, math_control_under_rule, "underrule"); @@ -5163,6 +5184,8 @@ static int texlib_getmathcontrolvalues(lua_State *L) lua_set_string_by_index(L, math_control_analyze_script_nucleus_box, "analyzescriptnucleusbox"); lua_set_string_by_index(L, math_control_accent_top_skew_with_offset, "accenttopskewwithoffset"); lua_set_string_by_index(L, math_control_ignore_kern_dimensions, "ignorekerndimensions"); + lua_set_string_by_index(L, math_control_ignore_flat_accents, "ignoreflataccents"); + lua_set_string_by_index(L, math_control_extend_accents, "extendaccents"); return 1; } @@ -5462,6 +5485,7 @@ static const struct luaL_Reg texlib_function_list[] = { { "getprimitiveorigins", texlib_getprimitiveorigins }, { "getfrozenparvalues", texlib_getfrozenparvalues }, { "getshapingpenaltiesvalues", texlib_getshapingpenaltiesvalues }, + { "getcharactertagvalues", texlib_getcharactertagvalues }, { "getkerneloptionvalues", texlib_getkerneloptionvalues }, { "getspecialmathclassvalues", texlib_getspecialmathclassvalues }, { "getlargestusedmark", texlib_getlargestusedmark }, diff --git a/source/luametatex/source/lua/lmttokenlib.c b/source/luametatex/source/lua/lmttokenlib.c index feac7cd46..e15b2de5a 100644 --- a/source/luametatex/source/lua/lmttokenlib.c +++ b/source/luametatex/source/lua/lmttokenlib.c @@ -347,23 +347,16 @@ inline static int tokenlib_aux_to_valid_index(int cmd, int chr) case internal_command_item: case reference_command_item: case data_command_item: - { - halfword c = chr; - switch (item.base) { - case ignore_entry: - return 0; - case direct_entry: - break; - default: - chr -= item.base; - break; - } - if (c >= item.min && c <= item.max) { - return c; - } else { - return item.min; - } + switch (item.base) { + case ignore_entry: + return 0; + case direct_entry: + break; + default: + chr -= item.base; + break; } + return (chr >= item.min && chr <= item.max) ? chr : item.min; case token_command_item: case node_command_item: return item.fixedvalue; @@ -2147,7 +2140,7 @@ static int tokenlib_future_expand(lua_State *L) return 0; } } - return 0; + // return 0; } static int tokenlib_scan_code(lua_State *L) @@ -2735,8 +2728,9 @@ static int tokenlib_get_fields(lua_State *L) size_t l; const char *str = lua_tolstring(L, 1, &l); if (l > 0) { + halfword cs; lua_createtable(L, 0, onlyflags ? 0 : 5); - halfword cs = tex_string_locate(str, l, 0); + cs = tex_string_locate(str, l, 0); cmd = eq_type(cs); chr = eq_value(cs); flags = eq_flag(cs); @@ -3174,10 +3168,11 @@ static int tokenlib_set_lua(lua_State *L) size_t lname = 0; const char *name = lua_tolstring(L, 1, &lname); if (name) { + halfword cs; int flags = 0; int funct = lmt_tointeger(L, 2); /*tex todo: check range */ lmt_check_for_flags(L, 3, &flags, 1, 1); - halfword cs = tex_string_locate(name, lname, 1); + cs = tex_string_locate(name, lname, 1); if (tex_define_permitted(cs, flags)) { if (is_value(flags)) { tex_define(flags, cs, lua_value_cmd, funct); |