summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/interpreter
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-02 00:09:00 +0000
committerKarl Berry <karl@freefriends.org>2011-08-02 00:09:00 +0000
commit6189f60645741ffcb1b6e730325243882d7e5526 (patch)
tree62dfcc1190bd97244ece6865ae07c33d55d13e7f /Master/texmf-dist/tex/luatex/interpreter
parent8cb09a6490220c7e2df1022ea66743b9afa234be (diff)
new luatex package interpreter (9jul11)
git-svn-id: svn://tug.org/texlive/trunk@23308 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/interpreter')
-rw-r--r--Master/texmf-dist/tex/luatex/interpreter/interpreter.sty17
-rw-r--r--Master/texmf-dist/tex/luatex/interpreter/interpreter.tex36
2 files changed, 53 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/interpreter/interpreter.sty b/Master/texmf-dist/tex/luatex/interpreter/interpreter.sty
new file mode 100644
index 00000000000..9ffcad52f1c
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/interpreter/interpreter.sty
@@ -0,0 +1,17 @@
+% This is interpreter.sty, a style file to load
+% the Interpreter package in LaTeX. Useful information
+% can be found in interpreter-doc.pdf or interpreter-doc.txt.
+%
+% Author: Paul Isambert.
+% E-mail: zappathustra AT free DOT fr
+% Comments and suggestions are welcome.
+% Date: July 2011.
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{interpreter}[2011/08/07 v.1.0 Preprocessing input files on the fly.]
+% Needed to prevent LaTeX check input, which would call open_read_file and
+% thus remove Interpreter's main function (which is removed as soon as it is
+% used).
+\expandafter\let\expandafter\interpreterinput\csname @@input\endcsname
+\input interpreter.tex
+\endinput
diff --git a/Master/texmf-dist/tex/luatex/interpreter/interpreter.tex b/Master/texmf-dist/tex/luatex/interpreter/interpreter.tex
new file mode 100644
index 00000000000..634c1ef826f
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/interpreter/interpreter.tex
@@ -0,0 +1,36 @@
+% This is the main TeX file for the Interpreter package.
+% Further information in interpreter-doc.pdf or interpreter-doc.txt.
+%
+% Paul Isambert - zappathustra AT free DOT fr - July 2011
+\csname Oh no, I won't be loaded twice!\endcsname
+\expandafter\let\csname Oh no, I won't be loaded twice!\endcsname\endinput
+\directlua{require("interpreter.lua")}
+\def\interpretergobble#1{}
+\unless\ifdefined\interpreterinput
+ \let\interpreterinput\input
+\fi
+\def\interpretfile#1#2{%
+ \directlua{%
+ local f = kpse.find_file("i-#1.lua")
+ if f then
+ interpreter.reset()
+ dofile(f)
+ if not interpreter.register then
+ if luatexbase and luatexbase.add_to_callback then
+ function interpreter.register (f)
+ luatexbase.add_to_callback("open_read_file", f, "interpreter")
+ end
+ else
+ function interpreter.register (f)
+ callback.register("open_read_file", f)
+ end
+ end
+ end
+ interpreter.register(interpreter.read_file)
+ tex.print([[\noexpand\interpreterinput]])
+ else
+ tex.error("I can't find file `i-#1.lua'. I won't input file `#2'")
+ tex.print([[\noexpand\igobble]])
+ end
+ }{#2}%
+ }