[NTG-pdftex] TeX trie processing (\pattern loading) details visualisation

Taco Hoekwater taco at elvenkind.com
Mon Jul 11 17:11:52 CEST 2005


Hi,

Vaguely connected to the font reader visualisation I posted last
month, I have created a visualisation of the trie (\pattern)
processing source code in initex.

There are files here:

    http://tex.aanhet.net/temp/patreader.zip (12.825 bytes)
    http://tex.aanhet.net/temp/patreader.pdf (> 36 Megabytes)

Please fetch the zip file and attempt to generate a local
version yourself before downloading the PDF document :)

The process itself is a bit harder to comprehend than the font
reader, so some background knowledge is needed. It also helps
if you have the TeX pascal sources handy.

I should probably write a descriptive text in prose to go along
with the images, but I'm bored with this stuff. It took me much
longer than I had anticipated, because I kept running into
limitations of MP ;-(


Roughly, the execution order <-> pages mapping is as follows:

   pages      function          action

    1  -   8  new_patterns()    % \patterns for language 0
    9  -  23  new_patterns()    % \patterns for language 2
   24  -  26  new_patterns()    % \patterns for language 1
   27  -  29  init_trie()       % initialization of arrays
   30  -  41  init_trie()       % reshuffling languages 2 and 1
   42  -  42  init_trie()       % prepare for compression
   43  - 241  compress_trie()   % trie compression
  242  - 244  init_trie()       % prepare for packing
  245  - 717  first_fit()       % trie packing
  718  - 965  init_trie()       % finalizations for run-time

The various blue items are used runtime (i.e. during hyphenation),
the other arrays are only used in initex or only for statistics
reporting.

trie_hash is physically the same array as trie_ref, but it is
cleaner to show them separately.

The supplied perl script can in fact demonstrate the hyphenation of
words using TeX's algorithm, but if you want meaningful results you
have to feed it hyphen.tex instead of the three demonstration languages,
and in that case, you have to increase the two limits ($trie_size and
$trie_op_size). Check the top (and bottom) of the perl script for that.

Have fun,

Taco



More information about the ntg-pdftex mailing list