"Fossies" - the Fresh Open Source Software Archive

Member "hevea-2.35/listings.hva" (16 Jan 2021, 33000 Bytes) of package /linux/www/hevea-2.35.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 \ProvidesPackage{listings}
    2 \RequirePackage{keyval}
    3 \@primitives{listings}
    4 %%%%%%%%%%% interface keyval
    5 \def\lst@define@key#1#2{\define@key{lst}{#1}{\@funcall{#2}{##1}}}
    6 \newenvironment{lst@protect}
    7   {\@clearstyle\def\%{\@print{\%}}%
    8    \def\#{\@print{\#}}%
    9    \def\${\@print{\$}}%
   10    \def\{{\@print{\{}}%
   11    \def\}{\@print{\}}}%
   12    \def\_{\@print{\_}}%
   13    \def\&{\@print{\&}}%
   14    \def\ref{\@print{\ref}}}
   15   {}
   16 \def\lst@define@key@opt#1#2#3{\define@key{lst}{#1}[#3]
   17   {\@callopt{#2}{\begin{lst@protect}##1\end{lst@protect}}}}
   18 \def\ignore@key#1{\define@key{lst}{#1}{}}
   19 %%%%%%%%%%%
   20 % Helpers %
   21 %%%%%%%%%%%
   22 \def\lstinfo#1{\typeout{LST, #1}}
   23 \def\lst@iter#1#2{%\hva@warn{\lst@iter '#1' '#2'}%
   24 \@iter#1,{#2}}
   25 %For getting rid of two (optional) levels of braces
   26 \def\lst@eat@again#1XXX#2{\@callsubst{#2}{#1\@empty\@empty\@empty\@empty\@empty}}
   27 \def\lst@eat@key#1XXX#2{\@callsubst{\lst@eat@again}{#1XXX#2}}
   28 %%%%%%%% Interface with keyval
   29 \def\lstset#1{\@setkeys{lst}{#1}}
   30 %%%%%%%% Def if not empty
   31 \newcommand{\lst@defne}[2]{\ifx#1\@empty\def#1{#2}\fi}
   32 %%%%%%%%%%%%%
   33 % Toks regs %
   34 %%%%%%%%%%%%%
   35 \newcommand{\lst@Empty}[1]{\let#1\@empty}
   36 %%%%%%%%%%%%
   37 % Hooks    %
   38 %%%%%%%%%%%%
   39 \newcommand{\lst@Hook}[1]
   40   {\newtokens{\csname lsthk@#1\endcsname}}
   41 \newcommand{\lst@ResetHook}[1]
   42   {\resettokens{\csname lsthk@#1\endcsname}}
   43 \newcommand{\lst@UseHook}[1]
   44   {\csname lsthk@#1\endcsname}
   45 \newcommand{\lst@AddToHook}[2]
   46   {\addtokens{\csname lsthk@#1\endcsname}{#2}}
   47 \newcommand{\lst@AddToHookExe}[2]
   48   {\lst@AddToHook{#1}{#2}#2}
   49 \lst@Hook{EOL}\lst@Hook{InitVarEOL}
   50 \lst@Hook{InitVarBOL}\lst@Hook{EveryLine}\lst@Hook{LastLine}
   51 \lst@Hook{PreSet}
   52 \lst@Hook{InitVar}
   53 \lst@Hook{Init}
   54 \lst@Hook{DeInit}
   55 \lst@Hook{SelectCharTable}
   56 \lst@Hook{SetLanguage}
   57 \lst@Hook{AfterSetLanguage}
   58 \lst@AddToHook{SetLanguage}{\lst@ResetHook{AfterSetLanguage}}
   59 \lst@Hook{SetStyle}
   60 \def\lststy@{\lsthk@EmptyStyle}
   61 \lst@Hook{EmptyStyle}
   62 \lst@Hook{EmptyLanguage}
   63 \lst@Hook{InlineUnsave}
   64 %%Avoid explicit TT in listings, they are useless with style sheets
   65 \lst@AddToHook{Init}{\let\tt\@empty}
   66 %%%%%%%%%%%%
   67 % Keywords %
   68 %%%%%%%%%%%%
   69 \newtokens{\lst@delete@all@kwd@class}%
   70 \def\lst@record@kwd@class#1#2{%
   71 %\hva@warn{RECORD '#1' '#2'}%
   72 \ifu\csname lst@allkwd@#1\endcsname%
   73 \addtokens{\lst@delete@all@kwd@class}{\lst@delete@kwd@class{#1}}\fi%
   74 \providecommand{\csname lst@allkwd@#1\endcsname}{}%
   75 \lst@AddTo,{\csname lst@allkwd@#1\endcsname}{\lst@normalize{#2}}}
   76 \def\lst@delete@kwd@class#1{%
   77 %\hva@warn{DELETE '#1'}%
   78 \ifu\csname lst@allkwd@#1\endcsname\else
   79 \@callprim{\lst@delete@kwds}{\{\csname lst@allkwd@#1\endcsname\}}%
   80 \lst@Empty{\csname lst@allkwd@#1\endcsname}\fi}
   81 \newcommand{\lst@allotherkeywords}{}
   82 \def\lst@record@okwds#1{\lst@AddTo,{\lst@allotherkeywords}{\lst@normalize{#1}}}
   83 \newcommand{\lst@alldirectives}{}
   84 \def\lst@record@directives#1{\lst@AddTo,{\lst@alldirectives}{\lst@normalize{#1}}}
   85 \lst@AddToHook{SetLanguage}
   86   {\lst@delete@all@kwd@class%
   87   \@callprim{\lst@delete@okwds}{\{\@rawchars{\lst@allotherkeywords}\}}%
   88   \@callprim{\lst@delete@directives}{\{\lst@alldirectives\}}}
   89 \def\lst@install@kwd#1#2{%
   90 %\hva@warn{INSTALL: #2 -> #1}%
   91 \def\csname lstk@\lst@normalize{#2}\endcsname{#1}}
   92 \def\lst@install@kwds#1#2{%
   93 %     \hva@warn{RESET: #1}%
   94     \lst@delete@kwd@class{#1}%
   95     \lst@record@kwd@class{#1}{#2}%
   96     \lst@iter{\lst@install@kwd{\csname lst@keywordstyle#1\endcsname}}{#2}}
   97 \def\lst@more@kwds#1#2{%
   98 %    \hva@warn{MORE: #1}%
   99     \lst@record@kwd@class{#1}{#2}%
  100     \lst@iter{\lst@install@kwd{\csname lst@keywordstyle#1\endcsname}}{#2}}
  101 \def\lst@install@directive#1#2{\def\csname lstd@\lst@normalize{#2}\endcsname{#1}}
  102 \def\lst@install@directives
  103   #1#2{%
  104     \lst@directivestrue%
  105     \lst@record@directives{#2}%
  106     \lst@iter{\lst@install@directive{#1}}{#2}}
  107 \def\lst@install@okwds
  108   #1#2{%
  109     \lst@record@okwds{#2}%
  110     \lst@iter{\lst@install@kwd{#1}}{#2}}
  111 \def\lst@delete@kwd#1{%
  112 %\hva@warn{DELETE #1}%
  113 \def\csname lstk@\@rawchars{#1}\endcsname{\lst@identifierstyle}}
  114 \def\lst@delete@directive
  115   #1{\def\csname lstd@\@rawchars{#1}\endcsname{}}
  116 \def\lst@delete@okwds#1{\lst@iter{\lst@delete@okwd}{#1}}
  117 \def\lst@delete@kwds#1{%\hva@warn{\lst@delete@kwds '#1'}%
  118 \lst@iter{\lst@delete@kwd}{#1}}
  119 \def\lst@delete@directives#1{\lst@iter{\lst@delete@directive}{#1}}
  120 \def\lst@delete@okwd
  121   #1{\def\csname lstk@\@rawchars{#1}\endcsname{}}
  122 \def\lst@delay@install#1#2{\lst@AddToHook{AfterSetLanguage}
  123 {\lst@install@kwds{#1}{#2}}}
  124 \def\lst@delay@more#1#2{\lst@AddToHook{AfterSetLanguage}
  125 {\lst@more@kwds{#1}{#2}}}
  126 \def\lst@delay@delete#1#2{\lst@AddToHook{AfterSetLanguage}{\lst@delete@kwds{#2}}}
  127 \def\lst@keywords@key#1#2\@empty{\lst@install@kwds{#1}{#2}}
  128 \def\lst@morekeywords@key#1#2\@empty{\lst@more@kwds{#1}{#2}}
  129 \def\lst@deletekeywords@key#1#2\@empty{\lst@delete@kwds{#2}}
  130 \define@key{lst}{keywords}[]{\@callsubstopt{\lst@keywords@key}{1}{#1\@empty}}
  131 \define@key{lst}{morekeywords}[]
  132   {\@callsubstopt{\lst@morekeywords@key}{1}{#1\@empty}}
  133 \define@key{lst}{deletekeywords}[]
  134   {\@callsubstopt{\lst@deletekeywords@key}{1}{#1\@empty}}
  135 %%2nd
  136 \define@key{lst}{ndkeywords}[]
  137   {\@funcall{\lst@keywords@key}{{2}#1\@empty}}
  138 \define@key{lst}{morendkeywords}[]
  139   {\@funcall{\lst@morekeywords@key}{{2}#1\@empty}}
  140 \define@key{lst}{deletendkeywords}[]
  141   {\@funcall{\lst@deletekeywords@key}{{2}#1\@empty}}
  142 %%3rd
  143 \define@key{lst}{rdkeywords}[]{\@callsubstopt{\lst@keywords@key}{3}{#1\@empty}}
  144 \define@key{lst}{morerdkeywords}[]
  145   {\@funcall{\lst@morekeywords@key}{{3}#1\@empty}}
  146 \define@key{lst}{deleterdkeywords}[]
  147   {\@funcall{\lst@deletekeywords@key}{{3}#1\@empty}}
  148 %%% Directives
  149 \def\lst@delay@dinstall#1#2{\lst@AddToHook{AfterSetLanguage}{\lst@install@directives{#1}{#2}}}
  150 \def\lst@delay@ddelete#1{\lst@AddToHook{AfterSetLanguage}{\lst@delete@directives{#1}}}
  151 \define@key{lst}{directives}{\lst@delay@dinstall\lst@directivestyle#1}
  152 \define@key{lst}{moredirectives}{\lst@delay@dinstall\lst@directivestyle#1}
  153 %%%%%%% Styles applied to keywords, strings etc %%%%%%
  154 \newcommand{\lst@keywordstyle@key}[2][1]
  155 {\def\csname lst@keywordstyle#1\endcsname##1{#2{##1}}}
  156 \def\lst@keywordstyle{\csname lst@keywordstyle1\endcsname}
  157 \define@key{lst}{keywordstyle}{\@calloptsimple{\lst@keywordstyle@key}{#1}}
  158 %\define@key{lst}{keywordstyle}{\def\lst@kwdstyle##1{#1{##1}}}
  159 \define@key{lst}{ndkeywordstyle}{\@calloptsimple{\lst@keywordstyle@key}{[2]#1}}
  160 \define@key{lst}{rdkeywordstyle}{\@calloptsimple{\lst@keywordstyle@key}{[3]#1}}
  161 \define@key{lst}{otherkeywordstyle}{\def\lst@okwdstyle##1{#1{##1}}}
  162 \define@key{lst}{directivestyle}{\def\lst@directivestyle##1{#1{##1}}}
  163 \define@key{lst}{identifierstyle}[]{\def\lst@identifierstyle##1{#1{##1}}}
  164 \define@key{lst}{basicstyle}{\def\lst@basicstyle{#1}}
  165 \define@key{lst}{commentstyle}{\def\lst@commentstyle{#1}}
  166 \define@key{lst}{stringstyle}{\def\lst@stringstyle{#1}}
  167 \lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty}
  168 \lst@AddToHook{EmptyStyle}{\let\lst@commentstyle\em}
  169 \lst@AddToHook{EmptyStyle}{\let\lst@identifierstyle\@empty}
  170 \lst@AddToHook{EmptyStyle}{\let\lst@basicstyle\@empty}
  171 \lst@AddToHook{EmptyStyle}{\lst@keywordstyle@key[1]{\bfseries}}
  172 \lst@AddToHook{EmptyStyle}
  173 {\lst@keywordstyle@key[2]{\csname lst@keywordstyle1\endcsname}}
  174 \lst@AddToHook{EmptyStyle}
  175 {\lst@keywordstyle@key[3]{\csname lst@keywordstyle1\endcsname}}
  176 \lst@AddToHook{EmptyStyle}{\def\lst@okwdstyle{\lst@keywordstyle}}
  177 \lst@AddToHook{EmptyStyle}{\def\lst@directivestyle{\lst@keywordstyle}}
  178 \lst@AddToHook{EmptyStyle}{\def\lst@directivestyle{\lst@keywordstyle}}
  179 %%%%%% Emph identifiers, classes seems to be implemented properly
  180 \def\lst@defall#1#2{\def\csname #1\endcsname{#2}}
  181 \def\lst@emphstyle@key#1#2\@empty{\lst@defall{lst@emphstyle#1}{#2}}
  182 \def\lst@emphstyle{\csname lst@emphstyle1\endcsname}
  183 \lst@AddToHook{EmptyStyle}{\let\csname lst@emphstyle1\endcsname\@empty}
  184 \define@key{lst}{emphstyle}{\@callsubstopt{\lst@emphstyle@key}{1}{#1\@empty}}
  185 \def\lst@record@class#1#2{%
  186   \providecommand{\csname lst@allemph@#1\endcsname}{}%
  187   \lst@AddTo,{\csname lst@allemph@#1\endcsname}{\lst@normalize{#2}}}
  188 \def\lst@delete@class#1{%
  189   \ifu\csname lst@allemph@#1\endcsname\else
  190   \@callprim{\lst@delete@kwds}{\{\csname lst@allemph@#1\endcsname\}}%
  191   \lst@Empty{\csname lst@allemph@#1\endcsname}\fi}
  192 \def\lst@moreemph@key#1#2\@empty{%
  193   \lst@record@class{#1}{#2}%
  194   \lst@iter{\lst@install@kwd{\csname lst@emphstyle#1\endcsname}}{#2}}
  195 \define@key{lst}{moreemph}{\@callsubstopt{\lst@moreemph@key}{1}{#1\@empty}}
  196 %%%Class number is not checked...
  197 \def\lst@deleteemph@key#1#2\@empty{\lst@iter{\lst@delete@kwd}{#2}}
  198 \define@key{lst}{deleteemph}{\@callsubstopt{\lst@deleteemph@key}{1}{#1\@empty}}
  199 \def\lst@emph@key#1#2\@empty{%
  200   \lst@delete@class{#1}%  
  201   \lst@record@class{#1}{#2}%
  202   \lst@iter{\lst@install@kwd{\csname lst@emphstyle#1\endcsname}}{#2}}
  203 \define@key{lst}{emph}[]{\@callsubstopt\lst@emph@key{1}{#1\@empty}}
  204 %%%%%% Style definitions
  205 \define@key{lst}{style}[{}]{\lsthk@SetStyle\csname lst@sty#1\endcsname}
  206 \newcommand{\lstdefinestyle}[2]
  207   {\def\csname lst@sty#1\endcsname{\lstset{#2}}}
  208 %%%%%% Language definitions
  209 \newcommand{\lst@define@dd}[2][]
  210   {\newcommand{\csname lstdd@\MakeLowercase{#2}\endcsname}{\MakeLowercase{#1}}}
  211 \newcommand{\lst@mklang}[2][]
  212   {\ifthenelse{\equal{#1}{}}
  213     {lstlang@\MakeLowercase{#2}@\csname lstdd@\MakeLowercase{#2}\endcsname}
  214     {lstlang@\MakeLowercase{#2}@\MakeLowercase{#1}}}
  215 \newcommand{\lst@language@key}[2][]
  216   {\lst@UseHook{SetLanguage}%
  217   \csname\lst@mklang[#1]{#2}\endcsname%
  218   \lst@UseHook{AfterSetLanguage}}
  219 %  \lst@UseHook{AfterSetLanguage}}
  220 \lst@define@key@opt{language}{\lst@language@key}{}
  221 \newcommand{\lst@checkdd}[2]
  222   {\@ifundefined{lstdd@\MakeLowercase{#1}}{\lst@define@dd[#2]{#1}}{}}
  223 %Awfull hack to avoid defining XML language (hevea crash)
  224 \def\lst@XML{XML}
  225 \newcommand{\lst@definelanguage@}[3]
  226   {\def\@tmp{#1}\ifx\@tmp\lst@XML\else
  227   \lst@checkdd{#1}{#2}\def\csname\lst@mklang[#2]{#1}\endcsname{\lstset{#3}}\fi}
  228 \newcommand{\lst@derivelanguage@}[5]
  229   {\lst@checkdd{#1}{#2}%
  230   \def\csname\lst@mklang[#2]{#1}\endcsname{\csname\lst@mklang[#4]{#3}\endcsname
  231 %    \lst@UseHook{AfterSetLanguage}\lst@ResetHook{AfterSetLanguage}%
  232     \lstset{#5}}}
  233 \lst@define@key@opt{defaultdialect}{\lst@define@dd}{}
  234 %%%%%%% Frames
  235 \newstyle{.lstlisting}{font-family:monospace;white-space:pre;margin-right:auto;margin-left:0pt;text-align:left}
  236 \setenvclass{lstlisting}{lstlisting}
  237 \setenvclass{lstframe}{lstframe}
  238 \def\lst@bgcolor@in@temp{%
  239    \let\old@color\color%
  240    \renewcommand{\color}[2][!*!]{\@getstylecolor[##1]{##2}}%
  241    \prim@def\lst@temp@bgcolor{background-color:\lst@bgcolor;}%
  242    \let\color\old@color}
  243 \def\lst@rulecolor@in@temp{%
  244    \let\old@color\color%
  245    \renewcommand{\color}[2][!*!]{\@getstylecolor[##1]{##2}}%
  246    \prim@def\lst@temp@rulecolor{border-color:\lst@rulecolor;}%
  247    \let\color\old@color}
  248 \def\lst@border@none{border-style:none;}
  249 \def\lst@border@leftline{border-left-style:solid;}
  250 \def\lst@border@topline{border-top-style:solid;}
  251 \def\lst@border@bottomline{border-bottom-style:solid;}
  252 \def\lst@border@lines{border-style:solid none;}
  253 \def\lst@border@single{border-style:solid;}
  254 \def\lst@border@shadowbox{border-style:outset;}
  255 \def\lst@frame@in@temp{%
  256    \ifu\csname lst@border@\lst@frame\endcsname
  257    \prim@def\lst@temp@frame{\lst@see@frame{\lst@frame}}%
  258    \else
  259    \let\lst@temp@frame\csname lst@border@\lst@frame\endcsname
  260    \fi
  261 }
  262 \let\lst@whitepre\whitepretrue
  263 \lst@AddToHook{InitVar}
  264   {\ifu\lst@cell@needed
  265    \def\@@open@lstbox{\@open{DIV}{\envclass@attr{lstlisting}}}%
  266    \def\@close@lstbox{\@close{DIV}}%
  267    \else
  268    \ifu\lst@bgcolor\def\lst@temp@bgcolor{}\else\lst@bgcolor@in@temp\fi%
  269    \ifu\lst@rulecolor\def\lst@temp@rulecolor{}\else\lst@rulecolor@in@temp\fi%
  270    \ifu\lst@frame\def\lst@temp@frame{}\else\lst@frame@in@temp\fi%
  271    \def\@@open@lstbox{\@opencell{\envclass@attr[ ]{lstframe}style="padding:1ex;\lst@temp@bgcolor\lst@temp@frame\lst@temp@rulecolor"}{}{\envclass@attr{lstlisting}}}%
  272    \def\@close@lstbox{\@closecell}%
  273    \fi
  274    \def\@open@lstbox{\@@open@lstbox\lst@whitepre}}
  275 \def\colorwarning{\hva@warn{Colors in listings and 'color' package not loaded}}
  276 \define@key{lst}{backgroundcolor}
  277 {\ifu\color\colorwarning\else\def\lst@cell@needed{}\def\lst@bgcolor{#1}\fi}
  278 \define@key{lst}{frame}{\def\lst@cell@needed{}\def\lst@frame{#1}}
  279 \define@key{lst}{rulecolor}
  280 {\ifu\color\colorwarning\else\def\lst@cell@needed{}\def\lst@rulecolor{#1}\fi}
  281 \lst@iter{\ignore@key}
  282    {framexleftmargin,framexrightmargin,framextopmargin,framexbottommargin}
  283 \lst@iter{\ignore@key}{fillcolor,rulesepcolor}
  284 \lst@iter{\ignore@key}{framesep,rulesep,framerule}
  285 \lst@iter{\ignore@key}{frameround,captionpos}
  286 %%%%%%% Margins and line shape
  287 \def\lst@doindent#1{}
  288 \define@key{lst}{indent}{\def\lst@doindent{\hspace{#1}}}
  289 \define@key{lst}{xleftmargin}{\def\lst@doindent{\hspace{#1}}}
  290 \lst@iter{\ignore@key}
  291   {linewitdh,xrightmargin,resetmargin,prebreak,postbreak,%
  292 breakindent,breakautoindent}
  293 %%%%%%% Lines
  294 %%% Those two I don't care
  295 \define@key{lst}{numbersep}{}
  296 \define@key{lst}{numberblanklines}{}
  297 \newcounter{lstlabel}\newcounter{lstlastline}
  298 \lst@AddToHook{InitVar}{\let\@currentlabel\thelstlabel}
  299 \newcommand{\lst@saved@lastline}
  300   {\@ifundefined{lst@intname}{}
  301     {\@ifundefined{thelst@saved@\lst@intname}
  302       {0}
  303       {\value{lst@saved@\lst@intname}}}}
  304 \def\@lst@compute@firstline{%
  305 \@ifundefined{lst@intname}{\def\lst@firstline{1}}
  306    {\@ifundefined{thelst@saved@\lst@intname}{\def\lst@firstline{1}}
  307    {\def\lst@firstline{\csname thelst@saved@\lst@intname\endcsname+1}}}}
  308 \def\@auto{auto}\def\@last{last}
  309 \lst@AddToHook{Init}
  310   {\@ifundefined{lst@firstline}
  311     {\@lst@compute@firstline}
  312     {\ifx\lst@firstline\@auto\@lst@compute@firstline\fi
  313      \ifx\lst@firstline\@last\def\lst@firstline{\thelstlastline+1}\fi}}
  314 \define@key{lst}{name}{\def\lst@intname{#1}}
  315 \define@key{lst}{firstlabel}{\def\lst@firstline{#1}}
  316 \define@key{lst}{firstnumber}{\def\lst@firstline{#1}}
  317 \define@key{lst}{advancelabel}{\def\lst@firstline{\lst@saved@lastline+#1+1}}
  318 \lst@AddToHook{Init}{\setcounter{lstlabel}{\lst@firstline-1}}
  319 \lst@AddToHook{DeInit}
  320   {\setcounter{lstlastline}{\value{lstlabel}}%
  321    \@ifundefined{lst@intname}{}
  322      {\@ifundefined{thelst@saved@\lst@intname}
  323        {\newcounter{lst@saved@\lst@intname}%
  324        \gdef\csname thelst@saved@\lst@intname\endcsname{\arabic{lst@saved@\lst@intname}}}
  325        {}%
  326      \setcounter{lst@saved@\lst@intname}{\value{lstlabel}}}}
  327 \define@key{lst}{labelstyle}{\def\lst@labelstyle##1{{#1{##1}}}}
  328 \define@key{lst}{numberstyle}{\def\lst@labelstyle##1{{#1{##1}}}}
  329 \newcommand{\lst@labelstyle}[1]{#1}
  330 \define@key{lst}{labelstep}{\def\lst@labelstep{#1}}
  331 \define@key{lst}{stepnumber}{\def\lst@labelstep{#1}}
  332 \lst@AddToHook{InlineUnsave}{\def\lst@labelstep{1}}
  333 \lst@AddToHookExe{EmptyStyle}{\def\lst@labelstep{1}}
  334 \define@key{lst}{labelsep}{\def{\lst@labelsep}{\hspace{#1}}}
  335 \newcommand{\lst@labelsep}{\hspace{1ex}}
  336 \newcommand{\lst@pad}[1]{\@pad{\@print{ }}{4}{#1}}
  337 \newcommand{\lst@linenumber@}[1]
  338   {\lst@labelstyle{\lst@pad{#1}}\lst@labelsep}
  339 \newboolean{lst@numbers}
  340 \newcommand{\lst@linenumber}
  341   {\ifthenelse{\boolean{lst@numbers}}
  342      {\ifthenelse{\lst@labelstep=0}
  343        {}
  344        {\ifthenelse
  345          {0=\value{lstlabel}-\(\value{lstlabel}/\lst@labelstep\)*\lst@labelstep}
  346          {\lst@linenumber@{\thelstlabel}}
  347          {\lst@linenumber@{}}}}
  348      {}}
  349 \lst@AddToHook{InitVarEOL}{\stepcounter{lstlabel}}
  350 \newsavebox{\@prevlines}
  351 \newsavebox{\@curline}
  352 \ifhtml
  353 \ifu\lst@@br\def\lst@@br{
  354 }\fi
  355 \def\lst@@@br{\global\let\lst@br\lst@@br}%To avoid output of first line skip
  356 \else
  357 \ifu\lst@@br\let\lst@@br\@br\fi
  358 \let\lst@@@br\lst@@br
  359 \fi
  360 \lst@AddToHook{Init}
  361 {\def\lst@br{}}
  362 \newcommand{\lst@forget@lastline}
  363 {\sbox{\@curline}{}\setcounter{lst@spaces}{0}\addtocounter{lstlabel}{-1}}
  364 \newcommand{\@NewLine@}
  365 {\usebox{\@prevlines}\usebox{\@curline}\lst@spaces%
  366 \sbox{\@prevlines}{}\sbox{\@curline}{}\global\let\@NewLine\lst@spaces}
  367 \lst@AddToHook{EveryLine}{\setcounter{lst@spaces}{0}%
  368 \sbox{\@prevlines}{\usebox{\@prevlines}\usebox{\@curline}}%
  369 \sbox{\@curline}{\lst@br\@rawchars{\lst@doindent}\lst@linenumber}%
  370 \global\let\@NewLine\@NewLine@}
  371 \lst@AddToHook{LastLine}{\setcounter{lst@spaces}{0}%
  372 \sbox{\@prevlines}{\usebox{\@prevlines}\usebox{\@curline}}%
  373 \iflst@showlines\usebox{\@prevlines}\fi\sbox{\@prevlines}{}\sbox{\@curline}{}%
  374 \global\let\@NewLine\@NewLine@}
  375 \lst@AddToHook{Init}{\sbox{\@prevlines}{}\sbox{\@curline}{}\global\let\@NewLine\lst@spaces}
  376 \def\lst@numbers@none{\setboolean{lst@numbers}{false}}
  377 \def\lst@numbers@left{\setboolean{lst@numbers}{true}}
  378 \let\lst@numbers@right\lst@numbers@left
  379 \def\lst@numbers#1{\csname lst@numbers@#1\endcsname}
  380 \define@key{lst}{numbers}{\lst@numbers{#1}}
  381 \lst@AddToHookExe{EmptyStyle}{\lst@numbers{none}}
  382 %%%%%% TeX escapes
  383 \define@key{lst}{texcl}[true]{\def\lst@texcl{#1}}
  384 \setboolean{lst@texcl}{false}
  385 \lst@AddToHook{Init}
  386   {\@ifundefined{lst@texcl}{}
  387      {\setboolean{lst@texcl}{\lst@boolean{\lst@texcl}}}}
  388 \lst@AddToHook{DeInit}{\setboolean{lst@texcl}{false}}
  389 \define@key{lst}{mathescape}[true]{\def\lst@mathescape{#1}}
  390 \setboolean{lst@mathescape}{false}
  391 \lst@AddToHook{Init}
  392   {\@ifundefined{lst@mathescape}{}
  393      {\setboolean{lst@mathescape}{\lst@boolean{\lst@mathescape}}}}
  394 \lst@AddToHook{DeInit}{\setboolean{lst@mathescape}{false}}
  395 \def\lst@BET{}\def\lst@EET{}
  396 \newcommand{\lst@Esc@key}[2]
  397   {\def\lst@BET{\@rawchars{#1}}\def\lst@EET{\@rawchars{#2}}}
  398 \define@key{lst}{escapeinside}{\@callsubst{\lst@Esc@key}{#1{}}}
  399 \define@key{lst}{escapechar}[{}]{\lst@Esc@key#1#1}
  400 \def\lst@escapebegin{}
  401 \define@key{lst}{escapebegin}[]{\def\lst@escapebegin{#1}}
  402 \def\lst@escapeend{}
  403 \define@key{lst}{escapeend}[]{\def\lst@escapeend{#1}}
  404 %%%%%% Ignore input
  405 \newcommand{\lst@gobble}{0}
  406 \define@key{lst}{gobble}{\def\lst@gobble{#1}}
  407 \define@key{lst}{first}{\def\lst@first{#1}}
  408 \define@key{lst}{firstline}{\def\lst@first{#1}}
  409 \define@key{lst}{last}{\def\lst@last{#1}}
  410 \define@key{lst}{lastline}{\def\lst@last{#1}}
  411 \define@key{lst}{linerange}{\def\lst@linerange{#1}}
  412 \lst@AddToHook{PreSet}
  413 {\newcommand{\lst@first}{1}\newcommand{\lst@last}{99999}%
  414 \let\lst@linerange\@empty}
  415 \lst@AddToHook{Init}
  416 {\ifx\lst@linerange\@empty
  417 \prim@def\lst@linerange{{\lst@first}-{\lst@last}}\fi}
  418 % boolean includerangemarker key
  419 \define@key{lst}{includerangemarker}[true]{\def\lst@includerangemarker{#1}}
  420 \lst@AddToHook{Init}
  421 {\@ifundefined{lst@includerangemarker}
  422   {\setboolean{lst@includerangemarker}{true}}
  423   {\setboolean{lst@includerangemarker}{\lst@boolean{\lst@includerangemarker}}}}
  424 %prefix/suffix of markers, one prefix/suffix only
  425 \newtokens{\lst@rangebeginprefix}\newtokens{\lst@rangeendprefix}%
  426 \newtokens{\lst@rangebeginsuffix}\newtokens{\lst@rangeendsuffix}%
  427 \addtokens{\lst@rangebeginprefix}{}\addtokens{\lst@rangeendprefix}{}%
  428 \addtokens{\lst@rangebeginsuffix}{}\addtokens{\lst@rangeendsuffix}{}%
  429 \define@key{lst}{rangebeginprefix}{\addtokens{\lst@rangebeginprefix}{#1}}
  430 \define@key{lst}{rangebeginsuffix}{\addtokens{\lst@rangebeginsuffix}{#1}}
  431 \define@key{lst}{rangeendprefix}{\addtokens{\lst@rangeendprefix}{#1}}
  432 \define@key{lst}{rangeendsuffix}{\addtokens{\lst@rangeendbeginsuffix}{#1}}
  433 \define@key{lst}{rangeprefix}
  434   {\addtokens{\lst@rangebeginprefix}{#1}\addtokens{\lst@rangeendprefix}{#1}}
  435 \define@key{lst}{rangesuffix}
  436   {\addtokens{\lst@rangebeginsuffix}{#1}\addtokens{\lst@rangeendsuffix}{#1}}
  437 % boolean print key
  438 \define@key{lst}{print}[true]{\def\lst@print{#1}}
  439 \lst@AddToHook{Init}
  440   {\@ifundefined{lst@print}{\setboolean{lst@print}{true}}
  441      {\setboolean{lst@print}{\lst@boolean{\lst@print}}}}
  442 % showlines
  443 \define@key{lst}{showlines}[true]{\def\lst@showlines{#1}}
  444 \lst@AddToHook{Init}
  445 {\@ifundefined{lst@showlines}
  446   {\setboolean{lst@showlines}{false}}
  447   {\setboolean{lst@showlines}{\lst@boolean{\lst@showlines}}}}
  448 %%%%%%% Strings
  449 \newcommand{\lst@inactivate}[1]{\let#1\@empty}
  450 \newcommand{\lst@activate}[1]{#1}
  451 \lst@Hook{String}
  452 \lst@AddToHook{Init}{\let\lst@do\lst@activate\lst@UseHook{String}}
  453 \lst@AddToHook{SetLanguage}
  454 {\let\lst@do\lst@inactivate\lst@UseHook{String}}
  455 %\newcommand{\lst@stringizer@key@add}[2][]
  456 %  {\lst@AddToHook{String}{\lst@def@stringizer{#1}{#2}}}
  457 %\newcommand{\lst@stringizer@key}[2][]
  458 %  {\lst@ResetHook{String}\lst@AddToHook{String}{\lst@def@stringizer{#1}{#2}}}
  459 %\newcommand{\lst@stringizer@key@delete}[2][]{\lst@ResetHook{String}}
  460 %\lst@define@key@opt{stringizer}{\lst@stringizer@key}{}
  461 %\lst@define@key@opt{string}{\lst@stringizer@key}{}
  462 %\lst@define@key@opt{morestring}{\lst@stringizer@key@add}{}
  463 %\lst@define@key@opt{deletestring}{\lst@stringizer@key@delete}{}
  464 %%Real keys, that take all three arguments
  465 \newcommand{\lst@DS@key}[3]
  466 {\def\csname @is@string@#3\endcsname{}}%
  467 \newcommand{\lst@SS@key}[3]
  468 {\let\lst@do\lst@inactivate\lst@UseHook{String}%
  469 \lst@MS@key{#1}{#2}{#3}}%
  470 \newcommand{\lst@MS@key}[3]
  471 {\ifu\csname @recorded@string@#3\endcsname
  472 \let\csname @recorded@string@#3\endcsname\@empty
  473 \lst@AddToHook{String}
  474 {\lst@do{\csname @is@string@#3\endcsname}}\fi
  475 \def\csname @is@string@#3\endcsname{\lst@def@stringizer{#1}{#2}{#3}}}%
  476 %%Parse the  [][]{} arguments
  477 \newcommand{\lst@stringarg@one}[1][b]{\def\lst@arg@one{#1}\lst@stringarg@two}
  478 \newcommand{\lst@stringarg@two}[1][stringstyle]
  479 {\def\lst@arg@two{#1}\lst@stringarg@three}
  480 \newcommand{\lst@stringarg@three}[1]
  481 {\lst@cmd{\lst@arg@one}{\lst@arg@two}{#1}}
  482 %%%Real key handlers
  483 \newcommand{\lst@deletetring@key}{\let\lst@cmd\lst@DS@key\lst@stringarg@one}
  484 \newcommand{\lst@string@key}{\let\lst@cmd\lst@SS@key\lst@stringarg@one}
  485 \newcommand{\lst@morestring@key}{\let\lst@cmd\lst@MS@key\lst@stringarg@one}
  486 \define@key{lst}{deletestring}{\@callsubst{\lst@deletestring@key}{#1}}
  487 \define@key{lst}{stringizer}{\@callsubst{\lst@string@key}{#1}}
  488 \define@key{lst}{string}{\@callsubst{\lst@string@key}{#1}}
  489 \define@key{lst}{morestring}{\@callsubst{\lst@morestring@key}{#1}}
  490 % stringspaces
  491 \define@key{lst}{stringspaces}[true]{\def\lst@stringspaces{#1}}
  492 \define@key{lst}{showstringspaces}[false]{\def\lst@stringspaces{#1}}
  493 \setboolean{lst@stringspaces}{false}
  494 \lst@AddToHook{Init}
  495   {\@ifundefined{lst@stringspaces}{}
  496      {\setboolean{lst@stringspaces}{\lst@boolean{\lst@stringspaces}}}}
  497 \lst@AddToHook{DeInit}{\setboolean{lst@stringspaces}{false}}
  498 %%%%%% Comments
  499 % Line comments
  500 \newcommand{\lst@LC@key}[3]
  501   {\lst@lExtend\lst@DefineComments@LC
  502     {\lst@line@comment{#1}{#2}{\@rawchars{#3}}}}
  503 \define@key{lst}{commentline}{\lst@LC@key{commentstyle}{#1}}
  504 \lst@AddToHookExe{SetLanguage}{\let\lst@DefineComments@LC\@empty}
  505 \lst@AddToHook{SelectCharTable}{\lst@DefineComments@LC}
  506 % Nested comments
  507 \newcommand{\lst@NC@key}[3]
  508   {\lst@lExtend\lst@DefineComments@NC
  509      {\lst@nested@comment{#1}{\@rawchars{#2}}{\@rawchars{#3}}}}
  510 \define@key[2]{lst}{nestedcomment}{\lst@NC@key{commentstyle}{#1}{#2}}
  511 \lst@AddToHookExe{SetLanguage}{\let\lst@DefineComments@NC\@empty}
  512 \lst@AddToHook{SelectCharTable}{\lst@DefineComments@NC}
  513 % Balanced comments
  514 \newcommand{\lst@SC@key}[3]
  515    {\lst@lExtend\lst@DefineComments@SC
  516      {\lst@balanced@comment{#1}{\@rawchars{#2}}{\@rawchars{#3}}}}
  517 \define@key[2]{lst}{singlecomment}{\lst@SC@key{commentstyle}{#1}{#2}}
  518 \lst@AddToHookExe{SetLanguage}{\let\lst@DefineComments@SC\@empty}
  519 \lst@AddToHook{SelectCharTable}{\lst@DefineComments@SC}
  520 % Double comments: more or less single comment twice
  521 \newcommand{\lst@DC@key}[5]
  522    {\lst@lExtend\lst@DefineComments@DC
  523       {\lst@balanced@comment{#1}{\@rawchars{#2}}{\@rawchars{#3}}}%
  524    \lst@lExtend\lst@DefineComments@DC
  525       {\lst@balanced@comment{#1}{\@rawchars{#4}}{\@rawchars{#5}}}}
  526 \define@key[4]{lst}{doublecomment}{\lst@DC@key{commentstyle}{#1}{#2}{#3}{#4}}
  527 \lst@AddToHookExe{SetLanguage}{\let\lst@DefineComments@DC\@empty}
  528 \lst@AddToHook{SelectCharTable}{\lst@DefineComments@DC}
  529 %%%%%% New interface for comments grr...
  530 \newcommand{\lst@morecomment@d}[5][commentstyle]
  531 {\lst@DC@key{#1}{#2}{#3}{#4}{#5}}
  532 \newcommand{\lst@morecomment@s}[3][commentstyle]{\lst@SC@key{#1}{#2}{#3}}
  533 \newcommand{\lst@morecomment@is}[3][commentstyle]
  534 {\hva@warn{Invisible comments not implemented}%
  535 \lst@SC@key{#1}{#2}{#3}}
  536 \newcommand{\lst@morecomment@n}[3][commentstyle]{\lst@NC@key{#1}{#2}{#3}}
  537 %Notice the horible trick to parse morecomment=[l]\\
  538 \def\lst@LC@parse#1#2#3\@empty{\lst@LC@key{#1}{#2}{#3}}
  539 \newcommand{\lst@morecomment@l}[1][commentstyle]{\lst@LC@parse{visible}{#1}}
  540 \newcommand{\lst@morecomment@il}[1][commentstyle]
  541 {\hva@warn{Invisible comments not implemented}%
  542 \lst@LC@parse{visible}{#1}}
  543 %%%
  544 \def\lst@deletecomment@d{\let\lst@DefineComments@DC\@empty}
  545 \def\lst@deletecomment@s{\let\lst@DefineComments@SC\@empty}
  546 \def\lst@deletecomment@n{\let\lst@DefineComments@NC\@empty}
  547 \def\lst@deletecomment@l{\let\lst@DefineComments@LC\@empty}
  548 \def\lst@deletecomment@all{%
  549 \lst@deletecomment@d\lst@deletecomment@s%
  550 \lst@deletecomment@n\lst@deletecomment@l}
  551 \def\lst@till@empty#1\@empty{}
  552 \newcommand{\lst@morecomment@key}[1][]
  553   {\ifu\csname lst@morecomment@#1\endcsname
  554     \hva@warn{Unknown comment type '#1'}%
  555     \let\lst@next\lst@till@empty\else
  556     \let\lst@next\csname lst@morecomment@#1\endcsname\fi
  557     \lst@next}
  558 \newcommand{\lst@deletecomment@key}[1][]
  559   {\ifu\csname lst@deletecomment@#1\endcsname
  560    \hva@warn{Unknown comment type '#1'}\else
  561    \csname lst@deletecomment@#1\endcsname\fi
  562    \lst@till@empty}
  563 \newcommand{\lst@comment@key}[1][]
  564   {\ifu\csname lst@morecomment@#1\endcsname
  565     \hva@warn{Unknown comment type '#1'}%
  566     \let\lst@next\lst@till@empty\else
  567     \csname lst@deletecomment@all\endcsname
  568     \let\lst@next\csname lst@morecomment@#1\endcsname\fi
  569     \lst@next}
  570 \define@key{lst}{deletecomment}{\@callsubst{\lst@deletecomment@key}{#1\@empty}}
  571 \define@key{lst}{comment}{\@callsubst{\lst@comment@key}{#1\@empty}}
  572 \define@key{lst}{morecomment}{\@callsubst{\lst@morecomment@key}{#1\@empty}}
  573 %%%%%%% General delimiters
  574 %Line delimiters
  575 \newcommand{\lst@LD@key}[3]{
  576 \lst@lExtend\lst@Define@LD{\lst@line@delim{#1}{#2}{\@rawchars{#3}}}}
  577 \lst@AddToHookExe{SetLanguage}{\let\lst@Define@LD\@empty}
  578 \lst@AddToHook{SelectCharTable}{\lst@Define@LD}
  579 %Single delimiters
  580 \newcommand{\lst@SD@key}[4]
  581 {\lst@lExtend\lst@Define@SD
  582 {\lst@single@delim{#1}{#2}{\@rawchars{#3}}{\@rawchars{#4}}}}
  583 \lst@AddToHookExe{SetLanguage}{\let\lst@Define@SD\@empty}
  584 \lst@AddToHook{SelectCharTable}{\lst@Define@SD}
  585 %%General interface
  586 \def\lst@deletedelim@l{\let\lst@Define@LC\@empty}
  587 \def\lst@deletedelim@s{\let\lst@Define@SD\@empty}
  588 \def\lst@deletedelim@all{\lst@deletedelim@l\lst@deletedelim@s}
  589 \newcommand{\lst@deletedelim@key}[1][]
  590 {\ifu\csname lst@deletedelim@#1\endcsname
  591 \hva@warn{Unknown delimiter type '#1'}\else
  592 \csname lst@deletedelim@#1\endcsname\fi
  593 \lst@till@empty}
  594 %Trick to parse delim=[l]\\
  595 \def\lst@LD@parse#1#2#3\@empty{\lst@LD@key{#1}{#2}{#3}}
  596 \newcommand{\lst@moredelim@l}[1][\@empty]{\lst@LD@parse{visible}{#1}}
  597 \newcommand{\lst@moredelim@il}[1][\@empty]{\lst@LD@parse{invisible}{#1}}
  598 \newcommand{\lst@moredelim@s}[3][\@empty]{\lst@SD@key{visible}{#1}{#2}{#3}}
  599 \newcommand{\lst@moredelim@is}[3][\@empty]{\lst@SD@key{invisible}{#1}{#2}{#3}}
  600 %Awfull hack to ignore moredelim=*[directive]\# present in lstlang?.sty files
  601 %In that case the argument of \lst@moredelim@key is empty
  602 %and \lst@moredelim@ is called to eat all arguments up to the final \@empty
  603 \newcommand{\lst@moredelim@}{\let\lst@next\lst@till@empty\lst@next}
  604 \newcommand{\lst@moredelim@key}[1][]
  605 {\ifu\csname lst@moredelim@#1\endcsname
  606 \hva@warn{Unknown delimiter type '#1'}%
  607 \let\lst@next\lst@till@empty\else
  608 \let\lst@next\csname lst@moredelim@#1\endcsname\fi
  609 \lst@next}
  610 \newcommand{\lst@delim@key}[1][]
  611 {\ifu\csname lst@moredelim@#1\endcsname
  612 \hva@warn{Unknown delimiter type '#1'}%
  613 \let\lst@next\lst@till@empty\else
  614 \csname lst@deletedelim@all\endcsname
  615 \let\lst@next\csname lst@moredelim@#1\endcsname\fi
  616 \lst@next}
  617 \define@key{lst}{deletedelim}{\@callsubst{\lst@deletedelim@key}{#1\@empty}}
  618 \define@key{lst}{delim}{\@callsubst{\lst@delim@key}{#1\@empty}}
  619 \define@key{lst}{moredelim}{\@callsubst{\lst@moredelim@key}{#1\@empty}}
  620 %%%%%%% Extended chars and others
  621 \def\lst@extendedchars{true}
  622 \lst@AddToHook{DeInit}{\setboolean{lst@extendedchars}{true}}
  623 \lst@AddToHookExe{SetLanguage}{\setboolean{lst@extendedchars}{true}}
  624 \lst@AddToHook{SelectCharTable}
  625 {\setboolean{lst@extendedchars}{\lst@boolean{\lst@extendedchars}}}
  626 \define@key{lst}{extendedchars}[true]{\def\lst@extendedchars{#1}}
  627 \define@key{lst}{showspaces}[true]{\def\lst@showspaces{#1}}
  628 \setboolean{lst@showspaces}{false}
  629 \lst@AddToHook{Init}
  630   {\@ifundefined{lst@showspaces}{}
  631      {\setboolean{lst@showspaces}{\lst@boolean{\lst@showspaces}}}}
  632 %Tabs...
  633 \define@key{lst}{showtabs}[true]{\def\lst@showtabs{#1}}
  634 \setboolean{lst@showtabs}{false}
  635 \lst@AddToHook{Init}
  636   {\@ifundefined{lst@showtabs}{}
  637      {\setboolean{lst@showtabs}{\lst@boolean{\lst@showtabs}}}}
  638 \lst@AddToHook{DeInit}{\setboolean{lst@showtabs}{false}}
  639 \newcommand{\lst@tabsize}{8}
  640 \define@key{lst}{tabsize}[8]{\def\lst@tabsize{#1}}
  641 \define@key{lst}{tab}{\def\lst@tab{#1}}
  642 \lst@iter{\ignore@key}{inputencoding,formfeed}
  643 %%%%%%% Alter char categories
  644 \def\lst@alsoletter{}
  645 \define@key{lst}{alsoletter}{\def\lst@alsoletter{#1}}
  646 %%%%%%% Sensitive keywords
  647 \lst@AddToHookExe{DeInit}{\setboolean{lst@sensitive}{true}}
  648 \lst@AddToHook{SetLanguage}{\setboolean{lst@sensitive}{true}}
  649 \define@key{lst}{sensitive}[true]{\setboolean{lst@sensitive}{\lst@boolean{#1}}}
  650 %%%%%%% Captions
  651 %\lst@AddToHookExe{InlineUnsave}
  652 %{\let\lst@caption\@empty%
  653 %\let\lst@title\@empty\let\lst@label\@empty}
  654 %listing counter
  655 \@ifundefined{thechapter}
  656 {\newcounter{lstlisting}}
  657 {\newcounter{lstlisting}[chapter]
  658 \renewcommand\thelstlisting
  659 {\ifthenelse{\value{chapter} > 0}{\thechapter.}{}\arabic{lstlisting}}}
  660 \lst@AddToHook{InitVar}{\ifu\lst@caption\else\refstepcounter{lstlisting}\fi}
  661 %%Keys
  662 \define@key{lst}{label}{\def\lst@label{#1}}
  663 \define@key{lst}{title}{\def\lst@title{#1}}
  664 %\lst@define@key@opt{caption}{\lst@caption@key}{}
  665 \define@key{lst}{caption}{\@calloptsimple{\lst@caption@key}{#1}}
  666 \newcommand{\lst@caption@key}[2][]{\def\lst@caption{#2}}
  667 %%% Output Caption
  668 \def\listingname{Listing}
  669 \def\@lst@caption
  670 {\ifu\lst@caption%
  671 \ifu\lst@title\else\begin{center}\lst@title\end{center}\fi\else
  672 \begin{center}\listingname~\thelstlisting: %
  673 \ifu\lst@label\else\label{\lst@label}\fi\lst@caption\end{center}\\\fi}
  674 %%%%%%% Output
  675 % Treating spaces with a counter (and not with boxes) enables
  676 % optimized style managment
  677 \newcounter{lst@spaces}
  678 \def\lst@output@space{\stepcounter{lst@spaces}}
  679 \lst@AddToHook{Init}{\setcounter{lst@spaces}{0}}
  680 \newsavebox{\normalize@box}
  681 \def\lst@normalize#1{%
  682   \sbox{\normalize@box}
  683   {\iflst@sensitive\@rawchars{#1}\else\@rawchars{\MakeLowercase{#1}}\fi}%
  684   \usebox{\normalize@box}}
  685 \def\lst@output#1#2{%
  686 \@NewLine%\lstinfo{OUT: '#1' '#2'}%
  687 {\ifu\csname lstk@\lst@normalize{#1}\endcsname
  688   \lst@identifierstyle{#2}\else
  689   \csname lstk@\lst@normalize{#1}\endcsname{#2}\fi}}
  690 \def\lst@output@other#1#2{%
  691 \@NewLine%\lstinfo{OTHER: '#1' '#2'}%
  692 \ifu\csname lstk@\lst@normalize{#1}\endcsname
  693   #2\else
  694   {\csname lstk@\lst@normalize{#1}\endcsname{#2}}\fi}
  695 \newcounter{lst@save@spaces}
  696 \def\save@spaces
  697   {\setcounter{lst@save@spaces}{\value{lst@spaces}}\setcounter{lst@spaces}{0}}
  698 \def\restore@spaces
  699   {\setcounter{lst@spaces}{\value{lst@save@spaces}}}
  700 \def\lst@output@directive#1#2{%
  701 %\lstinfo{DIRECTIVE: '#1' '#2' '\thelst@spaces'}%
  702 \save@spaces\@NewLine\restore@spaces%
  703 \ifu\csname lstd@\lst@normalize{#1}\endcsname
  704   {\lst@directivestyle{\@print{#}}}%
  705   \lst@spaces\lst@output{#1}{#2}\else
  706   {\csname lstd@\lst@normalize{#1}\endcsname{\@print{#}\lst@spaces#2}}\fi}
  707 %%%%%% Pre and post (already obsolete)
  708 \let\lst@pre\@empty
  709 \let\lst@post\@empty
  710 \define@key{lst}{pre}{\def\lst@pre{#1}}
  711 \define@key{lst}{post}{\def\lst@post{#1}}
  712 %%% inputencodings (for compatibility only ?)
  713 \def\lst@inputencoding@key#1{\inputencoding{#1}}
  714 \define@key{lst}{inputencoding}{\lst@inputencoding@key{#1}}
  715 %%%%% Column allignement None !
  716 \lst@iter{\ignore@key}
  717   {columns,flexiblecolumns,keepspaces,basewidth,fontadjust,aboveskip,belowskip,lineskip,emptylines}
  718 %%%%%%% User interface
  719 \newcommand{\lstinputlisting}[2][]
  720   {\@scaninput{\begin{lstlisting}[#1]{}
  721 }{#2}{\end{lstlisting}}}
  722 \let\lstdefinelanguage\lst@definelanguage
  723 \newcommand{\lstloadlanguage}[1]{}
  724 %%%%%% Driver files are loaded directly!
  725 \lstset{defaultdialect=[95]Ada,
  726         defaultdialect=[68]Algol,
  727         defaultdialect=[ANSI]C,
  728         defaultdialect=[Objective]Caml,
  729         defaultdialect=[1985]Cobol,
  730         defaultdialect=[ANSI]C++,
  731         defaultdialect=[95]Fortran,
  732         defaultdialect=[3.0]Mathematica,
  733         defaultdialect=[Standard]Pascal,
  734         defaultdialect=[67]Simula,
  735         defaultdialect=[plain]TeX}
  736 \input{lstlang1.hva}
  737 \input{lstlang2.hva}
  738 \input{lstlang3.hva}
  739 %%%%%%%%%%% Inits
  740 \lst@UseHook{SetStyle}\lst@UseHook{EmptyStyle}
  741 \lst@UseHook{SetLanguage}\lst@UseHook{EmptyLanguage}
  742 \newsavebox{\lst@box}
  743 %%%%%% Alternative style, with explicit <BR> (for copy/paste)
  744 \newcommand{\lstavoidwhitepre}
  745 {\let\lst@@br\@br%
  746 \newstyle{.mouselstlisting}{font-family:monospace;margin-right:auto;margin-left:0pt;text-align:left}%
  747 \setenvclass{lstlisting}{mouselstlisting}%
  748 \let\lst@whitepre\@empty%
  749 \renewcommand{\lst@pad}[1]{\@pad{~}{4}{##1}}}