diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx | 97 |
1 files changed, 93 insertions, 4 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 20c8535cf38..28a4eba5fa2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -36,10 +36,10 @@ %<*driver> \documentclass[full]{l3doc} %</driver> -%<*driver|package> -\GetIdInfo$Id: l3luatex.dtx 5983 2015-09-10 18:57:56Z joseph $ +%<*driver|package&tex> +\GetIdInfo$Id: l3luatex.dtx 6250 2015-11-11 13:45:38Z joseph $ {L3 Experimental LuaTeX-specific functions} -%</driver|package> +%</driver|package&tex> %<*driver> \begin{document} \DocInput{\jobname.dtx} @@ -77,6 +77,8 @@ % error: use \cs{sys_if_engine_luatex:T} to avoid this. Details of coding % the \LuaTeX{} engine are detailed in the \LuaTeX{} manual. % +% \subsection{\TeX{} code interfaces} +% % \begin{function}[EXP, added = 2015-06-29]{\lua_now_x:n, \lua_now:n} % \begin{syntax} % \cs{lua_now:n} \Arg{token list} @@ -142,6 +144,27 @@ % \end{texnote} % \end{function} % +% \subsection{Lua interfaces} +% +% As well as interfaces for \TeX{}, there are a small number of Lua functions +% provided here. Currently these are intended for internal use only. +% +% \begin{function}{l3kernel.strcmp} +% \begin{syntax} +% \cs{l3kernel.strcmp}|(|\meta{str one}, \meta{str two}|)| +% \end{syntax} +% Compares the two strings and returns |0| to \TeX{} +% if the two are identical. +% \end{function} +% +% \begin{function}{l3kernel.charcat} +% \begin{syntax} +% \cs{l3kernel.charcat}|(|\meta{charcode}, \meta{catcode}|)| +% \end{syntax} +% Constructs a character of \meta{charcode} and \meta{catcode} and returns +% the result to \TeX{}. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -152,7 +175,11 @@ %<*initex|package> % \end{macrocode} % -% \subsubsection{Breaking out to \Lua{}} +% \subsection{Breaking out to \Lua{}} +% +% \begin{macrocode} +%<*tex> +% \end{macrocode} % % \begin{macro}[EXP]{\lua_now_x:n, \lua_now:n} % \begin{macro}{\lua_shipout_x:n, \lua_shipout:n} @@ -206,6 +233,68 @@ % \end{macrocode} % % \begin{macrocode} +%</tex> +% \end{macrocode} +% +% \subsection{\Lua{} functions for internal use} +% +% \begin{macrocode} +%<*lua> +% \end{macrocode} +% +% \begin{macro}{l3kernel} +% Create a table for the kernel's own use. +% \begin{macrocode} +l3kernel = l3kernel or { } +% \end{macrocode} +% \end{macro} +% +% Various local copies of standard functions: naming convention is to retain +% the full text but replace all |.| by |_|. +% \begin{macrocode} +local tex_setcatcode = tex.setcatcode +local tex_sprint = tex.sprint +local tex_write = tex.write +local unicode_utf8_char = unicode.utf8.char +% \end{macrocode} +% +% \begin{macro}{l3kernel.strcmp} +% String comparison which gives the same results as \pdfTeX{}'s +% \tn{pdfstrcmp}, although the ordering should likely not be relied upon! +% \begin{macrocode} +local function strcmp(A, B) + if A == B then + tex_write("0") + elseif A < B then + tex_write("-1") + else + tex_write("1") + end +end +l3kernel.strcmp = strcmp +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{l3kernel.charcat} +% Creating arbitrary chars needs a category code table. As set up here, +% one may have been assigned earlier (see \pkg{l3bootstrap}) or a hard-coded +% one is used. The latter is intended for format mode and should be adjusted +% to match an eventual allocator. +% \begin{macrocode} +local charcat_table = l3kernel.charcat_table or 1 +local function charcat(charcode, catcode) + tex_setcatcode(charcat_table, charcode, catcode) + tex_sprint(charcat_table, unicode_utf8_char(charcode)) +end +l3kernel.charcat = charcat +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</lua> +% \end{macrocode} +% +% \begin{macrocode} %</initex|package> % \end{macrocode} % |