summaryrefslogtreecommitdiff
path: root/macros/generic/ifptex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/ifptex
Initial commit
Diffstat (limited to 'macros/generic/ifptex')
-rw-r--r--macros/generic/ifptex/LICENSE21
-rw-r--r--macros/generic/ifptex/README-ja.md108
-rw-r--r--macros/generic/ifptex/README.md111
-rw-r--r--macros/generic/ifptex/ifptex.sty322
-rw-r--r--macros/generic/ifptex/ifuptex.sty54
5 files changed, 616 insertions, 0 deletions
diff --git a/macros/generic/ifptex/LICENSE b/macros/generic/ifptex/LICENSE
new file mode 100644
index 0000000000..8ada757fbc
--- /dev/null
+++ b/macros/generic/ifptex/LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2017 Takayuki YATO (aka. "ZR")
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/macros/generic/ifptex/README-ja.md b/macros/generic/ifptex/README-ja.md
new file mode 100644
index 0000000000..48690cce58
--- /dev/null
+++ b/macros/generic/ifptex/README-ja.md
@@ -0,0 +1,108 @@
+ifptex パッケージバンドル
+=========================
+
+TeX: エンジンが pTeX(やその派生)であるかを判定する
+
+ifptex パッケージは ifxetex や ifluatex 等のパッケージの pTeX 版に
+相当する。ifuptex パッケージは ifptex の別名で、後方互換性のために
+用意されている。
+
+### システム要件
+
+ - TeX フォーマット: plain TeX、LaTeX (および他の plain 互換なもの)
+ - TeX エンジン: 不問
+ - DVI ウェア(DVI 出力時): 不問
+
+### インストール
+
+TDS 1.1 に準拠するシステムの場合、以下のようにファイルを移動する:
+
+ - `*.sty` → $TEXMF/tex/latex/ifptex
+
+この後必要に応じて mktexlsr を実行する。
+
+ifptex パッケージ ― pTeX 系エンジンの判定
+------------------------------------------
+
+### パッケージ読込
+
+plain TeX の場合:
+
+ \input ifptex.sty
+
+LaTeX の場合:
+
+ \usepackage{ifptex}
+
+### 機能
+
+注意:e-TeX拡張の有無は区別されない。
+
+ * `\ifpTeX`(又は `\ifptex`)[if-トークン]
+ pTeX(upTeX、pTeX-ng を含む)を使っているか。
+ * `\ifstrictpTeX`(又は `\ifstrictptex`)[if-トークン]
+ pTeX(upTeX、pTeX-ng ではなく)を使っているか。
+ * `\ifupTeX`(又は `\ifuptex`) [if-トークン]
+ upTeX(pTeX-ng を含む)を使っているか。
+ * `\ifstrictupTeX`(又は `\ifstrictuptex`) [if-トークン]
+ upTeX(pTeX-ng ではなく)を使っているか。
+ * `\ifnativeupTeX` [if-トークン]
+ upTeX を内部文字コードが Unicode の状態で使っているか。
+ * `\ifpTeXng`(又は `\ifptexng`)[if-トークン]
+ pTeX-ng を使っているか。
+ ※一応 `\ifstrictpTeXng`(`\ifstrictptexng`)もある。
+ * `\RequirepTeX`
+ `\ifpTeX` 不成立の場合はエラーを出す。
+ * `\RequireStirctpTeX`
+ `\ifstrictpTeX` 不成立の場合はエラーを出す。
+ * `\RequireupTeX`
+ `\ifupTeX` 不成立の場合はエラーを出す。
+ * `\RequireStrictupTeX`
+ `\ifstrictupTeX` 不成立の場合はエラーを出す。
+ * `\RequireNativeupTeX`
+ `\ifnativeupTeX` 不成立の場合はエラーを出す。
+ * `\RequirepTeXng`
+ `\ifpTeXng` 不成立の場合はエラーを出す。
+ ※一応 `\RequireStrictpTeXng` もある。
+
+
+ifuptex パッケージ ― ifptex の別名
+-----------------------------------
+
+ただ単に ifptex を読み込むだけのパッケージであり、0.2 版との後方互換性の
+ために用意されている。
+
+### パッケージ読込
+
+plain TeX の場合:
+
+ \input ifuptex.sty
+
+LaTeX の場合:
+
+ \usepackage{ifuptex}
+
+
+更新履歴
+--------
+
+ * Version 1.2c 〈2017/10/04〉
+ - バグ修正。
+ * Version 1.2b 〈2017/09/20〉
+ - バグ修正。
+ * Version 1.2a 〈2017/09/15〉
+ - (試験的) `漢字コード=UTF-8` 機能を追加。
+ * Version 1.2 〈2017/09/09〉
+ - `\ifstrictupTeX`、`\RequireStrictupTeX` を追加。
+ * Version 1.1 〈2017/05/04〉
+ - 細かい調整。
+ * Version 1.0 〈2013/04/29〉
+ - 独立のバンドルに移動。
+ - パッケージ名を ifptex に変更して、pTeX 判定機能を付加。
+ - (試験的) upTeX の版判定機能を追加。
+ * Version 0.2 〈2008/03/14〉
+ - 最初の公開版。
+
+--------------------
+Takayuki YATO (aka. "ZR")
+https://github.com/zr-tex8r
diff --git a/macros/generic/ifptex/README.md b/macros/generic/ifptex/README.md
new file mode 100644
index 0000000000..c9d37688f9
--- /dev/null
+++ b/macros/generic/ifptex/README.md
@@ -0,0 +1,111 @@
+ifptex Package Bundle
+=====================
+
+TeX: To check the engine is pTeX (or its derivatives)
+
+The ifptex package is a counterpart of ifxetex, ifluatex, etc. for
+the pTeX engine. The ifuptex package is an alises to ifptex provided
+for backward compatibility.
+
+### System Requirements
+
+ - TeX format: plain TeX, LaTeX (and any plain-compatible ones).
+ - TeX engine: Anything.
+ - DVI driver (in DVI mode): Anything.
+
+### Installation
+
+In a system compliant to TDS 1.1, move the files as follows:
+
+ - `*.sty` → $TEXMF/tex/latex/ifptex
+
+And rehash your TEXMF trees if necessary.
+
+### License
+
+This package is distributed under the MIT License.
+
+ifptex Package ― Test for pTeX engine
+--------------------------------------
+
+### Package Loading
+
+In plain TeX:
+
+ \input ifptex.sty
+
+In LaTeX:
+
+ \usepackage{ifptex}
+
+### Usage
+
+NB: Here “e-TeX-ness” is not considered.
+
+ * `\ifpTeX` (or `\ifptex`) [if-token]
+ Whether the engine is pTeX (including upTeX or pTeX-ng).
+ * `\ifstrictpTeX` (or `\ifstrictptex`) [if-token]
+ Whether the engine is pTeX but *not* upTeX or pTeX-ng.
+ * `\ifupTeX` (or `\ifuptex`) [if-token]
+ Whether the engine is upTeX (including pTeX-ng).
+ * `\ifstrictupTeX` (or `\ifstrictuptex`) [if-token]
+ Whether the engine is upTeX but *not* pTeX-ng.
+ * `\ifnativeupTeX` [if-token]
+ Whether the engine is upTeX and its internal encoding is Unicode.
+ * `\ifpTeXng` (or `\ifptexng`) [if-token]
+ Whether the engine is pTeX-ng.
+ * `\RequirepTeX`
+ Issues an error if `\ifpTeX` fails.
+ * `\RequireStrictpTeX`
+ Issues an error if `\ifstrictpTeX` fails.
+ * `\RequireupTeX`
+ Issues an error if `\ifupTeX` fails.
+ * `\RequireStrictupTeX`
+ Issues an error if `\ifstrictupTeX` fails.
+ * `\RequireNativeupTeX`
+ Issues an error if `\ifnativeupTeX` fails.
+ * `\RequirepTeXng`
+ Issues an error if `\ifpTeXng` fails.
+
+
+ifuptex Package ― Alias of ifptex
+----------------------------------
+
+The ifuptex package does nothing but loading ifptex internally. It is
+provided for backward compatibility.
+
+### Package Loading
+
+In plain TeX:
+
+ \input ifuptex.sty
+
+In LaTeX:
+
+ \usepackage{ifuptex}
+
+### Usage
+
+Just the same as the ifptex package.
+
+
+Revision History
+----------------
+
+ * Version 1.2c 〈2017/10/04〉
+ * Version 1.2b 〈2017/09/20〉
+ * Version 1.2a 〈2017/09/15〉
+ * Version 1.2 〈2017/09/09〉
+ - Add `\ifstrictupTeX` and `RequireStrictupTeX`.
+ * Version 1.1 〈2017/05/04〉
+ - Minor fix.
+ * Version 1.0 〈2013/04/29〉
+ - Move to a separate bundle.
+ - Change the package name to ifptex, and added the test
+ for pTeX (besides upTeX).
+ * Version 0.2 〈2008/03/14〉
+ - First public version.
+
+--------------------
+Takayuki YATO (aka. "ZR")
+https://github.com/zr-tex8r
diff --git a/macros/generic/ifptex/ifptex.sty b/macros/generic/ifptex/ifptex.sty
new file mode 100644
index 0000000000..29cec914ef
--- /dev/null
+++ b/macros/generic/ifptex/ifptex.sty
@@ -0,0 +1,322 @@
+%%
+%% This is file 'ifptex.sty'.
+%%
+%% Copyright (c) 2017 Takayuki YATO (aka. "ZR")
+%% GitHub: https://github.com/zr-tex8r
+%% Twitter: @zr_tex8r
+%%
+%% This package is distributed under the MIT License.
+%%
+%
+%% avoid multiple loading
+\csname\if11bxipIfptexLoaded\fi\endcsname
+%% code guards
+\edef\x{%
+\catcode32=\the\catcode32%
+\catcode33=\the\catcode33%
+\catcode35=\the\catcode35%
+\catcode42=\the\catcode42%
+\catcode60=\the\catcode60%
+\catcode62=\the\catcode62%
+\catcode64=\the\catcode64%
+\catcode91=\the\catcode91%
+\catcode93=\the\catcode93%
+\relax}
+\catcode32=10\relax
+\catcode33=11 %<">
+\catcode35=6 %<#>
+\catcode42=12 %<*>
+\catcode60=12 %<<>
+\catcode62=12 %<>>
+\catcode64=11 %<@>
+\catcode91=12 %<[>
+\catcode93=12 %<]>
+\edef\bxip@restore@codes{\x
+ \noexpand\let\noexpand\bxip@restore@codes\relax}
+\def\bxipIfptexLoaded{\endinput}
+
+%% check for LaTeX
+\ifx\RequirePackage\@undefined %<*!LaTeX>
+ \let\bxip@latex=f
+ \long\def\x#1\ProvidesPackage#2[#3]{%
+ \immediate\write-1{Package: #2 #3}}
+ \expandafter\x
+\else %<*LaTeX>
+ \let\bxip@latex=t \let\x\relax
+\fi %</LaTeX>
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{ifptex}[2017/10/04 v1.2c pTeX checker]
+\def\bxip@pkgname{ifptex}
+
+%% enter the big group
+\begingroup
+
+%--------------------------------------- helpers
+
+%% \bxip@csletcs{<csnameA>}{<csnameB>}
+\def\bxip@csletcs#1#2{%
+ \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}
+%% \bxip@true{<csname>}
+\def\bxip@true#1{%
+ \expandafter\let\csname#1\endcsname\iftrue}
+%% \bxip@false{<csname>}
+\def\bxip@false#1{%
+ \expandafter\let\csname#1\endcsname\iffalse}
+
+%% switches
+\bxip@false{ifbxip@ok}
+
+%% \bxip@test@primitive\CS
+\def\bxip@test@primitive#1{%
+ \edef\bxip@tmpa{\string#1}\edef\bxip@tmpb{\meaning#1}%
+ \ifx\bxip@tmpa\bxip@tmpb \bxip@true{ifbxip@ok}%
+ \else \bxip@false{ifbxip@ok}%
+ \fi}
+
+%% \bxip@with@default{<arg>}\CS
+\gdef\bxip@with@default#1#2{%
+ \def\bxip@tmpa{#2}\def\bxip@tmpb{#2[#1]}%
+ \futurelet\bxip@tok\bxip@with@default@a}
+\gdef\bxip@with@default@a{%
+ \ifx[\bxip@tok\expandafter\bxip@tmpa%]
+ \else \expandafter\bxip@tmpb
+ \fi}
+
+%% \bxip@check@version{<current>}{<required>}{<label>}
+\global\countdef\bxip@cnta=255
+\gdef\bxip@check@version#1#2#3{%
+ \ifnum#1<#2\relax
+ \begingroup
+ \bxip@cnta=#2\relax \advance\bxip@cnta100000\relax
+ \expandafter\bxip@check@version@a\the\bxip@cnta\relax{#3}%
+ \endgroup
+ \fi}
+\gdef\bxip@check@version@a#1#2#3#4#5#6\relax#7{%
+ \bxip@err@required{#7 v.>=\number#2#3#4.#5#6}}
+
+%% \bxip@err@required{<string>}
+% NB: Now the same style as in ifxetex is used.
+\gdef\bxip@err@required#1{%
+ \begingroup
+ \errorcontextlines=-1\relax
+ \newlinechar=10\relax
+ \errmessage{^^J
+ ********************************************^^J
+ * #1 is required to compile this document.^^J
+ * Sorry!^^J
+ ********************************************}%
+ \endgroup}
+
+%--------------------------------------- guess version
+
+%% \bxip@uptex@new@version
+\global\mathchardef\bxip@uptex@new@version=19
+
+%%<+> \upTeXguessedversion
+\global\mathchardef\upTeXguessedversion=0
+% if \ucs exists, then gv >= 1
+\bxip@test@primitive\ucs\ifbxip@ok
+ \global\mathchardef\upTeXguessedversion=1
+ % if \enablecjktoken exists, then gv >= 6
+ \bxip@test@primitive\enablecjktoken\ifbxip@ok
+ \global\mathchardef\upTeXguessedversion=6
+ % if \kchar exists, then gv >= 10
+ \bxip@test@primitive\kchar\ifbxip@ok
+ \global\mathchardef\upTeXguessedversion=10
+ % if \forcecjktoken exists, then gv >= 19
+ \bxip@test@primitive\forcecjktoken\ifbxip@ok
+ \global\mathchardef\upTeXguessedversion=19
+ \fi
+ \fi
+ \fi
+\fi
+
+%--------------------------------------- public stuffs
+% Note:
+% 1) Names '\ifFooTeX' are used in iftex.
+% 2) Names '\iffootex' are used in ifxetex/ifluatex/....
+% My preferences are:
+% - '\ifwhateverFooTeX' and '\RequireWhateverFooTeX'.
+% But I also provide aliases '\iffootex' and '\ifstrictfootex' for
+% compatibility with 1) and the old ifuptex.
+
+%%<+> \ifpTeX
+\global\bxip@false{ifpTeX}
+\bxip@test@primitive\kanjiskip\ifbxip@ok
+ \global\bxip@true{ifpTeX}
+\fi
+%%<+> \ifptex == \ifpTeX
+\global\bxip@csletcs{ifptex}{ifpTeX}
+
+%%<+> \ifupTeX
+\global\bxip@false{ifupTeX}
+%%<+> \ifnativeupTeX
+\global\bxip@false{ifnativeupTeX}
+\ifnum\upTeXguessedversion>0
+ \global\bxip@true{ifupTeX}
+ % native-ness check
+ \ifnum\ucs"3000="3000 \global\bxip@true{ifnativeupTeX}\fi
+\fi
+%%<+> \ifuptex == \ifupTeX
+\global\bxip@csletcs{ifuptex}{ifupTeX}
+
+%%<+> \ifpTeXng
+\global\bxip@false{ifpTeXng}
+\bxip@test@primitive\ngbanner\ifbxip@ok
+ \global\bxip@true{ifpTeXng}
+\fi
+%%<+> \ifptexng == \ifpTeXng
+\global\bxip@csletcs{ifptexng}{ifpTeXng}
+
+%%<+> \ifstrictpTeX
+\global\bxip@false{ifstrictpTeX}
+\ifpTeX \ifupTeX\else
+ \global\bxip@true{ifstrictpTeX}
+\fi\fi
+%%<+> \ifstrictptex == \ifstrictpTeX
+\global\bxip@csletcs{ifstrictptex}{ifstrictpTeX}
+
+%%<+> \ifstrictupTeX
+\global\bxip@false{ifstrictupTeX}
+\ifupTeX \ifpTeXng\else
+ \global\bxip@true{ifstrictupTeX}
+\fi\fi
+%%<+> \ifstrictuptex == \ifstrictupTeX
+\global\bxip@csletcs{ifstrictuptex}{ifstrictupTeX}
+
+%%<+> \ifstrictpTeXng (== \ifpTeXng, for now)
+\global\bxip@csletcs{ifstrictpTeXng}{ifpTeXng}
+%%<+> \ifstrictptexng == \ifstrictpTeXng
+\global\bxip@csletcs{ifstrictptexng}{ifstrictpTeXng}
+
+%%<+> \RequirepTeX
+\gdef\RequirepTeX{%
+ \ifpTeX\else \bxip@err@required{(u)pTeX}\fi}
+%%<+> \RequireStrictpTeX
+\gdef\RequireStrictpTeX{%
+ \ifstrictpTeX\else \bxip@err@required{pTeX (not upTeX)}\fi}
+%%<+> \RequireupTeX
+\gdef\RequireupTeX{%
+ \ifupTeX\else \bxip@err@required{upTeX}\fi}
+%%<+> \RequireStrictupTeX
+\gdef\RequireStrictupTeX{%
+ \ifstrictupTeX\else \bxip@err@required{upTeX (not pTeX-ng)}\fi}
+%%<+> \RequireNativeupTeX
+\gdef\RequireNativeupTeX{%
+ \ifnativeupTeX\else \bxip@err@required{upTeX in Unicode}\fi}
+%%<+> \RequirepTeXng
+\gdef\RequirepTeXng{%
+ \ifpTeXng\else \bxip@err@required{pTeX-ng}\fi}
+%%<+> \RequireStrictpTeXng
+\gdef\RequireStrictpTeXng{%
+ \ifstrictpTeXng\else \bxip@err@required{pTeX-ng}\fi}
+
+%--------------------------------------- KanjiKoodo declaration
+\ifpTeX
+
+%% \bxip@def@str\CS{<strcode>}
+\def\bxip@def@str#1#2{%
+ \let\bxip@str\@empty#2\let#1\bxip@str}
+\def\bxip@def@str@j#1{%
+ \kansujichar1=#1\relax\edef\bxip@str{\bxip@str\kansuji1}}
+\def\bxip@def@str@a#1{%
+ \uccode`\?=#1\relax\uppercase{\edef\bxip@str{\bxip@str?}}}
+\def\U/#1#2#3#4{\bxip@def@str@j{\ucs"#1#2#3#4}}
+\ifx\ucs\@undefined \def\U/#1#2#3#4{}\fi
+\def\J/#1#2#3#4{\bxip@def@str@j{\jis"#1#2#3#4}}
+\def\X/#1#2{\bxip@def@str@a{"#1#2}}
+
+%% KanjiKoodo strings
+% This is the correct "KanjiKoodo=".
+\bxip@def@str\bxip@@knjcde@u@u
+{\J/3441\J/3B7A\J/2533\J/213C\J/2549\X/3D}
+% This is the token list that results when upTeX with settings
+% "kanji=sjis, kanji-internal=uptex" reads the string "KanjiKoodo="
+% written in UTF-8. Note that mojibake will ocuur unless "kanji=utf8".
+\bxip@def@str\bxip@@knjcde@s@u
+{\U/8C8D\X/A2\U/87C4\U/52B1\U/3055\U/7E5D\X/BC\U/7E5D\X/89\X/3D}
+% Ditto, with settings "kanji=sjis, kanji-internal=sjis", and so on....
+\bxip@def@str\bxip@@knjcde@s@s
+{\J/6C3E\X/A2\J/6A2F\J/4E65\J/2435\J/6563\X/BC\J/6563\X/89\X/3D}
+\bxip@def@str\bxip@@knjcde@s@e
+{\J/6C3E\J/226A\J/2F4E\J/6524\J/3565\J/633C\J/6563\X/89\X/3D}
+\bxip@def@str\bxip@@knjcde@e@u
+{\U/7FB2\U/221A\X/AD\X/97\X/E3\X/82\U/6F5F\X/83\U/82E5\X/83\X/89\X/3D}
+\bxip@def@str\bxip@@knjcde@e@s
+{\J/663C\J/2265\X/AD\J/4E65\J/236A\J/2563\J/3C63\J/2569\X/3D}
+\bxip@def@str\bxip@@knjcde@e@e
+{\J/663C\J/2265\X/AD\X/97\X/E3\X/82\J/3363\X/83\J/3C63\X/83\X/89\X/3D}
+
+%% KanjiKoodo control sequences
+% The correct \[KanjiKoodo=UTF-8], meaning input kanji code is right.
+\global\@namedef{\bxip@@knjcde@u@u UTF-8}{\bxip@ensure@utf{}}
+% The mojibake \[XXXXX=UTf-8], meaning input kanji code is wrong.
+\global\@namedef{\bxip@@knjcde@s@u UTF-8}{\bxip@ensure@utf{sjis}}
+\global\@namedef{\bxip@@knjcde@s@s UTF-8}{\bxip@ensure@utf{sjis}}
+\global\@namedef{\bxip@@knjcde@s@e UTF-8}{\bxip@ensure@utf{sjis}}
+\global\@namedef{\bxip@@knjcde@e@u UTF-8}{\bxip@ensure@utf{euc}}
+\global\@namedef{\bxip@@knjcde@e@s UTF-8}{\bxip@ensure@utf{euc}}
+\global\@namedef{\bxip@@knjcde@e@e UTF-8}{\bxip@ensure@utf{euc}}
+
+%% \bxip@ensure@utf{<enc>}
+\gdef\bxip@ensure@utf#1{%
+ \ifx @#1@\expandafter\@gobble
+ \else \expandafter\@firstofone
+ \fi{\bxip@ensure@utf@a{#1}}}
+\ifx\epTeXinputencoding\@undefined
+ \gdef\bxip@ensure@utf@a#1{%
+ \PackageWarning\bxip@pkgname
+ {The input kanji code for file '\@currname.\@currext'\MessageBreak
+ is set to #1, but should be utf8\@gobble}}%
+\else
+ \gdef\bxip@ensure@utf@a#1{%
+ \PackageInfo\bxip@pkgname
+ {The input kanji code for file '\@currname.\@currext'\MessageBreak
+ was changed from #1 to utf8\@gobble}%
+ \ifnum\currentgrouplevel>\z@
+ \aftergroup\bxip@ensure@utf@b
+ \else \expandafter\bxip@ensure@utf@b
+ \fi}
+ \gdef\bxip@ensure@utf@b{%
+ \epTeXinputencoding utf8}% unterminated
+\fi
+
+\fi
+%--------------------------------------- deprecated stuffs
+
+%%<+>D \ifNativeupTeX == \ifnativeupTeX
+\global\bxip@csletcs{ifNativeupTeX}{ifnativeupTeX}
+%%<+>D \RequirenativeupTeX == \RequireNativeupTeX
+\gdef\RequirenativeupTeX{\RequireNativeupTeX}
+
+%%<+>D \ifnewupTeX
+\global\bxip@false{ifnewupTeX}
+\ifnum\upTeXguessedversion<\bxip@uptex@new@version\else
+ \global\bxip@true{ifnewupTeX}
+\fi
+
+%%<+>D \RequireNewupTeX
+\gdef\RequireNewupTeX{%
+ \bxip@with@default\bxip@uptex@new@version\bxip@require@new@uptex@a}
+\gdef\bxip@require@new@uptex@a[#1]{%
+ \ifupTeX
+ \bxip@check@version\upTeXguessedversion{#1}{upTeX}%
+ \else \bxip@err@required{upTeX}%
+ \fi}
+
+%%<+>D \RequireNativeNewupTeX
+\gdef\RequireNativeNewupTeX{%
+ \bxip@with@default\bxip@uptex@new@version\bxip@require@new@uptex@b}
+\gdef\bxip@require@new@uptex@b[#1]{%
+ \ifnativeupTeX
+ \bxip@check@version\upTeXguessedversion{#1}{upTeX in Unicode}%
+ \else \bxip@err@required{upTeX in Unicode}%
+ \fi}
+
+%--------------------------------------- all done
+\endgroup
+\bxip@restore@codes
+\endinput
+%% EOF
diff --git a/macros/generic/ifptex/ifuptex.sty b/macros/generic/ifptex/ifuptex.sty
new file mode 100644
index 0000000000..cb84bd8cbd
--- /dev/null
+++ b/macros/generic/ifptex/ifuptex.sty
@@ -0,0 +1,54 @@
+%%
+%% This is file 'ifuptex.sty'.
+%%
+%% Copyright (c) 2017 Takayuki YATO (aka. "ZR")
+%% GitHub: https://github.com/zr-tex8r
+%% Twitter: @zr_tex8r
+%%
+%% This package is distributed under the MIT License.
+%%
+%
+% NOTE: Now ifuptex is merely an alias to ifptex.
+%
+%% avoid multiple loading
+\csname\if11bxipIfuptexLoaded\fi\endcsname
+%% code guards
+\edef\x{%
+\catcode32=\the\catcode32%
+\catcode45=\the\catcode45%
+\catcode46=\the\catcode46%
+\catcode47=\the\catcode47%
+\catcode58=\the\catcode58%
+\catcode64=\the\catcode64%
+\relax}
+\catcode32=10\relax
+\catcode45=12 % <->
+\catcode46=12 % <.>
+\catcode47=12 % </>
+\catcode58=12 % <:>
+\catcode64=11 % <@>
+\edef\bxip@up@restore@codes{\x
+ \noexpand\let\noexpand\bxip@up@restore@codes\relax}
+\def\bxipIfuptexLoaded{\endinput}
+
+%% check for LaTeX
+\ifx\RequirePackage\@undefined % non-LaTeX
+ \long\def\x#1\ProvidesPackage#2[#3]{%
+ \def\x\RequirePackage##1[##2]{\input ##1.sty\relax}%
+ \immediate\write-1{Package: #2 #3}}
+ \expandafter\x
+\else % LaTeX
+ \let\x\relax
+\fi
+
+%% package declaration
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{ifuptex}[2017/10/04 v1.2c upTeX checker]
+
+%% load ifptex
+\x\RequirePackage{ifptex}[2017/10/04]
+
+%% all done
+\bxip@up@restore@codes
+\endinput
+%% EOF