summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/blopentype/luatex/blot-files.ltm
blob: 212b05fc076b9b1e104e8c3c065f834cb6b0e590 (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
\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