summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/uptexdir
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
committerKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
commitad547a6b5986815fda458221149728d9d9ab1d87 (patch)
tree16296910eb3eca724371474ea9aea3994dc69614 /Build/source/texk/web2c/uptexdir
parent947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff)
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/uptexdir')
-rw-r--r--Build/source/texk/web2c/uptexdir/COPYRIGHT26
-rw-r--r--Build/source/texk/web2c/uptexdir/COPYRIGHT.ja33
-rw-r--r--Build/source/texk/web2c/uptexdir/ChangeLog448
-rw-r--r--Build/source/texk/web2c/uptexdir/am/uptex.am228
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/gkhuge.test38
-rw-r--r--Build/source/texk/web2c/uptexdir/kanji.c542
-rw-r--r--Build/source/texk/web2c/uptexdir/kanji.h73
-rw-r--r--Build/source/texk/web2c/uptexdir/kanji_dump.c51
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/newjfm.test22
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/gkhuge.tex33
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/gkhugeng.err3
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/gkhugeng.tfmbin0 -> 133344 bytes
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/gkhugeok.tfmbin0 -> 121144 bytes
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/test_if.tex29
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/testnewu.pl130
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/testnewu.tfmbin0 -> 388 bytes
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/umin10.pl395
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/umin10.tfmbin0 -> 1300 bytes
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/unibib.aux4
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/unibib.bbl50
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/unibib.bib81
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/unibib.tex98
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/uparse.pl70
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/uparse.tfmbin0 -> 272 bytes
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/utmin10.pl287
-rw-r--r--Build/source/texk/web2c/uptexdir/tests/utmin10.tfmbin0 -> 960 bytes
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/uparse.test31
-rw-r--r--Build/source/texk/web2c/uptexdir/upbibtex.ch435
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/upbibtex.test15
-rw-r--r--Build/source/texk/web2c/uptexdir/updvitype.ch39
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/updvitype.test20
-rw-r--r--Build/source/texk/web2c/uptexdir/uppltotf.ch108
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/uppltotf.test10
-rw-r--r--Build/source/texk/web2c/uptexdir/uptex-m.ch1266
-rw-r--r--Build/source/texk/web2c/uptexdir/uptex.defines48
-rw-r--r--Build/source/texk/web2c/uptexdir/uptex_version.h1
-rw-r--r--Build/source/texk/web2c/uptexdir/uptexextra.c12
-rw-r--r--Build/source/texk/web2c/uptexdir/uptexextra.h25
-rw-r--r--Build/source/texk/web2c/uptexdir/uptftopl.ch94
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/uptftopl.test11
-rw-r--r--Build/source/texk/web2c/uptexdir/uptrip/texmf.cnf41
-rw-r--r--Build/source/texk/web2c/uptexdir/uptrip/uptrip.diffs621
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/uptriptest.test71
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/upver.test32
-rwxr-xr-xBuild/source/texk/web2c/uptexdir/yokotate.test23
45 files changed, 5544 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/uptexdir/COPYRIGHT b/Build/source/texk/web2c/uptexdir/COPYRIGHT
new file mode 100644
index 00000000000..a92f8732efd
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/COPYRIGHT
@@ -0,0 +1,26 @@
+Copyright (C) 2009 ASCII MEDIA WORKS.
+Copyright (C) 2007-2020 Takuji Tanaka
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. 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.
+3. Neither the name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/source/texk/web2c/uptexdir/COPYRIGHT.ja b/Build/source/texk/web2c/uptexdir/COPYRIGHT.ja
new file mode 100644
index 00000000000..44ab4156ed8
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/COPYRIGHT.ja
@@ -0,0 +1,33 @@
+(注) 以下は、英文の契約条項を日本語に翻訳したものである。日本語訳と英
+語表記の間に齟齬があった場合には、契約条件は英語表記による契約条項に従
+う。
+
+【著作権表示】
+Copyright (C) 2009 ASCII MEDIA WORKS.
+Copyright (C) 2007-2020 Takuji Tanaka
+All rights reserved.
+
+【契約条件】
+改変の有無にかかわらず、本ソフトウェアのソースコード及びバイナリーコー
+ド形式による再頒布及び使用は、次の契約条件の下に許諾される。
+1. ソースコードの再頒布に際しては、上記の【著作権表示】、この【契約条
+ 件】及び次の【免責条項】の表記を、引き続き維持して明記しなければな
+ らない。
+2. バイナリー形式による再頒布に際しては、上記の【著作権表示】、この
+ 【契約条件】及び次の【免責条項】を、再頒布に際し提供する説明書及び
+ その他の関連資料に改めて明記しなければならない。
+3. 特別な事前の書面による許諾がない限り、本ソフトウェアから派生した製
+ 品を推奨又は宣伝するために、著作権者名は使用してはならない。
+
+【免責条項】
+本ソフトウェアは、著作権者により、「現状有姿のまま(そのままの形で)」
+提供されるものであり、商品性又は特定目的への適合性に関する黙示的保証な
+ど、明示又は黙示の保証を問わず、いかなる保証をも行うものではない。
+いかなる理由によっても、また、契約責任、厳格責任又は(過失によるものを
+含む)不法行為責任を問わずどのような責任の理論によっても、著作権者は、
+いかなる場合も、本ソフトウェアを使用することにより発生する、あらゆる直
+接損害、間接損害、偶発損害、特別損害、懲罰的損害あるいは派生的損害(代
+替製品・代替サービスの調達、使用利益、データ又は収益に関する損失、営業
+中断による損失など)について何らの責任も負わない。これは、本ソフトウェ
+アを使用することにより、これらの損害が発生する可能性について、あらかじ
+め示唆されていた場合であっても同様である。
diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog
new file mode 100644
index 00000000000..b6db0953e71
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/ChangeLog
@@ -0,0 +1,448 @@
+2020-10-25 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.27.
+
+2020-10-25 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * upbibtex.ch:
+ Make is.kanji.str$ false for Latin, Cyrillic, Greek scripts
+ and CJK symbols.
+ * tests/unibib.{tex,bib,aux,bbl}: Test case.
+ https://github.com/texjporg/tex-jp-build/issues/109
+
+2020-08-29 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * updvitype.ch: Sync with the change of pdvitype.ch.
+
+2020-02-22 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.26.
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-13.0.0.txt Date: 2019-07-10, 19:06:00 GMT [KW]".
+ * COPYRIGHT, COPYRIGHT.ja:
+ Update copyright year.
+
+2019-12-10 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * am/uptex.am (uptex_cppflags): append $(ZLIB_INCLUDES).
+ (uptex_ldadd): append $(ZLIB_LIBS.)
+ (uptex_dependencies): append $(ZLIB_DEPEND)
+ (uptex_web_srcs): append zlib-fmt.ch.
+ * kanji.h: #include <zlib.h>
+ (dump_kanji, undump_kanji): arg is now type gzFile instead of FILE *.
+ * kanji_dump.c (pTeX) [!upTeX]: #define if not already.
+ (dump_kanji, undump_kanji): chang arg type.
+
+2019-05-28 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * am/uptex.am: Add a new test.
+ * upver.test: New test file for version number consistency.
+
+2019-05-25 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch:
+ Correct upTeX_revision ".25", upTeX_version_string "-u1.25".
+
+2019-05-06 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.25.
+ * kanji.c, kanji.h:
+ Fix bug of kcatcode at Fullwidth ASCII variants and
+ Halfwidth Katakana variants from Yusuke Terada san:
+ https://github.com/texjporg/tex-jp-build/pull/79
+ Set default internal encoding EUC/SJIS if a command name is
+ with prefix of "p" or "ep", intending to be compatible with
+ pTeX family (ptex, eptex, pbibtex, pdvitype, ppltotf, ptftopl)
+ (experimental).
+
+2019-05-06 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch:
+ Make appropreate comparison of U+0100 by \if.
+ https://github.com/texjporg/tex-jp-build/issues/68
+ * tests/test_if.tex: Test case.
+
+2019-02-23 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.24.
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-12.0.0.txt Date: 2018-07-30, 19:40:00 GMT [KW]".
+ Set kcatcode of "Latin Extended-B",
+ "Latin Extended Additional" 15 (not_cjk).
+ * COPYRIGHT, COPYRIGHT.ja:
+ Update copyright year.
+
+2019-02-03 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * kanji.h: Use fputs2() to benefit from kanji encoding conversion.
+ https://github.com/texjporg/tex-jp-build/issues/34
+
+2019-01-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * kanji_dump.c: Throw a warning when kanji internal encoding
+ is incompatible with the preloaded format.
+ https://github.com/texjporg/tex-jp-build/issues/55
+
+2018-09-16 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * upbibtex.ch: Fix bug of substring$
+ from Takashi Sakai san:
+ https://github.com/texjporg/tex-jp-build/issues/64
+ https://github.com/texjporg/tex-jp-build/pull/66
+
+2018-09-09 Karl Berry <karl@tug.org>
+
+ * uptriptest.test: LC_ALL=LANGUAGE=C.
+
+2018-09-03 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * gkhuge.test: Export TEXMFCNF beforehand, instead of setting
+ it at each one-line command execution. This should avoid test
+ failure on some platforms.
+ http://tug.org/pipermail/tlbuild/2018q3/004244.html
+ http://tug.org/pipermail/tlbuild/2018q3/004250.html
+
+2018-08-18 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * gkhuge.test: More strict test.
+ * tests/gkhugeng.err: Added.
+ * am/uptex.am: Adjust.
+
+2018-06-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * ksnji.h, kanji.c, uptex.defines:
+ remove sjisterminal (w32 only).
+
+2018-02-25 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-10.0.0.txt Date: 2017-04-12, 17:30:00 GMT [KW]".
+ Exclude Latin-1 letters from "Latin-1 Supplement" block.
+ Set kcatcode of "Latin-1 letters", "Latin Extended-A" 15 (not_cjk).
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.23.
+ * COPYRIGHT, COPYRIGHT.ja:
+ Update copyright year.
+
+2018-02-02 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * uppltotf.ch: Adapt to changes in ptexdir/ppltotf.ch.
+ * am/uptex.am: Add new tests.
+ * gkhuge.test, tests/gkhuge.tex, tests/gkhuge{ok,ng}.tfm,
+ uparse.test, tests/uparse.{pl,tfm} : New test files.
+
+2018-01-31 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch: Adapt to changes in ptexdir/ptex-base.ch (disp_node).
+
+2018-01-27 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * uppltotf.ch, uptftopl.ch, uptex-m.ch: Adapt to the new JFM spec.
+ * am/uptex.am: Add new tests.
+ * newjfm.test, tests/testnewu.{pl,tfm}: New test files.
+
+2018-01-21 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * yokotate.test, tests/{,u}[,t]min10.[pl,tfm], am/uptex.am:
+ More suitable tests.
+
+2018-01-21 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch: New primitives: \uptexversion and \uptexrevision.
+
+2017-04-24 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch: Adapt to changes in ptexdir/ptex-base.ch (p\TeX -> \pTeX).
+
+2017-04-09 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch: Fix a bug on a UTF-8 sequence at end of a line
+ when \endlinechar=-1.
+
+2017-01-15 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-9.0.0.txt Date: 2016-02-05, 23:48:00 GMT [KW]".
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.22.
+ * COPYRIGHT, COPYRIGHT.ja:
+ Update copyright name and year.
+ Rename from COPYRIGHT.utf8 to COPYRIGHT.ja.
+
+2017-01-14 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * upbibtex.ch, kanji.h: Fix bug on "substring$".
+ Thanks to Takeda Shiro san.
+
+2016-12-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch:
+ Use "issue@texjp.org" as bug_email in usagehelp().
+
+2016-12-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * uptexextra.h: Use "issue@texjp.org" as BUG_ADDRESS.
+
+2016-02-20 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-8.0.0.txt Date: 2014-11-10, 23:04:00 GMT [KW]".
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.21.
+ * COPYRIGHT.utf8:
+ Rename from COPYRIGHT.jis and convert encoding from ISO-2022-JP
+ to UTF-8.
+
+2015-09-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptriptest.test: Also check tripos.tex.
+
+2015-07-10 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptriptest (removed): Renamed ...
+ * uptriptest.test (new): ... into this.
+ * am/uptex.am: Better dependencies for 'make check'.
+
+2015-06-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am: Use $(tie_c) and $(tie_m).
+
+2015-04-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptrip/uptrip.diffs: Updated for TL 2015.
+
+2014-12-29 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
+
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-7.0.0.txt Date: 2014-04-03, 23:23:00 GMT [RP, KW]".
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.20.
+
+2014-12-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptriptest: Complain early if trip.fmt is not created.
+ Inspired by report from vvv, tlbuild 14 Jun 2011 10:25:47.
+
+2014-05-02 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptrip/uptrip.diffs: Updated for TL14.
+
+2014-01-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptrip/uptrip.diffs: Updated for upTeX 3.14159265.
+
+2014-01-20 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ TeX tuneup of 2014.
+ * uptex-m.ch: Adapt to TeX Version 3.14159265.
+ * uppltotf.ch: Adapt to PLtoTF Version 3.6.
+ * uptftopl.ch: Adapt to TFtoPL Version 3.3.
+
+2014-01-17 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptrip.test (removed): Renamed ...
+ * uptriptest (new): ... into this.
+ * am/uptex.am: Adapted.
+
+2013-12-31 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * tests/min10.pl, tests/min10.pl: Don't write SEVENBITSAFEFLAG
+ for JFM (yoko or tate) fonts.
+
+2013-12-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uppltotf.ch, tests/[t]min10.pl: Drop useless extra space.
+ * yokotate.test: Simplified.
+
+2013-12-17 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * yokotate.test (new): Shell scripts to test upPLtoTF/upTFtoPL
+ with yoko and tate fonts.
+ * tests/[t]min10.{pl,tfm} (new): Data for yokotate.test.
+ * am/uptex.am: Add the new tests.
+
+2013-08-12 TANAKA Takuji <KXD02663@nifty.ne.jp>
+
+ * kanji.h, uptex.defines: Allow file names with 0x5c
+ in (e)pTeX on Windows.
+
+2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am: upbibtex-web2c also depends on web2c/cvtbib.sed.
+
+2013-06-05 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * kanji.h: Avoid redefinition of KANJI.
+
+2013-04-09 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptrip/uptrip.diffs: Update for TL 2013.
+
+2013-03-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am: Better rule for uptex_version.h.
+
+2013-02-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am, upbibtex.test, updvitype.test, uppltotf.test,
+ uptftopl.test: Change directory for temporary files from tests
+ to uptests.
+
+2013-01-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am, uptrip.test: Enable parallel-tests.
+
+2013-01-04 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch: \xkanjiskip around math_node etc.
+
+2012-12-16 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am (uptex_version.h): Enable silent rules.
+
+2012-08-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * kanji.c (init_default_kanji): Set defaults before testing
+ PTEX_KANJI_ENC from the environment.
+ * kanji.c: All programs use init_default_kanji("utf8","uptex").
+
+2012-08-13 TANAKA Takuji <KXD02663@nifty.ne.jp>
+
+ * uptex-m.ch, upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch,
+ uptex_version.h: upTeX version u1.11.
+
+2012-08-02 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am: Clarify *tex_version.h dependencies.
+
+2012-07-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am: Distribute uptex_version.h.
+ * uptexextra.h: Use ../ptexdir/ptex_version.h.
+
+2012-07-15 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * upbibtex.ch, updvitype.ch, uppltotf.ch, uptftopl.ch:
+ Adapt to the use my_name.
+
+2012-07-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * uptexextra.c: Must #define DLLPROC before reading uptexd.h.
+
+2012-06-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptexextra.c [W32TeX]: #define DLLPROC for uptex.dll.
+
+2012-05-22 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * updvitype.test: Cope with spaces in paths returned by
+ kpsewhich.
+
+2012-05-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptex-m.ch: Restore the 'unnecessary and seemingly wrong'
+ changes; they are required to show the error context.
+ * uptrip/uptrip.diffs: Adapted.
+
+2012-04-29 Takuji Tanaka <KXD02663@nifty.ne.jp>
+
+ * uptex-m.ch, uppltotf.ch, uptftopl.ch, updvitype.ch, upbibtex.ch:
+ Update upTeX version number.
+
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-6.1.0.txt Date: 2011-06-14, 18:26:00 GMT [KW, LI]".
+
+2012-03-11 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * uptex-m.ch: remove unnecessary and seemingly wrong changes
+
+2012-03-08 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * uptex-m.ch: fix a long-remained bug in show_context.
+
+2012-03-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Avoid 'differ in signedness' warnings.
+ * uppltotf.ch: Use ustringcast(buffer).
+ * uptex-m.ch: Use ustringcast for buffer and str_pool.
+
+2012-01-15 Takuji Tanaka <KXD02663@nifty.ne.jp>
+
+ * uptex-m.ch, uppltotf.ch, uptftopl.ch, updvitype.ch, upbibtex.ch:
+ Update upTeX version number.
+
+ * uptex-m.ch, kanji.c:
+ Update reference of Unicode blocks to
+ "Blocks-6.0.0.txt Date: 2010-06-04, 11:12:00 PDT [KW]".
+
+2012-01-07 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * kanji.h: revert wrt init_kanji (from TANAKA Takuji-san).
+
+2012-01-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * kanji.h: enable -kanji option in updvitype.
+ (patch from TANAKA Takuji-san).
+
+2011-12-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * uptex-m.ch, kanji.[ch]: Drop unused param2 of check_kanji().
+
+2011-12-19 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * uptex-m.ch, uptex.defines, kanji.[ch], uppltotf.ch,
+ uppltotf.ch: Avoid Segmentation fault for japanese \catcode
+ or \kcatcode.
+
+2011-12-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * uptex-m.ch: change min_halfword because the ConTeXt with
+ euptex falls into an infinite loop if an Overfull \hbox error occurs.
+
+2011-11-25 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * am/uptex.am (uppltotf_CPPFLAGS): Replace '-DDHEX_CHAR_CODE'
+ by '-DPRESERVE_PUTC'. Mail [ptex:00311] from TANAKA Takuji.
+
+ * am/uptex.am (upbibtex_CPPFLAGS, uptftopl_CPPFLAGS): Drop the
+ useless '-DDHEX_CHAR_CODE'.
+ (updvitype_CPPFLAGS): Replace '-DDHEX_CHAR_CODE' by
+ '-DHEX_CHAR_CODE'.
+
+2011-09-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * updvitype.ch: Use const stringcast for get_enc_string().
+
+2011-09-05 Takuji Tanaka <KXD02663@nifty.ne.jp>
+
+ * updvitype.ch: show encoding in the banner.
+
+2011-08-29 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * kanji.h, uptex.defines: Remove setptexencuptex.
+ * upbibtex.ch: Use nil, not 0 as arg of set_enc_string().
+
+ * uptex-m.ch: Add dump_kanji and undump_kanji.
+ * uptex.defines: Add dumpkanji and undumpkanji.
+ * kanji.c: Factor out init_kanji().
+ * kanji_dump.c: New file for dumping/undumping kanji encoding.
+ * kanji.h: Add init_kanji(), dump_kanji(), and undump_kanji().
+ * am/uptex.am (libukanji_a_SOURCES): Add kanji_dump.c.
+
+2011-08-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Imported upTeX into TeX Live, based on the W32TeX version
+ from Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+ and on the TL patches in tlsvn23478-uptex-1108111825.tar.xz
+ from Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>.
diff --git a/Build/source/texk/web2c/uptexdir/am/uptex.am b/Build/source/texk/web2c/uptexdir/am/uptex.am
new file mode 100644
index 00000000000..8db4c4b8dcf
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/am/uptex.am
@@ -0,0 +1,228 @@
+## texk/web2c/uptexdir/am/uptex.am: Makefile fragment for upTeX.
+##
+## Copyright 2016-2021 Karl Berry <tex-live@tug.org>
+## Copyright 2011-2015 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+
+uptex_cppflags = $(PTEXENC_INCLUDES) $(AM_CPPFLAGS) $(ZLIB_INCLUDES)
+uptex_ldadd = libukanji.a $(pproglib) $(PTEXENC_LIBS) $(LDADD) $(ZLIB_LIBS)
+uptex_dependencies = libukanji.a $(pproglib) $(PTEXENC_DEPEND) $(ZLIB_DEPEND) $(default_dependencies)
+up_tangle = $(tangle_silent)WEBINPUTS=.:$(srcdir)/uptexdir:$(srcdir) $(buildenv) $(TANGLE)
+
+upweb_programs = upbibtex updvitype uppltotf uptftopl
+
+## libukanji.a for upTeX and e-upTeX
+##
+EXTRA_LIBRARIES += libukanji.a
+libukanji_a_SOURCES = uptexdir/kanji.c uptexdir/kanji.h uptexdir/kanji_dump.c
+libukanji_a_CPPFLAGS = $(uptex_cppflags)
+
+## upTeX
+##
+if UPTEX
+bin_PROGRAMS += uptex
+endif UPTEX
+if UPWEB
+bin_PROGRAMS += $(upweb_programs)
+endif UPWEB
+EXTRA_PROGRAMS += uptex $(upweb_programs)
+
+uptex_CPPFLAGS = $(uptex_cppflags)
+
+# With --enable-ipc, upTeX may need to link with -lsocket.
+uptex_LDADD = $(uptex_ldadd) $(ipc_socketlibs)
+uptex_DEPENDENCIES = $(uptex_dependencies)
+
+# upTeX C sources
+uptex_c_h = uptexini.c uptex0.c uptexcoerce.h uptexd.h
+nodist_uptex_SOURCES = $(uptex_c_h) uptex-pool.c
+dist_uptex_SOURCES = uptexdir/uptexextra.c uptexdir/uptexextra.h uptexdir/uptex_version.h
+
+# We must create uptexd.h and uptexdir/uptex_version.h before building the uptex_OBJECTS.
+uptex_prereq = uptexd.h ptexdir/ptex_version.h uptexdir/uptex_version.h
+$(uptex_OBJECTS): $(uptex_prereq)
+
+$(uptex_c_h): uptex-web2c
+ @$(web2c) uptex
+uptex-web2c: uptex.p $(web2c_texmf) uptexdir/uptex.defines
+ @$(web2c) uptex
+
+uptex-pool.c: uptex.pool uptexd.h $(makecpool_stamp)
+ $(makecpool) uptex >$@ || rm -f $@
+
+# Tangling upTeX
+uptex.p uptex.pool: uptex-tangle
+ @$(texmf_tangle) uptex uptex
+uptex-tangle: tangle$(EXEEXT) uptex.web uptex.ch tangle-sh
+ @$(texmf_tangle) uptex uptex
+
+# Extract uptex version
+$(srcdir)/uptexdir/uptex_version.h: @MAINTAINER_MODE_TRUE@ uptexdir/uptex-m.ch
+ $(AM_V_GEN)grep '^@d upTeX_version_string==' $(srcdir)/uptexdir/uptex-m.ch \
+ | sed "s/^.*'-/#define UPTEX_VERSION \"/;s/'.*$$/\"/" >$@
+
+# Generate uptex.web
+uptex.web: tie$(EXEEXT) $(uptex_web_srcs)
+ $(tie_m) $(uptex_web_srcs)
+uptex_web_srcs = \
+ tex.web \
+ tex.ch \
+ tracingstacklevels.ch \
+ zlib-fmt.ch
+
+# Generate uptex.ch
+uptex.ch: tie$(EXEEXT) uptex.web $(uptex_ch_srcs)
+ $(tie_c) uptex.web $(uptex_ch_srcs)
+uptex_ch_srcs = \
+ ptexdir/ptex-base.ch \
+ uptexdir/uptex-m.ch \
+ $(uptex_ch_synctex) \
+ tex-binpool.ch
+
+EXTRA_DIST += $(uptex_web_srcs) $(uptex_ch_srcs) uptexdir/uptex.defines
+
+DISTCLEANFILES += $(nodist_uptex_SOURCES) uptex.web uptex.ch uptex-web2c \
+ uptex.p uptex.pool uptex-tangle
+
+## upBibTeX
+##
+nodist_upbibtex_SOURCES = upbibtex.c upbibtex.h
+upbibtex_SOURCES = uptexdir/kanji.h
+upbibtex_CPPFLAGS = $(uptex_cppflags)
+upbibtex_LDADD = $(uptex_ldadd)
+upbibtex_DEPENDENCIES = $(uptex_dependencies)
+upbibtex.c upbibtex.h: upbibtex-web2c
+ @$(web2c) upbibtex
+upbibtex-web2c: upbibtex.p $(web2c_depend) uptexdir/uptex.defines web2c/cvtbib.sed
+ @$(web2c) upbibtex
+upbibtex.p: tangle$(EXEEXT) upbibtex.web uptexdir/upbibtex.ch
+ $(up_tangle) upbibtex upbibtex
+upbibtex.web: tie$(EXEEXT) bibtex.web bibtex.ch ptexdir/pbibtex.ch
+ $(tie_m) bibtex.web bibtex.ch ptexdir/pbibtex.ch
+EXTRA_DIST += ptexdir/pbibtex.ch uptexdir/upbibtex.ch
+
+## upDVItype
+##
+nodist_updvitype_SOURCES = updvitype.c updvitype.h
+updvitype_SOURCES = uptexdir/kanji.h
+updvitype_CPPFLAGS = $(uptex_cppflags) -DHEX_CHAR_CODE
+updvitype_LDADD = $(uptex_ldadd)
+updvitype_DEPENDENCIES = $(uptex_dependencies)
+updvitype.c updvitype.h: updvitype-web2c
+ @$(web2c) updvitype
+updvitype-web2c: updvitype.p $(web2c_depend) uptexdir/uptex.defines
+ @$(web2c) updvitype
+updvitype.p: tangle$(EXEEXT) updvitype.web uptexdir/updvitype.ch
+ $(up_tangle) updvitype updvitype
+updvitype.web: tie$(EXEEXT) dvitype.web dvitype.ch ptexdir/pdvitype.ch
+ $(tie_m) dvitype.web dvitype.ch ptexdir/pdvitype.ch
+EXTRA_DIST += ptexdir/pdvitype.ch uptexdir/updvitype.ch
+
+## upPLtoTF
+##
+nodist_uppltotf_SOURCES = uppltotf.c uppltotf.h
+uppltotf_SOURCES = uptexdir/kanji.h
+uppltotf_CPPFLAGS = $(uptex_cppflags) -DPRESERVE_PUTC
+uppltotf_LDADD = $(uptex_ldadd)
+uppltotf_DEPENDENCIES = $(uptex_dependencies)
+uppltotf.c uppltotf.h: uppltotf-web2c
+ @$(web2c) uppltotf
+uppltotf-web2c: uppltotf.p $(web2c_depend) uptexdir/uptex.defines
+ @$(web2c) uppltotf
+uppltotf.p: tangle$(EXEEXT) uppltotf.web uptexdir/uppltotf.ch
+ $(up_tangle) uppltotf uppltotf
+uppltotf.web: tie$(EXEEXT) pltotf.web pltotf.ch ptexdir/ppltotf.ch
+ $(tie_m) pltotf.web pltotf.ch ptexdir/ppltotf.ch
+EXTRA_DIST += ptexdir/ppltotf.ch uptexdir/uppltotf.ch
+
+## upTFtoPL
+##
+nodist_uptftopl_SOURCES = uptftopl.c uptftopl.h
+uptftopl_SOURCES = uptexdir/kanji.h
+uptftopl_CPPFLAGS = $(uptex_cppflags)
+uptftopl_LDADD = $(uptex_ldadd)
+uptftopl_DEPENDENCIES = $(uptex_dependencies)
+uptftopl.c uptftopl.h: uptftopl-web2c
+ @$(web2c) uptftopl
+uptftopl-web2c: uptftopl.p $(web2c_depend) uptexdir/uptex.defines
+ @$(web2c) uptftopl
+uptftopl.p: tangle$(EXEEXT) uptftopl.web uptexdir/uptftopl.ch
+ $(up_tangle) uptftopl uptftopl
+uptftopl.web: tie$(EXEEXT) tftopl.web tftopl.ch ptexdir/ptftopl.ch
+ $(tie_m) tftopl.web tftopl.ch ptexdir/ptftopl.ch
+EXTRA_DIST += ptexdir/ptftopl.ch uptexdir/uptftopl.ch
+
+##
+EXTRA_DIST += \
+ uptexdir/COPYRIGHT \
+ uptexdir/COPYRIGHT.jis \
+ uptexdir/ChangeLog
+
+# upTeX Tests
+uptex_tests = uptexdir/uptriptest.test uptexdir/upver.test
+uptexdir/uptriptest.log: uptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
+uptexdir/upver.log: uptex$(EXEEXT)
+upweb_tests = \
+ uptexdir/upbibtex.test \
+ uptexdir/updvitype.test \
+ uptexdir/uppltotf.test \
+ uptexdir/uptftopl.test \
+ uptexdir/yokotate.test \
+ uptexdir/newjfm.test \
+ uptexdir/uparse.test \
+ uptexdir/gkhuge.test
+uptexdir/upbibtex.log: upbibtex$(EXEEXT)
+uptexdir/updvitype.log: updvitype$(EXEEXT)
+uptexdir/uppltotf.log: uppltotf$(EXEEXT)
+uptexdir/uptftopl.log: uptftopl$(EXEEXT)
+uptexdir/yokotate.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
+uptexdir/newjfm.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
+uptexdir/uparse.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
+uptexdir/gkhuge.log: uppltotf$(EXEEXT) uptftopl$(EXEEXT)
+
+EXTRA_DIST += $(uptex_tests) $(upweb_tests)
+DISTCLEANFILES += $(upweb_programs:=.c) $(upweb_programs:=.h) \
+ $(upweb_programs:=.p) $(upweb_programs:=-web2c) $(upweb_programs:=.web)
+
+if UPTEX
+TESTS += $(uptex_tests)
+TRIPTRAP += uptrip.diffs
+TRIPTRAP_CLEAN += uptrip-clean
+endif UPTEX
+if UPWEB
+TESTS += $(upweb_tests)
+endif UPWEB
+
+## Test data and results
+##
+## uptexdir/upbibtex.test
+DISTCLEANFILES += uptests/xexampl.aux uptests/xexampl.bbl uptests/xexampl.blg
+## uptexdir/updvitype.test
+DISTCLEANFILES += uptests/xstory.dvityp uptests/xpagenum.typ
+## uptexdir/uppltotf.test
+DISTCLEANFILES += uptests/xcmr10.tfm
+## uptexdir/uptftopl.test
+DISTCLEANFILES += uptests/xcmr10.pl
+## uptexdir/yokotate.test
+EXTRA_DIST += uptexdir/tests/umin10.pl uptexdir/tests/umin10.tfm
+EXTRA_DIST += uptexdir/tests/utmin10.pl uptexdir/tests/utmin10.tfm
+DISTCLEANFILES += uptests/x*min10.*
+## uptexdir/newjfm.test
+EXTRA_DIST += uptexdir/tests/testnewu.pl uptexdir/tests/testnewu.tfm
+DISTCLEANFILES += uptests/xtestnewu.*
+## uptexdir/uparse.test
+EXTRA_DIST += uptexdir/tests/uparse.pl uptexdir/tests/uparse.tfm
+DISTCLEANFILES += uptests/xuparse.* uptests/yuparse.*
+## uptexdir/gkhuge.test
+EXTRA_DIST += uptexdir/tests/gkhugeok.tfm uptexdir/tests/gkhugeng.tfm uptexdir/tests/gkhugeng.err
+DISTCLEANFILES += uptests/ygkhuge*.*
+## uptexdir/uptriptest
+EXTRA_DIST += uptexdir/uptrip/uptrip.diffs uptexdir/uptrip/texmf.cnf
+uptrip.diffs: uptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
+ $(triptrap_diffs) $@
+.PHONY: uptrip-clean
+uptrip-clean:
+ rm -rf uptripdir
+
+DISTCLEANFILES += uptrip.diffs
+
diff --git a/Build/source/texk/web2c/uptexdir/gkhuge.test b/Build/source/texk/web2c/uptexdir/gkhuge.test
new file mode 100755
index 00000000000..d85c8d238dd
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/gkhuge.test
@@ -0,0 +1,38 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2018 Karl Berry <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+TEXMFCNF=$srcdir/../kpathsea
+export TEXMFCNF
+
+# Test inputs
+testdir=$srcdir/uptexdir/tests
+
+# Testing upPLtoTF/upTFtoPL for huge GLUEKERN table
+# with rearrangement.
+for font in gkhugeok; do
+
+ # This test is constructed as a cycle, since JPL source
+ # of gkhugeok.tfm is so large.
+ ./uptftopl -verbose $testdir/$font.tfm uptests/y$font.pl && \
+ ./uppltotf -verbose uptests/y$font.pl uptests/y$font.tfm && \
+ cmp $testdir/$font.tfm uptests/y$font.tfm && echo || exit 1
+
+done
+
+for font in gkhugeng; do
+
+ # Fifth byte of the JFM (= lf; length of the whole file)
+ # must not exceed 2^{15}-1; check that and exit with an
+ # error message, instead of trying to allocate too much.
+ # The invalid gkhugeng.tfm was erroneously created before
+ # web2c/pltotf.ch change 2017-09-10, due to overflow
+ ./uptftopl $testdir/$font.tfm uptests/y$font.pl \
+ 2>uptests/y$font.err && exit 1 || echo
+ diff $testdir/$font.err uptests/y$font.err && echo || exit 1
+
+done
+
diff --git a/Build/source/texk/web2c/uptexdir/kanji.c b/Build/source/texk/web2c/uptexdir/kanji.c
new file mode 100644
index 00000000000..1149c838908
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/kanji.c
@@ -0,0 +1,542 @@
+/*
+ * KANJI Code conversion routines.
+ * (for upTeX and e-upTeX)
+ */
+
+#include "kanji.h"
+
+#define CS_TOKEN_FLAG 0x1FFFFFFF
+#define CJK_CHAR_LIMIT 0x1000000
+#define CJK_TOKEN_FLAG 0xFFFFFF
+#define KCAT_KANJI 16
+#define KCAT_HANGUL 19
+
+/* TOKEN */
+boolean check_kanji (integer c)
+{
+ if (c >= CS_TOKEN_FLAG) return false;
+ else if (!(XXHi(c)>=KCAT_KANJI && XXHi(c)<=KCAT_HANGUL)) return false;
+ else return is_char_kanji(c);
+}
+
+boolean is_char_ascii(integer c)
+{
+ return (0 <= c && c < 0x100);
+}
+
+boolean is_char_kanji(integer c)
+{
+ if (is_internalUPTEX())
+ return (c >= 0);
+ else
+ return iskanji1(Hi(c)) && iskanji2(Lo(c));
+}
+
+boolean ismultiprn(integer c)
+{
+ int i, j;
+
+ for (i=2; i<=4; i++) for (j=1; j<=i; j++) {
+ if (ismultichr(i,j,c)) return true;
+ }
+ return false;
+}
+
+integer calc_pos(integer c)
+{
+ unsigned char c1, c2;
+
+ if(c>=0 && c<=255) return(c);
+ c1 = Hi(c);
+ c2 = Lo(c);
+
+ c1 = (c1 % 4) * 64; /* c1 = 0, 64, 128, 192 */
+ c2 = c2 % 64; /* c2 = 0..63 */
+ return(c1 + c2); /* ret = 0..255 */
+}
+
+/* Ref. http://www.unicode.org/Public/UNIDATA/Blocks.txt */
+/* # Blocks-13.0.0.txt */
+/* # Date: 2019-07-10, 19:06:00 GMT [KW] */
+static long ucs_range[]={
+ 0x0000, /* Basic Latin */ /* 0x00 */
+ 0x0080, /* Latin-1 Supplement */
+ 0x0100, /* Latin Extended-A */
+ 0x0180, /* Latin Extended-B */
+ 0x0250, /* IPA Extensions */
+ 0x02B0, /* Spacing Modifier Letters */
+ 0x0300, /* Combining Diacritical Marks */
+ 0x0370, /* Greek and Coptic */
+ 0x0400, /* Cyrillic */
+ 0x0500, /* Cyrillic Supplement */
+ 0x0530, /* Armenian */
+ 0x0590, /* Hebrew */
+ 0x0600, /* Arabic */
+ 0x0700, /* Syriac */
+ 0x0750, /* Arabic Supplement */
+ 0x0780, /* Thaana */
+ 0x07C0, /* NKo */ /* 0x10 */
+ 0x0800, /* Samaritan */
+ 0x0840, /* Mandaic */
+ 0x0860, /* Syriac Supplement */
+ 0x08A0, /* Arabic Extended-A */
+ 0x0900, /* Devanagari */
+ 0x0980, /* Bengali */
+ 0x0A00, /* Gurmukhi */
+ 0x0A80, /* Gujarati */
+ 0x0B00, /* Oriya */
+ 0x0B80, /* Tamil */
+ 0x0C00, /* Telugu */
+ 0x0C80, /* Kannada */
+ 0x0D00, /* Malayalam */
+ 0x0D80, /* Sinhala */
+ 0x0E00, /* Thai */
+ 0x0E80, /* Lao */ /* 0x20 */
+ 0x0F00, /* Tibetan */
+ 0x1000, /* Myanmar */
+ 0x10A0, /* Georgian */
+ 0x1100, /* Hangul Jamo */
+ 0x1200, /* Ethiopic */
+ 0x1380, /* Ethiopic Supplement */
+ 0x13A0, /* Cherokee */
+ 0x1400, /* Unified Canadian Aboriginal Syllabics */
+ 0x1680, /* Ogham */
+ 0x16A0, /* Runic */
+ 0x1700, /* Tagalog */
+ 0x1720, /* Hanunoo */
+ 0x1740, /* Buhid */
+ 0x1760, /* Tagbanwa */
+ 0x1780, /* Khmer */
+ 0x1800, /* Mongolian */ /* 0x30 */
+ 0x18B0, /* Unified Canadian Aboriginal Syllabics Extended */
+ 0x1900, /* Limbu */
+ 0x1950, /* Tai Le */
+ 0x1980, /* New Tai Lue */
+ 0x19E0, /* Khmer Symbols */
+ 0x1A00, /* Buginese */
+ 0x1A20, /* Tai Tham */
+ 0x1AB0, /* Combining Diacritical Marks Extended */
+ 0x1B00, /* Balinese */
+ 0x1B80, /* Sundanese */
+ 0x1BC0, /* Batak */
+ 0x1C00, /* Lepcha */
+ 0x1C50, /* Ol Chiki */
+ 0x1C80, /* Cyrillic Extended-C */
+ 0x1C90, /* Georgian Extended */
+ 0x1CC0, /* Sundanese Supplement */ /* 0x40 */
+ 0x1CD0, /* Vedic Extensions */
+ 0x1D00, /* Phonetic Extensions */
+ 0x1D80, /* Phonetic Extensions Supplement */
+ 0x1DC0, /* Combining Diacritical Marks Supplement */
+ 0x1E00, /* Latin Extended Additional */
+ 0x1F00, /* Greek Extended */
+ 0x2000, /* General Punctuation */
+ 0x2070, /* Superscripts and Subscripts */
+ 0x20A0, /* Currency Symbols */
+ 0x20D0, /* Combining Diacritical Marks for Symbols */
+ 0x2100, /* Letterlike Symbols */
+ 0x2150, /* Number Forms */
+ 0x2190, /* Arrows */
+ 0x2200, /* Mathematical Operators */
+ 0x2300, /* Miscellaneous Technical */
+ 0x2400, /* Control Pictures */ /* 0x50 */
+ 0x2440, /* Optical Character Recognition */
+ 0x2460, /* Enclosed Alphanumerics */
+ 0x2500, /* Box Drawing */
+ 0x2580, /* Block Elements */
+ 0x25A0, /* Geometric Shapes */
+ 0x2600, /* Miscellaneous Symbols */
+ 0x2700, /* Dingbats */
+ 0x27C0, /* Miscellaneous Mathematical Symbols-A */
+ 0x27F0, /* Supplemental Arrows-A */
+ 0x2800, /* Braille Patterns */
+ 0x2900, /* Supplemental Arrows-B */
+ 0x2980, /* Miscellaneous Mathematical Symbols-B */
+ 0x2A00, /* Supplemental Mathematical Operators */
+ 0x2B00, /* Miscellaneous Symbols and Arrows */
+ 0x2C00, /* Glagolitic */
+ 0x2C60, /* Latin Extended-C */ /* 0x60 */
+ 0x2C80, /* Coptic */
+ 0x2D00, /* Georgian Supplement */
+ 0x2D30, /* Tifinagh */
+ 0x2D80, /* Ethiopic Extended */
+ 0x2DE0, /* Cyrillic Extended-A */
+ 0x2E00, /* Supplemental Punctuation */
+ 0x2E80, /* CJK Radicals Supplement */
+ 0x2F00, /* Kangxi Radicals */
+ 0x2FF0, /* Ideographic Description Characters */
+ 0x3000, /* CJK Symbols and Punctuation */
+ 0x3040, /* Hiragana */
+ 0x30A0, /* Katakana */
+ 0x3100, /* Bopomofo */
+ 0x3130, /* Hangul Compatibility Jamo */
+ 0x3190, /* Kanbun */
+ 0x31A0, /* Bopomofo Extended */ /* 0x70 */
+ 0x31C0, /* CJK Strokes */
+ 0x31F0, /* Katakana Phonetic Extensions */
+ 0x3200, /* Enclosed CJK Letters and Months */
+ 0x3300, /* CJK Compatibility */
+ 0x3400, /* CJK Unified Ideographs Extension A */
+ 0x4DC0, /* Yijing Hexagram Symbols */
+ 0x4E00, /* CJK Unified Ideographs */
+ 0xA000, /* Yi Syllables */
+ 0xA490, /* Yi Radicals */
+ 0xA4D0, /* Lisu */
+ 0xA500, /* Vai */
+ 0xA640, /* Cyrillic Extended-B */
+ 0xA6A0, /* Bamum */
+ 0xA700, /* Modifier Tone Letters */
+ 0xA720, /* Latin Extended-D */
+ 0xA800, /* Syloti Nagri */ /* 0x80 */
+ 0xA830, /* Common Indic Number Forms */
+ 0xA840, /* Phags-pa */
+ 0xA880, /* Saurashtra */
+ 0xA8E0, /* Devanagari Extended */
+ 0xA900, /* Kayah Li */
+ 0xA930, /* Rejang */
+ 0xA960, /* Hangul Jamo Extended-A */
+ 0xA980, /* Javanese */
+ 0xA9E0, /* Myanmar Extended-B */
+ 0xAA00, /* Cham */
+ 0xAA60, /* Myanmar Extended-A */
+ 0xAA80, /* Tai Viet */
+ 0xAAE0, /* Meetei Mayek Extensions */
+ 0xAB00, /* Ethiopic Extended-A */
+ 0xAB30, /* Latin Extended-E */
+ 0xAB70, /* Cherokee Supplement */ /* 0x90 */
+ 0xABC0, /* Meetei Mayek */
+ 0xAC00, /* Hangul Syllables */
+ 0xD7B0, /* Hangul Jamo Extended-B */
+ 0xD800, /* High Surrogates */
+ 0xDB80, /* High Private Use Surrogates */
+ 0xDC00, /* Low Surrogates */
+ 0xE000, /* Private Use Area */
+ 0xF900, /* CJK Compatibility Ideographs */
+ 0xFB00, /* Alphabetic Presentation Forms */
+ 0xFB50, /* Arabic Presentation Forms-A */
+ 0xFE00, /* Variation Selectors */
+ 0xFE10, /* Vertical Forms */
+ 0xFE20, /* Combining Half Marks */
+ 0xFE30, /* CJK Compatibility Forms */
+ 0xFE50, /* Small Form Variants */
+ 0xFE70, /* Arabic Presentation Forms-B */ /* 0xa0 */
+ 0xFF00, /* Halfwidth and Fullwidth Forms */
+ 0xFFF0, /* Specials */
+ 0x10000, /* Linear B Syllabary */
+ 0x10080, /* Linear B Ideograms */
+ 0x10100, /* Aegean Numbers */
+ 0x10140, /* Ancient Greek Numbers */
+ 0x10190, /* Ancient Symbols */
+ 0x101D0, /* Phaistos Disc */
+ 0x10280, /* Lycian */
+ 0x102A0, /* Carian */
+ 0x102E0, /* Coptic Epact Numbers */
+ 0x10300, /* Old Italic */
+ 0x10330, /* Gothic */
+ 0x10350, /* Old Permic */
+ 0x10380, /* Ugaritic */
+ 0x103A0, /* Old Persian */ /* 0xb0 */
+ 0x10400, /* Deseret */
+ 0x10450, /* Shavian */
+ 0x10480, /* Osmanya */
+ 0x104B0, /* Osage */
+ 0x10500, /* Elbasan */
+ 0x10530, /* Caucasian Albanian */
+ 0x10600, /* Linear A */
+ 0x10800, /* Cypriot Syllabary */
+ 0x10840, /* Imperial Aramaic */
+ 0x10860, /* Palmyrene */
+ 0x10880, /* Nabataean */
+ 0x108E0, /* Hatran */
+ 0x10900, /* Phoenician */
+ 0x10920, /* Lydian */
+ 0x10980, /* Meroitic Hieroglyphs */
+ 0x109A0, /* Meroitic Cursive */ /* 0xc0 */
+ 0x10A00, /* Kharoshthi */
+ 0x10A60, /* Old South Arabian */
+ 0x10A80, /* Old North Arabian */
+ 0x10AC0, /* Manichaean */
+ 0x10B00, /* Avestan */
+ 0x10B40, /* Inscriptional Parthian */
+ 0x10B60, /* Inscriptional Pahlavi */
+ 0x10B80, /* Psalter Pahlavi */
+ 0x10C00, /* Old Turkic */
+ 0x10C80, /* Old Hungarian */
+ 0x10D00, /* Hanifi Rohingya */
+ 0x10E60, /* Rumi Numeral Symbols */
+ 0x10E80, /* Yezidi */
+ 0x10F00, /* Old Sogdian */
+ 0x10F30, /* Sogdian */
+ 0x10FB0, /* Chorasmian */ /* 0xd0 */
+ 0x10FE0, /* Elymaic */
+ 0x11000, /* Brahmi */
+ 0x11080, /* Kaithi */
+ 0x110D0, /* Sora Sompeng */
+ 0x11100, /* Chakma */
+ 0x11150, /* Mahajani */
+ 0x11180, /* Sharada */
+ 0x111E0, /* Sinhala Archaic Numbers */
+ 0x11200, /* Khojki */
+ 0x11280, /* Multani */
+ 0x112B0, /* Khudawadi */
+ 0x11300, /* Grantha */
+ 0x11400, /* Newa */
+ 0x11480, /* Tirhuta */
+ 0x11580, /* Siddham */
+ 0x11600, /* Modi */ /* 0xe0 */
+ 0x11660, /* Mongolian Supplement */
+ 0x11680, /* Takri */
+ 0x11700, /* Ahom */
+ 0x11800, /* Dogra */
+ 0x118A0, /* Warang Citi */
+ 0x11900, /* Dives Akuru */
+ 0x119A0, /* Nandinagari */
+ 0x11A00, /* Zanabazar Square */
+ 0x11A50, /* Soyombo */
+ 0x11AC0, /* Pau Cin Hau */
+ 0x11C00, /* Bhaiksuki */
+ 0x11C70, /* Marchen */
+ 0x11D00, /* Masaram Gondi */
+ 0x11D60, /* Gunjala Gondi */
+ 0x11EE0, /* Makasar */
+ 0x11FB0, /* Lisu Supplement */ /* 0xf0 */
+ 0x11FC0, /* Tamil Supplement */
+ 0x12000, /* Cuneiform */
+ 0x12400, /* Cuneiform Numbers and Punctuation */
+ 0x12480, /* Early Dynastic Cuneiform */
+ 0x13000, /* Egyptian Hieroglyphs */
+ 0x13430, /* Egyptian Hieroglyph Format Controls */
+ 0x14400, /* Anatolian Hieroglyphs */
+ 0x16800, /* Bamum Supplement */
+ 0x16A40, /* Mro */
+ 0x16AD0, /* Bassa Vah */
+ 0x16B00, /* Pahawh Hmong */
+ 0x16E40, /* Medefaidrin */
+ 0x16F00, /* Miao */
+ 0x16FE0, /* Ideographic Symbols and Punctuation */
+ 0x17000, /* Tangut */
+ 0x18800, /* Tangut Components */ /* 0x100 */
+ 0x18B00, /* Khitan Small Script */
+ 0x18D00, /* Tangut Supplement */
+ 0x1B000, /* Kana Supplement */
+ 0x1B100, /* Kana Extended-A */
+ 0x1B130, /* Small Kana Extension */
+ 0x1B170, /* Nushu */
+ 0x1BC00, /* Duployan */
+ 0x1BCA0, /* Shorthand Format Controls */
+ 0x1D000, /* Byzantine Musical Symbols */
+ 0x1D100, /* Musical Symbols */
+ 0x1D200, /* Ancient Greek Musical Notation */
+ 0x1D2E0, /* Mayan Numerals */
+ 0x1D300, /* Tai Xuan Jing Symbols */
+ 0x1D360, /* Counting Rod Numerals */
+ 0x1D400, /* Mathematical Alphanumeric Symbols */
+ 0x1D800, /* Sutton SignWriting */ /* 0x110 */
+ 0x1E000, /* Glagolitic Supplement */
+ 0x1E100, /* Nyiakeng Puachue Hmong */
+ 0x1E2C0, /* Wancho */
+ 0x1E800, /* Mende Kikakui */
+ 0x1E900, /* Adlam */
+ 0x1EC70, /* Indic Siyaq Numbers */
+ 0x1ED00, /* Ottoman Siyaq Numbers */
+ 0x1EE00, /* Arabic Mathematical Alphabetic Symbols */
+ 0x1F000, /* Mahjong Tiles */
+ 0x1F030, /* Domino Tiles */
+ 0x1F0A0, /* Playing Cards */
+ 0x1F100, /* Enclosed Alphanumeric Supplement */
+ 0x1F200, /* Enclosed Ideographic Supplement */
+ 0x1F300, /* Miscellaneous Symbols and Pictographs */
+ 0x1F600, /* Emoticons */
+ 0x1F650, /* Ornamental Dingbats */ /* 0x120 */
+ 0x1F680, /* Transport and Map Symbols */
+ 0x1F700, /* Alchemical Symbols */
+ 0x1F780, /* Geometric Shapes Extended */
+ 0x1F800, /* Supplemental Arrows-C */
+ 0x1F900, /* Supplemental Symbols and Pictographs */
+ 0x1FA00, /* Chess Symbols */
+ 0x1FA70, /* Symbols and Pictographs Extended-A */
+ 0x1FB00, /* Symbols for Legacy Computing */
+ 0x20000, /* CJK Unified Ideographs Extension B */
+ 0x2A700, /* CJK Unified Ideographs Extension C */
+ 0x2B740, /* CJK Unified Ideographs Extension D */
+ 0x2B820, /* CJK Unified Ideographs Extension E */
+ 0x2CEB0, /* CJK Unified Ideographs Extension F */
+ 0x2F800, /* CJK Compatibility Ideographs Supplement */
+ 0x30000, /* CJK Unified Ideographs Extension G */
+ 0x31350, /* reserved */ /* 0x130 */
+ 0x40000, /* reserved */
+ 0x50000, /* reserved */
+ 0x60000, /* reserved */
+ 0x70000, /* reserved */
+ 0x80000, /* reserved */
+ 0x90000, /* reserved */
+ 0xA0000, /* reserved */
+ 0xB0000, /* reserved */
+ 0xC0000, /* reserved */
+ 0xD0000, /* reserved */
+ 0xE0000, /* Tags */
+ 0xE0100, /* Variation Selectors Supplement */
+ 0xF0000, /* Supplementary Private Use Area-A */
+ 0x100000, /* Supplementary Private Use Area-B */
+ /* Value over 0x10FFFF is illegal under Unicode,
+ They are for some special use. *** experimental *** */
+ 0x110000, /* Reserved */
+ 0x120000, /* Reserved */ /* 0x140 */
+ 0x130000, /* Reserved */
+ 0x140000, /* Reserved */
+ 0x150000, /* Reserved */
+ 0x160000, /* Reserved */
+ 0x170000, /* Reserved */
+ 0x180000, /* Reserved */
+ 0x190000, /* Reserved */
+ 0x1A0000, /* Reserved */
+ 0x1B0000, /* Reserved */
+ 0x1C0000, /* Reserved */
+ 0x1D0000, /* Reserved */
+ 0x1E0000, /* Reserved */
+ 0x1F0000, /* Reserved */
+ 0x200000, /* Reserved */
+ 0x210000, /* Reserved */
+ 0x220000, /* Reserved */ /* 0x150 */
+ CJK_CHAR_LIMIT
+};
+
+#define NUCS_RANGE (sizeof(ucs_range)/sizeof(ucs_range[0]))
+
+/* Return i, which satisfies a[i] <= x < a[i+1]. */
+/* 'i' is serached between left <= i <= right. */
+/* If no i satisfies such condition, return left-1. */
+/* [Okumura et al.] An algorithm encyclopedia in Java, p.236. */
+static int
+binary_search (long x, long *a, int left, int right)
+{
+ right++;
+ while (left < right) {
+ int mid = (left + right) / 2;
+ if (a[mid] <= x ) left = mid + 1;
+ else right = mid;
+ }
+ return left - 1;
+}
+
+#define FEMININE_ORDINAL_INDICATOR 0x00AA
+#define MASCULINE_ORDINAL_INDICATOR 0x00BA
+#define LATIN_CAPITAL_LETTER_A_WITH_GRAVE 0x00C0
+#define LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS 0x00D6
+#define LATIN_CAPITAL_LETTER_O_WITH_STROKE 0x00D8
+#define LATIN_SMALL_LETTER_O_WITH_DIAERESIS 0x00F6
+#define LATIN_SMALL_LETTER_O_WITH_STROKE 0x00F8
+#define LATIN_SMALL_LETTER_Y_WITH_DIAERESIS 0x00FF
+#define FULLWIDTH_DIGIT_0 0xFF10
+#define FULLWIDTH_DIGIT_9 0xFF19
+#define FULLWIDTH_CAPITAL_A 0xFF21
+#define FULLWIDTH_CAPITAL_Z 0xFF3A
+#define FULLWIDTH_SMALL_A 0xFF41
+#define FULLWIDTH_SMALL_Z 0xFF5A
+#define HALFWIDTH_KATAKANA_WO 0xFF66
+#define HALFWIDTH_KATAKANA_SMALL_TSU 0xFF6F
+#define HALFWIDTH_KATAKANA_A 0xFF71
+#define HALFWIDTH_KATAKANA_N 0xFF9D
+
+integer kcatcodekey(integer c)
+{
+ integer block;
+ if (is_internalUPTEX()) {
+ block = binary_search((long)c, ucs_range, 0, NUCS_RANGE-1);
+ if (block==0x01) {
+ /* Latin-1 Letters */
+ if ( FEMININE_ORDINAL_INDICATOR ==c
+ || MASCULINE_ORDINAL_INDICATOR==c
+ || (LATIN_CAPITAL_LETTER_A_WITH_GRAVE <=c && c<=LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS)
+ || (LATIN_CAPITAL_LETTER_O_WITH_STROKE<=c && c<=LATIN_SMALL_LETTER_O_WITH_DIAERESIS )
+ || (LATIN_SMALL_LETTER_O_WITH_STROKE <=c && c<=LATIN_SMALL_LETTER_Y_WITH_DIAERESIS ) )
+ return 0x1FD;
+ }
+ if (block==0xa1) {
+ /* Fullwidth ASCII variants except for U+FF01..FF0F, U+FF1A..FF20, U+FF3B..FF40, U+FF5B..FF5E */
+ if ( (FULLWIDTH_DIGIT_0 <=c && c<=FULLWIDTH_DIGIT_9 )
+ || (FULLWIDTH_CAPITAL_A<=c && c<=FULLWIDTH_CAPITAL_Z)
+ || (FULLWIDTH_SMALL_A <=c && c<=FULLWIDTH_SMALL_Z ) )
+ return 0x1FE;
+ /* Halfwidth Katakana variants except for U+FF65, U+FF70, U+FF9E..FF9F */
+ if ( (HALFWIDTH_KATAKANA_WO <=c && c<=HALFWIDTH_KATAKANA_SMALL_TSU )
+ || (HALFWIDTH_KATAKANA_A <=c && c<=HALFWIDTH_KATAKANA_N ) )
+ return 0x1FF;
+ }
+ return block;
+ } else {
+ return Hi(toDVI(c));
+ }
+}
+
+integer multilenbuffchar(integer c)
+{
+ c=toBUFF(c);
+ if (BYTE1(c)) return 4;
+ if (BYTE2(c)) return 3;
+ if (BYTE3(c)) return 2;
+ if (BYTE4(c)) return 1;
+ return 0;
+}
+
+void init_kanji (const_string file_str, const_string internal_str)
+{
+ if (!set_enc_string (file_str, internal_str)) {
+ fprintf (stderr, "Bad kanji encoding \"%s\" or \"%s\".\n",
+ file_str ? file_str : "NULL",
+ internal_str ? internal_str : "NULL");
+ uexit(1);
+ }
+}
+
+void init_default_kanji (const_string file_str, const_string internal_str)
+{
+ char *p;
+
+ init_kanji (file_str, internal_str);
+
+ p = getenv ("PTEX_KANJI_ENC");
+ if (p) {
+ if (!set_enc_string (p, NULL))
+ fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p);
+ }
+
+#ifdef WIN32
+ p = kpse_var_value ("guess_input_kanji_encoding");
+ if (p) {
+ if (*p == '1' || *p == 'y' || *p == 't')
+ infile_enc_auto = 1;
+ free(p);
+ }
+#endif
+}
+
+void init_default_kanji_select(void)
+{
+ char *base;
+
+ base = kpse_program_basename (argv[0]);
+
+ if (FILESTRNCASEEQ(base, "p", 1) || FILESTRNCASEEQ(base, "ep", 2)) {
+
+ enable_UPTEX (false); /* disable */
+#if defined(WIN32)
+/* pBibTeX is EUC only */
+ if (FILESTRNCASEEQ(base, "pbibtex", 7)) {
+ init_default_kanji(NULL, "euc");
+ } else {
+/* for pTeX, e-pTeX, pDVItype, pPLtoTF, and pTFtoPL */
+ init_default_kanji(NULL, "sjis");
+ }
+#else
+ init_default_kanji(NULL, "euc");
+#endif
+
+ } else {
+
+/* for upTeX, e-upTeX, upBibTeX, upDVItype, upPLtoTF, and upTFtoPL */
+ enable_UPTEX (true); /* enable */
+ init_default_kanji ("utf8", "uptex");
+
+ }
+}
diff --git a/Build/source/texk/web2c/uptexdir/kanji.h b/Build/source/texk/web2c/uptexdir/kanji.h
new file mode 100644
index 00000000000..601e88d81f6
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/kanji.h
@@ -0,0 +1,73 @@
+/*
+ kanji.h: Handling 2byte char, and so on.
+*/
+#ifndef KANJI_H
+#define KANJI_H
+#include "cpascal.h"
+#include <ptexenc/ptexenc.h>
+#include <ptexenc/unicode.h>
+#ifdef eupTeX
+#define getintone(w) ((w).cint1)
+#define setintone(w,a) ((w).cint1=(a))
+#endif
+#include <zlib.h>
+
+#ifndef KANJI
+#define KANJI
+#endif
+
+/* (e)upTeX does not allow file names with 0x5c */
+#define not_kanji_char_seq(a,b) (1)
+#define notkanjicharseq not_kanji_char_seq
+
+/* functions */
+#define XXHi(x) BYTE1(x)
+#define XHi(x) BYTE2(x)
+#define Hi(x) BYTE3(x)
+#define Lo(x) BYTE4(x)
+
+extern boolean check_kanji (integer c);
+#define checkkanji check_kanji
+extern boolean is_char_ascii (integer c);
+#define ischarascii is_char_ascii
+extern boolean is_char_kanji (integer c);
+#define ischarkanji is_char_kanji
+extern boolean ismultiprn (integer c);
+extern integer calc_pos (integer c);
+#define calcpos calc_pos
+extern integer kcatcodekey (integer c);
+extern integer multilenbuffchar (integer c);
+
+extern void init_default_kanji (const_string file_str, const_string internal_str);
+extern void init_default_kanji_select (void);
+/* for upTeX, e-upTeX, upBibTeX, upDVItype, upPLtoTF, and upTFtoPL */
+#define initkanji() init_default_kanji_select()
+/* for upDVItype */
+#define setpriorfileenc() set_prior_file_enc()
+
+/* number of rest of multi-char for kcode_pos */
+#define nrestmultichr(x) ( (x)!=0 ? ((x) / 8) + 2 - ((x) % 8) : -1 )
+
+#ifndef PRESERVE_PUTC
+#undef putc
+#define putc(c,fp) putc2(c,fp)
+#endif /* !PRESERVE_PUTC */
+
+#ifndef PRESERVE_FPUTS
+#undef fputs
+#define fputs(c,fp) fputs2(c,fp)
+#endif /* !PRESERVE_FPUTS */
+
+#ifdef UPBIBTEX
+#define inputline2(fp,buff,pos,size,ptr) input_line2(fp,buff,pos,size,ptr)
+#else
+#define inputline2(fp,buff,pos,size) input_line2(fp,buff,pos,size,NULL)
+#endif
+
+extern void init_kanji (const_string file_str, const_string internal_str);
+extern void dump_kanji (gzFile fp);
+extern void undump_kanji (gzFile fp);
+#define dumpkanji dump_kanji
+#define undumpkanji undump_kanji
+
+#endif /* not KANJI_H */
diff --git a/Build/source/texk/web2c/uptexdir/kanji_dump.c b/Build/source/texk/web2c/uptexdir/kanji_dump.c
new file mode 100644
index 00000000000..795ed7497a1
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/kanji_dump.c
@@ -0,0 +1,51 @@
+/*
+ * Dump/undump Kanji encoding for (e)upTeX.
+ */
+
+#include "kanji.h"
+#ifndef upTeX
+#define upTeX
+#endif
+#include <texmfmp.h>
+
+void dump_kanji (gzFile fp)
+{
+ char buffer[12];
+ const char *p = get_enc_string ();
+ size_t len = strlen (p);
+
+ if (len > 11) {
+ fprintf (stderr, "Kanji encoding string \"%s\" exceeds 11 bytes.\n", p);
+ uexit(1);
+ }
+
+ strcpy (buffer, p);
+ for (len++; len < 12; len++)
+ buffer[len] = 0;
+ do_dump (buffer, 1, 12, fp);
+}
+
+void undump_kanji (gzFile fp)
+{
+ char buffer[12];
+ char *p;
+ int i;
+
+ do_undump (buffer, 1, 12, fp);
+ buffer[11] = 0; /* force string termination, just in case */
+
+ p = strchr (buffer, '.');
+ if (p)
+ *p++ = 0;
+ else
+ p = buffer;
+
+ i = get_internal_enc();
+
+ /* Now BUFFER and P are the file and internal encoding strings. */
+ init_kanji (NULL, p);
+ if (get_internal_enc() != i) {
+ fprintf (stderr, "Kanji internal encoding incompatible with the preloaded format.\n");
+ fprintf (stderr, "I'll stick to %s.\n", enc_to_string(get_internal_enc()));
+ }
+}
diff --git a/Build/source/texk/web2c/uptexdir/newjfm.test b/Build/source/texk/web2c/uptexdir/newjfm.test
new file mode 100755
index 00000000000..3240dad835e
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/newjfm.test
@@ -0,0 +1,22 @@
+#! /bin/sh -vx
+# $Id: newjfm.test 46400 2018-01-21 05:26:27Z hironobu $
+# Copyright 2018 Karl Berry <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+# Test inputs
+testdir=$srcdir/uptexdir/tests
+
+# Testing upPLtoTF/upTFtoPL for new JFM spec by texjporg.
+for font in testnewu; do
+
+ ./uppltotf -verbose $testdir/$font.pl uptests/x$font.tfm && \
+ cmp $testdir/$font.tfm uptests/x$font.tfm && echo || exit 1
+
+ TEXMFCNF=$srcdir/../kpathsea \
+ ./uptftopl -charcode-format octal -verbose $testdir/$font.tfm uptests/x$font.pl && \
+ diff $testdir/$font.pl uptests/x$font.pl && echo || exit 1
+
+done
+
diff --git a/Build/source/texk/web2c/uptexdir/tests/gkhuge.tex b/Build/source/texk/web2c/uptexdir/tests/gkhuge.tex
new file mode 100644
index 00000000000..744eb42672f
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/gkhuge.tex
@@ -0,0 +1,33 @@
+\prebreakpenalty`…=0
+\postbreakpenalty`「=0
+\postbreakpenalty`【=0
+\postbreakpenalty`(=0
+\postbreakpenalty`:=0
+\postbreakpenalty`;=0
+
+\tracingonline1
+\showboxdepth10000
+\showboxbreadth10000
+
+\font\x=upjisr-h\x
+\setbox0=\hbox{あ…あ「あ【あ(あ:あ;あ}\showbox0
+\box0
+
+\font\y=gkhugeok\y
+\setbox2=\hbox{あ…あ「あ【あ(あ:あ;あ}\showbox2
+\box2
+
+\newfam\mx
+\newfam\my
+\textfont\mx=\x \scriptfont\mx=\x \scriptscriptfont\mx=\x
+\textfont\my=\y \scriptfont\my=\y \scriptscriptfont\my=\y
+
+\jfam\mx
+\setbox4=\hbox{$あ…あ「あ【あ(あ:あ;あ$}\showbox4
+\box4
+
+\jfam\my
+\setbox6=\hbox{$あ…あ「あ【あ(あ:あ;あ$}\showbox6
+\box6
+
+\bye
diff --git a/Build/source/texk/web2c/uptexdir/tests/gkhugeng.err b/Build/source/texk/web2c/uptexdir/tests/gkhugeng.err
new file mode 100644
index 00000000000..484f95d3bad
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/gkhugeng.err
@@ -0,0 +1,3 @@
+Input file is in YOKO-kumi kanji tfm format.
+The fifth byte of the input file exceeds 127!
+Sorry, but I can't go on; are you sure this is a TFM?
diff --git a/Build/source/texk/web2c/uptexdir/tests/gkhugeng.tfm b/Build/source/texk/web2c/uptexdir/tests/gkhugeng.tfm
new file mode 100644
index 00000000000..60c13f00cbf
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/gkhugeng.tfm
Binary files differ
diff --git a/Build/source/texk/web2c/uptexdir/tests/gkhugeok.tfm b/Build/source/texk/web2c/uptexdir/tests/gkhugeok.tfm
new file mode 100644
index 00000000000..23c2a631d7f
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/gkhugeok.tfm
Binary files differ
diff --git a/Build/source/texk/web2c/uptexdir/tests/test_if.tex b/Build/source/texk/web2c/uptexdir/tests/test_if.tex
new file mode 100644
index 00000000000..35588f992c1
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/test_if.tex
@@ -0,0 +1,29 @@
+\kcatcode`あ=18
+\def\xA{あ}\let\yA=あ
+\kcatcode`あ=17
+\def\xB{あ}\let\yB=あ
+\kcatcode`あ=16
+
+\message{\ifcat あ\xA Y\else N\fi}
+\message{\ifcat あ\yA Y\else N\fi}
+\message{\ifcat あ\xB Y\else N\fi}
+\message{\ifcat あ\yB Y\else N\fi}
+
+\message{\if あ\xA Y\else N\fi}
+\message{\if あ\yA Y\else N\fi}
+\message{\if い\xA Y\else N\fi}
+\message{\if い\yA Y\else N\fi}
+
+\ifx\ucs\undefined\else
+ \kcatcode"100=16
+ \message{upTeX}
+ \def\xA{Ā}% U+0100
+ \def\xB{ā}% U+0101
+ \message{\if \xA\relax Y\else N\fi}
+ \message{\if \xB\relax Y\else N\fi}
+ \message{\ifcat\xA\relax Y\else N\fi}
+ \message{\ifcat\xB\relax Y\else N\fi}
+\fi
+\end
+
+
diff --git a/Build/source/texk/web2c/uptexdir/tests/testnewu.pl b/Build/source/texk/web2c/uptexdir/tests/testnewu.pl
new file mode 100644
index 00000000000..6b211cd51aa
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/testnewu.pl
@@ -0,0 +1,130 @@
+(COMMENT THIS IS A KANJI FORMAT FILE)
+(FAMILY UPJIS KANJI)
+(FACE F MRR)
+(CODINGSCHEME TEX KANJI TEXT)
+(DESIGNSIZE R 10.0)
+(COMMENT DESIGNSIZE IS IN POINTS)
+(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
+(CHECKSUM O 0)
+(FONTDIMEN
+ (SLANT R 0.0)
+ (SPACE R 0.0)
+ (STRETCH R 0.1)
+ (SHRINK R 0.0)
+ (XHEIGHT R 1.0)
+ (QUAD R 1.0)
+ (EXTRASPACE R 0.25)
+ (EXTRASTRETCH R 0.2)
+ (EXTRASHRINK R 0.125)
+ )
+(GLUEKERN
+ (LABEL O 0)
+ (GLUE O 1 R 0.5 R 0.0 R 0.5)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ (STOP)
+ (LABEL O 1)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ (STOP)
+ (LABEL O 2)
+ (GLUE O 0 R 0.5 R 0.0 R 0.5)
+ (GLUE O 1 R 0.5 R 0.0 R 0.5)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ (GLUE O 5 R 0.5 R 0.0 R 0.5)
+ (STOP)
+ (LABEL O 3)
+ (GLUE O 0 R 0.25 R 0.0 R 0.25)
+ (GLUE O 1 R 0.25 R 0.0 R 0.25)
+ (GLUE O 2 R 0.25 R 0.0 R 0.25)
+ (GLUE O 3 R 0.5 R 0.0 R 0.25)
+ (GLUE O 4 R 0.25 R 0.0 R 0.25)
+ (GLUE O 5 R 0.25 R 0.0 R 0.25)
+ (STOP)
+ (LABEL O 4)
+ (GLUE O 0 R 0.5 R 0.0 R 0.0)
+ (GLUE O 1 R 0.5 R 0.0 R 0.0)
+ (GLUE O 3 R 0.75 R 0.0 R 0.25)
+ (GLUE O 5 R 0.5 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 5)
+ (GLUE O 1 R 0.5 R 0.0 R 0.5)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ (KRN O 5 R 0.0)
+ (STOP)
+ )
+(CHARSINTYPE O 1
+ U 81FC U FF08 U 26951
+ )
+(CHARSINTYPE O 2
+ U 5409 U FF09 U 20BB7
+ )
+(CHARSINTYPE O 3
+ U 2462 U FF1A
+ )
+(CHARSINTYPE O 4
+ U 2463 U 3002
+ )
+(CHARSINTYPE O 5
+ U 2026 U 2464
+ )
+(TYPE O 0
+ (CHARWD R 1.0)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ (COMMENT
+ (GLUE O 1 R 0.5 R 0.0 R 0.5)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ )
+ )
+(TYPE O 1
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ (COMMENT
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ )
+ )
+(TYPE O 2
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ (COMMENT
+ (GLUE O 0 R 0.5 R 0.0 R 0.5)
+ (GLUE O 1 R 0.5 R 0.0 R 0.5)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ (GLUE O 5 R 0.5 R 0.0 R 0.5)
+ )
+ )
+(TYPE O 3
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ (COMMENT
+ (GLUE O 0 R 0.25 R 0.0 R 0.25)
+ (GLUE O 1 R 0.25 R 0.0 R 0.25)
+ (GLUE O 2 R 0.25 R 0.0 R 0.25)
+ (GLUE O 3 R 0.5 R 0.0 R 0.25)
+ (GLUE O 4 R 0.25 R 0.0 R 0.25)
+ (GLUE O 5 R 0.25 R 0.0 R 0.25)
+ )
+ )
+(TYPE O 4
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ (COMMENT
+ (GLUE O 0 R 0.5 R 0.0 R 0.0)
+ (GLUE O 1 R 0.5 R 0.0 R 0.0)
+ (GLUE O 3 R 0.75 R 0.0 R 0.25)
+ (GLUE O 5 R 0.5 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 5
+ (CHARWD R 1.0)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ (COMMENT
+ (GLUE O 1 R 0.5 R 0.0 R 0.5)
+ (GLUE O 3 R 0.25 R 0.0 R 0.25)
+ (KRN O 5 R 0.0)
+ )
+ )
diff --git a/Build/source/texk/web2c/uptexdir/tests/testnewu.tfm b/Build/source/texk/web2c/uptexdir/tests/testnewu.tfm
new file mode 100644
index 00000000000..6860278f2ca
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/testnewu.tfm
Binary files differ
diff --git a/Build/source/texk/web2c/uptexdir/tests/umin10.pl b/Build/source/texk/web2c/uptexdir/tests/umin10.pl
new file mode 100644
index 00000000000..6a6e819b19c
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/umin10.pl
@@ -0,0 +1,395 @@
+(COMMENT THIS IS A KANJI FORMAT FILE)
+(FAMILY MINCHO)
+(FACE F MRR)
+(CODINGSCHEME TEX KANJI TEXT)
+(DESIGNSIZE R 10.0)
+(COMMENT DESIGNSIZE IS IN POINTS)
+(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
+(CHECKSUM O 35147750366)
+(FONTDIMEN
+ (SLANT R 0.0)
+ (SPACE R 0.0)
+ (STRETCH R 0.091641)
+ (SHRINK R 0.0)
+ (XHEIGHT R 0.916443)
+ (QUAD R 0.962216)
+ (EXTRASPACE R 0.229101)
+ (EXTRASTRETCH R 0.183283)
+ (EXTRASHRINK R 0.114551)
+ )
+(GLUEKERN
+ (LABEL O 0)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (STOP)
+ (LABEL O 7)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.048114)
+ (KRN O 11 R -0.048114)
+ (STOP)
+ (LABEL O 12)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.096228)
+ (KRN O 11 R -0.096228)
+ (STOP)
+ (LABEL O 13)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.144327)
+ (KRN O 11 R -0.144327)
+ (STOP)
+ (LABEL O 14)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.192441)
+ (KRN O 11 R -0.192441)
+ (STOP)
+ (LABEL O 2)
+ (LABEL O 10)
+ (GLUE O 0 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 5 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ (STOP)
+ (LABEL O 4)
+ (GLUE O 0 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 7 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 12 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 13 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 14 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 5 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 3 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 11 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 1 R 0.3042755 R 0.0 R 0.3042755)
+ (STOP)
+ (LABEL O 5)
+ (GLUE O 0 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 5 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 3 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 11 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 1 R 0.229101 R 0.0 R 0.229101)
+ (STOP)
+ (LABEL O 3)
+ (GLUE O 0 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 7 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 12 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 13 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 14 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 11 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 1 R 0.107391 R 0.0 R 0.107391)
+ (STOP)
+ (LABEL O 6)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.0 R 0.458203 R 0.0)
+ (STOP)
+ (LABEL O 1)
+ (LABEL O 11)
+ (GLUE O 0 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 2 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 4 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 5 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 3 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 11 R 0.0 R 0.458203 R 0.0)
+ (GLUE O 1 R 0.0 R 0.458203 R 0.0)
+ (STOP)
+ )
+(CHARSINTYPE O 1
+ U 3009 U 300B U 300D U 300F U 3011 U 3015 U 3017 U 3019 U 301F U FF09
+ U FF3D U FF5D U FF60
+ )
+(CHARSINTYPE O 2
+ U 309B U 309C
+ )
+(CHARSINTYPE O 3
+ U 2234 U 2640 U 2642 U 3003 U 3005 U 3041 U 3043 U 3045 U 3047 U 3049
+ U 3063 U 3083 U 3085 U 3087 U 308E U 3095 U 3096 U 309E U 30A1 U 30A3
+ U 30A5 U 30A7 U 30A9 U 30C3 U 30E3 U 30E5 U 30E7 U 30EE U 30F5 U 30F6
+ U 31F0 U 31F1 U 31F2 U 31F3 U 31F4 U 31F5 U 31F6 U 31F7 U 31F8 U 31F9
+ U 31FA U 31FB U 31FC U 31FD U 31FE U 31FF U FF04 U FFE0 U FFE1
+ )
+(CHARSINTYPE O 4
+ U 00B4 U 2010 U 2016 U 2018 U 2019 U 30FB U FF01 U FF1A U FF1B U FF40
+ U FF5C
+ )
+(CHARSINTYPE O 5
+ U 00A7 U 00A8 U 00B0 U 201C U 201D U 2032 U 2033 U 309D U 30FD U FF1F
+ U FF3E
+ )
+(CHARSINTYPE O 6
+ U 3008 U 300A U 300C U 300E U 3010 U 3014 U 3016 U 3018 U 301D U FF08
+ U FF3B U FF5B U FF5F
+ )
+(CHARSINTYPE O 7
+ U 3046 U 304F U 3050 U 3051 U 3052 U 3059 U 305A U 308A U 30C6 U 30C7
+ U 30E4
+ )
+(CHARSINTYPE O 10
+ U FF0C U FF0E
+ )
+(CHARSINTYPE O 11
+ U 3001 U 3002
+ )
+(CHARSINTYPE O 12
+ U 30A2 U 30A4 U 30A6 U 30AA U 30B1 U 30B2 U 30B5 U 30B6 U 30BD U 30BE
+ U 30C1 U 30C2 U 30C4 U 30C5 U 30C8 U 30C9 U 30CA U 30D5 U 30D6 U 30D7
+ U 30DF U 30E1 U 30E9 U 30EA U 30EF U 30F2
+ )
+(CHARSINTYPE O 13
+ U 30AF U 30B0 U 30BF U 30C0
+ )
+(CHARSINTYPE O 14
+ U 30CE
+ )
+(TYPE O 0
+ (CHARWD R 0.962216)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ )
+ )
+(TYPE O 1
+ (CHARWD R 0.504013)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 2 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 4 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 5 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 3 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 11 R 0.0 R 0.458203 R 0.0)
+ (GLUE O 1 R 0.0 R 0.458203 R 0.0)
+ )
+ )
+(TYPE O 2
+ (CHARWD R 0.353665)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 5 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ )
+ )
+(TYPE O 3
+ (CHARWD R 0.747434)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 7 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 12 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 13 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 14 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 11 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 1 R 0.107391 R 0.0 R 0.107391)
+ )
+ )
+(TYPE O 4
+ (CHARWD R 0.353665)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 7 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 12 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 13 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 14 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 5 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 3 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 11 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 1 R 0.3042755 R 0.0 R 0.3042755)
+ )
+ )
+(TYPE O 5
+ (CHARWD R 0.504013)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 5 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 3 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 11 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 1 R 0.229101 R 0.0 R 0.229101)
+ )
+ )
+(TYPE O 6
+ (CHARWD R 0.504013)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.0 R 0.458203 R 0.0)
+ )
+ )
+(TYPE O 7
+ (CHARWD R 0.962216)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.048114)
+ (KRN O 11 R -0.048114)
+ )
+ )
+(TYPE O 10
+ (CHARWD R 0.353665)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.608551 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 2 R 0.0 R 0.3042755 R 0.0)
+ (GLUE O 4 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 5 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.229101 R 0.229101 R 0.229101)
+ )
+ )
+(TYPE O 11
+ (CHARWD R 0.504013)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 0 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 7 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 12 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 13 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 14 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 10 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 2 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 4 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 5 R 0.229101 R 0.229101 R 0.229101)
+ (GLUE O 3 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (GLUE O 11 R 0.0 R 0.458203 R 0.0)
+ (GLUE O 1 R 0.0 R 0.458203 R 0.0)
+ )
+ )
+(TYPE O 12
+ (CHARWD R 0.962216)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.096228)
+ (KRN O 11 R -0.096228)
+ )
+ )
+(TYPE O 13
+ (CHARWD R 0.962216)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.144327)
+ (KRN O 11 R -0.144327)
+ )
+ )
+(TYPE O 14
+ (CHARWD R 0.962216)
+ (CHARHT R 0.777588)
+ (CHARDP R 0.138855)
+ (COMMENT
+ (GLUE O 4 R 0.3042755 R 0.0 R 0.3042755)
+ (GLUE O 5 R 0.229101 R 0.0 R 0.229101)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 6 R 0.458203 R 0.0 R 0.229101)
+ (KRN O 10 R -0.192441)
+ (KRN O 11 R -0.192441)
+ )
+ )
diff --git a/Build/source/texk/web2c/uptexdir/tests/umin10.tfm b/Build/source/texk/web2c/uptexdir/tests/umin10.tfm
new file mode 100644
index 00000000000..443fcaeb845
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/umin10.tfm
Binary files differ
diff --git a/Build/source/texk/web2c/uptexdir/tests/unibib.aux b/Build/source/texk/web2c/uptexdir/tests/unibib.aux
new file mode 100644
index 00000000000..c8ad2dc61ca
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/unibib.aux
@@ -0,0 +1,4 @@
+\relax
+\citation{*}
+\bibstyle{jplain}
+\bibdata{unibib}
diff --git a/Build/source/texk/web2c/uptexdir/tests/unibib.bbl b/Build/source/texk/web2c/uptexdir/tests/unibib.bbl
new file mode 100644
index 00000000000..718ab2c44bc
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/unibib.bbl
@@ -0,0 +1,50 @@
+\begin{thebibliography}{1}
+
+\bibitem{björk2020}
+Tomas Björk.
+\newblock {\em Arbitrage Theory in Continuous Time}.
+\newblock Oxford University Press, 2020.
+
+\bibitem{boswell}
+Dustin Boswell and Trevor Foucher.
+\newblock リーダブルコード
+ ―より良いコードを書くためのシンプルで実践的
+ なテクニック (Theory in practice).
+\newblock オライリージャパン, 2012.
+
+\bibitem{dostoevskii}
+Фёдор~Миха́йлович Достое́вский.
+\newblock {\em Братья Карамазовы}.
+\newblock Гослитиздат, 1958.
+
+\bibitem{gim}
+김만중.
+\newblock 구운몽.
+\newblock 高麗書林, 1975.
+
+\bibitem{nikos}
+Νίκος Καζαντζάκης.
+\newblock {\em Συμπόσιον}.
+\newblock 京緑社, 2020.
+
+\bibitem{knuth86}
+Donald~E. Knuth.
+\newblock {\em The \TeX book}.
+\newblock Addison-Wesley, 1986.
+
+\bibitem{ken-na}
+中野賢.
+\newblock 日本語{\LaTeXe}ブック.
+\newblock アスキー, 1996.
+
+\bibitem{kigou}
+Foo Hoge.
+\newblock {\em $£(!?)☃♪、。§○●}.
+\newblock Snowman commedian Press, 2020.
+
+\bibitem{fullwidth}
+Bar Fuga.
+\newblock 1.
+\newblock TeXnician Co., Ltd., 2020.
+
+\end{thebibliography}
diff --git a/Build/source/texk/web2c/uptexdir/tests/unibib.bib b/Build/source/texk/web2c/uptexdir/tests/unibib.bib
new file mode 100644
index 00000000000..11e6baa22a8
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/unibib.bib
@@ -0,0 +1,81 @@
+%% ASCII only
+@book{knuth86,
+ author = "Donald E. Knuth",
+ title = "The \TeX book",
+ publisher = "Addison-Wesley",
+ year = 1986,
+}
+
+%% Latin-1
+@book{björk2020,
+ author = "Tomas Björk",
+ title = "Arbitrage Theory in Continuous Time",
+ publisher = "Oxford University Press",
+ year = 2020,
+}
+
+%% 日本人姓名;読み仮名つき
+@book{ken-na,
+ author = "中野 賢",
+ yomi = "Ken Nakano",
+ title = "日本語{\LaTeXe}ブック",
+ publisher = "アスキー",
+ year = 1996,
+}
+
+%% ギリシャ文字;ニコス・カザンザキス「饗宴」
+@book{nikos,
+ author = "Νίκος Καζαντζάκης",
+ yomi = "Nikos Kazantzakis",
+ title = "Συμπόσιον",
+ publisher = "京緑社",
+ year = 2020,
+}
+
+%% キリル文字;ドストエフスキー「カラマーゾフの兄弟」
+@book{dostoevskii,
+ title = "Братья Карамазовы",
+ author = "Достое́вский, Фёдор Миха́йлович",
+ yomi = "Dostoevskii, F.M.",
+ publisher = "Гослитиздат",
+ year = "1958",
+}
+
+%% ハングル:金萬重「九雲夢」
+@book{gim,
+ author = "김 만중",
+ yomi = "Manjung Gim",
+ title = "구운몽",
+ publisher = "高麗書林",
+ year = 1975,
+}
+
+%% 日本語文献;著者は非・日本人
+@book{boswell,
+ author = {Boswell, Dustin and Foucher, Trevor},
+ title = {リーダブルコード ―より良いコードを書くためのシンプルで実践的
+ なテクニック (Theory in practice) },
+ year = 2012,
+ publisher = {オライリージャパン},
+ translator = {角 征典},
+ language = {ja},
+ yomi = {boswell}
+}
+
+%% 全角数字(17)は和文扱いとする
+@book{fullwidth,
+ author = "Bar Fuga",
+ yomi = "ぜんかく",
+ title = "1",
+ publisher = "TeXnician Co., Ltd.",
+ year = 2020,
+}
+
+%% 記号類(18)は欧文扱いとする
+@book{kigou,
+ author = "Foo Hoge",
+ yomi = "きごうたち",
+ title = "$£(!?)☃♪、。§○●",
+ publisher = "Snowman commedian Press",
+ year = 2020,
+}
diff --git a/Build/source/texk/web2c/uptexdir/tests/unibib.tex b/Build/source/texk/web2c/uptexdir/tests/unibib.tex
new file mode 100644
index 00000000000..918d11f37b2
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/unibib.tex
@@ -0,0 +1,98 @@
+% https://github.com/texjporg/tex-jp-build/issues/109
+
+\begin{filecontents}[overwrite]{\jobname.bib}
+%% ASCII only
+@book{knuth86,
+ author = "Donald E. Knuth",
+ title = "The \TeX book",
+ publisher = "Addison-Wesley",
+ year = 1986,
+}
+
+%% Latin-1
+@book{björk2020,
+ author = "Tomas Björk",
+ title = "Arbitrage Theory in Continuous Time",
+ publisher = "Oxford University Press",
+ year = 2020,
+}
+
+%% 日本人姓名;読み仮名つき
+@book{ken-na,
+ author = "中野 賢",
+ yomi = "Ken Nakano",
+ title = "日本語{\LaTeXe}ブック",
+ publisher = "アスキー",
+ year = 1996,
+}
+
+%% ギリシャ文字;ニコス・カザンザキス「饗宴」
+@book{nikos,
+ author = "Νίκος Καζαντζάκης",
+ yomi = "Nikos Kazantzakis",
+ title = "Συμπόσιον",
+ publisher = "京緑社",
+ year = 2020,
+}
+
+%% キリル文字;ドストエフスキー「カラマーゾフの兄弟」
+@book{dostoevskii,
+ title = "Братья Карамазовы",
+ author = "Достое́вский, Фёдор Миха́йлович",
+ yomi = "Dostoevskii, F.M.",
+ publisher = "Гослитиздат",
+ year = "1958",
+}
+
+%% ハングル:金萬重「九雲夢」
+@book{gim,
+ author = "김 만중",
+ yomi = "Manjung Gim",
+ title = "구운몽",
+ publisher = "高麗書林",
+ year = 1975,
+}
+
+%% 日本語文献;著者は非・日本人
+@book{boswell,
+ author = {Boswell, Dustin and Foucher, Trevor},
+ title = {リーダブルコード ―より良いコードを書くためのシンプルで実践的
+ なテクニック (Theory in practice) },
+ year = 2012,
+ publisher = {オライリージャパン},
+ translator = {角 征典},
+ language = {ja},
+ yomi = {boswell}
+}
+
+%% 全角数字(17)は和文扱いとする
+@book{fullwidth,
+ author = "Bar Fuga",
+ yomi = "ぜんかく",
+ title = "1",
+ publisher = "TeXnician Co., Ltd.",
+ year = 2020,
+}
+
+%% 記号類(18)は欧文扱いとする
+@book{kigou,
+ author = "Foo Hoge",
+ yomi = "きごうたち",
+ title = "$£(!?)☃♪、。§○●",
+ publisher = "Snowman commedian Press",
+ year = 2020,
+}
+\end{filecontents}
+
+\documentclass{ltjsarticle}
+% ギリシャ文字・キリル文字を欧文扱い
+\ltjsetparameter{jacharrange={-2}}
+\usepackage{luatexja-fontspec}
+\usepackage[sourcehan]{luatexja-preset}
+\setmainfont{XITS}% ギリシャ文字・キリル文字を含む
+\begin{document}
+test
+\nocite{*}
+\bibliographystyle{jplain}
+\bibliography{\jobname}
+\end{document}
diff --git a/Build/source/texk/web2c/uptexdir/tests/uparse.pl b/Build/source/texk/web2c/uptexdir/tests/uparse.pl
new file mode 100644
index 00000000000..906989df2f7
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/uparse.pl
@@ -0,0 +1,70 @@
+(FAMILY JFM UCODE)
+(FACE F MRR)
+(CODINGSCHEME TEX KANJI TEXT)
+(DESIGNSIZE R 10.0)
+(CHECKSUM O 0)
+(FONTDIMEN
+ (SLANT R 0.0)
+ (SPACE R 0.0)
+ (STRETCH R 0.1)
+ (SHRINK R 0.0)
+ (XHEIGHT R 1.0)
+ (QUAD R 1.0)
+ (EXTRASPACE R 0.25)
+ (EXTRASTRETCH R 0.2)
+ (EXTRASHRINK R 0.125)
+ )
+(GLUEKERN
+ (LABEL O 0)
+ (LABEL O 5)
+ (LABEL O 6)
+ (GLUE O 3 R 0.25 R 0.1 R 0.1)
+ (STOP)
+ (LABEL O 3)
+ (GLUE O 0 R 0.25 R 0.1 R 0.1)
+ (GLUE O 5 R 0.25 R 0.1 R 0.1)
+ (GLUE O 6 R 0.25 R 0.1 R 0.1)
+ (GLUE O 3 R 0.5 R 0.25 R 0.25)
+ (STOP)
+ )
+(CHARSINTYPE O 1 U A1)
+(CHARSINTYPE O 2 U 28)
+(CHARSINTYPE O 3 U B7)
+(CHARSINTYPE O 4 U 21)
+(CHARSINTYPE O 5 U 200B7)
+(CHARSINTYPE O 6 U 3042)
+(TYPE O 0
+ (CHARWD R 1.0)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
+(TYPE O 1
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
+(TYPE O 2
+ (CHARWD R 0.3)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
+(TYPE O 3
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
+(TYPE O 4
+ (CHARWD R 0.5)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
+(TYPE O 5
+ (CHARWD R 1.0)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
+(TYPE O 6
+ (CHARWD R 1.0)
+ (CHARHT R 0.88)
+ (CHARDP R 0.12)
+ )
diff --git a/Build/source/texk/web2c/uptexdir/tests/uparse.tfm b/Build/source/texk/web2c/uptexdir/tests/uparse.tfm
new file mode 100644
index 00000000000..88d1ec39291
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/uparse.tfm
Binary files differ
diff --git a/Build/source/texk/web2c/uptexdir/tests/utmin10.pl b/Build/source/texk/web2c/uptexdir/tests/utmin10.pl
new file mode 100644
index 00000000000..0baa7a2c3e3
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/utmin10.pl
@@ -0,0 +1,287 @@
+(COMMENT THIS IS A KANJI FORMAT FILE)
+(DIRECTION TATE)
+(FAMILY MINCHO)
+(FACE F MRR)
+(CODINGSCHEME JIS X0208)
+(DESIGNSIZE R 10.0)
+(COMMENT DESIGNSIZE IS IN POINTS)
+(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
+(CHECKSUM O 35147750366)
+(FONTDIMEN
+ (SLANT R 0.0)
+ (SPACE R 0.0)
+ (STRETCH R 0.091641)
+ (SHRINK R 0.0)
+ (XHEIGHT R 0.916443)
+ (QUAD R 0.962216)
+ (EXTRASPACE R 0.229101)
+ (EXTRASTRETCH R 0.183283)
+ (EXTRASHRINK R 0.114551)
+ )
+(GLUEKERN
+ (LABEL O 0)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 1)
+ (GLUE O 0 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 2)
+ (GLUE O 0 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 3)
+ (GLUE O 0 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 4)
+ (GLUE O 0 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 7 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 5)
+ (GLUE O 0 R 0.0 R 0.0 R 0.0)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.0 R 0.0 R 0.0)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 6)
+ (GLUE O 0 R 0.0 R 0.0 R 0.0)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.0 R 0.0 R 0.0)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.0 R 0.0 R 0.0)
+ (GLUE O 7 R 0.240554 R 0.0 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ (LABEL O 7)
+ (GLUE O 0 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 1 R 0.240554 R 0.0 R 0.240554)
+ (GLUE O 2 R 0.240554 R 0.0 R 0.240554)
+ (GLUE O 3 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 4 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 5 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 6 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 7 R 0.0 R 0.183283 R 0.0)
+ (GLUE O 10 R 0.240554 R 0.0 R 0.240554)
+ (STOP)
+ (LABEL O 10)
+ (GLUE O 0 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ (STOP)
+ )
+(CHARSINTYPE O 1
+ U FF0C U FF0E
+ )
+(CHARSINTYPE O 2
+ U 3001 U 3002
+ )
+(CHARSINTYPE O 3
+ U 3003 U 3005 U 3041 U 3043 U 3045 U 3047 U 3049 U 3063 U 3083 U 3085
+ U 3087 U 308E U 3095 U 3096 U 309D U 309E U 30A1 U 30A3 U 30A5 U 30A7
+ U 30A9 U 30C3 U 30E3 U 30E5 U 30E7 U 30EE U 30F5 U 30F6 U 30FD U 30FE
+ U 31F0 U 31F1 U 31F2 U 31F3 U 31F4 U 31F5 U 31F6 U 31F7 U 31F8 U 31F9
+ U 31FA U 31FB U 31FC U 31FD U 31FE U 31FF
+ )
+(CHARSINTYPE O 4
+ U FF01 U FF1F
+ )
+(CHARSINTYPE O 5
+ U 2015 U 2025 U 2026
+ )
+(CHARSINTYPE O 6
+ U 2018 U 201C U 3008 U 300A U 300C U 300E U 3010 U 3014 U 3016 U 3018
+ U 301D U FF08 U FF3B U FF5B U FF5F
+ )
+(CHARSINTYPE O 7
+ U 2010 U 2016 U 30FB U FF5C
+ )
+(CHARSINTYPE O 10
+ U 2019 U 201D U 3009 U 300B U 300D U 300F U 3011 U 3015 U 3017 U 3019
+ U 301F U FF09 U FF3D U FF5D U FF60
+ )
+(TYPE O 0
+ (CHARWD R 0.962216)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 1
+ (CHARWD R 0.481108)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 2
+ (CHARWD R 0.481108)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 3
+ (CHARWD R 0.747434)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.107391 R 0.0 R 0.107391)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 4
+ (CHARWD R 0.962216)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 7 R 0.962216 R 0.0 R 0.481108)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 5
+ (CHARWD R 0.962216)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.0 R 0.0 R 0.0)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.0 R 0.0 R 0.0)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 6
+ (CHARWD R 0.481108)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.0 R 0.0 R 0.0)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.0 R 0.0 R 0.0)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.0 R 0.0 R 0.0)
+ (GLUE O 6 R 0.0 R 0.0 R 0.0)
+ (GLUE O 7 R 0.240554 R 0.0 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
+(TYPE O 7
+ (CHARWD R 0.481108)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 1 R 0.240554 R 0.0 R 0.240554)
+ (GLUE O 2 R 0.240554 R 0.0 R 0.240554)
+ (GLUE O 3 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 4 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 5 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 6 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 7 R 0.0 R 0.183283 R 0.0)
+ (GLUE O 10 R 0.240554 R 0.0 R 0.240554)
+ )
+ )
+(TYPE O 10
+ (CHARWD R 0.481108)
+ (CHARHT R 0.458221)
+ (CHARDP R 0.458221)
+ (COMMENT
+ (GLUE O 0 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 1 R 0.0 R 0.0 R 0.0)
+ (GLUE O 2 R 0.0 R 0.0 R 0.0)
+ (GLUE O 3 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 4 R 0.0 R 0.0 R 0.0)
+ (GLUE O 5 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 6 R 0.481108 R 0.183283 R 0.481108)
+ (GLUE O 7 R 0.240554 R 0.183283 R 0.240554)
+ (GLUE O 10 R 0.0 R 0.0 R 0.0)
+ )
+ )
diff --git a/Build/source/texk/web2c/uptexdir/tests/utmin10.tfm b/Build/source/texk/web2c/uptexdir/tests/utmin10.tfm
new file mode 100644
index 00000000000..007fa132baf
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/tests/utmin10.tfm
Binary files differ
diff --git a/Build/source/texk/web2c/uptexdir/uparse.test b/Build/source/texk/web2c/uptexdir/uparse.test
new file mode 100755
index 00000000000..a51e5945f82
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uparse.test
@@ -0,0 +1,31 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2018 Karl Berry <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+# Test inputs
+testdir=$srcdir/uptexdir/tests
+
+# Testing upPLtoTF/upTFtoPL for JPL parsing
+# and direct charcter printing (without -charcode-format octal).
+for font in uparse; do
+
+ # allow hex kanji code with arbitary digits,
+ # no error for no trailing spaces.
+ ./uppltotf -verbose $testdir/$font.pl uptests/x$font.tfm && \
+ cmp $testdir/$font.tfm uptests/x$font.tfm && echo || exit 1
+
+ # upTFtoPL should always print ASCII characters in charcode format,
+ # even when -charcode-format octal is disabled; otherwise
+ # upPLtoTF cannot accept the resulting JPL file correctly.
+ # This test is constructed as a cycle, so that there is no
+ # non-ASCII character inside test case distribution.
+ TEXMFCNF=$srcdir/../kpathsea \
+ ./uptftopl -verbose $testdir/$font.tfm uptests/y$font.pl && \
+ ./uppltotf -verbose uptests/y$font.pl uptests/y$font.tfm && \
+ cmp $testdir/$font.tfm uptests/y$font.tfm && echo || exit 1
+
+done
+
diff --git a/Build/source/texk/web2c/uptexdir/upbibtex.ch b/Build/source/texk/web2c/uptexdir/upbibtex.ch
new file mode 100644
index 00000000000..fa3cf4e4051
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/upbibtex.ch
@@ -0,0 +1,435 @@
+@x
+@d my_name=='pbibtex'
+@d banner=='This is pBibTeX, Version 0.99d-j0.33'
+@y
+@d my_name=='upbibtex'
+@d banner=='This is upBibTeX, Version 0.99d-j0.33-u1.27'
+@z
+
+@x
+for i:=@'200 to @'237 do xchr[i]:=chr(i-@'200);
+for i:=@'240 to 255 do xchr[i]:=chr(i);
+@y
+for i:=@'200 to 255 do xchr[i]:=chr(i);
+@z
+
+@x
+for i:=@'200 to @'237 do xord[i]:= i-@'200;
+for i:=@'240 to 255 do xord[i]:=i;
+@y
+for i:=@'200 to 255 do xord[i]:=i;
+@z
+
+@x
+@d zen_pun_first = 161 {Zenkaku punctuation first byte; in EUC}
+@d zen_space = 161 {Zenkaku space first, second byte; in EUC}
+@d zen_kuten = 162 {Zenkaku kuten second byte; in EUC}
+@d zen_ten = 163 {Zenkaku ten second byte; in EUC}
+@d zen_comma = 164 {Zenkaku comman second byte; in EUC}
+@d zen_period = 165 {Zenkaku period second byte; in EUC}
+@d zen_question = 169 {Zenkaku question mark second byte; in EUC}
+@d zen_exclamation = 170 {Zenkaku exclamation mark second byte; in EUC}
+@y
+@d e_ss3 = @"8F {single shift three in EUC}
+@d e_pun_first = @"A1 {Zenkaku punctuation first byte; in EUC}
+@d e_space = @"A1A1 {Zenkaku space; in EUC}
+@d e_toten = @"A1A2 {Zenkaku kuten; in EUC}
+@d e_kuten = @"A1A3 {Zenkaku toten; in EUC}
+@d e_comma = @"A1A4 {Zenkaku comman; in EUC}
+@d e_period = @"A1A5 {Zenkaku period; in EUC}
+@d e_question = @"A1A9 {Zenkaku question mark; in EUC}
+@d e_exclamation =@"A1AA {Zenkaku exclamation mark; in EUC}
+@d u_pun_first1 = @"E3 {Zenkaku punctuation first byte(1); in UTF-8}
+@d u_pun_first2 = @"EF {Zenkaku punctuation first byte(2); in UTF-8}
+@d u_space = @"3000 {Zenkaku space; in UCS}
+@d u_toten = @"3001 {Zenkaku toten; in UCS}
+@d u_kuten = @"3002 {Zenkaku kuten; in UCS}
+@d u_comma = @"FF0C {Zenkaku comman; in UCS}
+@d u_period = @"FF0E {Zenkaku period; in UCS}
+@d u_question = @"FF1F {Zenkaku question mark; in UCS}
+@d u_exclamation = @"FF01 {Zenkaku exclamation mark; in UCS}
+@d u_double_question = @"2047 {Zenkaku double question mark; in UCS}
+@d u_double_exclam = @"203C {Zenkaku double exclamation mark; in UCS}
+@d u_question_exclam = @"2048 {Zenkaku question exclamation mark; in UCS}
+@d u_exclam_question = @"2049 {Zenkaku exclamation question mark; in UCS}
+@z
+
+@x
+for i:=@'200 to @'237 do lex_class[i] := illegal;
+for i:=@'240 to 255 do lex_class[i] := alpha;
+lex_class[@'33]:=alpha;
+@y
+@z
+
+@x
+for i:=@'200 to @'237 do id_class[i] := illegal_id_char;
+@y
+@z
+
+@x
+for i:=@'240 to 254 do char_width[i]:=514;
+@y
+@z
+
+@x procedure get_the_top_level_aux_file_name
+label aux_found,@!aux_not_found;
+@y
+label aux_found,@!aux_not_found;
+var i:0..last_text_char; {this is the first one declared}
+@z
+@x
+ @<Process a possible command line@>
+@y
+ @<Process a possible command line@>
+ @<Initialize variables depending on Kanji code@>
+@z
+
+@x
+ zen_ten,
+ zen_period,
+ zen_question,
+ zen_exclamation:
+ if( str_pool[sp_ptr-1] = zen_pun_first ) then
+ repush_string
+ else
+ @<Add the |period| (it's necessary) and push@>;
+ othercases
+ @<Add the |period| (it's necessary) and push@>
+@y
+ othercases
+ begin
+ if (is_internalEUC) then
+ begin
+ case (fromBUFF(str_pool, sp_ptr+1, sp_ptr-1)) of
+ e_kuten,
+ e_period,
+ e_question,
+ e_exclamation:
+ if (str_pool[sp_ptr-2]<>e_ss3) then
+ repush_string
+ else
+ @<Add the |period| (it's necessary) and push@>;
+ othercases
+ @<Add the |period| (it's necessary) and push@>;
+ endcases;
+ end;
+ if (is_internalUPTEX) then
+ begin
+ case (fromBUFF(str_pool, sp_ptr+1, sp_ptr-2)) of
+ u_kuten,
+ u_period,
+ u_question,
+ u_exclamation,
+ u_double_question,
+ u_double_exclam,
+ u_question_exclam,
+ u_exclam_question:
+ repush_string;
+ othercases
+ @<Add the |period| (it's necessary) and push@>;
+ endcases;
+ end;
+ end;
+@z
+
+@x
+ if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is 2byte long }
+@y
+ if(str_pool[str_start[pop_lit1]]>127) then { a KANJI char is |2..4|byte long }
+@z
+
+@x
+ if( (ex_buf[ex_buf_ptr-1]=zen_comma) or (ex_buf[ex_buf_ptr-1]=zen_kuten) )
+ then ex_buf_ptr := ex_buf_ptr - 2
+ else ex_buf_ptr := ex_buf_ptr - 4;
+@y
+ if (is_internalEUC) then
+ if((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-2) = e_comma) or
+ (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-2) = e_toten))
+ then ex_buf_ptr := ex_buf_ptr - 2
+ else ex_buf_ptr := ex_buf_ptr - 4;
+ if (is_internalUPTEX) then
+ if((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-3) = u_comma) or
+ (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr-3) = u_toten))
+ then ex_buf_ptr := ex_buf_ptr - 3
+ else ex_buf_ptr := ex_buf_ptr - 4;
+@z
+
+@x
+ zen_pun_first:
+ begin
+ if((ex_buf[ex_buf_ptr+1]=zen_comma) or
+ (ex_buf[ex_buf_ptr+1]=zen_kuten) ) then
+@y
+ e_pun_first:
+ if (is_internalEUC) then
+ begin
+ if ((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = e_comma) or
+ (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = e_toten)) then
+@z
+@x
+ else if(ex_buf[ex_buf_ptr+1]=zen_space) then
+@y
+ else if (fromBUFF(ex_buf,ex_buf_length,ex_buf_ptr) = e_space) then
+@z
+@x
+ end;
+@y
+ end else begin
+ ex_buf_ptr := ex_buf_ptr + multibytelen(ex_buf[ex_buf_ptr]);
+ preceding_white := false;
+ end;
+ u_pun_first1,
+ u_pun_first2:
+ if (is_internalUPTEX) then
+ begin
+ if ((fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = u_comma) or
+ (fromBUFF(ex_buf, ex_buf_length, ex_buf_ptr) = u_toten)) then
+ begin
+ preceding_white := false;
+ and_found := true
+ end
+ else if (fromBUFF(ex_buf,ex_buf_length,ex_buf_ptr) = u_space) then
+ begin
+ ex_buf[ex_buf_ptr] := space;
+ ex_buf[ex_buf_ptr+1] := space;
+ ex_buf[ex_buf_ptr+2] := space;
+ preceding_white := true;
+ end;
+ ex_buf_ptr := ex_buf_ptr + 3;
+ end else begin
+ ex_buf_ptr := ex_buf_ptr + multibytelen(ex_buf[ex_buf_ptr]);
+ preceding_white := false;
+ end;
+@z
+
+@x
+ if( ex_buf[ex_buf_ptr] > 127 ) then
+ ex_buf_ptr := ex_buf_ptr +2
+ else
+ incr(ex_buf_ptr);
+@y
+ ex_buf_ptr := ex_buf_ptr + multibytelen(ex_buf[ex_buf_ptr]);
+@z
+
+@x
+ if name_buf[name_bf_ptr]>127 then begin
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr]);
+ incr(name_bf_ptr);
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr]);
+ end
+ else
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr]);
+@y
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr]);
+ if multibytelen(name_buf[name_bf_ptr]) > 1 then
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr+1]);
+ if multibytelen(name_buf[name_bf_ptr]) > 2 then
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr+2]);
+ if multibytelen(name_buf[name_bf_ptr]) > 3 then
+ append_ex_buf_char_and_check (name_buf[name_bf_ptr+3]);
+ name_bf_ptr := name_bf_ptr + multibytelen(name_buf[name_bf_ptr])-1;
+@z
+
+@x
+{ 2 bytes Kanji code break check }
+tps:=str_start[pop_lit3];
+while (tps < sp_ptr) do begin
+ if str_pool[tps] > 127
+ then tps := tps + 2
+ else incr(tps);
+end;
+tpe:=tps;
+while (tpe < sp_end) do begin
+ if str_pool[tpe] > 127
+ then tpe := tpe+2
+ else incr(tpe);
+end;
+if tps<>sp_ptr then begin
+ if tps>str_start[pop_lit3]
+ then decr(sp_ptr)
+ else incr(sp_ptr);
+end;
+if tpe<>sp_end then begin
+ if tpe<str_start[pop_lit3+1]
+ then incr(sp_end)
+ else decr(sp_end);
+end;
+@y
+{ |2..4| bytes Kanji code break check }
+tps:=str_start[pop_lit3];
+tpe:=tps;
+while tpe < str_start[pop_lit3+1] do begin
+ if multibytelen(str_pool[tpe])<0
+ or (str_start[pop_lit3+1] < tpe+multibytelen(str_pool[tpe])) then
+ break;
+ tpe := tpe + multibytelen(str_pool[tpe]);
+ if tpe<=sp_ptr then
+ tps := tpe;
+ if sp_end<=tpe then break;
+end;
+sp_ptr := tps;
+sp_end := tpe;
+@z
+
+@x
+ if str_pool[sp_ptr] >127 then begin
+ append_char (str_pool[sp_ptr]); incr(sp_ptr);
+ append_char (str_pool[sp_ptr]); incr(sp_ptr);
+ end
+ else begin
+ append_char (str_pool[sp_ptr]); incr(sp_ptr);
+ end;
+@y
+ append_char (str_pool[sp_ptr]);
+ incr(sp_ptr);
+@z
+
+@x
+ incr(sp_xptr1); num_text_chars:=num_text_chars+2;
+@y
+ num_text_chars := num_text_chars + multibytelen(str_pool[sp_xptr1-1]);
+ sp_xptr1 := sp_xptr1-1 + multibytelen(str_pool[sp_xptr1-1]);
+@z
+
+@x
+const n_options = 6; {Pascal won't count array lengths for us.}
+@y
+const n_options = 7; {Pascal won't count array lengths for us.}
+@z
+
+@x
+ usage_help (PBIBTEX_HELP, 'issue@@texjp.org');
+@y
+ usage_help (UPBIBTEX_HELP, 'issue@@texjp.org');
+@z
+
+@x
+ end; {Else it was a flag; |getopt| has already done the assignment.}
+@y
+ end else if argument_is ('kanji-internal') then begin
+ if (not (set_enc_string(nil,optarg) and
+ (is_internalEUC or is_internalUPTEX))) then
+ write_ln('Bad internal kanji encoding "', stringcast(optarg), '".');
+
+ end; {Else it was a flag; |getopt| has already done the assignment.}
+@z
+
+@x
+@ An element with all zeros always ends the list.
+@y
+@ Kanji-internal option.
+@.-kanji-internal@>
+
+@<Define the option...@> =
+long_options[current_option].name := 'kanji-internal';
+long_options[current_option].has_arg := 1;
+long_options[current_option].flag := 0;
+long_options[current_option].val := 0;
+incr(current_option);
+
+@ An element with all zeros always ends the list.
+@z
+
+@x procedure x_is_kanji_str
+procedure x_is_kanji_str;
+label exit;
+@y
+procedure x_is_kanji_str;
+label exit;
+var ctmp,clen:integer;
+@z
+
+@x procedure x_is_kanji_str (cont.)
+ while sp_ptr<sp_end do begin
+ if str_pool[sp_ptr]>127 then begin
+ push_lit_stk(1,stk_int);
+ return;
+ end else begin
+ incr(sp_ptr);
+ end;
+ end;
+@y
+ while sp_ptr<sp_end do begin
+ clen := multibytelen(str_pool[sp_ptr]);
+ if sp_ptr+clen<=sp_end then
+ ctmp := fromBUFF(str_pool, sp_ptr+clen, sp_ptr)
+ else
+ ctmp := str_pool[sp_ptr];
+ if is_char_kanji_upbibtex(ctmp) then begin
+ push_lit_stk(1,stk_int);
+ return;
+ end else begin
+ if sp_ptr+clen<=sp_end then
+ sp_ptr := sp_ptr + clen
+ else
+ incr(sp_ptr);
+ end;
+ end;
+@z
+
+@x
+exit:end;
+@y
+exit:end;
+
+@ @<Procedures and functions for handling numbers, characters, and strings@>=
+function is_char_kanji_upbibtex(@!c:integer):boolean;
+label exit;
+var k:integer;
+begin
+ { based on upTeX-1.26 kcatcode status: 16,17,19->true / 15,18->false }
+ is_char_kanji_upbibtex := true;
+ if (is_internalUPTEX) then begin { should be in sync with |kcat_code| of uptex-m.ch }
+ k := kcatcodekey(c);
+ if k=@"24 then return { Hangul Jamo }
+ else if (k>=@"67)and(k<=@"69) then return { CJK Radicals Supplement .. Ideographic Description Characters }
+ else if (k>=@"6B)and(k<=@"6C) then return { Hiragana, Katakana }
+ else if k=@"6D then return { Bopomofo }
+ else if k=@"6E then return { Hangul Compatibility Jamo }
+ else if (k>=@"6F)and(k<=@"71) then return { Kanbun .. CJK Strokes }
+ else if k=@"72 then return { Katakana Phonetic Extensions }
+ else if k=@"75 then return { CJK Unified Ideographs Extension A }
+ else if k=@"77 then return { CJK Unified Ideographs }
+ else if k=@"87 then return { Hangul Jamo Extended-A }
+ else if k=@"92 then return { Hangul Syllables }
+ else if k=@"93 then return { Hangul Jamo Extended-B }
+ else if k=@"98 then return { CJK Compatibility Ideographs }
+ else if (k>=@"103)and(k<=@"105) then return { Kana Supplement .. Small Kana Extension }
+ else if (k>=@"129)and(k<=@"12F) then return { CJK Unified Ideographs Extension B .. G }
+ else if k=@"1FE then return { Fullwidth digit and latin alphabet }
+ else if k=@"1FF then return; { Halfwidth katakana }
+ end
+ else { is_internalEUC }
+ if is_char_kanji(c) then return;
+ is_char_kanji_upbibtex := false;
+exit:end;
+
+@ @<Initialize variables depending on Kanji code@>=
+if (is_internalUPTEX) then
+ begin
+ for i:=@"80 to @"BF do lex_class[i] := alpha; { trail bytes }
+ for i:=@"C0 to @"C1 do lex_class[i] := illegal;
+ for i:=@"C2 to @"F4 do lex_class[i] := alpha; { lead bytes }
+ for i:=@"F5 to @"FF do lex_class[i] := illegal;
+ for i:=@"C0 to @"C1 do id_class[i] := illegal_id_char;
+ for i:=@"F5 to @"FF do id_class[i] := illegal_id_char;
+ for i:=@"80 to @"BF do char_width[i]:=257; { trail bytes }
+ for i:=@"C2 to @"DF do char_width[i]:=771; { lead bytes (2bytes) }
+ for i:=@"E0 to @"EF do char_width[i]:=514; { lead bytes (3bytes) }
+ for i:=@"F0 to @"F4 do char_width[i]:=257; { lead bytes (4bytes) }
+ end
+else
+ begin { is_internalEUC }
+ for i:=@'200 to @'240 do lex_class[i] := illegal;
+ for i:=@'241 to 254 do lex_class[i] := alpha;
+ lex_class[255]:=illegal;
+ for i:=@'200 to @'240 do id_class[i] := illegal_id_char;
+ id_class[255]:=illegal_id_char;
+ lex_class[@'33]:=alpha;
+ lex_class[e_ss3]:=alpha;
+ for i:=@'241 to 254 do char_width[i]:=514;
+ char_width[e_ss3]:=0;
+ end;
+@z
+
diff --git a/Build/source/texk/web2c/uptexdir/upbibtex.test b/Build/source/texk/web2c/uptexdir/upbibtex.test
new file mode 100755
index 00000000000..715608c56d3
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/upbibtex.test
@@ -0,0 +1,15 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2017 Karl Berry <tex-live@tug.org>
+# Copyright 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+cp $srcdir/tests/exampl.aux uptests/xexampl.aux
+
+TEXMFCNF=$srcdir/../kpathsea \
+ BSTINPUTS=$srcdir/tests \
+ BIBINPUTS=$srcdir/tests \
+ ./upbibtex uptests/xexampl || exit 1
+
diff --git a/Build/source/texk/web2c/uptexdir/updvitype.ch b/Build/source/texk/web2c/uptexdir/updvitype.ch
new file mode 100644
index 00000000000..41b0aae3936
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/updvitype.ch
@@ -0,0 +1,39 @@
+@x
+@d my_name=='pdvitype'
+@d banner=='This is pDVItype, Version 3.6-p0.5'
+@y
+@d my_name=='updvitype'
+@d banner=='This is upDVItype, Version 3.6-p0.5-u1.27'
+@z
+
+@x procedure initialize
+ print (banner);
+ print_ln (version_string);
+@y
+ print (banner);
+ print (' (');
+ print (conststringcast(get_enc_string));
+ print (')');
+ print_ln (version_string);
+@z
+
+@x procedure out_kanji
+ if text_ptr>=line_length-3 then flush_text;
+ c:=toBUFF(fromDVI(c));
+ incr(text_ptr); text_buf[text_ptr]:= Hi(c);
+ incr(text_ptr); text_buf[text_ptr]:= Lo(c);
+@y
+ if text_ptr>=line_length-5 then flush_text;
+ c:=toBUFF(fromDVI(c));
+ if BYTE1(c)<>0 then begin incr(text_ptr); text_buf[text_ptr]:=BYTE1(c); end;
+ if BYTE2(c)<>0 then begin incr(text_ptr); text_buf[text_ptr]:=BYTE2(c); end;
+ if BYTE3(c)<>0 then begin incr(text_ptr); text_buf[text_ptr]:=BYTE3(c); end;
+ incr(text_ptr); text_buf[text_ptr]:=BYTE4(c);
+@z
+
+@x
+ usage_help (PDVITYPE_HELP, 'issue@@texjp.org');
+@y
+ usage_help (UPDVITYPE_HELP, 'issue@@texjp.org');
+@z
+
diff --git a/Build/source/texk/web2c/uptexdir/updvitype.test b/Build/source/texk/web2c/uptexdir/updvitype.test
new file mode 100755
index 00000000000..191b01eca15
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/updvitype.test
@@ -0,0 +1,20 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2017 Karl Berry <tex-live@tug.org>
+# Copyright 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+if tfmpath=`$KPSEWHICH cmbx10.tfm`; then
+
+ TEXMFCNF=$srcdir/../kpathsea \
+ TFMFONTS=`dirname "$tfmpath"` \
+ ./updvitype -show-opcodes $srcdir/tests/story >uptests/xstory.dvityp || exit 1
+
+fi
+
+TEXMFCNF=$srcdir/../kpathsea \
+ TFMFONTS=$srcdir/tests \
+ ./updvitype --p=\*.\*.2 $srcdir/tests/pagenum.dvi >uptests/xpagenum.typ || exit 1
+
diff --git a/Build/source/texk/web2c/uptexdir/uppltotf.ch b/Build/source/texk/web2c/uptexdir/uppltotf.ch
new file mode 100644
index 00000000000..8978f5de8d6
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uppltotf.ch
@@ -0,0 +1,108 @@
+@x
+@d my_name=='ppltotf'
+@d banner=='This is pPLtoTF, Version 3.6-p2.0'
+@y
+@d my_name=='uppltotf'
+@d banner=='This is upPLtoTF, Version 3.6-p2.0-u1.27'
+@z
+
+@x
+ usage_help (PPLTOTF_HELP, 'issue@@texjp.org');
+@y
+ usage_help (UPPLTOTF_HELP, 'issue@@texjp.org');
+@z
+
+@x
+max_kanji=7237; { maximum number of 2byte characters }
+max_kanji_code=@"7E7E; { maximum jis code }
+@y
+max_kanji=1114111; { maximam number of 2byte characters }
+max_kanji_code=@"10FFFF; { maximum ucs code }
+@z
+
+@x function get_next_raw
+if multistrlen(ustringcast(buffer),loc+2,loc)=2 then cur_char:=" "
+@y
+if multistrlen(ustringcast(buffer),loc+3,loc)>1 then cur_char:=" "
+@z
+
+@x procedure print_jis_hex
+var dig:array[0..3] of byte; {holds jis hex codes}
+i:byte; {index of array}
+begin dig[0]:=Hi(jis_code) div 16; dig[1]:=Hi(jis_code) mod 16;
+dig[2]:=Lo(jis_code) div 16; dig[3]:=Lo(jis_code) mod 16;
+for i:=0 to 3 do
+@y
+var dig:array[0..5] of byte; {holds jis hex codes}
+i:byte; {index of array}
+begin dig[0]:=(jis_code div 65536) div 16; dig[1]:=(jis_code div 65536) mod 16;
+dig[2]:=(jis_code div 4096) mod 16; dig[3]:=(jis_code div 256) mod 16;
+dig[4]:=(jis_code div 16) mod 16; dig[5]:=jis_code mod 16;
+for i:=0 to 1 do
+ if (dig[i]<>0)or(dig[0]<>0) then begin { if dig[0]<>0, dig[1] should be always printed }
+ if dig[i]<10 then print(dig[i]) else
+ case dig[i] of
+ 10: print('A'); 11: print('B'); 12: print('C');
+ 13: print('D'); 14: print('E'); 15: print('F');
+ end;
+ end;
+for i:=2 to 5 do
+@z
+
+@x function valid_jis_code
+var @!first_byte,@!second_byte:integer; { jis code bytes }
+begin valid_jis_code:=true;
+first_byte:=cx div @'400; second_byte:=cx mod @'400;
+if (first_byte<@"21)
+ or((first_byte>@"28)and(first_byte<@"30))
+ or(first_byte>@"74) then valid_jis_code:=false;
+if (second_byte<@"21)or(second_byte>@"7E) then valid_jis_code:=false;
+@y
+begin valid_jis_code:=true;
+if (cx>@"10FFFF)or(not is_char_kanji(fromDVI(cx)))
+ or(toDVI(fromDVI(cx))<>cx) then valid_jis_code:=false;
+@z
+
+@x function jis_to_index
+var @!first_byte,@!second_byte:integer; { jis code bytes }
+begin
+first_byte:=jis div @'400 -@"21;
+second_byte:=jis mod @'400 -@"21;
+if first_byte<8 then
+ jis_to_index:=first_byte*94+second_byte
+else { next |first_byte| start 16 }
+ jis_to_index:=(first_byte-7)*94+second_byte;
+@y
+begin
+jis_to_index:=jis;
+@z
+
+@x function index_to_jis
+begin if ix<=8*94-1 then
+ index_to_jis:=(ix div 94 +@"21)*@'400+(ix mod 94 +@"21)
+else
+ index_to_jis:=((ix+7*94) div 94 +@"21)*@'400+((ix+7*94) mod 94 +@"21);
+@y
+begin
+index_to_jis:=ix;
+@z
+
+@x function get_kanji
+else if multistrlen(ustringcast(buffer), loc+2, loc)=2 then
+ begin jis_code:=toDVI(fromBUFF(ustringcast(buffer), loc+2, loc));
+ incr(loc); cur_char:=" ";
+@y
+else if (ch='U')or(ch='u') then
+ begin repeat ch:=get_next_raw;
+ until ch<>' '; {skip the blanks after the type code}
+ @<Scan a Kanji hexadecimal code@>;
+ jis_code:=toDVI(fromUCS(cx)); cur_char:=ch;
+ if not valid_jis_code(jis_code) then
+ err_print('jis code ', jis_code:1, ' is invalid');
+ end
+else if multistrlen(ustringcast(buffer), loc+4, loc)>1 then
+ begin cur_char:=" ";
+ jis_code:=toDVI(fromBUFF(ustringcast(buffer), loc+4, loc));
+ loc:=loc+multistrlen(ustringcast(buffer), loc+4, loc)-1;
+@z
+
diff --git a/Build/source/texk/web2c/uptexdir/uppltotf.test b/Build/source/texk/web2c/uptexdir/uppltotf.test
new file mode 100755
index 00000000000..845a5c51441
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uppltotf.test
@@ -0,0 +1,10 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2017 Karl Berry <tex-live@tug.org>
+# Copyright 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+./uppltotf -verbose $srcdir/tests/cmr10 uptests/xcmr10 || exit 1
+
diff --git a/Build/source/texk/web2c/uptexdir/uptex-m.ch b/Build/source/texk/web2c/uptexdir/uptex-m.ch
new file mode 100644
index 00000000000..78f830cb897
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptex-m.ch
@@ -0,0 +1,1266 @@
+% This is a change file for upTeX u1.27
+% By Takuji Tanaka.
+%
+% (02/26/2007) TTK upTeX u0.01
+% (03/18/2007) TTK upTeX u0.03
+% (04/08/2007) TTK upTeX u0.05
+% (04/15/2007) TTK upTeX u0.06
+% (05/13/2007) TTK upTeX u0.07
+% (05/28/2007) TTK upTeX u0.08
+% (06/16/2007) TTK upTeX u0.09
+% (07/28/2007) TTK upTeX u0.10
+% (08/07/2007) TTK upTeX u0.11
+% (08/25/2007) TTK upTeX u0.12
+% (09/15/2007) TTK upTeX u0.13
+% (09/25/2007) TTK upTeX u0.14
+% (10/18/2007) TTK upTeX u0.15
+% (11/10/2007) TTK upTeX u0.16
+% (11/13/2007) TTK upTeX u0.17
+% (12/08/2007) TTK upTeX u0.18
+% (12/26/2007) TTK upTeX u0.19
+% (01/12/2008) TTK upTeX u0.20
+% (03/13/2008) TTK upTeX u0.21
+% (08/03/2008) TTK upTeX u0.22
+% (09/04/2008) TTK upTeX u0.23
+% (10/18/2008) TTK upTeX u0.24
+% (12/13/2008) TTK upTeX u0.25
+% (02/21/2009) TTK upTeX u0.26
+% (03/12/2009) TTK upTeX u0.27
+% (08/23/2009) TTK upTeX u0.28
+% (01/31/2010) TTK upTeX u0.29
+% (04/10/2010) TTK upTeX u0.30
+% (01/15/2012) TTK upTeX u1.00
+% (04/29/2012) TTK upTeX u1.10
+% (08/13/2012) TTK upTeX u1.11
+% (12/29/2014) TTK upTeX u1.20
+% (02/20/2016) TTK upTeX u1.21
+% (01/15/2017) TTK upTeX u1.22
+% (04/09/2017) TTK Hironori Kitagawa fixed a bug in \endlinechar.
+% (2018-01-21) HK Added \uptexversion primitive and co.
+% (2018-02-24) TTK upTeX u1.23
+% (2019-02-23) TTK upTeX u1.24
+% (2019-05-06) HK Hironori Kitagawa fixed a bug in \if.
+% (2019-05-06) TTK upTeX u1.25
+% (2020-02-22) TTK upTeX u1.26
+% (2020-10-25) TTK upTeX u1.27
+
+@x upTeX: banner
+ {printed when \pTeX\ starts}
+@y
+ {printed when \pTeX\ starts}
+@#
+@d upTeX_version=1
+@d upTeX_revision==".27"
+@d upTeX_version_string=='-u1.27' {current u\pTeX\ version}
+@#
+@d upTeX_banner=='This is upTeX, Version 3.141592653',pTeX_version_string,upTeX_version_string
+@d upTeX_banner_k==upTeX_banner
+ {printed when u\pTeX\ starts}
+@z
+
+@x upTeX: banner
+@d banner==pTeX_banner
+@d banner_k==pTeX_banner_k
+@y
+@d banner==upTeX_banner
+@d banner_k==upTeX_banner_k
+@z
+
+@x
+@!KANJI_code=0..65535; {sixteen-bit numbers}
+@y
+@!KANJI_code=0..@"FFFFFF; {0..0x10FFFF: Unicode, 0x110000..0xFFFFFF: special}
+@z
+
+@x
+@!trick_buf2:array[0..ssup_error_line] of 0..2; {pTeX: buffer for KANJI}
+@!kcode_pos: 0..2; {pTeX: denotes whether first byte or second byte of KANJI}
+@y
+@!trick_buf2:array[0..ssup_error_line] of 0..@'24; {pTeX: buffer for KANJI}
+@!kcode_pos: 0..@'24; {pTeX: denotes whether first byte or second byte of KANJI
+ 1..2:2byte-char, 11..13:3byte-char, 21..24:4byte-char}
+@!kcp: 0..@'24; {temporary |kcode_pos|}
+@z
+
+@x
+procedure print_ln; {prints an end-of-line}
+@y
+procedure print_ln; {prints an end-of-line}
+var @!ii: integer;
+@z
+
+@x
+ if kcode_pos=1 then begin wterm(' '); wlog(' '); end;
+@y
+ if nrestmultichr(kcode_pos)>0 then
+ for ii:=0 to nrestmultichr(kcode_pos)-1 do
+ begin wterm(' '); wlog(' '); end;
+@z
+
+@x
+log_only: begin if kcode_pos=1 then wlog(' ');
+@y
+log_only: begin
+ if nrestmultichr(kcode_pos)>0 then
+ for ii:=0 to nrestmultichr(kcode_pos)-1 do wlog(' ');
+@z
+
+@x
+term_only: begin if kcode_pos=1 then wterm(' ');
+@y
+term_only: begin
+ if nrestmultichr(kcode_pos)>0 then
+ for ii:=0 to nrestmultichr(kcode_pos)-1 do wterm(' ');
+@z
+
+@x
+if kcode_pos=1 then kcode_pos:=2
+@y
+if (kcode_pos=1)or((kcode_pos>=@'11)and(kcode_pos<=@'12))
+ or((kcode_pos>=@'21)and(kcode_pos<=@'23)) then incr(kcode_pos)
+@z
+
+@x
+ begin kcode_pos:=1;
+@y
+ begin
+ if (ismultichr(4,1,xchr[s])) then kcode_pos:=@'21
+ else if (ismultichr(3,1,xchr[s])) then kcode_pos:=@'11
+ else kcode_pos:=1;
+@z
+
+@x
+ if file_offset>=max_print_line-1 then
+@y
+ if file_offset>=max_print_line-nrestmultichr(kcode_pos) then
+@z
+
+@x
+ if term_offset>=max_print_line-1 then
+@y
+ if term_offset>=max_print_line-nrestmultichr(kcode_pos) then
+@z
+
+@x
+@d min_quarterword=0 {smallest allowable value in a |quarterword|}
+@d max_quarterword=255 {largest allowable value in a |quarterword|}
+@d min_halfword==-@"FFFFFFF {smallest allowable value in a |halfword|}
+@d max_halfword==@"FFFFFFF {largest allowable value in a |halfword|}
+@d max_cjk_val=@"10000
+@y
+@d min_quarterword=0 {smallest allowable value in a |quarterword|}
+@d max_quarterword=@"FFFF {largest allowable value in a |quarterword|}
+@d min_halfword=-@"3FFFFFFF {smallest allowable value in a |halfword|}
+@d max_halfword=@"3FFFFFFF {largest allowable value in a |halfword|}
+@d max_cjk_val=@"1000000 {to separate wchar and kcatcode}
+@z
+
+@x
+@d kanji=16 {kanji}
+@d kana=17 {hiragana, katakana, alphabet}
+@d other_kchar=18 {kanji codes}
+@d max_char_code=18 {largest catcode for individual characters}
+@y
+@d not_cjk=15 {is not cjk characters}
+@d kanji=16 {kanji}
+@d kana=17 {hiragana, katakana, alphabet}
+@d other_kchar=18 {cjk symbol codes}
+@d hangul=19 {hangul codes}
+@d max_char_code=19 {largest catcode for individual characters}
+@z
+
+@x
+@d math_comp=left_right+1 {component of formula ( \.{\\mathbin}, etc.~)}
+@y
+@d kchar_num=left_right+1 {cjk character specified numerically ( \.{\\kchar} )}
+@d math_comp=kchar_num+1 {component of formula ( \.{\\mathbin}, etc.~)}
+@z
+
+@x
+@d math_given=char_given+1 {math code defined by \.{\\mathchardef}}
+@y
+@d kchar_given=char_given+1 {cjk character code defined by \.{\\kchardef}}
+@d math_given=kchar_given+1 {math code defined by \.{\\mathchardef}}
+@z
+
+@x
+@d max_command=set_auto_spacing {the largest command code seen at |big_switch|}
+@y
+@d set_enable_cjk_token=set_auto_spacing+1 {set cjk mode ( \.{\\enablecjktoken}, \.{\\disablecjktoken}, \.{\\forcecjktoken} )}
+@d max_command=set_enable_cjk_token {the largest command code seen at |big_switch|}
+@z
+
+@x
+@d cat_code_base=auto_xspacing_code+1
+ {table of 256 command codes (the ``catcodes'')}
+@d kcat_code_base=cat_code_base+256
+ {table of 256 command codes for the wchar's catcodes }
+@d auto_xsp_code_base=kcat_code_base+256 {table of 256 auto spacer flag}
+@y
+@d enable_cjk_token_code=auto_xspacing_code+1
+@d cat_code_base=enable_cjk_token_code+1
+ {table of 256 command codes (the ``catcodes'')}
+@d kcat_code_base=cat_code_base+256
+ {table of 512 command codes for the wchar's catcodes }
+@d auto_xsp_code_base=kcat_code_base+512 {table of 256 auto spacer flag}
+@z
+
+@x
+@d auto_xspacing==equiv(auto_xspacing_code)
+@y
+@d auto_xspacing==equiv(auto_xspacing_code)
+@d enable_cjk_token==equiv(enable_cjk_token_code)
+@z
+
+@x
+eqtb[auto_xspacing_code]:=eqtb[cat_code_base];
+for k:=0 to 255 do
+ begin cat_code(k):=other_char; kcat_code(k):=other_kchar;
+ math_code(k):=hi(k); sf_code(k):=1000;
+ auto_xsp_code(k):=0; inhibit_xsp_code(k):=0; inhibit_xsp_type(k):=0;
+ kinsoku_code(k):=0; kinsoku_type(k):=0;
+ end;
+@y
+eqtb[auto_xspacing_code]:=eqtb[cat_code_base];
+eqtb[enable_cjk_token_code]:=eqtb[cat_code_base];
+for k:=0 to 255 do
+ begin cat_code(k):=other_char;
+ math_code(k):=hi(k); sf_code(k):=1000;
+ auto_xsp_code(k):=0; inhibit_xsp_code(k):=0; inhibit_xsp_type(k):=0;
+ kinsoku_code(k):=0; kinsoku_type(k):=0;
+ end;
+for k:=0 to 511 do
+ begin kcat_code(k):=other_kchar;
+ end;
+@z
+
+@x
+@t\hskip10pt@>kcat_code(@"20+1):=other_kchar; {1 ku}
+@t\hskip10pt@>kcat_code(@"20+2):=other_kchar; {2 ku}
+@+@t\1@>for k:=3 to 6 do kcat_code(@"20+k):=kana; {3 ku ... 6 ku}
+@+@t\1@>for k:=7 to 8 do kcat_code(@"20+k):=other_kchar; {7 ku ... 8 ku}
+@+@t\1@>for k:=16 to 84 do kcat_code(@"20+k):=kanji; {16 ku ... 84 ku}
+{ $\.{@@"20}+|k| = |kcatcodekey|(|fromKUTEN|(|HILO|(k,1))$ }
+@y
+if (isinternalUPTEX) then begin
+ { default: |other_kchar| }
+ @t\hskip10pt@>kcat_code(@"0):=not_cjk;
+ @+@t\1@>for k:=@"2 to @"3 do kcat_code(k):=not_cjk; { Latin Extended-A, Latin Extended-B }
+ @t\hskip10pt@>kcat_code(@"24):=hangul; { Hangul Jamo }
+ @t\hskip10pt@>kcat_code(@"45):=not_cjk; { Latin Extended Additional }
+ @+@t\1@>for k:=@"67 to @"69 do kcat_code(k):=kanji; { CJK Radicals Supplement .. Ideographic Description Characters }
+ @+@t\1@>for k:=@"6B to @"6C do kcat_code(k):=kana; { Hiragana, Katakana }
+ @t\hskip10pt@>kcat_code(@"6D):=kanji; { Bopomofo }
+ @t\hskip10pt@>kcat_code(@"6E):=hangul; { Hangul Compatibility Jamo }
+ @+@t\1@>for k:=@"6F to @"71 do kcat_code(k):=kanji; { Kanbun .. CJK Strokes }
+ @t\hskip10pt@>kcat_code(@"72):=kana; { Katakana Phonetic Extensions }
+ @t\hskip10pt@>kcat_code(@"75):=kanji; { CJK Unified Ideographs Extension A }
+ @t\hskip10pt@>kcat_code(@"77):=kanji; { CJK Unified Ideographs }
+ @t\hskip10pt@>kcat_code(@"87):=hangul; { Hangul Jamo Extended-A }
+ @t\hskip10pt@>kcat_code(@"92):=hangul; { Hangul Syllables }
+ @t\hskip10pt@>kcat_code(@"93):=hangul; { Hangul Jamo Extended-B }
+ @t\hskip10pt@>kcat_code(@"98):=kanji; { CJK Compatibility Ideographs }
+ { \hskip10pt|kcat_code(@"A1):=other_kchar;| Halfwidth and Fullwidth Forms }
+ @+@t\1@>for k:=@"103 to @"105 do kcat_code(k):=kana; { Kana Supplement .. Small Kana Extension }
+ @+@t\1@>for k:=@"129 to @"12F do kcat_code(k):=kanji; { CJK Unified Ideographs Extension B .. G }
+ @t\hskip10pt@>kcat_code(@"1FD):=not_cjk; { Latin-1 Letters }
+ @t\hskip10pt@>kcat_code(@"1FE):=kana; { Fullwidth digit and latin alphabet }
+ @t\hskip10pt@>kcat_code(@"1FF):=kana; { Halfwidth katakana }
+end else begin
+ @t\hskip10pt@>kcat_code(@"20+1):=other_kchar; {1 ku}
+ @t\hskip10pt@>kcat_code(@"20+2):=other_kchar; {2 ku}
+ @+@t\1@>for k:=3 to 6 do kcat_code(@"20+k):=kana; {3 ku ... 6 ku}
+ @+@t\1@>for k:=7 to 13 do kcat_code(@"20+k):=other_kchar; {7 ku ... 13 ku}
+ @+@t\1@>for k:=14 to 120 do kcat_code(@"20+k):=kanji; {14 ku ... 120 ku}
+ { $\.{@@"20}+|k| = |kcatcodekey|(|fromKUTEN|(|HILO|(k,1))$ }
+ @+@t\1@>for k:=16 to 94 do kcat_code(@"A0+k):=kanji; {2 men 16 ku ... 94 ku}
+end;
+@z
+
+@x l.5897 - upTeX
+primitive("char",char_num,0);@/
+@!@:char_}{\.{\\char} primitive@>
+@y
+primitive("char",char_num,0);@/
+@!@:char_}{\.{\\char} primitive@>
+primitive("kchar",kchar_num,0);@/
+@!@:kchar_}{\.{\\kchar} primitive@>
+@z
+
+@x
+ital_corr: print_esc("/");
+@y
+ital_corr: print_esc("/");
+kchar_num: print_esc("kchar");
+@z
+
+@x
+@d cs_token_flag==@"FFFF {amount added to the |eqtb| location in a
+token that stands for a control sequence; is a multiple of~256, less~1}
+@d left_brace_token=@'0400 {$2^8\cdot|left_brace|$}
+@d left_brace_limit=@'1000 {$2^8\cdot(|left_brace|+1)$}
+@d right_brace_token=@'1000 {$2^8\cdot|right_brace|$}
+@d right_brace_limit=@'1400 {$2^8\cdot(|right_brace|+1)$}
+@d math_shift_token=@'1400 {$2^8\cdot|math_shift|$}
+@d tab_token=@'2000 {$2^8\cdot|tab_mark|$}
+@d out_param_token=@'2400 {$2^8\cdot|out_param|$}
+@d space_token=@'5040 {$2^8\cdot|spacer|+|" "|$}
+@d letter_token=@'5400 {$2^8\cdot|letter|$}
+@d other_token=@'6000 {$2^8\cdot|other_char|$}
+@d match_token=@'6400 {$2^8\cdot|match|$}
+@d end_match_token=@'7000 {$2^8\cdot|end_match|$}
+@y
+@d cs_token_flag=@"1FFFFFFF {amount added to the |eqtb| location in a
+ token that stands for a control sequence; is a multiple of~@@"1000000, less~1}
+@d max_char_val=@"100 {to separate char and command code}
+@d left_brace_token=@"100 {$2^8\cdot|left_brace|$}
+@d left_brace_limit=@"200 {$2^8\cdot(|left_brace|+1)$}
+@d right_brace_token=@"200 {$2^8\cdot|right_brace|$}
+@d right_brace_limit=@"300 {$2^8\cdot(|right_brace|+1)$}
+@d math_shift_token=@"300 {$2^8\cdot|math_shift|$}
+@d tab_token=@"400 {$2^8\cdot|tab_mark|$}
+@d out_param_token=@"500 {$2^8\cdot|out_param|$}
+@d space_token=@"A20 {$2^8\cdot|spacer|+|" "|$}
+@d letter_token=@"B00 {$2^8\cdot|letter|$}
+@d other_token=@"C00 {$2^8\cdot|other_char|$}
+@d match_token=@"D00 {$2^8\cdot|match|$}
+@d end_match_token=@"E00 {$2^8\cdot|end_match|$}
+@z
+
+@x
+ if check_kanji(info(p)) then {|wchar_token|}
+ begin m:=kcat_code(kcatcodekey(info(p))); c:=info(p);
+ end
+ else begin m:=Hi(info(p)); c:=Lo(info(p));
+@y
+ if check_kanji(info(p)) then {|wchar_token|}
+ begin m:=info(p) div max_cjk_val; c:=info(p) mod max_cjk_val; end
+ else begin m:=info(p) div max_char_val; c:=info(p) mod max_char_val;
+@z
+
+@x
+kanji,kana,other_kchar: print_kanji(KANJI(c));
+@y
+kanji,kana,other_kchar,hangul: print_kanji(KANJI(c));
+@z
+
+@x
+kanji,kana,other_kchar: begin print("kanji character ");
+@y
+kanji,kana,other_kchar,hangul: begin print("kanji character ");
+@z
+
+@x
+ if (first_count>0)and(trick_buf2[(first_count-1)mod error_line]=1) then
+ incr(first_count);
+@y
+ kcp:=trick_buf2[(first_count-1)mod error_line];
+ if (first_count>0)and(kcp>0) then
+ first_count:=first_count+nrestmultichr(kcp);
+@z
+
+@x
+if trick_buf2[p mod error_line]=2 then
+ begin p:=p+1; n:=n-1;
+ end;
+@y
+kcp:=trick_buf2[p mod error_line];
+if (kcp mod @'10)>1 then begin
+ p:=p+nrestmultichr(kcp)+1; n:=n-nrestmultichr(kcp)-1; end;
+@z
+
+@x
+if trick_buf2[(p-1) mod error_line]=1 then p:=p-1;
+@y
+kcp:=trick_buf2[(p-1) mod error_line];
+if ((kcp mod @'10)>0)and(nrestmultichr(kcp)>0) then p:=p-(kcp mod @'10);
+@z
+
+@x
+ s:=get_avail; info(s):=Lo(info(loc));
+@y
+ s:=get_avail; info(s):=(info(loc) mod max_char_val);
+@z
+
+@x
+ begin cur_chr:=buffer[loc]; incr(loc);
+ if multistrlen(ustringcast(buffer), limit+1, loc-1)=2 then
+ begin cur_chr:=fromBUFF(ustringcast(buffer), limit+1, loc-1);
+ cur_cmd:=kcat_code(kcatcodekey(cur_chr));
+ incr(loc);
+ end
+ else reswitch: cur_cmd:=cat_code(cur_chr);
+@y
+ begin
+ cur_chr:=fromBUFF(ustringcast(buffer), limit+1, loc);
+ cur_cmd:=kcat_code(kcatcodekey(cur_chr));
+ if (multistrlen(ustringcast(buffer), limit+1, loc)>1) and check_kcat_code(cur_cmd) then begin
+ if (cur_cmd=not_cjk) then cur_cmd:=other_kchar;
+ loc:=loc+multistrlen(ustringcast(buffer), limit+1, loc) end
+ else begin
+ cur_chr:=buffer[loc]; incr(loc);
+ reswitch: cur_cmd:=cat_code(cur_chr);
+ end;
+@z
+
+@x
+@ @d add_delims_to(#)==#+math_shift,#+tab_mark,#+mac_param,
+ #+sub_mark,#+letter,#+other_char
+@d all_jcode(#)==#+kanji,#+kana,#+other_kchar
+@y
+@ @d add_delims_to(#)==#+math_shift,#+tab_mark,#+mac_param,
+ #+sub_mark,#+letter,#+other_char
+@d all_jcode(#)==#+kanji,#+kana,#+other_kchar
+@d hangul_code(#)==#+hangul
+@z
+
+@x
+all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line):
+ state:=mid_kanji;
+@y
+all_jcode(skip_blanks),all_jcode(new_line),all_jcode(mid_line):
+ state:=mid_kanji;
+hangul_code(skip_blanks),hangul_code(new_line),hangul_code(mid_kanji):
+ state:=mid_line;
+@z
+
+@x
+else begin k:=loc; cur_chr:=buffer[k]; incr(k);
+ if multistrlen(ustringcast(buffer), limit+1, k-1)=2 then
+ begin cat:=kcat_code(kcatcodekey(fromBUFF(ustringcast(buffer), limit+1, k-1))); incr(k);
+ end
+ else cat:=cat_code(cur_chr);
+start_cs:
+ if (cat=letter)or(cat=kanji)or(cat=kana) then state:=skip_blanks
+@y
+else begin k:=loc;
+ cur_chr:=fromBUFF(ustringcast(buffer), limit+1, k);
+ cat:=kcat_code(kcatcodekey(cur_chr));
+ if (multistrlen(ustringcast(buffer), limit+1, k)>1) and check_kcat_code(cat) then begin
+ if (cat=not_cjk) then cat:=other_kchar;
+ k:=k+multistrlen(ustringcast(buffer), limit+1, k) end
+ else begin {not multi-byte char}
+ cur_chr:=buffer[k];
+ cat:=cat_code(cur_chr);
+ incr(k);
+ end;
+start_cs:
+ if (cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul) then state:=skip_blanks
+@z
+
+@x
+ else if ((cat=letter)or(cat=kanji)or(cat=kana))and(k<=limit) then
+@y
+ else if ((cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul))and(k<=limit) then
+@z
+
+@x
+ if (cat=kanji)or(cat=kana) then
+@y
+ if (cat=kanji)or(cat=kana)or(cat=hangul) then
+@z
+
+@x
+begin repeat cur_chr:=buffer[k]; incr(k);
+ if multistrlen(ustringcast(buffer), limit+1, k-1)=2 then
+ begin cat:=kcat_code(kcatcodekey(fromBUFF(ustringcast(buffer), limit+1, k-1))); incr(k);
+ end
+ else cat:=cat_code(cur_chr);
+@y
+begin repeat
+ cur_chr:=fromBUFF(ustringcast(buffer), limit+1, k);
+ cat:=kcat_code(kcatcodekey(cur_chr));
+ if (multistrlen(ustringcast(buffer), limit+1, k)>1) and check_kcat_code(cat) then begin
+ if (cat=not_cjk) then cat:=other_kchar;
+ k:=k+multistrlen(ustringcast(buffer), limit+1, k) end
+ else begin {not multi-byte char}
+ cur_chr:=buffer[k];
+ cat:=cat_code(cur_chr);
+ incr(k);
+ end;
+@z
+
+@x
+until not((cat=letter)or(cat=kanji)or(cat=kana))or(k>limit);
+{@@<If an expanded...@@>;}
+if not((cat=letter)or(cat=kanji)or(cat=kana)) then decr(k);
+if cat=other_kchar then decr(k); {now |k| points to first nonletter}
+@y
+until not((cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul))or(k>limit);
+{@@<If an expanded...@@>;}
+if not((cat=letter)or(cat=kanji)or(cat=kana)or(cat=hangul)) then decr(k);
+if cat=other_kchar then k:=k-multilenbuffchar(cur_chr)+1; {now |k| points to first nonletter}
+@z
+
+@x
+ else if check_kanji(t) then {|wchar_token|}
+ begin cur_chr:=t; cur_cmd:=kcat_code(kcatcodekey(t));
+ end
+ else
+ begin cur_cmd:=Hi(t); cur_chr:=Lo(t);
+@y
+ else if check_kanji(t) then {|wchar_token|}
+ begin cur_cmd:=t div max_cjk_val; cur_chr:=t mod max_cjk_val; end
+ else
+ begin cur_cmd:=t div max_char_val; cur_chr:=t mod max_char_val;
+@z
+
+@x
+ if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {|wchar_token|}
+ cur_tok:=cur_chr
+ else cur_tok:=(cur_cmd*@'400)+cur_chr
+@y
+ if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|}
+ cur_tok:=(cur_cmd*max_cjk_val)+cur_chr
+ else cur_tok:=(cur_cmd*max_char_val)+cur_chr
+@z
+
+@x
+ if check_kanji(info(p)) then {|wchar_token|}
+ begin buffer[j]:=Hi(info(p)); incr(j);
+ end;
+ buffer[j]:=Lo(info(p)); incr(j); p:=link(p);
+@y
+ if check_kanji(info(p)) then {|wchar_token|}
+ begin t:=toBUFF(info(p) mod max_cjk_val);
+ if BYTE1(t)<>0 then begin buffer[j]:=BYTE1(t); incr(j); end;
+ if BYTE2(t)<>0 then begin buffer[j]:=BYTE2(t); incr(j); end;
+ if BYTE3(t)<>0 then begin buffer[j]:=BYTE3(t); incr(j); end;
+ buffer[j]:=BYTE4(t); incr(j);
+ p:=link(p);
+ end
+ else
+ begin buffer[j]:=info(p) mod max_char_val; incr(j); p:=link(p);
+ end;
+@z
+
+@x
+ if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ cur_tok:=cur_chr
+ else cur_tok:=(cur_cmd*@'400)+cur_chr
+@y
+ if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ cur_tok:=(cur_cmd*max_cjk_val)+cur_chr
+ else cur_tok:=(cur_cmd*max_char_val)+cur_chr
+@z
+
+@x
+ if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ cur_tok:=cur_chr
+ else cur_tok:=(cur_cmd*@'400)+cur_chr
+@y
+ if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ cur_tok:=(cur_cmd*max_cjk_val)+cur_chr
+ else cur_tok:=(cur_cmd*max_char_val)+cur_chr
+@z
+
+@x
+char_given,math_given: scanned_result(cur_chr)(int_val);
+@y
+kchar_given,
+char_given,math_given: scanned_result(cur_chr)(int_val);
+@z
+
+@x
+@d ptex_minor_version_code=ptex_version_code+1 {code for \.{\\ptexminorversion}}
+@y
+@d ptex_minor_version_code=ptex_version_code+1 {code for \.{\\ptexminorversion}}
+@d uptex_version_code=ptex_minor_version_code+1 {code for \.{\\uptexversion}}
+@z
+
+@x
+primitive("ptexversion",last_item,ptex_version_code);
+@!@:ptexversion_}{\.{\\ptexversion} primitive@>
+@y
+primitive("ptexversion",last_item,ptex_version_code);
+@!@:ptexversion_}{\.{\\ptexversion} primitive@>
+primitive("uptexversion",last_item,uptex_version_code);
+@!@:uptexversion_}{\.{\\uptexversion} primitive@>
+@z
+
+@x
+ ptex_version_code: print_esc("ptexversion");
+@y
+ ptex_version_code: print_esc("ptexversion");
+ uptex_version_code: print_esc("uptexversion");
+@z
+
+@x
+ ptex_version_code: cur_val:=pTeX_version;
+@y
+ ptex_version_code: cur_val:=pTeX_version;
+ uptex_version_code: cur_val:=upTeX_version;
+@z
+
+@x
+ if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {|wchar_token|}
+@y
+ if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|}
+@z
+
+@x
+@!t:halfword; {token being appended}
+@!k:pool_pointer; {index into |str_pool|}
+begin str_room(1);
+p:=temp_head; link(p):=null; k:=b;
+while k<pool_ptr do
+ begin t:=so(str_pool[k]);
+ if multistrlen(ustringcast(str_pool), pool_ptr, k)=2 then
+ begin t:=fromBUFF(ustringcast(str_pool), pool_ptr, k); incr(k);
+ end
+ else if t=" " then t:=space_token
+ else t:=other_token+t;
+@y
+@!t:halfword; {token being appended}
+@!k:pool_pointer; {index into |str_pool|}
+@!cc:escape..max_char_code;
+begin str_room(1);
+p:=temp_head; link(p):=null; k:=b;
+while k<pool_ptr do
+ begin t:=fromBUFF(ustringcast(str_pool), pool_ptr, k);
+ cc:=kcat_code(kcatcodekey(t));
+ if (multistrlen(ustringcast(str_pool), pool_ptr, k)>1)and
+ check_kcat_code(cc) then
+ begin if (cc=not_cjk) then cc:=other_kchar;
+ t:=t+cc*max_cjk_val;
+ k:=k+multistrlen(ustringcast(str_pool), pool_ptr, k)-1;
+ end
+ else begin t:=so(str_pool[k]);
+ if t=" " then t:=space_token
+ else t:=other_token+t;
+ end;
+@z
+
+@x
+
+@d ptex_revision_code=10 {command code for \.{\\ptexrevision}}
+@d ptex_convert_codes=11 {end of \pTeX's command codes}
+@y
+@d ucs_code=10 {command code for \.{\\ucs}}
+@d ptex_revision_code=11 {command code for \.{\\ptexrevision}}
+@d uptex_revision_code=12 {command code for \.{\\uptexrevision}}
+@d ptex_convert_codes=13 {end of \pTeX's command codes}
+@z
+
+@x
+@!@:kuten_}{\.{\\kuten} primitive@>
+@y
+@!@:kuten_}{\.{\\kuten} primitive@>
+primitive("ucs",convert,ucs_code);
+@!@:ucs_}{\.{\\ucs} primitive@>
+@z
+
+@x
+primitive("ptexrevision",convert,ptex_revision_code);
+@!@:ptexrevision_}{\.{\\ptexrevision} primitive@>
+@y
+primitive("ptexrevision",convert,ptex_revision_code);
+@!@:ptexrevision_}{\.{\\ptexrevision} primitive@>
+primitive("uptexrevision",convert,uptex_revision_code);
+@!@:uptexrevision_}{\.{\\uptexrevision} primitive@>
+@z
+
+@x
+ kuten_code:print_esc("kuten");
+@y
+ kuten_code:print_esc("kuten");
+ ucs_code:print_esc("ucs");
+@z
+
+@x
+ ptex_revision_code:print_esc("ptexrevision");
+@y
+ ptex_revision_code:print_esc("ptexrevision");
+ uptex_revision_code:print_esc("uptexrevision");
+@z
+
+@x
+kansuji_code,euc_code,sjis_code,jis_code,kuten_code: scan_int;
+ptex_revision_code: do_nothing;
+string_code, meaning_code: begin save_scanner_status:=scanner_status;
+ scanner_status:=normal; get_token;
+ if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {|wchar_token|}
+@y
+kansuji_code,euc_code,sjis_code,jis_code,kuten_code,ucs_code: scan_int;
+ptex_revision_code, uptex_revision_code: do_nothing;
+string_code, meaning_code: begin save_scanner_status:=scanner_status;
+ scanner_status:=normal; get_token;
+ if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|}
+@z
+
+@x
+kuten_code: print_int(fromKUTEN(cur_val));
+@y
+kuten_code: print_int(fromKUTEN(cur_val));
+ucs_code: print_int(fromUCS(cur_val));
+@z
+
+@x
+ptex_revision_code: print(pTeX_revision);
+@y
+ptex_revision_code: print(pTeX_revision);
+uptex_revision_code: print(upTeX_revision);
+@z
+
+@x
+if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ begin n:=cur_chr; m:=kcat_code(kcatcodekey(n));
+ end
+@y
+if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ begin m:=cur_cmd; n:=cur_chr;
+ end
+@z
+
+@x
+get_x_token_or_active_char;
+if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ begin cur_cmd:=kcat_code(kcatcodekey(cur_chr));
+ end
+@y
+get_x_token_or_active_char;
+if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ begin cur_cmd:=cur_cmd;
+ end {dummy}
+@z
+
+@x
+ if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then {is kanji}
+ begin str_room(2);
+ append_char(Hi(cur_chr)); {kanji upper byte}
+ append_char(Lo(cur_chr)); {kanji lower byte}
+@y
+ if (cur_cmd>=kanji)and(cur_cmd<=hangul) then {|wchar_token|}
+ begin str_room(4); {4 is maximum}
+ cur_chr:=toBUFF(cur_chr);
+ if BYTE1(cur_chr)<>0 then append_char(BYTE1(cur_chr));
+ if BYTE2(cur_chr)<>0 then append_char(BYTE2(cur_chr));
+ if BYTE3(cur_chr)<>0 then append_char(BYTE3(cur_chr));
+ append_char(BYTE4(cur_chr));
+@z
+
+@x
+@d set2=129 {typeset a character and move right}
+@y
+@d set2=129 {typeset a character and move right}
+@d set3=130 {typeset a character and move right}
+@z
+
+@x
+ jc:=toDVI(KANJI(info(p)));
+ dvi_out(set2); dvi_out(Hi(jc)); dvi_out(Lo(jc));
+@y
+ jc:=toDVI(KANJI(info(p)) mod max_cjk_val);
+ if (jc<@"10000) then begin
+ dvi_out(set2);
+ end else begin
+ dvi_out(set3); dvi_out(BYTE2(jc));
+ end;
+ dvi_out(BYTE3(jc)); dvi_out(BYTE4(jc));
+@z
+
+@x
+loop@+ begin get_x_token;
+ reswitch: case cur_cmd of
+ letter,other_char,char_given:@<Append a new letter or hyphen@>;
+ char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
+ goto reswitch;
+ end;
+@y
+loop@+ begin get_x_token;
+ reswitch: case cur_cmd of
+ letter,other_char,char_given,kchar_given:@<Append a new letter or hyphen@>;
+ char_num,kchar_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
+ goto reswitch;
+ end;
+@z
+
+@x
+hmode+kanji,hmode+kana,hmode+other_kchar: goto main_loop_j;
+hmode+char_given:
+ if is_char_ascii(cur_chr) then goto main_loop else goto main_loop_j;
+hmode+char_num: begin scan_char_num; cur_chr:=cur_val;
+ if is_char_ascii(cur_chr) then goto main_loop else goto main_loop_j;
+ end;
+hmode+no_boundary: begin get_x_token;
+ if (cur_cmd=letter)or(cur_cmd=other_char)or
+ (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar)or
+ (cur_cmd=char_given)or(cur_cmd=char_num) then cancel_boundary:=true;
+@y
+hmode+kanji,hmode+kana,hmode+other_kchar,hmode+hangul,hmode+kchar_given: goto main_loop_j;
+hmode+char_given:
+ if check_echar_range(cur_chr) then goto main_loop else goto main_loop_j;
+hmode+char_num: begin scan_char_num; cur_chr:=cur_val;
+ if check_echar_range(cur_chr) then goto main_loop else goto main_loop_j;
+ end;
+hmode+kchar_num: begin scan_char_num; cur_chr:=cur_val;
+ goto main_loop_j;
+ end;
+hmode+no_boundary: begin get_x_token;
+ if (cur_cmd=letter)or(cur_cmd=other_char)or
+ ((cur_cmd>=kanji)and(cur_cmd<=hangul))or
+ (cur_cmd=char_given)or(cur_cmd=char_num)or
+ (cur_cmd=kchar_given)or(cur_cmd=kchar_num) then cancel_boundary:=true;
+@z
+
+@x
+if cur_cmd=letter then goto main_loop_lookahead+1;
+if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ @<goto |main_lig_loop|@>;
+if cur_cmd=other_char then goto main_loop_lookahead+1;
+if cur_cmd=char_given then
+ begin if is_char_ascii(cur_chr) then goto main_loop_lookahead+1
+ else @<goto |main_lig_loop|@>;
+ end;
+x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|}
+if cur_cmd=letter then goto main_loop_lookahead+1;
+if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ @<goto |main_lig_loop|@>;
+if cur_cmd=other_char then goto main_loop_lookahead+1;
+if cur_cmd=char_given then
+ begin if is_char_ascii(cur_chr) then goto main_loop_lookahead+1
+ else @<goto |main_lig_loop|@>;
+ end;
+if cur_cmd=char_num then
+ begin scan_char_num; cur_chr:=cur_val;
+ if is_char_ascii(cur_chr) then goto main_loop_lookahead+1
+ else @<goto |main_lig_loop|@>;
+ end;
+@y
+if cur_cmd=letter then goto main_loop_lookahead+1;
+if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ @<goto |main_lig_loop|@>;
+if cur_cmd=other_char then goto main_loop_lookahead+1;
+if cur_cmd=char_given then
+ begin if check_echar_range(cur_chr) then goto main_loop_lookahead+1
+ else @<goto |main_lig_loop|@>;
+ end;
+if cur_cmd=kchar_given then
+ @<goto |main_lig_loop|@>;
+x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|}
+if cur_cmd=letter then goto main_loop_lookahead+1;
+if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ @<goto |main_lig_loop|@>;
+if cur_cmd=other_char then goto main_loop_lookahead+1;
+if cur_cmd=char_given then
+ begin if check_echar_range(cur_chr) then goto main_loop_lookahead+1
+ else @<goto |main_lig_loop|@>;
+ end;
+if cur_cmd=char_num then
+ begin scan_char_num; cur_chr:=cur_val;
+ if check_echar_range(cur_chr) then goto main_loop_lookahead+1
+ else @<goto |main_lig_loop|@>;
+ end;
+if cur_cmd=kchar_num then
+ begin scan_char_num; cur_chr:=cur_val;
+ @<goto |main_lig_loop|@>;
+ end;
+@z
+
+@x
+vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given,
+ vmode+math_shift,vmode+un_hbox,vmode+vrule,
+ vmode+accent,vmode+discretionary,vmode+hskip,vmode+valign,
+ vmode+kanji,vmode+kana,vmode+other_kchar,
+@y
+vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given,
+ vmode+kchar_num,vmode+kchar_given,
+ vmode+math_shift,vmode+un_hbox,vmode+vrule,
+ vmode+accent,vmode+discretionary,vmode+hskip,vmode+valign,
+ vmode+kanji,vmode+kana,vmode+other_kchar,vmode+hangul,
+@z
+
+@x
+if not is_char_ascii(cur_val) then
+ begin KANJI(cx):=cur_val;
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ p:=new_character(f,get_jfm_pos(KANJI(cx),f));
+ if p<>null then
+ begin
+ link(p):=get_avail; info(link(p)):=KANJI(cx);
+ end;
+@y
+if check_echar_range(cur_val)=0 then
+ begin KANJI(cx):=cur_val;
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ p:=new_character(f,get_jfm_pos(KANJI(cx),f));
+ if p<>null then
+ begin
+ link(p):=get_avail;
+ info(link(p)):=KANJI(cx) + kcat_code(kcatcodekey(cx))*max_cjk_val;
+ end;
+@z
+
+@x
+if (cur_cmd=letter)or(cur_cmd=other_char) then
+ q:=new_character(f,cur_chr)
+else if (cur_cmd=kanji)or(cur_cmd=kana)or(cur_cmd=other_kchar) then
+ begin if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ cx:=cur_chr;
+ end
+else if cur_cmd=char_given then
+ if is_char_ascii(cur_chr) then q:=new_character(f,cur_chr)
+ else begin
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ KANJI(cx):=cur_chr
+ end
+ else if cur_cmd=char_num then
+ begin scan_char_num;
+ if is_char_ascii(cur_val) then q:=new_character(f,cur_val)
+ else begin
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ KANJI(cx):=cur_val
+ end
+ end
+@y
+if (cur_cmd=letter)or(cur_cmd=other_char) then
+ q:=new_character(f,cur_chr)
+else if (cur_cmd>=kanji)and(cur_cmd<=hangul) then
+ begin if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ cx:=cur_chr;
+ end
+else if cur_cmd=char_given then
+ if check_echar_range(cur_chr) then q:=new_character(f,cur_chr)
+ else begin
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ KANJI(cx):=cur_chr
+ end
+else if cur_cmd=char_num then
+ begin scan_char_num;
+ if check_echar_range(cur_val) then q:=new_character(f,cur_val)
+ else begin
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ KANJI(cx):=cur_val
+ end
+ end
+else if cur_cmd=kchar_given then
+ begin
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ KANJI(cx):=cur_chr
+ end
+else if cur_cmd=kchar_num then
+ begin scan_char_num;
+ if direction=dir_tate then f:=cur_tfont else f:=cur_jfont;
+ KANJI(cx):=cur_val
+ end
+@z
+
+@x
+ begin q:=new_character(f,get_jfm_pos(KANJI(cx),f));
+ link(q):=get_avail; info(link(q)):=KANJI(cx); last_jchr:=q;
+@y
+ begin q:=new_character(f,get_jfm_pos(KANJI(cx),f));
+ link(q):=get_avail;
+ info(link(q)):=KANJI(cx) + kcat_code(kcatcodekey(cx))*max_cjk_val;
+ last_jchr:=q;
+@z
+
+@x
+letter,other_char,char_given:
+ if (is_char_ascii(cur_chr) or (cur_chr=256)) then begin
+@y
+letter,other_char,char_given:
+ if (cur_chr>=0)and(cur_chr<=256) then begin
+@z
+
+@x
+ KANJI(cx):=cur_chr;
+kanji,kana,other_kchar: cx:=cur_chr;
+@y
+ KANJI(cx):=cur_chr;
+kchar_given:
+ KANJI(cx):=cur_chr;
+kanji,kana,other_kchar,hangul: cx:=cur_chr;
+@z
+
+@x
+ math_type(p):=math_jchar; fam(p):=cur_jfam; character(p):=qi(0);
+ math_kcode(p-1):=KANJI(cx);
+@y
+ math_type(p):=math_jchar; fam(p):=cur_jfam; character(p):=qi(0);
+ math_kcode(p-1):=KANJI(cx) + kcat_code(kcatcodekey(cx))*max_cjk_val;
+@z
+
+@x
+mmode+letter,mmode+other_char,mmode+char_given:
+ if is_char_ascii(cur_chr) then
+ if cur_chr<128 then set_math_char(ho(math_code(cur_chr)))
+ else set_math_char(cur_chr)
+ else set_math_kchar(cur_chr);
+mmode+kanji,mmode+kana,mmode+other_kchar: begin
+ cx:=cur_chr; set_math_kchar(KANJI(cx));
+ end;
+mmode+char_num: begin scan_char_num; cur_chr:=cur_val;
+ if is_char_ascii(cur_chr) then
+ if cur_chr<128 then set_math_char(ho(math_code(cur_chr)))
+ else set_math_char(cur_chr)
+ else set_math_kchar(cur_chr);
+ end;
+@y
+mmode+letter,mmode+other_char,mmode+char_given:
+ if check_echar_range(cur_chr) then
+ if cur_chr<128 then set_math_char(ho(math_code(cur_chr)))
+ else set_math_char(cur_chr)
+ else set_math_kchar(cur_chr);
+mmode+kanji,mmode+kana,mmode+other_kchar,mmode+hangul: begin
+ cx:=cur_chr; set_math_kchar(KANJI(cx));
+ end;
+mmode+char_num: begin scan_char_num; cur_chr:=cur_val;
+ if check_echar_range(cur_chr) then
+ if cur_chr<128 then set_math_char(ho(math_code(cur_chr)))
+ else set_math_char(cur_chr)
+ else set_math_kchar(cur_chr);
+ end;
+mmode+kchar_given:
+ set_math_kchar(cur_chr);
+mmode+kchar_num: begin scan_char_num; cur_chr:=cur_val;
+ set_math_kchar(cur_chr);
+ end;
+@z
+
+@x
+any_mode(assign_inhibit_xsp_code),
+any_mode(set_auto_spacing),
+@y
+any_mode(assign_inhibit_xsp_code),
+any_mode(set_auto_spacing),
+any_mode(set_enable_cjk_token),
+@z
+
+@x l.23666 - upTeX
+@d char_sub_def_code=7 {|shorthand_def| for \.{\\charsubdef}}
+
+@<Put each...@>=
+primitive("chardef",shorthand_def,char_def_code);@/
+@!@:char_def_}{\.{\\chardef} primitive@>
+@y
+@d char_sub_def_code=7 {|shorthand_def| for \.{\\charsubdef}}
+@d kchar_def_code=char_sub_def_code+1 {|shorthand_def| for \.{\\kchardef}}
+
+@<Put each...@>=
+primitive("chardef",shorthand_def,char_def_code);@/
+@!@:char_def_}{\.{\\chardef} primitive@>
+primitive("kchardef",shorthand_def,kchar_def_code);@/
+@!@:kchar_def_}{\.{\\kchardef} primitive@>
+@z
+
+@x
+shorthand_def: case chr_code of
+ char_def_code: print_esc("chardef");
+ math_char_def_code: print_esc("mathchardef");
+@y
+shorthand_def: case chr_code of
+ char_def_code: print_esc("chardef");
+ kchar_def_code: print_esc("kchardef");
+ math_char_def_code: print_esc("mathchardef");
+@z
+
+@x l.23698 - upTeX
+char_given: begin print_esc("char"); print_hex(chr_code);
+ end;
+@y
+char_given: begin print_esc("char"); print_hex(chr_code);
+ end;
+kchar_given: begin print_esc("kchar"); print_hex(chr_code);
+ end;
+@z
+
+@x l.23729 - upTeX
+ char_def_code: begin scan_char_num; define(p,char_given,cur_val);
+ end;
+@y
+ char_def_code: begin scan_char_num; define(p,char_given,cur_val);
+ end;
+ kchar_def_code: begin scan_char_num; define(p,kchar_given,cur_val);
+ end;
+@z
+
+@x
+@ @<Let |m| be the minimal...@>=
+if cur_chr=kcat_code_base then m:=kanji else m:=0
+@y
+@ @<Let |m| be the minimal...@>=
+if cur_chr=kcat_code_base then m:=not_cjk else m:=0
+@z
+
+@x
+@<Change the case of the token in |p|, if a change is appropriate@>=
+t:=info(p);
+if (t<cs_token_flag+single_base)and(not check_kanji(t)) then
+ begin c:=t mod 256;
+@y
+@<Change the case of the token in |p|, if a change is appropriate@>=
+t:=info(p);
+if (t<cs_token_flag+single_base)and(not check_kanji(t)) then
+ begin c:=t mod max_char_val;
+@z
+
+@x
+@d set_auto_xspacing_code=3
+@y
+@d set_auto_xspacing_code=3
+@d reset_enable_cjk_token_code=0
+@d set_enable_cjk_token_code=1
+@d set_force_cjk_token_code=2
+@z
+
+@x
+@!@:no_auto_xspacing_}{\.{\\noautoxspacing} primitive@>
+@y
+@!@:no_auto_xspacing_}{\.{\\noautoxspacing} primitive@>
+primitive("enablecjktoken",set_enable_cjk_token,reset_enable_cjk_token_code);
+@!@:enable_cjk_token_}{\.{\\enablecjktoken} primitive@>
+primitive("disablecjktoken",set_enable_cjk_token,set_enable_cjk_token_code);
+@!@:disable_cjk_token_}{\.{\\disablecjktoken} primitive@>
+primitive("forcecjktoken",set_enable_cjk_token,set_force_cjk_token_code);
+@!@:force_cjk_token_}{\.{\\forcecjktoken} primitive@>
+@z
+
+@x
+ if (chr_code mod 2)=0 then print_esc("noauto") else print_esc("auto");
+ if chr_code<2 then print("spacing") else print("xspacing");
+end;
+@y
+ if (chr_code mod 2)=0 then print_esc("noauto") else print_esc("auto");
+ if chr_code<2 then print("spacing") else print("xspacing");
+end;
+set_enable_cjk_token:begin
+ if chr_code=0 then print_esc("enable")
+ else if chr_code=1 then print_esc("disable") else print_esc("force");
+ print("cjktoken");
+end;
+@z
+
+@x
+ else begin p:=auto_xspacing_code; cur_chr:=(cur_chr mod 2); end;
+ define(p,data,cur_chr);
+end;
+@y
+ else begin p:=auto_xspacing_code; cur_chr:=(cur_chr mod 2); end;
+ define(p,data,cur_chr);
+end;
+set_enable_cjk_token: define(enable_cjk_token_code,data,cur_chr);
+@z
+
+@x
+@ @<Insert a space around the character |p|@>=
+if font_dir[font(p)]<>dir_default then
+ begin KANJI(cx):=info(link(p));
+@y
+@ @<Insert a space around the character |p|@>=
+if font_dir[font(p)]<>dir_default then
+ begin KANJI(cx):=info(link(p)) mod max_cjk_val;
+@z
+
+@x
+else if font_dir[font(first_char)]<>dir_default then
+ begin KANJI(cx):=info(link(first_char));
+@y
+else if font_dir[font(first_char)]<>dir_default then
+ begin KANJI(cx):=info(link(first_char)) mod max_cjk_val;
+@z
+
+@x
+begin if is_char_node(link(p)) then
+ begin q:=p; p:=link(p);
+ if font_dir[font(p)]<>dir_default then
+ begin KANJI(cx):=info(link(p));
+@y
+begin if is_char_node(link(p)) then
+ begin q:=p; p:=link(p);
+ if font_dir[font(p)]<>dir_default then
+ begin KANJI(cx):=info(link(p)) mod max_cjk_val;
+@z
+
+@x
+ begin KANJI(cx):=info(link(p)); i:=kcat_code(kcatcodekey(cx)); k:=0;
+ if (i=kanji)or(i=kana) then begin t:=q; s:=p; end;
+@y
+ begin KANJI(cx):=info(link(p)) mod max_cjk_val;
+ i:=info(link(p)) div max_cjk_val; k:=0;
+ if (i=kanji)or(i=kana)or(i=hangul) then begin t:=q; s:=p; end;
+@z
+
+@x
+ fast_get_avail(main_p); info(main_p):=KANJI(cur_chr);
+@y
+ fast_get_avail(main_p); info(main_p):=KANJI(cur_chr)+cur_cmd*max_cjk_val;
+@z
+
+@x
+ main_i:=orig_char_info(main_f)(cur_l);
+ case cur_cmd of
+ kanji,kana,other_kchar: begin
+@y
+ main_i:=orig_char_info(main_f)(cur_l);
+ case cur_cmd of
+ kanji,kana,other_kchar,hangul: begin
+@z
+
+@x
+ kanji,kana,other_kchar: cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ letter,other_char: begin ins_kp:=true; cur_l:=qi(0); end;
+ char_given: begin
+ if is_char_ascii(cur_chr) then
+ begin ins_kp:=true; cur_l:=qi(0);
+ end
+ else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ end;
+ char_num: begin scan_char_num; cur_chr:=cur_val;
+ if is_char_ascii(cur_chr) then
+ begin ins_kp:=true; cur_l:=qi(0);
+ end
+ else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ end;
+@y
+ kanji,kana,other_kchar,hangul: cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ letter,other_char: begin ins_kp:=true; cur_l:=qi(0); end;
+ char_given: begin
+ if check_echar_range(cur_chr) then
+ begin ins_kp:=true; cur_l:=qi(0);
+ end
+ else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ end;
+ char_num: begin scan_char_num; cur_chr:=cur_val;
+ if check_echar_range(cur_chr) then
+ begin ins_kp:=true; cur_l:=qi(0);
+ end
+ else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ end;
+ kchar_given: begin
+ cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ end;
+ kchar_num: begin scan_char_num; cur_chr:=cur_val;
+ cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
+ end;
+@z
+
+@x
+procedure print_kanji(@!s:KANJI_code); {prints a single character}
+begin
+if s>255 then
+ begin print_char(Hi(s)); print_char(Lo(s));
+ end else print_char(s);
+@y
+procedure print_kanji(@!s:KANJI_code); {prints a single character}
+begin
+s:=toBUFF(s mod max_cjk_val);
+if BYTE1(s)<>0 then print_char(BYTE1(s));
+if BYTE2(s)<>0 then print_char(BYTE2(s));
+if BYTE3(s)<>0 then print_char(BYTE3(s));
+ print_char(BYTE4(s));
+end;
+
+function check_kcat_code(@!ct:integer):integer;
+begin
+if ((ct>=kanji)and(enable_cjk_token=0))or(enable_cjk_token=2)then
+ check_kcat_code:=1
+else check_kcat_code:=0;
+end;
+
+function check_echar_range(@!c:integer):integer;
+begin
+if (c>=0)and(c<256)then
+ check_echar_range:=1
+else check_echar_range:=0;
+@z
diff --git a/Build/source/texk/web2c/uptexdir/uptex.defines b/Build/source/texk/web2c/uptexdir/uptex.defines
new file mode 100644
index 00000000000..52243e57185
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptex.defines
@@ -0,0 +1,48 @@
+{ defined at kanji.c, kanji.h, ptexenc/ptexenc.h, ptexenc/unicode.h }
+@define function BYTE1 ();
+@define function BYTE2 ();
+@define function BYTE3 ();
+@define function BYTE4 ();
+@define function Hi ();
+@define function Lo ();
+
+@define function getencstring;
+@define function setencstring ();
+@define procedure setpriorfileenc;
+@define function isinternalUPTEX;
+@define function isinternalEUC;
+
+@define function iskanji1 ();
+@define function is1stchr ();
+@define function ismultichr ();
+
+@define function multistrlen ();
+@define function multibytelen ();
+@define function fromBUFF ();
+@define function toBUFF ();
+
+@define function fromDVI ();
+@define function toDVI ();
+@define function putc2 ();
+@define function fputs2 ();
+@define function inputline2 ();
+
+@define function fromJIS ();
+@define function fromEUC ();
+@define function fromSJIS ();
+@define function fromKUTEN ();
+@define function fromUCS ();
+
+@define function notkanjicharseq ();
+@define function checkkanji ();
+@define function ischarascii ();
+@define function ischarkanji ();
+@define function ismultiprn ();
+@define function calcpos ();
+@define function kcatcodekey ();
+@define function multilenbuffchar ();
+@define function nrestmultichr ();
+
+@define procedure dumpkanji ();
+@define procedure initkanji;
+@define procedure undumpkanji ();
diff --git a/Build/source/texk/web2c/uptexdir/uptex_version.h b/Build/source/texk/web2c/uptexdir/uptex_version.h
new file mode 100644
index 00000000000..cfe69163294
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptex_version.h
@@ -0,0 +1 @@
+#define UPTEX_VERSION "u1.27"
diff --git a/Build/source/texk/web2c/uptexdir/uptexextra.c b/Build/source/texk/web2c/uptexdir/uptexextra.c
new file mode 100644
index 00000000000..40bd527d19b
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptexextra.c
@@ -0,0 +1,12 @@
+/* uptexextra.c: Hand-coded routines for upTeX.
+
+ This file is public domain. */
+
+#define EXTERN /* Instantiate data from uptexd.h here. */
+#define DLLPROC dlluptexmain
+
+/* This file defines TeX and upTeX. */
+#include <uptexd.h>
+
+/* Hand-coded routines for TeX or Metafont in C. */
+#include <lib/texmfmp.c>
diff --git a/Build/source/texk/web2c/uptexdir/uptexextra.h b/Build/source/texk/web2c/uptexdir/uptexextra.h
new file mode 100644
index 00000000000..e1fa75424d7
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptexextra.h
@@ -0,0 +1,25 @@
+/* uptexextra.h: banner etc. for upTeX.
+
+ This is included by upTeX, from uptexextra.c
+*/
+
+#include <ptexdir/ptex_version.h> /* for PTEX_VERSION */
+#include <uptexdir/uptex_version.h> /* for UPTEX_VERSION */
+
+#define BANNER "This is upTeX, Version 3.141592653-" PTEX_VERSION "-" UPTEX_VERSION
+#define COPYRIGHT_HOLDER "D.E. Knuth"
+#define AUTHOR NULL
+#define PROGRAM_HELP UPTEXHELP
+#define BUG_ADDRESS "issue@texjp.org"
+#define DUMP_VAR TEXformatdefault
+#define DUMP_LENGTH_VAR formatdefaultlength
+#define DUMP_OPTION "fmt"
+#define DUMP_EXT ".fmt"
+#define INPUT_FORMAT kpse_tex_format
+#define INI_PROGRAM "iniuptex"
+#define VIR_PROGRAM "viruptex"
+
+#ifdef Xchr
+#undef Xchr
+#define Xchr(x) (x)
+#endif /* Xchr */
diff --git a/Build/source/texk/web2c/uptexdir/uptftopl.ch b/Build/source/texk/web2c/uptexdir/uptftopl.ch
new file mode 100644
index 00000000000..7b3032ce2db
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptftopl.ch
@@ -0,0 +1,94 @@
+@x
+@d my_name=='ptftopl'
+@d banner=='This is pTFtoPL, Version 3.3-p2.0'
+@y
+@d my_name=='uptftopl'
+@d banner=='This is upTFtoPL, Version 3.3-p2.0-u1.27'
+@z
+
+@x
+ usage_help (PTFTOPL_HELP, 'issue@@texjp.org');
+@y
+ usage_help (UPTFTOPL_HELP, 'issue@@texjp.org');
+@z
+
+@x
+@d max_kanji=7237 {number of the kanji characters - 1}
+@y
+@d max_kanji=1114111 {number of the kanji characters - 1}
+@z
+
+@x procedure out_kanji
+i:0..3; {index of array}
+@y
+i:0..5; {index of array}
+@z
+@x
+ begin cx:=jis_code; out('J '); {specify jiscode format}
+ dig[0]:=Hi(cx) div 16; dig[1]:=Hi(cx) mod 16;
+ dig[2]:=Lo(cx) div 16; dig[3]:=Lo(cx) mod 16;
+ for i:=0 to 3 do
+@y
+ begin cx:=jis_code;
+ if (isinternalUPTEX) then out('U ')
+ else out('J '); {specify jiscode format}
+ dig[0]:=(cx div 65536) div 16; dig[1]:=(cx div 65536) mod 16;
+ dig[2]:=(cx div 4096) mod 16; dig[3]:=(cx div 256) mod 16;
+ dig[4]:=(cx div 16) mod 16; dig[5]:=cx mod 16;
+ for i:=0 to 1 do
+ if (dig[i]<>0)or(dig[0]<>0) then begin { if dig[0]<>0, dig[1] should be always printed }
+ if dig[i]<10 then out(dig[i]) else
+ case dig[i] of
+ 10: out('A'); 11: out('B'); 12: out('C');
+ 13: out('D'); 14: out('E'); 15: out('F');
+ end;
+ end;
+ for i:=2 to 5 do
+@z
+
+@x
+ out(xchr[Hi(cx)]); out(xchr[Lo(cx)]);
+@y
+ if BYTE1(cx)<>0 then out(xchr[BYTE1(cx)]);
+ if BYTE2(cx)<>0 then out(xchr[BYTE2(cx)]);
+ if BYTE3(cx)<>0 then out(xchr[BYTE3(cx)]);
+ out(xchr[BYTE4(cx)]);
+@z
+
+@x function valid_jis_code
+var first_byte, second_byte:integer; { jis code bytes }
+begin valid_jis_code:=true;
+first_byte:=cx div @'400; second_byte:=cx mod @'400;
+if (first_byte<@"21)
+ or((first_byte>@"28)and(first_byte<@"30))
+ or(first_byte>@"74) then valid_jis_code:=false;
+if (second_byte<@"21)or(second_byte>@"7E) then valid_jis_code:=false;
+@y
+begin valid_jis_code:=true;
+if (cx>@"10FFFF)or(not is_char_kanji(fromDVI(cx)))
+ or(toDVI(fromDVI(cx))<>cx) then valid_jis_code:=false;
+@z
+
+@x function index_to_jis
+if ix<=8*94-1 then
+ index_to_jis:=(ix div 94 + @"21) * @'400 + (ix mod 94 + @"21)
+else
+ index_to_jis:=((ix+7 * 94) div 94 + @"21) * @'400 + ((ix+7*94) mod 94 + @"21);
+@y
+index_to_jis:=ix;
+@z
+
+@x function jis_to_index
+var first_byte,second_byte:integer; { jis code bytes }
+begin
+first_byte:=cx div @'400 - @"21;
+second_byte:=cx mod @'400 - @"21;
+if first_byte<8 then
+ jis_to_index:=first_byte*94+second_byte
+else
+ jis_to_index:=(first_byte-7)*94+second_byte;
+@y
+begin
+jis_to_index:=cx;
+@z
+
diff --git a/Build/source/texk/web2c/uptexdir/uptftopl.test b/Build/source/texk/web2c/uptexdir/uptftopl.test
new file mode 100755
index 00000000000..0f0aab1d6ed
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptftopl.test
@@ -0,0 +1,11 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2017 Karl Berry <tex-live@tug.org>
+# Copyright 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+TEXMFCNF=$srcdir/../kpathsea \
+ ./uptftopl -verbose $srcdir/tests/cmr10 uptests/xcmr10 || exit 1
+
diff --git a/Build/source/texk/web2c/uptexdir/uptrip/texmf.cnf b/Build/source/texk/web2c/uptexdir/uptrip/texmf.cnf
new file mode 100644
index 00000000000..bc7cde7871d
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptrip/texmf.cnf
@@ -0,0 +1,41 @@
+% uptexdir/uptrip/texmf.cnf -- configuration for the uptrip test.
+
+% These values apply to all the programs, and they are necessary for any
+% kind of reasonable diff.
+error_line = 64
+half_error_line = 32
+max_print_line = 72
+
+% upTeX.
+mem_bot = 1
+main_memory = 4500
+max_strings = 3000
+pool_size = 40000
+
+string_vacancies = 8000
+
+font_mem_size = 20000
+font_max = 75
+stack_size = 200
+nest_size = 40
+buf_size = 500
+save_size = 600
+dvi_buf_size = 800
+% Although hyph_size is settable, it can't be <hyph_prime, which is 607,
+% and the original trip setting is 307, so no point in changing the default.
+
+% Avoid running any MakeTeX* program.
+MAKETEXTFM = 0
+MAKETEXTEX = 0
+MAKETEXMF = 0
+
+% Search paths.
+% trip.tex:
+TEXINPUTS = .
+% trip.tfm:
+TFMFONTS = .
+% trip.fmt:
+TEXFORMATS = .
+% tex.pool:
+TEXPOOL = .
+
diff --git a/Build/source/texk/web2c/uptexdir/uptrip/uptrip.diffs b/Build/source/texk/web2c/uptexdir/uptrip/uptrip.diffs
new file mode 100644
index 00000000000..2bb94558a14
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptrip/uptrip.diffs
@@ -0,0 +1,621 @@
+#! /bin/sh -vx
+# $Id: uptriptest.test 48633 2018-09-09 17:56:55Z karl $
+# Copyright 2017-2018 Karl Berry <tex-live@tug.org>
+# Copyright 2011-2014 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
++ LC_ALL=C
++ export LC_ALL
++ LANGUAGE=C
++ export LANGUAGE
+
+testdir=$abs_srcdir/triptrap
++ testdir=SRCDIR/triptrap
+uptestdir=$abs_srcdir/uptexdir/uptrip
++ uptestdir=SRCDIR/uptexdir/uptrip
+
+TEXMFCNF=$uptestdir; export TEXMFCNF
++ TEXMFCNF=SRCDIR/uptexdir/uptrip
++ export TEXMFCNF
+
+rm -rf uptripdir
++ rm -rf uptripdir
+mkdir uptripdir
++ mkdir uptripdir
+cd uptripdir
++ cd uptripdir
+
+dvitype_args="-output-level=2 -dpi=72.27 -page-start='*.*.*.*.*.*.*.*.*.*'"
++ dvitype_args='-output-level=2 -dpi=72.27 -page-start='\''*.*.*.*.*.*.*.*.*.*'\'''
+
+echo ">>> Running TRIP test for upTeX." >&2
++ echo '>>> Running TRIP test for upTeX.'
+>>> Running TRIP test for upTeX.
+echo ">>> See $uptestdir/uptrip.diffs for example of acceptable diffs." >&2
++ echo '>>> See SRCDIR/uptexdir/uptrip/uptrip.diffs for example of acceptable diffs.'
+>>> See SRCDIR/uptexdir/uptrip/uptrip.diffs for example of acceptable diffs.
+
+# upTeX outputs direction of boxes.
+P_SED1='s/, yoko direction//;s/yoko direction, //'
++ P_SED1='s/, yoko direction//;s/yoko direction, //'
+P_SED2='s/yoko(math) direction, //'
++ P_SED2='s/yoko(math) direction, //'
+
+is_OK=:
++ is_OK=:
+
+set -x
++ set -x
+
+echo "*** TRIP test for upTeX ***."
++ echo '*** TRIP test for upTeX ***.'
+*** TRIP test for upTeX ***.
+
+./pltotf $testdir/trip.pl trip.tfm || exit 1
++ ./pltotf SRCDIR/triptrap/trip.pl trip.tfm
+
+./tftopl ./trip.tfm trip.pl || exit 1
++ ./tftopl ./trip.tfm trip.pl
+
+diff $testdir/trip.pl trip.pl || is_OK=false
++ diff SRCDIR/triptrap/trip.pl trip.pl
+
+# get same filename in log
+$LN_S $testdir/trip.tex .
++ ln -s SRCDIR/triptrap/trip.tex .
+
+rm -f trip.log
++ rm -f trip.log
+./uptex --progname=upinitex --ini <$testdir/trip1.in >uptripin.fot
++ ./uptex --progname=upinitex --ini
+if test ! -s trip.fmt; then
+ echo "*** trip.fmt not created by trip1.in, investigate!" >&2
+ exit 1
+fi
++ test '!' -s trip.fmt
+sed "$P_SED1" trip.log > uptripin.log || exit 1
++ sed 's/, yoko direction//;s/yoko direction, //' trip.log
+diff $testdir/tripin.log uptripin.log
++ diff SRCDIR/triptrap/tripin.log uptripin.log
+1c1
+< This is TeX, Version 3.141592653 (INITEX) 4 JUL 1776 12:00
+---
+> This is upTeX, Version 3.141592653-p3.8.3-u1.27 (utf8.uptex) (TeX Live 2021/dev) (INITEX) 27 JAN 2021 18:03
+3c3
+< (trip.tex
+---
+> (./trip.tex
+91c91,92
+< ### horizontal mode entered at line 77 (language255:hyphenmin1,63)
+---
+> ### horizontal mode entered at line 77 (language255:hyph
+> enmin1,63)
+93a95
+> \displace 0.0
+95a98
+> \displace 0.0
+368a372
+> ....\displace 0.0
+370a375
+> ....\displace 0.0
+437,438d441
+< ....\rip 6 (ligature )
+< ....\rip 7 (ligature )
+450,453c453,456
+< (preloaded format=trip 1776.7.4)
+< 1326 strings of total length 23633
+< 471 memory locations dumped; current usage is 96&278
+< 341 multiletter control sequences
+---
+> (preloaded format=trip 2021.1.27)
+> 1489 strings of total length 26192
+> 487 memory locations dumped; current usage is 108&278
+> 395 multiletter control sequences
+461c464
+< Hyphenation trie of length 273 has 9 ops out of 500
+---
+> Hyphenation trie of length 273 has 9 ops out of 35111
+
+# May as well test non-ini second time through.
+rm -f trip.log
++ rm -f trip.log
+./uptex --progname=uptex <$testdir/trip2.in >uptrip.fot
++ ./uptex --progname=uptex
+sed "$P_SED1;$P_SED2" trip.log > uptrip.log
++ sed 's/, yoko direction//;s/yoko direction, //;s/yoko(math) direction, //' trip.log
+diff $testdir/trip.fot uptrip.fot
++ diff SRCDIR/triptrap/trip.fot uptrip.fot
+1,3c1,2
+< This is TeX, Version 3.141592653 (INITEX)
+< ** &trip trip
+< (trip.tex ##
+---
+> This is upTeX, Version 3.141592653-p3.8.3-u1.27 (utf8.uptex) (TeX Live 2021/dev) (preloaded format=uptex)
+> **(./trip.tex ##
+17c16
+< Memory usage before: 159&313; after: 102&278; still untouched: 1613
+---
+> Memory usage before: 192&313; after: 116&278; still untouched: 3113
+75c74
+< Memory usage before: 334&431; after: 292&418; still untouched: 175
+---
+> Memory usage before: 458&431; after: 396&418; still untouched: 484
+
+# We use $DIFF instead of `diff' only for those files where there
+# might actually be legitimate numerical differences.
+$DIFF $DIFFFLAGS $testdir/trip.log uptrip.log
++ diff SRCDIR/triptrap/trip.log uptrip.log
+1c1
+< This is TeX, Version 3.141592653 (preloaded format=trip 1776.7.4) 4 JUL 1776 12:00
+---
+> This is upTeX, Version 3.141592653-p3.8.3-u1.27 (utf8.uptex) (TeX Live 2021/dev) (preloaded format=trip 2021.1.27) 27 JAN 2021 18:03
+3c3
+< (trip.tex ##
+---
+> (./trip.tex ##
+73c73
+< Memory usage before: 159&313; after: 102&278; still untouched: 1613
+---
+> Memory usage before: 192&313; after: 116&278; still untouched: 3113
+113a114
+> .\displace 0.0
+198a200
+> .\displace 0.0
+253a256
+> .\displace 0.0
+308a312
+> .\displace 0.0
+349a354
+> .\displace 0.0
+385,386c390,391
+< \insert100, natural size 803.09999; split(1.0 plus 43.0,-2.0); float cos
+< t 100
+---
+> \insert100Y, natural size 803.09999; split(1.0 plus 43.0,-2.0); float co
+> st 100
+406a412
+> ....\displace 0.0
+409a416
+> ....\displace 0.0
+412a420
+> ....\displace 0.0
+420a429
+> .\displace 0.0
+426c435
+< \insert200, natural size 400.0; split(0.0,-2.0); float cost 100
+---
+> \insert200Y, natural size 400.0; split(0.0,-2.0); float cost 100
+435a445
+> .\displace 0.0
+441c451
+< \insert200, natural size 400.0; split(1.0,-1.0); float cost 100
+---
+> \insert200Y, natural size 400.0; split(1.0,-1.0); float cost 100
+450a461
+> .\displace 0.0
+456c467
+< \insert200, natural size 400.0; split(2.0,-1.0); float cost 100
+---
+> \insert200Y, natural size 400.0; split(2.0,-1.0); float cost 100
+466a478
+> .\displace 0.0
+474c486
+< \special{^^80-1000.0pt}
+---
+> \special{-1000.0pt}
+483,484c495,496
+< \insert200, natural size 10000.0; split(1.0 plus 43.0,-1.0); float cost
+< 3
+---
+> \insert200Y, natural size 10000.0; split(1.0 plus 43.0,-1.0); float cost
+> 3
+588a601
+> .....\displace 0.0
+591a605
+> .....\displace 0.0
+594a609
+> .....\displace 0.0
+630a646
+> ......\displace 0.0
+633a650
+> ......\displace 0.0
+636a654
+> ......\displace 0.0
+642c660
+< Memory usage before: 747&484; after: 581&481; still untouched: 1492
+---
+> Memory usage before: 1114&483; after: 860&480; still untouched: 1993
+647c665,666
+< ### internal vertical mode entered at line 150 (\output routine)
+---
+> ### internal vertical mode entered at line 150 (\output
+> routine)
+650a670
+> .\displace 0.0
+660a681
+> .\displace 0.0
+670a692
+> .\displace 0.0
+681a704
+> .\displace 0.0
+689c712
+< \special{^^80-1000.0pt}
+---
+> \special{-1000.0pt}
+693,694c716,717
+< \insert100, natural size 535.4; split(1.0 plus 43.0,-2.0); float cost 10
+< 0
+---
+> \insert100Y, natural size 535.4; split(1.0 plus 43.0,-2.0); float cost 1
+> 00
+701c724
+< \insert200, natural size 2.0; split(2.0,-1.0); float cost 100
+---
+> \insert200Y, natural size 2.0; split(2.0,-1.0); float cost 100
+714,715c737,738
+< \insert200, natural size 10000.0; split(1.0 plus 43.0,-1.0); float cost
+< 3
+---
+> \insert200Y, natural size 10000.0; split(1.0 plus 43.0,-1.0); float cost
+> 3
+815c838
+< Memory usage before: 475&470; after: 290&466; still untouched: 1473
+---
+> Memory usage before: 706&469; after: 414&465; still untouched: 1974
+820c843,844
+< ### internal vertical mode entered at line 150 (\output routine)
+---
+> ### internal vertical mode entered at line 150 (\output
+> routine)
+915c939
+< Memory usage before: 218&459; after: 149&458; still untouched: 1473
+---
+> Memory usage before: 304&458; after: 194&457; still untouched: 1974
+920c944,945
+< ### internal vertical mode entered at line 150 (\output routine)
+---
+> ### internal vertical mode entered at line 150 (\output
+> routine)
+1070c1095
+< Memory usage before: 118&328; after: 102&328; still untouched: 1473
+---
+> Memory usage before: 146&327; after: 122&327; still untouched: 1974
+1405c1430
+< \vbox(16383.99998+0.0)x1000.0, glue set 16342.0fil
+---
+> \vbox(16383.99998+0.0)x1000.0, glue set 16341.99998fil
+1493a1519
+> ..\displace 0.0
+1503a1530
+> ..\displace 0.0
+1504a1532
+> ..\displace 0.0
+1511c1539
+< Memory usage before: 990&376; after: 584&370; still untouched: 735
+---
+> Memory usage before: 1494&375; after: 842&369; still untouched: 1974
+1887c1915
+< .\rip A
+---
+> .\displace 0.0
+1923c1951
+< .\hbox(0.0+0.0)x120.0 []
+---
+> .\hbox(0.0+0.0)x120.0, yoko(math) direction []
+1954c1982
+< (tripos.tex
+---
+> (./tripos.tex
+2018c2046
+< \vbox(16383.99998+1.0)x100.0, glue set 16239.0fil
+---
+> \vbox(16383.99998+1.0)x100.0, glue set 16238.99998fil
+2022a2051
+> ..\displace 0.0
+2048,2049c2077,2078
+< ..\rip ^^82 (ligature CA)
+< ..\rip ^^82 (ligature CA)
+---
+> ..\rip (ligature CA)
+> ..\rip (ligature CA)
+2058a2088
+> ..\displace 0.0
+2071a2102
+> ..\displace 0.0
+2092a2124
+> ..\displace 0.0
+2113a2146
+> ..\displace 0.0
+2123a2157
+> ..\displace 0.0
+2142a2177
+> ..\displace 0.0
+2150a2186
+> ..\displace 0.0
+2171c2207,2208
+< ..\hbox(0.0+0.0)x120.0
+---
+> ..\hbox(0.0+0.0)x120.0, yoko(math) direction
+> ...\displace 0.0
+2189c2226
+< Memory usage before: 950&531; after: 546&448; still untouched: 706
+---
+> Memory usage before: 1490&530; after: 822&447; still untouched: 1945
+2397c2434
+< ! Improper alphabetic constant.
+---
+> ! Improper alphabetic or KANJI constant.
+2533c2570
+< \vbox(16383.99998+0.0)x20.0, glue set 16331.0fil
+---
+> \vbox(16383.99998+0.0)x20.0, glue set 16330.99998fil
+2544a2582
+> ..\displace 0.0
+2570c2608,2609
+< .\hbox(0.0+0.0)x15.0, glue set 0.1875, shifted 5.0
+---
+> .\hbox(0.0+0.0)x15.0, glue set 0.1875, shifted 5.0, yoko(math) direction
+>
+2572c2611
+< ..\hbox(0.0+0.0)x0.0
+---
+> ..\hbox(0.0+0.0)x0.0, yoko(math) direction
+2575c2614
+< Memory usage before: 339&413; after: 236&405; still untouched: 706
+---
+> Memory usage before: 493&411; after: 325&403; still untouched: 1945
+2650,2651c2689,2690
+< Dimensions can be in units of em, ex, in, pt, pc,
+< cm, mm, dd, cc, bp, or sp; but yours is a new one!
+---
+> Dimensions can be in units of em, ex, zw, zh, in, pt, pc,
+> cm, mm, dd, cc, bp, H, Q, or sp; but yours is a new one!
+3038c3077,3078
+< ^\hbox(7.0+1.0)x2.0
+---
+> ^\hbox(7.0+1.0)x2.0, yoko(math) direction
+> ^.\displace 0.0
+3051c3091
+< \insert0, natural size 0.0; split(1.0 plus 43.0,-2.0); float cost 100
+---
+> \insert0Y, natural size 0.0; split(1.0 plus 43.0,-2.0); float cost 100
+3054c3094
+< .\fam0 ^^c8
+---
+> .\fam0
+3056c3096
+< .\vbox(-2.0+0.0)x0.0
+---
+> .\vbox(-2.0+0.0)x0.0, yoko(math) direction
+3060c3100,3101
+< ^.\hbox(7.0+1.0)x2.0, shifted -2.0
+---
+> ^.\hbox(7.0+1.0)x2.0, shifted -2.0, yoko(math) direction
+> ^..\displace 0.0
+3140a3182
+> .....\displace 0.0
+3142a3185
+> ....|\displace 0.0
+3143a3187
+> ....\displace 0.0
+3151a3196
+> .\displace 0.0
+3235c3280
+< ! \textfont 0 is undefined (character ^^c8).
+---
+> ! \textfont 0 is undefined (character ).
+3286c3331
+< .\vbox(6.0+-8.0)x0.0
+---
+> .\vbox(6.0+-8.0)x0.0, yoko(math) direction
+3326c3371
+< \vbox(10000.0+2.0)x28.0, glue set 9737.58789fil
+---
+> \vbox(10000.0+2.0)x28.0, glue set 9737.58742fil
+3329a3375
+> ..\displace 0.0
+3374c3420
+< ..\vbox(6.0+-8.0)x0.0
+---
+> ..\vbox(6.0+-8.0)x0.0, yoko(math) direction
+3385c3431,3432
+< ......\hbox(7.0+1.0)x2.0, shifted -2.0
+---
+> ......\hbox(7.0+1.0)x2.0, shifted -2.0, yoko(math) direction
+> .......\displace 0.0
+3411c3458
+< p ^^82
+---
+> p
+3544a3592
+> ..........\displace 0.0
+3546a3595
+> .........|\displace 0.0
+3547a3597
+> .........\displace 0.0
+3564c3614,3615
+< ...\hbox(7.0+1.0)x1.99
+---
+> ...\hbox(7.0+1.0)x1.99, yoko(math) direction
+> ....\displace 0.0
+3616c3667
+< Memory usage before: 2170&521; after: 1181&459; still untouched: 175
+---
+> Memory usage before: 3279&519; after: 1749&457; still untouched: 484
+3864c3915
+< \vbox(16383.99998+2.0)x100.0, glue set 16318.0fil
+---
+> \vbox(16383.99998+2.0)x100.0, glue set 16317.99997fil
+3919,3920c3970,3972
+< ...\vbox(-0.00002+13.00002)x52.5, glue set - 0.00247
+< ....\vbox(-0.00002+0.0)x0.0
+---
+> ...\vbox(-0.00002+13.00002)x52.5, glue set - 0.00247, yoko(math) directi
+> on
+> ....\vbox(-0.00002+0.0)x0.0, yoko(math) direction
+3951c4003
+< Memory usage before: 640&415; after: 397&410; still untouched: 175
+---
+> Memory usage before: 955&413; after: 569&408; still untouched: 484
+3985c4037
+< ^^82
+---
+>
+3991c4043
+< []\ip A ^^82
+---
+> []\ip A
+4034c4086
+< \vbox(16383.99998+0.0)x8236.0, glue set 16344.0fil
+---
+> \vbox(16383.99998+0.0)x8236.0, glue set 16343.99998fil
+4041c4093
+< ..\ip ^^82
+---
+> ..\ip
+4053c4105
+< Memory usage before: 235&401; after: 178&399; still untouched: 175
+---
+> Memory usage before: 338&399; after: 244&397; still untouched: 484
+4420c4472
+< \vbox(16383.99998+0.0)x100.0, glue set 16332.0fil
+---
+> \vbox(16383.99998+0.0)x100.0, glue set 16331.99998fil
+4425a4478
+> ...\displace 0.0
+4447a4501
+> ...\displace 0.0
+4475a4530
+> ...\displace 0.0
+4492a4548
+> ...\displace 0.0
+4506c4562
+< Memory usage before: 651&432; after: 417&418; still untouched: 175
+---
+> Memory usage before: 1004&431; after: 602&417; still untouched: 484
+4742c4798,4799
+< \vbox(16383.99998+0.0)x205.12613, glue set 16344.0fil
+---
+> \vbox(16383.99998+0.0)x205.12613, glue set 16343.99998fil, yoko directio
+> n
+4746a4804
+> ...\displace 0.0
+4762a4821
+> .....\displace 0.0
+4777a4837
+> ......\displace 0.0
+4828c4888
+< Memory usage before: 776&458; after: 464&452; still untouched: 175
+---
+> Memory usage before: 1182&457; after: 678&451; still untouched: 484
+5701c5761
+< ! \textfont 0 is undefined (character ^^c8).
+---
+> ! \textfont 0 is undefined (character ).
+6381c6441
+< (tripos.tex
+---
+> (./tripos.tex
+6502c6562
+< l.429 ...^^M=13 \def^^M{\relax}#
+---
+> l.429 ...^^M=13 \defqqM{\relax}#
+6596c6656
+< Memory usage before: 819&428; after: 720&426; still untouched: 175
+---
+> Memory usage before: 1228&428; after: 1074&426; still untouched: 484
+6853c6913
+< .|vbox(0.0+0.0)x0.0
+---
+> .|vbox(0.0+0.0)x0.0, yoko(math) direction
+6876a6937
+> ..|displace 0.0
+6891a6953
+> ..|displace 0.0
+6926a6989
+> .|displace 0.0
+6959a7023
+> .|displace 0.0
+6961c7025,7026
+< .|hbox(0.0+0.0)x0.0
+---
+> .|hbox(0.0+0.0)x0.0, yoko(math) direction
+> ..|displace 0.0
+6991a7057
+> .|displace 0.0
+7103a7170
+> ...|displace 0.0
+7108d7174
+< ...|ip A (ligature BB)
+7116a7183
+> ...|displace 0.0
+7125d7191
+< ...|kern2.0
+7126a7193
+> .|displace 0.0
+7136c7203
+< ...|vbox(0.0+0.0)x0.0
+---
+> ...|vbox(0.0+0.0)x0.0, yoko(math) direction
+7156c7223
+< Memory usage before: 895&439; after: 290&420; still untouched: 175
+---
+> Memory usage before: 1346&439; after: 394&420; still untouched: 484
+7289c7356
+< Memory usage before: 334&431; after: 292&418; still untouched: 175
+---
+> Memory usage before: 458&431; after: 396&418; still untouched: 484
+7297,7300c7364,7367
+< 47 strings out of 1674
+< 253 string characters out of 8367
+< 2825 words of memory out of 3000
+< 372 multiletter control sequences out of 2100
+---
+> 44 strings out of 1511
+> 261 string characters out of 13808
+> 4016 words of memory out of 4500
+> 426 multiletter control sequences out of 15000+0
+7302c7369
+< 2 hyphenation exceptions out of 307
+---
+> 1 hyphenation exception out of 659
+
+mv tripos.tex uptripos.tex
++ mv tripos.tex uptripos.tex
+diff $testdir/tripos.tex uptripos.tex || is_OK=false
++ diff SRCDIR/triptrap/tripos.tex uptripos.tex
+
+eval ./dvitype $dvitype_args trip.dvi >uptrip.typ || exit 1
++ eval ./dvitype -output-level=2 -dpi=72.27 '-page-start='\''*.*.*.*.*.*.*.*.*.*'\''' trip.dvi
+./dvitype -output-level=2 -dpi=72.27 -page-start='*.*.*.*.*.*.*.*.*.*' trip.dvi
+++ ./dvitype -output-level=2 -dpi=72.27 '-page-start=*.*.*.*.*.*.*.*.*.*' trip.dvi
+$DIFF $DIFFFLAGS $testdir/trip.typ uptrip.typ
++ diff SRCDIR/triptrap/trip.typ uptrip.typ
+1c1
+< This is DVItype, Version 3.6
+---
+> This is DVItype, Version 3.6 (TeX Live 2021/dev)
+9c9
+< ' TeX output 1776.07.04:1200'
+---
+> ' TeX output 2021.01.27:1803'
+419c419
+< 1121: down4 639342208
+---
+> 1121: down4 639342177
+1087,1088c1087,1088
+< 2535: y4 203921760
+< 2540: y0 203921760
+---
+> 2535: y4 203921756
+> 2540: y0 203921756
+
+$is_OK || {
+ echo ">>> There were some errors." >&2
+ exit 1
+}
++ :
+
+PASS uptexdir/uptriptest.test (exit status: 0)
+PASS: uptexdir/uptriptest.test
diff --git a/Build/source/texk/web2c/uptexdir/uptriptest.test b/Build/source/texk/web2c/uptexdir/uptriptest.test
new file mode 100755
index 00000000000..8035f023bb3
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/uptriptest.test
@@ -0,0 +1,71 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2017-2018 Karl Berry <tex-live@tug.org>
+# Copyright 2011-2014 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
+
+testdir=$abs_srcdir/triptrap
+uptestdir=$abs_srcdir/uptexdir/uptrip
+
+TEXMFCNF=$uptestdir; export TEXMFCNF
+
+rm -rf uptripdir
+mkdir uptripdir
+cd uptripdir
+
+dvitype_args="-output-level=2 -dpi=72.27 -page-start='*.*.*.*.*.*.*.*.*.*'"
+
+echo ">>> Running TRIP test for upTeX." >&2
+echo ">>> See $uptestdir/uptrip.diffs for example of acceptable diffs." >&2
+
+# upTeX outputs direction of boxes.
+P_SED1='s/, yoko direction//;s/yoko direction, //'
+P_SED2='s/yoko(math) direction, //'
+
+is_OK=:
+
+set -x
+
+echo "*** TRIP test for upTeX ***."
+
+../pltotf $testdir/trip.pl trip.tfm || exit 1
+
+../tftopl ./trip.tfm trip.pl || exit 1
+
+diff $testdir/trip.pl trip.pl || is_OK=false
+
+# get same filename in log
+$LN_S $testdir/trip.tex .
+
+rm -f trip.log
+../uptex --progname=upinitex --ini <$testdir/trip1.in >uptripin.fot
+if test ! -s trip.fmt; then
+ echo "*** trip.fmt not created by trip1.in, investigate!" >&2
+ exit 1
+fi
+sed "$P_SED1" trip.log > uptripin.log || exit 1
+diff $testdir/tripin.log uptripin.log
+
+# May as well test non-ini second time through.
+rm -f trip.log
+../uptex --progname=uptex <$testdir/trip2.in >uptrip.fot
+sed "$P_SED1;$P_SED2" trip.log > uptrip.log
+diff $testdir/trip.fot uptrip.fot
+
+# We use $DIFF instead of `diff' only for those files where there
+# might actually be legitimate numerical differences.
+$DIFF $DIFFFLAGS $testdir/trip.log uptrip.log
+
+mv tripos.tex uptripos.tex
+diff $testdir/tripos.tex uptripos.tex || is_OK=false
+
+eval ../dvitype $dvitype_args trip.dvi >uptrip.typ || exit 1
+$DIFF $DIFFFLAGS $testdir/trip.typ uptrip.typ
+
+$is_OK || {
+ echo ">>> There were some errors." >&2
+ exit 1
+}
+
diff --git a/Build/source/texk/web2c/uptexdir/upver.test b/Build/source/texk/web2c/uptexdir/upver.test
new file mode 100755
index 00000000000..9384214603f
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/upver.test
@@ -0,0 +1,32 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2019 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+# You may freely use, modify and/or distribute this file.
+
+LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
+
+TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
+TEXINPUTS=$srcdir/ptexdir/tests:.; export TEXINPUTS
+
+# check consistency between runtime terminal and log
+./uptex -ini -interaction batchmode -jobname upver1-log pver1.tex >upver1-term.log || exit 1
+sed -n 's/^This is \([-A-Za-z]*\), Version [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
+ upver1-term.log >upver1-term_ed.log || exit 1
+sed -n 's/^This is \([-A-Za-z]*\), Version [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
+ upver1-log.log >upver1-log_ed.log || exit 1
+diff upver1-term_ed.log upver1-log_ed.log || exit 2
+
+# check consistency between runtime and version output
+./uptex -version >upver2-self.log || exit 1
+sed -n '1 s/^\([-A-Za-z]*\) [^-]*-\([^ ]*\) \(.*\)/\1 \2/p' \
+ upver2-self.log >upver2-self_ed.log || exit 1
+diff upver1-term_ed.log upver2-self_ed.log || exit 4
+
+# check consistency between version output and version primitives
+./uptex -ini -interaction batchmode -jobname upver2-prim pver2.tex || exit 1
+sed -n 's/^Engine \([-A-Za-z]*\) \([^ ]*\) \(.*\)/\1 \2/p' \
+ upver2-prim.log >upver2-prim_ed.log || exit 1
+diff upver2-self_ed.log upver2-prim_ed.log || exit 8
+
+exit 0
+
diff --git a/Build/source/texk/web2c/uptexdir/yokotate.test b/Build/source/texk/web2c/uptexdir/yokotate.test
new file mode 100755
index 00000000000..82fce7d0c60
--- /dev/null
+++ b/Build/source/texk/web2c/uptexdir/yokotate.test
@@ -0,0 +1,23 @@
+#! /bin/sh -vx
+# $Id$
+# Copyright 2017 Karl Berry <tex-live@tug.org>
+# Copyright 2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d uptests || mkdir -p uptests
+
+# Test inputs
+testdir=$srcdir/uptexdir/tests
+
+# Testing upPLtoTF/upTFtoPL for umin10 (yoko=horiz) and utmin10 (tate=vert).
+for font in umin10 utmin10; do
+
+ ./uppltotf -verbose $testdir/$font.pl uptests/x$font.tfm && \
+ cmp $testdir/$font.tfm uptests/x$font.tfm && echo || exit 1
+
+ TEXMFCNF=$srcdir/../kpathsea \
+ ./uptftopl -charcode-format octal -verbose $testdir/$font.tfm uptests/x$font.pl && \
+ diff $testdir/$font.pl uptests/x$font.pl && echo || exit 1
+
+done
+