summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/back-ini.mkiv
blob: ff19d02299121f57f627a68590c559cb65e71a9b (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
%D \module
%D   [       file=back-ini,
%D        version=2009.04.15,
%D          title=\CONTEXT\ Backend Macros,
%D       subtitle=Initialization,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Backend Macros / Initialization}

\registerctxluafile{back-ini}{}

\unprotect

%D Right from the start \CONTEXT\ had a backend system based on runtime pluggable
%D code. As most backend issues involved specials and since postprocessors had not
%D that much in common, we ended up with a system where we could switch backend as
%D well as output code for multiple backends at the same time.
%D
%D Because \LUATEX\ has the backend built in, and since some backend issues have
%D been moved to the frontend I decided to provide new backend code for \MKIV,
%D starting with what was actually used.
%D
%D At this moment \DVI\ is no longer used for advanced document output and we
%D therefore dropped support for this format. Future versions might support more
%D backends again, but this has a low priority.

\ifdefined\outputmode
    \outputmode\plusone
    \let\outputmode\relax
    \newcount\outputmode
    \outputmode\plusone
    \let\normaloutputmode\outputmode
\fi

%D The exact page model depends on the backend so we just define some variables that
%D are used. A helper at the \LUA\ end will synchronize with the internal variables.
%D We store these in the format.

\ifdefined\everybackendshipout       \else \newtoks\everybackendshipout       \fi
\ifdefined\everylastbackendshipout   \else \newtoks\everylastbackendshipout   \fi
\ifdefined\everybackendlastinshipout \else \newtoks\everybackendlastinshipout \fi

\installcorenamespace{backend}

\installsetuponlycommandhandler \??backend {backend}

%D \starttyping
%D \setupbackend[space=yes]
%D \stoptyping

\appendtoks
    \clf_setrealspaces{\backendparameter\c!space}%
\to \everysetupbackend

\appendtoks
    \ifdefined\clf_resetmapfile
        \clf_resetmapfile
    \fi
\to \everysetupbackend

%D For older styles:

\let\setupoutput\gobbleoneoptional

\protect \endinput