%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.

\ifx\nilcatcodes \undefined \newcatcodetable \nilcatcodes  \fi
\ifx\texcatcodes \undefined \newcatcodetable \texcatcodes  \fi
\ifx\luacatcodes \undefined \newcatcodetable \luacatcodes  \fi
\ifx\notcatcodes \undefined \newcatcodetable \notcatcodes  \fi
\ifx\vrbcatcodes \undefined \newcatcodetable \vrbcatcodes  \fi
\ifx\prtcatcodes \undefined \newcatcodetable \prtcatcodes  \fi

\startcatcodetable \nilcatcodes
    \catcode`\^^I = 10 % ascii tab is a blank space
    \catcode`\^^M =  5 % ascii return is end-line
    \catcode`\^^L =  5 % ascii form-feed
    \catcode`\    = 10 % ascii space is blank space
    \catcode`\^^Z =  9 % ascii eof is ignored
\stopcatcodetable

\startcatcodetable \texcatcodes
    \catcode`\^^I = 10
    \catcode`\^^M =  5
    \catcode`\^^L =  5
    \catcode`\    = 10
    \catcode`\^^Z =  9
    \catcode`\\   =  0
    \catcode`\{   =  1
    \catcode`\}   =  2
    \catcode`\$   =  3
    \catcode`\&   =  4
    \catcode`\#   =  6
    \catcode`\^   =  7
    \catcode`\_   =  8
    \catcode`\%   = 14
\stopcatcodetable

\startcatcodetable \luacatcodes
    \catcode`\^^I = 12 % ascii tab is a blank space
    \catcode`\^^M = 12 % ascii return is end-line
    \catcode`\^^L = 12 % ascii form-feed
    \catcode`\    = 12 % ascii space is blank space
    \catcode`\^^Z =  9 % ascii eof is ignored
    \catcode`\\   =  0
    \catcode`\%   = 12
    \catcode`\#   = 12
    \catcode`\_   = 12
    \catcode`\^   = 12
    \catcode`\&   = 12
    \catcode`\|   = 12
    \catcode`\{   = 12
    \catcode`\}   = 12
    \catcode`\~   = 12
    \catcode`\$   = 12
\stopcatcodetable

\startcatcodetable \notcatcodes
    \catcode`\^^I = 10 % ascii tab is a blank space
    \catcode`\^^M =  5 % ascii return is end-line
    \catcode`\^^L =  5 % ascii form-feed
    \catcode`\    = 10 % ascii space is blank space
    \catcode`\^^Z =  9 % ascii eof is ignored
    \catcode`\~   = 12
    \catcode`\#   = 12 % probably too much, in principle
    \catcode`\$   = 12 % nilcatcodes would be ok too
    \catcode`\%   = 12
    \catcode`\^   = 12
    \catcode`\&   = 12
    \catcode`\_   = 12
    \catcode`\<   = 12
    \catcode`\>   = 12
    \catcode`\{   = 12
    \catcode`\}   = 12
    \catcode`\"   = 12
    \catcode`\'   = 12
    \catcode`\/   = 12
    \catcode`\\   = 12
    \catcode`\|   = 12
\stopcatcodetable

\startcatcodetable \vrbcatcodes % probably less needed
    \catcode`\^^I = 12
    \catcode`\^^M = 12
    \catcode`\^^L = 12
    \catcode`\    = 12
    \catcode`\^^Z = 12
\stopcatcodetable

\startcatcodetable \prtcatcodes
    \catcode`\^^I = 10
    \catcode`\^^M =  5
    \catcode`\^^L =  5
    \catcode`\    = 10
    \catcode`\^^Z =  9
    \catcode`\\   =  0
    \catcode`\{   =  1
    \catcode`\}   =  2
    \catcode`\$   =  3
    \catcode`\&   =  4
    \catcode`\#   =  6
    \catcode`\^   =  7
    \catcode`\_   =  8
    \catcode`\%   = 14
    \catcode`\@   = 11
    \catcode`\!   = 11
    \catcode`\?   = 11
    \catcode`\~   = 13
    \catcode`\|   = 13
\stopcatcodetable

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

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

%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
