back-ini.mkiv /size: 2358 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=back-ini,
3%D        version=2009.04.15,
4%D          title=\CONTEXT\ Backend Macros,
5%D       subtitle=Initialization,
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\writestatus{loading}{ConTeXt Backend Macros / Initialization}
15
16\registerctxluafile{back-ini}{}
17
18\unprotect
19
20%D Right from the start \CONTEXT\ had a backend system based on runtime pluggable
21%D code. As most backend issues involved specials and since postprocessors had not
22%D that much in common, we ended up with a system where we could switch backend as
23%D well as output code for multiple backends at the same time.
24%D
25%D Because \LUATEX\ has the backend built in, and since some backend issues have
26%D been moved to the frontend I decided to provide new backend code for \MKIV,
27%D starting with what was actually used.
28%D
29%D At this moment \DVI\ is no longer used for advanced document output and we
30%D therefore dropped support for this format. Future versions might support more
31%D backends again, but this has a low priority.
32
33\outputmode\plusone
34\let\outputmode\relax
35\newcount\outputmode
36\outputmode\plusone
37\let\normaloutputmode\outputmode
38
39%D The exact page model depends on the backend so we just define some variables that
40%D are used. A helper at the \LUA\ end will synchronize with the internal variables.
41%D We store these in the format.
42
43\ifdefined\everybackendshipout       \else \newtoks\everybackendshipout       \fi
44\ifdefined\everylastbackendshipout   \else \newtoks\everylastbackendshipout   \fi
45\ifdefined\everybackendlastinshipout \else \newtoks\everybackendlastinshipout \fi
46
47%D In \MKIV\ there is just one backend, \PDF, plus an additional export. We never
48%D came to seperate them, but \LMTX\ might do that.
49
50\installcorenamespace{backend}
51
52\installsetuponlycommandhandler \??backend {backend}
53
54%D \starttyping
55%D \setupbackend[space=yes]
56%D \stoptyping
57
58\appendtoks
59    \clf_setrealspaces{\backendparameter\c!space}%
60\to \everysetupbackend
61
62\appendtoks
63    \ifdefined\clf_resetmapfile
64        \clf_resetmapfile
65    \fi
66\to \everysetupbackend
67
68\unexpanded\def\setupoutput[#1]%
69  {\clf_enabledriver{#1}}
70
71\protect \endinput
72