summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/ifxptex/ifxptex.sty
blob: 7342533f2625928f11f8348ec263907d0f13506b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109


% ifxptex.sty
% Copyright 2017 Yue ZHANG
% License: Knuth License (https://ctan.org/license/knuth)

\csname ENDINPUTIFXPTEXDOTSTY\endcsname

\let\ENDINPUTIFXPTEXDOTSTY=\endinput

\begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname ProvidesPackage\endcsname\relax
  \else
    \ProvidesPackage{ifxptex}[2017/09/02 v0.1a Detect pTeX and its derivatives]%
  \fi

\edef\IFXPTEXDOTSTYRESTORECATCODE{\catcode`\noexpand\@=\the\catcode`\@\relax}

\catcode`\@=11\relax

\def\ifxptex@ifprimitive#1{%
  \begingroup
    \edef\ifxptex@temp@meaning{\meaning#1}%
    \edef\ifxptex@temp@string{\string#1}%
    \expandafter
  \endgroup
  \ifx\ifxptex@temp@meaning\ifxptex@temp@string}

\newif\ifxptex
\newif\ifxeptex
\newif\ifxuptex
\newif\ifxeuptex
\newif\ifxaptex

\ifxptex@ifprimitive \tate               \xptextrue  \fi
\ifxptex@ifprimitive \epTeXinputencoding \xeptextrue \fi
\ifxptex@ifprimitive \ucs                \xuptextrue \fi
\ifxptex@ifprimitive \ngbanner           \xaptextrue \fi

\newif\ifxpTeX
\newif\ifxepTeX
\newif\ifxupTeX
\newif\ifxeupTeX
\newif\ifxApTeX

\ifxptex
  \ifxaptex
    \xApTeXtrue
  \else
    \ifxuptex
      \ifxeptex
        \xeupTeXtrue\xeuptextrue
      \else
        \xupTeXtrue
      \fi
    \else
      \ifxeptex
        \xepTeXtrue
      \else
        \xpTeXtrue
      \fi
    \fi
  \fi
\fi

\newif\ifxuniuptex
\newif\ifxunieuptex

\newif\ifxUniupTeX
\newif\ifxUnieupTeX

\ifxuptex  \ifnum\ucs"3000="3000\relax \xuniuptextrue  \fi \fi
\ifxeuptex \ifnum\ucs"3000="3000\relax \xunieuptextrue \fi \fi

\ifxupTeX  \ifnum\ucs"3000="3000\relax \xUniupTeXtrue  \fi \fi
\ifxeupTeX \ifnum\ucs"3000="3000\relax \xUnieupTeXtrue \fi \fi

\def\ifxptex@newrequiretex@error#1{% can be easily redefined
  \errmessage{#1 is required}}

\def\ifxptex@newrequiretex#1#2{%
  \expandafter\def\csname RequireX#1\endcsname{%
    \relax
    \csname ifx#1\endcsname
    \else
      \ifxptex@newrequiretex@error{#2}%
    \fi}}

\ifxptex@newrequiretex{ptex}{pTeX / e-pTeX / upTeX / e-upTeX / ApTeX}
\ifxptex@newrequiretex{eptex}{e-pTeX / e-upTeX}
\ifxptex@newrequiretex{uptex}{upTeX / e-upTeX / ApTeX}
\ifxptex@newrequiretex{euptex}{e-upTeX}
\ifxptex@newrequiretex{aptex}{ApTeX}

\ifxptex@newrequiretex{pTeX}{pTeX}
\ifxptex@newrequiretex{epTeX}{e-pTeX}
\ifxptex@newrequiretex{upTeX}{upTeX}
\ifxptex@newrequiretex{eupTeX}{e-upTeX}
\ifxptex@newrequiretex{ApTeX}{ApTeX}

\ifxptex@newrequiretex{uniuptex}{Unicode upTeX / Unicode e-upTeX / ApTeX}
\ifxptex@newrequiretex{unieuptex}{Unicode e-upTeX}

\ifxptex@newrequiretex{UniupTeX}{Unicode upTeX}
\ifxptex@newrequiretex{UnieupTeX}{Unicode e-upTeX}

\IFXPTEXDOTSTYRESTORECATCODE

\endinput