OSDN Git Service

"FFFFF -> \ltjlineendcomment
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Wed, 2 Mar 2016 11:44:31 +0000 (20:44 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Wed, 2 Mar 2016 11:44:31 +0000 (20:44 +0900)
src/ltj-inputbuf.lua
src/luatexja-core.sty
src/luatexja.sty
src/patches/lltjp-listings.sty

index cec74cf..d039f7d 100644 (file)
@@ -8,12 +8,12 @@ luatexja.load_module('charrange'); local ltjc = luatexja.charrange
 require("unicode")
 local utflen = unicode.utf8.len
 local utfbyte = unicode.utf8.byte
+local utfchar = unicode.utf8.char
 local node_new = node.new
 local node_free = node.free
 local id_glyph = node.id('glyph')
-local getcatcode = tex.getcatcode
+local getcatcode, getcount = tex.getcatcode, tex.getcount
 local ltjc_is_japanese_char_curlist = ltjc.is_japanese_char_curlist
-local FFFFF = string.char(0xF3,0xBF,0xBF,0xBF)
 
 --- the following function is modified from jafontspec.lua (by K. Maeda).
 --- Instead of "%", we use U+FFFFF for suppressing spaces.
@@ -33,12 +33,12 @@ local function add_comment(buffer)
       if c>=0x80 then
         local ct = getcatcode(c)
         local te = tex.endlinechar
-        local ctl = (te ~= -1) and (getcatcode(te)==5) and (getcatcode(0xFFFFF)==14)
+        local ctl = (te ~= -1) and (getcatcode(te)==5) and (getcatcode(getcount('ltjlineendcomment')==14)
         -- Is the catcode of endline character is 5 (end-of-line)?
-        -- Is the catcode of U+FFFFF (new comment char) is 14 (comment)?
+        -- Is the catcode of \ltjlineendcomment (new comment char) is 14 (comment)?
         if ((ct==11) or (ct==12)) and ctl then
            if ltjc_is_japanese_char_curlist(c) then
-              buffer = buffer .. FFFFF -- U+FFFFF
+              buffer = buffer .. utfchar(getcount('ltjlineendcomment'))
            end
         end
       end
index c881570..7475f30 100644 (file)
@@ -65,7 +65,7 @@
   \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
     \csname iftrue\endcsname
   \NeedsTeXFormat{LaTeX2e}
-  \ProvidesPackage{luatexja-core}[2015/12/11 Core of LuaTeX-ja]
+  \ProvidesPackage{luatexja-core}[2016/03/03 Core of LuaTeX-ja]
 \fi                             %</LaTeX>
 
 %% Load prerequisite packages.
 %! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 % LuaTeX-ja core TeX source
 
-\catcode"FFFFF=14 %"
+\newcount\ltjlineendcomment
+\ltjlineendcomment="FFFFF
+\catcode\ltjlineendcomment=14 %"
 
 \def\ltj@loaded{hoge}
 
 \newcatcodetable\ltj@temp@cctb
 \def\ltj@overwrite@catcodetable#1{%
   \setluatexcatcodetable\ltj@temp@cctb{\luatexcatcodetable#1}%
-  \setluatexcatcodetable#1{\luatexcatcodetable\ltj@temp@cctb\catcode"FFFFF=14}%"
+  \setluatexcatcodetable#1{\luatexcatcodetable\ltj@temp@cctb\catcode\ltjlineendcomment=14}%"
 }
 \ltj@overwrite@catcodetable\CatcodeTableLaTeX
 \ltj@overwrite@catcodetable\CatcodeTableLaTeXAtLetter
index 4d23965..2e55d5c 100644 (file)
@@ -34,7 +34,7 @@
   \expandafter\let\csname ifltj@in@latex\expandafter\endcsname
     \csname iftrue\endcsname
   \NeedsTeXFormat{LaTeX2e}
-  \ProvidesPackage{luatexja}[2015/11/03 Japanese Typesetting with Lua(La)TeX]
+  \ProvidesPackage{luatexja}[2015/11/03 Japanese Typesetting with Lua(La))TeX]
 \fi                             %</LaTeX>
 
 \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
index 987cd69..253bf5b 100644 (file)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2016/02/07 Patch to listings for LuaTeX-ja]
+\ProvidesPackage{lltjp-listings}[2016/03/02 Patch to listings for LuaTeX-ja]
 \RequirePackage{listings,luatexbase-cctb}
 
 %%%%%%%%%%%%%%%% Japanese support
 \newluatexcatcodetable\CatcodeTableLTJlistings
 \setluatexcatcodetable\CatcodeTableLTJlistings{%
   \luatexcatcodetable\CatcodeTableLaTeXAtLetter
-  \catcode"FFFFF=13%"
+  \catcode\ltjlineendcomment=13%"
   \SetCatcodeRange{"FF61}{"FF9F}{13}%     半角カナ
   \SetCatcodeRange{"E0100}{"E01EF}{13}%   漢字用異体字セレクタ
   \SetCatcodeRange{"FE00}{"FE0F}{13}%     Variation Selector
 }}
 
 \directlua{
+  local utfchar, getcount = unicode.utf8.char, tex.getcount
   luatexja.listings.insert_cb = function()
     if not luatexja.listings.patched then
       luatexja.listings.patched = 1
               local c = utf.sub(buf, i, i)
               local cu = utf.byte(c)
               if cu >= 0x80 and tex.getcatcode(cu) \string~= 13 then
-                ret = ret .. utf.char(1048575) % U+FFFFF
+                ret = ret .. utfchar(getcount('ltjlineendcomment'))
               end
               ret = ret .. c
             end
 % hook!
 \lst@AddToHook{Init}{%
   \luatexcatcodetable\CatcodeTableLTJlistings\ltj@@listing@jpcmd
-  \lccode`\~="FFFFF\lowercase{\def~{\ltj@lst@ProcessJALetter}}%"
+  \lccode`\~=\ltjlineendcomment\lowercase{\def~{\ltj@lst@ProcessJALetter}}%"
   \directlua{luatexja.listings.insert_cb()}%
   \if@ltj@lst@double
     \let\ltj@lst@hss@normal=\ltj@lst@hss@double
 \begingroup
 \catcode`\^^A=12
 \catcode`\^^@=\active
-\lccode`\$="FFFFF \catcode`\$=13 %"
+\lccode`\$=\ltjlineendcomment \catcode`\$=13 %"
 \lowercase{%
 \gdef\ltj@lst@MakeActive@#1{\let\lst@next\relax%
     \ifx#1\relax
                  {}%
          \fi%
          \ltj@lst@escape@setup#2%
-         #3\catcode"FFFFF=9\lst@escapebegin\expandafter\lst@next%"
+         #3\catcode\ltjlineendcomment=9\lst@escapebegin\expandafter\lst@next%"
          \fi}%
         {}}
 \def\ltj@lst@escape@setup#1{%
   }\endgroup
 }
 \begingroup
-  \lccode`\|="FFFFF \lowercase{%"
+  \lccode`\|=\ltjlineendcomment \lowercase{%"
   \gdef\ltj@lst@remove@jacmd#1{%
     \expandafter\ltj@lst@remove@jacmd@\detokenize{#1}|\@nil|}
   \gdef\ltj@lst@remove@jacmd@#1|{%