catc-act.mkxl /size: 2051 b    last modification: 2023-12-21 09:44
1%D \module
2%D   [       file=catc-act,
3%D        version=2006.09.18,
4%D          title=\CONTEXT\ Catcode Macros,
5%D       subtitle=Default Catcode Tables,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\unprotect
15
16%D \macros
17%D   {installactivecharacter, defineactivecharacter}
18%D
19%D This module deals with some active character handling and I still need to
20%D update it to use \typ {\letcharcode <number> = \something}. This module
21%D will be simplified stepwise. Look into the \MKIV\ variant for originals.
22%D
23%D There was a time when we had active double quotes and such but we no longer
24%D do that. In fact, only the tilde and bar can be active in \CONTEXT.
25%D
26%D For those who love the more obscure features of \TEX: whenever you see
27%D uppercase magic with active characters, keep in mind that this is something
28%D deep down in the engine: handling of that specific case. The code here is
29%D not used and not really tested.
30
31\permanent\protected\def\installactivecharacter#1 %
32  {\ifchknumber#1\or
33     \scratchcounter\lastchknumber
34     \edef\scratchmacro{\expandtoken\othercatcode\scratchcounter}%
35   \else
36     \scratchcounter`#1%
37     \let\scratchmacro#1%
38   \fi
39   \normalexpanded{\startextendcatcodetable\ctxcatcodes\catcode\the\scratchcounter\activecatcode\stopextendcatcodetable}%
40   \letcatcodecommand \ctxcatcodes \scratchcounter \scratchmacro
41   \ifnum\currentcatcodetable=\ctxcatcodes \setcatcodetable\ctxcatcodes \fi}
42
43\permanent\protected\def\defineactivecharacter #1 #2%
44  {\ifchknumber#1\or\letcharcode\lastchknumber=#2\relax\else\letcharcode`#1=#2\relax\fi}
45
46\permanent\protected\def\makecharacteractive #1 %
47  {\catcode`#1\activecatcode}
48
49\permanent\protected\def\installanddefineactivecharacter #1 #2%
50  {\normalexpanded{\installactivecharacter \utfchar{#1} }%
51   \defineactivecharacter #1 #2}
52
53\protect \endinput
54