1 % lltjlisting.sty: modified from jlisting.sty (by Thor) for
4 \NeedsTeXFormat{LaTeX2e}
5 \def\filedate{2006/02/20}
7 \ProvidesPackage{lltjlisting}[\filedate\space\fileversion\space(Thor)]
10 \let\lst@@ProcessSpace\lst@ProcessSpace
11 \def\lst@ProcessSpace#1{%
12 \lst@check@chartype{#1}%
15 \let\lst@@ProcessLetter\lst@ProcessLetter
16 \def\lst@ProcessLetter#1#2{%
17 \lst@check@chartype{#2}%
18 {\lst@@ProcessLetter{#1}}%
20 \let\lst@@ProcessDigit\lst@ProcessDigit
21 \def\lst@ProcessDigit#1#2{%
22 \lst@check@chartype{#2}%
23 {\lst@@ProcessDigit{#1}}%
25 \let\lst@@ProcessOther\lst@ProcessOther
26 \def\lst@ProcessOther#1#2{%
27 \lst@check@chartype{#2}%
28 {\lst@@ProcessOther{#1}}%
30 \let\lst@@ProcessTabulator\lst@ProcessTabulator
31 \def\lst@ProcessTabulator#1{%
32 \lst@check@chartype{#1}%
33 \lst@@ProcessTabulator
35 \def\lst@check@chartype#1#2#3{%
36 \edef\@tempa{\lst@nextchar=`\string#1\relax}%
37 \afterassignment\remove@to@nnil
40 \ifnum\lst@nextchar<\@cclvi
43 \lst@ifletter \else \lst@OutputOther \fi
45 \expandafter\lst@AppendJchar
48 \def\lst@AppendJchar#1#2{%
49 \lst@check@chartype{#2}%
50 {\advance\lst@length\@ne\lst@Append{#1}}%
52 \def\lst@check@chartype@BOL#1{%
53 \edef\@tempa{\lst@nextchar=`\string#1\relax}%
54 \afterassignment\remove@to@nnil
56 \ifnum\lst@nextchar<\@cclvi\else
58 \expandafter\lst@AppendJchar
61 \def\lst@InputListing#1{%
63 \lsthk@PreSet \gdef\lst@intname{#1}%
64 \expandafter\lstset\expandafter{\lst@set}%
66 \catcode\active=\active
67 \lst@Init\relax \let\lst@gobble\z@
69 \lst@ifprint \def\lst@next{\lst@get@filecontents{#1}}%
70 \else \let\lst@next\@empty
76 \newread\lst@inputfile
77 \def\lst@get@filecontents#1{%
78 \let\lst@filecontents\@empty
79 \openin\lst@inputfile=#1\relax
80 \let\@lst@get@filecontents@prevline\relax
81 \lst@get@filecontents@loop
82 \closein\lst@inputfile
83 \lst@filecontents\empty}
84 \def\lst@get@filecontents@loop{%
85 \read\lst@inputfile to\@lst@get@filecontents@currline
86 \ifx\@lst@get@filecontents@prevline\relax\else
87 \expandafter\expandafter\expandafter\def
88 \expandafter\expandafter\expandafter\lst@filecontents
89 \expandafter\expandafter\expandafter{%
90 \expandafter\lst@filecontents\@lst@get@filecontents@prevline}%
92 \let\@lst@get@filecontents@prevline\@lst@get@filecontents@currline
93 \ifeof\lst@inputfile\else
94 \expandafter\lst@get@filecontents@loop
99 \@tempcnta\lst@gobble\relax
100 \expandafter\lst@BOLGobble@
102 \expandafter\lst@check@chartype@BOL
104 \def\lst@BOLGobble@#1{%
106 \ifx \lst@next\relax\else
107 \ifx \lst@next\lst@MProcessListing\else
108 \ifx \lst@next\lst@ProcessFormFeed\else
109 \ifx \lst@next\lstenv@backslash
110 \let\lst@next\lstenv@BOLGobble@@
112 \let\lst@next\lst@BOLGobble@@
113 \ifx #1\lst@ProcessTabulator
114 \advance\@tempcnta-\lst@tabsize\relax
116 \lst@length-\@tempcnta \lst@PreGotoTabStop
119 \edef\@tempa{\lst@nextchar=`\string#1\relax}%
121 \ifnum\lst@nextchar<\@cclvi\else
122 \advance\@tempcnta\m@ne
124 \advance\@tempcnta\m@ne
128 \def\lst@BOLGobble@@{%
130 \expandafter\lst@BOLGobble@
132 \expandafter\lst@check@chartype@BOL
139 \gdef\lst@breakProcessOther#1{\lst@ProcessOther#1}
140 % ソースコード目次における文字と番号の空き
141 \let \l@lstlisting = \l@figure
142 % キャプションとソースコード目次に対する日本語対応
143 \def\lstlistingname{ソースコード}
144 \def\lstlistlistingname{ソースコード目次}
148 % Changes for LuaTeX-ja:
149 % 1. \char"FFFFF は通常行末用コメント文字として使われる.
150 % だが,それはソースコードの組版には邪魔ものとなる.
151 %\lst@AddToHook{Init}{\catcode"FFFFF=9 }
152 %\lst@AddToHook{DeInit}{\catcode"FFFFF=14 }