[dev-context] kpse

Hans Hagen pragma at wxs.nl
Tue Mar 14 19:11:19 CET 2006


Hi,

Attached is a zip with ruby stuff. Not perfect, also not best organized 
but it shows some ideas.

compare

  kpsewhich texnansi.enc
  tmftools.rb texnansi-enc

the first alternative is a bit faster, the second can be faster when we 
use a serialized hash.

now, say (windows)

  set KPSEMETHOD=drb
  set KPSEPORT=7000

and run

  tmftools --serve

and next

  tmftools.rb texnansi-enc

since we now run kpse as a service, we have a pretty fast response.

One may wonder why we need such things ... but imagine (as part of a 
workflow):

texmfstart bin:xsltproc --output whatever.xml kpse:something.xsl 
whoknows.xml
texmfstart rlxtools --manipulate kpse:test.rlx whatever.rlg

we can now save calls to kpsewhich.

texmfstart already has many built in optimizations to limit the number 
of calls and kpsefast also has some caching.

Btw, the server serves multiple trees at the same time.

(I have to reshuffle the kpse classes/modules a bit.)

Other new features involve passing environment variables. In threaded 
scripts the problem is that the environment hash is shared. This means 
that one cannot easily do something

ENV['TEXMF']= = "..."
system("texexec ...")

in treads because each thread may have different assignments to TEXMF. 
For this purpose, texmfstart already had:

  --tree=/mytex/version-1

with setuptex.tmf is part of the minimal distributions and and is just a 
series of assignments. This file is put in the root of a tree.

(btw, this makes it easy to put several trees on the wiki and to select 
a version; it's juts a matter if adding the --tree switch)

# usage: texmfstart --tree=f:/minimal/tex ...
#
# this assumes that calling script sets TEXPATH without a trailing
# slash; %VARNAME% expands to the environment variable, $VARNAME
# is left untouched; we also assume that TEXOS is set.

TEXMFMAIN    = %TEXPATH%/texmf
TEXMFLOCAL   = %TEXPATH%/texmf-local
TEXMFFONTS   = %TEXPATH%/texmf-fonts
TEXMFEXTRA   = %TEXPATH%/texmf-extra
TEXMFPROJECT = %TEXPATH%/texmf-project
VARTEXMF     = %TMP%/texmf-var
HOMETEXMF    =

TEXMFOS      = %TEXPATH%/%TEXOS%
# OSFONTDIR  = %SYSTEMROOT%/fonts

TEXMFCNF     = %TEXPATH%/texmf{-local,}/web2c
TEXMF        = 
{$TEXMFOS,$TEXMFPROJECT,$TEXMFFONTS,$TEXMFLOCAL,$TEXMFEXTRA,!!$TEXMFMAIN}
TEXMFDBS     = $TEXMF

TEXFORMATS   = %TEXMFOS%/web2c/{$engine,}
MPMEMS       = %TEXFORMATS%
TEXPOOL      = %TEXFORMATS%
MPPOOL       = %TEXPOOL%

PATH         > %TEXMFOS%/bin
PATH         > %TEXMFLOCAL%/scripts/perl/context
PATH         > %TEXMFLOCAL%/scripts/ruby/context

EXAMPLEROOT  = %VARTEXMF%

TEXINPUTS    =
MPINPUTS     =
MFINPUTS     =

In addition to this file, one can also feed an extra file with the 
--environment option.

This means that one can leave most dirty details to texmfstart and keep 
scripts simple.


Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.zip
Type: application/zip
Size: 67869 bytes
Desc: not available
Url : http://www.ntg.nl/mailman/private/dev-context/attachments/20060314/0a7b527c/attachment-0001.zip 


More information about the dev-context mailing list