diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-24 20:46:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-24 20:46:14 +0000 |
commit | 2e1f687d46764061ec8df089e40b9ac1aece2761 (patch) | |
tree | b633d8a205fd529be57878fc2502e2c07a4c5efc /Master/texmf-dist/tex/latex | |
parent | c0e73acce7eb5e03fceb4e011fa579a5706460c2 (diff) |
l3 (24sep20)
git-svn-id: svn://tug.org/texlive/trunk@56424 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
21 files changed, 1142 insertions, 377 deletions
diff --git a/Master/texmf-dist/tex/latex/l3backend/l3backend-dvipdfmx.def b/Master/texmf-dist/tex/latex/l3backend/l3backend-dvipdfmx.def index ecef294a754..8643b498c4a 100644 --- a/Master/texmf-dist/tex/latex/l3backend/l3backend-dvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3backend/l3backend-dvipdfmx.def @@ -25,7 +25,7 @@ %% %% File: l3backend-basics.dtx \ProvidesExplFile - {l3backend-dvipdfmx.def}{2020-09-11}{} + {l3backend-dvipdfmx.def}{2020-09-24}{} {L3 backend support: dvipdfmx} \cs_if_exist:NTF \__kernel_dependency_version_check:nn { @@ -92,6 +92,7 @@ \__kernel_backend_literal:n { pdf: bc ~ #1 } \group_insert_after:N \__color_backend_reset: } +\cs_new_eq:NN \__color_backend_select_devicen:nn \__color_backend_select_separation:nn \cs_new_protected:Npn \__color_backend_separation_init:nnnnn #1#2#3#4#5 { \pdf_object_now:nx { dict } @@ -104,7 +105,7 @@ } \__color_backend_separation_init:n { - /Separation + /Separation ~ / \str_convert_pdfname:n {#1} ~ #2 ~ \pdf_object_last: } @@ -115,7 +116,7 @@ { \__kernel_backend_literal:x { - pdf:obj ~ @color \int_use:N \g__color_separation_int \c_space_tl + pdf:obj ~ @color \int_use:N \g__color_model_int \c_space_tl [#1] } } @@ -146,6 +147,47 @@ \cs_gset_protected:Npn \__color_backend_separation_init_CIELAB:nnn #1#2#3 { } } +\cs_new_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 + { + \pdf_object_now:nx { stream } + { + { + /FunctionType ~ 4 ~ + /Domain ~ + [ ~ + \prg_replicate:nn + { 0 \__color_backend_devicen_init:w #1 ~ \s__color_stop } + { 0 ~ 1 ~ } ~ + ] ~ + /Range ~ + [ ~ + \str_case:nn {#2} + { + { /DeviceCMYK } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + { /DeviceGray } { 0 ~ 1 } + { /DeviceRGB } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + } ~ + ] + } + {#3} + } + \__color_backend_separation_init:n + { + /DeviceN ~ + [ ~ #1 ~ ] ~ + #2 ~ + \pdf_object_last: + } + } +\cs_if_exist:NF \pdf_object_now:nn + { \cs_gset_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 { } } +\cs_new:Npn \__color_backend_devicen_init:w #1 ~ #2 \s__color_stop + { + + 1 + \tl_if_blank:nF {#2} + { \__color_backend_devicen_init:w #2 \s__color_stop } + } +\cs_new_eq:NN \__color_backend_devicen_init:n \__color_backend_separation_init:n \cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 { \__kernel_backend_literal_pdf:n { #1 ~ k } } \cs_new_protected:Npn \__color_backend_fill_gray:n #1 @@ -162,6 +204,8 @@ { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } } \cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn %% File: l3backend-box.dtx \cs_new_protected:Npn \__box_backend_clip:N #1 { diff --git a/Master/texmf-dist/tex/latex/l3backend/l3backend-dvips.def b/Master/texmf-dist/tex/latex/l3backend/l3backend-dvips.def index 84ff37e80c0..32425e0870a 100644 --- a/Master/texmf-dist/tex/latex/l3backend/l3backend-dvips.def +++ b/Master/texmf-dist/tex/latex/l3backend/l3backend-dvips.def @@ -25,7 +25,7 @@ %% %% File: l3backend-basics.dtx \ProvidesExplFile - {l3backend-dvips.def}{2020-09-11}{} + {l3backend-dvips.def}{2020-09-24}{} {L3 backend support: dvips} \cs_if_exist:NTF \__kernel_dependency_version_check:nn { @@ -112,6 +112,7 @@ { \__kernel_backend_literal:n { color~pop } } \cs_new_protected:Npn \__color_backend_select_separation:nn #1#2 { \__color_backend_select:n { separation ~ #1 ~ #2 } } +\cs_new_eq:NN \__color_backend_select_devicen:nn \__color_backend_select_separation:nn \cs_new_protected:Npx \__color_backend_separation_init:nnnnn #1#2#3#4#5 { \bool_if:NT \g__kernel_backend_header_bool @@ -132,7 +133,7 @@ { ! TeXDict ~ begin ~ - /color \int_use:N \g__color_separation_int + /color \int_use:N \g__color_model_int { [ ~ /Separation ~ ( \str_convert_pdfname:n {#1} ) ~ @@ -262,6 +263,24 @@ { 100 ~ 0 ~ 0 } {#3} } +\cs_new_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 + { + \__kernel_backend_literal:e + { + ! + TeXDict ~ begin ~ + /color \int_use:N \g__color_model_int + { + [ ~ + /DeviceN ~ + [ ~ #1 ~ ] ~ + #2 ~ + { ~ #3 ~ } ~ + ] ~ setcolorspace + } ~ def ~ + end + } + } \cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 { \__kernel_backend_postscript:n { /color.fc { #1 ~ setcmykcolor } def } } \cs_new_protected:Npn \__color_backend_fill_gray:n #1 @@ -278,6 +297,8 @@ { \__kernel_backend_postscript:n { /color.fc { #1 } def } } \cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { \__kernel_backend_postscript:n { /color.sc { #1 } def } } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn %% File: l3backend-box.dtx \cs_new_protected:Npn \__box_backend_clip:N #1 { diff --git a/Master/texmf-dist/tex/latex/l3backend/l3backend-dvisvgm.def b/Master/texmf-dist/tex/latex/l3backend/l3backend-dvisvgm.def index a2616cd5741..a85b91ed169 100644 --- a/Master/texmf-dist/tex/latex/l3backend/l3backend-dvisvgm.def +++ b/Master/texmf-dist/tex/latex/l3backend/l3backend-dvisvgm.def @@ -25,7 +25,7 @@ %% %% File: l3backend-basics.dtx \ProvidesExplFile - {l3backend-dvisvgm.def}{2020-09-11}{} + {l3backend-dvisvgm.def}{2020-09-24}{} {L3 backend support: dvisvgm} \cs_if_exist:NTF \__kernel_dependency_version_check:nn { @@ -121,6 +121,7 @@ \cs_new_protected:Npn \__color_backend_reset: { \__kernel_backend_literal:n { color~pop } } \cs_new_protected:Npn \__color_backend_select_separation:nn #1#2 { } +\cs_new_protected:Npn \__color_backend_select_devicen:nn #1#2 { } \cs_new_protected:Npn \__color_backend_separation_init:nnnnn #1#2#3#4#5 { } \cs_new_protected:Npn \__color_backend_separation_init_CIELAB:nnnnnn #1#2#3 { } \cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 @@ -185,10 +186,10 @@ " } } -\cs_new_protected:Npn \__color_backend_fill_separation:nn #1#2 - { } -\cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 - { } +\cs_new_protected:Npn \__color_backend_fill_separation:nn #1#2 { } +\cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn %% File: l3backend-box.dtx \cs_new_protected:Npn \__box_backend_clip:N #1 { diff --git a/Master/texmf-dist/tex/latex/l3backend/l3backend-luatex.def b/Master/texmf-dist/tex/latex/l3backend/l3backend-luatex.def index f7eb09b28bc..80181c90df3 100644 --- a/Master/texmf-dist/tex/latex/l3backend/l3backend-luatex.def +++ b/Master/texmf-dist/tex/latex/l3backend/l3backend-luatex.def @@ -25,7 +25,7 @@ %% %% File: l3backend-basics.dtx \ProvidesExplFile - {l3backend-luatex.def}{2020-09-11}{} + {l3backend-luatex.def}{2020-09-24}{} {L3 backend support: PDF output (LuaTeX)} \cs_if_exist:NTF \__kernel_dependency_version_check:nn { @@ -123,6 +123,7 @@ } \cs_new_protected:Npn \__color_backend_select_separation:nn #1#2 { \__color_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } } +\cs_new_eq:NN \__color_backend_select_devicen:nn \__color_backend_select_separation:nn \cs_new_protected:Npn \__color_backend_separation_init:nnnnn #1#2#3#4#5 { \pdf_object_now:nx { dict } @@ -135,7 +136,7 @@ } \__color_backend_separation_init:n { - /Separation + /Separation ~ / \str_convert_pdfname:n {#1} ~ #2 ~ \pdf_object_last: } @@ -143,7 +144,7 @@ { \pdfcoredict_gput:nnn { Page / Resources / ColorSpace } - { color \int_use:N \g__color_separation_int } + { color \int_use:N \g__color_model_int } { \pdf_object_last: } } } @@ -180,6 +181,54 @@ \cs_gset_protected:Npn \__color_backend_separation_init_CIELAB:nnn #1#2#3 { } } +\cs_new_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 + { + \pdf_object_now:nx { stream } + { + { + /FunctionType ~ 4 ~ + /Domain ~ + [ ~ + \prg_replicate:nn + { 0 \__color_backend_devicen_init:w #1 ~ \s__color_stop } + { 0 ~ 1 ~ } ~ + ] ~ + /Range ~ + [ ~ + \str_case:nn {#2} + { + { /DeviceCMYK } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + { /DeviceGray } { 0 ~ 1 } + { /DeviceRGB } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + } ~ + ] + } + {#3} + } + \__color_backend_separation_init:n + { + /DeviceN ~ + [ ~ #1 ~ ] ~ + #2 ~ + \pdf_object_last: + } + \use:x + { + \pdfcoredict_gput:nnn + { Page / Resources / ColorSpace } + { color \int_use:N \g__color_model_int } + { \pdf_object_last: } + } + } +\cs_if_exist:NF \pdf_object_now:nn + { \cs_gset_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 { } } +\cs_new:Npn \__color_backend_devicen_init:w #1 ~ #2 \s__color_stop + { + + 1 + \tl_if_blank:nF {#2} + { \__color_backend_devicen_init:w #2 \s__color_stop } + } +\cs_new_eq:NN \__color_backend_devicen_init:n \__color_backend_separation_init:n \cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 { \__kernel_backend_literal_pdf:n { #1 ~ k } } \cs_new_protected:Npn \__color_backend_fill_gray:n #1 @@ -196,6 +245,8 @@ { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } } \cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn %% File: l3backend-box.dtx \cs_new_protected:Npn \__box_backend_clip:N #1 { diff --git a/Master/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def b/Master/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def index 85d24278f52..fa05b1f7721 100644 --- a/Master/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def +++ b/Master/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def @@ -25,7 +25,7 @@ %% %% File: l3backend-basics.dtx \ProvidesExplFile - {l3backend-pdftex.def}{2020-09-11}{} + {l3backend-pdftex.def}{2020-09-24}{} {L3 backend support: PDF output (pdfTeX)} \cs_if_exist:NTF \__kernel_dependency_version_check:nn { @@ -123,6 +123,7 @@ } \cs_new_protected:Npn \__color_backend_select_separation:nn #1#2 { \__color_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ scn ~ #2 ~ SCN } } +\cs_new_eq:NN \__color_backend_select_devicen:nn \__color_backend_select_separation:nn \cs_new_protected:Npn \__color_backend_separation_init:nnnnn #1#2#3#4#5 { \pdf_object_now:nx { dict } @@ -135,7 +136,7 @@ } \__color_backend_separation_init:n { - /Separation + /Separation ~ / \str_convert_pdfname:n {#1} ~ #2 ~ \pdf_object_last: } @@ -143,7 +144,7 @@ { \pdfcoredict_gput:nnn { Page / Resources / ColorSpace } - { color \int_use:N \g__color_separation_int } + { color \int_use:N \g__color_model_int } { \pdf_object_last: } } } @@ -180,6 +181,54 @@ \cs_gset_protected:Npn \__color_backend_separation_init_CIELAB:nnn #1#2#3 { } } +\cs_new_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 + { + \pdf_object_now:nx { stream } + { + { + /FunctionType ~ 4 ~ + /Domain ~ + [ ~ + \prg_replicate:nn + { 0 \__color_backend_devicen_init:w #1 ~ \s__color_stop } + { 0 ~ 1 ~ } ~ + ] ~ + /Range ~ + [ ~ + \str_case:nn {#2} + { + { /DeviceCMYK } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + { /DeviceGray } { 0 ~ 1 } + { /DeviceRGB } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + } ~ + ] + } + {#3} + } + \__color_backend_separation_init:n + { + /DeviceN ~ + [ ~ #1 ~ ] ~ + #2 ~ + \pdf_object_last: + } + \use:x + { + \pdfcoredict_gput:nnn + { Page / Resources / ColorSpace } + { color \int_use:N \g__color_model_int } + { \pdf_object_last: } + } + } +\cs_if_exist:NF \pdf_object_now:nn + { \cs_gset_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 { } } +\cs_new:Npn \__color_backend_devicen_init:w #1 ~ #2 \s__color_stop + { + + 1 + \tl_if_blank:nF {#2} + { \__color_backend_devicen_init:w #2 \s__color_stop } + } +\cs_new_eq:NN \__color_backend_devicen_init:n \__color_backend_separation_init:n \cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 { \__kernel_backend_literal_pdf:n { #1 ~ k } } \cs_new_protected:Npn \__color_backend_fill_gray:n #1 @@ -196,6 +245,8 @@ { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } } \cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn %% File: l3backend-box.dtx \cs_new_protected:Npn \__box_backend_clip:N #1 { diff --git a/Master/texmf-dist/tex/latex/l3backend/l3backend-xetex.def b/Master/texmf-dist/tex/latex/l3backend/l3backend-xetex.def index bc40c6ee387..fa755e56742 100644 --- a/Master/texmf-dist/tex/latex/l3backend/l3backend-xetex.def +++ b/Master/texmf-dist/tex/latex/l3backend/l3backend-xetex.def @@ -25,7 +25,7 @@ %% %% File: l3backend-basics.dtx \ProvidesExplFile - {l3backend-xetex.def}{2020-09-11}{} + {l3backend-xetex.def}{2020-09-24}{} {L3 backend support: XeTeX} \cs_if_exist:NTF \__kernel_dependency_version_check:nn { @@ -92,6 +92,7 @@ \__kernel_backend_literal:n { pdf: bc ~ #1 } \group_insert_after:N \__color_backend_reset: } +\cs_new_eq:NN \__color_backend_select_devicen:nn \__color_backend_select_separation:nn \cs_new_protected:Npn \__color_backend_separation_init:nnnnn #1#2#3#4#5 { \pdf_object_now:nx { dict } @@ -104,7 +105,7 @@ } \__color_backend_separation_init:n { - /Separation + /Separation ~ / \str_convert_pdfname:n {#1} ~ #2 ~ \pdf_object_last: } @@ -115,7 +116,7 @@ { \__kernel_backend_literal:x { - pdf:obj ~ @color \int_use:N \g__color_separation_int \c_space_tl + pdf:obj ~ @color \int_use:N \g__color_model_int \c_space_tl [#1] } } @@ -146,6 +147,47 @@ \cs_gset_protected:Npn \__color_backend_separation_init_CIELAB:nnn #1#2#3 { } } +\cs_new_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 + { + \pdf_object_now:nx { stream } + { + { + /FunctionType ~ 4 ~ + /Domain ~ + [ ~ + \prg_replicate:nn + { 0 \__color_backend_devicen_init:w #1 ~ \s__color_stop } + { 0 ~ 1 ~ } ~ + ] ~ + /Range ~ + [ ~ + \str_case:nn {#2} + { + { /DeviceCMYK } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + { /DeviceGray } { 0 ~ 1 } + { /DeviceRGB } { 0 ~ 1 ~ 0 ~ 1 ~ 0 ~ 1 } + } ~ + ] + } + {#3} + } + \__color_backend_separation_init:n + { + /DeviceN ~ + [ ~ #1 ~ ] ~ + #2 ~ + \pdf_object_last: + } + } +\cs_if_exist:NF \pdf_object_now:nn + { \cs_gset_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 { } } +\cs_new:Npn \__color_backend_devicen_init:w #1 ~ #2 \s__color_stop + { + + 1 + \tl_if_blank:nF {#2} + { \__color_backend_devicen_init:w #2 \s__color_stop } + } +\cs_new_eq:NN \__color_backend_devicen_init:n \__color_backend_separation_init:n \cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 { \__kernel_backend_literal_pdf:n { #1 ~ k } } \cs_new_protected:Npn \__color_backend_fill_gray:n #1 @@ -162,6 +204,8 @@ { \__kernel_backend_literal_pdf:n { /#1 ~ cs ~ #2 ~ scn } } \cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { \__kernel_backend_literal_pdf:n { /#1 ~ CS ~ #2 ~ SCN } } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn %% File: l3backend-box.dtx \cs_new_protected:Npn \__box_backend_clip:N #1 { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3benchmark/l3benchmark.sty b/Master/texmf-dist/tex/latex/l3experimental/l3benchmark/l3benchmark.sty index 25891307496..c037a40a41e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3benchmark/l3benchmark.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3benchmark/l3benchmark.sty @@ -20,12 +20,31 @@ %% %% File: l3benchmark.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3benchmark}{2020-09-11}{} +\ProvidesExplPackage{l3benchmark}{2020-09-24}{} {L3 Experimental benchmarking} \sys_if_engine_luatex:TF { + \cs_new:Npn \__sys_elapsedtime: { } + \cs_new:Npn \__sys_resettimer: { } + \lua_now:n + { + local~gettimeofday = os.gettimeofday~ + local~epoch = gettimeofday() - os.clock()~ + local~write = tex.write~ + local~tointeger = math.tointeger~ + local~id = luatexbase.new_luafunction'__sys_elapsedtime:' + lua.get_functions_table()[id] = function() + write(tointeger((gettimeofday() - epoch)*65536 // 1)) + end~ + token.set_lua('__sys_elapsedtime:', id, 'global') + id = luatexbase.new_luafunction'__sys_resettimer:' + lua.get_functions_table()[id] = function() + epoch = gettimeofday() + end~ + token.set_lua('__sys_resettimer:', id, 'global', 'protected') + } \cs_new:Npn \sys_timer: - { \lua_now:n { l3kernel.elapsedtime() } } + { \__sys_elapsedtime: } } { \cs_if_exist:NT \tex_elapsedtime:D @@ -41,7 +60,7 @@ \sys_if_engine_luatex:TF { \cs_new_protected:Npn \sys_gzero_timer: - { \lua_now:n { l3kernel.resettimer() } } + { \__sys_resettimer: } } { \cs_new_protected:Npn \sys_gzero_timer: { \tex_resettimer:D } } } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3color/l3color.sty b/Master/texmf-dist/tex/latex/l3experimental/l3color/l3color.sty index 0d6d0ca16c6..8c291e4f258 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3color/l3color.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3color/l3color.sty @@ -20,8 +20,9 @@ %% %% File: l3color.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3color}{2020-09-11}{} +\ProvidesExplPackage{l3color}{2020-09-24}{} {L3 Experimental color support} +\int_new:N \l__color_internal_int \tl_new:N \l__color_internal_tl \scan_new:N \s__color_mark \prg_new_conditional:Npnn \__color_if_defined:n #1 { T, F, TF } @@ -698,7 +699,19 @@ \cs_new_protected:cpn { __color_export_space-sep-rgb:Nw } #1#2 \s__color_stop { \tl_set:Nx #1 {#2} } \prop_new:N \l__color_internal_prop -\int_new:N \g__color_separation_int +\int_new:N \g__color_model_int +\tl_const:Nn \c__color_fallback_cmyk_tl { 0 ~ 0 ~ 0 ~ 1 } +\tl_const:Nn \c__color_fallback_gray_tl { 1 } +\tl_const:Nn \c__color_fallback_rgb_tl { 1 ~ 1 ~ 1 } +\prop_new:N \g__color_colorants_prop +\prop_gput:Nnn \g__color_colorants_prop { black } { Black } +\prop_gput:Nnn \g__color_colorants_prop { blue } { Blue } +\prop_gput:Nnn \g__color_colorants_prop { cyan } { Cyan } +\prop_gput:Nnn \g__color_colorants_prop { green } { Green } +\prop_gput:Nnn \g__color_colorants_prop { magenta } { Magenta } +\prop_gput:Nnn \g__color_colorants_prop { none } { None } +\prop_gput:Nnn \g__color_colorants_prop { red } { Red } +\prop_gput:Nnn \g__color_colorants_prop { yellow } { Yellow } \tl_const:Nn \c__color_model_whitepoint_CIELAB_a_tl { 1.0985 ~ 1 ~ 0.3558 } \tl_const:Nn \c__color_model_whitepoint_CIELAB_b_tl { 0.9807 ~ 1 ~ 1.1822 } \tl_const:Nn \c__color_model_whitepoint_CIELAB_e_tl { 1 ~ 1 ~ 1 } @@ -707,6 +720,19 @@ \tl_const:cn { c__color_model_whitepoint_CIELAB_d65_tl } { 0.9504 ~ 1 ~ 1.0888 } \tl_const:cn { c__color_model_whitepoint_CIELAB_d75_tl } { 0.9497 ~ 1 ~ 1.2261 } \tl_const:Nn \c__color_model_range_CIELAB_tl { 0 ~ 100 ~ -128 ~ 127 ~ -128 ~ 127 } +\prop_new:N \g__color_alternative_model_prop +\clist_map_inline:nn { cyan , magenta , yellow , black } + { \prop_gput:Nnn \g__color_alternative_model_prop {#1} { cmyk } } +\clist_map_inline:nn { red , green , blue } + { \prop_gput:Nnn \g__color_alternative_model_prop {#1} { rgb } } +\prop_new:N \g__color_alternative_values_prop +\prop_gput:Nnn \g__color_alternative_values_prop { cyan } { 1 , 0 , 0 , 0 } +\prop_gput:Nnn \g__color_alternative_values_prop { magenta } { 0 , 1 , 0 , 0 } +\prop_gput:Nnn \g__color_alternative_values_prop { yellow } { 0 , 0 , 1 , 0 } +\prop_gput:Nnn \g__color_alternative_values_prop { black } { 0 , 0 , 0 , 1 } +\prop_gput:Nnn \g__color_alternative_values_prop { red } { 1 , 0 , 0 } +\prop_gput:Nnn \g__color_alternative_values_prop { green } { 0 , 1 , 0 } +\prop_gput:Nnn \g__color_alternative_values_prop { blue } { 0 , 0 , 1 } \cs_new_protected:Npn \color_model_new:nnn #1#2#3 { \exp_args:Nee \__color_model_new:nnn @@ -779,7 +805,7 @@ \cs_new_protected:Npn \__color_model_separation:w #1 , #2 , #3 , #4 , #5 \s__color_stop #6#7#8 { - \int_gincr:N \g__color_separation_int + \int_gincr:N \g__color_model_int \tl_const:cn { c__color_fallback_ #6 _tl } { 1 } \cs_new_eq:cN { __color_parse_mix_ #6 :nw } \__color_parse_mix_gray:nw \cs_new:cpn { __color_parse_model_ #6 :w } ##1 , ##2 \s__color_stop @@ -789,11 +815,14 @@ \cs_new_protected:cpx { __color_backend_ ##1 _ #6 :n } ####1 { \exp_not:c { __color_backend_ ##1 _ separation:nn } - { color \int_use:N \g__color_separation_int } {####1} + { color \int_use:N \g__color_model_int } {####1} } } \use:c { __color_model_separation_ #8 :nnnnnn } {#6} {#7} {#1} {#2} {#3} {#4} + \prop_gput:Nnn \g__color_alternative_model_prop {#6} {#8} + \prop_gput:Nnx \g__color_colorants_prop {#6} + { \str_convert_pdfname:n {#7} } \cs_new_protected:cpx { __color_model_ #6 _white: } { \prop_put:Nnn \exp_not:N \l__color_named_white_prop {#6} { 0 } @@ -813,6 +842,7 @@ } \__color_model_convert:nnn {#1} { cmyk } { rgb } \__color_model_convert:nnn {#1} { cmyk } { gray } + \prop_gput:Nnn \g__color_alternative_values_prop {#1} { #3 , #4 , #5 , #6 } \__color_backend_separation_init:nnnnn {#2} { /DeviceCMYK } { } { 0 ~ 0 ~ 0 ~ 0 } { #3 ~ #4 ~ #5 ~ #6 } } @@ -826,6 +856,7 @@ } \__color_model_convert:nnn {#1} { rgb } { cmyk } \__color_model_convert:nnn {#1} { rgb } { gray } + \prop_gput:Nnn \g__color_alternative_values_prop {#1} { #3 , #4 , #5 } \__color_backend_separation_init:nnnnn {#2} { /DeviceRGB } { } { 0 ~ 0 ~ 0 } { #3 ~ #4 ~ #5 } } @@ -846,6 +877,7 @@ \fp_eval:n {##1 * #3} ~ \fp_eval:n {##1 * #3} } + \prop_gput:Nnn \g__color_alternative_values_prop {#1} {#3} \__color_backend_separation_init:nnnnn {#2} { /DeviceGray } { } { 0 } {#3} } \cs_new_protected:Npn \__color_model_convert:nnn #1#2#3 @@ -887,6 +919,393 @@ { unknown-CIELAB-illuminant } {#1} } } +\cs_new_protected:Npn \__color_model_devicen:n #1 + { + \prop_get:NnNTF \l__color_internal_prop { names } + \l__color_internal_tl + { + \exp_args:NV \__color_model_devicen:nn + \l__color_internal_tl {#1} + } + { + \__kernel_msg_error:nnn { color } + { DeviceN-requires-names } {#1} + } + } +\cs_new_protected:Npn \__color_model_devicen:nn #1#2 + { + \tl_clear:N \l__color_model_tl + \clist_map_inline:nn {#1} + { + \prop_get:NnNTF \g__color_alternative_model_prop {##1} + \l__color_internal_tl + { + \tl_if_empty:NTF \l__color_model_tl + { \tl_set_eq:NN \l__color_model_tl \l__color_internal_tl } + { + \str_if_eq:VVF \l__color_model_tl \l__color_internal_tl + { + \__kernel_msg_error:nnn { color } + { DeviceN-inconsistent-alternative } + {#2} + \clist_map_break:n { \use_none:nnnn } + } + } + } + { + \str_if_eq:nnF {##1} { none } + { + \__kernel_msg_error:nnn { color } + { DeviceN-no-alternative } + {#2} + } + } + } + \tl_if_empty:NTF \l__color_model_tl + { + \__kernel_msg_error:nnn { color } + { DeviceN-no-alternative } {#2} + } + { \exp_args:NV \__color_model_devicen:nnn \l__color_model_tl {#1} {#2} } + } +\cs_new_protected:Npn \__color_model_devicen:nnn #1#2#3 + { + \exp_args:Nx \__color_model_devicen:nnnn + { \clist_count:n {#2} } {#1} {#2} {#3} + } +\cs_new_protected:Npn \__color_model_devicen:nnnn #1#2#3#4 + { + \int_gincr:N \g__color_model_int + \tl_const:cx { c__color_fallback_ #4 _tl } + { \prg_replicate:nn {#1} { 1 ~ } } + \cs_if_exist_use:cF { __color_model_devicen_parse_ #1 :nn } + { \__color_model_devicen_parse_generic:nn } + {#4} {#1} + \clist_map_inline:nn { fill , stroke , select } + { + \cs_new_protected:cpx { __color_backend_ ##1 _ #4 :n } ####1 + { + \exp_not:c { __color_backend_ ##1 _ devicen:nn } + { color \int_use:N \g__color_model_int } {####1} + } + } + \cs_new_protected:cpx { __color_model_ #4 _white: } + { + \prop_put:Nnn \exp_not:N \l__color_named_white_prop {#4} + { \prg_replicate:nn {#1} { 0 ~ } } + \exp_not:N \int_compare:nNnF { \tex_currentgrouplevel:D } = 0 + { \group_insert_after:N \exp_not:c { __color_model_ #4 _ white: } } + } + \use:c { __color_model_ #4 _white: } + \__color_model_devicen_init:nnn {#1} {#2} {#3} + \__color_model_devicen_convert:nnn {#4} {#2} {#3} + } +\cs_new_protected:cpn { __color_model_devicen_parse_1:nn } #1#2 + { + \cs_new:cpn { __color_parse_model_ #1 :w } ##1 , ##2 \s__color_stop + { {#1} { \__color_parse_number:n {##1} } } + \cs_new_eq:cN { __color_parse_mix_ #1 :nw } \__color_parse_mix_gray:nw + } +\cs_new_protected:cpn { __color_model_devicen_parse_2:nn } #1#2 + { + \cs_new:cpn { __color_parse_model_ #1 :w } ##1 , ##2 , ##3 \s__color_stop + { {#1} { \__color_parse_number:n {##1} ~ \__color_parse_number:n {##2} } } + \cs_new:cpn { __color_parse_mix_ #1 :nw } + ##1##2 ~ ##3 \s__color_mark ##4 ~ ##5 \s__color_stop + { + \fp_eval:n { ##2 * ##1 + ##4 * ( 1 - ##1 ) } \c_space_tl + \fp_eval:n { ##3 * ##1 + ##5 * ( 1 - ##1 ) } + } + } +\cs_new_protected:cpn { __color_model_devicen_parse_3:nn } #1#2 + { + \cs_new:cpn { __color_parse_model_ #1 :w } ##1 , ##2 , ##3 , ##4 \s__color_stop + { + {#1} + { + \__color_parse_number:n {##1} ~ + \__color_parse_number:n {##2} ~ + \__color_parse_number:n {##3} + } + } + \cs_new_eq:cN { __color_parse_mix_ #1 :nw } \__color_parse_mix_rgb:nw + } +\cs_new_protected:cpn { __color_model_devicen_parse_4:nn } #1#2 + { + \cs_new:cpn { __color_parse_model_ #1 :w } + ##1 , ##2 , ##3 , ##4 , ##5 \s__color_stop + { + {#1} + { + \__color_parse_number:n {##1} ~ + \__color_parse_number:n {##2} ~ + \__color_parse_number:n {##3} ~ + \__color_parse_number:n {##4} + } + } + \cs_new_eq:cN { __color_parse_mix_ #1 :nw } \__color_parse_mix_cmyk:nw + } +\cs_new_protected:Npn \__color_model_devicen_parse_generic:nn #1#2 + { + \cs_new:cpn { __color_parse_model_ #1 :w } ##1 , ##2 \s__color_stop + { + {#1} + { \__color_model_devicen_parse:nw {#2} ##1 , ##2 , \q_nil , \s__color_stop } + } + \cs_new:cpx { __color_parse_mix_ #1 :nw } + ##1 ##2 \s__color_mark ##3 \s__color_stop + { + \exp_not:N \__color_model_devicen_mix:nw {##1} + ##2 \c_space_tl \exp_not:N \q_nil \c_space_tl \exp_not:N \s__color_mark + ##3 \c_space_tl \exp_not:N \q_nil \c_space_tl \exp_not:N \s__color_stop + } + } +\cs_new:Npn \__color_model_devicen_parse:nw #1#2 , #3 \s__color_stop + { + \int_compare:nNnT {#1} > 0 + { + \quark_if_nil:nTF {#2} + { \prg_replicate:nn {#1} { 0 ~ } } + { + \__color_parse_number:n {#2} + \int_compare:nNnT {#1} > 1 { ~ } + \exp_args:Nf \__color_model_devicen_parse:nw + { \int_eval:n { #1 - 1 } } #3 \s__color_stop + } + } + } +\cs_new:Npn \__color_model_devicen_mix:nw #1#2 ~ #3 \s__color_mark #4 ~ #5 \s__color_stop + { + \fp_eval:n { #2 * #1 + #4 * ( 1 - #1 ) } + \quark_if_nil:oF { \tl_head:w #3 \q_stop } + { + \c_space_tl + \__color_model_devicen_mix:nw {#1} #3 \s__color_mark #5 \s__color_stop + } + } +\cs_new_protected:Npn \__color_model_devicen_init:nnn #1#2#3 + { + \exp_args:Ne \__color_model_devicen_init:nnnn + { + \str_case:nn {#2} + { + { cmyk } { 4 } + { gray } { 1 } + { rgb } { 3 } + } + } + {#1} {#2} {#3} + } +\cs_new_protected:Npn \__color_model_devicen_init:nnnn #1#2#3#4 + { + \tl_set:Nx \l__color_internal_tl + { \prg_replicate:nn {#1} { 1.0 ~ } } + \int_zero:N \l__color_internal_int + \clist_map_inline:nn {#4} + { + \int_incr:N \l__color_internal_int + \prop_get:NnN \g__color_alternative_values_prop {##1} + \l__color_value_tl + \exp_after:wN \__color_model_devicen_transform:w + \l__color_value_tl , 0 , 0 , 0 \s__color_stop {#1} {#2} + } + \tl_put_right:Nx \l__color_internal_tl + { + \prg_replicate:nn {#1} + { neg ~ 1.0 ~ add ~ #1 ~ -1 ~ roll ~ } + \int_eval:n { #2 + 4 } ~ 4 ~ roll + \prg_replicate:nn {#2} { ~ pop } + } + \use:x + { + \__color_backend_devicen_init:nnn + { + \clist_map_function:nN {#4} + \__color_model_devicen_colorant:n + } + { + \str_case:nn {#3} + { + { cmyk } { /DeviceCMYK } + { gray } { /DeviceGray } + { rgb } { /DeviceRGB } + } + } + { \exp_not:V \l__color_internal_tl } + } + } +\cs_new_protected:Npn \__color_model_devicen_transform:w + #1 , #2 , #3 , #4 , #5 \s__color_stop #6#7 + { + \use:c { __color_model_devicen_transform_ #6 :nnnnn } + {#1} {#2} {#3} {#4} {#7} + } +\cs_new_protected:cpn { __color_model_devicen_transform_1:nnnnn } #1#2#3#4#5 + { \__color_model_devicen_transform:nnn {#5} { 1 } {#1} } +\cs_new_protected:cpn { __color_model_devicen_transform_3:nnnnn } #1#2#3#4#5 + { + \clist_map_inline { #1 , #2 , #3 } + { \__color_model_devicen_transform:nnn {#5} { 3 } {##1} } + } +\cs_new_protected:cpn { __color_model_devicen_transform_4:nnnnn } #1#2#3#4#5 + { + \clist_map_inline:nn { #1 , #2 , #3 , #4 } + { \__color_model_devicen_transform:nnn {#5} { 4 } {##1} } + } +\cs_new_protected:Npn \__color_model_devicen_transform:nnn #1#2#3 + { + \tl_put_right:Nx \l__color_internal_tl + { + \fp_compare:nNnF {#3} = \c_zero_fp + { + \int_eval:n { #1 - \l__color_internal_int + #2 } ~ index ~ + #3 ~ neg ~ mul ~ 1.0 ~ add ~ mul ~ + } + #2 ~ -1 ~ roll ~ + } + } +\cs_new:Npn \__color_model_devicen_colorant:n #1 + { + / \prop_item:Nn \g__color_colorants_prop {#1} ~ + } +\cs_new_protected:Npn \__color_model_devicen_convert:nnn #1#2#3 + { + \use:c { __color_model_devicen_convert_ #2 :nn } {#1} {#3} + } +\cs_new_protected:Npn \__color_model_devicen_convert_cmyk:nn #1#2 + { + \__color_model_convert:nnn {#1} { cmyk } { gray } + \__color_model_convert:nnn {#1} { cmyk } { rgb } + \__color_model_devicen_convert:nnnn {#1} { cmyk } { 4 } {#2} + } +\cs_new_protected:Npn \__color_model_devicen_convert_gray:nn #1#2 + { + \__color_model_convert:nnn {#1} { gray } { cmyk } + \__color_model_convert:nnn {#1} { gray } { rgb } + \__color_model_devicen_convert:nnnn {#1} { gray } { 1 } {#2} + } +\cs_new_protected:Npn \__color_model_devicen_convert_rgb:nn #1#2 + { + \__color_model_convert:nnn {#1} { rgb } { cmyk } + \__color_model_convert:nnn {#1} { rgb } { gray } + \__color_model_devicen_convert:nnnn {#1} { rgb } { 3 } {#2} + } +\cs_new_protected:Npn \__color_model_devicen_convert:nnnn #1#2#3#4 + { + \cs_new:cpx { __color_convert_ #1 _ #2 :w } ##1 \s__color_stop + { + \exp_not:c { __color_convert_devicen_ #2 : \prg_replicate:nn {#3} { n } w } + \prg_replicate:nn {#3} { { 1 } } + ##1 \exp_not:N \s__color_mark + \clist_map_function:nN {#4} \__color_model_devicen_convert:n + \exp_not:N \s__color_stop + } + } +\cs_new:Npn \__color_model_devicen_convert:n #1 + { + { + \exp_args:Ne \__color_model_devicen_convert_aux:n + { \prop_item:Nn \g__color_alternative_values_prop {#1} } + } + } +\cs_new:Npn \__color_model_devicen_convert_aux:n #1 + { \__color_model_devicen_convert_aux:w #1 , , , , \s__color_stop } +\cs_new:Npn \__color_model_devicen_convert_aux:w #1 , #2 , #3 , #4 , #5 \s__color_stop + { + {#1} + \tl_if_blank:nF {#2} + { + {#2} + \tl_if_blank:nF {#3} + { + {#3} + \tl_if_blank:nF {#4} { {#4} } + } + } + } +\cs_new:Npn \__color_convert_devicen_cmyk:nnnnw + #1#2#3#4#5 ~ #6 \s__color_mark #7#8 \s__color_stop + { + \__color_convert_devicen_cmyk:nnnnnnnnn {#5} {#1} {#2} {#3} {#4} #7 + #6 \s__color_mark #8 \s__color_stop + } +\cs_new:Npn \__color_convert_devicen_cmyk:nnnnnnnnn #1#2#3#4#5#6#7#8#9 + { + \use:e + { + \exp_not:N \__color_convert_devicen_cmyk_aux:nnnnw + { \fp_eval:n { #2 * (1 - (#1 * #6)) } } + { \fp_eval:n { #3 * (1 - (#1 * #7)) } } + { \fp_eval:n { #4 * (1 - (#1 * #8)) } } + { \fp_eval:n { #5 * (1 - (#1 * #9)) } } + } + } +\cs_new:Npn \__color_convert_devicen_cmyk_aux:nnnnw + #1#2#3#4 #5 \s__color_mark #6 \s__color_stop + { + \tl_if_blank:nTF {#5} + { + \fp_eval:n { 1 - #1 } ~ + \fp_eval:n { 1 - #2 } ~ + \fp_eval:n { 1 - #3 } ~ + \fp_eval:n { 1 - #4 } + } + { + \__color_convert_devicen_cmyk:nnnnw {#1} {#2} {#3} {#4} + #5 \s__color_mark #6 \s__color_stop + } + } +\cs_new:Npn \__color_convert_devicen_gray:nw + #1#2 ~ #3 \s__color_mark #4#5 \s__color_stop + { + \__color_convert_devicen_gray:nnn {#2} {#1} #4 + #3 \s__color_mark #5 \s__color_stop + } +\cs_new:Npn \__color_convert_devicen_gray:nnn #1#2#3 + { + \exp_arsgs:Ne \__color_convert_devicen_gray_aux:nw + { \fp_eval:n { #2 * (1 - (#1 * #3)) } } + } +\cs_new:Npn \__color_convert_devicen_gray_aux:nw + #1 #2 \s__color_mark #3 \s__color_stop + { + \tl_if_blank:nTF {#2} + { \fp_eval:n { 1 - #1 } } + { + \__color_convert_devicen_gray:nw {#1} + #2 \s__color_mark #3 \s__color_stop + } + } +\cs_new:Npn \__color_convert_devicen_rgb:nnnw + #1#2#3#4 ~ #5 \s__color_mark #6#7 \s__color_stop + { + \__color_convert_devicen_cmyk:nnnnnn {#4} {#1} {#2} {#3} #6 + #5 \s__color_mark #7 \s__color_stop + } +\cs_new:Npn \__color_convert_devicen_rgb:nnnnnnn #1#2#3#4#5#6#7 + { + \use:e + { + \exp_not:N \__color_convert_devicen_rgb_aux:nnnw + { \fp_eval:n { #2 * (1 - (#1 * #5)) } } + { \fp_eval:n { #3 * (1 - (#1 * #6)) } } + { \fp_eval:n { #4 * (1 - (#1 * #7)) } } + } + } +\cs_new:Npn \__color_convert_devicen_rgb_aux:nnnw + #1#2#3 #4 \s__color_mark #5 \s__color_stop + { + \tl_if_blank:nTF {#4} + { + \fp_eval:n { 1 - #1 } ~ + \fp_eval:n { 1 - #2 } ~ + \fp_eval:n { 1 - #3 } + } + { + \__color_convert_devicen_rgb:nnnw {#1} {#2} {#3} + #4 \s__color_mark #5 \s__color_stop + } + } \cs_new_protected:Npn \color_show:n #1 { \msg_show:nnxxxx { LaTeX / color } { show } @@ -923,6 +1342,28 @@ LaTeX~has~been~asked~to~convert~a~color~from~model~'#1'~ to~model'#2',~but~there~is~no~method~available~to~do~that. } +\__kernel_msg_new:nnnn { color } { DeviceN-inconsistent-alternative } + { DeviceN~color~spaces~require~a~single~alternative~space. } + { + LaTeX~has~been~asked~to~create~a~DeviceN~color~space~'#1',~ + but~the~constituent~colors~do~not~have~a~common~alternative~ + color. + } +\__kernel_msg_new:nnnn { color } { DeviceN-no-alternative } + { DeviceN~color~spaces~require~an~alternative~space. } + { + LaTeX~has~been~asked~to~create~a~DeviceN~color~space~'#1',~ + but~the~constituent~colors~do~not~all~have~a~device-based~alternative. + } +\__kernel_msg_new:nnnn { color } { DeviceN-requires-names } + { DeviceN~color~space~'#1'~require~a~list~of~names. } + { + LaTeX~has~been~asked~to~create~a~DeviceN~color~space,~ + but~no~\\ \\ + \iow_indent:n { names~=~<names> } + \\ \\ + key~was~given~with~the~correct~information. + } \__kernel_msg_new:nnnn { color } { model-already-defined } { Color~model~'#1'~already~defined. } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3draw/l3draw.sty b/Master/texmf-dist/tex/latex/l3experimental/l3draw/l3draw.sty index 292d4fe6f35..cb5bc61d7cf 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3draw/l3draw.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3draw/l3draw.sty @@ -28,7 +28,7 @@ %% %% File: l3draw.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3draw}{2020-09-11}{} +\ProvidesExplPackage{l3draw}{2020-09-24}{} {L3 Experimental core drawing support} \RequirePackage { l3color } \scan_new:N \s__draw_mark diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3graphics/l3graphics.sty b/Master/texmf-dist/tex/latex/l3experimental/l3graphics/l3graphics.sty index 797321a00dc..7a4f5a08c31 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3graphics/l3graphics.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3graphics/l3graphics.sty @@ -20,7 +20,7 @@ %% %% File: l3graphics.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3graphics}{2020-09-11}{} +\ProvidesExplPackage{l3graphics}{2020-09-24}{} {L3 Experimental graphics inclusion support} \ior_new:N \l__graphics_tmp_ior \tl_new:N \l__graphics_tmp_tl diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3pdf/l3pdf.sty b/Master/texmf-dist/tex/latex/l3experimental/l3pdf/l3pdf.sty index 018102c7a98..28d449e24c3 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3pdf/l3pdf.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3pdf/l3pdf.sty @@ -20,7 +20,7 @@ %% %% File: l3pdf.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3pdf}{2020-09-11}{} +\ProvidesExplPackage{l3pdf}{2020-09-24}{} {L3 Experimental core PDF support} \scan_new:N \s__pdf_stop \bool_new:N \g__pdf_init_bool diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index bee09eb299b..78c53b18789 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -20,7 +20,7 @@ %% %% File: l3str-format.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3str-format}{2020-09-11}{} +\ProvidesExplPackage{l3str-format}{2020-09-24}{} {L3 Experimental string formatting} \cs_generate_variant:Nn \use:nn { nf } \cs_generate_variant:Nn \use:nnn { fnf } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3sys-shell/l3sys-shell.sty b/Master/texmf-dist/tex/latex/l3experimental/l3sys-shell/l3sys-shell.sty index 97e8ba69c8f..016256ce53e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3sys-shell/l3sys-shell.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3sys-shell/l3sys-shell.sty @@ -20,7 +20,7 @@ %% %% File: l3sys-shell.dtx \RequirePackage{expl3} -\ProvidesExplPackage{l3sys-shell}{2020-09-11}{} +\ProvidesExplPackage{l3sys-shell}{2020-09-24}{} {L3 Experimental system shell functions} \scan_new:N \s__sys_stop \quark_new:N \q__sys_nil diff --git a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty index f745fb21f8f..3f0b8650e6e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xcoffins/xcoffins.sty @@ -20,7 +20,7 @@ %% %% File: xcoffins.dtx \RequirePackage{xparse} -\ProvidesExplPackage{xcoffins}{2020-09-11}{} +\ProvidesExplPackage{xcoffins}{2020-09-24}{} {L3 Experimental design level coffins} \keys_define:nn { coffin } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index 9e66d0a8cd1..9c939bef3d5 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -32,7 +32,7 @@ }% \endinput } -\ProvidesExplPackage{l3galley}{2020-09-11}{} +\ProvidesExplPackage{l3galley}{2020-09-24}{} {L3 Experimental galley code} \int_new:N \l__galley_tmp_int \seq_new:N \g__galley_tmpa_seq diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty index 5a074a0d7ac..2dd1b612023 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty @@ -20,7 +20,7 @@ %% %% File: xgalley.dtx \RequirePackage{xparse} -\ProvidesExplPackage{xgalley}{2020-09-11}{} +\ProvidesExplPackage{xgalley}{2020-09-24}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} \clist_new:N \l__galley_tmpa_clist diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index 9553268383f..7807eb086be 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -6,7 +6,7 @@ %% %% expl3.dtx (with options: `package') %% l3bootstrap.dtx (with options: `package') -%% l3names.dtx (with options: `package') +%% l3names.dtx (with options: `package,tex') %% l3basics.dtx (with options: `package') %% l3expan.dtx (with options: `package') %% l3quark.dtx (with options: `package') @@ -16,9 +16,9 @@ %% l3int.dtx (with options: `package') %% l3flag.dtx (with options: `package') %% l3prg.dtx (with options: `package') -%% l3sys.dtx (with options: `package') +%% l3sys.dtx (with options: `package,tex') %% l3clist.dtx (with options: `package') -%% l3token.dtx (with options: `package') +%% l3token.dtx (with options: `package,tex') %% l3prop.dtx (with options: `package') %% l3msg.dtx (with options: `package') %% l3file.dtx (with options: `package') @@ -69,7 +69,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx -\def\ExplFileDate{2020-09-06}% +\def\ExplFileDate{2020-09-24}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -151,12 +151,16 @@ \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname directlua\endcsname\relax \else - \ifnum\luatexversion<95 % + \ifnum\luatexversion<110 % \else \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname newcatcodetable\endcsname\relax \input{ltluatex}% \fi + \begingroup\edef\ignored{% + \expandafter\noexpand\csname prg_return_true:\endcsname + \expandafter\noexpand\csname prg_return_false:\endcsname + }\endgroup \directlua{require("expl3")}% \ifnum 0% \directlua{ @@ -182,7 +186,7 @@ These are available in the engines\LineBreak - pdfTeX v1.40\LineBreak - XeTeX v0.99992\LineBreak - - LuaTeX v0.95\LineBreak + - LuaTeX v1.10\LineBreak - e-(u)pTeX mid-2012\LineBreak or later.\LineBreak \LineBreak @@ -205,7 +209,7 @@ \fi \expandafter\ifx\csname directlua\endcsname\relax \else - \ifnum\luatexversion<76 \else 1\fi + \ifnum\luatexversion<110 \else 1\fi \fi =0 % \newlinechar`\^^J % @@ -775,9 +779,6 @@ \__kernel_primitive:NN \pdfeachlinedepth \tex_eachlinedepth:D \__kernel_primitive:NN \pdfeachlineheight \tex_eachlineheight:D \__kernel_primitive:NN \pdfelapsedtime \tex_elapsedtime:D - \__kernel_primitive:NN \pdffiledump \tex_filedump:D - \__kernel_primitive:NN \pdffilemoddate \tex_filemoddate:D - \__kernel_primitive:NN \pdffilesize \tex_filesize:D \__kernel_primitive:NN \pdffirstlineheight \tex_firstlineheight:D \__kernel_primitive:NN \pdffontexpand \tex_fontexpand:D \__kernel_primitive:NN \pdffontsize \tex_fontsize:D @@ -788,7 +789,6 @@ \__kernel_primitive:NN \pdflastypos \tex_lastypos:D \__kernel_primitive:NN \pdfmapfile \tex_mapfile:D \__kernel_primitive:NN \pdfmapline \tex_mapline:D - \__kernel_primitive:NN \pdfmdfivesum \tex_mdfivesum:D \__kernel_primitive:NN \pdfnoligatures \tex_noligatures:D \__kernel_primitive:NN \pdfnormaldeviate \tex_normaldeviate:D \__kernel_primitive:NN \pdfpageheight \tex_pageheight:D @@ -801,7 +801,6 @@ \__kernel_primitive:NN \pdfrandomseed \tex_randomseed:D \__kernel_primitive:NN \pdfresettimer \tex_resettimer:D \__kernel_primitive:NN \pdfsavepos \tex_savepos:D - \__kernel_primitive:NN \pdfstrcmp \tex_strcmp:D \__kernel_primitive:NN \pdfsetrandomseed \tex_setrandomseed:D \__kernel_primitive:NN \pdfshellescape \tex_shellescape:D \__kernel_primitive:NN \pdftracingfonts \tex_tracingfonts:D @@ -828,6 +827,11 @@ \tex_fi:D \use_none:n { \tex_global:D \tex_let:D #2 #1 } } + \__kernel_primitive:NN \pdfstrcmp \tex_strcmp:D + \__kernel_primitive:NN \pdffilesize \tex_filesize:D + \__kernel_primitive:NN \pdfmdfivesum \tex_mdfivesum:D + \__kernel_primitive:NN \pdffilemoddate \tex_filemoddate:D + \__kernel_primitive:NN \pdffiledump \tex_filedump:D \__kernel_primitive:NN \suppressfontnotfounderror \tex_suppressfontnotfounderror:D \__kernel_primitive:NN \XeTeXcharclass \tex_XeTeXcharclass:D @@ -4772,28 +4776,7 @@ { p , T , F , TF } \prg_new_eq_conditional:NNn \str_if_empty:c \tl_if_empty:c { p , T , F , TF } -\cs_new:Npn \__str_if_eq:nn #1#2 { \tex_strcmp:D {#1} {#2} } -\cs_if_exist:NT \tex_luatexversion:D - { - \cs_set_eq:NN \lua_escape:e \tex_luaescapestring:D - \cs_set_eq:NN \lua_now:e \tex_directlua:D - \cs_set:Npn \__str_if_eq:nn #1#2 - { - \lua_now:e - { - l3kernel.strcmp - ( - " \__str_escape:n {#1} " , - " \__str_escape:n {#2} " - ) - } - } - \cs_new:Npn \__str_escape:n #1 - { - \lua_escape:e - { \__kernel_tl_to_str:w \use:e { {#1} } } - } - } +\cs_new_eq:NN \__str_if_eq:nn \tex_strcmp:D \prg_new_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF } { \if_int_compare:w @@ -7173,23 +7156,26 @@ \__sys_const:nn { sys_if_engine_ #1 } { \str_if_eq_p:Vn \c_sys_engine_str {#1} } } -\str_const:Nx \c_sys_engine_exec_str - { - \sys_if_engine_pdftex:T { pdf } - \sys_if_engine_xetex:T { xe } - \sys_if_engine_ptex:T { ep } - \sys_if_engine_uptex:T { eup } - \sys_if_engine_luatex:T - { - lua \lua_now:e - { - if (pcall(require, 'luaharfbuzz')) then ~ - tex.print("hb") ~ - end - } - } - tex - } +\group_begin: + \cs_set_eq:NN \lua_now:e \tex_directlua:D + \str_const:Nx \c_sys_engine_exec_str + { + \sys_if_engine_pdftex:T { pdf } + \sys_if_engine_xetex:T { xe } + \sys_if_engine_ptex:T { ep } + \sys_if_engine_uptex:T { eup } + \sys_if_engine_luatex:T + { + lua \lua_now:e + { + if (pcall(require, 'luaharfbuzz')) then ~ + tex.print("hb") ~ + end + } + } + tex + } +\group_end: \str_const:Nx \c_sys_engine_format_str { \cs_if_exist:NTF \fmtname @@ -7355,10 +7341,7 @@ \sys_if_engine_luatex:TF { \cs_new_protected:Npn \sys_shell_now:n #1 - { - \lua_now:e - { l3kernel.shellescape(" \lua_escape:e { \tl_to_str:n {#1} } ") } - } + { \__sys_shell_now:e { \exp_not:n {#1} } } } { \cs_new_protected:Npn \sys_shell_now:n #1 @@ -7368,10 +7351,7 @@ \sys_if_engine_luatex:TF { \cs_new_protected:Npn \sys_shell_shipout:n #1 - { - \lua_shipout_e:n - { l3kernel.shellescape(" \lua_escape:e { \tl_to_str:n {#1} } ") } - } + { \__sys_shell_shipout:e { \exp_not:n {#1} } } } { \cs_new_protected:Npn \sys_shell_shipout:n #1 @@ -8300,37 +8280,26 @@ \if_int_odd:w 0 \sys_if_engine_luatex:T { 1 } \sys_if_engine_xetex:T { 1 } \exp_stop_f: - \sys_if_engine_luatex:TF - { - \cs_new:Npn \__char_generate_aux:nnw #1#2#3 \exp_end: - { - #3 - \exp_after:wN \exp_after:wN \exp_after:wN \exp_end: - \lua_now:e { l3kernel.charcat(#1, #2) } - } - } - { - \cs_new:Npn \__char_generate_aux:nnw #1#2#3 \exp_end: - { - #3 - \exp_after:wN \exp_end: - \tex_Ucharcat:D #1 \exp_stop_f: #2 \exp_stop_f: - } - \cs_if_exist:NF \tex_expanded:D - { - \cs_new_eq:NN \__char_generate_auxii:nnw \__char_generate_aux:nnw - \cs_gset:Npn \__char_generate_aux:nnw #1#2#3 \exp_end: - { - #3 - \if_int_compare:w #2 = 13 \exp_stop_f: - \__kernel_msg_expandable_error:nn { kernel } { char-active } - \else: - \__char_generate_auxii:nnw {#1} {#2} - \fi: - \exp_end: - } - } - } + \cs_new:Npn \__char_generate_aux:nnw #1#2#3 \exp_end: + { + #3 + \exp_after:wN \exp_end: + \tex_Ucharcat:D #1 \exp_stop_f: #2 \exp_stop_f: + } + \cs_if_exist:NF \tex_expanded:D + { + \cs_new_eq:NN \__char_generate_auxii:nnw \__char_generate_aux:nnw + \cs_gset:Npn \__char_generate_aux:nnw #1#2#3 \exp_end: + { + #3 + \if_int_compare:w #2 = 13 \exp_stop_f: + \__kernel_msg_expandable_error:nn { kernel } { char-active } + \else: + \__char_generate_auxii:nnw {#1} {#2} + \fi: + \exp_end: + } + } \else: \tl_set:Nn \l__char_tmp_tl { \exp_not:N \or: } \char_set_catcode_group_begin:n { 0 } % { @@ -8809,66 +8778,75 @@ \__token_tmp:w { skip_register } { skip } { \token_to_str:N \skip } \__token_tmp:w { toks_register } { toks } { \token_to_str:N \toks } \group_end: -\tex_chardef:D \c__token_A_int = `A ~ % -\use:x +\sys_if_engine_luatex:TF { - \prg_new_conditional:Npnn \exp_not:N \token_if_primitive:N ##1 - { p , T , F , TF } + \prg_new_conditional:Npnn \token_if_primitive:N #1 { p , T , F , TF } { - \exp_not:N \token_if_macro:NTF ##1 - \exp_not:N \prg_return_false: - { - \exp_not:N \exp_after:wN \exp_not:N \__token_if_primitive:NNw - \exp_not:N \token_to_meaning:N ##1 - \tl_to_str:n { : : : } \s__token_stop ##1 - } + \__token_if_primitive_lua:N #1 } - \cs_new:Npn \exp_not:N \__token_if_primitive:NNw - ##1##2 ##3 \c_colon_str ##4 \s__token_stop + } + { + \tex_chardef:D \c__token_A_int = `A ~ % + \use:x { - \exp_not:N \tl_if_empty:oTF - { \exp_not:N \__token_if_primitive_space:w ##3 ~ } + \prg_new_conditional:Npnn \exp_not:N \token_if_primitive:N ##1 + { p , T , F , TF } + { + \exp_not:N \token_if_macro:NTF ##1 + \exp_not:N \prg_return_false: + { + \exp_not:N \exp_after:wN \exp_not:N \__token_if_primitive:NNw + \exp_not:N \token_to_meaning:N ##1 + \tl_to_str:n { : : : } \s__token_stop ##1 + } + } + \cs_new:Npn \exp_not:N \__token_if_primitive:NNw + ##1##2 ##3 \c_colon_str ##4 \s__token_stop { - \exp_not:N \__token_if_primitive_loop:N ##3 - \c_colon_str \s__token_stop + \exp_not:N \tl_if_empty:oTF + { \exp_not:N \__token_if_primitive_space:w ##3 ~ } + { + \exp_not:N \__token_if_primitive_loop:N ##3 + \c_colon_str \s__token_stop + } + { \exp_not:N \__token_if_primitive_nullfont:N } } - { \exp_not:N \__token_if_primitive_nullfont:N } } - } -\cs_new:Npn \__token_if_primitive_space:w #1 ~ { } -\cs_new:Npn \__token_if_primitive_nullfont:N #1 - { - \if_meaning:w \tex_nullfont:D #1 - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new:Npn \__token_if_primitive_loop:N #1 - { - \if_int_compare:w `#1 < \c__token_A_int % - \exp_after:wN \__token_if_primitive:Nw - \exp_after:wN #1 - \else: - \exp_after:wN \__token_if_primitive_loop:N - \fi: - } -\cs_new:Npn \__token_if_primitive:Nw #1 #2 \s__token_stop - { - \if:w : #1 - \exp_after:wN \__token_if_primitive_undefined:N - \else: - \prg_return_false: - \exp_after:wN \use_none:n - \fi: - } -\cs_new:Npn \__token_if_primitive_undefined:N #1 - { - \if_cs_exist:N #1 - \prg_return_true: - \else: - \prg_return_false: - \fi: + \cs_new:Npn \__token_if_primitive_space:w #1 ~ { } + \cs_new:Npn \__token_if_primitive_nullfont:N #1 + { + \if_meaning:w \tex_nullfont:D #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + \cs_new:Npn \__token_if_primitive_loop:N #1 + { + \if_int_compare:w `#1 < \c__token_A_int % + \exp_after:wN \__token_if_primitive:Nw + \exp_after:wN #1 + \else: + \exp_after:wN \__token_if_primitive_loop:N + \fi: + } + \cs_new:Npn \__token_if_primitive:Nw #1 #2 \s__token_stop + { + \if:w : #1 + \exp_after:wN \__token_if_primitive_undefined:N + \else: + \prg_return_false: + \exp_after:wN \use_none:n + \fi: + } + \cs_new:Npn \__token_if_primitive_undefined:N #1 + { + \if_cs_exist:N #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } } \cs_new_eq:NN \l_peek_token ? \cs_new_eq:NN \g_peek_token ? @@ -11198,14 +11176,6 @@ \tl_set:No #1 {#2} } \cs_new_eq:NN \__file_size:n \tex_filesize:D -\sys_if_engine_luatex:T - { - \cs_gset:Npn \__file_size:n #1 - { - \lua_now:e - { l3kernel.filesize ( " \lua_escape:e {#1} " ) } - } - } \cs_new:Npn \file_full_name:n #1 { \exp_args:Ne \__file_full_name:n @@ -11275,9 +11245,7 @@ {#1} } } -\bool_lazy_or:nnF - { \cs_if_exist_p:N \tex_filesize:D } - { \sys_if_engine_luatex_p: } +\cs_if_exist:NF \tex_filesize:D { \cs_gset:Npn \file_full_name:n #1 { @@ -11309,9 +11277,7 @@ \cs_generate_variant:Nn \file_get_full_name:nNT { V } \cs_generate_variant:Nn \file_get_full_name:nNF { V } \cs_generate_variant:Nn \file_get_full_name:nNTF { V } -\bool_lazy_or:nnF - { \cs_if_exist_p:N \tex_filesize:D } - { \sys_if_engine_luatex_p: } +\cs_if_exist:NF \tex_filesize:D { \prg_set_protected_conditional:Npnn \file_get_full_name:nN #1#2 { T , F , TF } { @@ -11356,8 +11322,6 @@ \ior_if_eof:NF \g__file_internal_ior { #2 { \prg_break: } } } \ior_new:N \g__file_internal_ior -\cs_new:Npn \file_mdfive_hash:n #1 - { \__file_details:nn {#1} { mdfivesum } } \cs_new:Npn \file_size:n #1 { \__file_details:nn {#1} { size } } \cs_new:Npn \file_timestamp:n #1 @@ -11372,20 +11336,10 @@ \tl_if_blank:nF {#1} { \use:c { tex_file #2 :D } {#1} } } -\sys_if_engine_luatex:TF - { - \cs_gset:Npn \__file_details_aux:nn #1#2 - { - \lua_now:e - { l3kernel.file#2 ( " \lua_escape:e { #1 } " ) } - } - } - { - \cs_gset:Npn \file_mdfive_hash:n #1 - { \exp_args:Ne \__file_mdfive_hash:n { \file_full_name:n {#1} } } - \cs_new:Npn \__file_mdfive_hash:n #1 - { \tex_mdfivesum:D file {#1} } - } +\cs_new:Npn \file_mdfive_hash:n #1 + { \exp_args:Ne \__file_mdfive_hash:n { \file_full_name:n {#1} } } +\cs_new:Npn \__file_mdfive_hash:n #1 + { \tex_mdfivesum:D file {#1} } \cs_new:Npn \file_hex_dump:nnn #1#2#3 { \exp_args:Neee \__file_hex_dump_auxi:nnn @@ -11434,34 +11388,21 @@ length ~ \int_eval:n { #1 - #2 + 1 } {#3} } -\sys_if_engine_luatex:T - { - \cs_gset:Npn \__file_hex_dump_auxiv:nnn #1#2#3 - { - \lua_now:e - { - l3kernel.filedump - ( - " \lua_escape:e {#3} " , - \int_eval:n { #2 - 1 } , - \int_eval:n { #1 - #2 + 1 } - ) - } - } - } \cs_new:Npn \file_hex_dump:n #1 { \exp_args:Ne \__file_hex_dump:n { \file_full_name:n {#1} } } -\cs_new:Npn \__file_hex_dump:n #1 +\sys_if_engine_luatex:TF { - \tl_if_blank:nF {#1} - { \tex_filedump:D length \tex_filesize:D {#1} {#1} } + \cs_new:Npn \__file_hex_dump:n #1 + { + \tl_if_blank:nF {#1} + { \tex_filedump:D whole {#1} {#1} } + } } -\sys_if_engine_luatex:T { - \cs_gset:Npn \__file_hex_dump:n #1 + \cs_new:Npn \__file_hex_dump:n #1 { - \lua_now:e - { l3kernel.filedump ( " \lua_escape:e { #1 } " ) } + \tl_if_blank:nF {#1} + { \tex_filedump:D length \tex_filesize:D {#1} {#1} } } } \cs_new_protected:Npn \file_get_hex_dump:nN #1#2 @@ -11488,9 +11429,7 @@ { \prg_return_false: } { \prg_return_true: } } -\bool_lazy_or:nnF - { \cs_if_exist_p:N \tex_filesize:D } - { \sys_if_engine_luatex_p: } +\cs_if_exist:NF \tex_filesize:D { \cs_set_protected:Npn \__file_get_details:nnN #1#2#3 { @@ -11524,26 +11463,7 @@ { \prg_return_false: } { \prg_return_true: } } -\cs_new:Npn \__file_str_cmp:nn #1#2 { \tex_strcmp:D {#1} {#2} } -\sys_if_engine_luatex:T - { - \cs_set:Npn \__file_str_cmp:nn #1#2 - { - \lua_now:e - { - l3kernel.strcmp - ( - " \__file_str_escape:n {#1}", - " \__file_str_escape:n {#2}" - ) - } - } - \cs_new:Npn \__file_str_escape:n #1 - { - \lua_escape:e - { \__kernel_tl_to_str:w \use:e { {#1} } } - } - } +\cs_new_eq:NN \__file_str_cmp:nn \tex_strcmp:D \prg_new_conditional:Npnn \file_compare_timestamp:nNn #1#2#3 { p , T , F , TF } { @@ -11584,15 +11504,7 @@ } } } -\sys_if_engine_luatex:TF - { - \cs_new:Npn \__file_timestamp:n #1 - { - \lua_now:e - { l3kernel.filemoddate ( " \lua_escape:e {#1} " ) } - } - } - { \cs_new_eq:NN \__file_timestamp:n \tex_filemoddate:D } +\cs_new_eq:NN \__file_timestamp:n \tex_filemoddate:D \cs_if_exist:NF \__file_timestamp:n { \prg_set_conditional:Npnn \file_compare_timestamp:nNn #1#2#3 @@ -14272,21 +14184,7 @@ \exp_after:wN \use_ii:nn \fi: } -\sys_if_engine_luatex:TF - { - \cs_new:Npn \__fp_str_if_eq:nn #1#2 - { - \tex_directlua:D - { - l3kernel.strcmp - ( - " \tex_luaescapestring:D {#1}", - " \tex_luaescapestring:D {#2}" - ) - } - } - } - { \cs_new_eq:NN \__fp_str_if_eq:nn \tex_strcmp:D } +\cs_new_eq:NN \__fp_str_if_eq:nn \tex_strcmp:D \cs_new:Npn \__fp_func_to_name:N #1 { \exp_last_unbraced:Nf @@ -28008,22 +27906,9 @@ { \exp_not:N \tex_unexpanded:D \exp_not:N \exp_after:wN { - \sys_if_engine_luatex:TF - { - \exp_not:N \tex_directlua:D - { - l3kernel.charcat - ( - \exp_not:N \tex_number:D #1 , - \exp_not:N \tex_the:D \tex_catcode:D #1 - ) - } - } - { - \exp_not:N \tex_Ucharcat:D - #1 ~ - \tex_catcode:D #1 ~ - } + \exp_not:N \tex_Ucharcat:D + #1 ~ + \tex_catcode:D #1 ~ } } \ior_open:Nn \g__char_data_ior { UnicodeData.txt } diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex index d9dee0de3ca..9b4cd0935d0 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx -\def\ExplFileDate{2020-09-06}% +\def\ExplFileDate{2020-09-24}% \let\ExplLoaderFileDate\ExplFileDate \begingroup \catcode`\>=12 diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.ltx b/Master/texmf-dist/tex/latex/l3kernel/expl3.ltx index eec1f2b6611..558342f78c2 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.ltx +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.ltx @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx -\def\ExplFileDate{2020-09-06}% +\def\ExplFileDate{2020-09-24}% \let\ExplLoaderFileDate\ExplFileDate \begingroup \catcode`\>=12 diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua index a0788cdfc7f..a60086c340f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua @@ -5,6 +5,9 @@ -- The original source files were: -- -- l3luatex.dtx (with options: `package,lua') +-- l3names.dtx (with options: `package,lua') +-- l3sys.dtx (with options: `package,lua') +-- l3token.dtx (with options: `package,lua') -- -- Copyright (C) 1990-2020 The LaTeX3 Project -- @@ -20,6 +23,10 @@ -- -- File: l3luatex.dtx l3kernel = l3kernel or { } +local l3kernel = l3kernel +ltx = ltx or {utils={}} +ltx.utils = ltx.utils or { } +local ltxutils = ltx.utils local io = io local kpse = kpse local lfs = lfs @@ -30,37 +37,47 @@ local string = string local tex = tex local texio = texio local tonumber = tonumber -local unicode = unicode local abs = math.abs local byte = string.byte local floor = math.floor local format = string.format local gsub = string.gsub local lfs_attr = lfs.attributes -local md5_sum = md5.sum local open = io.open -local os_clock = os.clock local os_date = os.date -local os_exec = os.execute local setcatcode = tex.setcatcode local sprint = tex.sprint local cprint = tex.cprint local write = tex.write local write_nl = texio.write_nl -local utf8_char = (utf8 and utf8.char) or (utf and utf.char) or unicode.utf8.char +local utf8_char = utf8.char + +local scan_int = token.scan_int or token.scan_integer +local scan_string = token.scan_string +local scan_keyword = token.scan_keyword +local put_next = token.put_next + +local true_tok = token.create'prg_return_true:' +local false_tok = token.create'prg_return_false:' +local function deprecated(table, name, func) + table[name] = function(...) + write_nl(format("Calling deprecated Lua function %s", name)) + table[name] = func + return func(...) + end +end local kpse_find = (resolvers and resolvers.findfile) or kpse.find_file local function escapehex(str) - write((gsub(str, ".", - function (ch) return format("%02X", byte(ch)) end))) + return (gsub(str, ".", + function (ch) return format("%02X", byte(ch)) end)) end -local charcat -function charcat(charcode, catcode) +deprecated(l3kernel, 'charcat', function(charcode, catcode) cprint(catcode, utf8_char(charcode)) -end -l3kernel.charcat = charcat -local base_time = 0 +end) +local os_clock = os.clock +local base_clock_time = 0 local function elapsedtime() - local val = (os_clock() - base_time) * 65536 + 0.5 + local val = (os_clock() - base_clock_time) * 65536 + 0.5 if val > 2147483647 then val = 2147483647 end @@ -68,94 +85,127 @@ local function elapsedtime() end l3kernel.elapsedtime = elapsedtime local function resettimer() - base_time = os_clock() + base_clock_time = os_clock() end l3kernel.resettimer = resettimer local function filedump(name,offset,length) local file = kpse_find(name,"tex",true) - if file then - local length = tonumber(length) or lfs_attr(file,"size") - local offset = tonumber(offset) or 0 - local f = open(file,"rb") - if f then - if offset > 0 then - f:seek("set",offset) - end - local data = f:read(length) - escapehex(data) - f:close() - end + if not file then return end + local f = open(file,"rb") + if not f then return end + if offset and offset > 0 then + f:seek("set", offset) end + local data = f:read(length or 'a') + f:close() + return escapehex(data) end -l3kernel.filedump = filedump -local function filemdfivesum(name) - local file = kpse_find(name, "tex", true) - if file then - local f = open(file, "rb") - if f then - local data = f:read("*a") - escapehex(md5_sum(data)) - f:close() - end +ltxutils.filedump = filedump +deprecated(l3kernel, "filedump", function(name, offset, length) + local dump = filedump(name, tonumber(offset), tonumber(length)) + if dump then + write(dump) + end +end) +local md5_HEX = md5.HEX +if not md5_HEX then + local md5_sum = md5.sum + function md5_HEX(data) + return escapehex(md5_sum(data)) end + md5.HEX = md5_HEX end -l3kernel.filemdfivesum = filemdfivesum -local function filemoddate(name) - local file = kpse_find(name, "tex", true) - if file then +local function filemd5sum(name) + local file = kpse_find(name, "tex", true) if not file then return end + local f = open(file, "rb") if not f then return end + + local data = f:read("*a") + f:close() + return md5_HEX(data) +end +ltxutils.filemd5sum = filemd5sum +deprecated(l3kernel, "filemdfivesum", function(name) + local hash = filemd5sum(name) + if hash then + write(hash) + end +end) +local filemoddate +if os_date'%z':match'^[+-]%d%d%d%d$' then + local pattern = lpeg.Cs(16 * + (lpeg.Cg(lpeg.S'+-' * '0000' * lpeg.Cc'Z') + + 3 * lpeg.Cc"'" * 2 * lpeg.Cc"'" + + lpeg.Cc'Z') + * -1) + function filemoddate(name) + local file = kpse_find(name, "tex", true) + if not file then return end local date = lfs_attr(file, "modification") - if date then - local d = os_date("*t", date) - if d.sec >= 60 then - d.sec = 59 + if not date then return end + return pattern:match(os_date("D:%Y%m%d%H%M%S%z", date)) + end +else + local function filemoddate(name) + local file = kpse_find(name, "tex", true) + if not file then return end + local date = lfs_attr(file, "modification") + if not date then return end + local d = os_date("*t", date) + local u = os_date("!*t", date) + local off = 60 * (d.hour - u.hour) + d.min - u.min + if d.year ~= u.year then + if d.year > u.year then + off = off + 1440 + else + off = off - 1440 end - local u = os_date("!*t", date) - local off = 60 * (d.hour - u.hour) + d.min - u.min - if d.year ~= u.year then - if d.year > u.year then - off = off + 1440 - else - off = off - 1440 - end - elseif d.yday ~= u.yday then - if d.yday > u.yday then - off = off + 1440 - else - off = off - 1440 - end + elseif d.yday ~= u.yday then + if d.yday > u.yday then + off = off + 1440 + else + off = off - 1440 end - local timezone - if off == 0 then - timezone = "Z" + end + local timezone + if off == 0 then + timezone = "Z" + else + if off < 0 then + timezone = "-" + off = -off else - local hours = floor(off / 60) - local mins = abs(off - hours * 60) - timezone = format("%+03d", hours) - .. "'" .. format("%02d", mins) .. "'" + timezone = "+" end - write("D:" - .. format("%04d", d.year) - .. format("%02d", d.month) - .. format("%02d", d.day) - .. format("%02d", d.hour) - .. format("%02d", d.min) - .. format("%02d", d.sec) - .. timezone) + timezone = format("%s%02d'%02d'", timezone, hours // 60, hours % 60) end + return format("D:%04d%02d%02d%02d%02d%02d%s", + d.year, d.month, d.day, d.hour, d.min, d.sec, timezone) end end -l3kernel.filemoddate = filemoddate +ltxutils.filemoddate = filemoddate +deprecated(l3kernel, "filemoddate", function(name) + local hash = filemoddate(name) + if hash then + write(hash) + end +end) local function filesize(name) - local file = kpse_find(name, "tex", true) + local file = kpse_find(name, "tex", true) if file then local size = lfs_attr(file, "size") if size then - write(size) + return size end end end -l3kernel.filesize = filesize -local function strcmp(A, B) +ltxutils.filesize = filesize +deprecated(l3kernel, "filesize", function(name) + local size = filesize(name) + if size then + write(size) + end +end) +deprecated(l3kernel, "strcmp", function (A, B) if A == B then write("0") elseif A < B then @@ -163,9 +213,9 @@ local function strcmp(A, B) else write("1") end -end -l3kernel.strcmp = strcmp -local function shellescape(cmd) +end) +local os_exec = os.execute +deprecated(l3kernel, "shellescape", function(cmd) local status,msg = os_exec(cmd) if status == nil then write_nl("log","runsystem(" .. cmd .. ")...(" .. msg .. ")\n") @@ -174,5 +224,163 @@ local function shellescape(cmd) else write_nl("log","runsystem(" .. cmd .. ")...failed " .. (msg or "") .. "\n") end +end) +local luacmd do + local token_create = token.create + local set_lua = token.set_lua + local undefined_cs = token.command_id'undefined_cs' + + if not context and not luatexbase then require'ltluatex' end + if luatexbase then + local new_luafunction = luatexbase.new_luafunction + local functions = lua.get_functions_table() + function luacmd(name, func, ...) + local id + local tok = token_create(name) + if tok.command == undefined_cs then + id = new_luafunction(name) + set_lua(name, id, ...) + else + id = tok.index or tok.mode + end + functions[id] = func + end + elseif context then + local register = context.functions.register + local functions = context.functions.known + function luacmd(name, func, ...) + local tok = token.create(name) + if tok.command == undefined_cs then + token.set_lua(name, register(func), ...) + else + functions[tok.index or tok.mode] = func + end + end + end +end +-- File: l3names.dtx +luacmd('tex_strcmp:D', function() + local first = scan_string() + local second = scan_string() + write(first == second and '0' + or first < second and '-1' + or '1') +end, 'global') +local cprint = tex.cprint +luacmd('tex_Ucharcat:D', function() + local charcode = scan_int() + local catcode = scan_int() + cprint(catcode, utf8_char(charcode)) +end, 'global') +luacmd('tex_filesize:D', function() + local size = filesize(scan_string()) + if size then write(size) end +end, 'global') +luacmd('tex_mdfivesum:D', function() + local hash + if scan_keyword"file" then + hash = filemd5sum(scan_string()) + else + hash = md5_HEX(scan_string()) + end + if hash then write(hash) end +end, 'global') +luacmd('tex_filemoddate:D', function() + local date = filemoddate(scan_string()) + if date then write(date) end +end, 'global') +luacmd('tex_filedump:D', function() + local offset = scan_keyword'offset' and scan_int() or nil + local length = scan_keyword'length' and scan_int() + or not scan_keyword'whole' and 0 or nil + local data = filedump(scan_string(), offset, length) + if data then write(data) end +end, 'global') +-- File: l3sys.dtx +do + local os_exec = os.execute + + local function shellescape(cmd) + local status,msg = os_exec(cmd) + if status == nil then + write_nl("log","runsystem(" .. cmd .. ")...(" .. msg .. ")\n") + elseif status == 0 then + write_nl("log","runsystem(" .. cmd .. ")...executed\n") + else + write_nl("log","runsystem(" .. cmd .. ")...failed " .. (msg or "") .. "\n") + end + end + luacmd("__sys_shell_now:e", function() + shellescape(scan_string()) + end, "global", "protected") + local whatsit_id = node.id'whatsit' + local latelua_sub = node.subtype'late_lua' + local node_new = node.direct.new + local setfield = node.direct.setwhatsitfield or node.direct.setfield + local node_write = node.direct.write + + luacmd("__sys_shell_shipout:e", function() + local cmd = scan_string() + local n = node_new(whatsit_id, latelua_sub) + setfield(n, 'data', function() shellescape(cmd) end) + node_write(n) + end, "global", "protected") +end +-- File: l3token.dtx +do + local get_next = token.get_next + local get_command = token.get_command + local get_index = token.get_index + local get_mode = token.get_mode or token.get_index + local cmd = token.command_id + local set_font = cmd'get_font' + local biggest_char = token.biggest_char() + + local mode_below_biggest_char = {} + local index_not_nil = {} + local mode_not_null = {} + local non_primitive = { + [cmd'left_brace'] = true, + [cmd'right_brace'] = true, + [cmd'math_shift'] = true, + [cmd'mac_param'] = mode_below_biggest_char, + [cmd'sup_mark'] = true, + [cmd'sub_mark'] = true, + [cmd'endv'] = true, + [cmd'spacer'] = true, + [cmd'letter'] = true, + [cmd'other_char'] = true, + [cmd'tab_mark'] = mode_below_biggest_char, + [cmd'char_given'] = true, + [cmd'math_given'] = true, + [cmd'xmath_given'] = true, + [cmd'set_font'] = mode_not_null, + [cmd'undefined_cs'] = true, + [cmd'call'] = true, + [cmd'long_call'] = true, + [cmd'outer_call'] = true, + [cmd'long_outer_call'] = true, + [cmd'assign_glue'] = index_not_nil, + [cmd'assign_mu_glue'] = index_not_nil, + [cmd'assign_toks'] = index_not_nil, + [cmd'assign_int'] = index_not_nil, + [cmd'assign_attr'] = true, + [cmd'assign_dimen'] = index_not_nil, + } + + luacmd("__token_if_primitive_lua:N", function() + local tok = get_next() + local is_non_primitive = non_primitive[get_command(tok)] + return put_next( + is_non_primitive == true + and false_tok + or is_non_primitive == nil + and true_tok + or is_non_primitive == mode_not_null + and (get_mode(tok) == 0 and true_tok or false_tok) + or is_non_primitive == index_not_nil + and (get_index(tok) and false_tok or true_tok) + or is_non_primitive == mode_below_biggest_char + and (get_mode(tok) > biggest_char and true_tok or false_tok)) + end, "global") end -l3kernel.shellescape = shellescape diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index a46667be426..d9cb4aa5ce4 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: expl3.dtx -\def\ExplFileDate{2020-09-06}% +\def\ExplFileDate{2020-09-24}% \let\ExplLoaderFileDate\ExplFileDate \ProvidesPackage{expl3} [% |