diff options
Diffstat (limited to 'tex/context/base/java-ini.tex')
-rw-r--r-- | tex/context/base/java-ini.tex | 154 |
1 files changed, 73 insertions, 81 deletions
diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex index 666a1c89e..85f4a8876 100644 --- a/tex/context/base/java-ini.tex +++ b/tex/context/base/java-ini.tex @@ -200,16 +200,15 @@ %D \stopJScode %D \stoptypen -\long\gdef\startJScode#1 #2 +\long\def\startJScode#1 #2 {\doifelse{#2}{uses} - {\def\next{\dostartJScodeA{#1}}} - {\def\next{\dostartJScodeB{#1} #2 }}% - \next} + {\dostartJScodeA{#1}} + {\dostartJScodeB{#1} #2 }} -\long\gdef\dostartJScodeA#1#2 #3\stopJScode% +\long\def\dostartJScodeA#1#2 #3\stopJScode {\long\setgvalue{\r!java#1}{\do{#2}{#3}}} -\long\gdef\dostartJScodeB#1#2\stopJScode% +\long\def\dostartJScodeB#1#2\stopJScode {\long\setgvalue{\r!java#1}{\do{}{#2}}} \let\stopJScode\relax @@ -232,7 +231,7 @@ \def\setverbosecscharacter#1% {\edef#1{\string#1}} -\def\setverbosecscharacters% temporary hack +\def\setverbosecscharacters % temporary hack {\setverbosecscharacter |\setverbosecscharacter ~% \setverbosecscharacter\:\setverbosecscharacter\;% \setverbosecscharacter\+\setverbosecscharacter\-% @@ -251,10 +250,10 @@ \def\presetJScode#1#2% #1=operation #2=arguments {\setverbosecscharacters \def\par{\delcharacter}% was: { } - \scratchcounter=0 - \global\let\JScode=\empty + \scratchcounter\zerocount + \globallet\JScode\empty \def\do##1##2% - {\doifelse{##2}{!}{\directJScodetrue}{\directJScodefalse}}% + {\doifelse{##2}{!}\directJScodetrue\directJScodefalse}% \getvalue{\r!java#1}% \edef\!!stringa{#2}% \ifx\!!stringa\empty \else @@ -262,7 +261,7 @@ \fi \def\docommando##1% {\doifundefinedelse{\r!java\r!java##1} - {\showmessage{\m!javascript}{2}{##1}} + {\showmessage\m!javascript2{##1}} {\useJSpreamblenow{##1}}}% % {\doglobal\increment\currentJSpreamble % \doglobal\addtocommalist{##1}\allJSpreambles}}% @@ -273,20 +272,17 @@ \getvalue{\r!java#1}} \def\dopresetJSvariables#1% - {\advance\scratchcounter 1 + {\advance\scratchcounter \plusone \donefalse \dodopresetJSvariables#1\end}% -\def\dodopresetJSvariables% - {\doifnextcharelse{R} - {\dodopresetJSrefvariables} - {\doifnextcharelse{V} - {\dodopresetJSvervariables} - {\doifnextcharelse{S} - {\dodopresetJSstrvariables} - {\dodopresetJSrawvariables}}}} +\def\dodopresetJSvariables + {\doifnextcharelse{R}\dodopresetJSrefvariables + {\doifnextcharelse{V}\dodopresetJSvervariables + {\doifnextcharelse{S}\dodopresetJSstrvariables + \dodopresetJSrawvariables}}} -\def\dodopresetJSrefvariables R#1\end% +\def\dodopresetJSrefvariables R#1\end {\doifreferencefoundelse{#1} {\donetrue \dododopresetJSvariables R{\referenceprefix#1}% \donefalse\dododopresetJSvariables P{\currentrealreference}} @@ -295,16 +291,16 @@ \donetrue\dododopresetJSvariables S{#1}% \fi} -\def\dodopresetJSvervariables V#1\end% +\def\dodopresetJSvervariables V#1\end {\donefalse\dododopresetJSvariables V{#1}% \ifminimalizeJScode \else \donetrue\dododopresetJSvariables S{#1}% \fi} -\def\dodopresetJSstrvariables S#1\end% +\def\dodopresetJSstrvariables S#1\end {\donetrue\dododopresetJSvariables S{#1}} -\def\dodopresetJSrawvariables #1\end% +\def\dodopresetJSrawvariables #1\end {\donetrue\dododopresetJSvariables S{#1}} \def\JSprefix#1% @@ -363,17 +359,16 @@ {\bgroup % we need to restore the catcodes \popendofline % just in case it happens while reading lists \doifelse{#2}{used} - {\def\next{\dostartJSpreamble#1 }} - {\def\next{\dostartJSpreamble#1 now #2 }}% - \next} + {\dostartJSpreamble#1 } + {\dostartJSpreamble#1 now #2 }} \long\def\dostartJSpreamble#1 #2 #3\stopJSpreamble% {\processaction [#2] - [ later=>\chardef\JSstatus=0, - now=>\chardef\JSstatus=1, - \s!default=>\chardef\JSstatus=2, - \s!unknown=>\chardef\JSstatus=2]% + [ later=>\chardef\JSstatus0,% + now=>\chardef\JSstatus1,% + \s!default=>\chardef\JSstatus2,% + \s!unknown=>\chardef\JSstatus2]% \presetJSfunctions #3function ()\end \long\setgvalue{\r!java\r!java#1}{#3}% \ifcase\JSstatus \else @@ -425,12 +420,12 @@ \def\getJSpreamble#1% {\getvalue{\r!java\r!java#1}} -\def\presetJSpreamble% +\def\presetJSpreamble {\ifx\allJSpreambles\empty\else \bgroup \setverbosecscharacters \def\par{\delcharacter}% was: { } - \global\let\JSpreamble=\empty + \globallet\JSpreamble\empty \def\@@collectedJSpreamble{\r!java\r!java collected}% \letvalue{\@@collectedJSpreamble}=\empty \def\docommando##1% @@ -446,18 +441,18 @@ \ifoneJSpreamble \gdef\allJSpreambles{collected}% \fi - \global\let\presetJSpreamble\relax + \globallet\presetJSpreamble\relax \egroup \fi} -\def\flushJSpreamble% +\def\flushJSpreamble {\iflocation\ifx\allJSpreambles\empty\else \ifcase\nofJSpreambles\else\ifnum\nofJSpreambles=\currentJSpreamble \bgroup \presetJSpreamble \expanded{\doflushJSpreamble{\allJSpreambles}}% - \global\let\flushJSpreamble\relax - \global\let\allJSpreambles\empty + \globallet\flushJSpreamble\relax + \globallet\allJSpreambles\empty \egroup \fi\fi \fi\fi} @@ -467,7 +462,7 @@ \flushJSpreamble \ifcase\currentJSpreamble\relax\else \savecurrentvalue\nofJSpreambles\currentJSpreamble - \global\let\currentJSpreamble\nofJSpreambles + \globallet\currentJSpreamble\nofJSpreambles \fi \fi} @@ -484,7 +479,7 @@ \def\doPSsanitizeJScode#1\to#2% {\begingroup - \scratchcounter=0 % \aftergroup counter + \scratchcounter\zerocount % \aftergroup counter \aftergroup\xdef \aftergroup#2% \aftergroup{% @@ -526,15 +521,15 @@ \newif\ifaddJSlinebreaks -\def\flushJSisTEX% +\def\flushJSisTEX {\ifcase\JSisTEX \or \aftergroup T% \or \aftergroup T\aftergroup E% \or \aftergroup T\aftergroup E\aftergroup X% \fi - \chardef\JSisTEX=0 } + \chardef\JSisTEX0 } -\def\doJSlinebreak% +\def\doJSlinebreak {\ifaddJSlinebreaks \aftergroup\string\aftergroup\n% \fi} @@ -542,18 +537,18 @@ \def\dodoPSsanitizeJScode#1% % input stack>500 & TEX check {\if#1/% \ifnum\JScomment=0 - \chardef\JScomment=1 + \chardef\JScomment1 \else\ifnum\JScomment=1 - \chardef\JScomment=2 + \chardef\JScomment2 \fi\fi \else \ifnum\JScomment=1 \aftergroup/% - \chardef\JScomment=0 + \chardef\JScomment0 \fi \ifnum\JScomment=2 \if#1\delcharacter - \chardef\JScomment=0 + \chardef\JScomment0 \fi \else \if#1\delcharacter @@ -565,13 +560,13 @@ \else\if#1;% \flushJSisTEX\aftergroup;\doJSlinebreak \else\if#1T% - \ifnum\JSisTEX=0 \chardef\JSisTEX=1 \else\flushJSisTEX\aftergroup T\fi + \ifnum\JSisTEX=0 \chardef\JSisTEX1 \else\flushJSisTEX\aftergroup T\fi \else\if#1E% - \ifnum\JSisTEX=1 \chardef\JSisTEX=2 \else\flushJSisTEX\aftergroup E\fi + \ifnum\JSisTEX=1 \chardef\JSisTEX2 \else\flushJSisTEX\aftergroup E\fi \else\if#1X% - \ifnum\JSisTEX=2 \chardef\JSisTEX=3 \else\flushJSisTEX\aftergroup X\fi + \ifnum\JSisTEX=2 \chardef\JSisTEX3 \else\flushJSisTEX\aftergroup X\fi \else\if#1\normalspace - \ifnum\JSisTEX=3 \chardef\JSisTEX=0 \else\flushJSisTEX\aftergroup#1\fi + \ifnum\JSisTEX=3 \chardef\JSisTEX0 \else\flushJSisTEX\aftergroup#1\fi \else \flushJSisTEX\aftergroup\string\expandafter\aftergroup#1% \fi\fi\fi\fi\fi\fi\fi\fi @@ -589,15 +584,15 @@ %\beginTEX -\def\dododoPSsanitizeJScode% +\def\dododoPSsanitizeJScode {\ifcase\JSisTEX\ifcase\JScomment - \advance\scratchcounter by 1 + \advance\scratchcounter \plusone \fi\fi \ifnum\scratchcounter=500 \expandafter\dodododoPSsanitizeJScode \fi} -\def\dodododoPSsanitizeJScode% +\def\dodododoPSsanitizeJScode {\let\next={% \aftergroup}% \endgroup @@ -631,19 +626,19 @@ \definespeciallocation{JS}#1#2% {\iflocation \bgroup -\bgroup - \presetJScode - \currentreferenceoperation - \currentreferencearguments -\egroup - \dostartgoto - \data - {#2}% - \start - \dostartgotoJS\buttonwidth\buttonheight\JScode - \stop - \dostopgotoJS - \dostopgoto + \bgroup + \presetJScode + \currentreferenceoperation + \currentreferencearguments + \egroup + \dostartgoto + \data + {#2}% + \start + \dostartgotoJS\buttonwidth\buttonheight\JScode + \stop + \dostopgotoJS + \dostopgoto \egroup \else {#2}% @@ -665,26 +660,23 @@ %D The not so complicated implementation of this macro is: \def\dodouseJSscripts#1% - {\doifelse{#1}{\v!reset} - {\let\allJSpreambles=\empty} + {\doifelse{#1}\v!reset + {\let\allJSpreambles\empty} {\doifundefined{\c!file\f!javascriptprefix#1} - {\bgroup - \setbox0=\hbox % forget spaces and worse - {\setgvalue{\c!file\f!javascriptprefix#1}{}% - \makeshortfilename[\f!javascriptprefix#1]% - \showmessage{\m!javascript}{1}{#1}% - \startreadingfile - \readsysfile{\shortfilename}{}{}% - \stopreadingfile}% - \egroup}}} + {\startnointerference + \letgvalueempty{\c!file\f!javascriptprefix#1}% + \makeshortfilename[\f!javascriptprefix#1]% + \showmessage\m!javascript1{#1}% + \startreadingfile + \readsysfile\shortfilename\donothing\donothing + \stopreadingfile + \stopnointerference}}} \def\douseJSscripts[#1][#2]% {\processcommalist[#1]\dodouseJSscripts \processcommalist[#2]\useJSpreamblenow} -\def\useJSscripts% +\def\useJSscripts {\dodoubleempty\douseJSscripts} -\protect - -\endinput +\protect \endinput |