diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-04-16 09:53:19 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-04-16 09:53:19 +0200 |
commit | 32e6c720c4f84f112596c6b4a75193f99e9be158 (patch) | |
tree | 9a673cc26aa02f8a9e74d18fc821fb5f3cda5380 /tex | |
parent | ba81502d685bdba367e2a8f0bdff0f8ecc0cf7f6 (diff) | |
download | context-32e6c720c4f84f112596c6b4a75193f99e9be158.tar.gz |
2019-04-16 09:02:00
Diffstat (limited to 'tex')
36 files changed, 822 insertions, 405 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index a6e0a9e61..29fff3fc5 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.04.13 17:01} +\newcontextversion{2019.04.16 08:54} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index b95c52953..2d0c17f50 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2019.04.13 17:01} +\edef\contextversion{2019.04.16 08:54} %D For those who want to use this: diff --git a/tex/context/base/mkiv/attr-ini.mkiv b/tex/context/base/mkiv/attr-ini.mkiv index 6a1ac86de..29f384b97 100644 --- a/tex/context/base/mkiv/attr-ini.mkiv +++ b/tex/context/base/mkiv/attr-ini.mkiv @@ -109,11 +109,11 @@ \let\dompattribute\gobbletwoarguments \ifcase\contextlmtxmode - \unexpanded\def\resetglobalattributes{\attribute\zerocount\zerocount\the\t_attr_list_global\relax} - \unexpanded\def\resetlocalattributes {\attribute\zerocount\zerocount\the\t_attr_list_local \relax} + \unexpanded\def\resetglobalattributes{\the\t_attr_list_global\attribute\zerocount\zerocount} + \unexpanded\def\resetlocalattributes {\the\t_attr_list_local \attribute\zerocount\zerocount} \else - \unexpanded\def\resetglobalattributes{\glyphdatafield \zerocount\the\t_attr_list_global\relax} - \unexpanded\def\resetlocalattributes {\glyphdatafield \zerocount\the\t_attr_list_local \relax} + \unexpanded\def\resetglobalattributes{\the\t_attr_list_global\glyphdatafield \zerocount} + \unexpanded\def\resetlocalattributes {\the\t_attr_list_local \glyphdatafield \zerocount} \fi \let\resetallattributes\resetlocalattributes diff --git a/tex/context/base/mkiv/buff-ver.mkiv b/tex/context/base/mkiv/buff-ver.mkiv index 7cf829b74..efa179d3b 100644 --- a/tex/context/base/mkiv/buff-ver.mkiv +++ b/tex/context/base/mkiv/buff-ver.mkiv @@ -502,12 +502,25 @@ \buff_verbatim_setup_keep_together \normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}} +% \def\buff_verbatim_typing_start_yes[#1]% +% {\typingparameter\c!before +% \startpacked[\v!blank]% +% \doifelseassignment{#1} +% {\setupcurrenttyping[#1]} +% {\doif\v!continue{#1}{\lettypingparameter\c!continue\v!yes}}% +% \buff_verbatim_setup_line_numbering +% \buff_verbatim_initialize_typing_one +% \buff_verbatim_setup_keep_together +% \normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}} + \def\buff_verbatim_typing_start_yes[#1]% {\typingparameter\c!before \startpacked[\v!blank]% - \doifelseassignment{#1} - {\setupcurrenttyping[#1]} - {\doif\v!continue{#1}{\lettypingparameter\c!continue\v!yes}}% + \ifcondition\validassignment{#1}% + \setupcurrenttyping[#1]% + \else + \doif\v!continue{#1}{\lettypingparameter\c!continue\v!yes}% + \fi \buff_verbatim_setup_line_numbering \buff_verbatim_initialize_typing_one \buff_verbatim_setup_keep_together @@ -610,16 +623,33 @@ \setuevalue{\e!type\currenttyping\v!file}{\typefile[\currenttyping]}% \to \everydefinetyping +% \def\buff_verbatim_type_file[#1][#2]#3% +% {\begingroup +% \ifsecondargument +% \setuptyping[#1][#2]% +% \buff_verbatim_type_file_checked{#1}{#3}% +% \else\iffirstargument +% \doifelseassignment{#1} +% {\setuptyping[\v!file][#1]% +% \buff_verbatim_type_file_checked\v!file{#3}} +% {\buff_verbatim_type_file_checked{#1}{#3}}% +% \else +% \buff_verbatim_type_file_checked\v!file{#3}% +% \fi\fi +% \endgroup} + \def\buff_verbatim_type_file[#1][#2]#3% {\begingroup \ifsecondargument \setuptyping[#1][#2]% \buff_verbatim_type_file_checked{#1}{#3}% \else\iffirstargument - \doifelseassignment{#1} - {\setuptyping[\v!file][#1] - \buff_verbatim_type_file_checked\v!file{#3}} - {\buff_verbatim_type_file_checked{#1}{#3}}% + \ifcondition\validassignment{#1}% + \setuptyping[\v!file][#1]% + \buff_verbatim_type_file_checked\v!file{#3}% + \else + \buff_verbatim_type_file_checked{#1}{#3}% + \fi \else \buff_verbatim_type_file_checked\v!file{#3}% \fi\fi @@ -806,15 +836,31 @@ \setuevalue{\e!type\currenttyping\v!buffer}{\buff_verbatim_type_buffer_class{\currenttyping}}% \to \everydefinetyping +% \unexpanded\def\buff_verbatim_type_buffer[#1][#2]% +% {\ifsecondargument +% \setupcurrenttyping[#2]% +% \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}% [name] [settings] +% \else\iffirstargument +% \doifelseassignment{#1} +% {\setupcurrenttyping[#1]% +% \buff_verbatim_type_buffer_indeed\currenttyping\empty}% [settings] +% {\processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}}% [name] +% \else +% \buff_verbatim_type_buffer_indeed\currenttyping\empty% [] +% \fi\fi +% \endgroup} + \unexpanded\def\buff_verbatim_type_buffer[#1][#2]% {\ifsecondargument \setupcurrenttyping[#2]% \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}% [name] [settings] \else\iffirstargument - \doifelseassignment{#1} - {\setupcurrenttyping[#1]% - \buff_verbatim_type_buffer_indeed\currenttyping\empty}% [settings] - {\processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}}% [name] + \ifcondition\validassignment{#1}% + \setupcurrenttyping[#1]% + \buff_verbatim_type_buffer_indeed\currenttyping\empty% [settings] + \else + \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\currenttyping}% [name] + \fi \else \buff_verbatim_type_buffer_indeed\currenttyping\empty% [] \fi\fi @@ -891,16 +937,33 @@ {\writestatus{nota bene}{\string\processbuffer\space is obsolete}% \dodoubleempty\buff_verbatim_process} +% \def\buff_verbatim_process[#1][#2]% +% {\begingroup +% \ifsecondargument +% \setuptyping[\v!buffer][#2]% +% \processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}% [name] [settings] +% \else\iffirstargument +% \doifelseassignment{#1} +% {\setuptyping[\v!buffer][#1]% +% \buff_verbatim_process_indeed\v!buffer\empty}% [settings] +% {\processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}}% [name] +% \else +% \buff_verbatim_process_indeed\v!buffer\empty% [] +% \fi\fi +% \endgroup} + \def\buff_verbatim_process[#1][#2]% {\begingroup \ifsecondargument \setuptyping[\v!buffer][#2]% \processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}% [name] [settings] \else\iffirstargument - \doifelseassignment{#1} - {\setuptyping[\v!buffer][#1]% - \buff_verbatim_process_indeed\v!buffer\empty}% [settings] - {\processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}}% [name] + \ifcondition\validassignment{#1}% + \setuptyping[\v!buffer][#1]% + \buff_verbatim_process_indeed\v!buffer\empty% [settings] + \else + \processcommalist[#1]{\buff_verbatim_process_indeed\v!buffer}% [name] + \fi \else \buff_verbatim_process_indeed\v!buffer\empty% [] \fi\fi diff --git a/tex/context/base/mkiv/catc-sym.mkiv b/tex/context/base/mkiv/catc-sym.mkiv index ae1253272..64604ba35 100644 --- a/tex/context/base/mkiv/catc-sym.mkiv +++ b/tex/context/base/mkiv/catc-sym.mkiv @@ -55,6 +55,20 @@ .egroup +\bgroup + +\catcode`_=\lettercatcode + +%xdef\_n_u_l_{\expandafter\string\Uchar1} % nul(l) +%xdef\_s_o_h_{\expandafter\string\Uchar1} % start of header +\xdef\_s_t_x_{\expandafter\string\Uchar2} % start of text +\xdef\_e_t_x_{\expandafter\string\Uchar3} % end of text +\xdef\_e_o_t_{\expandafter\string\Uchar4} % end of transmission +%xdef\_e_n_q_{\expandafter\string\Uchar5} % enquiry +%xdef\_a_c_k_{\expandafter\string\Uchar6} % aknowledgement + +\egroup + %D \macros %D {uncatcodespecials,setnaturalcatcodes,setnormalcatcodes, %D uncatcodecharacters,uncatcodeallcharacters, diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv index 8c2c0e792..c5639f44a 100644 --- a/tex/context/base/mkiv/colo-ini.mkiv +++ b/tex/context/base/mkiv/colo-ini.mkiv @@ -131,42 +131,6 @@ \unexpanded\def\switchtocolor[#1]{\begincsname#1\endcsname} -% \unexpanded\def\color [#1]{\bgroup -% \def\g_color{\colo_helpers_activate{#1}}% -% \afterassignment\g_color -% \let\nexttoken} -% -% \unexpanded\def\graycolor [#1]{\bgroup -% \def\g_color{\colo_helpers_set_model\s!gray\colo_helpers_activate{#1}}% -% \afterassignment\g_color -% \let\nexttoken} -% -% \unexpanded\def\startcolor [#1]{\begingroup -% \colo_helpers_activate{#1}} -% -% \unexpanded\def\stopcolor {\endgroup} -% -% \unexpanded\def\colored [#1]{\bgroup -% \def\g_color{\colo_basics_defined_and_activated{#1}}% -% \afterassignment\g_color -% \let\nexttoken} -% -% \unexpanded\def\fastcolored[#1]#2{\begingroup % is this command still needed? -% \colo_basics_defined_and_activated{#1}% -% #2% -% \endgroup} -% -% \unexpanded\def\directcolored[#1]{\colo_basics_defined_and_activated{#1}} -% -% \unexpanded\def\fastcolor [#1]#2{\begingroup % is this command still needed? -% \colo_helpers_activate{#1}% -% #2% -% \endgroup} -% -% \unexpanded\def\directcolor [#1]{\colo_helpers_activate{#1}} -% -% \afterassignment was a left-over artifact - % transparency \unexpanded\def\transparent[#1]% @@ -527,14 +491,25 @@ \expandafter\colo_palets_define_a \fi} +% \unexpanded\def\colo_palets_define_a[#1][#2][#3]% +% {\colo_palet_prepare{#1}% +% \doifelseassignment{#2} +% {\setevalue{\??colorpaletspecification#1}{#2}% +% \processcommalist[#2]{\colo_palets_define_one{#1}}} +% {\ifcsname\??colorpaletspecification#2\endcsname +% \normalexpanded{\colo_palets_define[#1][\lastnamedcs]}% +% \fi}} + \unexpanded\def\colo_palets_define_a[#1][#2][#3]% {\colo_palet_prepare{#1}% - \doifelseassignment{#2} - {\setevalue{\??colorpaletspecification#1}{#2}% - \processcommalist[#2]{\colo_palets_define_one{#1}}} - {\ifcsname\??colorpaletspecification#2\endcsname - \normalexpanded{\colo_palets_define[#1][\lastnamedcs]}% - \fi}} + \ifcondition\validassignment{#2}% + \setevalue{\??colorpaletspecification#1}{#2}% + \processcommalist[#2]{\colo_palets_define_one{#1}}% + \else + \ifcsname\??colorpaletspecification#2\endcsname + \normalexpanded{\colo_palets_define[#1][\lastnamedcs]}% + \fi + \fi} \unexpanded\def\colo_palets_define_b[#1][#2][#3]% {\colo_palet_prepare{#1}% @@ -542,10 +517,17 @@ \colo_palet_extend{#2}% \colo_palets_define_assign{#1}{#2}{#3}} +% \def\colo_palets_define_one#1#2% get rid of { } +% {\doifelseassignment{#2} % catch empty entries +% {\colo_palets_define_two{#1}[#2]} +% {\colo_palets_define_three{#1}{#2}}} + \def\colo_palets_define_one#1#2% get rid of { } - {\doifelseassignment{#2} % catch empty entries - {\colo_palets_define_two{#1}[#2]} - {\colo_palets_define_three{#1}{#2}}} + {\ifcondition\validassignment{#2}% catch empty entries + \colo_palets_define_two{#1}[#2]% + \else + \colo_palets_define_three{#1}{#2}% + \fi} \def\colo_palets_define_two#1[#2=#3]% {\colo_palet_extend{#2}% @@ -1233,16 +1215,28 @@ \fi \to \everysetupcolors +% \def\colo_palets_define_set#1#2#3% +% {\doifelseassignment{#3}% \definepalet[test][xx={y=.4}] +% {\colo_palets_define_assign}% +% {\ifcsname\??colorsetter#3\endcsname +% % \definepalet[test][xx=green] +% \expandafter\colo_palets_define_inherit +% \else +% % not entered when making format +% \expandafter\colo_palets_define_undefine +% \fi}% +% {#1}{#2}{#3}} + \def\colo_palets_define_set#1#2#3% - {\doifelseassignment{#3}% \definepalet[test][xx={y=.4}] - {\colo_palets_define_assign}% - {\ifcsname\??colorsetter#3\endcsname - % \definepalet[test][xx=green] - \expandafter\colo_palets_define_inherit - \else - % not entered when making format - \expandafter\colo_palets_define_undefine - \fi}% + {\ifcondition\validassignment{#3}% \definepalet[test][xx={y=.4}] + \expandafter\colo_palets_define_assign + \else\ifcsname\??colorsetter#3\endcsname + % \definepalet[test][xx=green] + \doubleexpandafter\colo_palets_define_inherit + \else + % not entered when making format + \doubleexpandafter\colo_palets_define_undefine + \fi\fi {#1}{#2}{#3}} \def\colo_palets_define_inherit#1#2#3% diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index a7f700bb0..e200e6bbd 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.04.13 17:01} +\newcontextversion{2019.04.16 08:54} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 9f6cf4f4d..ccd549ec9 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.04.13 17:01} +\edef\contextversion{2019.04.16 08:54} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 0fd6c61af..61c5f3929 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -2549,7 +2549,7 @@ do implement { name = "resetfontfeature", - arguments = { 0, 0 }, + -- arguments = { 0, 0 }, actions = resetfontfeature, } diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 0645e7c8a..e6679fda2 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -1525,9 +1525,7 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly classdef1 = readclassdef(f,tableoffset+classdef1,coverage) classdef2 = readclassdef(f,tableoffset+classdef2,nofglyphs) local usedcoverage = { } - -- - local shared = { } -- partial sparse - -- + local shared = { } -- partial sparse, when set also needs to be handled in the packer for g1, c1 in next, classdef1 do if coverage[g1] then local l1 = classlist[c1] @@ -1539,21 +1537,21 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly local first = offsets[1] local second = offsets[2] if first or second then - -- - local s1 = shared[first] - if not s1 then - s1 = { } - shared[first] = s1 - end - local s2 = s1[second] - if not s2 then - s2 = { first, second or nil } - s1[second] = s2 + if shared then + local s1 = shared[first] + if s1 == nil then + s1 = { } + shared[first] = s1 + end + local s2 = s1[second] + if s2 == nil then + s2 = { first, second or nil } + s1[second] = s2 + end + hash[paired] = s2 + else + hash[paired] = { first, second or nil } end - hash[paired] = s2 - -- - -- hash[paired] = { first, second or nil } - -- else -- upto the next lookup for this combination end @@ -1564,6 +1562,7 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly end end return { + shared = shared and true or nil, format = "pair", coverage = usedcoverage, } diff --git a/tex/context/base/mkiv/font-fea.mkvi b/tex/context/base/mkiv/font-fea.mkvi index 9c4b60d9f..3737632fe 100644 --- a/tex/context/base/mkiv/font-fea.mkvi +++ b/tex/context/base/mkiv/font-fea.mkvi @@ -138,26 +138,12 @@ {\clf_featurelist{#name}{\detokenize{#separator}}} \ifcase\contextlmtxmode - - \attribute\zerocount\zerocount % first in list, so fast match - - \prependtoks - \attribute\zerocount\attributeunsetvalue % new per 2017-08-30 / why not zero - \to \t_attr_list_local - + \attribute\zerocount\zerocount \def\font_dynamic_value{\attribute\zerocount} - \else - - \glyphdatafield\zerocount \attribute\zerocount\attributeunsetvalue - - \prependtoks - \glyphdatafield\attributeunsetvalue % why not zero - \to \t_attr_list_local - + \glyphdatafield\zerocount \let\font_dynamic_value\glyphdatafield - \fi % beware: these are global features on top of existing font features diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi index 4ebbff88e..0f29cf155 100644 --- a/tex/context/base/mkiv/font-ini.mkvi +++ b/tex/context/base/mkiv/font-ini.mkvi @@ -1565,17 +1565,33 @@ \font_basics_define_body_font_name [#whatever]} +% \unexpanded\def\font_basics_define_body_font_body[#body][#style][#specification]% +% {\doifelseassignment{#specification} +% \font_basics_define_body_font_body_assignment +% \font_basics_define_body_font_body_identifier +% [#body][#style][#specification]}% + \unexpanded\def\font_basics_define_body_font_body[#body][#style][#specification]% - {\doifelseassignment{#specification} - \font_basics_define_body_font_body_assignment - \font_basics_define_body_font_body_identifier - [#body][#style][#specification]}% + {\ifcondition\validassignment{#specification}% + \expandafter\font_basics_define_body_font_body_assignment + \else + \expandafter\font_basics_define_body_font_body_identifier + \fi + [#body][#style][#specification]}% + +% \unexpanded\def\font_basics_define_body_font_name[#name][#style][#specification]% +% {\doifelseassignment{#specification} +% \font_basics_define_body_font_name_assignment +% \font_basics_define_body_font_name_identifier +% [#name][#style][#specification]}% \unexpanded\def\font_basics_define_body_font_name[#name][#style][#specification]% - {\doifelseassignment{#specification} - \font_basics_define_body_font_name_assignment - \font_basics_define_body_font_name_identifier - [#name][#style][#specification]}% + {\ifcondition\validassignment{#specification}% + \expandafter\font_basics_define_body_font_name_assignment + \else + \expandafter\font_basics_define_body_font_name_identifier + \fi + [#name][#style][#specification]}% \unexpanded\def\font_basics_define_body_font_body_assignment[#bodylist][#stylelist][#assignments]% {\processcommalist[#bodylist]{\font_basics_define_body_font_body_assignment_a{#stylelist}{#assignments}}} diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index c75b92984..c3b7f3bb8 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.107 + otf.version = otf.version or 3.108 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 6e0939e76..bba7bcb64 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.107 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.108 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index d1faadbf7..51b1c248f 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -1573,16 +1573,34 @@ function readers.pack(data) if kind == "gpos_pair" then local c = step.coverage if c then - if step.format == "pair" then + if step.format ~= "pair" then + for g1, d1 in next, c do + c[g1] = pack_normal(d1) + end + elseif step.shared then + -- This branch results from classes. We already share at the reader end. Maybe + -- the sharing should be moved there altogether but it becomes kind of messy + -- then. Here we're still wasting time because in the second pass we serialize + -- and hash. So we compromise. We could merge the two passes ... + local shared = { } for g1, d1 in next, c do for g2, d2 in next, d1 do - local f = d2[1] if f and f ~= true then d2[1] = pack_indexed(f) end - local s = d2[2] if s and s ~= true then d2[2] = pack_indexed(s) end + if not shared[d2] then + local f = d2[1] if f and f ~= true then d2[1] = pack_indexed(f) end + local s = d2[2] if s and s ~= true then d2[2] = pack_indexed(s) end + shared[d2] = true + end end end + if pass == 2 then + step.shared = nil -- weird, so dups + end else for g1, d1 in next, c do - c[g1] = pack_normal(d1) + for g2, d2 in next, d1 do + local f = d2[1] if f and f ~= true then d2[1] = pack_indexed(f) end + local s = d2[2] if s and s ~= true then d2[2] = pack_indexed(s) end + end end end end diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua index d5c194c85..b7986f7a2 100644 --- a/tex/context/base/mkiv/font-shp.lua +++ b/tex/context/base/mkiv/font-shp.lua @@ -210,7 +210,7 @@ local function loadstreams(cache,filename,sub,instance) local size = attr and attr.size or 0 local time = attr and attr.modification or 0 local sub = tonumber(sub) - if size > 0 and (kind == "otf" or kind == "ttf" or kind == "tcc") then + if size > 0 and (kind == "otf" or kind == "ttf" or kind == "ttc") then local hash = makehash(filename,sub,instance) data = containers.read(cache,hash) if not data or data.time ~= time or data.size ~= size then @@ -333,8 +333,11 @@ end local function loadstreamdata(fontdata) local properties = fontdata.properties + local shared = fontdata.shared + local rawdata = shared and shared.rawdata + local metadata = rawdata and rawdata.metadata local filename = properties.filename - local subindex = fontdata.subindex + local subindex = metadata and metadata.subfontindex local instance = properties.instance local hash = makehash(filename,subindex,instance) local loaded = loadedstreams[hash] diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index 20e7c11a6..f2f626b28 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -197,19 +197,39 @@ % label file settings % label file parent +% \def\grph_include_use[#1][#2][#3][#4]% +% {\doifelsenothing{#1} +% {\doifsomething{#2} +% {\doifelseassignment{#3} +% {\grph_include_use_indeed{#2}{#2}{#3}{#4}} +% {\grph_include_use_indeed{#2}{#2}\empty{#4}}}} +% {\doifelsenothing{#2} +% {\doifelseassignment{#3} +% {\grph_include_use_indeed{#1}{#1}\empty{#3}} +% {\grph_include_use_indeed{#1}{#1}{#3}{#4}}} +% {\doifelseassignment{#3} +% {\grph_include_use_indeed{#1}{#2}\empty{#3}} +% {\grph_include_use_indeed{#1}{#2}{#3}{#4}}}}} + \def\grph_include_use[#1][#2][#3][#4]% {\doifelsenothing{#1} {\doifsomething{#2} - {\doifelseassignment{#3} - {\grph_include_use_indeed{#2}{#2}{#3}{#4}} - {\grph_include_use_indeed{#2}{#2}\empty{#4}}}} + {\ifcondition\validassignment{#3}% + \grph_include_use_indeed{#2}{#2}{#3}{#4}% + \else + \grph_include_use_indeed{#2}{#2}\empty{#4}% + \fi}}% {\doifelsenothing{#2} - {\doifelseassignment{#3} - {\grph_include_use_indeed{#1}{#1}\empty{#3}} - {\grph_include_use_indeed{#1}{#1}{#3}{#4}}} - {\doifelseassignment{#3} - {\grph_include_use_indeed{#1}{#2}\empty{#3}} - {\grph_include_use_indeed{#1}{#2}{#3}{#4}}}}} + {\ifcondition\validassignment{#3}% + \grph_include_use_indeed{#1}{#1}\empty{#3}% + \else + \grph_include_use_indeed{#1}{#1}{#3}{#4}% + \fi} + {\ifcondition\validassignment{#3}% + \grph_include_use_indeed{#1}{#2}\empty{#3} + \else + \grph_include_use_indeed{#1}{#2}{#3}{#4}% + \fi}}} \def\grph_include_use_indeed#1#2#3#4% {\dodoglobal\setvalue{\??externalfigureinstance#1}{\grph_include_setup{#2}{#3}{#4}}% @@ -221,8 +241,9 @@ {\dotripleempty\grph_include_figure} \def\grph_include_figure[#1][#2][#3]% - {\docheckassignment{#2}% - \ifassignment +% {\docheckassignment{#2}% +% \ifassignment + {\ifcondition\validassignment{#2}% \grph_include_place[#1][][#2]% \else \grph_include_place[#1][#2][#3]% @@ -301,8 +322,9 @@ % \edef\p_grph_include_label{#1}% \let\p_grph_include_name\p_grph_include_label - \docheckassignment{#2}% - \ifassignment + % \docheckassignment{#2}% + % \ifassignment + \ifcondition\validassignment{#2}% % [label] [settings] \let\p_grph_include_parent\p_grph_include_label \grph_include_place_inherit diff --git a/tex/context/base/mkiv/lang-ini.mkiv b/tex/context/base/mkiv/lang-ini.mkiv index 296cf7f1c..f9d7e0f51 100644 --- a/tex/context/base/mkiv/lang-ini.mkiv +++ b/tex/context/base/mkiv/lang-ini.mkiv @@ -195,19 +195,35 @@ \unexpanded\def\installlanguage {\dodoubleargument\lang_basics_install} +% \def\lang_basics_install[#1][#2]% +% {\doifelseassignment{#2} +% {\doifelselanguage{#1} +% {\getparameters[\??language#1][#2]} +% {\setvalue{\??languagelinked#1}{#1}% +% \lang_basics_install_indeed{#1}{#1}% +% \getparameters[\??language#1][\c!state=\v!start,#2]}% +% \edef\currentsetuplanguage{#1}% +% \clf_definelanguage{#1}{\specificlanguageparameter{#1}\s!default}% +% \the\everysetuplanguage} +% {\setvalue{\??languagelinked#1}{#2}% +% \clf_setlanguagesynonym{#1}{#2}% +% \lang_basics_install_indeed{#1}{#2}}} + \def\lang_basics_install[#1][#2]% - {\doifelseassignment{#2} - {\doifelselanguage{#1} - {\getparameters[\??language#1][#2]} - {\setvalue{\??languagelinked#1}{#1}% - \lang_basics_install_indeed{#1}{#1}% - \getparameters[\??language#1][\c!state=\v!start,#2]}% - \edef\currentsetuplanguage{#1}% - \clf_definelanguage{#1}{\specificlanguageparameter{#1}\s!default}% - \the\everysetuplanguage} - {\setvalue{\??languagelinked#1}{#2}% - \clf_setlanguagesynonym{#1}{#2}% - \lang_basics_install_indeed{#1}{#2}}} + {\ifcondition\validassignment{#2}% + \doifelselanguage{#1} + {\getparameters[\??language#1][#2]} + {\setvalue{\??languagelinked#1}{#1}% + \lang_basics_install_indeed{#1}{#1}% + \getparameters[\??language#1][\c!state=\v!start,#2]}% + \edef\currentsetuplanguage{#1}% + \clf_definelanguage{#1}{\specificlanguageparameter{#1}\s!default}% + \the\everysetuplanguage + \else + \setvalue{\??languagelinked#1}{#2}% + \clf_setlanguagesynonym{#1}{#2}% + \lang_basics_install_indeed{#1}{#2}% + \fi} \def\lang_basics_install_indeed#1#2% {\ifcsname#1\endcsname\else\setuvalue{#1}{\lang_basics_set_current[#2]}\fi} diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua index 3ec0e131f..d29a463b8 100644 --- a/tex/context/base/mkiv/luat-run.lua +++ b/tex/context/base/mkiv/luat-run.lua @@ -244,7 +244,12 @@ end local function report_start(name,rest) if rest then - name = rest -- luatex + -- luatex + if name ~= 1 then + insert(stack,false) + return + end + name = rest end if find(name,"virtual://",1,true) then insert(stack,false) diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv index b6dcf9ba9..24da3441e 100644 --- a/tex/context/base/mkiv/math-ini.mkiv +++ b/tex/context/base/mkiv/math-ini.mkiv @@ -254,11 +254,25 @@ \def\math_m_yes_math[#1]#2% {#2} +% \def\math_m_yes_text[#1]% +% {\begingroup +% \doifassignmentelse{#1}% +% {\setupcurrentmathematics[#1]}% +% {\edef\currentmathematics{#1}}% check for valid +% \edef\p_openup{\mathematicsparameter\c!openup}% +% \ifx\p_openup\v!yes +% \expandafter\math_m_yes_text_openedup +% \else +% \expandafter\math_m_yes_text_normal +% \fi} + \def\math_m_yes_text[#1]% {\begingroup - \doifassignmentelse{#1}% - {\setupcurrentmathematics[#1]}% - {\edef\currentmathematics{#1}}% check for valid + \ifcondition\validassignment{#1}% + \setupcurrentmathematics[#1]% + \else + \edef\currentmathematics{#1}% check for valid + \fi \edef\p_openup{\mathematicsparameter\c!openup}% \ifx\p_openup\v!yes \expandafter\math_m_yes_text_openedup diff --git a/tex/context/base/mkiv/mult-aux.mkiv b/tex/context/base/mkiv/mult-aux.mkiv index 5e7de2270..a599f1673 100644 --- a/tex/context/base/mkiv/mult-aux.mkiv +++ b/tex/context/base/mkiv/mult-aux.mkiv @@ -101,7 +101,7 @@ \fi#2} \def\mult_interfaces_get_parameters_indeed#1]% namespace already set - {\mult_interfaces_get_parameters_item#1,],\_e_o_p_} + {\mult_interfaces_get_parameters_item#1,],\_e_o_t_} \def\mult_interfaces_get_parameters_item#1,#2% #2 takes space before , {\if,#1,% dirty trick for testing #1=empty @@ -109,7 +109,7 @@ \else\if]#1% \doubleexpandafter\gobbleoneargument \else - \mult_interfaces_get_parameters_assign#1==\empty\_e_o_p_ + \mult_interfaces_get_parameters_assign#1==\empty\_e_o_t_ % \doubleexpandafter\mult_interfaces_get_parameters_item % saves skipping when at end \fi\fi#2} @@ -120,7 +120,7 @@ \def\mult_interfaces_get_parameters_error_indeed#1#2% {\showassignerror{#2}{\the\inputlineno\space(#1)}} -\def\mult_interfaces_get_parameters_assign#1=#2=#3#4\_e_o_p_ +\def\mult_interfaces_get_parameters_assign#1=#2=#3#4\_e_o_t_ {\ifx\empty#1\empty \expandafter\mult_interfaces_get_parameters_error \else\ifx#3\empty @@ -143,7 +143,7 @@ \def\mult_interfaces_get_parameters_error_two#1\csname#2#3\endcsname#4% {\mult_interfaces_get_parameters_error_indeed{#2}{#3}} - \def\mult_interfaces_get_parameters_assign#1=#2=#3#4\_e_o_p_ + \def\mult_interfaces_get_parameters_assign#1=#2=#3#4\_e_o_t_ {\ifx\empty#1\empty \mult_interfaces_get_parameters_error_one \else\ifx#3\empty @@ -161,7 +161,7 @@ % \def\mult_interfaces_get_parameters_error_two#1\m_mult_interfaces_namespace#2\fi\fi% % {\mult_interfaces_get_parameters_error_indeed\m_mult_interfaces_namespace{#2}\m_mult_interfaces_namespace\s!dummy\fi\fi} % - % \def\mult_interfaces_get_parameters_assign#1=#2=#3#4\_e_o_p_ + % \def\mult_interfaces_get_parameters_assign#1=#2=#3#4\_e_o_t_ % {\expandafter\def\csname % \ifx\empty#1\empty % \mult_interfaces_get_parameters_error_one @@ -177,15 +177,14 @@ \newif\ifassignment -\def\mult_check_for_assignment_indeed#1=#2#3\_end_ - {\if#2@\assignmentfalse\else\assignmenttrue\fi} - -\def\mult_check_for_assignment_indeed_begin_#1=#2#3\_end_ - {\if#2@} +\def\mult_check_for_assignment_indeed#1=#2#3\_e_o_t_ + {\if#2\_e_t_x_\assignmentfalse\else\assignmenttrue\fi} +\def\mult_check_for_assignment_indeed_begin_#1=#2#3\_e_o_t_ + {\if#2\_e_t_x_} \def\mult_check_for_assignment#1% - {\expandafter\mult_check_for_assignment_indeed\detokenize{#1}=@@\_end_} + {\expandafter\mult_check_for_assignment_indeed\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_} % End of experimental code. @@ -357,44 +356,6 @@ \def\getparentchain #1#2{\begincsname#1#2:\s!chain\endcsname} \def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname} -\unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones - {\ifx#4\relax\let#4\empty\fi % see \defineregister - \unexpanded\def#2{\dotripleempty#5}% - \newtoks#6% - \newtoks#7% - \unexpanded\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] - {\let#9#4% - \edef#4{##1}% - \ifthirdargument - \the#6% predefine - \edef#8{##2}% - \mult_check_for_parent{#1}{#3}#4#8% - \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% - \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}% - \mult_interfaces_get_parameters{#1#4:}[##3]% - \else\ifsecondargument - \the#6% predefine - \expandafter\mult_check_for_assignment_indeed\detokenize{##2}=@@\_end_ - \ifassignment - \let#8\empty - \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}% - \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}% - \mult_interfaces_get_parameters{#1#4:}[##2]% - \else - \edef#8{##2}% - \mult_check_for_parent{#1}{#3}#4#8% - \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% - \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}% - \fi - \else - \the#6% predefine - \let#8\empty - \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}% - \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}% - \fi\fi - \the#7% - \let#4#9}} - % \unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones % {\ifx#4\relax\let#4\empty\fi % see \defineregister % \unexpanded\def#2{\dotripleempty#5}% @@ -412,16 +373,17 @@ % \mult_interfaces_get_parameters{#1#4:}[##3]% % \else\ifsecondargument % \the#6% predefine -% \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##2}=@@\_end_ -% \edef#8{##2}% -% \mult_check_for_parent{#1}{#3}#4#8% -% \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% -% \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}% -% \else +% \expandafter\mult_check_for_assignment_indeed\detokenize{##2}=\_e_t_x_\_e_t_x_\_e_o_t_ +% \ifassignment % \let#8\empty % \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}% % \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}% % \mult_interfaces_get_parameters{#1#4:}[##2]% +% \else +% \edef#8{##2}% +% \mult_check_for_parent{#1}{#3}#4#8% +% \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% +% \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}% % \fi % \else % \the#6% predefine @@ -432,6 +394,43 @@ % \the#7% % \let#4#9}} +\unexpanded\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9% why is \expanded still needed in clones + {\ifx#4\relax\let#4\empty\fi % see \defineregister + \unexpanded\def#2{\dotripleempty#5}% + \newtoks#6% + \newtoks#7% + \unexpanded\def#5[##1][##2][##3]% [child][parent][settings] | [child][settings] | [child][parent] | [child] + {\let#9#4% + \edef#4{##1}% + \ifthirdargument + \the#6% predefine + \edef#8{##2}% + \mult_check_for_parent{#1}{#3}#4#8% + \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% + \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}% + \mult_interfaces_get_parameters{#1#4:}[##3]% + \else\ifsecondargument + \the#6% predefine + \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##2}=\_e_t_x_\_e_t_x_\_e_o_t_ + \edef#8{##2}% + \mult_check_for_parent{#1}{#3}#4#8% + \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}% + \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}% + \else + \let#8\empty + \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}% + \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}% + \mult_interfaces_get_parameters{#1#4:}[##2]% + \fi + \else + \the#6% predefine + \let#8\empty + \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}% + \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}% + \fi\fi + \the#7% + \let#4#9}} + \unexpanded\def\installdefinehandler#1#2#3% {\normalexpanded {\mult_interfaces_install_define_handler @@ -490,55 +489,6 @@ \unexpanded\def#2{\dodoubleempty#4}% \unexpanded\def#5{\mult_interfaces_get_parameters{#1#3:}}} -\unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% - {\newtoks#5% - \newconstant#2% - \newtoks#8% - \newtoks#9% - \ifx#6\relax\let#6\empty\fi - \unexpanded\def#4[##1][##2]% maybe helper - {\ifsecondargument % no commalist here - % \setuplayout[whatever][key=value] - \let#7#3% - \let#6#3% - \edef#3{##1}% - #2\doingrootsetupnamed - \mult_interfaces_get_parameters{#1#3:}[##2]% - \the#5% - \ifx#3#6\the#8\fi % only switchsetups if previous == current - \let#3#7% - \else\iffirstargument - % \mult_check_for_assignment{##1}% - \expandafter\mult_check_for_assignment_indeed\detokenize{##1}=@@\_end_ - \ifassignment - % \setuplayout[key=value] - \let#7#3% - \let#6#3% - \let#3\empty - #2\doingrootsetuproot - \mult_interfaces_get_parameters{#1:}[##1]% - \the#5% - \the#8% switchsetups - \let#3#7% - \else - % \setuplayout[whatever] - \let#6#3% % previous becomes current - \edef#3{##1}% this will catch reset so one needs to test for it - #2\doingrootsetnamed - \the#5% % we can check for previous vs current - \the#8% switchsetups - \fi - \else - % \setuplayout - \let#6#3% % previous becomes current - \let#3\empty % current becomes empty - #2\doingrootsetroot - \the#5% - \the#8% switchsetups - \fi\fi - #2\zerocount % mode is always zero at the end - \the#9}} - % \unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% % {\newtoks#5% % \newconstant#2% @@ -558,14 +508,8 @@ % \let#3#7% % \else\iffirstargument % % \mult_check_for_assignment{##1}% -% \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##1}=@@\_end_ -% % \setuplayout[whatever] -% \let#6#3% % previous becomes current -% \edef#3{##1}% this will catch reset so one needs to test for it -% #2\doingrootsetnamed -% \the#5% % we can check for previous vs current -% \the#8% switchsetups -% \else +% \expandafter\mult_check_for_assignment_indeed\detokenize{##1}=\_e_t_x_\_e_t_x_\_e_o_t_ +% \ifassignment % % \setuplayout[key=value] % \let#7#3% % \let#6#3% @@ -575,6 +519,13 @@ % \the#5% % \the#8% switchsetups % \let#3#7% +% \else +% % \setuplayout[whatever] +% \let#6#3% % previous becomes current +% \edef#3{##1}% this will catch reset so one needs to test for it +% #2\doingrootsetnamed +% \the#5% % we can check for previous vs current +% \the#8% switchsetups % \fi % \else % % \setuplayout @@ -587,6 +538,54 @@ % #2\zerocount % mode is always zero at the end % \the#9}} +\unexpanded\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9% + {\newtoks#5% + \newconstant#2% + \newtoks#8% + \newtoks#9% + \ifx#6\relax\let#6\empty\fi + \unexpanded\def#4[##1][##2]% maybe helper + {\ifsecondargument % no commalist here + % \setuplayout[whatever][key=value] + \let#7#3% + \let#6#3% + \edef#3{##1}% + #2\doingrootsetupnamed + \mult_interfaces_get_parameters{#1#3:}[##2]% + \the#5% + \ifx#3#6\the#8\fi % only switchsetups if previous == current + \let#3#7% + \else\iffirstargument + % \mult_check_for_assignment{##1}% + \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##1}=\_e_t_x_\_e_t_x_\_e_o_t_ + % \setuplayout[whatever] + \let#6#3% % previous becomes current + \edef#3{##1}% this will catch reset so one needs to test for it + #2\doingrootsetnamed + \the#5% % we can check for previous vs current + \the#8% switchsetups + \else + % \setuplayout[key=value] + \let#7#3% + \let#6#3% + \let#3\empty + #2\doingrootsetuproot + \mult_interfaces_get_parameters{#1:}[##1]% + \the#5% + \the#8% switchsetups + \let#3#7% + \fi + \else + % \setuplayout + \let#6#3% % previous becomes current + \let#3\empty % current becomes empty + #2\doingrootsetroot + \the#5% + \the#8% switchsetups + \fi\fi + #2\zerocount % mode is always zero at the end + \the#9}} + \unexpanded\def\installswitchsetuphandler#1#2% {\normalexpanded {\mult_interfaces_install_switch_setup_handler_a @@ -804,6 +803,24 @@ \expandafter\noexpand\csname setupcurrent#1\endcsname \expandafter\noexpand\csname #1_action\endcsname}} +% \unexpanded\def\mult_interfaces_install_action_handler#1#2#3#4% +% {\unexpanded\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% +% \unexpanded\def#4[##1][##2]% +% {\begingroup +% \ifsecondargument +% \edef#2{##1}% +% #3[##2]% +% \else\iffirstargument +% \doifelseassignment{##1} +% {\let#2\empty +% #3[##1]}% +% {\edef#2{##1}}% +% \else +% \let#2\empty +% \fi\fi +% \directsetup{handler:action:#1}% +% \endgroup}} + \unexpanded\def\mult_interfaces_install_action_handler#1#2#3#4% {\unexpanded\expandafter\def\csname#1\endcsname{\dodoubleempty#4}% \unexpanded\def#4[##1][##2]% @@ -812,10 +829,12 @@ \edef#2{##1}% #3[##2]% \else\iffirstargument - \doifelseassignment{##1} - {\let#2\empty - #3[##1]}% - {\edef#2{##1}}% + \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##1}=\_e_t_x_\_e_t_x_\_e_o_t_ + \edef#2{##1}% + \else + \let#2\empty + #3[##1]% + \fi \else \let#2\empty \fi\fi diff --git a/tex/context/base/mkiv/mult-chk.mkiv b/tex/context/base/mkiv/mult-chk.mkiv index b3005b012..8869f7dcb 100644 --- a/tex/context/base/mkiv/mult-chk.mkiv +++ b/tex/context/base/mkiv/mult-chk.mkiv @@ -62,7 +62,7 @@ \def\mult_checkers_get_checked_parameters_nop_indeed#1#2]% needs checking with adapted syst-aux.mkiv {\def\syst_helpers_get_parameters_assign{\syst_helpers_get_parameters_assign_indeed#1}% will change - \syst_helpers_process_comma_item#2,],\_e_o_p_} + \syst_helpers_process_comma_item#2,],\_e_o_t_} \unexpanded\def\disablecheckparameters{\let\getcheckedparameters\mult_checkers_get_checked_parameters_nop} \unexpanded\def\enablecheckparameters {\let\getcheckedparameters\mult_checkers_get_checked_parameters_yes} diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 6cc468514..b620eb721 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -284,6 +284,7 @@ return { "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", + "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", -- "tracingall", "tracingnone", "loggingall", diff --git a/tex/context/base/mkiv/pack-com.mkiv b/tex/context/base/mkiv/pack-com.mkiv index 1c6f2de73..fe622509a 100644 --- a/tex/context/base/mkiv/pack-com.mkiv +++ b/tex/context/base/mkiv/pack-com.mkiv @@ -227,26 +227,74 @@ \newtoks\everycombination +% \def\pack_combinations_start[#1][#2]% needs a cleanup, also nx ny (pretty old, this one) +% {\edef\currentcombination{#1}% +% \edef\currentcombinationspec{#2}% +% \ifx\currentcombinationspec\empty +% \doifelseassignment{#1}% +% {\let\currentcombination\empty +% \setupcurrentcombination[#1]% +% \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}} +% {\doifelseinstring{*}\currentcombination +% {\edef\currentcombinationspec{\currentcombination*\plusone*}% +% \let\currentcombination\empty} +% {\doifelsenumber\currentcombination +% {\edef\currentcombinationspec{\currentcombination*\plusone*}% +% \let\currentcombination\empty} +% {\edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}}}}% +% \else +% \doifelseassignment{#2}% +% {\setupcurrentcombination[#2]% +% \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}} +% {\edef\currentcombinationspec{\currentcombinationspec*\plusone*}}% +% \fi +% % +% \forgetall +% % +% \the\everycombination +% % +% \let\startcontent\pack_common_content_start +% \let\stopcontent \pack_common_content_stop +% \let\startcaption\pack_common_caption_start +% \let\stopcaption \pack_common_caption_stop +% % +% \edef\p_height {\combinationparameter\c!height}% +% \edef\p_width {\combinationparameter\c!width}% +% \edef\p_location{\combinationparameter\c!location}% +% \edef\p_distance{\combinationparameter\c!distance}% +% % +% \pack_combinations_location_reset +% \rawprocesscommacommand[\p_location]\pack_combinations_location_step +% % +% \dostarttaggedchained\t!combination\currentcombination\??combination +% \vbox \ifx\p_height\v!fit\else to \p_height \fi \bgroup +% \let\combination\empty % permits \combination{}{} handy for cld +% \normalexpanded{\pack_combinations_start_indeed[\currentcombinationspec]}} + \def\pack_combinations_start[#1][#2]% needs a cleanup, also nx ny (pretty old, this one) {\edef\currentcombination{#1}% \edef\currentcombinationspec{#2}% \ifx\currentcombinationspec\empty - \doifelseassignment{#1}% - {\let\currentcombination\empty - \setupcurrentcombination[#1]% - \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}} - {\doifelseinstring{*}\currentcombination - {\edef\currentcombinationspec{\currentcombination*\plusone*}% - \let\currentcombination\empty} - {\doifelsenumber\currentcombination - {\edef\currentcombinationspec{\currentcombination*\plusone*}% - \let\currentcombination\empty} - {\edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}}}}% + \ifcondition\validassignment{#1}% + \let\currentcombination\empty + \setupcurrentcombination[#1]% + \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% + \else + \doifelseinstring{*}\currentcombination + {\edef\currentcombinationspec{\currentcombination*\plusone*}% + \let\currentcombination\empty} + {\doifelsenumber\currentcombination + {\edef\currentcombinationspec{\currentcombination*\plusone*}% + \let\currentcombination\empty} + {\edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}}}% + \fi \else - \doifelseassignment{#2}% - {\setupcurrentcombination[#2]% - \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}} - {\edef\currentcombinationspec{\currentcombinationspec*\plusone*}}% + \ifcondition\validassignment{#2}% + \setupcurrentcombination[#2]% + \edef\currentcombinationspec{\combinationparameter\c!nx*\combinationparameter\c!ny*}% + \else + \edef\currentcombinationspec{\currentcombinationspec*\plusone*}% + \fi \fi % \forgetall @@ -521,10 +569,8 @@ {\pack_combinations_float_hack_a{\recurselevel}}% {\pack_combinations_float_hack_b{\recurselevel}}% \to\scratchtoks}% brrr - \let\pack_combinations_check_x_y\pack_combinations_float_check_x_y - \doifassignmentelse{#1} - {\expanded{\startcombination[#1]\the\scratchtoks}\stopcombination}% - {\expanded{\startcombination[#1]\the\scratchtoks}\stopcombination}% + \let\pack_combinations_check_x_y\pack_combinations_float_check_x_y + \expanded{\startcombination[#1]\the\scratchtoks}\stopcombination \resetlocalfloats \egroup} diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index f94517144..bde86e8b1 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -363,20 +363,35 @@ \unexpanded\def\definepapersize {\dotripleempty\page_paper_define_size} +% \def\page_paper_define_size[#1][#2][#3]% +% {\edef\currentlayouttarget{#1}% +% \ifx\currentlayouttarget\empty +% % invalid target +% \else +% \doifelseassignment{#2} +% {\definelayouttarget[#1][#2]} +% {\setevalue{\??layoutpaper#1}{#2}% +% \ifthirdargument +% \setevalue{\??layoutprint#1}{#3}% +% \else +% \setevalue{\??layoutprint#1}{#2}% +% \fi}% +% \fi} + \def\page_paper_define_size[#1][#2][#3]% {\edef\currentlayouttarget{#1}% \ifx\currentlayouttarget\empty % invalid target + \else\ifcondition\validassignment{#2}% + \definelayouttarget[#1][#2]% \else - \doifelseassignment{#2} - {\definelayouttarget[#1][#2]} - {\setevalue{\??layoutpaper#1}{#2}% - \ifthirdargument - \setevalue{\??layoutprint#1}{#3}% - \else - \setevalue{\??layoutprint#1}{#2}% - \fi}% - \fi} + \setevalue{\??layoutpaper#1}{#2}% + \ifthirdargument + \setevalue{\??layoutprint#1}{#3}% + \else + \setevalue{\??layoutprint#1}{#2}% + \fi + \fi\fi} \appendtoks \letvalue{\??layoutcurrent\currentlayouttarget}\relax @@ -398,13 +413,26 @@ \unexpanded\def\setuppapersize {\dodoubleempty\page_paper_setup_size} +% \unexpanded\def\page_paper_setup_size[#1][#2]% +% {\iffirstargument +% \doifelseassignment{#1} +% {\page_paper_setup_size_settings[#1]} +% {\doifelseassignment{#2} +% {\page_paper_setup_size_settings_by_name[#1][#2]} +% {\page_paper_setup_size_change_size[#1][#2]}}% +% \else +% \page_paper_restore +% \fi} + \unexpanded\def\page_paper_setup_size[#1][#2]% {\iffirstargument - \doifelseassignment{#1} - {\page_paper_setup_size_settings[#1]} - {\doifelseassignment{#2} - {\page_paper_setup_size_settings_by_name[#1][#2]} - {\page_paper_setup_size_change_size[#1][#2]}}% + \ifcondition\validassignment{#1}% + \page_paper_setup_size_settings[#1]% + \else\ifcondition\validassignment{#2}% + \page_paper_setup_size_settings_by_name[#1][#2]% + \else + \page_paper_setup_size_change_size[#1][#2]% + \fi\fi \else \page_paper_restore \fi} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 3855acd13..3fdae5c04 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 4804fb6ae..5d10829d8 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-itm.mkvi b/tex/context/base/mkiv/strc-itm.mkvi index 0fc204320..13e400c0e 100644 --- a/tex/context/base/mkiv/strc-itm.mkvi +++ b/tex/context/base/mkiv/strc-itm.mkvi @@ -625,10 +625,17 @@ % can be made a bit faster +% \def\strc_itemgroups_setup_each#category#whatever% +% {\doifelseassignment{#whatever} +% {\strc_itemgroups_normal_setup[#category][#whatever]} +% {\strc_itemgroups_normal_setup[#category][\c!option={#whatever}]}} + \def\strc_itemgroups_setup_each#category#whatever% - {\doifelseassignment{#whatever} - {\strc_itemgroups_normal_setup[#category][#whatever]} - {\strc_itemgroups_normal_setup[#category][\c!option={#whatever}]}} + {\ifcondition\validassignment{#whatever}% + \strc_itemgroups_normal_setup[#category][#whatever]% + \else + \strc_itemgroups_normal_setup[#category][\c!option={#whatever}]% + \fi} \def\strc_itemgroups_setup_list_level_a#category#whatever#level% {\strc_itemgroups_normal_setup[#category:#level][#whatever]} @@ -636,10 +643,17 @@ \def\strc_itemgroups_setup_list_level_b#category#whatever#level% {\strc_itemgroups_normal_setup[#category:#level][\c!option={#whatever}]} +% \def\strc_itemgroups_setup_list#subcategories#category#whatever% +% {\doifelseassignment{#whatever} +% {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}} +% {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}}} + \def\strc_itemgroups_setup_list#subcategories#category#whatever% - {\doifelseassignment{#whatever} - {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}} - {\processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}}} + {\ifcondition\validassignment{#whatever}% + \processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}% + \else + \processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}% + \fi} \def\strc_itemgroups_increment_item_counter {\ifconditional\c_strc_itemgroups_sub \else @@ -774,6 +788,25 @@ \unexpanded\def\startitemgroup {\dotripleempty\strc_itemgroups_start} +% \def\strc_itemgroups_start[#category][#options][#settings]% +% {\begingroup % (1) +% \def\currentitemgroup{#category}% no nested mixing of itemgroups +% \let\currentparentitemgroup\currentitemgroup +% \global\advance\c_strc_itemgroups_nesting\plusone +% \def\currentitemlevel{\number\c_strc_itemgroups_nesting}% +% \normalexpanded{\chaintocurrentitemgroup{\currentparentitemgroup:\currentitemlevel}}% +% \edef\currentitemgroup{\currentparentitemgroup:\currentitemlevel}% +% % +% \ifthirdargument +% \strc_itemgroups_start_indeed[#options][#settings]% +% \else\ifsecondargument +% \doifelseassignment{#options} +% {\strc_itemgroups_start_indeed[][#options]} +% {\strc_itemgroups_start_indeed[#options][]}% +% \else +% \strc_itemgroups_start_indeed[][]% +% \fi\fi} + \def\strc_itemgroups_start[#category][#options][#settings]% {\begingroup % (1) \def\currentitemgroup{#category}% no nested mixing of itemgroups @@ -786,9 +819,11 @@ \ifthirdargument \strc_itemgroups_start_indeed[#options][#settings]% \else\ifsecondargument - \doifelseassignment{#options} - {\strc_itemgroups_start_indeed[][#options]} - {\strc_itemgroups_start_indeed[#options][]}% + \ifcondition\validassignment{#options}% + \strc_itemgroups_start_indeed[][#options]% + \else + \strc_itemgroups_start_indeed[#options][]% + \fi \else \strc_itemgroups_start_indeed[][]% \fi\fi} diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv index 4066a1f38..f367013fb 100644 --- a/tex/context/base/mkiv/strc-sec.mkiv +++ b/tex/context/base/mkiv/strc-sec.mkiv @@ -637,10 +637,20 @@ \triggerautostructurelevel \strc_sectioning_handle{#1}{\c!reference={#2},\c!ownnumber={#3},\c!title={#4}}{}} % name ref nr title -- +% \unexpanded\def\strc_sectioning_handle_nop_indeed[#1][#2]% for taco: [key=value] variant +% {\setfalse\currentstructureown +% \triggerautostructurelevel +% \doifelseassignment{#2}\strc_sectioning_handle_nop_indeed_yes\strc_sectioning_handle_nop_indeed_nop{#1}{#2}} + \unexpanded\def\strc_sectioning_handle_nop_indeed[#1][#2]% for taco: [key=value] variant {\setfalse\currentstructureown \triggerautostructurelevel - \doifelseassignment{#2}\strc_sectioning_handle_nop_indeed_yes\strc_sectioning_handle_nop_indeed_nop{#1}{#2}} + \ifcondition\validassignment{#2}% + \expandafter\strc_sectioning_handle_nop_indeed_yes + \else + \expandafter\strc_sectioning_handle_nop_indeed_nop + \fi + {#1}{#2}} \unexpanded\def\strc_sectioning_handle_nop_indeed_yes#1#2% {\strc_sectioning_handle{#1}{#2}{}} diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index 9b0ca82c4..15c2ca294 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -423,6 +423,9 @@ context.secondoftwoarguments = ctx_secondoftwoarguments context.firstofoneargument = ctx_firstofoneargument context.gobbleoneargument = ctx_gobbleoneargument +local ctx_iftrue = context.iftrue +local ctx_iffalse = context.iffalse + local hash = utilities.parsers.hashes.settings_to_set local function doifelsecommon(a,b) @@ -554,6 +557,45 @@ local function doifnotcommon(a,b) ctx_firstofoneargument() end +-- local function hascommonargumentcondition(a,b) +-- if a == b then +-- setmacro("commalistelement",a) +-- if a == "" then +-- ctx_iffalse() +-- else +-- ctx_iftrue() +-- end +-- return +-- end +-- local ba = find(a,",",1,true) +-- local bb = find(b,",",1,true) +-- if ba and bb then +-- local ha = hash[a] +-- local hb = hash[b] +-- for k in next, ha do +-- if hb[k] then +-- setmacro("commalistelement",k) +-- ctx_iftrue() +-- return +-- end +-- end +-- elseif ba then +-- if hash[a][b] then +-- setmacro("commalistelement",b) +-- ctx_iftrue() +-- return +-- end +-- elseif bb then +-- if hash[b][a] then +-- setmacro("commalistelement",a) +-- ctx_iftrue() +-- return +-- end +-- end +-- setmacro("commalistelement","") +-- ctx_iffalse() +-- end + local function doifelseinset(a,b) if a == b then setmacro("commalistelement",a) @@ -641,6 +683,13 @@ implement { arguments = "2 strings", } +-- implement { +-- name = "hascommonargumentcondition", +-- actions = hascommonargumentcondition, +-- arguments = "2 strings", +-- arguments = { "argument", "argument" }, +-- } + implement { name = "doifelseinset", actions = doifelseinset, diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 3004c08b8..f316511e8 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -212,8 +212,7 @@ %D Recent \TEX\ engines have a primitive \type {\expanded} and we will use that when %D possible. After all, we can make not expandable macros now. -% We cannot use the next variant as first we need to adapt \type {##}'s -% in callers: +% We cannot use the next variant as first we need to adapt \type {##}'s in callers: % % \def\expanded#1% % {\normalexpanded{\noexpand#1}} @@ -1549,6 +1548,9 @@ \expandafter\firstofoneargument \fi} +\def\isnonumbercondition#1% does not accept counters (fully expandable) + {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space} + %D \macros %D {setpercentdimen} %D @@ -1850,7 +1852,7 @@ \fi#4} \def\syst_helpers_get_parameters#1]% - {\xprocesscommaitem#1,],\_e_o_p_} + {\xprocesscommaitem#1,],\_e_o_t_} \def\syst_helpers_process_comma_item#1,#2% #2 takes space before , {\if,#1,% dirty trick for testing #1=empty @@ -1858,14 +1860,14 @@ \else\if]#1% \doubleexpandafter\gobbleoneargument \else - \syst_helpers_get_parameters_assign\_e_o_p_#1==\empty\_e_o_p_ + \syst_helpers_get_parameters_assign\_e_o_t_#1==\empty\_e_o_t_ \doubleexpandafter\syst_helpers_process_comma_item \fi\fi#2} \def\syst_helpers_assign_error#1#2#3% {\showassignerror{#2}{\the\inputlineno\space(#1)}} -\def\syst_helpers_get_parameters_assign_normal#1\_e_o_p_#2=#3=#4#5\_e_o_p_ +\def\syst_helpers_get_parameters_assign_normal#1\_e_o_t_#2=#3=#4#5\_e_o_t_ {\ifx\empty#2\empty \expandafter\syst_helpers_assign_error \else\ifx#4\empty @@ -1875,7 +1877,7 @@ \fi\fi {#1}{#2}{#3}} -\def\syst_helpers_get_parameters_assign_error#1\_e_o_p_#2=#3=#4#5\_e_o_p_ +\def\syst_helpers_get_parameters_assign_error#1\_e_o_t_#2=#3=#4#5\_e_o_t_ {\ifx\empty#2\empty \expandafter\syst_helpers_assign_error \else\ifx#4\empty @@ -1892,9 +1894,9 @@ \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_normal -\unexpanded\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#1\_e_o_p_#2==\empty\_e_o_p_} -\unexpanded\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#1\_e_o_p_#2==\empty\_e_o_p_} -\unexpanded\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#1\_e_o_p_#2==\empty\_e_o_p_} +\unexpanded\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#1\_e_o_t_#2==\empty\_e_o_t_} +\unexpanded\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#1\_e_o_t_#2==\empty\_e_o_t_} +\unexpanded\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#1\_e_o_t_#2==\empty\_e_o_t_} %D \macros %D {processassignmentlist,processassignmentcommand, @@ -1960,14 +1962,14 @@ %D Here we hook in the code (beware, this is the optimized get **): \def\syst_helpers_get_parameters_normal#1]% - {\syst_helpers_process_comma_item#1,],\_e_o_p_} + {\syst_helpers_process_comma_item#1,],\_e_o_t_} \def\syst_helpers_get_parameters_expanded#1]% {\let\dosetnvalue\setsomevalue \let\setsomevalue\dosetevalue \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_error \let\setsomevalue\dosetevalue - \syst_helpers_process_comma_item#1,],\_e_o_p_ + \syst_helpers_process_comma_item#1,],\_e_o_t_ \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_normal \let\setsomevalue\dosetnvalue \let\syst_helpers_get_parameters\syst_helpers_get_parameters_normal @@ -2045,10 +2047,10 @@ \newif\ifparameters \def\syst_helpers_check_parameters#1=#2#3\_e_o_s_ - {\if#2@\parametersfalse\else\parameterstrue\fi} + {\if#2\_e_t_x_\parametersfalse\else\parameterstrue\fi} \unexpanded\def\checkparameters[#1]% - {\syst_helpers_check_parameters#1=@@\_e_o_s_} + {\syst_helpers_check_parameters#1=\_e_t_x_\_e_t_x_\_e_o_s_} %D \macros %D {getfromcommalist,getfromcommacommand, @@ -4621,52 +4623,46 @@ \unexpanded\def\forgeteverypar {\everypar{\the\neverypar}} -%D Which we're going to use indeed! When the second argument -%D equals \type {\relax}, the first token list is created -%D unless it is already defined. - -%D Technically spoken we could have used the method we are -%D going to present in the visual debugger. First we save -%D the primitive \type{\everypar}: +%D Which we're going to use indeed! When the second argument equals \type {\relax}, +%D the first token list is created unless it is already defined. +%D +%D Technically spoken we could have used the method we are going to present in the +%D visual debugger. First we save the primitive \type{\everypar}: %D %D \starttyping %D \let\normaleverypar=\everypar %D \stoptyping %D -%D Next we allocate a \TOKENLIST\ named \type{\everypar}, -%D which means that \type{\everypar} is no longer a primitive -%D but something like \type{\toks44}. +%D Next we allocate a \TOKENLIST\ named \type{\everypar}, which means that +%D \type{\everypar} is no longer a primitive but something like \type{\toks44}. %D %D \starttyping %D \newtoks\everypar %D \stoptyping %D -%D Because \TEX\ now executes \type{\normaleverypar} instead -%D of \type{\everypar}, we are ready to assign some tokens to -%D this internally known and used \TOKENLIST. +%D Because \TEX\ now executes \type{\normaleverypar} instead of \type{\everypar}, we +%D are ready to assign some tokens to this internally known and used \TOKENLIST. %D %D \starttyping %D \normaleverypar={all the things the system wants to do \the\everypar} %D \stoptyping %D -%D Where the user can provide his own tokens to be expanded -%D every time he expects them to expand. +%D Where the user can provide his own tokens to be expanded every time he expects +%D them to expand. %D %D \starttyping %D \everypar={something the user wants to do} %D \stoptyping %D -%D We don't use this method because it undoubtly leads to -%D confusing situations, especially when other packages are -%D used, but it's this kind of tricks that make \TEX\ so -%D powerful. +%D We don't use this method because it undoubtly leads to confusing situations, +%D especially when other packages are used, but it's this kind of tricks that make +%D \TEX\ so powerful. %D \macros %D {convertargument,convertcommand,convertvalue} %D -%D Some persistent experimenting led us to the next macro. This -%D macro converts a parameter or an expanded macro to it's -%D textual meaning. +%D Some persistent experimenting led us to the next macro. This macro converts a +%D parameter or an expanded macro to it's textual meaning. %D %D \starttyping %D \convertargument ... \to \command @@ -4678,9 +4674,9 @@ %D \convertargument{one \two \three{four}}\to\ascii %D \stoptyping %D -%D The resulting macro \type{\ascii} can be written to a file -%D or the terminal without problems. In \CONTEXT\ we use this -%D macro for generating registers and tables of contents. +%D The resulting macro \type{\ascii} can be written to a file or the terminal +%D without problems. In \CONTEXT\ we use this macro for generating registers and +%D tables of contents. %D %D The second conversion alternative accepts a command: %D @@ -4688,8 +4684,7 @@ %D \convertcommand\command\to\ascii %D \stoptyping %D -%D Both commands accept the prefix \type{\doglobal} for global -%D assignments. +%D Both commands accept the prefix \type{\doglobal} for global assignments. \unexpanded\def\convertvalue#1\to {\expandafter\convertcommand\csname#1\endcsname\to} @@ -4700,8 +4695,7 @@ %D \macros %D {doifassignmentelse} %D -%D A lot of \CONTEXT\ commands take optional arguments, for -%D instance: +%D A lot of \CONTEXT\ commands take optional arguments, for instance: %D %D \starttyping %D \dothisorthat[alfa,beta] @@ -4709,25 +4703,25 @@ %D \dothisorthat[alfa,beta][first=foo,second=bar] %D \stoptyping %D -%D Although a combined solution is possible, we prefer a -%D seperation. The next command takes care of propper -%D handling of such multi||faced commands. +%D Although a combined solution is possible, we prefer a seperation. The next +%D command takes care of propper handling of such multi||faced commands. %D %D \starttyping %D \doifassignmentelse {...} {then ...} {else ...} %D \stoptyping -\def\syst_helpers_check_if_assignment_else#1=#2#3\_e_o_p_{\if#2@}% +\def\syst_helpers_check_if_assignment_else#1=#2#3\_e_o_t_{\if#2\_e_t_x_}% +\def\syst_helpers_check_else_assignment_if#1=#2#3\_e_o_t_{\unless\if#2\_e_t_x_}% \unexpanded\def\doifelseassignment#1% - {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=@@\_e_o_p_ + {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_ \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} \unexpanded\def\doifelseassignmentcs#1#2#3% - {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=@@\_e_o_p_ + {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_ \expandafter#3% \else \expandafter#2% @@ -4739,12 +4733,20 @@ \newif\ifassignment \unexpanded\def\docheckassignment#1% - {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=@@\_e_o_p_ + {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_ \assignmentfalse \else \assignmenttrue \fi} +%D These can be used for cases where we want less tracing noise. + +\unexpanded\def\validassignment#1% + {\expandafter\syst_helpers_check_else_assignment_if\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_} + +\unexpanded\def\novalidassignment#1% + {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=\_e_t_x_\_e_t_x_\_e_o_t_} + %D In \ETEX\ we can use \type {\detokenize} and gain some %D speed, but in general far less that 1\% for \type %D {\convertargument} and nil for \type {\convertcommand}. @@ -7168,18 +7170,17 @@ \let\gobblesingleempty\dogobblesingleempty % also used \let\gobbledoubleempty\dogobbledoubleempty % also used -%D \macros -%D {@True, @False, @Not, @And} -%D -%D Some predicate logic functions, used in for instance the -%D math module. - -% These have rather ugly names ... will change: - -\def\@True {00} -\def\@False {01} -\def\@Not #1{0\ifcase#11 \or\expandafter 1\else \expandafter 0\fi} -\def\@And #1#2{0\ifcase#1#2 \expandafter 0\else \expandafter 1\fi} +% %D \macros +% %D {@True, @False, @Not, @And} +% %D +% %D Some predicate logic functions, used in for instance the math module. +% +% % These have rather ugly names ... will change: +% +% \def\@True {00} +% \def\@False {01} +% \def\@Not #1{0\ifcase#11 \or\expandafter 1\else \expandafter 0\fi} +% \def\@And #1#2{0\ifcase#1#2 \expandafter 0\else \expandafter 1\fi} %D \macros %D {setdimensionwithunit, freezedimensionwithunit} @@ -8103,6 +8104,21 @@ % % \def\additemtolist#1#2{\normalexpanded{\noexpand\clf_additemtolist{#1}{#2}}} +%D Experiment (sometimes looks nicer in code): + +\unexpanded\def\sameargumentscondition#1#2% + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two} + +\unexpanded\def\emptyargumentcondition#1% + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty} + +% \unexpanded\def\hascommonargumentcondition#1#2{\clf_hascommonargumentcondition{#1}{#2}} +% \let\hascommonargumentcondition \clf_hascommonargumentcondition +% \unexpanded\def\hascommonargumentcondition{\clf_hascommonargumentcondition} + \protect \endinput % \edef\choicetokenyes{+} diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv index fb7e283cd..b18b5e618 100644 --- a/tex/context/base/mkiv/tabl-tbl.mkiv +++ b/tex/context/base/mkiv/tabl-tbl.mkiv @@ -1184,10 +1184,18 @@ \singleexpandafter\tabl_start_defined_zero \fi} +% \def\tabl_start_defined_one[#1][#2]% +% {\doifelseassignment{#1} +% {\setuptabulation[\currenttabulation][#1]}% +% {\edef\currenttabulation{\currenttabulation:#1}}% +% \tabl_tabulate_start_building} + \def\tabl_start_defined_one[#1][#2]% - {\doifelseassignment{#1} - {\setuptabulation[\currenttabulation][#1]}% - {\edef\currenttabulation{\currenttabulation:#1}}% + {\ifcondition\validassignment{#1}% + \setuptabulation[\currenttabulation][#1]% + \else + \edef\currenttabulation{\currenttabulation:#1}% + \fi \tabl_tabulate_start_building} \def\tabl_start_defined_two[#1][#2]% @@ -1215,15 +1223,28 @@ \def\tabl_default_format{|l|p|} +% \def\tabl_start_regular_one[#1][#2]% +% {\doifelseassignment{#1} +% {\lettabulationparameter\c!format\tabl_default_format +% \setupcurrenttabulation[#1]} +% {\def\p_format{#1}% +% \ifx\p_format\empty +% \def\p_format{|l|p|}% +% \fi +% \lettabulationparameter\c!format\p_format}% +% \tabl_tabulate_start_building} + \def\tabl_start_regular_one[#1][#2]% - {\doifelseassignment{#1} - {\lettabulationparameter\c!format\tabl_default_format - \setupcurrenttabulation[#1]} - {\def\p_format{#1}% - \ifx\p_format\empty - \def\p_format{|l|p|}% - \fi - \lettabulationparameter\c!format\p_format}% + {\ifcondition\validassignment{#1}% + \lettabulationparameter\c!format\tabl_default_format + \setupcurrenttabulation[#1]% + \else + \def\p_format{#1}% + \ifx\p_format\empty + \def\p_format{|l|p|}% + \fi + \lettabulationparameter\c!format\p_format + \fi \tabl_tabulate_start_building} \def\tabl_start_regular_two[#1][#2]% diff --git a/tex/context/base/mkiv/type-ini.mkvi b/tex/context/base/mkiv/type-ini.mkvi index ac5f6af2f..8cb370f58 100644 --- a/tex/context/base/mkiv/type-ini.mkvi +++ b/tex/context/base/mkiv/type-ini.mkvi @@ -386,6 +386,29 @@ \expandafter\font_typescripts_start_gobble \fi} +% \def\font_typescripts_check#asked#target#followup[#value]% script use value next +% {\donefalse +% \edef\m_font_typescripts_check{#value}% +% \ifx\m_font_typescripts_check\empty % no longer needed / met +% \ifcase\typescriptmethod\or\donetrue\fi +% \else\ifx#asked\s!all +% \donetrue +% \else\ifx\m_font_typescripts_check\s!all +% \donetrue +% \else\ifx#asked\m_font_typescripts_check % saves 10% trace so probably faster too +% \donetrue +% \let#target\m_font_typescripts_check +% \else\ifcondition\hascommonargumentcondition\m_font_typescripts_check#asked% +% \donetrue +% \let#target\commalistelement +% \fi\fi\fi\fi\fi +% \ifdone +% \iftracetypescripts\extendtypescriptmatch\fi +% \expandafter#followup% +% \else +% \expandafter\font_typescripts_start_gobble +% \fi} + \def\extendtypescriptmatch {\edef\m_font_typescripts_match{\m_font_typescripts_match\space[\m_font_typescripts_check]}} diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 5d129c4bc..59f56b683 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 53be62a57..beae0d66b 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 83ead82ca..e537a1141 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 04/13/19 17:01:11 +-- merge date : 04/16/19 08:54:10 do -- begin closure to overcome local limits and interference @@ -17916,7 +17916,7 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly classdef1=readclassdef(f,tableoffset+classdef1,coverage) classdef2=readclassdef(f,tableoffset+classdef2,nofglyphs) local usedcoverage={} - local shared={} + local shared={} for g1,c1 in next,classdef1 do if coverage[g1] then local l1=classlist[c1] @@ -17928,17 +17928,21 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly local first=offsets[1] local second=offsets[2] if first or second then - local s1=shared[first] - if not s1 then - s1={} - shared[first]=s1 - end - local s2=s1[second] - if not s2 then - s2={ first,second or nil } - s1[second]=s2 + if shared then + local s1=shared[first] + if s1==nil then + s1={} + shared[first]=s1 + end + local s2=s1[second] + if s2==nil then + s2={ first,second or nil } + s1[second]=s2 + end + hash[paired]=s2 + else + hash[paired]={ first,second or nil } end - hash[paired]=s2 else end end @@ -17948,6 +17952,7 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly end end return { + shared=shared and true or nil, format="pair", coverage=usedcoverage, } @@ -21239,16 +21244,30 @@ function readers.pack(data) if kind=="gpos_pair" then local c=step.coverage if c then - if step.format=="pair" then + if step.format~="pair" then + for g1,d1 in next,c do + c[g1]=pack_normal(d1) + end + elseif step.shared then + local shared={} for g1,d1 in next,c do for g2,d2 in next,d1 do - local f=d2[1] if f and f~=true then d2[1]=pack_indexed(f) end - local s=d2[2] if s and s~=true then d2[2]=pack_indexed(s) end + if not shared[d2] then + local f=d2[1] if f and f~=true then d2[1]=pack_indexed(f) end + local s=d2[2] if s and s~=true then d2[2]=pack_indexed(s) end + shared[d2]=true + end end end + if pass==2 then + step.shared=nil + end else for g1,d1 in next,c do - c[g1]=pack_normal(d1) + for g2,d2 in next,d1 do + local f=d2[1] if f and f~=true then d2[1]=pack_indexed(f) end + local s=d2[2] if s and s~=true then d2[2]=pack_indexed(s) end + end end end end @@ -22534,7 +22553,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.107 +otf.version=3.108 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.pngcache=containers.define("fonts","png",otf.version,true) |