Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id p03KCOpY001580 for ; Mon, 3 Jan 2011 21:12:26 +0100 Received: (qmail 21051 invoked by alias); 3 Jan 2011 20:12:19 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 03 Jan 2011 20:12:12 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx104) with SMTP; 03 Jan 2011 21:12:12 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p03K9l2s017432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Jan 2011 21:09:48 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p03ImIF4013754; Mon, 3 Jan 2011 21:09:32 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 818655 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 3 Jan 2011 21:09:32 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p03K9WgB021979 for ; Mon, 3 Jan 2011 21:09:32 +0100 Received: from anchor-post-2.mail.demon.net (anchor-post-2.mail.demon.net [195.173.77.133]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p03K9Hll031918 for ; Mon, 3 Jan 2011 21:09:21 +0100 Received: from cremornelane.demon.co.uk ([80.177.25.195] helo=palladium.local) by anchor-post-2.mail.demon.net with esmtp (Exim 4.69) id 1PZqiS-0002gH-m4; Mon, 03 Jan 2011 20:09:17 +0000 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 References: <4D20D031.7040803@gmx.de> <4D20F26B.2010606@morningstar2.co.uk> <4D21D59F.3060603@elvenkind.com> <4D21D87D.6080105@morningstar2.co.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4D222CEC.4040500@morningstar2.co.uk> Date: Mon, 3 Jan 2011 20:09:16 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: [luatex] l3luatex module To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4D21D87D.6080105@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p5mOUCHqrP9iL/6eeEA7/vGXc8Az2zQ5lkNsVrprUw5ljr293uKsrVdFBp1i k5eF2TKdovp4qtfEvYkwJlTyCJPnhg0xAPWnM7rhY/+LZUrte1UAr5224vU33NgWA8bmceIWcEOY UsgKg==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6515 On 03/01/2011 14:09, Joseph Wright wrote: > On 03/01/2011 13:56, Taco Hoekwater wrote: >> On 01/03/2011 02:39 PM, Philipp Stephani wrote: >>> >>> Reading the source code, I guess \directlua behaves identically to >>> \immediate\write, while \latelua corresponds to \write. If that is >>> true, then the naming convention of the \iow_… macros should be >>> applied. >> >> The correspondence is correct, but \directlua is expandable >> (\immediate\write is not). > > Thanks Taco (and Philipp). I will revisit the l3luatex stuff later today > and try to tighten both the expl3 function names and description up. (With apologies to those on the LuaTeX list who are not interested in LaTeX3 - I think I need some LuaTeX experts to check the following.) Okay, to save everyone needing to read the SVN feed, I've revised the documentation to: %\begin{function}{ % \lua_now:n / (EXP) | % \lua_now:x / (EXP) | %} % \begin{syntax} % \cs{lua_now:n} \Arg{token list} % \end{syntax} % The \meta{token list} is first tokenized by \TeX, which will include % converting line ends to spaces in the usual \TeX\ manner and which % respects currently-applicable \TeX\ category codes. The resulting % \meta{\Lua\ input} is passed to the \Lua\ interpreter for processing. % Each \cs{lua_now:n} block is treated by \Lua\ as a separate chunk. % The \Lua\ interpreter will execute the \meta{\Lua\ input} immediately, % and in an expandable manner. % \begin{texnote} % \cs{lua_now:x} is the \LuaTeX\ primitive \cs{directlua} renamed. % \end{texnote} %\end{function} % %\begin{function}{ % \lua_shipout:n | % \lua_shipout:x | %} % \begin{syntax} % \cs{lua_shipout:x} \Arg{token list} % \end{syntax} % The \meta{token list} is first tokenized by \TeX, which will include % converting line ends to spaces in the usual \TeX\ manner and which % respects currently-applicable \TeX\ category codes. The resulting % \meta{\Lua\ input} is passed to the \Lua\ interpreter when the % current page is finalised (\emph{i.e}.~at shipout). Each % \cs{lua_shipout:n} block is treated by Lua as a separate chunk. % The \Lua\ interpreter will execute the \meta{\Lua\ input} during the % page-building routine: no \TeX\ expansion of the \meta{\Lua\ input} % will occur at this stage. % \begin{texnote} % At a \TeX\ level, the \meta{\Lua\ input} is stored as a % `whatsit'. % \end{texnote} %\end{function} % %\begin{function}{ % \lua_shipout_x:n | % \lua_shipout_x:x | %} % \begin{syntax} % \cs{lua_shipout:n} \Arg{token list} % \end{syntax} % The \meta{token list} is first tokenized by \TeX, which will include % converting line ends to spaces in the usual \TeX\ manner and which % respects currently-applicable \TeX\ category codes. The resulting % \meta{\Lua\ input} is passed to the \Lua\ interpreter when the % current page is finalised (\emph{i.e}.~at shipout). Each % \cs{lua_shipout:n} block is treated by Lua as a separate chunk. % The \Lua\ interpreter will execute the \meta{\Lua\ input} during the % page-building routine: the \meta{\Lua\ input} is expanded during this % process in addition to any expansion when the argument was read. This % makes these functions suitable for including material finalised % during the page building process (such as the page number). % \begin{texnote} % \cs{lua_sjhipout_x:n} is the \LuaTeX\ primitive \cs{latelua} % named using the \LaTeX3 scheme. % % At a \TeX\ level, the \meta{\Lua\ input} is stored as a % `whatsit'. % \end{texnote} %\end{function} with the code block reading %\begin{macro}{\lua_now:n} %\begin{macro}{\lua_now:x} %\begin{macro}{\lua_shipout_x:n} %\begin{macro}{\lua_shipout_x:x} %\begin{macro}{\lua_shipout:n} %\begin{macro}{\lua_shipout:x} %\begin{macro}{\lua_wrong_engine:} % When \LuaTeX\ is in use, this is all a question of primitives with new % names. On the other hand, for \pdfTeX\ and \XeTeX\ the argument should % be removed from the input stream before issuing an error. This needs % to be expandable, so the same idea is used as for \texttt{V}-type % expansion, with an appropriately-named but undefined function. % \begin{macrocode} \luatex_if_engine:TF { \cs_new_eq:NN \lua_now:x \luatex_directlua:D \cs_new_eq:NN \lua_shipout_x:n \luatex_latelua:D } { \cs_new:Npn \lua_now:x #1 { \lua_wrong_engine: } \cs_new_protected:Npn \lua_shipout_x:n #1 { \lua_wrong_engine: } } \cs_new:Npn \lua_now:n #1 { \lua_now:x { \exp_not:n {#1} } } \cs_generate_variant:Nn \lua_shipout_x:n { x } \cs_new_protected:Npn \lua_shipout:n #1 { \lua_shipout_x:n { \exp_not:n {#1} } } \cs_generate_variant:Nn \lua_shipout:n { x } \group_begin: \char_make_letter:N\! \char_make_letter:N\ % \cs_gset:Npn\lua_wrong_engine:{% \LuaTeX engine not in use!% }% \group_end:% % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} %\end{macro} %\end{macro} %\end{macro} %\end{macro} This is modelled on the expl3 wrappers for \write, noting as Taco has pointed out that \directlua is expandable, but I take it that \latelua is not. Once this is sorted out correctly then I'll sort out a CTAN snapshot. -- Joseph Wright