diff options
-rw-r--r-- | Master/texmf-dist/doc/luatex/hyph-utf8/README | 59 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/hyph-utf8/luatex-hyphen.pdf | bin | 0 -> 393081 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/luatex/hyph-utf8/Makefile | 35 | ||||
-rw-r--r-- | Master/texmf-dist/source/luatex/hyph-utf8/luatex-hyphen.dtx | 836 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/hyph-utf8/etex.src | 928 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/hyph-utf8/hyphen.cfg | 426 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua | 77 |
7 files changed, 2361 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/luatex/hyph-utf8/README b/Master/texmf-dist/doc/luatex/hyph-utf8/README new file mode 100644 index 00000000000..0ef0959f81c --- /dev/null +++ b/Master/texmf-dist/doc/luatex/hyph-utf8/README @@ -0,0 +1,59 @@ + The luatex hyphenation package. + +This package aims at replacing the standard hyphen.cfg for LuaTeX. The main +difference is that the patterns are loaded at runtime and not in the format. +This leads to much shorter format loading time, with no loss as the +patterns are not really loaded in the format, just copied and then loaded +at runtime. + +This package is developped on <http://github.com/eroux/luatex-hyphen>. + +Installation +------------ + +Here are the recommended installation methods (preferred first). + +1. If you are using TeX Live 2010 or later, the files are already installed. + +2. a. Grab luatex-hyphen.tds.zip on the CTAN. + b. Unzip it at the root of one or your TDS trees. + c. Update some filename database after, and regenerate the formats for + LuaTeX. See your TeX distribution's manual for details. + +3. a. Grab the sources from CTAN or github. + b. Run 'make install TEXMFROOT=/path/to/texmf'. + c. See 2c. + +4. Try to figure it out by looking at the Makefile and comments in the sources. + +Manifest +-------- + +Source files: + luatex-hyphen.dtx single file source & doc + +Derived files: + luatex-hyphen.pdf documentation + hyphen.cfg pattern loading file + luatex-hyphen.lua lua code used by the package + + +License +------- + +This work is under the CC0 license, with an additional restriction: +the article 6 of the LaTeX Project Public License (lppl), that applies to code +that has been taken from LaTeX files. + +You can find the text of the lppl at + +The lppl can be found at http://www.latex-project.org/lppl.txt + +You can find the CC0 full text at + +http://creativecommons.org/publicdomain/zero/1.0/legalcode + +The file luatex-hyphen.dtx contains code with the lppl restriction as well as the +derived files + hyphen.cfg + luatex-hyphen.pdf diff --git a/Master/texmf-dist/doc/luatex/hyph-utf8/luatex-hyphen.pdf b/Master/texmf-dist/doc/luatex/hyph-utf8/luatex-hyphen.pdf Binary files differnew file mode 100644 index 00000000000..474174fbb6b --- /dev/null +++ b/Master/texmf-dist/doc/luatex/hyph-utf8/luatex-hyphen.pdf diff --git a/Master/texmf-dist/source/luatex/hyph-utf8/Makefile b/Master/texmf-dist/source/luatex/hyph-utf8/Makefile new file mode 100644 index 00000000000..2ae8bd67a1f --- /dev/null +++ b/Master/texmf-dist/source/luatex/hyph-utf8/Makefile @@ -0,0 +1,35 @@ +# Makefile for luatex-hyphen in tex-hyphen/hyph-utf8 + +NAME = luatex-hyphen +DTX = $(NAME).dtx + +# Generated files +COMPILED = $(NAME).pdf +UNPACKED = $(NAME).lua hyphen.cfg + +# Installation locations +RUNDIR = ../../../tex/luatex/hyph-utf8 +DOCDIR = ../../../doc/luatex/hyph-utf8 + +# Final files +RUNFILES = $(patsubst %, $(RUNDIR)/%, $(UNPACKED)) +DOCFILE = $(DOCDIR)/$(COMPILED) + +all: $(RUNFILES) $(DOCFILE) + +DO_TEX = tex --interaction=batchmode $< >/dev/null +DO_PDFLATEX = pdflatex --interaction=batchmode $< >/dev/null + +$(DOCFILE): $(DTX) + $(DO_PDFLATEX) + $(DO_PDFLATEX) + mv $(COMPILED) $(DOCDIR) + +$(RUNFILES): $(DTX) + $(DO_TEX) + for file in $(UNPACKED); do mv $$file $(RUNDIR); done + +clean: + @$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg + +.PHONY: clean diff --git a/Master/texmf-dist/source/luatex/hyph-utf8/luatex-hyphen.dtx b/Master/texmf-dist/source/luatex/hyph-utf8/luatex-hyphen.dtx new file mode 100644 index 00000000000..2eac29d4e5c --- /dev/null +++ b/Master/texmf-dist/source/luatex/hyph-utf8/luatex-hyphen.dtx @@ -0,0 +1,836 @@ +% \iffalse meta-comment +% +% This is a modified version of the hyphen.cfg file from the babel system, +% intended for use with LuaTeX, but compatible with other engines. +% The present file IS NOT part of the babel system. +% +% The modifications are Copyright 2010 Khaled Hosny, Elie Roux, and Manuel +% Pegourie-Gonnard, under LPPL version 1.3 or later. +% +% Here is the licence statement of the original hyphen.cfg file: +% | +% | Copyright 1989-2008 Johannes L. Braams and any individual authors +% | Listed elsewhere in this file. All rights reserved. +% | +% | It may be distributed and/or modified under the +% | Conditions of the LaTeX Project Public License, either version 1.3 +% | Of this license or (at your option) any later version. +% | The latest version of this license is in +% | http://www.latex-project.org/lppl.txt +% | And version 1.3 or later is part of all distributions of LaTeX +% | Version 2003/12/01 or later. +% | +% | This work has the LPPL maintenance status "maintained". +% | +% | The Current Maintainer of this work is Johannes Braams. +% | +% `---=(licence statement of original hyphen.cfg)=--- +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a modified version of the hyphen.cfg file from the babel system, +intended for use with LuaTeX, but compatible with other engines. +The present file IS NOT part of the babel system. + +The modifications are Copyright 2010 Khaled Hosny, Elie Roux, and Manuel +Pegourie-Gonnard, under LPPL version 1.3 or later. + +Here is the licence statement of the original hyphen.cfg file: + | + | Copyright 1989-2008 Johannes L. Braams and any individual authors + | Listed elsewhere in this file. All rights reserved. + | + | It may be distributed and/or modified under the + | Conditions of the LaTeX Project Public License, either version 1.3 + | Of this license or (at your option) any later version. + | The latest version of this license is in + | http://www.latex-project.org/lppl.txt + | And version 1.3 or later is part of all distributions of LaTeX + | Version 2003/12/01 or later. + | + | This work has the LPPL maintenance status "maintained". + | + | The Current Maintainer of this work is Johannes Braams. + | + `---=(licence statement of original hyphen.cfg)=--- + +\endpreamble + +\generate{% + \file{hyphen.cfg}{\from{luatex-hyphen.dtx}{hyphen}}% +} + +\def\MetaPrefix{-- } + +\def\luapostamble{% + \MetaPrefix^^J% + \MetaPrefix\space End of File `\outFileName'.% +} + +\def\currentpostamble{\luapostamble}% + +\preamble + +This is a generated file (source: luatex-hyphen.dtx). + +Copyright (C) 2010 by The LuaLaTeX development team. + +This work is under the CC0 license. + +\endpreamble + +\generate{% + \file{luatex-hyphen.lua}{\from{luatex-hyphen.dtx}{lua}}% +} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{luatex-hyphen.drv} + [2010/04/28 v1.3beta Hyphenation file for LuaTeX] +\documentclass{ltxdoc} +\usepackage[ascii]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\EnableCrossrefs +\CodelineIndex +\begin{document} + \DocInput{luatex-hyphen.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \GetFileInfo{luatex-hyphen.drv} +% +% \title{The \texttt{hyphen.cfg} file for Lua\TeX } +% \date{2010/04/28 v1.3beta} +% \author{Khaled Hosny, \'Elie Roux, and Manuel P\'egouri\'e-Gonnard\\ +% \texttt{khaledhosny@eglug.org} \\ +% \texttt{elie.roux@telecom-bretagne.eu} \\ +% \texttt{mpg@elzevir.fr}} +% +% \maketitle +% +% \begin{abstract} +% This is a modified version of the file \texttt{hyphen.cfg} distributed with +% the \textsf{babel} package, with a supporting Lua module, aimed at adapting +% \textsf{babel}'s hyphenation patterns loading mechanism to Lua\TeX's dynamic +% pattern loading capabilities. It makes use of a \texttt{language.dat.lua} +% file (whose format is described below) that should be present in the +% distribution, in addition to the regular \texttt{language.dat} file. +% +% There is a version of \texttt{etex.src} modified for the same reasons using +% similar code, which also makes use of the \texttt{luatex-hyphen.lua} and +% \texttt{language.dat.lua} files described here. +% \end{abstract} +% +% \section{Documentation} +% +% Hyphenation patterns should be loaded at runtime with Lua\TeX: if they appear +% in the format, they will be rehashed when the format is loaded anyway, which +% makes the format quite long to load (many seconds even on modern machines) +% and provides for bad user experience. Hence, it is desirable to load as few +% patterns as possible in the format, and load on-demand the needed patterns +% at runtime. +% +% This package provides a modified version of hyphen.cfg adapted to Lua\TeX, +% as well as a supporting Lua module. Since a lot of things, especially the +% catcodes, are not as predictable at runtime than at format creation time, we +% don't \verb+\input+ the usual pattern files, but rather load the patterns +% using the Lua interface, using a special plain text version of the pattern +% files if available. +% +% The existence and file name of such a version cannot be guessed, so we need +% a specific database: the file \texttt{language.dat.lua}. This file should be +% loadable by Lua and return a table whose keys are the canonical language +% names as found in \texttt{language.dat}, and the values are Lua tables +% consisting of: +% \begin{enumerate} +% \item A fixed part with two fields: +% \begin{quote} +% \verb+loader = <string> name of the TeX loader+\\ +% \verb+synonyms = { <string> alternative name, ...}+ +% \end{quote} +% Those field's values must be the same as in \texttt{language.dat}. The +% \verb+loader+ field is currently unused. +% \item A variable part consisting of either: +% \begin{itemize} +% \item For most languages: +% \begin{quote} +% \verb+patterns = <string> filename for patterns+\\ +% \verb+hyphenation = <string> filename for exceptions+\\ +% \verb+lefthyphenmin = <number> value for \letfhyphenmin+\\ +% \verb+righthyphenmin = <number> value for \letfhyphenmin+ +% \end{quote} +% The files given by \verb+patterns+ (resp. \verb+hypenation+) must be +% plain text files encoded in utf8, with only patterns (resp. +% exceptions) and not even comments: their content will be used +% directly without being parsed by \TeX. If one of these keys is +% missing or is the empty string, it is ignored and no patterns (resp. +% exceptions) are loaded for this language. The values of +% \texttt{*hyphenmin} are currently unused. +% \item Special case are supported by a field \verb+special+. Currently, +% the following kind of values are recognized: +% \begin{description} +% \item[\texttt{'null'}] for languages with no hyphenation patterns +% nor exceptions. (Note that this is equivalent to both +% \verb+hyphenation+ and \verb+patterns+ being \verb+nil+ or +% \verb+''+, but produces a more explicit message in the log.) +% \item[\texttt{'disabled:<reason>'}] allows to disable specific +% languages: when the user tries to load this language, an error +% will be issued, with the \verb+<reason>+. +% \item[\texttt{'language0'}] only \texttt{english} should use this +% type of special, to indicate it is normally dumped in the format +% as \verb+\language0+ (see below). +% \end{description} +% Special languages may have \texttt{*hyphenmin} information when it +% makes sense (mostly \verb+\language0+). +% \end{itemize} +% \end{enumerate} +% Languages that are mentioned in \texttt{language.dat} but not in +% \texttt{language.dat.lua} will be loaded in the format. So, if the +% \texttt{language.dat.lua} file is missing or incomplete, languages will just +% go back to the ``old'' behaviour, resulting in longer startup time, which +% seems less bad than complete breakage. +% +% For backward compatibility, Knuth's original patterns for US English are +% always loaded in the format, as \verb+\language0+.\footnote{It is assumed +% to be the first entry in \texttt{language.dat}.} +% +% The modified version of \texttt{hyphen.cfg} provided here checks for the +% engine, and should continue to work with any engine without any modified +% behaviour. However, it is recommended to install it in such a way that the +% original \verb+hyphen.cfg+ from \textsf{babel} is found first by any engine +% other than Lua\TeX. +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \subsection{luatex-hyphen.lua} +% +% \begin{macrocode} +%<*lua> +% \end{macrocode} +% +% Start a Lua module, importing only the necessary functions as locals. +% +% \begin{macrocode} +local error, dofile, pairs, ipairs = error, dofile, pairs, ipairs +local io, texio, lang, kpse = io, texio, lang, kpse +module('luatexhyphen') +% \end{macrocode} +% +% Two functions for error and information reporting. +% +% \begin{macrocode} +local function wlog(msg, ...) + texio.write_nl('log', 'luatex-hyphen: '..msg:format(...)) +end +local function err(msg, ...) + error('luatex-hyphen: '..msg:format(...), 2) +end +% \end{macrocode} +% +% Load the \texttt{language.dat.lua} file with the Lua version of the +% language database. +% +% \begin{macrocode} +local dbname = "language.dat.lua" +local language_dat +local dbfile = kpse.find_file(dbname) +if not dbfile then + err("file not found: "..dbname) +else + language_dat = dofile(dbfile) +end +% \end{macrocode} +% +% Look up a language in the database, and return the associated +% information, as well as the canonical name of the language. +% +% \begin{macrocode} +function lookupname(name) + if language_dat[name] then + return language_dat[name], name + else + for canon, data in pairs(language_dat) do + for _,syn in ipairs(data.synonyms) do + if syn == name then + return data, canon + end + end + end + end +end +% \end{macrocode} +% +% Set hyphenation patterns and exceptions for a language given by its name +% (in the database) and number (value of \verb+\language+). Doesn't return +% anything, but will call \verb+error()+ if things go wrong. +% +% \begin{macrocode} +function loadlanguage(lname, id) + local msg = "loading%s patterns and exceptions for: %s (\\language%d)" +% \end{macrocode} +% +% Lookup the language in the database. +% +% \begin{macrocode} + local ldata, cname = lookupname(lname) + if not ldata then + err("no entry in %s for this language: %s", dbname, lname) + end +% \end{macrocode} +% +% Handle special languages. +% +% \begin{macrocode} + if ldata.special then + if ldata.special == 'null' then + wlog(msg, ' (null)', cname, id) + return + elseif ldata.special:find('^disabled:') then + err("language disabled by %s: %s (%s)", dbname, cname, + ldata.special:gsub('^disabled:', '')) + elseif ldata.special == 'language0' then + err("\\language0 should be dumped in the format") + else + err("bad entry in %s for language %s") + end + end +% \end{macrocode} +% +% The generic case: load hyphenation patterns and exceptions from files +% given by the language code. +% +% \begin{macrocode} + wlog(msg, '', cname, id) + for _, item in ipairs{'hyphenation', 'patterns'} do + local file = ldata[item] + if file ~= nil and file ~= '' then + local file = kpse.find_file(file) or err("file not found: %s", file) + local fh = io.open(file, 'r') + local data = fh:read('*a') or err("file not readable: %s", f) + fh:close() + lang[item](lang.new(id), data) + end + end +end +% \end{macrocode} +% +% \begin{macrocode} +%</lua> +% \end{macrocode} +% +% \subsection{hyphen.cfg} +% +% \begin{macrocode} +%<*hyphen> +% \end{macrocode} +% +% Start with unmodified code from \textsf{babel}. +% +% \begin{macrocode} +\ifx\ProvidesFile\@undefined + \def\ProvidesFile#1[#2 #3 #4]{% + \wlog{File: #1 #4 #3 <#2>}% +% \end{macrocode} +% +% Use a modified banner for Lua\TeX. +% +% \begin{macrocode} + \ifx\directlua\@undefined + \toks8{Babel <#3> and hyphenation patterns for }% + \else + \toks8{LuaTeX adaptation of babel <#3> + and hyphenation patterns for }% + \fi +% \end{macrocode} +% +% \begin{macrocode} + \let\ProvidesFile\@undefined + } + \def\ProvidesLanguage#1[#2 #3 #4]{% + \wlog{Language: #1 #4 #3 <#2>}% + } +\else + \let\bbl@tempa\ProvidesFile + \def\ProvidesFile#1[#2 #3 #4]{% +% \end{macrocode} +% +% Same here. +% +% \begin{macrocode} + \ifx\directlua\@undefined + \toks8{Babel <#3> and hyphenation patterns for }% + \else + \toks8{LuaTeX adaptation of babel <#3> + and hyphenation patterns for }% + \fi +% \end{macrocode} +% +% \begin{macrocode} + \bbl@tempa#1[#2 #3 #4]% + \let\ProvidesFile\bbl@tempa} + \def\ProvidesLanguage#1{% + \begingroup + \catcode`\ 10 % + \@makeother\/% + \@ifnextchar[%] + {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}} + \def\@provideslanguage#1[#2]{% + \wlog{Language: #1 #2}% + \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}% + \endgroup} +\fi + +% \end{macrocode} +% +% File identification is modified again. +% +% \begin{macrocode} +\ProvidesFile{hyphen.cfg} + [2010/04/26 v3.8l-luatex-1.3beta % + Language switching mechanism for LuaTeX, adapted from babel v3.8l] +% \end{macrocode} +% +% \begin{macrocode} +\ifx\AtBeginDocument\@undefined + \input plain.def\relax +\fi +\ifx\language\@undefined + \csname newcount\endcsname\language +\fi +\ifx\newlanguage\@undefined + \csname newcount\endcsname\last@language +\else + \countdef\last@language=19 +\fi +\ifx\newlanguage\@undefined + \def\addlanguage#1{% + \global\advance\last@language \@ne + \ifnum\last@language<\@cclvi + \else + \errmessage{No room for a new \string\language!}% + \fi + \global\chardef#1\last@language + \wlog{\string#1 = \string\language\the\last@language}} +\else + \def\addlanguage{\alloc@9\language\chardef\@cclvi} +\fi +\def\adddialect#1#2{% + \global\chardef#1#2\relax + \wlog{\string#1 = a dialect from \string\language#2}} +\def\iflanguage#1{% + \expandafter\ifx\csname l@#1\endcsname\relax + \@nolanerr{#1}% + \else + \bbl@afterfi{\ifnum\csname l@#1\endcsname=\language + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}% + \fi} +\edef\selectlanguage{% + \noexpand\protect + \expandafter\noexpand\csname selectlanguage \endcsname + } +\ifx\@undefined\protect\let\protect\relax\fi +\ifx\documentclass\@undefined + \def\xstring{\string\string\string} +\else + \let\xstring\string +\fi +\xdef\bbl@language@stack{} +\def\bbl@push@language{% + \xdef\bbl@language@stack{\languagename+\bbl@language@stack}% + } +\def\bbl@pop@lang#1+#2-#3{% + \def\languagename{#1}\xdef#3{#2}% + } +\def\bbl@pop@language{% + \expandafter\bbl@pop@lang\bbl@language@stack-\bbl@language@stack + \expandafter\bbl@set@language\expandafter{\languagename}% + } +\expandafter\def\csname selectlanguage \endcsname#1{% + \bbl@push@language + \aftergroup\bbl@pop@language + \bbl@set@language{#1}} +\def\bbl@set@language#1{% + \edef\languagename{% + \ifnum\escapechar=\expandafter`\string#1\@empty + \else \string#1\@empty\fi}% + \select@language{\languagename}% + \if@filesw + \protected@write\@auxout{}{\string\select@language{\languagename}}% + \addtocontents{toc}{\xstring\select@language{\languagename}}% + \addtocontents{lof}{\xstring\select@language{\languagename}}% + \addtocontents{lot}{\xstring\select@language{\languagename}}% + \fi} +\def\select@language#1{% + \expandafter\ifx\csname l@#1\endcsname\relax + \@nolanerr{#1}% + \else + \expandafter\ifx\csname date#1\endcsname\relax + \@noopterr{#1}% + \else + \bbl@patterns{\languagename}% + \originalTeX + \expandafter\def\expandafter\originalTeX + \expandafter{\csname noextras#1\endcsname + \let\originalTeX\@empty}% + \languageshorthands{none}% + \babel@beginsave + \csname captions#1\endcsname + \csname date#1\endcsname + \csname extras#1\endcsname\relax + \babel@savevariable\lefthyphenmin + \babel@savevariable\righthyphenmin + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi + \fi + \fi} +\long\def\otherlanguage#1{% + \csname selectlanguage \endcsname{#1}% + \ignorespaces + } +\long\def\endotherlanguage{% + \originalTeX + \global\@ignoretrue\ignorespaces + } +\expandafter\def\csname otherlanguage*\endcsname#1{% + \foreign@language{#1}% + } +\expandafter\def\csname endotherlanguage*\endcsname{% + \csname noextras\languagename\endcsname + } +\def\foreignlanguage{\protect\csname foreignlanguage \endcsname} +\expandafter\def\csname foreignlanguage \endcsname#1#2{% + \begingroup + \originalTeX + \foreign@language{#1}% + #2% + \csname noextras#1\endcsname + \endgroup + } +\def\foreign@language#1{% + \def\languagename{#1}% + \expandafter\ifx\csname l@#1\endcsname\relax + \@nolanerr{#1}% + \else + \bbl@patterns{\languagename}% + \languageshorthands{none}% + \csname extras#1\endcsname + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi + \fi + } +\def\bbl@patterns#1{% + \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax + \csname l@#1\endcsname + \else + \csname l@#1:\f@encoding\endcsname + \fi\relax +% \end{macrocode} +% +% With Lua\TeX, load patterns and exceptions on the fly using functions +% from the supporting Lua module, unless of course they are already loaded +% for this language (identified by its number to avoid problems with +% synonyms). +% +% Also, since this code will be executed at runtime, be careful while +% testing if we're using Lua\TeX. +% +% \begin{macrocode} + \ifx\directlua\@undefined\else + \ifx\directlua\relax\else + \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else + \global\@namedef{lu@texhyphen@loaded@\the\language}{}% + \directlua{ + if not luatexhyphen then + dofile(assert(kpse.find_file("luatex-hyphen.lua"))) + end + luatexhyphen.loadlanguage("\luatexluaescapestring{#1}", + \the\language)}% + \fi + \fi + \fi +% \end{macrocode} +% +% \begin{macrocode} +} +\def\hyphenrules#1{% + \expandafter\ifx\csname l@#1\endcsname\@undefined + \@nolanerr{#1}% + \else + \bbl@patterns{#1}% + \languageshorthands{none}% + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi + \fi + } +\def\endhyphenrules{} +\def\providehyphenmins#1#2{% + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \@namedef{#1hyphenmins}{#2}% + \fi} +\def\set@hyphenmins#1#2{\lefthyphenmin#1\righthyphenmin#2} +\def\LdfInit{% + \chardef\atcatcode=\catcode`\@ + \catcode`\@=11\relax + \input babel.def\relax + \catcode`\@=\atcatcode \let\atcatcode\relax + \LdfInit} +\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi +\ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi +\ifx\PackageError\@undefined + \def\@nolanerr#1{% + \errhelp{Your command will be ignored, type <return> to proceed}% + \errmessage{You haven't defined the language #1\space yet}} + \def\@nopatterns#1{% + \message{No hyphenation patterns were loaded for}% + \message{the language `#1'}% + \message{I will use the patterns loaded for \string\language=0 + instead}} + \def\@noopterr#1{% + \errmessage{The option #1 was not specified in \string\usepackage} + \errhelp{You may continue, but expect unexpected results}} + \def\@activated#1{% + \wlog{Package babel Info: Making #1 an active character}} +\else + \newcommand*{\@nolanerr}[1]{% + \PackageError{babel}% + {You haven't defined the language #1\space yet}% + {Your command will be ignored, type <return> to proceed}} + \newcommand*{\@nopatterns}[1]{% + \PackageWarningNoLine{babel}% + {No hyphenation patterns were loaded for\MessageBreak + the language `#1'\MessageBreak + I will use the patterns loaded for \string\language=0 + instead}} + \newcommand*{\@noopterr}[1]{% + \PackageError{babel}% + {You haven't loaded the option #1\space yet}% + {You may proceed, but expect unexpected results}} + \newcommand*{\@activated}[1]{% + \PackageInfo{babel}{% + Making #1 an active character}} +\fi +\def\process@line#1#2 #3/{% + \ifx=#1 + \process@synonym#2 / + \else + \process@language#1#2 #3/% + \fi + } +\toks@{} +\def\process@synonym#1 /{% + \ifnum\last@language=\m@ne + \expandafter\chardef\csname l@#1\endcsname0\relax + \wlog{\string\l@#1=\string\language0} + \toks@\expandafter{\the\toks@ + \expandafter\let\csname #1hyphenmins\expandafter\endcsname + \csname\languagename hyphenmins\endcsname}% + \else + \expandafter\chardef\csname l@#1\endcsname\last@language + \wlog{\string\l@#1=\string\language\the\last@language} + \expandafter\let\csname #1hyphenmins\expandafter\endcsname + \csname\languagename hyphenmins\endcsname + \fi + } +\def\process@language#1 #2 #3/{% + \expandafter\addlanguage\csname l@#1\endcsname + \expandafter\language\csname l@#1\endcsname + \def\languagename{#1}% +% \end{macrocode} +% +% In the Lua\TeX case, we have to decide wether to load the language now. +% Remember our choice, since we'll need it two times more. +% +% If we choose to load the language now, mark it as loaded. This is done +% using \TeX\ macros in order to survive the format dumping-loading cycle, +% which would not be as straigthforward using Lua objects. +% +% \begin{macrocode} + \ifx\directlua\@undefined + \global\toks8\expandafter{\the\toks8#1, }% + \else + \directlua{ + if not luatexhyphen then + dofile(assert(kpse.find_file("luatex-hyphen.lua"))) + end + processnow = (tex.language == 0) or + (luatexhyphen.lookupname("\luatexluaescapestring{#1}") == nil)}% + \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax + \global\toks8\expandafter{\the\toks8#1, }% + \global\@namedef{lu@texhyphen@loaded@\the\language}{}% + \fi + \fi +% \end{macrocode} +% +% \begin{macrocode} + \begingroup + \bbl@get@enc#1:\@@@ + \ifx\bbl@hyph@enc\@empty + \else + \fontencoding{\bbl@hyph@enc}\selectfont + \fi + \lefthyphenmin\m@ne +% \end{macrocode} +% +% Conditionally input the patterns file. +% +% \begin{macrocode} + \ifx\directlua\@undefined + \input #2\relax + \else + \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax + \input #2\relax + \fi + \fi +% \end{macrocode} +% +% \begin{macrocode} + \ifnum\lefthyphenmin=\m@ne + \else + \expandafter\xdef\csname #1hyphenmins\endcsname{% + \the\lefthyphenmin\the\righthyphenmin}% + \fi + \endgroup + \ifnum\the\language=\z@ + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname + \fi + \the\toks@ + \fi + \toks@{}% + \def\bbl@tempa{#3}% + \ifx\bbl@tempa\@empty + \else + \ifx\bbl@tempa\space + \else +% \end{macrocode} +% +% Conditionnaly input the exceptions file. +% +% \begin{macrocode} + \ifx\directlua\@undefined + \input #3\relax + \else + \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax + \input #3\relax + \fi + \directlua{processnow = nil}% + \fi +% \end{macrocode} +% +% \begin{macrocode} + \fi + \fi + } +\def\bbl@get@enc#1:#2\@@@{% + \def\bbl@tempa{#1}% + \def\bbl@tempb{#2}% + \ifx\bbl@tempb\@empty + \let\bbl@hyph@enc\@empty + \else + \bbl@get@enc#2\@@@ + \edef\bbl@hyph@enc{\bbl@tempa}% + \fi} +\openin1 = language.dat +\ifeof1 + \message{I couldn't find the file language.dat,\space + I will try the file hyphen.tex} + \input hyphen.tex\relax +\else + \last@language\m@ne + \loop + \endlinechar\m@ne + \read1 to \bbl@line + \endlinechar`\^^M + \ifx\bbl@line\@empty + \else + \edef\bbl@line{\bbl@line\space/}% + \expandafter\process@line\bbl@line + \fi + \iftrue \csname fi\endcsname + \csname if\ifeof1 false\else true\fi\endcsname + \repeat + \language=0 +\fi +\closein1 +\let\process@language\@undefined +\let\process@synonym\@undefined +\let\process@line\@undefined +\let\bbl@tempa\@undefined +\let\bbl@tempb\@undefined +\let\bbl@eq@\@undefined +\let\bbl@line\@undefined +\let\bbl@get@enc\@undefined +\ifx\addto@hook\@undefined +\else + \expandafter\addto@hook\expandafter\everyjob\expandafter{% + \expandafter\typeout\expandafter{\the\toks8 loaded.}} +\fi +% \end{macrocode} +% +% \begin{macrocode} +%</hyphen> +% \end{macrocode} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/tex/luatex/hyph-utf8/etex.src b/Master/texmf-dist/tex/luatex/hyph-utf8/etex.src new file mode 100644 index 00000000000..343c56eff02 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/hyph-utf8/etex.src @@ -0,0 +1,928 @@ +%% e-TeX V2.1;0-luatex +%% Revision-date: 26-APR-2010 11:05:45 +%% Revision-history: (at-end) + +% The version number in the first line is compared with the corresponding +% element in e-TeX, and an error reported if incompatibility is detected. +% The cycle and revision numbers (that is, the element(s) following the +% period) are not used in this comparison, allowing enhancements to be made to +% this module and recorded in its header without introducing a risk of conflict. +% +% This allows to use this file with e-TeX versions 2.0 and 2.1! +% +% Other files whose headers must be kept in synch include "etexdefs.lib" and +% "language.def". + +% This is "etex.src", the (e-TeX) source file for the "etex" format file. +% To build the format from it, use one of the following commands or the +% local equivalent: + +% Generic: einitex *etex.src \dump +% emTeX: etex -i *etex.src \dump +% VMS: etex /init /noformat *"etex.src \dump" + +% Assume a purely IniTeX environment and set up a minimal \catcode r\'egime + +\catcode `\{=1 +\catcode `\}=2 +\catcode `\#=6 +\catcode `\^=7 +\catcode `\@=\catcode `\A + +% Define the basic error-reporting and abort mechanisms: + +\def \et@xmsg #1#2% + {\begingroup + \def \n {^^J}% + \def \ { }% + \newlinechar=\expandafter `\n + \if E#1% + \errorcontextlines=0 + \errmessage {e-TeX error: #2}% + \else + \message {\n ! e-TeX \if I#1 message% + \else \if W#1 warning% + \else \if F#1 fatal error% + \else + \ unknown (#1)% + \fi + \fi + \fi: #2% + }% + \fi + \endgroup + } + +% Note: a future version may report errors in the %<fac>-<s>-<code>[, <text>] +% format, allowing the more verbose <text>s to be read from file rather than +% stored in the format. + +\def \et@xabort #1% + {\et@xmsg {F}{#1}% + \batchmode + \end + } + +% Make sure this file is being read by e-TeX in extended mode; +% If it is, prepare to check version/revision compatibility, otherwise abort. + +\ifx \undefined \eTeXversion + \et@xabort {this file can be processed only in extended mode;\n + \ \ did you perhaps forget the asterisk?% + }% +\else + \begingroup + \catcode `\%=12 + \catcode `\?=14 + \xdef \et@xfilehdr + {\detokenize {%% e-TeX V}\the \eTeXversion \eTeXrevision}? + \xdef \et@xlibhdr + {\detokenize {%% e-TeXlib V}\the \eTeXversion \eTeXrevision}? + \endgroup +\fi + +% Assume extended mode, but no additional \catcodes/\defs yet; +% set up a simple e-TeX condition-reporting system: + +\def \et@xinf #1{\et@xmsg {I}{#1}} %%% not currently used +\def \et@xwarn #1{\et@xmsg {W}{#1}} +\def \et@xerr #1#2{{\errhelp={#2}\et@xmsg {E}{#1}}} + +% deactivate the processing of patterns and exceptions; these will be +% reinstated later, after the \uselanguage mechanism has been defined. + +\let \et@xpatterns=\patterns +\def \patterns + {\begingroup + \everyeof={\fi \endgroup}% + \message {[skipping from \noexpand \patterns to end-of-file...]}% + \iffalse + } + +% Read "plain.tex" (\patterns & \hyphenation will be skipped) + +\input plain + +% restore the catcode of commercial-at (@), which will just have been clobbered + +\catcode `\@=\catcode `\A + +% Assume an extended Plain environment (i.e. there are no longer any +% restrictions on the coding techniques we can use). First prepare to +% carry out consistency checks on the file headers and the current e-TeX +% version/revision levels: + +\newread \et@xinput + +\def \etexhdrchk #1#2% + {\openin \et@xinput=#2 + \ifeof \et@xinput + \chardef \etexstatus=0 % V1.0-1 + \else + \begingroup + \endlinechar=-1 + \readline \et@xinput to \et@xbuf + \closein \et@xinput + \def \p@rtition ##1.##2\endp@rtition {##1}% V2.1%0 + \xdef \et@xbuf + {\expandafter \p@rtition \et@xbuf .\endp@rtition}% V2.1;0 + \xdef \et@xtmp {\csname et@x#1hdr\endcsname}% + \xdef \et@xtmp + {\expandafter \p@rtition \et@xtmp .\endp@rtition}% V2.1;0 + \endgroup + \ifx \et@xtmp \et@xbuf + \chardef \etexstatus=2 % V1.1;4 + \else + \chardef \etexstatus=1 % V1.1;4 + \fi + \fi + } + +% Check the version number of this file: + +\def \et@xfmtsrc {etex.src} +\etexhdrchk {file} {\et@xfmtsrc} +\ifcase \etexstatus + \et@xerr {unable to open format source file "\et@xfmtsrc";} + {This should not happen; please ensure that your system + allows a file to be opened for reading more than once + concurrently.% + }% +\or + \et@xwarn {format source file "\et@xfmtsrc" has wrong header;\n + \ \ expected: "\et@xfilehdr"; found: "\et@xbuf";% + }% + {You are using a version of e-TeX which may be incompatible + with the source for the format file you are trying to + compile; please ensure that you have the most recent + version of each. I will proceed, but you should treat + the results with caution...% + }% +\fi + +% Module handling now implemented (V1.0-2) + +\def \module #1{\iftrue} +\let \endmodule=\fi + +\newtoks \et@xtoks + +\def \et@xl@@d #1 #2\endl@ad %%% the "#1 #2" code avoids trailing spaces + {\ifcsname module:#1\endcsname + \et@xwarn {duplicate module name "#1"}% + \else + \csname module:#1\endcsname %%% we exploit the side-effect explicitly + \et@xtoks=\expandafter + {\the \et@xtoks + \expandafter \let \csname module:#1\endcsname=\undefined + }% + \fi + } + +\def \et@xl@ad #1#2,#3\endl@ad %%% the #1#2 code avoids spurious leading spaces + {\et@xl@@d #1#2 \endl@ad + \if *#3* + \let \n@xt=\relax + \else + \def \n@xt {\et@xl@ad #3\endl@ad}% + \fi + \n@xt + } + +\def \et@xload #1 %%% needed because of the embedded \ifs... + {\def \module ##1% + {\unless + \ifcsname module:##1\endcsname + \message {Skipping module "##1";}% + \else + \message {Loading module "##1";}% + }% + \input #1 + \def \module ##1{\iftrue}% + } + +\def \load #1 from #2 %%% selective module loading from an e-TeX library file + {\etexhdrchk {lib} {#2}% + \ifcase \etexstatus + \et@xerr {unable to open library file "#2"; load aborted.} + {I got an <eof> on trying to open your library file; + please make sure it exists, is readable and is not locked.% + }% + \or + \et@xerr {library file "#2" has wrong header;\n + \ \ expected: "\et@xlibhdr"; found: "\et@xbuf";\n + \ \ load aborted.% + }% + {The first line of your library does not start with + the correct e-TeX header; you may need to update the + file to be compatible with the current version of + e-TeX, or you may simply have specified the wrong file.% + }% + \else + \et@xtoks={\et@xtoks={}}% + \et@xl@ad #1,\endl@ad + \et@xload {#2} + \the \et@xtoks + \fi + } + +\load interactionmodes from etexdefs.lib %%% \load <foo>[, <bar>...] from <baz> + +\def \@sk #1#2#3% + {\ifnum \interactionmode=\interactionmodes {errorstop} %%% V2.0;15 + \def \pr@mpt {\csname #1 \endcsname}% + \edef \pr@mptloop {{\escapechar=-1 \global \readline 16 to \pr@mpt}}% + \loop \pr@mptloop + \ch@ckforyn \pr@mpt {#2}% + \ifb@dresponse + \message {Please answer Y[es] or N[o]}% + \repeat + \else + \def \pr@mpt {#3}% + \ch@ckforyn \pr@mpt {#2}% + \fi + } + +\def \ch@ckforyn #1#2% Bernd Raichle's improved version, V1.0-1 + {\edef \@nswer {#1}% + \def \p@rse ##1##2\endp@rse + {\lowercase {\if y##1}\b@dresponsefalse \csname #2true\endcsname + \else \lowercase {\if n##1}\b@dresponsefalse \csname #2false\endcsname + \else + \b@dresponsetrue + \fi + \fi + }% + \expandafter \p@rse \@nswer \endp@rse + } + +\def \usef@llback %%% V1.0-3 + {\message {Using fallback mode (USenglish)}% + \addlanguage {USenglish}{hyphen}{}{2}{3}% + } + +% OK, that's all the utilities defined; on with the real work: +% First, re-instate \patterns: + +\let \patterns=\et@xpatterns + +% Define the language-handling commands + +\def \et@xlang {\csname newlanguage\endcsname} + +\def \uselanguage #1% + {\ifcsname lang@#1\endcsname + \language=\csname lang@#1\endcsname + \lefthyphenmin=\csname lhm@#1\endcsname + \righthyphenmin=\csname rhm@#1\endcsname + \ifdefined\directlua % V2.1;0-luatex + \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else + \global\expandafter\def\csname + lu@texhyphen@loaded@\the\language\endcsname{}% + \directlua{ + if not status.ini_version then + if not luatexhyphen then + dofile(assert(kpse.find_file("luatex-hyphen.lua"))) + end + luatexhyphen.loadlanguage("\luatexluaescapestring{#1}", + \the\language) + end}% + \fi + \fi + \ifdefined \uselanguage@hook % V1.0-1 + \uselanguage@hook {#1}% % V1.0-1 + \fi + \else + \et@xerr {language #1 undefined.}% + {You are trying to use a language which has not previously + been defined; remember that any language you want to use + will need to have been specified at the time the format + was created.% + }% + \fi + } + +\def \addlanguage #1#2#3#4#5% language patterns exceptions lhm rhm + {\expandafter \et@xlang \csname lang@#1\endcsname + \expandafter \chardef \csname lhm@#1\endcsname=#4 % V1.0-1 + \expandafter \chardef \csname rhm@#1\endcsname=#5 % V1.0-1 + \ifdefined\directlua % V2.1;0-luatex + \csname fi\endcsname + \csname if\directlua{% do we want to skip this language now? + if not luatexhyphen then + dofile(assert(kpse.find_file("luatex-hyphen.lua"))) + end + if (luatexhyphen.lookupname("\luatexluaescapestring{#1}") == nil) + or (\number\csname lang@#1\endcsname == 0) then + tex.sprint("false") % no, load it (execute 'else' part) + else + tex.sprint("true") % yes, skip + end}\endcsname + \else + \uselanguage {#1}% + \input #2 + \if *#3*\else \input #3 \fi + \edef \fmtversion {\fmtversion/#1}% + \fi + \ifdefined \addlanguage@hook % V1.0-4 + \addlanguage@hook {#1}% % V1.0-4 + \fi + } + +% Decrement \count 19, because \newlanguage will increment it again + +\advance \count 19 by -1 + +% We are about to try to process a user/site-specific file "language.def", +% which establishes a Babel-like language selection environment. Since +% there is always a risk of a spurious file of that name being found, +% we look for an e-TeX header in the first line. If the file can be opened, +% but doesn't have the right header, we interrogate the user as to whether +% to use fallback mode; in this mode, we simply establish USenglish as the +% sole language, with the et@x patterns, exceptions and left- and right- +% hyphen minima for TeX. If we can't interrogate the user (e.g. not in +% \errorstopmode), or if the user elects not to use fallback, we abort; +% if the file can't be found/opened, we use fallback unconditionally. + +\newif \ifb@dresponse +\newif \ifusef@llback + +\def \l@ngdefnfile {language.def} + +\etexhdrchk {file} {\l@ngdefnfile} +\ifcase \etexstatus + \et@xwarn {unable to open file "\l@ngdefnfile";}% + \usef@llback % unable to open "language.def" +\or + \et@xwarn {file "\l@ngdefnfile" has wrong header;\n + \ \ expected: "\et@xfilehdr"; found: "\et@xbuf";% + }% + \@sk {Use fallback?} {usef@llback} {y}% + \ifusef@llback + \usef@llback + \else + \input \l@ngdefnfile % use "language.def" after warning + \fi +\else + \input \l@ngdefnfile % "language.def" open & valid +\fi + +% All that was just to set up natural language handling... +% The "real" work of "etex.src", however, is to augment the non-primitives +% of Plain.TeX to incorporate e-TeX specific features, and to add new +% non-primitives to simplify access to new e-TeX specific primitives. + +\message {Augmenting the Plain TeX definitions:} +\message {\string \tracingall;} + +\def \tracingall + {\tracingonline=\@ne + \tracingcommands=\thr@@ % plain.tex has \tw@ + \tracingstats=\tw@ + \tracingpages=\@ne + \tracingoutput=\@ne + \tracinglostchars=\tw@ % plain.tex has \@ne + \tracingmacros=\tw@ + \tracingparagraphs=\@ne + \tracingrestores=\@ne + \showboxbreadth=\maxdimen + \showboxdepth=\maxdimen + \errorstopmode + \tracinggroups=\@ne + \tracingifs=\@ne + \tracingscantokens=\@ne + \tracingnesting=\@ne + \tracingassigns=\tw@ + } + +\message {Adding new e-TeX definitions:} + +\message {\string \eTeX,} +\def \eTeX {$\varepsilon$-\TeX} %%% the simple version, not suitable for maths; + %%% a more sophisticated one may find its way + %%% into "etexdefs.lib" in due course. + +\message {\string \loggingall,} +\def \loggingall {\tracingall \tracingonline=\z@} + +\message {\string \tracingnone,} +\def \tracingnone + {\tracingassigns=\z@ + \tracingnesting=\z@ + \tracingscantokens=\z@ + \tracingifs=\z@ + \tracinggroups=\z@ + \showboxdepth=\thr@@ + \showboxbreadth=5 + \tracingrestores=\z@ + \tracingparagraphs=\z@ + \tracingmacros=\z@ + \tracinglostchars=\@ne + \tracingoutput=\z@ + \tracingpages=\z@ + \tracingstats=\z@ + \tracingcommands=\z@ + \tracingonline=\z@ + } + +\message {register allocation;} + +\newcount \et@xins % our insertion counter (\insc@unt is used differently) + +% We have to adjust the Plain TeX register allocation counts for our +% slightly modified book-keeping: + +\advance \count 10 by 1 % \count 10=23 % allocates \count registers 23, 24, ... +\advance \count 11 by 1 % \count 11=10 % allocates \dimen registers 10, 11, ... +\advance \count 12 by 1 % \count 12=10 % allocates \skip registers 10, 11, ... +\advance \count 13 by 1 % \count 13=10 % allocates \muskip registers 10, 11, ... +\advance \count 14 by 1 % \count 14=10 % allocates \box registers 10, 11, ... +\advance \count 15 by 1 % \count 15=10 % allocates \toks registers 10, 11, ... +\advance \count 16 by 1 % \count 16=0 % allocates input streams 0, 1, ... +\advance \count 17 by 1 % \count 17=0 % allocates output streams 0, 1, ... +\advance \count 18 by 1 % \count 18=4 % allocates math families 4, 5, ... +\advance \count 19 by 1 % \count 19=0 % allocates \language codes 0, 1, ... + +\et@xins=\insc@unt % \et@xins=255 % allocates insertions 254, 253, ... + +% We don't change the Plain TeX definitions of \newcount, etc., but the +% \alloc@ macro doing the actual work is redefined. + +% When the normal register pool for \count, \dimen, \skip, \muskip, +% \box, or \toks registers is exhausted, we switch to the extended pool. + +\def \alloc@ #1#2#3#4#5% + {\ifnum \count 1#1 < #4% make sure there's still room + \allocationnumber=\count 1#1 + \global \advance \count 1#1 by \@ne + \global #3#5=\allocationnumber + \wlog {\string #5=\string #2\the \allocationnumber}% + \else \ifnum #1 < 6 + \begingroup \escapechar=\m@ne + \expandafter \alloc@@ \expandafter {\string #2}#5% + \else + \errmessage {No room for a new #2}% + \fi + \fi + } + +% The \expandafter construction used here allows the generation of +% \newcount and \globcount from #1=count. Moreover (and more important) +% this construction avoids the appearance of \outer macros inside +% macro definitions or conditionals. + +\def \alloc@@ #1#2% + {\endgroup % restore \escapechar + \message {Normal \csname#1\endcsname register pool exhausted, + switching to extended pool.}% + \global \expandafter + \let \csname new#1\expandafter \endcsname \csname glob#1\endcsname + \csname new#1\endcsname#2% + } + +% We do change the Plain TeX definition of \newinsert + +\outer \def \newinsert #1%make sure there's still room for ... + {\ch@ck 0 \et@xins \count % ... a \count, ... + {\ch@ck 1 \et@xins \dimen % ... \dimen, ... + {\ch@ck 2 \et@xins \skip % ... \skip, ... + {\ch@ck 4 \et@xins \box % ... and \box register + {\global \advance \et@xins by \m@ne + \unless + \ifnum \insc@unt < \et@xins + \global \insc@unt=\et@xins + \fi + \allocationnumber=\et@xins + \global \chardef #1=\allocationnumber + \wlog {\string #1=\string \insert \the \allocationnumber}% + }% + }% + }% + }% + } + +\def \ch@ck #1#2#3#4% + {\ifnum \count 1#1 < #2#4\else \errmessage {No room for a new #3}\fi} + +% And we define \reserveinserts, so that you can say \reserveinserts{17} +% in order to reserve room for up to 17 additional insertion classes that will +% not be taken away by \newcount, \newdimen, \newskip, or \newbox. + +\outer \def \reserveinserts#1% + {\global \insc@unt=\numexpr \et@xins \ifnum #1 > \z@ -#1\fi \relax} + +\message {extended register allocation;} + +% Now, we define \globcount, \globbox, etc., so that you can say +% \globcount\foo and \foo will be defined (with \countdef) to be the +% next count register from the vastly larger but somewhat less efficient +% extended register pool. We also define \loccount, etc., but these +% register definitions are local to the current group. + +\count 260=277 % globally allocates \count registers 277, 278, ... +\count 261=\@cclvi % globally allocates \dimen registers 256, 257, ... +\count 262=\@cclvi % globally allocates \skip registers 256, 257, ... +\count 263=\@cclvi % globally allocates \muskip registers 256, 257, ... +\count 264=\@cclvi % globally allocates \box registers 256, 257, ... +\count 265=\@cclvi % globally allocates \toks registers 256, 257, ... +\count 266=\@ne % globally allocates \marks classes 1, 2, ... + +\def \et@xmaxregs {32768} + +\count 270=\et@xmaxregs % locally allocates \count registers 32767, 32766, ... +\count 271=\et@xmaxregs % ditto for \dimen registers +\count 272=\et@xmaxregs % ditto for \skip registers +\count 273=\et@xmaxregs % ditto for \muskip registers +\count 274=\et@xmaxregs % ditto for \box registers +\count 275=\et@xmaxregs % ditto for \toks registers +\count 276=\et@xmaxregs % ditto for \marks classes + +% \count registers 256-259 and 267-269 are not (yet) used + +\outer \def \globcount {\et@xglob 0 \count \countdef} + \def \loccount {\et@xloc 0 \count \countdef} +\outer \def \globdimen {\et@xglob 1 \dimen \dimendef} + \def \locdimen {\et@xloc 1 \dimen \dimendef} +\outer \def \globskip {\et@xglob 2 \skip \skipdef} + \def \locskip {\et@xloc 2 \skip \skipdef} +\outer \def \globmuskip {\et@xglob 3 \muskip \muskipdef} + \def \locmuskip {\et@xloc 3 \muskip \muskipdef} +\outer \def \globbox {\et@xglob 4 \box \mathchardef} + \def \locbox {\et@xloc 4 \box \mathchardef} +\outer \def \globtoks {\et@xglob 5 \toks \toksdef} + \def \loctoks {\et@xloc 5 \toks \toksdef} +\outer \def \globmarks {\et@xglob 6 \marks \mathchardef} + \def \locmarks {\et@xloc 6 \marks \mathchardef} + +\let\newmark=\globmarks %%% 2.0;14 +\let\newmarks=\globmarks + +\def \et@xglob #1#2#3#4% + {\et@xchk #1#2% make sure there's still room + {\allocationnumber=\count 26#1 + \global \advance \count 26#1 by \@ne + \global #3#4=\allocationnumber + \wlog {\string #4=\string #2\the \allocationnumber}% + }% + } + +\def \et@xloc#1#2#3#4% + {\et@xchk #1#2% make sure there's still room + {\advance \count 27#1 by \m@ne + \allocationnumber=\count 27#1 + #3#4=\allocationnumber + \wlog {\string #4=\string #2\the \allocationnumber \space (local)}% + }% + } + +\def \et@xchk #1#2#3% + {\ifnum \count 26#1 < \count 27#1 + #3% + \else + \errmessage {No room for a new #2}% + \fi + } + +% Next we define \globcountblk, \loccountblk, etc., so that one can +% write \globcountblk\foo{17} and \foo will be defined (with \mathchardef) +% as the first (the zeroth?) of a block of 17 consecutive registers. +% Thus the user is intended to reference elements <\foo+0> to <\foo+n-1>, +% where n is the length of the block allocated. + +\outer \def \globcountblk {\et@xgblk 0 \count} + \def \loccountblk {\et@xlblk 0 \count} +\outer \def \globdimenblk {\et@xgblk 1 \dimen} + \def \locdimenblk {\et@xlblk 1 \dimen} +\outer \def \globskipblk {\et@xgblk 2 \skip} + \def \locskipblk {\et@xlblk 2 \skip} +\outer \def \globmuskipblk {\et@xgblk 3 \muskip} + \def \locmuskipblk {\et@xlblk 3 \muskip} +\outer \def \globboxblk {\et@xgblk 4 \box} + \def \locboxblk {\et@xlblk 4 \box} +\outer \def \globtoksblk {\et@xgblk 5 \toks} + \def \loctoksblk {\et@xlblk 5 \toks} +\outer \def \globmarksblk {\et@xgblk 6 \marks} + \def \locmarksblk {\et@xlblk 6 \marks} + +% And, both to provide a higher-level interface to the block allocation +% scheme, and to demonstrate possible applications of the new \...expr +% primitives, we also define \globcountvector and \loccountvector (etc) +% which allow the user to access elements with embedded arithmetic, as in + +% \globcountvector \foo {12} +% \foo {\count 0 + 3} = \foo {\count 1 * 2} + +\outer \def \globcountvector {\et@xgvec 0 \count} + \def \loccountvector {\et@xlvec 0 \count} +\outer \def \globdimenvector {\et@xgvec 1 \dimen} + \def \locdimenvector {\et@xlvec 1 \dimen} +\outer \def \globskipvector {\et@xgvec 2 \skip} + \def \locskipvector {\et@xlvec 2 \skip} +\outer \def \globmuskipvector {\et@xgvec 3 \muskip} + \def \locmuskipvector {\et@xlvec 3 \muskip} +\outer \def \globboxvector {\et@xgvec 4 \box} + \def \locboxvector {\et@xlvec 4 \box} +\outer \def \globtoksvector {\et@xgvec 5 \toks} + \def \loctoksvector {\et@xlvec 5 \toks} +\outer \def \globmarksvector {\et@xgvec 6 \marks} + \def \locmarksvector {\et@xlvec 6 \marks} + +\def \et@xgblk #1#2#3#4% + {\et@xchkblk #1#2{#4}% make sure there's still room + {\allocationnumber=\count 26#1 + \global \advance \count 26#1 by #4% + \global \mathchardef #3=\allocationnumber + \wlog {\string #3=\string #2blk{\number #4} at \the \allocationnumber}% + }% + } + +\def \et@xlblk #1#2#3#4% + {\et@xchkblk #1#2{#4}% make sure there's still room + {\advance \count 27#1 by -#4% + \allocationnumber=\count 27#1 + \mathchardef #3=\allocationnumber + \wlog {\string #3=\string #2blk{\number #4} + at \the \allocationnumber \space (local)% + }% + }% + } + +\begingroup +\catcode `\# = 12 +\gdef \et@xhash {#} +\endgroup + +\def \et@xgvec #1#2#3#4% + {\et@xchkblk #1#2{#4}% make sure there's still room + {\allocationnumber=\count 26#1 + \global \advance \count 26#1 by #4% + \ifx #2\box + \def \2{}% + \else \ifx #2\marks + \def \2{}% + \else + \def \2{\string #2}% + \fi + \fi + \xdef #3##1{\2 \noexpand \numexpr \the \allocationnumber+##1\relax}% + \wlog {\string #3 {\et@xhash 1} = + \2 {\the \allocationnumber+\et@xhash 1} (global #2 vector)% + }% + }% + } + +\def \et@xlvec #1#2#3#4% + {\et@xchkblk #1#2{#4}% make sure there's still room + {\advance \count 27#1 by -#4% + \allocationnumber=\count27#1 + \mathchardef #3=\allocationnumber + \ifx #2\box + \def \2{}% + \else \ifx #2\marks + \def \2{}% + \else + \def \2{\string #2}% + \fi + \fi + \edef #3##1{\2 \noexpand \numexpr \the \allocationnumber+##1\relax}% + \wlog {\string #3 {\et@xhash 1} = + \2 {\the \allocationnumber+\et@xhash 1} (local #2 vector)% + }% + }% + } + +\def \et@xchkblk #1#2#3#4% + {\ifnum #3 < \z@ + \errmessage {Negative register block size \number #3}% + \else \ifnum \numexpr \count 26#1+#3 > \count 27#1 + \errmessage {No room for new #2block of size \number#3}% + \else + #4% + \fi + \fi + } + +% In an attempt to reduce the overheads of e-TeX, we recycle all possible +% resources, including (as a penultimate step) the recycler itself... +% The user can circumvent (or force) this during format creation, +% by \letting \ifrecycle=\iffalse (or \iftrue, to force it). + +% As this file has grown by accretion, it is possible that we are no +% longer recycling all the resources we could; this will be investigated. + +\def \mayber@cycle {\expandafter \ifrecycle} +\def \forcer@cycle {\expandafter \iftrue} + +\ifdefined \ifrecycle + \mayber@cycle +\else + \forcer@cycle +\fi + +% There's a concealed \if... lurking here, which explains the +% strange indentation of the code that follows (V1.0-1) + + \def \r@cycle #1% + {\ifdefined #1 + \message {\string #1,}\let #1=\und@fined + \else + \message {\string #1 (not defined),} + \fi + } + {\newlinechar=`\! \message {!Recycling:}} + + \r@cycle \addlanguage + \r@cycle \@nswer + \r@cycle \@sk + \r@cycle \b@dresponsetrue + \r@cycle \b@dresponsefalse + \r@cycle \ch@ckforyn + \r@cycle \mayber@cycle + \r@cycle \et@xabort + \r@cycle \et@xbuf + \r@cycle \et@xfmtsrc + \r@cycle \et@xfilehdr + \r@cycle \et@xinf + \r@cycle \et@xpatterns +% \r@cycle \ifb@dresponse +% \r@cycle \ifusef@llback + \r@cycle \l@ngdefnfile + \r@cycle \n@xt + \r@cycle \p@rse + \r@cycle \pr@mpt + \r@cycle \pr@mptloop + \r@cycle \forcer@cycle + \r@cycle \usef@llback + \r@cycle \usef@llbacktrue + \r@cycle \usef@llbackfalse + +% The following are retained, since they may be needed by user code; with a few +% (regrettable) exceptions, all of these are given the \etex or \et@x prefix, +% to reduce as far as possible the risk of them clashing with other used-defined +% names. + +% The e-TeX team are willing to change the names of the remaining, at-risk, +% control sequences if it is demonstrated that the current names cause problems +% or difficulties. + + \def \r@tain #1% + {\ifdefined #1 + \message {\string #1,} + \else + \message {\string #1 (not defined),} + \fi + } + {\newlinechar=`\! \message {!Retaining:}} + + \r@tain \et@xerr + \r@tain \et@xinput + \r@tain \et@xlibhdr + \r@tain \et@xmsg + \r@tain \et@xtoks + \r@tain \et@xwarn + \r@tain \et@xl@@d + \r@tain \et@xl@ad + \r@tain \et@xload + \r@tain \et@xlang + \r@tain \et@xhash + \r@tain \eTeX + \r@tain \etexhdrchk +% \r@tain \endmodule + \r@tain \etexstatus + \r@tain \module + \r@tain \uselanguage + + \r@cycle \r@tain + \r@cycle \r@cycle + +\fi + +% And finally re-catcode commercial-at + +\catcode `\@=12 +\endinput + +%% Revision-history: + +3-MAY-2010: 2.1;0-luatex With LuaTeX, don't embed hyphenation patterns and + exceptions in the format, but on-demand at runtime, for faster + format loading. Use the Lua interface for loading hyphenation + rules from plain text files according to the new configuration + file language.lua.dat. Make use of a supporting lua file, + luatex-hyphen.lua. See also luatex-hyphen.pdf. + (Manuel Pegourie-Gonnard, Elie Roux and Khaled Hosny) + +01-FEB-1999: 2.1;0 Allow file to be used with e-TeX versions 2.0 and 2.1 + +25-MAR-1998: 2.0;19 Improved log message for \{glob|loc}{marks|box}vector (PEB) + +24-MAR-1998: 2.0;18 Optimisation of one section made (DC & PEB), + a couple of \if tests made more robust, + and spacing improved in one macro. + +24-MAR-1998: 2.0;17 Coding styles unified and all references to Peter + Breitenlohner eliminated from main code + +23-MAR-1998: 2.0;16 Continued from 2.0;15 + +20-MAR-1998: 2.0;15 Changes made here and in "etexdefs.lib" to + improve compatibility with LaTeX, and + \{glob,loc}{marks,box}vector re-thought. + +11-MAR-1998: 2.0;14 \newmark made synonym for \newmarks / PT + +10-MAR-1998: 2.0;13 Missing brace re-inserted in \...lvec /PT + +10-MAR-1998: 2.0;12 Typo corrected in Peter's name /PT + +10-MAR-1998: 2.0;11 "\...lvec" failed to use \et@xhash; fixed / PT + +10-MAR-1998: 2.0;10 \h@sh -> \et@xhash /PT + +06-MAR-1998: 2.0;9 Final tweaks by PEB ! + +05-MAR-1998: <missing version number> Final tweaks by PT + +28-Feb-1998: 2.0;8 Major re-work by PEB + +24-Feb-1998: 2.0;7 \tracingnesting -> \tw@ + +24-FEB-1998: 2.0;6 version-mismatch reduced in severity; + \tracingall and ...none improved; + aesthetic spaces around "=" removed + +24-Jan-1998: 2.0;5: block allocation of registers added + +21-Jan-1998: 2.0;4: released to e-TeX team for testing/comments + +20-Jan-1998: \glob... implemented, and coding simplified by + the implementation and use of of \max@xpr + +06-Jan-1998: Alpha-testing complete of extended and local register allocation. + +29-Dec-1997: The "%!" convention replaced by a corresponding "%%": + this should avoid any inadvertent conflict with Adobe conventions. + + \tracingall augmented with + \tracinglostchars=\tw@ %%% Q -- should this be default? + \tracingnesting=\@ne + + \tracingnone augmented. + +05-DEC-1997: A long-standing bug removed: left- and right- hyphenmin + were transposed in fallback mode :-((((( + +24-APR-1997: An interim release, to provide compatibility with Peter's + naming conventions for beta-test versions of e-TeX V2. + Consistency checking is now restricted to \eTeXversion, + and \eTeXrevision is ignored. + +01-NOV-1996: V1.1;5: Final stage? Checking that everything possible + is recycled whilst nothing that is needed is lost. Retained + names given \etex or \et@x prefix wherever possible. Some + potentially dangerous cs-names commented out of the recycle/retain + lists because they were synonyms of members of the if-else-fi set. + The definition of the e-TeX logo added: this had somehow slipped + through the net! Intended to be the final revision before public + release, but awaiting comments from other members of the team. + +31-OCT-1996: V1.1;4: errors noticed while proof-reading corrected; far + greater use made of concealed control sequences with + commercial-at (@); library file headers differentiated + from ordinary file headers; return-values for header-check + altered to allow fall-thru' if ok; fallback-use algorithm + significantly modified (major semantic shift). + +29-OCT-1996: V1.1;3: tidying up prior to release; careful check on + which control words can be re-cycled; \recycle made more + robust, to check whether one is trying to re-cycle something + that was never 'cycled' in the first place (PEB suggestion); + \et@xmsg re-written to use \message or \errmessage as necessary; + \errhelps provided for all places they might be referenced. + +27-OCT-1996: V1.1;2: minor version numbers re-introduced, using semi-colon + as delimiter and stopping pattern matching at the semi-colon; + \et@xfilehdr defined dynamically, based in \eTeXversion and + \eTeXrevision; \load now uses \etexhdrchk, so library + files are required to start with an e-TeX header; this will + have implications when e-TeX -> V2+, so this code should be + re-considered at this point. + +17-OCT-1996: V1.1: minor version numbers eliminated, to reduce the + need for users to update their "language.def" files. + +17-OCT-1996: V1.0-4: \addlanguage@hook added, version history moved to end. + +17-OCT-1996: Version 1.0-3 does away with the "fallback" file. + +16-OCT-1996: Version 1.0-2 implements module handling, so constant "3" + no longer used (see below). + +13-Oct-1996: Replaced \def by \chardef where possible; + eliminated dependency on "etexdefs.def", hard-coding + in the constant "3" (with comment) instead; + used Bernd's \ch@ckforyn; + re-catcoded `\@ earlier, to reduce number of \[if]csnames; + commented the strange indentation of the \recycles at end. + +11-Oct-1996: language handling commands modified (V1.0): PT/BR diff --git a/Master/texmf-dist/tex/luatex/hyph-utf8/hyphen.cfg b/Master/texmf-dist/tex/luatex/hyph-utf8/hyphen.cfg new file mode 100644 index 00000000000..d7dfc419340 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/hyph-utf8/hyphen.cfg @@ -0,0 +1,426 @@ +%% +%% This is file `hyphen.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% luatex-hyphen.dtx (with options: `hyphen') +%% +%% This is a modified version of the hyphen.cfg file from the babel system, +%% intended for use with LuaTeX, but compatible with other engines. +%% The present file IS NOT part of the babel system. +%% +%% The modifications are Copyright 2010 Khaled Hosny, Elie Roux, and Manuel +%% Pegourie-Gonnard, under LPPL version 1.3 or later. +%% +%% Here is the licence statement of the original hyphen.cfg file: +%% | +%% | Copyright 1989-2008 Johannes L. Braams and any individual authors +%% | Listed elsewhere in this file. All rights reserved. +%% | +%% | It may be distributed and/or modified under the +%% | Conditions of the LaTeX Project Public License, either version 1.3 +%% | Of this license or (at your option) any later version. +%% | The latest version of this license is in +%% | http://www.latex-project.org/lppl.txt +%% | And version 1.3 or later is part of all distributions of LaTeX +%% | Version 2003/12/01 or later. +%% | +%% | This work has the LPPL maintenance status "maintained". +%% | +%% | The Current Maintainer of this work is Johannes Braams. +%% | +%% `---=(licence statement of original hyphen.cfg)=--- +%% +\ifx\ProvidesFile\@undefined + \def\ProvidesFile#1[#2 #3 #4]{% + \wlog{File: #1 #4 #3 <#2>}% + \ifx\directlua\@undefined + \toks8{Babel <#3> and hyphenation patterns for }% + \else + \toks8{LuaTeX adaptation of babel <#3> + and hyphenation patterns for }% + \fi + \let\ProvidesFile\@undefined + } + \def\ProvidesLanguage#1[#2 #3 #4]{% + \wlog{Language: #1 #4 #3 <#2>}% + } +\else + \let\bbl@tempa\ProvidesFile + \def\ProvidesFile#1[#2 #3 #4]{% + \ifx\directlua\@undefined + \toks8{Babel <#3> and hyphenation patterns for }% + \else + \toks8{LuaTeX adaptation of babel <#3> + and hyphenation patterns for }% + \fi + \bbl@tempa#1[#2 #3 #4]% + \let\ProvidesFile\bbl@tempa} + \def\ProvidesLanguage#1{% + \begingroup + \catcode`\ 10 % + \@makeother\/% + \@ifnextchar[%] + {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}} + \def\@provideslanguage#1[#2]{% + \wlog{Language: #1 #2}% + \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}% + \endgroup} +\fi + +\ProvidesFile{hyphen.cfg} + [2010/04/26 v3.8l-luatex-1.3beta % + Language switching mechanism for LuaTeX, adapted from babel v3.8l] +\ifx\AtBeginDocument\@undefined + \input plain.def\relax +\fi +\ifx\language\@undefined + \csname newcount\endcsname\language +\fi +\ifx\newlanguage\@undefined + \csname newcount\endcsname\last@language +\else + \countdef\last@language=19 +\fi +\ifx\newlanguage\@undefined + \def\addlanguage#1{% + \global\advance\last@language \@ne + \ifnum\last@language<\@cclvi + \else + \errmessage{No room for a new \string\language!}% + \fi + \global\chardef#1\last@language + \wlog{\string#1 = \string\language\the\last@language}} +\else + \def\addlanguage{\alloc@9\language\chardef\@cclvi} +\fi +\def\adddialect#1#2{% + \global\chardef#1#2\relax + \wlog{\string#1 = a dialect from \string\language#2}} +\def\iflanguage#1{% + \expandafter\ifx\csname l@#1\endcsname\relax + \@nolanerr{#1}% + \else + \bbl@afterfi{\ifnum\csname l@#1\endcsname=\language + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}% + \fi} +\edef\selectlanguage{% + \noexpand\protect + \expandafter\noexpand\csname selectlanguage \endcsname + } +\ifx\@undefined\protect\let\protect\relax\fi +\ifx\documentclass\@undefined + \def\xstring{\string\string\string} +\else + \let\xstring\string +\fi +\xdef\bbl@language@stack{} +\def\bbl@push@language{% + \xdef\bbl@language@stack{\languagename+\bbl@language@stack}% + } +\def\bbl@pop@lang#1+#2-#3{% + \def\languagename{#1}\xdef#3{#2}% + } +\def\bbl@pop@language{% + \expandafter\bbl@pop@lang\bbl@language@stack-\bbl@language@stack + \expandafter\bbl@set@language\expandafter{\languagename}% + } +\expandafter\def\csname selectlanguage \endcsname#1{% + \bbl@push@language + \aftergroup\bbl@pop@language + \bbl@set@language{#1}} +\def\bbl@set@language#1{% + \edef\languagename{% + \ifnum\escapechar=\expandafter`\string#1\@empty + \else \string#1\@empty\fi}% + \select@language{\languagename}% + \if@filesw + \protected@write\@auxout{}{\string\select@language{\languagename}}% + \addtocontents{toc}{\xstring\select@language{\languagename}}% + \addtocontents{lof}{\xstring\select@language{\languagename}}% + \addtocontents{lot}{\xstring\select@language{\languagename}}% + \fi} +\def\select@language#1{% + \expandafter\ifx\csname l@#1\endcsname\relax + \@nolanerr{#1}% + \else + \expandafter\ifx\csname date#1\endcsname\relax + \@noopterr{#1}% + \else + \bbl@patterns{\languagename}% + \originalTeX + \expandafter\def\expandafter\originalTeX + \expandafter{\csname noextras#1\endcsname + \let\originalTeX\@empty}% + \languageshorthands{none}% + \babel@beginsave + \csname captions#1\endcsname + \csname date#1\endcsname + \csname extras#1\endcsname\relax + \babel@savevariable\lefthyphenmin + \babel@savevariable\righthyphenmin + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi + \fi + \fi} +\long\def\otherlanguage#1{% + \csname selectlanguage \endcsname{#1}% + \ignorespaces + } +\long\def\endotherlanguage{% + \originalTeX + \global\@ignoretrue\ignorespaces + } +\expandafter\def\csname otherlanguage*\endcsname#1{% + \foreign@language{#1}% + } +\expandafter\def\csname endotherlanguage*\endcsname{% + \csname noextras\languagename\endcsname + } +\def\foreignlanguage{\protect\csname foreignlanguage \endcsname} +\expandafter\def\csname foreignlanguage \endcsname#1#2{% + \begingroup + \originalTeX + \foreign@language{#1}% + #2% + \csname noextras#1\endcsname + \endgroup + } +\def\foreign@language#1{% + \def\languagename{#1}% + \expandafter\ifx\csname l@#1\endcsname\relax + \@nolanerr{#1}% + \else + \bbl@patterns{\languagename}% + \languageshorthands{none}% + \csname extras#1\endcsname + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi + \fi + } +\def\bbl@patterns#1{% + \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax + \csname l@#1\endcsname + \else + \csname l@#1:\f@encoding\endcsname + \fi\relax + \ifx\directlua\@undefined\else + \ifx\directlua\relax\else + \ifcsname lu@texhyphen@loaded@\the\language\endcsname \else + \global\@namedef{lu@texhyphen@loaded@\the\language}{}% + \directlua{ + if not luatexhyphen then + dofile(assert(kpse.find_file("luatex-hyphen.lua"))) + end + luatexhyphen.loadlanguage("\luatexluaescapestring{#1}", + \the\language)}% + \fi + \fi + \fi +} +\def\hyphenrules#1{% + \expandafter\ifx\csname l@#1\endcsname\@undefined + \@nolanerr{#1}% + \else + \bbl@patterns{#1}% + \languageshorthands{none}% + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi + \fi + } +\def\endhyphenrules{} +\def\providehyphenmins#1#2{% + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \@namedef{#1hyphenmins}{#2}% + \fi} +\def\set@hyphenmins#1#2{\lefthyphenmin#1\righthyphenmin#2} +\def\LdfInit{% + \chardef\atcatcode=\catcode`\@ + \catcode`\@=11\relax + \input babel.def\relax + \catcode`\@=\atcatcode \let\atcatcode\relax + \LdfInit} +\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi +\ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi +\ifx\PackageError\@undefined + \def\@nolanerr#1{% + \errhelp{Your command will be ignored, type <return> to proceed}% + \errmessage{You haven't defined the language #1\space yet}} + \def\@nopatterns#1{% + \message{No hyphenation patterns were loaded for}% + \message{the language `#1'}% + \message{I will use the patterns loaded for \string\language=0 + instead}} + \def\@noopterr#1{% + \errmessage{The option #1 was not specified in \string\usepackage} + \errhelp{You may continue, but expect unexpected results}} + \def\@activated#1{% + \wlog{Package babel Info: Making #1 an active character}} +\else + \newcommand*{\@nolanerr}[1]{% + \PackageError{babel}% + {You haven't defined the language #1\space yet}% + {Your command will be ignored, type <return> to proceed}} + \newcommand*{\@nopatterns}[1]{% + \PackageWarningNoLine{babel}% + {No hyphenation patterns were loaded for\MessageBreak + the language `#1'\MessageBreak + I will use the patterns loaded for \string\language=0 + instead}} + \newcommand*{\@noopterr}[1]{% + \PackageError{babel}% + {You haven't loaded the option #1\space yet}% + {You may proceed, but expect unexpected results}} + \newcommand*{\@activated}[1]{% + \PackageInfo{babel}{% + Making #1 an active character}} +\fi +\def\process@line#1#2 #3/{% + \ifx=#1 + \process@synonym#2 / + \else + \process@language#1#2 #3/% + \fi + } +\toks@{} +\def\process@synonym#1 /{% + \ifnum\last@language=\m@ne + \expandafter\chardef\csname l@#1\endcsname0\relax + \wlog{\string\l@#1=\string\language0} + \toks@\expandafter{\the\toks@ + \expandafter\let\csname #1hyphenmins\expandafter\endcsname + \csname\languagename hyphenmins\endcsname}% + \else + \expandafter\chardef\csname l@#1\endcsname\last@language + \wlog{\string\l@#1=\string\language\the\last@language} + \expandafter\let\csname #1hyphenmins\expandafter\endcsname + \csname\languagename hyphenmins\endcsname + \fi + } +\def\process@language#1 #2 #3/{% + \expandafter\addlanguage\csname l@#1\endcsname + \expandafter\language\csname l@#1\endcsname + \def\languagename{#1}% + \ifx\directlua\@undefined + \global\toks8\expandafter{\the\toks8#1, }% + \else + \directlua{ + if not luatexhyphen then + dofile(assert(kpse.find_file("luatex-hyphen.lua"))) + end + processnow = (tex.language == 0) or + (luatexhyphen.lookupname("\luatexluaescapestring{#1}") == nil)}% + \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax + \global\toks8\expandafter{\the\toks8#1, }% + \global\@namedef{lu@texhyphen@loaded@\the\language}{}% + \fi + \fi + \begingroup + \bbl@get@enc#1:\@@@ + \ifx\bbl@hyph@enc\@empty + \else + \fontencoding{\bbl@hyph@enc}\selectfont + \fi + \lefthyphenmin\m@ne + \ifx\directlua\@undefined + \input #2\relax + \else + \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax + \input #2\relax + \fi + \fi + \ifnum\lefthyphenmin=\m@ne + \else + \expandafter\xdef\csname #1hyphenmins\endcsname{% + \the\lefthyphenmin\the\righthyphenmin}% + \fi + \endgroup + \ifnum\the\language=\z@ + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname + \fi + \the\toks@ + \fi + \toks@{}% + \def\bbl@tempa{#3}% + \ifx\bbl@tempa\@empty + \else + \ifx\bbl@tempa\space + \else + \ifx\directlua\@undefined + \input #3\relax + \else + \ifnum0=\directlua{tex.sprint(processnow and "0" or "1")}\relax + \input #3\relax + \fi + \directlua{processnow = nil}% + \fi + \fi + \fi + } +\def\bbl@get@enc#1:#2\@@@{% + \def\bbl@tempa{#1}% + \def\bbl@tempb{#2}% + \ifx\bbl@tempb\@empty + \let\bbl@hyph@enc\@empty + \else + \bbl@get@enc#2\@@@ + \edef\bbl@hyph@enc{\bbl@tempa}% + \fi} +\openin1 = language.dat +\ifeof1 + \message{I couldn't find the file language.dat,\space + I will try the file hyphen.tex} + \input hyphen.tex\relax +\else + \last@language\m@ne + \loop + \endlinechar\m@ne + \read1 to \bbl@line + \endlinechar`\^^M + \ifx\bbl@line\@empty + \else + \edef\bbl@line{\bbl@line\space/}% + \expandafter\process@line\bbl@line + \fi + \iftrue \csname fi\endcsname + \csname if\ifeof1 false\else true\fi\endcsname + \repeat + \language=0 +\fi +\closein1 +\let\process@language\@undefined +\let\process@synonym\@undefined +\let\process@line\@undefined +\let\bbl@tempa\@undefined +\let\bbl@tempb\@undefined +\let\bbl@eq@\@undefined +\let\bbl@line\@undefined +\let\bbl@get@enc\@undefined +\ifx\addto@hook\@undefined +\else + \expandafter\addto@hook\expandafter\everyjob\expandafter{% + \expandafter\typeout\expandafter{\the\toks8 loaded.}} +\fi +\endinput +%% +%% End of file `hyphen.cfg'. diff --git a/Master/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua b/Master/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua new file mode 100644 index 00000000000..fd68da74710 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/hyph-utf8/luatex-hyphen.lua @@ -0,0 +1,77 @@ +-- +-- This is file `luatex-hyphen.lua', +-- generated with the docstrip utility. +-- +-- The original source files were: +-- +-- luatex-hyphen.dtx (with options: `lua') +-- +-- This is a generated file (source: luatex-hyphen.dtx). +-- +-- Copyright (C) 2010 by The LuaLaTeX development team. +-- +-- This work is under the CC0 license. +-- +local error, dofile, pairs, ipairs = error, dofile, pairs, ipairs +local io, texio, lang, kpse = io, texio, lang, kpse +module('luatexhyphen') +local function wlog(msg, ...) + texio.write_nl('log', 'luatex-hyphen: '..msg:format(...)) +end +local function err(msg, ...) + error('luatex-hyphen: '..msg:format(...), 2) +end +local dbname = "language.dat.lua" +local language_dat +local dbfile = kpse.find_file(dbname) +if not dbfile then + err("file not found: "..dbname) +else + language_dat = dofile(dbfile) +end +function lookupname(name) + if language_dat[name] then + return language_dat[name], name + else + for canon, data in pairs(language_dat) do + for _,syn in ipairs(data.synonyms) do + if syn == name then + return data, canon + end + end + end + end +end +function loadlanguage(lname, id) + local msg = "loading%s patterns and exceptions for: %s (\\language%d)" + local ldata, cname = lookupname(lname) + if not ldata then + err("no entry in %s for this language: %s", dbname, lname) + end + if ldata.special then + if ldata.special == 'null' then + wlog(msg, ' (null)', cname, id) + return + elseif ldata.special:find('^disabled:') then + err("language disabled by %s: %s (%s)", dbname, cname, + ldata.special:gsub('^disabled:', '')) + elseif ldata.special == 'language0' then + err("\\language0 should be dumped in the format") + else + err("bad entry in %s for language %s") + end + end + wlog(msg, '', cname, id) + for _, item in ipairs{'hyphenation', 'patterns'} do + local file = ldata[item] + if file ~= nil and file ~= '' then + local file = kpse.find_file(file) or err("file not found: %s", file) + local fh = io.open(file, 'r') + local data = fh:read('*a') or err("file not readable: %s", f) + fh:close() + lang[item](lang.new(id), data) + end + end +end +-- +-- End of File `luatex-hyphen.lua'. |