OSDN Git Service

Revert "Regenerated manual PDFs."
[luatex-ja/luatexja.git] / src / ltj-cctbreg.sty
index c63933b..9840890 100644 (file)
@@ -8,7 +8,7 @@
 %! 筋が良くなく, できるなら避けたいが, 今のままだと LuaTeX-ja を
 %! LaTeX + fontspec で用いた時に確実に影響が出る. また衝突を残した
 %! ままだとカテゴリコードテーブルが実質的に使えない訳で, これも
-%! 残念なことである. 
+%! 残念なことである.
 %! 「近いうちに両パッケージの中で解決される」ことを期待しつつ,
 %! 「衝突がない」という前提で開発を行いたいので, 暫定的処置として,
 %! このモジュールを用意する.
 \fi                             %</LaTeX>
 
 % LS = Size of storage reserved for luatex-pkg.
-\chardef\ltj@cctb@lower@stor@size=32768
+\chardef\ltj@cctb@lower@stor@size=16384
+
+% LL = (upper bound of cctb index used by luatexbase.sty and luatex.sty) - 1
+\chardef\ltj@cctb@limit=32766
 
 %-------------------
 
 
 \begingroup
 \endlinechar=13
-\catcode`\_=12
 \gdef\ltj@@cctb@org@def#1{%
   \ifnum\lltxb@catcodetable@alloc<65535\relax
-    \global\advance\lltxb@catcodetable@alloc\@ne
+    \global\advance\lltxb@catcodetable@alloc\tw@
     \allocationnumber\lltxb@catcodetable@alloc
     \global\chardef#1\allocationnumber
     \luatexinitcatcodetable\allocationnumber
 
 %-------------------
 
+\begingroup
+\endlinechar=13
+\gdef\newluatexcatcodetable#1{%
+  \ifnum\lltxb@catcodetable@alloc<\ltj@cctb@limit\relax
+    \global\advance\lltxb@catcodetable@alloc\tw@
+    \allocationnumber\lltxb@catcodetable@alloc
+    \global\chardef#1\allocationnumber
+    \luatexinitcatcodetable\allocationnumber
+    \begingroup\escapechar\m@ne
+    \luatexbase@directlua{luatexbase.catcodetabledef_from_tex(
+      '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
+    \endgroup
+    \wlog{\string#1=\string\luatexcatcodetable\the\allocationnumber}%
+  \else
+    \errmessage{No room for a new \string\luatexcatcodetable}%
+  \fi}
+\endgroup
+
+%-------------------
+
 % The luatex package stores its preset settings to registers 1, 3, 5, 7
 % and new user allocations go to odd number 9, 11, 13, etc.; registers
 % with even number are reserved for the "category code table stack".
 \fi
 
 \def\ltj@@cctb@org@def{%
-  \ifnum\CatcodeTableStack<268435454 %
-    \global\advance\CatcodeTableStack by\tw@
+  \ifnum\CatcodeTableStack<65534\relax
+    \global\advance\CatcodeTableStack\tw@
   \else
-    \@PackageError{luatex}{%
-      Catcode table stack overflow%
-    }\@ehd
-  \fi
-}
+    \errmessage{CatcodeTableStack overflow}%
+  \fi}
 \unless\ifx\ltj@@cctb@org@def\IncCatcodeTableStack
   % Failure: luatex-pkg is not of expected version!!
   \ltj@@cctb@failure=100 %
   \catcode0   12 % nul
   \catcode13  12 % carriage return
   \catcode37  12 % percent
-  \setcatcoderange{65}{90}{12}% A-Z
-  \setcatcoderange{97}{122}{12}% a-z
+  \SetCatcodeRange{65}{90}{12}% A-Z
+  \SetCatcodeRange{97}{122}{12}% a-z
   \catcode92  12 % backslash
   \catcode127 12 }
 \newluatexcatcodetable\CatcodeTableOther
 \newluatexcatcodetable\CatcodeTableLaTeX
 \setluatexcatcodetable\CatcodeTableLaTeX{%
   \luatexcatcodetable\CatcodeTableIniTeX
-  \setcatcoderange{0}{31}{15}%
+  \SetCatcodeRange{0}{31}{15}%
   \catcode9   10 % tab
   \catcode12  13 % form feed
   \catcode13  5  % carriage return