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}{autosuffix} 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%D The exact page model depends on the backend so we just define some variables that 34%D are used. A helper at the \LUA\ end will synchronize with the internal variables. 35%D We store these in the format. 36 37\ifdefined\everybackendshipout \else \newtoks\everybackendshipout \fi 38\ifdefined\everylastbackendshipout \else \newtoks\everylastbackendshipout \fi 39\ifdefined\everybackendlastinshipout \else \newtoks\everybackendlastinshipout \fi 40 41\installcorenamespace{backend} 42 43\installsetuponlycommandhandler \??backend {backend} 44 45%D \starttyping 46%D \setupbackend[space=yes] 47%D \stoptyping 48 49\appendtoks 50 {\backendparameter\c!space}% 51\to \everysetupbackend 52 53\appendtoks 54 {\backendparameter\c!hyphen}% 55\to \everysetupbackend 56 57\setupbackend 58 [\c!space=\v!yes, % is now default 59 \c!hyphen=\v!yes] 60 61%D For the moment this is an experiment (defauls is pdf, but we also 62%D have lua, json and mps). 63%D 64%D \starttyping 65%D % \setupoutput[lua] 66%D % \setupoutput[json] 67%D % \setupoutput[mps] 68%D % \setupoutput[none] % for testing only 69%D % \setupoutput[empty] % for testing only 70%D 71%D \starttext 72%D \dorecurse{1000}{ 73%D {\tf \red \samplefile{tufte}} \par 74%D {\bf \green \samplefile {ward}} \par 75%D {\sl \blue \samplefile{davis}} \par 76%D } 77%D \stoptext 78%D \stoptyping 79 80\permanent\protected\def\setupoutput[#1]% 81 {{#1}% 82 {\backendparameter\c!space}} 83 84\protect \endinput 85 |