From 3d14629715165c2716655f18dbf303d353bad606 Mon Sep 17 00:00:00 2001 From: Yukimasa Morimi Date: Thu, 11 Aug 2022 16:00:06 +0900 Subject: [PATCH] First commit --- .gitattributes | 1 + .gitignore | 5 + LICENSE | 28 ++ build.lua | 77 +++++ plexpl3.dtx | 483 ++++++++++++++++++++++++++++++++ plexpl3.ins | 33 +++ testfiles/pl3str-convert001.lvt | 36 +++ testfiles/pl3str-convert001.tlg | 12 + testfiles/pl3str001.lvt | 71 +++++ testfiles/pl3str001.tlg | 38 +++ testfiles/pl3str001.uptex.tlg | 35 +++ testfiles/pl3text001.lvt | 71 +++++ testfiles/pl3text001.tlg | 38 +++ testfiles/pl3text001.uptex.tlg | 35 +++ 14 files changed, 963 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 build.lua create mode 100644 plexpl3.dtx create mode 100644 plexpl3.ins create mode 100644 testfiles/pl3str-convert001.lvt create mode 100644 testfiles/pl3str-convert001.tlg create mode 100644 testfiles/pl3str001.lvt create mode 100644 testfiles/pl3str001.tlg create mode 100644 testfiles/pl3str001.uptex.tlg create mode 100644 testfiles/pl3text001.lvt create mode 100644 testfiles/pl3text001.tlg create mode 100644 testfiles/pl3text001.uptex.tlg diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56ddc95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +build/* + +*.zip + +*.pdf diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..592f89f --- /dev/null +++ b/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2010 ASCII MEDIA WORKS +Copyright (c) 2016-2022 Japanese TeX Development Community +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/build.lua b/build.lua new file mode 100644 index 0000000..48cb0f9 --- /dev/null +++ b/build.lua @@ -0,0 +1,77 @@ +module = "plexpl3" +bundle = "" + +maindir = "." + +checkengines = {"ptex","uptex"} +stdengine = "ptex" +checkformat = "latex" +checkopts = " -interaction=nonstopmode -no-guess-input-enc -kanji=utf8 " + +installfiles = {"plexpl3.ltx","plexpl3.sty"} + +typesetexe = "platex" +typesetopts = " -interaction=nonstopmode -no-guess-input-enc -kanji=utf8 " + +unpackexe = "ptex" +unpackopts = " -interaction=nonstopmode -no-guess-input-enc -kanji=utf8 " + +-- Do not break non-ascii chars in log file +asciiengines = {} + +-- Typeseting with dvipdfmx +function typeset(file,dir,exe) + dir = dir or "." + local errorlevel = tex(file,dir,exe) + if errorlevel ~= 0 then + return errorlevel + end + local name = jobname(file) + errorlevel = biber(name,dir) + bibtex(name,dir) + if errorlevel ~= 0 then + return errorlevel + end + for i = 2,typesetruns do + errorlevel = + makeindex(name,dir,".glo",".gls",".glg",glossarystyle) + + makeindex(name,dir,".idx",".ind",".ilg",indexstyle) + + tex(file,dir,exe) + if errorlevel ~= 0 then break end + end + -- Run dvipdfmx if .dvi file extists + if fileexists(dir .. "/" .. name .. dviext) then + errorlevel = runcmd("dvipdfmx " .. name, dir, {}) + end + return errorlevel +end + +local function mkfmts(engines,dir) + for _,engine in pairs(engines) do + engine = string.gsub(engine,"latex$","tex") + local ininame = string.gsub(engine,"tex$","latex.ini") + if engine:match("u?ptex") then + engine = "e" .. engine + end + runcmd(engine .. " -etex -ini " .. ininame, dir, {}) + end + return 0 +end + +function checkinit_hook() + local engines = options.engine + if not engines then + local target = options.target + if target == 'check' or target == 'bundlecheck' then + engines = checkengines + elseif target == 'save' then + engines = {stdengine} + else + error'Unexpected target in call to checkinit_hook' + end + end + return mkfmts(engines, testdir) +end + +function docinit_hook() + return mkfmts({typesetexe},typesetdir) +end diff --git a/plexpl3.dtx b/plexpl3.dtx new file mode 100644 index 0000000..6fe296e --- /dev/null +++ b/plexpl3.dtx @@ -0,0 +1,483 @@ +% \iffalse meta-comment +%% File: plexpl3.dtx +% +% Copyright (c) 2020-2022 Japanese TeX Development Community +% +% This file is part of the pLaTeX2e system (community edition). +% ------------------------------------------------------------- +% +% \fi +% +% +% \iffalse +% \changes{v1.0}{2020/09/28}{初版:p\TeX{}の条件文を定義} +% \fi +% +% \iffalse +%<*driver> +\NeedsTeXFormat{pLaTeX2e} +\ProvidesFile{plexpl3.dtx}[2020/09/28 v1.0 expl3 additions] +\RequirePackage{plautopatch} +\documentclass[dvipdfmx,a4paper]{jltxdoc} +\GetFileInfo{plexpl3.dtx} +\author{Japanese \TeX\ Development Community} +\title{The \textsf{plexpl3} package} +\date{作成日:\filedate} +\begin{document} + \newcommand\Lpack[1]{\textsf{#1}} + \maketitle + \DocInput{\filename} +\end{document} +% +% \fi +% +% \LaTeX3 (expl3)で用意されていない「p\TeX{}系列の独自機能」を +% expl3の文法で使えるようにするコードです。 +% p\LaTeXe~2020-10-01で新設しました。 +% +% \setcounter{StandardModuleDepth}{1} +% \StopEventually{} +% +% \section{コード} +% +% パッケージとして宣言します。 +% これで、p\LaTeXe~2020-04-12以前でも +% \file{plexpl3.sty}と\file{plexpl3.ltx}だけ +% 入手すれば同等の機能が使えます。 +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{pLaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{plexpl3}{2020-09-28}{1.0} + {pTeX/upTeX-specific additions to expl3} +% +% \end{macrocode} +% +% \LaTeXe~2020-02-02以降では\file{expl3}が標準で +% フォーマットに読み込まれています。この場合は +% \file{plexpl3}の機能をフォーマットに取り込みます。 +% \begin{macrocode} +%\ifdefined\ExplSyntaxOn %--- expl3 available BEGIN +%\ExplSyntaxOn +%<*plcore|package> +\input plexpl3.ltx +% +%\ExplSyntaxOff +%\fi %--- expl3 available END +% \end{macrocode} +% +% \file{platexrelease}のroll-forwardにも登録します。 +% \begin{macrocode} +%\plIncludeInRelease{2020/10/01}% +% {plexpl3}{Pre-load plexpl3}% +%\RequirePackage{plexpl3} +%\plEndIncludeInRelease +%\plIncludeInRelease{0000/00/00}% +% {plexpl3}{Not loading plexpl3}% +%% Nothing to do +%\plEndIncludeInRelease +% \end{macrocode} +% +% 以下のコードは\file{plexpl3.ltx}に書き出します。 +% フォーマットとパッケージからの重複読み込みは禁止します。 +% \begin{macrocode} +%<*code> +\cs_if_exist:NT \__platex_expl_loaded: + { + \GenericInfo{} + {Skipping:~ plexpl3~ code~ already~ part~ of~ the~ format}% + \endinput + } +\cs_new:Npn \__platex_expl_loaded: { } +% \end{macrocode} +% +% \section{p\TeX{}系列の条件文} +% +% p\TeX{}系列の条件文をexpl3の文法にします。 +% \changes{v1.0}{2020/09/28}{初版:p\TeX{}の条件文を定義} +% \begin{macrocode} +%% additions to l3box.dtx: writing directions (pTeX/upTeX-specific) +\cs_set_eq:NN \platex_direction_yoko: \tex_yoko:D +\cs_set_eq:NN \platex_direction_tate: \tex_tate:D +\cs_set_eq:NN \platex_direction_dtou: \tex_dtou:D +% +\prg_new_conditional:Npnn \platex_if_direction_yoko: { p, T, F, TF } + { \tex_ifydir:D \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \platex_if_direction_tate: { p, T, F, TF } + { \tex_iftdir:D \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \platex_if_direction_dtou: { p, T, F, TF } + { \tex_ifddir:D \prg_return_true: \else: \prg_return_false: \fi: } +% +\prg_new_conditional:Npnn \platex_if_box_yoko:N #1 { p, T, F, TF } + { \tex_ifybox:D #1 \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \platex_if_box_tate:N #1 { p, T, F, TF } + { \tex_iftbox:D #1 \prg_return_true: \else: \prg_return_false: \fi: } +\prg_new_conditional:Npnn \platex_if_box_dtou:N #1 { p, T, F, TF } + { \tex_ifdbox:D #1 \prg_return_true: \else: \prg_return_false: \fi: } +% \end{macrocode} +% +% \section{expl3の和文文字トークン対応} +% +% \url{https://gist.github.com/zr-tex8r/248ff347172ce16d005897656687a901} +% \begin{macrocode} +%--------------------------------------- +%% \token_if_jachar:N +% Tests if is a jachar token or not. +\bool_lazy_or:nnTF + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } + { + \use:x + { + \prg_new_conditional:Npnn \exp_not:N \token_if_jachar:N ##1 + { p , T , F , TF } + { + % A token is a jachar token if and only if + % its meaning string starts with "kanji ". + \exp_not:N \str_if_eq:eeTF + { + \exp_not:N \exp_after:wN + \exp_not:N \__token_delimit_by_kanji:w + \exp_not:N \token_to_meaning:N ##1 + ? \tl_to_str:n { kanji } ~ \s__token_stop + } + { } + { \exp_not:N \prg_return_true: } + { \exp_not:N \prg_return_false: } + } + \cs_new:Npn \exp_not:N \__token_delimit_by_kanji:w ##1 + \tl_to_str:n { kanji } ~ ##2 \s__token_stop + {##1} + } + } + { + \prg_new_conditional:Npnn \token_if_jachar:N #1 + { p , T , F , TF } + { \prg_return_false: } + } + +%--------------------------------------- +%% Fix for the case-change funcrtions in l3text. +\bool_lazy_or:nnT + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } + { + \cs_gset_eq:NN \__text_change_case_char_jachar:nnnN + \__text_change_case_char_auxii:nnnN + } +\bool_lazy_or:nnF + { \sys_if_engine_luatex_p: } + { \sys_if_engine_xetex_p: } + { + % The current implementation for pdftex should be employed + % for all non-Unicode engines. + \cs_gset:Npn \__text_change_case_char_auxii:nnnN #1#2#3#4 + { + \int_compare:nNnTF { `#4 } < { "F0 } + { \__text_change_case_char_UTFviii:nnnNNN } + { \__text_change_case_char_UTFviii:nnnNNNN } + {#1} {#2} {#3} #4 + } + } +\bool_lazy_or:nnT + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } + { + \cs_gset:Npn \__text_change_case_char:nnnN #1#2#3#4 + { + \int_compare:nNnTF { `#4 } > { "80 } % why not "7F? + { + % Check if the given character token is a jachar. + \token_if_jachar:NTF #4 + { \__text_change_case_char_jachar:nnnN } + { + \int_compare:nNnTF { `#4 } < { "E0 } + { \__text_change_case_char_UTFviii:nnnNN } + { \__text_change_case_char_auxii:nnnN } + } + } + { \__text_change_case_char_auxi:nnnN } + {#1} {#2} {#3} #4 + } + } + +%--------------------------------------- +%% Fix for the case-change funcrtions in l3str. +\bool_lazy_or:nnF + { \sys_if_engine_luatex_p: } + { \sys_if_engine_xetex_p: } + { + % The current implementation for pdftex should be employed + % for all non-Unicode engines. + \cs_gset:Npn \__str_change_case_char_UTFviii:nNNN #1#2#3#4 + { \__str_change_case_char_UTFviii:nn {#1} {#2#3#4} } + \cs_gset:Npn \__str_change_case_char_UTFviii:nNNNN #1#2#3#4#5 + { \__str_change_case_char_UTFviii:nn {#1} {#2#3#4#5} } + } +\bool_lazy_or:nnT + { \sys_if_engine_ptex_p: } + { \sys_if_engine_uptex_p: } + { + \cs_gset:Npn \__str_change_case_char:nN #1#2 + { + \__str_if_recursion_tail_stop_do:Nn #2 + { \__str_change_case_end:wn } + \int_compare:nNnTF { `#2 } > { "80 } + { + % Check if the given character token is a jachar. + \token_if_jachar:NTF #2 + { \__str_change_case_char_jachar:nN } + { + \int_compare:nNnTF { `#2 } < { "E0 } + { \__str_change_case_char_UTFviii:nNN } + { + \int_compare:nNnTF { `#2 } < { "F0 } + { \__str_change_case_char_UTFviii:nNNN } + { \__str_change_case_char_UTFviii:nNNNN } + } + } + {#1} #2 + } + { + \__str_change_case_output:fw + { \use:c { char_str_ #1 case:N } #2 } + \__str_change_case_loop:nw {#1} + } + } + \cs_new:Npn \__str_change_case_char_jachar:nN #1#2 + { + \__str_change_case_output:nw {#2} + \__str_change_case_loop:nw {#1} + } + } +% \end{macrocode} +% +% \url{https://gist.github.com/h20y6m/6449d1d5d29a71620d19f29f881a0549} +% \begin{macrocode} +\cs_new:Npn \__str_encode_if_extended_char_p:n #1 { \c_false_bool } +\cs_new:Npn \__str_encode_extended_char:n #1 { } + +\cs_gset:Npn \__str_encode_utf_viii_char:n #1 + { + \if_predicate:w \__str_encode_if_extended_char_p:n {#1} + \__str_encode_extended_char:n {#1} + \else: + \__str_encode_utf_viii_loop:wwnnw #1 ; - 1 + 0 * ; + { 128 } { 0 } + { 32 } { 192 } + { 16 } { 224 } + { 8 } { 240 } + \s__str_stop + \fi: + } + +\cs_new:Npn \__str_decode_if_extended_char_p:N #1 { \c_false_bool } +\cs_new:Npn \__str_decode_extended_char:N #1 { } + +\cs_gset:Npn \__str_decode_utf_viii_start:N #1 + { + #1 + \if_predicate:w \__str_decode_if_extended_char_p:N #1 + \s__str + \__str_decode_extended_char:N #1 + \else: + \if_int_compare:w `#1 < "C0 \exp_stop_f: + \s__str + \if_int_compare:w `#1 < "80 \exp_stop_f: + \int_value:w `#1 + \else: + \flag_raise:n { str_extra } + \flag_raise:n { str_error } + \int_use:N \c__str_replacement_char_int + \fi: + \else: + \exp_after:wN \__str_decode_utf_viii_continuation:wwN + \int_value:w \int_eval:n { `#1 - "C0 } \exp_after:wN + \fi: + \exp_after:wN % ??? + \fi: + \s__str + \__str_use_none_delimit_by_s_stop:w {"80} {"800} {"10000} {"110000} \s__str_stop + \__str_decode_utf_viii_start:N + } + +\cs_new_protected:Npn \__ptex_tmp:w { } + +% (upTeX only) declare kanji token which has specific kcatcode. +\sys_if_engine_uptex:T + { + \group_begin: + \cs_set:Npn \__ptex_tmp:w #1#2 + { + \exp_after:wN \cs_new_eq:NN \exp_after:wN #1 + \tex_Ucharcat:D + \int_eval:n { \tex_jis:D "2121 } ~ + \int_eval:n {#2} \scan_stop: + } + \__ptex_tmp:w \c_kcatcode_kanji_token { 16 } + \__ptex_tmp:w \c_kcatcode_kana_token { 17 } + \__ptex_tmp:w \c_kcatcode_symbol_token { 18 } + \__ptex_tmp:w \c_kcatcode_hangul_token { 19 } + \group_end: + } + +% (upTeX only) get kcatcode of token. +\sys_if_engine_uptex:T + { + \cs_new:Npn \__ptex_char_kcatcode:N #1 + { + \if_catcode:w \exp_not:N #1 \c_kcatcode_kanji_token + 16 + \else: + \if_catcode:w \exp_not:N #1 \c_kcatcode_kana_token + 17 + \else: + \if_catcode:w \exp_not:N #1 \c_kcatcode_symbol_token + 18 + \else: + \if_catcode:w \exp_not:N #1 \c_kcatcode_hangul_token + 19 + \else: + 15 + \fi: + \fi: + \fi: + \fi: + } + } + + +% define ptex+utf8 encoding. + +% ptex+utf8 encode function. +\cs_new_protected:cpn { __str_convert_encode_ptex+utf8: } + { + \group_begin: + \cs_set_eq:NN \__str_encode_if_extended_char_p:n \__str_encode_if_kanji_char_p:n + \cs_set_eq:NN \__str_encode_extended_char:n \__str_encode_kanji_char:n + \use:c { __str_convert_encode_utf8: } + \group_end: + } + +% Tests whether the Unicode code point #1 is Japanese character +\int_compare:nNnTF { \tex_jis:D "2121 } = { "3000 } + { + % upTeX with unicode + \prg_new_conditional:Npnn \__str_encode_if_kanji_char:n #1 { p } + { + % NOTE: + % \kcatcode0--\kcatcode127 may not be 15, + % but ASCII (0--127) never be Japanese character. + \if_int_compare:w #1 < "80 \exp_stop_f: + \prg_return_false: + \else: + \if_int_compare:w \tex_kcatcode:D #1 = 15 \exp_stop_f: + \prg_return_false: + \else: + \prg_return_true: + \fi: + \fi: + } + } + { + % pTeX or upTeX with euc/sjis + \prg_new_conditional:Npnn \__str_encode_if_kanji_char:n #1 { p } + { + % If specified Unicode code point cannot convert to internal Kanji code, + % \ucs returns -1. + \if_int_compare:w \tex_ucs:D #1 < 0 \exp_stop_f: + \prg_return_false: + \else: + \if_int_compare:w \tex_kcatcode:D \tex_ucs:D #1 = 15 \exp_stop_f: % upTeX only. pTeX always false. + \prg_return_false: + \else: + \prg_return_true: + \fi: + \fi: + } + } + +% Generate Japanese character token which has Unicode code point #1. +\int_compare:nNnTF { \tex_jis:D "2121 } = { "3000 } + { + % upTeX with unicode + \cs_new:Npn \__str_encode_kanji_char:n #1 + { + % \Uchar always generates Latin character token for character + % code 128--255, but Japanese character token are needed, + % so use \Ucharcat instead. + \if_int_compare:w \tex_kcatcode:D #1 > 15 \exp_stop_f: + \tex_Ucharcat:D #1 \exp_stop_f: \tex_kcatcode:D #1 \exp_stop_f: + \else: + \tex_Ucharcat:D #1 \exp_stop_f: 18 \exp_stop_f: + \fi: + } + } + { + % pTeX or upTeX with euc/sjis + \cs_new:Npn \__str_encode_kanji_char:n #1 + { \tex_Uchar:D \tex_ucs:D #1 \exp_stop_f: \exp_stop_f: } + } + +% ptex+utf8 decode function. +\cs_new_protected:cpn { __str_convert_decode_ptex+utf8: } + { + \group_begin: + \cs_set_eq:NN \__str_decode_if_extended_char_p:N \__str_decode_if_kanji_char_p:N + \cs_set_eq:NN \__str_decode_extended_char:N \__str_decode_kanji_char:N + \use:c { __str_convert_decode_utf8: } + \group_end: + } + +% Tests whether the token #1 is Japanese character. +\int_compare:nNnTF { \tex_jis:D "2121 } = { "3000 } + { + % upTeX with unicode + \prg_new_conditional:Npnn \__str_decode_if_kanji_char:N #1 { p } + { + \if_int_compare:w \__ptex_char_kcatcode:N #1 > 15 \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + } + { + % pTeX or upTeX with euc/sjis + \prg_new_conditional:Npnn \__str_decode_if_kanji_char:N #1 { p } + { + \if_int_compare:w `#1 < "100 \exp_stop_f: + \prg_return_false: + \else: + \prg_return_true: + \fi: + } + } + +% Convert Japanese character #1 to Unicode code point. +\int_compare:nNnTF { \tex_jis:D "2121 } = { "3000 } + { + % upTeX with unicode + \cs_new:Npn \__str_decode_kanji_char:N #1 + { \int_value:w `#1 } + } + { + % pTeX or upTeX with euc/sjis + \cs_new:Npn \__str_decode_kanji_char:N #1 + { \tex_toucs:D `#1 } + } + +% alternative encoding name +\prop_gput:Nnn \g__str_alias_prop { ptex } { ptex+utf8 } +% set default encoding to ptex+utf8 +\prop_gput:Nnn \g__str_alias_prop { default } { ptex+utf8 } +% \end{macrocode} +% +% 以上です。 +% \begin{macrocode} +% +% \end{macrocode} +% +% \Finale +% +\endinput diff --git a/plexpl3.ins b/plexpl3.ins new file mode 100644 index 0000000..51fbc18 --- /dev/null +++ b/plexpl3.ins @@ -0,0 +1,33 @@ +\iffalse meta-comment + +File plexpl3.ins + +Copyright (c) 2022 Japanese TeX Development Community + +This file is part of the pLaTeX2e system (community edition). +------------------------------------------------------------- + +\fi + +\let\jobname\relax +\input docstrip % +\askforoverwritefalse + +\preamble + +Copyright (c) 2020-2022 Japanese TeX Development Community + +This file is part of the pLaTeX2e system (community edition). +------------------------------------------------------------- + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +\generate{\file{plexpl3.sty}{\from{plexpl3.dtx}{package}}} +\generate{\file{plexpl3.ltx}{\from{plexpl3.dtx}{code}}} + +\endbatchfile diff --git a/testfiles/pl3str-convert001.lvt b/testfiles/pl3str-convert001.lvt new file mode 100644 index 0000000..13cfff4 --- /dev/null +++ b/testfiles/pl3str-convert001.lvt @@ -0,0 +1,36 @@ +% +% Copyright (c) 2022 Japanese TeX Development Community +% +\epTeXinputencoding utf8 + +\input{regression-test} +\documentclass{minimal} +\RequirePackage[enable-debug]{expl3} +\ExplSyntaxOn +\debug_on:n { check-declarations , deprecation , log-functions } +\ExplSyntaxOff + +\RequirePackage{plexpl3} + +\begin{document} + +\START +\ExplSyntaxOn + +\TEST { default } + { + \str_set_convert:Nnnn \l_tmpa_tl { ABC~äëïöü~αβγ~あいうえお~日本語~☀☁☂☃ } + { default } { utf16/hex } + \str_if_eq:onTF { \l_tmpa_tl } { FEFF004100420043002000E400EB00EF00F600FC002003B103B203B300203042304430463048304A002065E5672C8A9E00202600260126022603 } + { \TRUE } { \ERROR } + } + +\TEST { to~default } + { + \str_set_convert:Nnnn \l_tmpa_tl { FEFF004100420043002000E400EB00EF00F600FC002003B103B203B300203042304430463048304A002065E5672C8A9E00202600260126022603 } + { utf16/hex } { default } + \str_if_eq:onTF { \l_tmpa_tl } { ABC~äëïöü~αβγ~あいうえお~日本語~☀☁☂☃ } + { \TRUE } { \ERROR } + } + +\END diff --git a/testfiles/pl3str-convert001.tlg b/testfiles/pl3str-convert001.tlg new file mode 100644 index 0000000..6dd8002 --- /dev/null +++ b/testfiles/pl3str-convert001.tlg @@ -0,0 +1,12 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +============================================================ +TEST 1: default +============================================================ +TRUE +============================================================ +============================================================ +TEST 2: to default +============================================================ +TRUE +============================================================ diff --git a/testfiles/pl3str001.lvt b/testfiles/pl3str001.lvt new file mode 100644 index 0000000..1ba6f03 --- /dev/null +++ b/testfiles/pl3str001.lvt @@ -0,0 +1,71 @@ +% +% Copyright (c) 2022 Japanese TeX Development Community +% +\epTeXinputencoding utf8 + +\input{regression-test} +\documentclass{minimal} +\RequirePackage[enable-debug]{expl3} +\ExplSyntaxOn +\debug_on:n { check-declarations , deprecation , log-functions } +\ExplSyntaxOff + +\RequirePackage{plexpl3} + +\begin{document} + +\START +\ExplSyntaxOn + +\TESTEXP { tl_to_str } + { + " \tl_to_str:n { ABCxyz+? } " + \NEWLINE + " \tl_to_str:n { £§±¶½ÅÆÇÊÏÐÑÒ×ØÙÝÞß } " + \NEWLINE + " \tl_to_str:n { ãæçéìðô÷øûþÿ } " + \NEWLINE + " \tl_to_str:n { ĂĘŁŊŐąěğŋşůż } " + \NEWLINE + " \tl_to_str:n { ΑΒΓΩαβγω } " + \NEWLINE + " \tl_to_str:n { АБВЉЇЯабвґџя } " + \NEWLINE + " \tl_to_str:n { ‰ } " + } + +\TESTEXP { uppercase } + { + " \str_uppercase:n { ABCxyz+? } " + \NEWLINE + " \str_uppercase:n { £§±¶½ÅÆÇÊÏÐÑÒ×ØÙÝÞß } " + \NEWLINE + " \str_uppercase:n { ãæçéìðô÷øûþÿ } " + \NEWLINE + " \str_uppercase:n { ĂĘŁŊŐąěğŋşůż } " + \NEWLINE + " \str_uppercase:n { ΑΒΓΩαβγω } " + \NEWLINE + " \str_uppercase:n { АБВЉЇЯабвґџя } " + \NEWLINE + " \str_uppercase:n { ‰ } " + } + +\TESTEXP { lowercase } + { + " \str_lowercase:n { ABCxyz+? } " + \NEWLINE + " \str_lowercase:n { £§±¶½ÅÆÇÊÏÐÑÒ×ØÙÝÞß } " + \NEWLINE + " \str_lowercase:n { ãæçéìðô÷øûþÿ } " + \NEWLINE + " \str_lowercase:n { ĂĘŁŊŐąěğŋşůż } " + \NEWLINE + " \str_lowercase:n { ΑΒΓΩαβγω } " + \NEWLINE + " \str_lowercase:n { АБВЉЇЯабвґџя } " + \NEWLINE + " \str_lowercase:n { ‰ } " + } + +\END diff --git a/testfiles/pl3str001.tlg b/testfiles/pl3str001.tlg new file mode 100644 index 0000000..a611a7a --- /dev/null +++ b/testfiles/pl3str001.tlg @@ -0,0 +1,38 @@ +This is a generated file for the l3build validation system. +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" +"^^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" +"ΑΒΓΩαβγω" +"АБВ^^d0^^89^^d0^^87Яабв^^d2^^91^^d1^^9fя" +"‰" +============================================================ +============================================================ +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" +"^^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" +"ΑΒΓΩαβγω" +"АБВ^^d0^^89^^d0^^87Яабв^^d2^^91^^d0^^8fя" +"‰" +============================================================ +============================================================ +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" +"^^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" +"ΑΒΓΩαβγω" +"АБВ^^d1^^99^^d1^^97Яабв^^d2^^91^^d1^^9fя" +"‰" +============================================================ diff --git a/testfiles/pl3str001.uptex.tlg b/testfiles/pl3str001.uptex.tlg new file mode 100644 index 0000000..d75f694 --- /dev/null +++ b/testfiles/pl3str001.uptex.tlg @@ -0,0 +1,35 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +============================================================ +TEST 1: tl_to_str +============================================================ +"ABCxyz+?" +"£§±¶½^^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" +"ΑΒΓΩαβγω" +"АБВЉЇЯабвґџя" +"‰" +============================================================ +============================================================ +TEST 2: uppercase +============================================================ +"ABCXYZ+?" +"£§±¶½^^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" +"ΑΒΓΩαβγω" +"АБВЉЇЯабвґџя" +"‰" +============================================================ +============================================================ +TEST 3: lowercase +============================================================ +"abcxyz+?" +"£§±¶½^^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.lvt b/testfiles/pl3text001.lvt new file mode 100644 index 0000000..7790b44 --- /dev/null +++ b/testfiles/pl3text001.lvt @@ -0,0 +1,71 @@ +% +% Copyright (c) 2022 Japanese TeX Development Community +% +\epTeXinputencoding utf8 + +\input{regression-test} +\documentclass{minimal} +\RequirePackage[enable-debug]{expl3} +\ExplSyntaxOn +\debug_on:n { check-declarations , deprecation , log-functions } +\ExplSyntaxOff + +\RequirePackage{plexpl3} + +\begin{document} + +\START +\ExplSyntaxOn + +\TESTEXP { expand } + { + \text_expand:n { ABCxyz+? } + \NEWLINE + \text_expand:n { £§±¶½ÅÆÇÊÏÐÑÒ×ØÙÝÞß } + \NEWLINE + \text_expand:n { ãæçéìðô÷øûþÿ } + \NEWLINE + \text_expand:n { ĂĘŁŊŐąěğŋşůż } + \NEWLINE + \text_expand:n { \cGrek{ΑΒΓΩαβγω} } + \NEWLINE + \text_expand:n { \cCyrl{АБВЉЇЯабвґџя} } + \NEWLINE + \text_expand:n { ‰ } + } + +\TESTEXP { uppercase } + { + \text_uppercase:n { ABCxyz+? } + \NEWLINE + \text_uppercase:n { £§±¶½ÅÆÇÊÏÐÑÒ×ØÙÝÞß } + \NEWLINE + \text_uppercase:n { ãæçéìðô÷øûþÿ } + \NEWLINE + \text_uppercase:n { ĂĘŁŊŐąěğŋşůż } + \NEWLINE + \text_uppercase:n { \cGrek{ΑΒΓΩαβγω} } + \NEWLINE + \text_uppercase:n { \cCyrl{АБВЉЇЯабвґџя} } + \NEWLINE + \text_uppercase:n { ‰ } + } + +\TESTEXP { lowercase } + { + \text_lowercase:n { ABCxyz+? } + \NEWLINE + \text_lowercase:n { £§±¶½ÅÆÇÊÏÐÑÒ×ØÙÝÞß } + \NEWLINE + \text_lowercase:n { ãæçéìðô÷øûþÿ } + \NEWLINE + \text_lowercase:n { ĂĘŁŊŐąěğŋşůż } + \NEWLINE + \text_lowercase:n { \cGrek{ΑΒΓΩαβγω} } + \NEWLINE + \text_lowercase:n { \cCyrl{АБВЉЇЯабвґџя} } + \NEWLINE + \text_lowercase:n { ‰ } + } + +\END diff --git a/testfiles/pl3text001.tlg b/testfiles/pl3text001.tlg new file mode 100644 index 0000000..142493e --- /dev/null +++ b/testfiles/pl3text001.tlg @@ -0,0 +1,38 @@ +This is a generated file for the l3build validation system. +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 +^^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 {ΑΒΓΩαβγω} +\cCyrl {АБВ^^d0^^89^^d0^^87Яабв^^d2^^91^^d1^^9fя} +‰ +============================================================ +============================================================ +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 +^^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 {ΑΒΓΩαβγω} +\cCyrl {АБВ^^d0^^89^^d0^^87Яабв^^d2^^91^^d0^^8fя} +‰ +============================================================ +============================================================ +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 +^^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 {ΑΒΓΩαβγω} +\cCyrl {АБВ^^d1^^99^^d1^^97Яабв^^d2^^91^^d1^^9fя} +‰ +============================================================ diff --git a/testfiles/pl3text001.uptex.tlg b/testfiles/pl3text001.uptex.tlg new file mode 100644 index 0000000..0e6106f --- /dev/null +++ b/testfiles/pl3text001.uptex.tlg @@ -0,0 +1,35 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +============================================================ +TEST 1: expand +============================================================ +ABCxyz+? +£§±¶½^^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 {ΑΒΓΩαβγω} +\cCyrl {АБВЉЇЯабвґџя} +‰ +============================================================ +============================================================ +TEST 2: uppercase +============================================================ +ABCXYZ+? +£§±¶½^^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 {ΑΒΓΩαβγω} +\cCyrl {АБВЉЇЯабвґџя} +‰ +============================================================ +============================================================ +TEST 3: lowercase +============================================================ +abcxyz+? +£§±¶½^^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 {ΑΒΓΩαβγω} +\cCyrl {АБВЉЇЯабвґџя} +‰ +============================================================