Hi,

I uploaded a new version. There have been no changes to the typesetting machinery although we're still in the process of finetuning some updated low level macros. There was a fix in the font machinery (thanks to Kai) but that will probably go unnoticed as the issue has been there for years.

Now, that doesn't mean that nothing has been changed. First of all there is a new data related mechanism. After Wolfgang had updated the definition files it became official. It was on the agenda for a while but finally a nice solution surfaced.

The new thing is luatables that obey grouping. Normally what you do at the lua end is kind of global, but there can be cases where you really want it to behave like tex: obeying \bgroup/\egroup, { } etc. The examples given below show that you can create them at the tex end and access them in tex as well as lua.

\starttext

\dorecurse {100} {
    \setdatavalue{#1}{#1}
}

\start \tttf \darkred \raggedright \dorecurse {100} {
    #1=\scratchcounter\getdatavalue{#1}\the\scratchcounter
} \par \stop \blank

\start \tttf \darkgreen \raggedright \dorecurse {100} {
    #1=\thedatavalue{#1}%
} \par \stop \blank

\bgroup \tttf
    \newluatable\testtable
    \setluatable\testtable{ foo = 123, bar = "456", oof = "rab" }
  % \inspectluatable\testtable
    \darkblue
    foo = \getfromluatable\testtable{foo}\par
    bar = \getfromluatable\testtable{bar}\par
    oof = \getfromluatable\testtable{oof}\blank
    \bgroup
        \useluatable\testtable
        \setluatable\testtable{ foo = 123123, bar = "456456" }
      % \inspectluatable\testtable
        \darkmagenta
        foo = \getfromluatable\testtable{foo}\par
        bar = \getfromluatable\testtable{bar}\par
        oof = \getfromluatable\testtable{oof}\blank
        \startluacode
            local t = context.luatables.get("testtable")
            print(t.foo,t.bar,t.oof)
        \stopluacode
    \egroup
    \darkyellow
    foo = \getfromluatable\testtable{foo}\par
    bar = \getfromluatable\testtable{bar}\par
    oof = \getfromluatable\testtable{oof}\blank
    \startluacode
        local t = context.luatables.get("testtable")
        print(t.foo,t.bar,t.oof)
    \stopluacode
  % \inspectluatable\testtable
\egroup

\bgroup \tttf
    \newluatable\moretable
    \setluatable\moretable{ 1, "foo" }
    \darkblue
    [1] = \getfromluatable\moretable{1}\par
    [2] = \idxfromluatable\moretable 2 \blank
    \bgroup
        \useluatable\moretable
        \setluatable\moretable{ foo = 123123, bar = "456456" }
        \darkmagenta
        [1] = \getfromluatable\moretable{1}\par
        [2] = \idxfromluatable\moretable 2 \blank
        \startluacode
            local t = context.luatables.get("moretable")
            print(t[1],t[2])
        \stopluacode
    \egroup
    \darkyellow
    [1] = \getfromluatable\moretable{1}\par
    [2] = \idxfromluatable\moretable 2 \blank
    \startluacode
        local t = context.luatables.get("moretable")
        print(t[1],t[2])
    \stopluacode
\egroup

\stoptext

This is only available in lmtx (until i see a real reason to cook up an alternative for mkiv, which is unlikely as no context code depends on this being available, at least not now). The datavalue macro you see there can be used to create massive amounts of numeric variable independent of counters, not that we really need it, but it was very cheap to implement.

At the engine level there also have been some changes but these should not be visible for users. We just mention:

- extensions to the macro definition and expansion mechanisms (for instance optional arguments, optional delimiters, and silent error recovery; there will be some explanation in the evenmore document and at some point - when stable - in the manual) .. this permits some cleaner low level code; only things were done that had no impact on performance (as macro definition and expansion is used a lot) and didn't make the code messy (it actually became cleaner)

- some additional substring (ok, tex has no string, just tokens) parsing capabilities with optional tokens, which again permits a bit cleaner low level code

- a slightly reorganized handling of tokens (one of tex's basic data structures) in the lua token interface so that we get a more meaningful and robust subsystem (basically getting rid of funny numbers) ... this also will be discussed in an evenmore chapter .. not that users need it (i think)

- as a side effect (or necessity) some low level recoding (and abstraction) had to happen but as far as we can see it works ok (i admit it was a slow, tedious job with lots of intermediate testing on the suite to make sure nothign was broken) .. in the end it was all doable because most of the preparation was already done over the last years

- in the process we got rid of a traditional tex data structure that was left over from the 32 bit times but no longer needed in our 64 bit luatex/luametatex universe (i might backport that simplification to luatex some day) ... it discards some checking and saves the same amount of memory that we had on the early day pc's (where we ran whole tex jobs in that amount)

Of course ... all kind of small improvenments ... hopefully for the best,

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to