%D \module
%D   [       file=catc-def,
%D        version=2006.09.18,
%D          title=\CONTEXT\ Catcode Macros,
%D       subtitle=Default Tables,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D The following catcode tables are rather \CONTEXT\ independent.

\ifdefined\nilcatcodes \else \newcatcodetable \nilcatcodes  \fi
\ifdefined\texcatcodes \else \newcatcodetable \texcatcodes  \fi
\ifdefined\luacatcodes \else \newcatcodetable \luacatcodes  \fi
\ifdefined\notcatcodes \else \newcatcodetable \notcatcodes  \fi
\ifdefined\vrbcatcodes \else \newcatcodetable \vrbcatcodes  \fi
\ifdefined\prtcatcodes \else \newcatcodetable \prtcatcodes  \fi

\startcatcodetable \nilcatcodes
    \catcode\tabasciicode      \spacecatcode
    \catcode\endoflineasciicode\endoflinecatcode
    \catcode\formfeedasciicode \endoflinecatcode
    \catcode\spaceasciicode    \spacecatcode
    \catcode\endoffileasciicode\ignorecatcode
\stopcatcodetable

\startcatcodetable \texcatcodes
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\caretasciicode     \superscriptcatcode
    \catcode\underscoreasciicode\subscriptcatcode
    \catcode\ampersandasciicode \alignmentcatcode
    \catcode`\\                 \escapecatcode
    \catcode`\{                 \begingroupcatcode
    \catcode`\}                 \endgroupcatcode
    \catcode`\$                 \mathshiftcatcode
    \catcode`\#                 \parametercatcode
    \catcode`\%                 \commentcatcode
\stopcatcodetable

\startcatcodetable \luacatcodes
    \catcode\tabasciicode       \othercatcode
    \catcode\endoflineasciicode \othercatcode
    \catcode\formfeedasciicode  \othercatcode
    \catcode\spaceasciicode     \othercatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\caretasciicode     \othercatcode
    \catcode\underscoreasciicode\othercatcode
    \catcode\ampersandasciicode \othercatcode
    \catcode`\\                 \escapecatcode
    \catcode`\%                 \othercatcode
    \catcode`\#                 \othercatcode
    \catcode`\|                 \othercatcode
    \catcode`\{                 \othercatcode
    \catcode`\}                 \othercatcode
    \catcode`\~                 \othercatcode
    \catcode`\$                 \othercatcode
\stopcatcodetable

\startcatcodetable \notcatcodes % probably less needed
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\caretasciicode     \othercatcode
    \catcode\underscoreasciicode\othercatcode
    \catcode\ampersandasciicode \othercatcode
    \catcode`\~                 \othercatcode
    \catcode`\#                 \othercatcode
    \catcode`\$                 \othercatcode
    \catcode`\%                 \othercatcode
    \catcode`\<                 \othercatcode
    \catcode`\>                 \othercatcode
    \catcode`\{                 \othercatcode
    \catcode`\}                 \othercatcode
    \catcode`\"                 \othercatcode
    \catcode`\'                 \othercatcode
    \catcode`\/                 \othercatcode
    \catcode`\\                 \othercatcode
    \catcode`\|                 \othercatcode
\stopcatcodetable

\startcatcodetable \vrbcatcodes % probably less needed
    \catcode\tabasciicode      \othercatcode
    \catcode\endoflineasciicode\othercatcode
    \catcode\formfeedasciicode \othercatcode
    \catcode\spaceasciicode    \othercatcode
    \catcode\endoffileasciicode\othercatcode
\stopcatcodetable

\startcatcodetable \prtcatcodes
    \catcode\tabasciicode       \spacecatcode
    \catcode\endoflineasciicode \endoflinecatcode
    \catcode\formfeedasciicode  \endoflinecatcode
    \catcode\spaceasciicode     \spacecatcode
    \catcode\endoffileasciicode \ignorecatcode
    \catcode\caretasciicode     \superscriptcatcode
    \catcode\underscoreasciicode\subscriptcatcode
    \catcode\ampersandasciicode \alignmentcatcode
    \catcode`\\                 \escapecatcode
    \catcode`\{                 \begingroupcatcode
    \catcode`\}                 \endgroupcatcode
    \catcode`\$                 \mathshiftcatcode
    \catcode`\#                 \parametercatcode
    \catcode`\%                 \commentcatcode
    \catcode`\@                 \lettercatcode
    \catcode`\!                 \lettercatcode
    \catcode`\?                 \lettercatcode
    \catcode`\~                 \activecatcode
    \catcode`\|                 \activecatcode
\stopcatcodetable

%D Because some characters have a special meaning, we provide
%D shortcuts to their character representation.

\chardef\^=\caretasciicode
\chardef\_=\underscoreasciicode % but way too wide in lm, so ... until that's fixed:
\chardef\&=\ampersandasciicode
\chardef\%=`\%
\chardef\#=`\#
\chardef\$=`\$
\chardef\{=`\{
\chardef\}=`\}
\chardef\\=`\\

%def\_{\leavevmode     \kern.06em \vbox{\hrule width.3em}}
\def\_{\dontleavehmode \kern.06em \vbox{\hrule width.3em}}

%D From now on we can use the protection mechanisms.

\def\unprotect {\pushcatcodetable\setcatcodetable\prtcatcodes}
\def\protect   {\popcatcodetable}

\endinput
