summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ucharcat/ucharcat.sty
blob: e9f4e81396f01d68db381ae7766aeb2ce59f559d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%%
%% This is file `ucharcat.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ucharcat.dtx  (with options: `package')
%% 
%% Source File: textcase.dtx
%% Copyright 2015 David Carlisle
%%
%% This file may be distributed under the terms of the LPPL.
%% See README for details.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ucharcat}
       [2015/11/19 v0.03 ucharcat for luaLaTeX  (DPC)]
\ifx\directlua\@undefined
\ifx\Ucharcat\@undefined
\ifx\XeTeXinterchartokenstate\@undefined
\PackageError{ucharcat}
{\string\Ucharcat\space may only be used with xetex and luatex}
{skipping package}
\else
\PackageError{ucharcat}
{\string\Ucharcat\space is defined in xetex releases from 2015 only}
{skipping package}
\fi
\fi
\expandafter\endinput
\fi
\ifx\newcatcodetable\@undefined
  \chardef\ucharcat@table"7000
  \directlua{tex.enableprimitives("",{"initcatcodetable"})}
  \initcatcodetable\ucharcat@table
\else
  \newcatcodetable\ucharcat@table
\fi
\directlua{%
local nt = newtoken or token
function UcharcatLua()
  local mych = nt.scan_int()
  local mycat = nt.scan_int()
  tex.setcatcode(\the\numexpr\ucharcat@table\relax,mych,mycat)
  tex.sprint(\the\numexpr\ucharcat@table\relax,unicode.utf8.char(mych))
end
}
\def\Ucharcat{\directlua{UcharcatLua()}}
\endinput
%%
%% End of file `ucharcat.sty'.