diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/enco-ini.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/enco-ini.tex | 199 |
1 files changed, 120 insertions, 79 deletions
diff --git a/Master/texmf-dist/tex/context/base/enco-ini.tex b/Master/texmf-dist/tex/context/base/enco-ini.tex index 2b7c85fcd04..9b78ae18da0 100644 --- a/Master/texmf-dist/tex/context/base/enco-ini.tex +++ b/Master/texmf-dist/tex/context/base/enco-ini.tex @@ -115,6 +115,13 @@ 3: codificarea -- este necunoscuta \stopmessages +\startmessages french library: encodings + title: encodage + 1: encodage -- + 2: l'encodage -- est chargé + 3: encodage -- inconnu +\stopmessages + %D First we define a few local or not yet initialized constants. \def\@map@{@m@ap@} % mapping prefix @@ -203,9 +210,17 @@ \def\trueregimename#1% {\executeifdefined{\@reg@::#1}{#1}} +% \def\enableregime[#1]% +% {\edef\characterregime{@\trueregimename{#1}@}% +% \ifx\enabledregime\characterregime \else +% \the\executeifdefined{\@reg@\characterregime}\emptytoks +% \fi} + \def\enableregime[#1]% {\edef\characterregime{@\trueregimename{#1}@}% \ifx\enabledregime\characterregime \else + \doifundefined{\@reg@\characterregime} + {\expanded{\useregime[\pureencodingname\characterregime]}}% auto load \the\executeifdefined{\@reg@\characterregime}\emptytoks \fi} @@ -377,11 +392,11 @@ \def\douseencoding#1% {\doifundefined{\c!file\f!encodingprefix#1}% {\letvalue{\c!file\f!encodingprefix#1}\empty - \makeshortfilename[\f!encodingprefix#1]% + \makeshortfilename[\truefilename{\f!encodingprefix#1}]% \startreadingfile - \readsysfile\shortfilename - {\showmessage\m!encodings2{#1}} - {\showmessage\m!encodings3{#1}}% + \readsysfile\shortfilename + {\showmessage\m!encodings2{#1}} + {\showmessage\m!encodings3{#1}}% \stopreadingfile}} \def\useencoding[#1]% @@ -432,10 +447,12 @@ \def\stopsavingmappingtoks {\global\mappingtoks\emptytoks - \dostepwiserecurse{128}{255}\plusone + \dostepwiserecurse{0}{255}\plusone {\edef\@@expanded {\the\mappingtoks - \noexpand\checkregimecode\recurselevel\space + \ifnum\recurselevel>127 + \noexpand\checkregimecode\recurselevel\space + \fi \lccode\recurselevel\ifnum\lccode\recurselevel=\zerocount\zerocount\else\space\the\lccode\recurselevel\space\fi \uccode\recurselevel\ifnum\uccode\recurselevel=\zerocount\zerocount\else\space\the\uccode\recurselevel\space\fi \ifnum\sfcode\recurselevel=\plusthousand\else\sfcode\recurselevel=\the\sfcode\recurselevel\space\fi @@ -751,7 +768,8 @@ {\edef\charactermapping{@#1@}% \ifx\enabledmapping\charactermapping \else \doifdefined{\@map@\charactermapping} - {\the\csname\@map@\charactermapping\endcsname}% + {%\expandafter\showthe\csname\@map@\charactermapping\endcsname\endcsname + \the\csname\@map@\charactermapping\endcsname}% % == \the\executeifdefined{\@map@\charactermapping}\emptytoks \edef\enabledmapping{\charactermapping}% \enablelanguagespecifics[\currentlanguage]% new @@ -929,43 +947,17 @@ \def\startencoding {\dodoubleempty\dostartencoding} -% \def\dostartencoding[#1][#2]% encoding regime -% {\doifelsenothing{#1} -% {\let\stopencoding\relax} -% {%\protectfontcharacters % problematic in language loading -% %\showmessage\m!encodings1{#1}% -% \pushmacro\dohandleaccent % still needed? -% \pushmacro\dohandlecommand % still needed? -% \pushmacro\definesortkey -% \pushmacro\characterregime -% \pushmacro\doautosetregime -% \let\dohandleaccent\donthandleaccent % still needed? -% \let\dohandlecommand\donthandlecommand % still needed? -% \let\definesortkey\savesortkey -% \doifelsenothing{#2}% -% {\let\doautosetregime\gobbletwoarguments} -% {\def\characterregime{@#2@}}% -% \enableencoding[#1]% -% \def\stopencoding% -% {\popmacro\doautosetregime -% \popmacro\characterregime -% \popmacro\definesortkey -% \popmacro\dohandlecommand % still needed? -% \popmacro\dohandleaccent % still needed? -% \enableencoding[\s!default]% -% }}}% \unprotectfontcharacters}}} % ?? - \def\dostartencoding[#1][#2]% encoding regime {%\showmessage\m!encodings1{#1}% \pushmacro\characterencoding \pushmacro\characterregime \pushmacro\dohandleaccent % still needed? \pushmacro\dohandlecommand % still needed? - \pushmacro\definesortkey + %pushmacro\definesortkey \pushmacro\doautosetregime \let\dohandleaccent\donthandleaccent % still needed? \let\dohandlecommand\donthandlecommand % still needed? - \let\definesortkey\savesortkey + %let\definesortkey\savesortkey \edef\characterencoding{@#1@}% \doifelsenothing{#2}% {\let\doautosetregime\gobbletwoarguments} @@ -973,7 +965,7 @@ \def\stopencoding {\popmacro\doautosetregime - \popmacro\definesortkey + %popmacro\definesortkey \popmacro\dohandlecommand % still needed? \popmacro\dohandleaccent % still needed? \popmacro\characterregime @@ -1018,27 +1010,34 @@ %D This mechanism is currently being tested and subjected to %D changes! -\def\savesortkey#1#2#3#4% - {\let\flushsortkey\relax % important - \edef\!!stringa{sort:\characterencoding}% - \ifundefined\!!stringa - \let\!!stringb\empty - \else - \@EA\def\@EA\!!stringb\@EA{\csname\!!stringa\endcsname}% - \fi - \convertargument#1\to\asciiA \convertargument#2\to\asciiB - \convertargument#3\to\asciiC \convertargument#4\to\asciiD - \setevalue{\!!stringa}% - {\!!stringb\flushsortkey{\asciiA}{\asciiB}{\asciiC}{\asciiD}}} - -\def\definesortkey#1#2#3#4% - {} +%D THS CODE IS OBSOLETE -\def\flushsortkeys - {\enablelanguagespecifics[\currentlanguage]% - \getvalue{sort:\characterencoding}} +% \def\savesortkey#1#2#3#4% +% {\let\flushsortkey\relax % important +% \edef\!!stringa{sort:\characterencoding}% +% \ifundefined\!!stringa +% \let\!!stringb\empty +% \else +% \@EA\def\@EA\!!stringb\@EA{\csname\!!stringa\endcsname}% +% \fi +% \convertargument#1\to\asciiA \convertargument#2\to\asciiB +% \convertargument#3\to\asciiC \convertargument#4\to\asciiD +% \setevalue{\!!stringa}% +% {\!!stringb\flushsortkey{\asciiA}{\asciiB}{\asciiC}{\asciiD}}} +% +% \def\definesortkey#1#2#3#4% +% {} +% +% \def\flushsortkeys +% {\enablelanguagespecifics[\currentlanguage]% +% \getvalue{sort:\characterencoding}} +% +% \let\flushsortkey \relax -\let\flushsortkey\relax +\let\definesortkey\gobblefourarguments +\let\savesortkey \gobblefourarguments +\let\flushsortkeys\relax +\let\flushsortkey \relax %D \macros %D {defineaccent, definecharacter, definecommand} @@ -1125,6 +1124,7 @@ \else \enablepatterntokens \fi + \let\dochar\thechr \lccode16=16 % brrr, extra quote in ec (turkish) \lccode17=17 % brrr, extra quote in ec (turkish) \lccode`\-=`\- @@ -1172,13 +1172,23 @@ % \doautosetregime{#1}{#2}} % {\setvalue{\characterprefix\characterencoding\string#1}{#2}}} -\def\numcharacter#1{\char#1 } -\let\dochar\numcharacter +% \def\numcharacter#1{\char#1 } +% \let\dochar\numcharacter + + \def\thechr#1{\char#1 } % just in case \relax interferes +\unexpanded\def\numchr#1{\char#1\relax} +\unexpanded\def\strchr#1{\csname#1\endcsname} + +\let\dochar\numchr + +\def\startdirectcharacters {\pushmacro\dochar \let\dochar\thechr} +\def\stopdirectcharacters {\popmacro \dochar} \def\definecharacter#1 #2 % {\ifundefined{#1}\setvalue{#1}{\dohandlecharacter{#1}}\fi +% \doifnumberelse{\string#2} \doifnumberelse{\string#2} - {\setevalue{\characterprefix\characterencoding\string#1}{\dochar{#2}}% + {\setvalue{\characterprefix\characterencoding\string#1}{\dochar{#2}}% \doautosetregime{#1}{#2}} {\setvalue{\characterprefix\characterencoding\string#1}{#2}}} @@ -1458,11 +1468,13 @@ %D When we show 'm, we don't want to see the protection %D measures. -\def\currentencoding{\@EA\docurrentencoding\characterencoding} -\def\currentregime {\@EA\docurrentencoding\characterregime } -\def\currentmapping {\@EA\docurrentencoding\charactermapping } +\def\currentencoding{\@EA\dopureencodingname\characterencoding} +\def\currentregime {\@EA\dopureencodingname\characterregime } +\def\currentmapping {\@EA\dopureencodingname\charactermapping } + +\def\dopureencodingname @#1@{#1} -\def\docurrentencoding @#1@{#1} +\def\pureencodingname#1{\@EA\dopureencodingname#1} %D \macros %D {showaccents, showcharacters, @@ -1647,7 +1659,19 @@ %D The next few macros are experimental and needed for unicoded %D chinese characters. -\def\defineuclass #1 #2 #3 {\setvalue{uc#2#3}{#1}} +\beginETEX + \def\defineuclass #1 #2 #3 % + {\setvalue{uc\the\numexpr#2*256+#3\relax}{#1}} +\endETEX + +\beginTEX + \def\defineuclass #1 #2 #3 % + {\scratchcounter256\relax + \multiply\scratchcounter#2\relax + \advance\scratchcounter#3\relax + \setvalue{uc\the\scratchcounter}{#1}} +\endTEX + \def\defineudigit #1 #2 #3 {\setvalue{\characterencoding uc#1}{\uchar{#2}{#3}}} %D It may look strange, but for the moment, we want the encoding @@ -1848,6 +1872,10 @@ \definecommand d {\buildtextbottomdot} \definecommand k {\buildtextogonek} +%D A collectors item: + +\def\buildtextbottomcomma{\bottomaccent{.15ex}{0}{5}{\tx,}} + %D Rarely needed but there: \unexpanded\def\topaccent#1#2#3#4#5% down right slantcorrection accent char @@ -1921,15 +1949,27 @@ % new, to be documented (oeps, conflicts with existing code) +\def\donthandleaccent #1{\expandafter\string\csname#1\endcsname\space} +\def\donthandlecommand #1{\expandafter\string\csname#1\endcsname\space} +\def\donthandlecharacter #1{\expandafter\string\csname#1\endcsname\space} + +\def\stringifyhandleaccent #1{\strchr{#1}} +\def\stringifyhandlecommand #1{\strchr{#1}} +\def\stringifyhandlecharacter#1{\strchr{#1}} + +\def\keephandleaccent #1{\expandafter\noexpand\csname#1\endcsname} +\def\keephandlecommand #1{\expandafter\noexpand\csname#1\endcsname} +\def\keephandlecharacter #1{\expandafter\noexpand\csname#1\endcsname} + +\def\handleaccent #1{\csname#1\endcsname} +\def\handlecommand #1{\csname#1\endcsname} +\def\handlecharacter #1{\csname#1\endcsname} + \def\dontexpandencoding {\let\dohandleaccent \donthandleaccent \let\dohandlecommand \donthandlecommand \let\dohandlecharacter\donthandlecharacter} -\def\donthandleaccent #1{\expandafter\string\csname#1\endcsname\space} -\def\donthandlecommand #1{\expandafter\string\csname#1\endcsname\space} -\def\donthandlecharacter#1{\expandafter\string\csname#1\endcsname\space} - \def\keepencodedtokens {\let\dohandleaccent \keephandleaccent \let\dohandlecommand \keephandlecommand @@ -1940,13 +1980,10 @@ % \let\dohandlecommand \keephandlecommand \let\dohandlecharacter\keephandlecharacter} -\def\keephandleaccent #1{\expandafter\noexpand\csname#1\endcsname} -\def\keephandlecommand #1{\expandafter\noexpand\csname#1\endcsname} -\def\keephandlecharacter#1{\expandafter\noexpand\csname#1\endcsname} - -\def\handleaccent #1{\csname#1\endcsname} -\def\handlecommand #1{\csname#1\endcsname} -\def\handlecharacter#1{\csname#1\endcsname} +\def\stringifyencodedtokens + {% \let\dohandleaccent \stringifyhandleaccent + % \let\dohandlecommand \stringifyhandlecommand + \let\dohandlecharacter\stringifyhandlecharacter} \unexpanded\def\uhandleaccent #1{\csname#1\endcsname} \unexpanded\def\uhandlecommand #1{\csname#1\endcsname} @@ -1957,17 +1994,19 @@ \def\dohandlecommand {\uhandlecommand}% \def\dohandlecharacter{\uhandlecharacter}} +\def\convertencodedtokens{\dontexpandencoding} + %D Still valid? To be checked: +\def\doignoreaccent #1#2{\string#1\string#2}% +\def\doignorecommand #1{\string#1} +\def\doignorecharacter#1{\string#1} + \def\ignoreencoding {\let\dohandleaccent \doignoreaccent \let\dohandlecommand \doignorecommand \let\dohandlecharacter\doignorecharacter} -\def\doignoreaccent #1#2{\string#1\string#2}% -\def\doignorecommand #1{\string#1} -\def\doignorecharacter#1{\string#1} - \appendtoks \ignoreencoding \to \everycleanupfeatures @@ -1985,7 +2024,9 @@ \useencoding[def,acc,raw,com,cas,mis] % mis should come first -\useencoding[ans,il2,ec,tbo,pdf,uc,pol,qx,t5,cyr] +\useencoding[ans,il2,ec,tbo,pdf,uc,pol,qx,t5,cyr,agr] % pol and il2 will go away + +\useencoding[032,033,037] \setupencoding[\s!default=ec] % was: [\s!default=\s!default] |