[XeTeX] implementing a look up table

Michiel Kamermans pomax at nihongoresources.com
Sun Oct 18 14:16:48 CEST 2009


Hi all,

I'm playing with getting the newXeTeXintercharclass to work, which in 
itself seems reasonably simple, using the code from the mails concerning 
the topic last May in a package of its own:

\ProvidesPackage{newxetexintercharclass}
\RequirePackage{ifxetex}
\RequireXeTeX
\@ifundefined{newXeTeXintercharclass}{%
  \PackageWarning{uccalloc}{newXeTeXintercharclass was not previously 
defined. If you use packages that rely on intercharclasses, things may 
break by mixing old manual class assignment with class numbers served 
using the newXeTeXintercharclass request.}
  \newcount\xe at alloc@intercharclass % allocates intercharclass
  \xe at alloc@intercharclass=\thr@@ % from 4 (1,2 and 3 are used by CJK, 
AFAIK)
  \def\xe at alloc@#1#2#3#4#5{\global\advance#1\@ne
    \xe at ch@ck#1#4#2% make sure there's still room
    \allocationnumber#1%
    \global#3#5\allocationnumber
    \wlog{\string#5=\string#2\the\allocationnumber}}
  \def\xe at ch@ck#1#2#3{%
    \ifnum#1<#2\else
     \errmessage{No room for a new #3}%
    \fi}
  \def\newXeTeXintercharclass{%
    
\xe at alloc@\xe at alloc@intercharclass\XeTeXintercharclass\chardef\@cclv} 
%at most 254
}{%
\PackageWarning{uccalloc}{newXeTeXintercharclass already defined, not 
redeclaring.}}
\endinput

However, I'm not the best with plain TeX code, so I'm not sure: will 
this code "jump over" already assigned classes? If not, then my 
questions kind of stop - I can just record the first class number I get 
from newxtexintercharclass, as well as the last class number, and do 
nicely easy iteration over that number range. If it does, then things 
get more complicated - how does one build a lookup table so that 
iterating over classes is a matter of a \forloop again?

- Mike "Pomax" Kamermans
nihongoresources.com


More information about the XeTeX mailing list