| 1 |
\global\newtoks\lstCcolors |
| 2 |
\global\newtoks\_C_listingcommands |
| 3 |
|
| 4 |
\global\lstCcolors={ |
| 5 |
\definecolor{preprocessor}{rgb}{0 0 1} |
| 6 |
\definecolor{special char}{rgb}{.7 0 .7} |
| 7 |
\definecolor{keyword}{rgb}{1 0 0} |
| 8 |
\definecolor{quote}{rgb}{.6 .6 0} |
| 9 |
} |
| 10 |
|
| 11 |
\global\_C_listingcommands={ |
| 12 |
\the\lstCcolors |
| 13 |
\replace {\string\"} {{\string\"}} |
| 14 |
\replacefromto "" {\mc{quote}{"#1"}} |
| 15 |
\replacefromto {//}\n {\c{lst-comment}{//#1}\n} |
| 16 |
\replacefromto {/*}{*/} {\mc{lst-comment}{/*#1*/}} |
| 17 |
\replacefromto {\string#}\n {\c{preprocessor}{\string##1}\n} |
| 18 |
\bgroup\lccode`?=`\{\lccode`!=`\}\lccode`.=`\%\lowercase{\egroup |
| 19 |
\replace ?{\w\c{special char}{?}\w}% |
| 20 |
\replace !{\w\c{special char}{!}\w}% |
| 21 |
\replace .{\w\c{special char}{.}\w}% |
| 22 |
} |
| 23 |
\edef\_regA{{!@\string$\string^\string&*()-+=[];:,.<>/}}%$ |
| 24 |
\def\_regB#1{\replace{#1}{\w\c{special char}{#1}\w}} |
| 25 |
\_xp\map\_xp\_regB\_regA |
| 26 |
\def\_regB#1{\replace{\w#1\w}{\w\c{keyword}{#1}\w}} |
| 27 |
\map\_regB{% |
| 28 |
{auto}{bool}{break}{case}{char}{const}{continue}{default}{do}{double}{else}{enum}% |
| 29 |
{extern}{false}{float}{for}{goto}{if}{inline}{int}{long}{NULL}{register}{restrict}% |
| 30 |
{return}{short}{signed}{sizeof}{static}{struct}{switch}{true}{typedef}{union}% |
| 31 |
{unsigned}{void}{volatile}{while}% |
| 32 |
} |
| 33 |
\def\_regB#1{\replace{\w#1}{\w\c{lst-number}{#1}\w}} |
| 34 |
\map\_regB{0123456789} |
| 35 |
} |