[luatex] LuaTeX as a Library
Hans Hagen
pragma at wxs.nl
Fri Feb 26 09:52:00 CET 2016
On 2/26/2016 2:13 AM, Robert Krug wrote:
> Greetings,
>
> Is there any interest in LuaTeX as a library callable from foreign (e.gg., C, Lisp,
> Python) languages? With a little bit of hacking, I have succeeded in building
> LuaTeX as a library and made a couple of very simple documents with Common
> Lisp.
>
> I have two sets of questions, and append to the end of this email a brief
> description of what I did.
>
> First, would you (the LuaTeX maintainers) be interested in some patch files? If so,
> in what form would you want them? I can quite understand if you say that this is
> not what you are interested in, or if you want to wait till 1.0 is released.
>
> Second, should I write up some notes on the wiki? Perhaps I should wait until 1.0
> is released? Or perhaps (given the crude state of my work) this would create more
> problems than it is worth.
>
> Robert
>
> ==========
>
> Finally, here is a brief description of what I did:
>
> (All this is on OS X 10.10.5)
>
> Edited source/texk/web2c/Makefile.in to make the call to g++ which creates the luatex
> executable verbose, grabbed the output, added:
> -dynamiclib -undefined suppress -flat_namespace
> and changed the output file to luatex.dylib
>
> For some reason create_hash was not being called. I created and renamed local
> copies of create_hash in those files from which it was being called. I do not
> undestand the need for this.
>
> Created a main_body_start --- everything before the call to main_control ---
> and main_body_end --- everything after the call to main_control.
>
> Made some messy hacks to main_control, and get_x_token and subsidiary functions
> to prevent the call to prompt_input in next_line from grabbing standard input. This
> was surely the "wrong way" to do this. Doing this correctly would (I imagine) be not
> too hard for someone who knew what they were doing. But then I don't really know
> what might be involved, so my judgement is probably not worth much.
If something like that happens, it's indeed after 1.0, when we can
consider more fundamental changes while staying as compatible as can be.
It also relates to going to tex and back from the lua end. Messing with
the main loop and getting tokens can have performance penalties that
need to be investigated very well (as luatex is already a bit slower
than we want it to be). But it doesn't hurt to experiment so keep going.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
More information about the luatex
mailing list