[luatex] Getting the extra primitives?

luigi scarso luigi.scarso at gmail.com
Wed Feb 17 11:03:22 CET 2010


On Wed, Feb 17, 2010 at 9:21 AM, Joseph Wright
<joseph.wright at morningstar2.co.uk> wrote:
>
>
Maybe this is not what you want,
but format generation and test file are ok.

%% jo.tex %%%%%
\catcode `\{ = 1 \relax
\catcode `\} = 2 \relax
\catcode `\# = 6 \relax
\catcode `\^ = 7 \relax
\catcode `\^^I = 10 \relax
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
\else
 \long\def\pdfstrcmp#1#2{%
   \directlua
     {%
       joseph = joseph or {}
       function joseph.strcmp(A,B)
        if A == B then
         tex.write("0")
       elseif A<  B then
         tex.write("-1")
       else
         tex.write("1")
       end
       end
       joseph.strcmp("\luaescapestring{#1}","\luaescapestring{#2}")%
     }%
 }
 \directlua
   {
     tex.enableprimitives('',tex.extraprimitives ())
     module("joseph",package.seeall)
     function strcmp(A, B)
       if A == B then
         tex.write("0")
       elseif A<  B then
         tex.write("-1")
       else
         tex.write("1")
       end
     end
   }
\fi
\dump
%%%%%%%%

%% jo1.tex
Hello
\pdfstrcmp{W}{Q}
\end


# luatex --ini jo.tex
# luatex --fmt=jo.fmt jo1.tex


-- 
luigi


More information about the luatex mailing list