summaryrefslogtreecommitdiff
path: root/tex/context/base/core-syn.mkiv
blob: 8996940ddfc899f63811b917b7e1feef1213d9d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%D \module
%D   [       file=core-syn,
%D        version=1997.03.31,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Synonyms and Sorts,
%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.

\unprotect

\registerctxluafile{core-syn}{1.001}

\appendtoks
    \immediatewriteutilitytua{if not job.sortedlists then job.sortedlists = { } end}%
    \immediatewriteutilitytua{local js = job.sortedlists}%
\to \everyopenutilities

\let\allsortedlists\empty

\appendtoks
    \processcommacommand[\allsortedlists]\mkdodefinesortedlist
    \globallet\allsortedlists\empty
\to \everyopenutilities

\def\mkdodefinesortedlist#1% class
  {\ctxlua{job.definesortedlist('#1')}%
   \immediatewriteutilitytua{job.definesortedlist('#1')}}

\def\mkdefinesortedlist#1% class
  {\mkdodefinesortedlist{#1}%
   \doglobal\addtocommalist{#1}\allsortedlists}

\def\mksavesortedlistentry#1#2#3#4% class key entry meaning
  {\immediatewriteutilitytua{table.insert(js['#1'],{'e','#1',\!!bs#2\!!es,\!!bs#3\!!es})}}

\def\mksavesortedlistvariable#1#2#3% class type value
  {\immediatewriteutilitytua{table.insert(js['#1'],{'#2','#3'})}}

\def\mkloadsortedlist#1% class
  {\bgroup
   \getvalue{\s!set#1}%
   \ctxlua{job.loadsortedlist('#1')}%
   \getvalue{\s!reset#1}%
   \egroup}

\protect \endinput