diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2010-05-24 14:05:02 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2010-05-24 14:05:02 +0000 |
commit | 57ea7dad48fbf2541c04e434c31bde655ada3ac4 (patch) | |
tree | 1f8b43bc7cb92939271e1f5bec610710be69097f /Master/texmf-dist/tex/context/base/core-sys.mkiv | |
parent | 6ee41e1f1822657f7f23231ec56c0272de3855e3 (diff) |
here is context 2010.05.24 13:05
git-svn-id: svn://tug.org/texlive/trunk@18445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-sys.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/core-sys.mkiv | 149 |
1 files changed, 78 insertions, 71 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-sys.mkiv b/Master/texmf-dist/tex/context/base/core-sys.mkiv index f30c8a958cb..649e5e65c9b 100644 --- a/Master/texmf-dist/tex/context/base/core-sys.mkiv +++ b/Master/texmf-dist/tex/context/base/core-sys.mkiv @@ -15,6 +15,8 @@ \writestatus{loading}{ConTeXt Core Macros / System} +\registerctxluafile{core-sys}{1.001} + \unprotect %D Version checking: @@ -36,29 +38,61 @@ %newlinechar=10 \def\outputnewlinechar{\rawcharacter{10}} \newlinechar=10 \edef\outputnewlinechar{^^J} -% in case formats are shared: +\edef\operatingsystem {\ctxlua{tex.write(os.platform)}} + +\def\jobfilename {\ctxlua{tex.sprint(tex.texcatcodes,environment.jobfilename or "")}} +\def\jobfilesuffix {\ctxlua{tex.sprint(tex.texcatcodes,environment.jobfilesuffix or "")}} +\def\inputfilebarename{\ctxlua{tex.sprint(tex.texcatcodes,environment.inputfilebarename or "")}} +\def\inputfilesuffix {\ctxlua{tex.sprint(tex.texcatcodes,environment.inputfilesuffix or "")}} +\def\inputfilename {\ctxlua{tex.sprint(tex.texcatcodes,environment.inputfilename or "")}} +\def\outputfilename {\ctxlua{tex.sprint(tex.texcatcodes,environment.outputfilename or "")}} \def\initializenewlinechar {\bgroup\newlinechar=10\xdef\outputnewlinechar{^^J}\egroup} -%D Job names. - -\def\outputfilename {\@@svfile} -\def\inputfilename {\@@svinputfile} -\def\operatingsystem{\@@svtype} +\newtoks \everysetupsystem -\let\jobfilename \jobname -\let\jobfilesuffix\c!tex +\unexpanded\def\setupsystem + {\dosingleargument\dosetupsystem} -\def\splitjobfilename % todo: mkiv - {\resetsystemmode{suffix-\jobfilesuffix}% - \edef\ascii{\inputfilename}\defconvertedcommand\ascii\ascii - \splitstring\ascii\at.\to\jobfilename\and\jobfilesuffix - \lowercasestring\jobfilesuffix\to\jobfilesuffix - \doifnothing\jobfilename {\let\jobfilename \jobname}% - % todo and totest: \defconvertedcommand\jobfilename\jobfilename - \doifnothing\jobfilesuffix{\let\jobfilesuffix\c!tex}% - \setsystemmode{suffix-\jobfilesuffix}} +\def\dosetupsystem[#1]% + {\getparameters[\??sv][#1]% + \the\everysetupsystem} + +\appendtoks + \edef\outputresolution{\@@svresolution}% +\to \everysetupsystem + +\appendtoks + \ifcase\@@svn + % % 0 : unknown + \or + \setsystemmode\v!first % 1 : first run + \or + % % 2 : successive run + \or + \setsystemmode\v!first % 3 : first and only run + \or + \setsystemmode\v!last % 4 : (extra) last run + \fi +\to \everysetupsystem + +\appendtoks + \edef\outputfilename{\@@svfile}% + \edef\inputfilename {\@@svinputfile}% +\to \everysetupsystem + +\let\@@jobsuffix\s!unknown + +\appendtoks + \resetsystemmode{suffix-\@@jobsuffix}% + \edef\@@jobsuffix{\jobsuffix}% + \setsystemmode{suffix-\@@jobsuffix}% +\to \everysetupsystem + +\appendtoks + \ctxlua {commands.updatefilenames("\inputfilename","\outputfilename")}% +\to \everysetupsystem % Some mechanisms (see x-res-01) use either \jobfilename or % \jobfilename.somesuffix, in which case we need to use the @@ -72,41 +106,23 @@ {\let\jobfullname\empty} {\doif\jobfilesuffix\c!tex{\edef\jobfullname{\jobfilename.#1}}}} -% ... - -\def\dosetupsystem[#1]% - {\getparameters[\??sv][#1]% - \setuprandomize[\@@svrandom]% - \beforesplitstring\@@svresolution\at dpi\to\@@svresolution - \let\outputresolution\@@svresolution - \ifcase\@@svn - % % 0 : unknown - \or - \setsystemmode\v!first % 1 : first run - \or - % % 2 : successive run - \or - \setsystemmode\v!first % 3 : first and only run - \or - \setsystemmode\v!last % 4 : (extra) last run - \fi -% \processaction -% [\@@svtype] -% %[ mswin=>\edef\@@svline{\rawcharacter{13}\rawcharacter{10}}, % crlf -% [ mswin=>\edef\@@svline{\rawcharacter{13}}, % cr % crlf -% darwin=>\edef\@@svline{\rawcharacter{13}}, % cr -% \s!unknown=>\edef\@@svline{\rawcharacter{10}}]% % lf - \splitjobfilename} - -% \edef\@@svline{\rawcharacter{10}} % unix is the most critical/sensitive system - \let\systemendofline\outputnewlinechar % will become obsolete -\def\setupsystem - {\dosingleargument\dosetupsystem} - \def\systemparameter#1{\executeifdefined{\??sv#1}\empty} +%D There are a couple of system states avaiable: +%D +%D \starttabulate [|T|T|] +%D \NC \type{\jobname} \NC \jobname \NC \NR +%D \NC \type{\jobfilename} \NC \jobfilename \NC \NR +%D \NC \type{\jobfilesuffix} \NC \jobfilesuffix \NC \NR +%D \NC \type{\inputfilename} \NC \inputfilename \NC \NR +%D \NC \type{\inputfilebarename} \NC \inputfilebarename \NC \NR +%D \NC \type{\inputfilesuffix} \NC \inputfilesuffix \NC \NR +%D \NC \type{\outputfilename} \NC \outputfilename \NC \NR +%D \NC \type{\operatingsystem} \NC \operatingsystem \NC \NR +%D \stoptabulate + %D The system modes set by the setup command can be used in %D situations like: %D @@ -120,7 +136,7 @@ %D \stoptext %D \stoptyping -\def\setuprandomize[#1]% +\unexpanded\def\setuprandomize[#1]% {\doifsomething{#1} {\bgroup % tex's time is in minutes @@ -134,14 +150,14 @@ \s!default=>\getnewrandomseed\scratchcounter, \s!unknown=>\scratchcounter#1]% \expanded{\setrandomseed{\the\scratchcounter}}% -% \writestatus\m!systems{randomseed: \the\scratchcounter}% + % \writestatus\m!systems{randomseed: \the\scratchcounter}% \egroup}} \setupsystem [\c!directory=, \c!n=0, % 0:unknown 1: one run 2: first 3: successive 4: final run - \c!resolution=600dpi, - \c!random=, + \c!resolution=600,% in dpi, no unit in mkiv + %c!random=, % obsolete here \c!file=\jobname, \c!inputfile=\outputfilename, \c!type=unix, % windows is normally less sensitive to handle @@ -164,10 +180,10 @@ {\globaldefs\getvalue{@gd@\the\globaldefs}\relax} {\globaldefs\zerocount}} -\def\startlocal {\dostartglobaldefs>-} -\def\stoplocal {\dostopglobaldefs} -\def\startglobal {\dostartglobaldefs<+} -\def\stopglobal {\dostopglobaldefs} +\unexpanded\def\startlocal {\dostartglobaldefs>-} +\unexpanded\def\stoplocal {\dostopglobaldefs} +\unexpanded\def\startglobal {\dostartglobaldefs<+} +\unexpanded\def\stopglobal {\dostopglobaldefs} \def\complexstart[#1]{\bgroup\getvalue{\e!start#1}} \def\complexstop [#1]{\getvalue{\e!stop #1}\egroup} @@ -187,7 +203,7 @@ \c!commands=, \c!style=, #2]% - \unexpanded\setvalue{#1}% + \setuvalue{#1}% {\groupedcommand {\getvalue{\??be#1\c!commands}% \dostartattributes{\??be#1}\c!style\c!color} @@ -207,14 +223,14 @@ {\def\docommand##1{\dododefinestartstop[##1][#2]}% \processcommalist[#1]\docommand} -\def\definestartstop +\unexpanded\def\definestartstop {\dodoubleargument\dodefinestartstop} \def\dosetupstartstop[#1][#2]% {\def\docommand##1{\getparameters[\??be##1][#2]}% \processcommalist[#1]\docommand} -\def\setupstartstop +\unexpanded\def\setupstartstop {\dodoubleargument\dosetupstartstop} % \docommand kan niet worden gebruikt omdat deze macro @@ -227,10 +243,10 @@ % \def\executeprotected#1% % {\csname\??pc\string#1\endcsname} % -% \def\defineprotected#1#2% +% \unexpanded\def\defineprotected#1#2% % {\expandafter\def\csname\??pc\string#2\endcsname} % -% \def\defineunprotected#1% +% \unexpanded\def\defineunprotected#1% % {\def#1} % % \def\doprotected% @@ -334,7 +350,7 @@ % end % \stopluacode % -% \def\define#1#{\ctxlua{commands.define([[\detokenize{#1}]])}} +% \unexpanded\def\define#1#{\ctxlua{commands.define([[\detokenize{#1}]])}} % % \starttext % \define[2]\whatevera{#1+#2} @@ -413,13 +429,4 @@ \def\defreducedargument {\dodefreducedargument\edef} \def\gdefreducedargument{\dodefreducedargument\xdef} -\startruntimeluacode - \ctxlua { - environment.inputfilename = "\inputfilename" - environment.outputfilename = "\outputfilename" - environment.jobfilename = "\jobfilename" - environment.jobfilesuffix = "\jobfilesuffix" - } -\stopruntimeluacode - \protect \endinput |