diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-03-28 13:39:06 +0200 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2010-03-28 13:39:06 +0200 |
commit | 19f51c58f9a7eda52a1108dd836825631b3cbf08 (patch) | |
tree | 814f520f0e6d85115a378b5f8483e8b29ceaf908 | |
parent | e7375b2ed085cd4a3b61850e9886ba211718a02f (diff) | |
download | luatexbase-19f51c58f9a7eda52a1108dd836825631b3cbf08.tar.gz |
Add catcode defenses.
-rw-r--r-- | TODO | 14 | ||||
-rw-r--r-- | luatexbase-attr.dtx | 49 | ||||
-rw-r--r-- | luatexbase-cctb.dtx | 49 | ||||
-rw-r--r-- | luatexbase-loader.dtx | 49 | ||||
-rw-r--r-- | luatexbase-modutils.dtx | 49 | ||||
-rw-r--r-- | luatexbase-regs.dtx | 49 |
6 files changed, 195 insertions, 64 deletions
@@ -1,9 +1,3 @@ -general -------- - -- add catcode defenses -- adjust original luatextra package - Later ===== @@ -12,14 +6,6 @@ Later - compat with LuaTeX 0.25.4? (Means problems with \directlua, primitive names, kpse.find_file(..., 'lua'), etc.) Maybe do a compat package? -regs ----- - -- Should the various allocation macros set something in a Lua table, or should - we just wait for it to be implemented in LuaTeX? (The \*blk macros would be -rather tricky in this respect, but are they really used?) Well, is there any -actual need for this? - attr ---- diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx index 8e6b4a6..6332260 100644 --- a/luatexbase-attr.dtx +++ b/luatexbase-attr.dtx @@ -174,6 +174,43 @@ See source file '\inFileName' for details. \expandafter\let\csname lltxb@attr@loaded\endcsname\endinput % \end{macrocode} % +% Catcode defenses. +% +% \begin{macrocode} +\begingroup + \catcode123 1 % { + \catcode125 2 % } + \catcode 35 6 % # + \toks0{}% + \def\x{}% + \def\y#1 #2 {% + \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% + \edef\x{\x \catcode#1 #2}}% + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 10 12 % ^^J + \y 34 12 % " + \y 36 3 % $ $ + \y 39 12 % ' + \y 40 12 % ( + \y 41 12 % ) + \y 42 12 % * + \y 43 12 % + + \y 44 12 % , + \y 45 12 % - + \y 46 12 % . + \y 47 12 % / + \y 60 12 % < + \y 61 12 % = + \y 64 11 % @ (letter) + \y 62 12 % > + \y 95 12 % _ (other) + \y 96 12 % ` + \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% +\expandafter\y\csname lltxb@attr@AtEnd\endcsname +% \end{macrocode} +% % Package declaration. % % \begin{macrocode} @@ -205,20 +242,12 @@ See source file '\inFileName' for details. \let\x\PackageWarningNoLine \fi \expandafter\endgroup - \x{luatexbase-attr}{LuaTeX is required for this package.^^J - Aborting package loading.} + \x{luatexbase-attr}{LuaTeX is required for this package. Aborting.} + \lltxb@attr@AtEnd \expandafter\endinput \fi % \end{macrocode} % -% Make sure the catcode of @ is correct, especially for \plaintex. -% -% \begin{macrocode} -\expandafter\edef\csname lltxb@attr@AtEnd\endcsname{% - \catcode64 \the\catcode64\relax} -\catcode64 11 -% \end{macrocode} -% % \subsubsection{Main content} % % Load the supporting Lua module. diff --git a/luatexbase-cctb.dtx b/luatexbase-cctb.dtx index 435bc0d..09ff77f 100644 --- a/luatexbase-cctb.dtx +++ b/luatexbase-cctb.dtx @@ -197,6 +197,43 @@ See source file '\inFileName' for details. \expandafter\let\csname lltxb@cctb@loaded\endcsname\endinput % \end{macrocode} % +% Catcode defenses. +% +% \begin{macrocode} +\begingroup + \catcode123 1 % { + \catcode125 2 % } + \catcode 35 6 % # + \toks0{}% + \def\x{}% + \def\y#1 #2 {% + \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% + \edef\x{\x \catcode#1 #2}}% + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 10 12 % ^^J + \y 34 12 % " + \y 36 3 % $ $ + \y 39 12 % ' + \y 40 12 % ( + \y 41 12 % ) + \y 42 12 % * + \y 43 12 % + + \y 44 12 % , + \y 45 12 % - + \y 46 12 % . + \y 47 12 % / + \y 60 12 % < + \y 61 12 % = + \y 64 11 % @ (letter) + \y 62 12 % > + \y 95 12 % _ (other) + \y 96 12 % ` + \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% +\expandafter\y\csname lltxb@cctb@AtEnd\endcsname +% \end{macrocode} +% % Package declaration. % % \begin{macrocode} @@ -228,20 +265,12 @@ See source file '\inFileName' for details. \let\x\PackageWarningNoLine \fi \expandafter\endgroup - \x{luatexbase-cctb}{LuaTeX is required for this package.^^J - Aborting package loading.} + \x{luatexbase-cctb}{LuaTeX is required for this package. Aborting.} + \lltxb@cctb@AtEnd \expandafter\endinput \fi % \end{macrocode} % -% Make sure the catcode of @ is correct, especially for \plaintex. -% -% \begin{macrocode} -\expandafter\edef\csname lltxb@cctb@AtEnd\endcsname{% - \catcode64 \the\catcode64\relax} -\catcode64 11 -% \end{macrocode} -% % \subsubsection{Main content} % % Load the supporting Lua module. diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx index cb5079c..695efe6 100644 --- a/luatexbase-loader.dtx +++ b/luatexbase-loader.dtx @@ -143,6 +143,43 @@ See source file '\inFileName' for details. \expandafter\let\csname lltxb@loader@loaded\endcsname\endinput % \end{macrocode} % +% Catcode defenses. +% +% \begin{macrocode} +\begingroup + \catcode123 1 % { + \catcode125 2 % } + \catcode 35 6 % # + \toks0{}% + \def\x{}% + \def\y#1 #2 {% + \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% + \edef\x{\x \catcode#1 #2}}% + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 10 12 % ^^J + \y 34 12 % " + \y 36 3 % $ $ + \y 39 12 % ' + \y 40 12 % ( + \y 41 12 % ) + \y 42 12 % * + \y 43 12 % + + \y 44 12 % , + \y 45 12 % - + \y 46 12 % . + \y 47 12 % / + \y 60 12 % < + \y 61 12 % = + \y 64 11 % @ (letter) + \y 62 12 % > + \y 95 12 % _ (other) + \y 96 12 % ` + \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% +\expandafter\y\csname lltxb@loader@AtEnd\endcsname +% \end{macrocode} +% % Package declaration. % % \begin{macrocode} @@ -174,20 +211,12 @@ See source file '\inFileName' for details. \let\x\PackageWarningNoLine \fi \expandafter\endgroup - \x{luatexbase-loader}{LuaTeX is required for this package.^^J - Aborting package loading.} + \x{luatexbase-loader}{LuaTeX is required for this package. Aborting.} + \lltxb@loader@AtEnd \expandafter\endinput \fi % \end{macrocode} % -% Make sure the catcode of @ is correct, especially for \plaintex. -% -% \begin{macrocode} -\expandafter\edef\csname lltxb@loader@AtEnd\endcsname{% - \catcode64 \the\catcode64\relax} -\catcode64 11 -% \end{macrocode} -% % \subsubsection{Main content} % % Load the supporting Lua module. diff --git a/luatexbase-modutils.dtx b/luatexbase-modutils.dtx index 6cea769..f623183 100644 --- a/luatexbase-modutils.dtx +++ b/luatexbase-modutils.dtx @@ -155,6 +155,43 @@ See source file '\inFileName' for details. \expandafter\let\csname lltxb@modutils@loaded\endcsname\endinput % \end{macrocode} % +% Catcode defenses. +% +% \begin{macrocode} +\begingroup + \catcode123 1 % { + \catcode125 2 % } + \catcode 35 6 % # + \toks0{}% + \def\x{}% + \def\y#1 #2 {% + \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% + \edef\x{\x \catcode#1 #2}}% + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 10 12 % ^^J + \y 34 12 % " + \y 36 3 % $ $ + \y 39 12 % ' + \y 40 12 % ( + \y 41 12 % ) + \y 42 12 % * + \y 43 12 % + + \y 44 12 % , + \y 45 12 % - + \y 46 12 % . + \y 47 12 % / + \y 60 12 % < + \y 61 12 % = + \y 64 11 % @ (letter) + \y 62 12 % > + \y 95 12 % _ (other) + \y 96 12 % ` + \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% +\expandafter\y\csname lltxb@modutils@AtEnd\endcsname +% \end{macrocode} +% % Package declaration. % % \begin{macrocode} @@ -186,20 +223,12 @@ See source file '\inFileName' for details. \let\x\PackageWarningNoLine \fi \expandafter\endgroup - \x{luatexbase-modutils}{LuaTeX is required for this package.^^J - Aborting package loading.} + \x{luatexbase-modutils}{LuaTeX is required for this package. Aborting.} + \lltxb@modutils@AtEnd \expandafter\endinput \fi % \end{macrocode} % -% Make sure the catcode of @ is correct, especially for \plaintex. -% -% \begin{macrocode} -\expandafter\edef\csname lltxb@modutils@AtEnd\endcsname{% - \catcode64 \the\catcode64\relax} -\catcode64 11 -% \end{macrocode} -% % Load the package loader. % % \begin{macrocode} diff --git a/luatexbase-regs.dtx b/luatexbase-regs.dtx index bf532ed..89c2313 100644 --- a/luatexbase-regs.dtx +++ b/luatexbase-regs.dtx @@ -164,6 +164,43 @@ See source file '\inFileName' for details. \expandafter\let\csname lltxb@regs@loaded\endcsname\endinput % \end{macrocode} % +% Catcode defenses. +% +% \begin{macrocode} +\begingroup + \catcode123 1 % { + \catcode125 2 % } + \catcode 35 6 % # + \toks0{}% + \def\x{}% + \def\y#1 #2 {% + \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% + \edef\x{\x \catcode#1 #2}}% + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 10 12 % ^^J + \y 34 12 % " + \y 36 3 % $ $ + \y 39 12 % ' + \y 40 12 % ( + \y 41 12 % ) + \y 42 12 % * + \y 43 12 % + + \y 44 12 % , + \y 45 12 % - + \y 46 12 % . + \y 47 12 % / + \y 60 12 % < + \y 61 12 % = + \y 64 11 % @ (letter) + \y 62 12 % > + \y 95 12 % _ (other) + \y 96 12 % ` + \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% +\expandafter\y\csname lltxb@regs@AtEnd\endcsname +% \end{macrocode} +% % Package declaration. % % \begin{macrocode} @@ -195,20 +232,12 @@ See source file '\inFileName' for details. \let\x\PackageWarningNoLine \fi \expandafter\endgroup - \x{luatexbase-regs}{LuaTeX is required for this package.^^J - Aborting package loading.} + \x{luatexbase-regs}{LuaTeX is required for this package. Aborting.} + \lltxb@regs@AtEnd \expandafter\endinput \fi % \end{macrocode} % -% Make sure the catcode of @ is correct, especially for \plaintex. -% -% \begin{macrocode} -\expandafter\edef\csname lltxb@regs@AtEnd\endcsname{% - \catcode64 \the\catcode64\relax} -\catcode64 11 -% \end{macrocode} -% % \subsection{Main content} % % If running \latex, load \file{etex.sty}. If not, either |