summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-14 17:44:48 +0000
committerKarl Berry <karl@freefriends.org>2015-06-14 17:44:48 +0000
commit12b5085cdf20c13b62a489187ab3144bb82319b7 (patch)
tree75f4fca661765838c5ce4df63895e7ffb4b10ceb
parente7c79a2788c21767e22c0e19e32a09d4240244b1 (diff)
ucharcat (13jun15)
git-svn-id: svn://tug.org/texlive/trunk@37529 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/ucharcat/README20
-rw-r--r--Master/texmf-dist/doc/latex/ucharcat/ucharcat.pdfbin0 -> 158387 bytes
-rw-r--r--Master/texmf-dist/source/latex/ucharcat/ucharcat.dtx173
-rw-r--r--Master/texmf-dist/source/latex/ucharcat/ucharcat.ins10
-rw-r--r--Master/texmf-dist/tex/latex/ucharcat/ucharcat.sty48
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-luatex.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/ucharcat.tlpsrc0
8 files changed, 253 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/ucharcat/README b/Master/texmf-dist/doc/latex/ucharcat/README
new file mode 100644
index 00000000000..58188e55690
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ucharcat/README
@@ -0,0 +1,20 @@
+ucharcat package
+
+Lua implementation of \Ucharcat, to match xetex's primitive.
+
+
+To extract the ucharcat.sty package:
+tex ucharcat.ins
+
+David Carlisle
+LPPL licenced (status: maintained)
+
+Master source:
+https://github.com/davidcarlisle/dpctex/tree/master/ucharcat
+
+
+Please report any issues at
+
+https://github.com/davidcarlisle/dpctex/issues
+
+
diff --git a/Master/texmf-dist/doc/latex/ucharcat/ucharcat.pdf b/Master/texmf-dist/doc/latex/ucharcat/ucharcat.pdf
new file mode 100644
index 00000000000..f34e47dee2a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ucharcat/ucharcat.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/ucharcat/ucharcat.dtx b/Master/texmf-dist/source/latex/ucharcat/ucharcat.dtx
new file mode 100644
index 00000000000..90727c6f8d7
--- /dev/null
+++ b/Master/texmf-dist/source/latex/ucharcat/ucharcat.dtx
@@ -0,0 +1,173 @@
+% \iffalse
+%% Source File: textcase.dtx
+%% Copyright 2015 David Carlisle
+%%
+%% This file may be distributed under the terms of the LPPL.
+%% See README for details.
+%
+%<*dtx>
+ \ProvidesFile{ucharcat.dtx}
+%</dtx>
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{ucharcat}
+%<driver> \ProvidesFile{ucharcat.drv}
+% \fi
+% \ProvidesFile{ucharcat.dtx}
+ [2015/05/20 v0.01 ucharcat for luaLaTeX (DPC)]
+%
+% \iffalse
+%<*driver>
+\documentclass{ltxdoc}
+\ifx\directlua\undefined\else
+\usepackage{ucharcat}
+\fi
+\begin{document}
+\DocInput{ucharcat.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \GetFileInfo{ucharcat.dtx}
+%
+% \title{The \textsf{ucharcat} Package\thanks{This file
+% has version number \fileversion, last
+% revised \filedate.
+% Please report any issues at https://github.com/davidcarlisle/dpctex/issues}}
+% \author{David Carlisle}
+% \maketitle
+%
+% \section{Introduction}
+%
+% The 2015 release of Xe\TeX\ introduced a new command |\Ucharcat|,
+% this is an extension of the |\Uchar| comand that has been available
+% in Xe\TeX\ and lua\TeX\ for some time. It takes a second integer
+% value, that specifies the category code of the token to be
+% produced. This allows character tokens to be constructed \emph{via
+% expansion}, which has many potential uses in producing expandable
+% case changing, numeric counter represntations, etc.
+%
+% |\Uchar 65 12| produces a catcode 12 |A| for example.
+%
+% This package provides a lua implementation of |\Ucharcat| for use
+% with luatex, it silently accepts Xe\TeX\ and does nothing in that
+% case if |\Ucharcat| is defined.
+%
+% The main difference between the lua implementation and the Xe\TeX\
+% primitive is that the lua implementation takes \emph{two} expansions
+% to produce the token.
+%
+%\begin{verbatim}
+% \edef\tmp{\Uchar 65 11 }
+%\end{verbatim}
+% is the same as |\def\tmp{A}| with both
+% systems but
+%
+%\begin{verbatim}
+% \expandafter\def\expandafter\tmp\expandafter{\Uchar 65 11 }
+%\end{verbatim}
+% the same as
+%\begin{verbatim}
+% \def\tmp{A}
+%\end{verbatim}
+% with Xe\TeX, but in lua\TeX\ it is
+% equivalent to
+%\begin{verbatim}
+% \def\tmp{\directlua{UcharcatLua() 65 11 }
+%\end{verbatim}
+%
+% \ifx\Ucharcat\undefined\else
+% \section{Examples}
+%
+% This section will be omitted if this document is not processed with
+% a suitable format.
+%
+% \begin{itemize}
+% \item |\Ucharcat 65 11|
+%
+% \Ucharcat 65 11\ is a capital A.
+%
+% \item |\Ucharcat 65 12|
+% \edef\tmpa{\Ucharcat 65 12}
+% \edef\tmpb{\string A}
+%
+% This is a catcode 12 A: \ifx\tmpa\tmpb yes\else no\fi.
+%
+% \item% |\Ucharcat 65 1| and |\Ucharcat 65 2|
+%
+% \Ucharcat 65 1 \large\bfseries Bold is grouped \Ucharcat 65 2
+% by catcode 1 and 2 A.
+% \end{itemize}
+%
+% \fi
+% \section{Implementation}
+%
+% Note that the current implementation uses |\directlua| and a
+% dedicated luatex catcode array. Hans hagen made some useful comments
+% and pointers to alternative implementation using |\lusfunction|
+% in the luatex list thread
+% \texttt{http://tug.org/pipermail/luatex/2015-May/005199.html}
+% For now keeping with the simpler initial approach as there
+% is no built in support for |\luafunction| in the \LaTeX\ format yet.
+% (No allocator macros or hook to save function definition in the
+% format)
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+% On classic \TeX{} or old Xe\TeX, stop.
+% \begin{macrocode}
+\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
+% \end{macrocode}
+%
+% If some package has defined an allocator for catcode tables
+% use it, othewise just use one (near) the top of the range (hex 7FFF).
+%
+% \begin{macrocode}
+\ifx\newcatcodetable\@undefined
+ \chardef\ucharcat@table"7000
+\else
+ \newcatcodetable\ucharcat@table
+\fi
+% \end{macrocode}
+%
+% Set up catcode table.
+% \begin{macrocode}
+\luatexinitcatcodetable\ucharcat@table
+% \end{macrocode}
+%
+% lua print function
+% \begin{macrocode}
+\directlua{%
+function UcharcatLua()
+ local mych = newtoken.scan_int()
+ local mycat = newtoken.scan_int()
+ tex.setcatcode(\the\numexpr\ucharcat@table\relax,mych,mycat)
+ tex.sprint(\the\numexpr\ucharcat@table\relax,unicode.utf8.char(mych))
+end
+}
+% \end{macrocode}
+%
+% \TeX\ wrapper.
+% \begin{macrocode}
+\def\Ucharcat{\directlua{UcharcatLua()}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \Finale
+%
diff --git a/Master/texmf-dist/source/latex/ucharcat/ucharcat.ins b/Master/texmf-dist/source/latex/ucharcat/ucharcat.ins
new file mode 100644
index 00000000000..d1660dd6144
--- /dev/null
+++ b/Master/texmf-dist/source/latex/ucharcat/ucharcat.ins
@@ -0,0 +1,10 @@
+\input docstrip
+\keepsilent
+\preamble
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{\file{ucharcat.sty}{\from{ucharcat.dtx}{package}}}
+
+\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/ucharcat/ucharcat.sty b/Master/texmf-dist/tex/latex/ucharcat/ucharcat.sty
new file mode 100644
index 00000000000..1bad5082f8f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ucharcat/ucharcat.sty
@@ -0,0 +1,48 @@
+%%
+%% 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/05/20 v0.01 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
+\else
+ \newcatcodetable\ucharcat@table
+\fi
+\luatexinitcatcodetable\ucharcat@table
+\directlua{%
+function UcharcatLua()
+ local mych = newtoken.scan_int()
+ local mycat = newtoken.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'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 490757c1a49..3f452fc7a3e 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -555,7 +555,7 @@ my @TLP_working = qw(
twoinone twoup
txfonts txfontsb txgreeks
type1cm typeface typehtml typeoutfileinfo typogrid
- uaclasses uadocs uafthesis ucharclasses ucbthesis ucdavisthesis ucs
+ uaclasses uadocs uafthesis ucharcat ucharclasses ucbthesis ucdavisthesis ucs
ucthesis udesoftec uebungsblatt uestcthesis uiucredborder uiucthesis
ukrhyph ulem ulqda ulthese
umich-thesis uml umlaute umoline
diff --git a/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc b/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
index 118a5807890..61935a5a6b1 100644
--- a/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
@@ -34,3 +34,4 @@ depend placeat
depend selnolig
depend showhyphens
depend spelling
+depend ucharcat
diff --git a/Master/tlpkg/tlpsrc/ucharcat.tlpsrc b/Master/tlpkg/tlpsrc/ucharcat.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/ucharcat.tlpsrc