diff --git a/build.lua b/build.lua index 7519275..448c2a0 100644 --- a/build.lua +++ b/build.lua @@ -4,6 +4,7 @@ bundle = "" maindir = "." os.setenv("guess_input_kanji_encoding", "0") +os.setenv("PTEX_KANJI_ENC", "utf8") checkengines = {"ptex-euc","ptex-sjis","uptex","uptex-euc","uptex-sjis"} stdengine = "ptex-euc" @@ -49,6 +50,8 @@ installfiles = {"plexpl3.ltx","plexpl3.sty","plpatch3.sty"} typesetexe = "platex" typesetopts = " -interaction=nonstopmode -halt-on-error -kanji=utf8 " +maxprintline = 9999 + unpackexe = "ptex" unpackopts = " -interaction=batchmode -halt-on-error -kanji=utf8 " diff --git a/plpatch3.dtx b/plpatch3.dtx index 941ffcc..494fb8a 100644 --- a/plpatch3.dtx +++ b/plpatch3.dtx @@ -28,11 +28,14 @@ % }^^A % } % -% \date{Released 2023-02-18} +% \date{Released 2023-08-11} % % \maketitle % % \begin{documentation} +% +% +% % \end{documentation} % % \begin{implementation} @@ -495,86 +498,32 @@ % % \subsubsection{Fix for the codepoints funcrtions} % -% Reverts the \pTeX{} implementation to the same as \pdfTeX{}. -% \begin{macrocode} -\sys_if_engine_ptex:T - { - \cs_gset:Npn \@@_codepoint_process:nN #1#2 - { - \int_compare:nNnTF { `#2 } > { "80 } - { - \int_compare:nNnTF { `#2 } < { "E0 } - { \@@_codepoint_process:nNN } - { - \int_compare:nNnTF { `#2 } < { "F0 } - { \@@_codepoint_process:nNNN } - { \@@_codepoint_process:nNNNN } - } - } - { \use:n } - {#1} #2 - } - \cs_new:Npn \@@_codepoint_process:nNNN #1#2#3#4 - { #1 {#2#3#4} } - \cs_new:Npn \@@_codepoint_process:nNNNN #1#2#3#4#5 - { #1 {#2#3#4#5} } - } -% \end{macrocode} % Handle jachar in \pTeX{} and \upTeX{}. % \begin{macrocode} \bool_lazy_or:nnT { \sys_if_engine_ptex_p: } { \sys_if_engine_uptex_p: } { - \cs_new_eq:NN \@@_codepoint_process_non_jachar:nN - \@@_codepoint_process:nN \cs_gset:Npn \@@_codepoint_process:nN #1#2 { - \token_if_jachar:NTF #2 - { \@@_codepoint_process_jachar:nN } - { \@@_codepoint_process_non_jachar:nN } + \int_compare:nNnTF {`#2} > { "7F } + { + \token_if_jachar:NTF #2 + { \use:n } + { \@@_codepoint_process_aux:nN } + } + { \use:n } {#1} #2 } - \cs_new:Npn \@@_codepoint_process_jachar:nN #1#2 - { #1 {#2} } } % \end{macrocode} % % Reverts the \pTeX{} implementation to the same as \pdfTeX{}. % \begin{macrocode} -\sys_if_engine_ptex:T +\bool_lazy_or:nnT + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } { - \cs_gset:Npn \@@_codepoint_from_chars:Nw #1 - { - \if_int_compare:w `#1 > "80 \exp_stop_f: - \if_int_compare:w `#1 < "E0 \exp_stop_f: - \exp_after:wN \exp_after:wN \exp_after:wN - \@@_codepoint_from_chars:NN - \else: - \if_int_compare:w `#1 < "F0 \exp_stop_f: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \@@_codepoint_from_chars:NNN - \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \@@_codepoint_from_chars:NNNN - \fi: - \fi: - \else: - \exp_after:wN \@@_codepoint_from_chars:N - \fi: - #1 - } - \cs_new:Npn \@@_codepoint_from_chars:NNN #1#2#3 - { (`#1 - "E0) * "1000 + (`#2 - "80) * "40 + `#3 - "80 } - \cs_new:Npn \@@_codepoint_from_chars:NNNN #1#2#3#4 - { - (`#1 - "F0) * "40000 - + (`#2 - "80) * "1000 - + (`#3 - "80) * "40 - + `#4 - "80 - } } % \end{macrocode} % Handle jachar in \pTeX{} and \upTeX{}. @@ -583,14 +532,22 @@ { \sys_if_engine_ptex_p: } { \sys_if_engine_uptex_p: } { - \cs_new_eq:NN \@@_codepoint_from_chars_non_jachar:Nw - \@@_codepoint_from_chars:Nw \cs_gset:Npn \@@_codepoint_from_chars:Nw #1 { - \token_if_jachar:NTF #1 - { \@@_codepoint_from_chars_jachar:N } - { \@@_codepoint_from_chars_non_jachar:Nw } - #1 + \if_int_compare:w `#1 > "7F \exp_stop_f: + \token_if_jachar:NTF #1 + { + \exp_after:wN + \@@_codepoint_from_chars:N + } + { + \exp_after:wN + \@@_codepoint_from_chars_aux:Nw + } + \else: + \exp_after:wN \@@_codepoint_from_chars:N + \fi: + #1 } \cs_new:Npn \@@_codepoint_from_chars_jachar:N #1 { \tex_toucs:D `#1 ~ } diff --git a/testfiles/pl3str001.tlg b/testfiles/pl3str001.tlg index 8bcd486..3d43dde 100644 --- a/testfiles/pl3str001.tlg +++ b/testfiles/pl3str001.tlg @@ -4,8 +4,7 @@ Don't change this file in any respect. TEST 1: tl_to_str ============================================================ "ABCxyz+?" -"£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^ -92×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9e^^c3^^9f" +"£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^92×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9e^^c3^^9f" "^^c3^^a3^^c3^^a6^^c3^^a7^^c3^^a9^^c3^^ac^^c3^^b0^^c3^^b4÷^^c3^^b8^^c3^^bb^^c3^^be^^c3^^bf" "^^c4^^82^^c4^^98^^c5^^81^^c5^^8a^^c5^^90^^c4^^85^^c4^^9b^^c4^^9f^^c5^^8b^^c5^^9f^^c5^^af^^c5^^bc" "ΑΒΓΩαβγω" @@ -16,8 +15,7 @@ TEST 1: tl_to_str TEST 2: uppercase ============================================================ "ABCXYZ+?" -"£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^ -92×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9eSS" +"£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^92×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9eSS" "^^c3^^83^^c3^^86^^c3^^87^^c3^^89^^c3^^8c^^c3^^90^^c3^^94÷^^c3^^98^^c3^^9b^^c3^^9e^^c5^^b8" "^^c4^^82^^c4^^98^^c5^^81^^c5^^8a^^c5^^90^^c4^^84^^c4^^9a^^c4^^9e^^c5^^8a^^c5^^9e^^c5^^ae^^c5^^bb" "ΑΒΓΩαβγω" @@ -28,8 +26,7 @@ TEST 2: uppercase TEST 3: lowercase ============================================================ "abcxyz+?" -"£§±¶^^c2^^bd^^c3^^a5^^c3^^a6^^c3^^a7^^c3^^aa^^c3^^af^^c3^^b0^^c3^^b1^^c3^^ -b2×^^c3^^b8^^c3^^b9^^c3^^bd^^c3^^be^^c3^^9f" +"£§±¶^^c2^^bd^^c3^^a5^^c3^^a6^^c3^^a7^^c3^^aa^^c3^^af^^c3^^b0^^c3^^b1^^c3^^b2×^^c3^^b8^^c3^^b9^^c3^^bd^^c3^^be^^c3^^9f" "^^c3^^a3^^c3^^a6^^c3^^a7^^c3^^a9^^c3^^ac^^c3^^b0^^c3^^b4÷^^c3^^b8^^c3^^bb^^c3^^be^^c3^^bf" "^^c4^^83^^c4^^99^^c5^^82^^c5^^8b^^c5^^91^^c4^^85^^c4^^9b^^c4^^9f^^c5^^8b^^c5^^9f^^c5^^af^^c5^^bc" "ΑΒΓΩαβγω" diff --git a/testfiles/pl3text001.tlg b/testfiles/pl3text001.tlg index 8624a41..192e320 100644 --- a/testfiles/pl3text001.tlg +++ b/testfiles/pl3text001.tlg @@ -4,8 +4,7 @@ Don't change this file in any respect. TEST 1: expand ============================================================ ABCxyz+? -£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^9 -2×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9e^^c3^^9f +£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^92×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9e^^c3^^9f ^^c3^^a3^^c3^^a6^^c3^^a7^^c3^^a9^^c3^^ac^^c3^^b0^^c3^^b4÷^^c3^^b8^^c3^^bb^^c3^^be^^c3^^bf ^^c4^^82^^c4^^98^^c5^^81^^c5^^8a^^c5^^90^^c4^^85^^c4^^9b^^c4^^9f^^c5^^8b^^c5^^9f^^c5^^af^^c5^^bc \cGrek {ΑΒΓΩαβγω} @@ -16,8 +15,7 @@ ABCxyz+? TEST 2: uppercase ============================================================ ABCXYZ+? -£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^9 -2×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9eSS +£§±¶^^c2^^bd^^c3^^85^^c3^^86^^c3^^87^^c3^^8a^^c3^^8f^^c3^^90^^c3^^91^^c3^^92×^^c3^^98^^c3^^99^^c3^^9d^^c3^^9eSS ^^c3^^83^^c3^^86^^c3^^87^^c3^^89^^c3^^8c^^c3^^90^^c3^^94÷^^c3^^98^^c3^^9b^^c3^^9e^^c5^^b8 ^^c4^^82^^c4^^98^^c5^^81^^c5^^8a^^c5^^90^^c4^^84^^c4^^9a^^c4^^9e^^c5^^8a^^c5^^9e^^c5^^ae^^c5^^bb \cGrek {ΑΒΓΩαβγω} @@ -28,8 +26,7 @@ ABCXYZ+? TEST 3: lowercase ============================================================ abcxyz+? -£§±¶^^c2^^bd^^c3^^a5^^c3^^a6^^c3^^a7^^c3^^aa^^c3^^af^^c3^^b0^^c3^^b1^^c3^^b -2×^^c3^^b8^^c3^^b9^^c3^^bd^^c3^^be^^c3^^9f +£§±¶^^c2^^bd^^c3^^a5^^c3^^a6^^c3^^a7^^c3^^aa^^c3^^af^^c3^^b0^^c3^^b1^^c3^^b2×^^c3^^b8^^c3^^b9^^c3^^bd^^c3^^be^^c3^^9f ^^c3^^a3^^c3^^a6^^c3^^a7^^c3^^a9^^c3^^ac^^c3^^b0^^c3^^b4÷^^c3^^b8^^c3^^bb^^c3^^be^^c3^^bf ^^c4^^83^^c4^^99^^c5^^82^^c5^^8b^^c5^^91^^c4^^85^^c4^^9b^^c4^^9f^^c5^^8b^^c5^^9f^^c5^^af^^c5^^bc \cGrek {ΑΒΓΩαβγω} diff --git a/testfiles/pl3text002.tlg b/testfiles/pl3text002.tlg index 3ccca6d..45ec924 100644 --- a/testfiles/pl3text002.tlg +++ b/testfiles/pl3text002.tlg @@ -4,10 +4,7 @@ Defining \test_map:n on line ... ============================================================ TEST 1: text_map_function ============================================================ -[A][B][C][ ][^^c3^^a4][^^c3^^ab][^^c3^^af][^^c3^^b6][^^c3^^bc][ ][α][β][γ][ ][あ][い][う][え][お][ ][か^^e3^^82^^9a][き^^e3^^82^^9a][く^^e3^^82^^9a][け^^e3 -^^82^^9a][こ^^e3^^82^^9a][ ][葛^^f3^^a0^^84^^80][城][市][ ][葛^^f3^^a0^^84^^81] -[飾][区][ ][^^e2^^98^^80][^^e2^^98^^81][^^e2^^98^^82][^^e2^^98^^83][ ][^^e2^^9b -^^84][^^f0^^9f^^91^^a8^^e2^^80^^8d][^^f0^^9f^^91^^a9^^e2^^80^^8d][^^f0^^9f^^91^^a7^^e2^^80^^8d][^^f0^^9f^^91^^a6][^^f0^^9f^^92^^94] +[A][B][C][ ][^^c3^^a4][^^c3^^ab][^^c3^^af][^^c3^^b6][^^c3^^bc][ ][α][β][γ][ ][あ][い][う][え][お][ ][か^^e3^^82^^9a][き^^e3^^82^^9a][く^^e3^^82^^9a][け^^e3^^82^^9a][こ^^e3^^82^^9a][ ][葛^^f3^^a0^^84^^80][城][市][ ][葛^^f3^^a0^^84^^81][飾][区][ ][^^e2^^98^^80][^^e2^^98^^81][^^e2^^98^^82][^^e2^^98^^83][ ][^^e2^^9b^^84][^^f0^^9f^^91^^a8^^e2^^80^^8d][^^f0^^9f^^91^^a9^^e2^^80^^8d][^^f0^^9f^^91^^a7^^e2^^80^^8d][^^f0^^9f^^91^^a6][^^f0^^9f^^92^^94] ============================================================ ============================================================ TEST 2: text_map_inline diff --git a/testfiles/pl3text002.uptex.tlg b/testfiles/pl3text002.uptex.tlg index 0f6e253..9693e9a 100644 --- a/testfiles/pl3text002.uptex.tlg +++ b/testfiles/pl3text002.uptex.tlg @@ -4,9 +4,7 @@ Defining \test_map:n on line ... ============================================================ TEST 1: text_map_function ============================================================ -[A][B][C][ ][^^c3^^a4][^^c3^^ab][^^c3^^af][^^c3^^b6][^^c3^^bc][ ][α][β][γ][ ][あ][い][う][え][お][ ][か゚][き゚][く゚][け゚][こ゚][ ][葛 -󠄀][城][市][ ][葛󠄁][飾][区][ ][☀][☁][☂][☃][ ][⛄][👨‍][ -👩‍][👧‍][👦][💔] +[A][B][C][ ][^^c3^^a4][^^c3^^ab][^^c3^^af][^^c3^^b6][^^c3^^bc][ ][α][β][γ][ ][あ][い][う][え][お][ ][か゚][き゚][く゚][け゚][こ゚][ ][葛󠄀][城][市][ ][葛󠄁][飾][区][ ][☀][☁][☂][☃][ ][⛄][👨‍][👩‍][👧‍][👦][💔] ============================================================ ============================================================ TEST 2: text_map_inline