diff options
Diffstat (limited to 'Master/texmf-dist/tex/plain/pitex/files.ptx')
-rw-r--r-- | Master/texmf-dist/tex/plain/pitex/files.ptx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/plain/pitex/files.ptx b/Master/texmf-dist/tex/plain/pitex/files.ptx new file mode 100644 index 00000000000..212b05fc076 --- /dev/null +++ b/Master/texmf-dist/tex/plain/pitex/files.ptx @@ -0,0 +1,39 @@ +\newread\ptx@temp_read +\def\iffile{% + \ifnext[ + {\ptx@iffile} + {\ptx@iffile[]}% + } +\def\ptx@iffile[#1]#2{% + \directlua{ + local f = kpse.find_file("\luaescapestring{#2}"\reverse\iffemptystring{#1}{, "#1"}) + local x = f and "firstoftwo" or "secondoftwo" + tex.print(\the\texcatcodes, "\noexpand\\" .. x) + }% + } +\long\def\ifffile{% + \ifnext[ + {\ptx@ifffile} + {\ptx@ifffile[]}% + } +\long\def\ptx@ifffile[#1]#2#3{% + \iffile[#1]{#2}{#3}{}% + } + +\long\def\inputfileor{% + \ifnext[ + {\ptx@inputfileor} + {\ptx@inputfileor[]}% + } +\long\def\ptx@inputfileor[#1]#2{% + \iffile[#1]{#2}{\input{#2}\relax}% + } + +\newwrite\ptx@auxfile +\def\ptx@write_toaux{% + \ifnext* + {\gobbleoneand{\write\ptx@auxfile}} + {\immediate\write\ptx@auxfile}% + } + +\let\writeout\ptx@write_toaux |