summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-ini.mkiv
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-11-19 20:15:06 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-11-19 20:15:06 +0100
commitadc43c3c243ed95215af6fe02d71e393c178da23 (patch)
treeaad04954cbfb0378c65fd2b98e7c924245aad372 /tex/context/base/syst-ini.mkiv
parent726a663be481042003566d4614266b940b5a0c91 (diff)
downloadcontext-adc43c3c243ed95215af6fe02d71e393c178da23.tar.gz
2015-11-19 19:15:00
Diffstat (limited to 'tex/context/base/syst-ini.mkiv')
-rw-r--r--tex/context/base/syst-ini.mkiv271
1 files changed, 147 insertions, 124 deletions
diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv
index b71713b00..b3193a393 100644
--- a/tex/context/base/syst-ini.mkiv
+++ b/tex/context/base/syst-ini.mkiv
@@ -63,6 +63,8 @@
\chardef\xetexengine = 2
\chardef\luatexengine = 3
+\chardef\statuswrite = 128
+
\ifx\directlua\undefined
\ifx\XeTeXversion\undefined
\ifx\pdftexversion\undefined
@@ -80,9 +82,9 @@
\ifnum\texengine=\luatexengine
% for historic reasons we keep some mkii code around
\else
- \immediate\write16{>>>}
- \immediate\write16{>>> only luatex is supported}
- \immediate\write16{>>>}
+ \immediate\write\statuswrite{>>>}
+ \immediate\write\statuswrite{>>> only luatex is supported}
+ \immediate\write\statuswrite{>>>}
\let\dump\relax
\expandafter\end
\fi
@@ -91,48 +93,20 @@
\directlua 0 { % this info is stored in the format
lua.name[0] = "main ctx instance"
- local extraprimitives = tex.extraprimitives
- local enableprimitives = tex.enableprimitives
- local core = extraprimitives("core")
- local btex = extraprimitives("tex")
- local etex = extraprimitives("etex")
- local pdftex = extraprimitives("pdftex")
- local luatex = extraprimitives("luatex")
- local omega = { % now luatex
- "pagewidth", "pageheight",
- "textdir", "pagedir", "mathdir", "pardir", "bodydir",
- "leftghost", "rightghost",
- "localleftbox", "localrightbox",
- "localinterlinepenalty", "localbrokenpenalty",
- }
- local aleph = { % now luatex
- "boxdir",
- "pagebottomoffset", "pagerightoffset",
- }
- for _, subset in next, { etex, pdftex, luatex, omega, aleph } do
- enableprimitives("",subset)
- end
- for _, subset in next, { core, btex, etex, pdftex, luatex, omega, aleph } do
- enableprimitives("normal",subset)
- end
-}
-
-% for the moment:
-\ifdefined\pagewidth \else \let\pagewidth \pdfpagewidth \let\normalpagewidth \pdfpagewidth \fi
-\ifdefined\pageheight \else \let\pageheight \pdfpageheight \let\normalpageheight \pdfpageheight \fi
+ local coreprimitives = tex.extraprimitives("core")
+ local texprimitives = tex.extraprimitives("tex")
+ local etexprimitives = tex.extraprimitives("etex")
+ local luatexprimitives = tex.extraprimitives("luatex")
-\ifdefined\adjustspacing \else \let\adjustspacing \pdfadjustspacing \let\normaladjustspacing \adjustspacing \fi
-\ifdefined\protrudechars \else \let\protrudechars \pdfprotrudechars \let\normalprotrudechars \protrudechars \fi
+ tex.enableprimitives("",etexprimitives)
+ tex.enableprimitives("",luatexprimitives)
-\ifdefined\pdfxform \else \let\pdfxform \saveboxresource \let\normalpdfxform \pdfxform \fi
-\ifdefined\pdflastxform \else \let\pdflastxform \lastsavedboxresourceindex \let\normalpdflastxform \pdflastxform \fi
-\ifdefined\pdfrefxform \else \let\pdfrefxform \useboxresource \let\normalpdfrefxform \pdfrefxform \fi
-
-\ifdefined\pdfximage \else \let\pdfximage \saveimageresource \let\normalpdfximage \pdfximage \fi
-\ifdefined\pdflastximage \else \let\pdflastximage \lastsavedimageresourceindex \let\normalpdflastximage \pdflastximage \fi
-\ifdefined\pdflastximagepages\else \let\pdflastximagepages \lastsavedimageresourcepages \let\normalpdflastximagepages\pdflastximagepages\fi
-\ifdefined\pdfrefximage \else \let\pdfrefximage \useimageresource \let\normalpdfrefximage \pdfrefximage \fi
+ tex.enableprimitives("normal",coreprimitives)
+ tex.enableprimitives("normal",texprimitives)
+ tex.enableprimitives("normal",etexprimitives)
+ tex.enableprimitives("normal",luatexprimitives)
+}
%D \ETEX\ has a not so handy way of telling you the version number, i.e. the revision
%D number has a period in it:
@@ -191,8 +165,8 @@
\countdef \c_syst_min_allocated_register = 52 \c_syst_min_allocated_register = 256 % can change
\countdef \c_syst_max_allocated_register = 53 \c_syst_max_allocated_register = 32767
-\countdef \c_syst_min_allocated_iochannel = 54 \c_syst_min_allocated_iochannel = -1
-\countdef \c_syst_max_allocated_iochannel = 55 \c_syst_max_allocated_iochannel = 16
+\countdef \c_syst_min_allocated_read = 54 \c_syst_min_allocated_read = -1
+\countdef \c_syst_max_allocated_read = 55 \c_syst_max_allocated_read = 16
\countdef \c_syst_min_allocated_language = 56 \c_syst_min_allocated_language = 0
\countdef \c_syst_max_allocated_language = 57 \c_syst_max_allocated_language = 255
\countdef \c_syst_max_allocated_insert = 58 \c_syst_max_allocated_insert = 254
@@ -200,6 +174,8 @@
\countdef \c_syst_min_allocated_family = 60 \c_syst_min_allocated_family = 128
\countdef \c_syst_max_allocated_family = 61 \c_syst_max_allocated_family = 255
\countdef \c_syst_min_allocated_attribute = 62 \c_syst_min_allocated_attribute = 1024 % 127-1023 : private
+\countdef \c_syst_min_allocated_write = 63 \c_syst_min_allocated_write = 0 % luatex >= 0.82
+\countdef \c_syst_max_allocated_write = 64 \c_syst_max_allocated_write = 127 % luatex >= 0.82
\countdef \c_syst_last_allocated_count = 32 \c_syst_last_allocated_count = \c_syst_min_allocated_register
\countdef \c_syst_last_allocated_dimen = 33 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register
@@ -207,8 +183,8 @@
\countdef \c_syst_last_allocated_muskip = 35 \c_syst_last_allocated_muskip = \c_syst_min_allocated_register
\countdef \c_syst_last_allocated_box = 36 \c_syst_last_allocated_box = \c_syst_min_allocated_register
\countdef \c_syst_last_allocated_toks = 37 \c_syst_last_allocated_toks = \c_syst_min_allocated_register
-\countdef \c_syst_last_allocated_read = 38 \c_syst_last_allocated_read = \c_syst_min_allocated_iochannel
-\countdef \c_syst_last_allocated_write = 39 \c_syst_last_allocated_write = \c_syst_min_allocated_iochannel
+\countdef \c_syst_last_allocated_read = 38 \c_syst_last_allocated_read = \c_syst_min_allocated_read
+\countdef \c_syst_last_allocated_write = 39 \c_syst_last_allocated_write = \c_syst_min_allocated_write
\countdef \c_syst_last_allocated_marks = 40 \c_syst_last_allocated_marks = \c_syst_min_allocated_register
\countdef \c_syst_last_allocated_language = 41 \c_syst_last_allocated_language = \c_syst_min_allocated_language % not used in context
\countdef \c_syst_last_allocated_insertion = 42 \c_syst_last_allocated_insertion = \c_syst_min_allocated_insert
@@ -246,8 +222,8 @@
\normalprotected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register}
\normalprotected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \mathchardef\c_syst_max_allocated_register}
\normalprotected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register}
-\normalprotected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_iochannel}
-\normalprotected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_iochannel}
+\normalprotected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \chardef \c_syst_max_allocated_read}
+\normalprotected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \chardef \c_syst_max_allocated_write}
\normalprotected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \mathchardef\c_syst_max_allocated_register}
\normalprotected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert}
@@ -280,7 +256,7 @@
%D as all engines now provide many registers we removed all traces.
\ifdefined\writestatus \else
- \normalprotected\def\writestatus#1#2{\immediate\write16{#1: #2}}
+ \normalprotected\def\writestatus#1#2{\immediate\write\statuswrite{#1: #2}}
\fi
\def\syst_basics_allocate_yes#1#2#3#4#5% last class method max name
@@ -324,6 +300,121 @@
\normalprotected\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}}
+%D For the moment:
+
+% for the moment (till 0.82)
+
+\ifdefined\outputmode \else \let\outputmode \pdfoutput \fi
+
+\ifdefined\pagewidth \else \let\pagewidth \pdfpagewidth \let\normalpagewidth \pdfpagewidth \fi
+\ifdefined\pageheight \else \let\pageheight \pdfpageheight \let\normalpageheight \pdfpageheight \fi
+
+\ifdefined\adjustspacing \else \let\adjustspacing \pdfadjustspacing \let\normaladjustspacing \adjustspacing \fi
+\ifdefined\protrudechars \else \let\protrudechars \pdfprotrudechars \let\normalprotrudechars \protrudechars \fi
+
+\ifdefined\saveboxresource \else \let\saveboxresource \pdfxform \let\normalsaveboxresource \saveboxresource \fi
+\ifdefined\lastsavedboxresourceindex \else \let\lastsavedboxresourceindex \pdflastxform \let\normallastsavedboxresourceindex \lastsavedboxresourceindex \fi
+\ifdefined\useboxresource \else \let\useboxresource \pdfrefxform \let\normaluseboxresource \useboxresource \fi
+
+\ifdefined\saveimageresource \else \let\saveimageresource \pdfximage \let\normalsaveimageresource \saveimageresource \fi
+\ifdefined\lastsavedimageresourceindex\else \let\lastsavedimageresourceindex\pdflastximage \let\normallastsavedimageresourceindex\lastsavedimageresourceindex \fi
+\ifdefined\lastsavedimageresourcepages\else \let\lastsavedimageresourcepages\pdflastximagepages \let\normallastsavedimageresourcepages\lastsavedimageresourcepages \fi
+\ifdefined\useimageresource \else \let\useimageresource \pdfrefximage \let\normaluseimageresource \useimageresource \fi
+
+% for the moment, this will move to the backend module
+
+\ifdefined\pdfextension
+
+ \normalprotected\def\pdfliteral {\pdfextension literal }
+ \normalprotected\def\pdfcolorstack {\pdfextension colorstack }
+ \normalprotected\def\pdfsetmatrix {\pdfextension setmatrix }
+ \normalprotected\def\pdfsave {\pdfextension save\relax}
+ \normalprotected\def\pdfrestore {\pdfextension restore\relax}
+ \normalprotected\def\pdfobj {\pdfextension obj }
+ \normalprotected\def\pdfrefobj {\pdfextension refobj }
+ \normalprotected\def\pdfannot {\pdfextension annot }
+ \normalprotected\def\pdfstartlink {\pdfextension startlink }
+ \normalprotected\def\pdfendlink {\pdfextension endlink\relax}
+ \normalprotected\def\pdfoutline {\pdfextension outline }
+ \normalprotected\def\pdfdest {\pdfextension dest }
+ \normalprotected\def\pdfthread {\pdfextension thread }
+ \normalprotected\def\pdfstartthread {\pdfextension startthread }
+ \normalprotected\def\pdfendthread {\pdfextension endthread\relax}
+ \normalprotected\def\pdfinfo {\pdfextension info }
+ \normalprotected\def\pdfcatalog {\pdfextension catalog }
+ \normalprotected\def\pdfnames {\pdfextension names }
+ \normalprotected\def\pdfincludechars {\pdfextension includechars }
+ \normalprotected\def\pdffontattr {\pdfextension fontattr }
+ \normalprotected\def\pdfmapfile {\pdfextension mapfile }
+ \normalprotected\def\pdfmapline {\pdfextension mapline }
+ \normalprotected\def\pdftrailer {\pdfextension trailer }
+ \normalprotected\def\pdfglyphtounicode {\pdfextension glyphtounicode }
+
+\fi
+
+\ifdefined\pdfextension
+
+ \def\pdftexversion {\numexpr\pdffeedback version}
+ \def\pdftexrevision {\pdffeedback revision}
+ \def\pdflastlink {\numexpr\pdffeedback lastlink}
+ \def\pdfretval {\numexpr\pdffeedback retval}
+ \def\pdflastobj {\numexpr\pdffeedback lastobj}
+ \def\pdflastannot {\numexpr\pdffeedback lastannot}
+ \def\pdfxformname {\numexpr\pdffeedback xformname}
+ \def\pdfcreationdate {\pdffeedback creationdate}
+ \def\pdffontname {\numexpr\pdffeedback fontname}
+ \def\pdffontobjnum {\numexpr\pdffeedback fontobjnum}
+ \def\pdffontsize {\dimexpr\pdffeedback fontsize}
+ \def\pdfpageref {\numexpr\pdffeedback pageref}
+ \def\pdfcolorstackinit {\pdffeedback colorstackinit}
+
+\fi
+
+\ifdefined\pdfxform \else
+ \let \pdfxform \saveboxresource
+ \let \pdflastxform \lastsavedboxresourceindex
+ \let \pdfrefxform \useboxresource
+ \let \pdfximage \saveimageresource
+ \let \pdflastximage \lastsavedimageresourceindex
+ \let \pdflastximagepages \lastsavedimageresourcepages
+ \let \pdfrefximage \useimageresource
+\fi
+
+\ifdefined\pdfvariable
+
+ \edef\pdfcompresslevel {\pdfvariable compresslevel} \pdfcompresslevel 9
+ \edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} \pdfobjcompresslevel 1
+ \edef\pdfdecimaldigits {\pdfvariable decimaldigits} \pdfdecimaldigits 3
+ \edef\pdfgamma {\pdfvariable gamma} \pdfgamma 1000
+ \edef\pdfimageresolution {\pdfvariable imageresolution} \pdfimageresolution 71
+ \edef\pdfimageapplygamma {\pdfvariable imageapplygamma} \pdfimageapplygamma 0
+ \edef\pdfimagegamma {\pdfvariable imagegamma} \pdfimagegamma 2200
+ \edef\pdfimagehicolor {\pdfvariable imagehicolor} \pdfimagehicolor 1
+ \edef\pdfimageaddfilename {\pdfvariable imageaddfilename} \pdfimageaddfilename 1
+ \edef\pdfpkresolution {\pdfvariable pkresolution} \pdfpkresolution 72
+ \edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} \pdfinclusioncopyfonts 0
+ \edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} \pdfinclusionerrorlevel 0
+ \edef\pdfreplacefont {\pdfvariable replacefont} \pdfreplacefont 0
+ \edef\pdfgentounicode {\pdfvariable gentounicode} \pdfgentounicode 0
+ \edef\pdfpagebox {\pdfvariable pagebox} \pdfpagebox 0
+ \edef\pdfminorversion {\pdfvariable minorversion} \pdfminorversion 4
+ \edef\pdfuniqueresname {\pdfvariable uniqueresname} \pdfuniqueresname 0
+
+ \edef\pdfhorigin {\pdfvariable horigin} \pdfhorigin 1in
+ \edef\pdfvorigin {\pdfvariable vorigin} \pdfvorigin 1in
+ \edef\pdflinkmargin {\pdfvariable linkmargin} \pdflinkmargin 0pt
+ \edef\pdfdestmargin {\pdfvariable destmargin} \pdfdestmargin 0pt
+ \edef\pdfthreadmargin {\pdfvariable threadmargin} \pdfthreadmargin 0pt
+
+ \edef\pdfpagesattr {\pdfvariable pagesattr}
+ \edef\pdfpageattr {\pdfvariable pageattr}
+ \edef\pdfpageresources {\pdfvariable pageresources}
+ \edef\pdfxformattr {\pdfvariable xformattr}
+ \edef\pdfxformresources {\pdfvariable xformresources}
+ \edef\pdfpkmode {\pdfvariable pkmode}
+
+\fi
+
%D \macros
%D {scratchcounter,
%D scratchdimen,scratchskip,scratchmuskip,
@@ -425,6 +516,7 @@
\chardef \plusten = 10
\chardef \plussixteen = 16
\chardef \plushundred = 100
+\chardef \plustwohundred = 200
\chardef \pluscxxvii = 127
\chardef \pluscxxviii = 128
\chardef \pluscclv = 255
@@ -963,53 +1055,10 @@
\spanomit \advance\mscount\minusone
\repeat}
-%D The next section deals with selective definitions in later modules. One can of
-%D course use the \type {\texengine} number that we defined earlier instead.
-
-\bgroup \obeylines
- \gdef\pickupSOMETEX#1%
- {\expandafter\gdef\csname begin#1\endcsname{\bgroup\obeylines\dopickupSOMETEX{#1}}}
- \gdef\dopickupSOMETEX#1#2
- % {\egroup\immediate\write16{special code for #1 -> [line \the\inputlineno] \detokenize{#2}}}
- {\egroup}
-\egroup
-
-\let\endTEX \relax \def\beginTEX #1\endTEX {}
-\let\endETEX \relax \def\beginETEX #1\endETEX {}
-\let\endXETEX \relax \def\beginXETEX #1\endXETEX {}
-\let\endLUATEX\relax \def\beginLUATEX#1\endLUATEX{}
-\let\endOLDTEX\relax \def\beginOLDTEX#1\endOLDTEX{}
-\let\endNEWTEX\relax \def\beginNEWTEX#1\endNEWTEX{}
-
-\pickupSOMETEX{ETEX}
-
-\ifnum\texengine=\xetexengine
- \pickupSOMETEX{XETEX}
-\fi
-\ifnum\texengine=\luatexengine
- \pickupSOMETEX{LUATEX}
-\fi
-\ifnum\texengine<\xetexengine
- \pickupSOMETEX{OLDTEX}
-\else
- \pickupSOMETEX{NEWTEX}
-\fi
-
-%D \macros
-%D {bindprimitive}
-%D
-%D We can remap primitives (which is needed because of changes in for instance
-%D \PDFTEX).
-
-\def\bindprimitive#1 #2 % new old
- {\ifcsname#1\endcsname \else \ifcsname#2\endcsname
- \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
- \fi \fi}
-
%D We need to make sure that we start up in \DVI\ mode, so, after testing for running
%D \PDFTEX, we default to \DVI. Why?
-\pdfoutput \zerocount
+\outputmode \zerocount
\pdfminorversion \plusseven
\pdfgentounicode \plusone
\pdfinclusioncopyfonts \plusone
@@ -1026,10 +1075,6 @@
\normalpdfcompression
-% \let\normalsetrandomseed \setrandomseed
-% \let\normaluniformdeviate\uniformdeviate
-% \let\normalnormaldeviate \normaldeviate
-
%D Basic status stuff.
\newif\ifproductionrun
@@ -1044,28 +1089,6 @@
\def\modulonumber#1#2{\the\numexpr#2-((((#2+(#1/2))/#1)-1)*#1)\relax}
\def\dividenumber#1#2{\the\numexpr(#2-(#1/2))/#1\relax}
-% \ifnum\texengine=\xetexengine
-% \edef\xetexversion {\numexpr\XeTeXversion*100+(\expandafter\gobbleoneargument\XeTeXrevision-5)/10\relax}
-% \edef\xetexrevision {\the\numexpr(\expandafter\gobbleoneargument\XeTeXrevision-50)/100\relax}
-% \fi
-%
-% \ifcase\texengine
-% \def \texenginename {impossible}
-% \edef\texengineversion{0}
-% \or
-% \def \texenginename {pdfTeX}
-% \edef\texengineversion{\dividenumber{100}\pdftexversion.\modulonumber{100}\pdftexversion.\pdftexrevision}
-% \or
-% \def \texenginename {XeTeX}
-% \edef\texengineversion{\dividenumber{100}\xetexversion .\modulonumber{100}\xetexversion .\xetexrevision}
-% \or
-% \def \texenginename {LuaTeX}
-% \edef\texengineversion{\dividenumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision}
-% \else
-% \def \texenginename {impossible}
-% \edef\texengineversion{0}
-% \fi
-
\def \texenginename {LuaTeX}
\edef\texengineversion{\dividenumber{100}\luatexversion.\modulonumber{100}\luatexversion.\luatexrevision}
@@ -1084,10 +1107,10 @@
%D Handy.
-\suppresslongerror \plusone
-\suppressoutererror \plusone
-\suppressmathparerror \plusone
-\suppressifcsnameerror\plusone
+\suppresslongerror \plusone % \let\suppresslongerror \relax
+\suppressoutererror \plusone % \let\suppressoutererror \relax
+\suppressmathparerror \plusone % \let\suppressmathparerror \relax
+\suppressifcsnameerror\plusone % \let\suppressifcsnameerror\relax
\ifdefined\matheqnogapstep % for now
\matheqnogapstep \zerocount
@@ -1124,7 +1147,7 @@
\normalprotected\def\installsystemnamespace#1%
{\ifcsname ??#1\endcsname
- \immediate\write16{fatal error: duplicate system namespace '#1'}%
+ \immediate\write\statuswrite{fatal error: duplicate system namespace '#1'}%
\expandafter\normalend
\else
\global\advance\c_syst_helpers_n_of_namespaces\plusone