% kbconfig.tex                       An idea of Bernard Gaulle as of 1992/07/29
%                                                                         V7,03
%                                     Copyright Bernard Gaulle as in french.doc
%
% (previous changes listed in historyk.pdf)
% V7,00 Global definition of chars replaced by local ones using
%         \outside macros. This was required because kbconfig can
%         be used by the "msg" package (\msgencoding) and thus
%         the encoding should only be changed locally for the 
%         issued message and not globally for the document.     --bg 2005/04/08
%       K3 modified for \c noexpansion.                         
%       Added ^^J newline for Plain.
%       \outsidecase completed.                                 --bg 2005/04/12
%       \noexpand moved to \protect for unusedslot ^^8d.        --bg 2005/04/15
% V7,01 \ifLEX now saved on second pass.                        --bg 2005/04/20
% V7,02 Let \kbAissue be \relax with Plain.                     
%       Allow kbconfig to be used with  XeTeX.                  --bg 2005/04/21
% V7,03 Wrong encoding for accentued \i char, as shown by
%       Andre Valentin.                                         --bg 2005/08/29
%%
%%      checksum        = "64196 2070 4788 91646"
%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If not loaded by kbconfig.tex or keyboard.sty 
% this code will read keyboard.dat, and do appropriate customisation
% of your keyboard according to the engine you are using. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Is supposed to run with \catcode`@=11.
\def\GOfrench{\ifx\@prevkbencoding\@kbencoding\expandafter\endinput\fi}%
\def\@tempc{\let\ifLEX\iffalse\let\ifLEXhic\iftrue}%
\ifx\ifLEX\undefined\message{keyboard (kbconfig V7,03),}\@tempc\fi%
%
\def\@tempc{\let\ifLEX\iffalse\let\unusedslot\undefined%
           }%
\ifx\documentclass\undefined\let\kbAissue\relax\let\messag@\message%
\else%
   \let\messag@\@gobble%
% For debugging one can remove "msg" access, just uncomment
%\let\kbAissue\relax% this line.
   \ifx\kbAissue\undefined%
% Firstly we add the material to use the "msg" package for localization.
% (but don't use "msg" inside "msg").
      \def\kbAissue{\ifx\msgid\undefined\expandafter\kb@issue%
                    \else\let\kbAissue\relax\let\messag@\message\fi}%
      \def\kb@issue#1#2{\kb@issue@[#1]#2\void}% The local \issuemsg macro.
                                      % which will call the real one;
                                      % #1 is the macro message required.
                                      % #2 is the message header + msg number
                                      %    such as "^^J -234-", just message 
                                      %    number (234) is kept. 
      \def\kb@issue@[#1]#2-#3-#4\void{\issuemsg[#1]#3(keyboard)}%
   \else\let\kbAissue\relax\let\messag@\message%
%%%        \@tempc% Avoid second level loop.
   \fi%
\fi%
%
\ifLEX\def\GOfrench{}\fi%
\ifx\@kbencoding\undefined\else\expandafter\GOfrench\fi%
\let\@prevkbencoding\@kbencoding%
\let\UTFviii@two@octets\string% If utf8 was loaded then
\let\UTFviii@three@octets\string% nullify it until we
\let\UTFviii@four@octets\string% know if it is requested.
\ifx\@gobble\undefined\def\@gobble#1{}\fi%
\ifx\@GobbleEmpty\undefined%
 \gdef\@GobbleEmpty#1{\ifx#1\empty\else\expandafter#1\fi}%
\fi%
\ifx\blankspace\undefined%
{\def~{\global\futurelet\blankspace\relax}~ }%
\fi%
\ifx\dGs\undefined\let\dGs\empty\fi%
\ifx\@firstoftwo\undefined\long\def\@firstoftwo#1#2{#1}\fi%
\ifx\@@charsubdef\undefined\else% Case mltex.sty preloaded,
    \let\charsubdef\@@charsubdef% reset saved primitive meaning.
\fi%
%-------------Debugging part-----------------------------------------
%\let\DEBUGmessage\message% Uncomment to obtain debugging messages.
%\let\charsubdef\undefined% Uncomment to make MlTeX unkown for tests.
%\let\kbtypeout=\typeout% Uncomment to do nothing more when \kbtypeout
%--------------------------------------------------------------------
\ifx\DEBUGmessage\undefined\let\DEBUGmessage\@gobble\fi%
\ifx\message\DEBUGmessage%
\def\tracingall{\tracingonline\@ne\tracingcommands\tw@\tracingstats\tw@
  \tracingpages\@ne\tracingoutput\@ne\tracinglostchars\@ne
  \tracingmacros\tw@\tracingparagraphs\@ne\tracingrestores\@ne
  \showboxbreadth\maxdimen\showboxdepth\maxdimen\errorstopmode}
\fi%
%
%%%% Check if we can output 8bit without translation to ^^codes
%
\def\@tempa{%
 \edef\GOresetat{\noexpand\catcode\GOfrench=\the\catcode\GOfrench}%
 \ifx\ifEightBitOutput\undefined% in a second pass non-MlTeX
  \ifx\accent@spacefactor\undefined\let\accent@spacefactor\relax%
   \ifx\inputencoding\undefined\else%
                                \def\@tempa{french}%
                                \ifx\l@nguagename\@tempa%
\kbAissue%
\message{^^J -67- WARNING it seeems your are using inputenc and keyboard, 
         please chose!}%
                                \else%
\kbAissue%
\message{^^J -67- ATTENTION il me semble que vous utilisez \`a la fois
          inputenc et keyboard, svp choisissez \string!}%
                                \fi% 
   \fi%
  \fi%
 \edef\GOfrench{^^e9}% this char. which is activated should not be expanded
 \fi% because all the LaTeX stuff is not available.
\catcode`\^=12%
           }%\@tempa
\edef\GOfrench{`\string ^}% temp def further correctly defined
\ifnum\catcode\GOfrench=12% mods of code proposed by DT that
      \let\GOresetat\relax% accepts also that ^ were active
\else\expandafter\@tempa%
\fi%
\def\@tempc#1 #2\null{\def\@jobname{#1}}% \jobname may contain a space 
\expandafter\expandafter%
\expandafter\@tempc% on Mac.set \@jobname with first
\csname jobname\expandafter\endcsname\space\null% non blank chars.
\ifx\kbconfigw\undefined\csname newwrite\endcsname\kbconfigw\fi%
\ifx\kbconfigr\undefined\csname newread\endcsname\kbconfigr\fi%
\def\@tempc{\csname newif\endcsname\ifEightBitOutput\EightBitOutputfalse%
  \immediate\openout\kbconfigw=\@jobname.tmp%
  \immediate\write\kbconfigw{\string\def\string\ligne{\GOfrench}}%
  \immediate\closeout\kbconfigw%
{\catcode`\^=12
\input\@jobname.tmp % If pb, insure you wrote in an inputable directory.
\def\vide{}\def\gobbleIV##1##2##3##4{}
\def\yy^##1^##2^{\def\aa{##1}%
               \ifx\aa\vide\let\next\gobbleIV
               \else\aftergroup\EightBitOutputtrue
\let\next\relax\fi
               \next}
\expandafter\yy\expandafter^\ligne^^
}%\catcode
}%\@tempc
\ifx\EightBitOutputfalse\undefined\expandafter\@tempc\fi%
\GOresetat\let\GOfrench\undefined%
\let\@tempc=\undefined% so if someone use it...
%%%% Dirty hack to be remove later...
\def\@tempc{\let\ifECM\iffalse}%
\ifx\ifECM\undefined\relax\@tempc\fi%
\ifx\documentclass\undefined% Case Plain: no language.xx.kbc file
\message{ -76- kbconfig: no language dependencies available within Plain TeX!}%
 \def\IfFileExists#1#2#3{#3}%
\fi%
\ifLEX\else%
\ifx\documentclass\undefined% This is Plain
\newlinechar=`^^J%
 \ifx\IeC\undefined\gdef\IeC#1{\ifx\protect\relax #1%
                               \else\noexpand\IeC{\noexpand #1}\fi}% 1999/11/26
 \fi%
\else% This is LaTeX
 \ifx\IeC\undefined%
   \gdef\IeC{\ifx\protect\@typeset@protect\expandafter\@firstofone%
             \else\noexpand\IeC\fi}%
 \fi%
\ifx\undefined\@uclclist% is it initex? yes probably
    \let\kbAissue\relax% No localization with Plain.
    \ifx\dumpORI\undefined\let\dumpORI=\dump%
\wlog{ -69- kbconfig: Intercepting the dump control sequence for %
                     eliminating few invalid chars.}%
          \let\InitexTime\relax%
          \def\dump{\makeatletter%
                    \let\xordcode\undefined% disable encTeX
                    \let\xchrcode\undefined% as in TUGboat vol 19 (1998) #4
                    \let\xprncode\undefined% p 370.
                    \input kbconfig.tex %
                    \let\dump\dumpORI%
                    \ifECM\relax\else\uccode`\^^Y=`\^^Y%
                                     \uccode`\^^Z=`\^^Z%
\wlog{ -35- kbconfig: Redefining \string ^\string ^\string Y uccode.}%
\wlog{ -35- kbconfig: Redefining \string ^\string ^\string Z uccode.}%
                    \fi%
                    \let\InitexTime\undefined%
\ifx\charsubdef\undefined\else%
  \expandafter%  
  \ifx\csname @tbkORI\endcsname\relax\let\@tbkORI=\@tabacckludge%
  \def\@tabacckludge{\ifmmode\expandafter\@gobble\else\expandafter\@tbkORI\fi}%
  \fi
  \wlog{ -70- kbconfig: modifying \string\@tabacckludge\space for math.}%
\fi%
                    \makeatother\dump}%
    \fi%
\fi% LaTeX2e
\fi% initex
\fi% LEX
%%%%
\ifx\I\undefined\def\I{I}\fi%
\ifx\cedilla\undefined\gdef\cedilla{\noexpand\m@c@@}\fi%
\ifx\m@c@@\undefined% For cedilla in math mode.
\gdef\m@c@@#1{\setbox\z@\hbox{$#1$}%
              {\ooalign{\unhbox\z@\crcr\ifdim\ht\z@<1ex\else\hidewidth\fi%
               $\char24$\hidewidth}}%
             }%
\fi%
\ifx\SS\undefined\def\SS{\hbox{SS}}\fi% new defs
% \" is redefined, look at the accentuation macros
%%% unused slot preliminary processing
{% (testing activation of the unused slot char)
\ifx\@unusedslot\undefined%
\ifx\unusedslot\undefined\else%
  \def\@tempb{}\def\@tempc{\catcode`}
       \edef\@unusedslot{\unusedslot}%
  \expandafter\ifnum\expandafter\@tempc\@unusedslot=\active\else%
    \def\@tempb{\kbAissue%
                \message{ -55- ERROR \string\unusedslot\space character
                         (\@unusedslot) is not activated.}\stop}%  
  \fi%
\expandafter\@tempb%
\fi%
\fi%
}%
%
\def\newcount{\alloc@0\count\countdef\insc@unt}%....................  \newcount
\def\@tempa{\newcount\@tempcnta\newcount\@tempcntb}%
\ifx\@tempcnta\undefined\expandafter\@tempa\fi% case plain TeX.
\def\reserved@a#1#2{\@tempcnta#1\relax\@tempcntb#2\relax\reserved@b}%
\def\reserved@b{\ifnum\@tempcnta>\@tempcntb\else\reserved@c\@tempcnta%
                 \advance\@tempcnta\@ne\expandafter\reserved@b\fi}%
%
% Go back to default LaTeX catcodes
%
\ifLEX\else% don't activate for kb2lex
\expandafter\ifx\csname ^^63\endcsname\c % 128-255 going \active locally in V3
\catcode`\ =10
\catcode`\#=6
\catcode`\$=3
\catcode`\%=14
\catcode`\&=4
\catcode`\\=0
\catcode`\^=7
\catcode`\_=8
\catcode`\{=1
\catcode`\}=2
\catcode`\~=13
\catcode`\@=11
\catcode`\^^I=10
\catcode`\^^J=12
\catcode`\^^L=13
\catcode`\^^M=5
\def\reserved@c#1{\catcode#1=12\relax}
\reserved@c{`\!}
\reserved@c{`\"}
\reserved@a{`\'}{`\?}
\reserved@c{`\[}
\reserved@c{`\]}
\reserved@c{`\`}
\reserved@c{`\|}
%
\def\reserved@c#1{\catcode#1=11\relax}
\reserved@a{`\A}{`\Z}
\reserved@a{`\a}{`\z}
\def\reserved@c#1{\catcode#1=15\relax}
\reserved@a{0}{`\^^H}
\reserved@c{`\^^K}
\reserved@a{`\^^N}{31}
  \catcode"7F=15
\def\reserved@c#1{\catcode#1=13\relax}%
\reserved@a{"7F}{"FF}% activate all 8-bits chars 
\def\reserved@c#1{%
   \count@=#1\advance\count@ by -"20
   \uccode#1=\count@
   \lccode#1=#1}
\reserved@a{`\a}{`\z}
\ifnum\inputlineno=\m@ne\else
  \reserved@a{"A0}{"BC}
  \reserved@a{"E0}{"FF}
\fi
\def\reserved@c#1{%
   \count@=#1\advance\count@ by "20
   \uccode#1=#1
   \lccode#1=\count@
   \sfcode#1=999
                 }
\reserved@a{`\A}{`\Z}
\ifnum\inputlineno=\m@ne\else
  \reserved@a{"80}{"9C}
  \reserved@a{"C0}{"DF}
\fi
\uccode`\^^Y=`\I     % dotless i
\lccode`\^^Y=`\^^Y   % dotless i
\uccode`\^^Z=`\J     % dotless j, ae in OT1
\lccode`\^^Z=`\^^Z   % dotless j, ae in OT1
\ifnum\inputlineno=\m@ne\else
  \lccode`\^^9d=`\i    % dotted I
  \uccode`\^^9d=`\^^9d % dotted I
  \lccode`\^^9e=`\^^9e % d-bar
  \uccode`\^^9e=`\^^d0 % d-bar
\fi
% reset macros to initial values
\def\reserved@a#1#2{\@tempcnta#1\relax\@tempcntb#2\relax\reserved@b}%
\def\reserved@b{\ifnum\@tempcnta>\@tempcntb\else\reserved@c\@tempcnta%
                 \advance\@tempcnta\@ne\expandafter\reserved@b\fi}%
%
\ifx\unusedslot\undefined\edef\@unusedslot{\noexpand ^^9c}%
  \else\edef\@unusedslot{\unusedslot}%
\fi%
\expandafter\let \@unusedslot =\undefined%
\fi% ifx TeX V3 
\fi%\ifLEX
\def\ESC{}% no escape char
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\@kbspecials{}% 
%---------------------------------------------------------------------------
\begingroup
\catcode`\"=12
\catcode`\<=12
\catcode`\.=12
\catcode`\,=12
\catcode`\;=12
\catcode`\!=12
\catcode`\~=13
\gdef\GenUcsCode#1{% DeclareUnicodeCharacter#1#2%
   \count@"#1\relax%
   \begingroup%
% same code as in inputenc \parse@XML@charref
  \ifnum\count@<"A0\relax
     \def\@tempa{\PackageError{keyboard}}\kbAissue\@tempa%
                 {-90- Invalid Unicode char value < 00A0}\@eha
  \else\ifnum\count@<"800\relax
     \kbparse@UTFviii@a,%
     \kbparse@UTFviii@b C\UTFviii@two@octets.,%
  \else\ifnum\count@<"10000\relax
     \kbparse@UTFviii@a;%
     \kbparse@UTFviii@a,%
     \kbparse@UTFviii@b E\UTFviii@three@octets.{,;}%
   \else
     \kbparse@UTFviii@a;%
     \kbparse@UTFviii@a,%
     \kbparse@UTFviii@a!%
     \kbparse@UTFviii@b F\UTFviii@four@octets.{!,;}%
    \fi%
    \fi%
  \fi%
   \endgroup%
%\edef\UcsCode{\expandafter\@gobble\UTFviii@tmp}%
}%
\gdef\kbparse@UTFviii@a#1{%
     \@tempcnta\count@
     \divide\count@ 64
     \@tempcntb\count@
     \multiply\count@ 64
     \advance\@tempcnta-\count@
     \advance\@tempcnta 128
     \uccode`#1\@tempcnta
     \count@\@tempcntb}%
\gdef\kbparse@UTFviii@b#1#2#3#4{%
     \advance\count@ "#10\relax
     \uccode`#3\count@
%     \uppercase{\gdef\UTFviii@tmp{#2#3#4}}}%
     \uppercase{\gdef\UcsCode{#3#4}}}%
\endgroup%
%---------------------------------------------------------------------------
%Original code coming from compatible.tex (Aug. 1990) of MJF and Justin Bur
% \csubinverse mechanism only apply when MlTeX, otherwise pivot macro
% is (re)set to undefined to avoid any previous definition use.
\def\csubinverse#1#2#3{\ifx\charsubdef\undefined%
%                 \global\expandafter\let\csname #2#3\endcsname\undefined%
 \edef\GOfrench{\noexpand\protect\expandafter\noexpand\csname #2#3\endcsname}%
 \outside{\expandafter\let\expandafter\GOfrench\protect\undefined}% 2005/04/08
                       \else%
%                        \expandafter\xdef\csname #2#3\endcsname{#1}%
             \outside{\expandafter\edef\csname #2#3\endcsname{#1}}% 2005/04/08
                       \fi%
                       \@csubencodedecode{#1}{#2}{#3}% added 99/05
                      }% 
\def\@csubencodedecode#1#2#3#4#5{%
                          \ifx\kbtypeout\typeout\else%
                          {\edef\tempf{\expandafter\noexpand%
                                       \csname#2#3\endcsname}% 
                           % To avoid ORI char expands:
                           \def\protect{\noexpand\protect\noexpand}%
                           \edef\tempc{\expandafter\noexpand%
                                       \csname#2#3ORI\endcsname}% 
\expandafter%
\ifx\tempf\relax\else%
    \edef\tempe{#5}%
    \ifx\tempe\empty%
\expandafter%
       \ifx\tempc\relax\else% bg 25/01/2005
                           \xdef\@kbspecials{\@kbspecials% Set specials.
                                             \protect\let\expandafter%
                                             \protect\tempf\expandafter%
                                             \protect\tempc%
                                            }%
         \DEBUGmessage{Kspe (\expandafter\string\expandafter%
                             \let\expandafter\noexpand\tempf\tempc)}%
         \def\tempf{#3}\expandafter%
         \ifx\tempf\i\edef\tempf{\expandafter\noexpand%
                                       \csname#2i\endcsname}% 
                           \xdef\@kbspecials{\@kbspecials% Set specials.
                                             \protect\let\expandafter%
                                             \protect\tempf\expandafter%
                                             \protect\tempc%
                                            }%
         \fi
         \def\tempf{#3}\expandafter%
         \ifx\tempf\j\edef\tempf{\expandafter\noexpand%
                                       \csname#2i\endcsname}% 
                           \xdef\@kbspecials{\@kbspecials% Set specials.
                                             \protect\let\expandafter%
                                             \protect\tempf\expandafter%
                                             \protect\tempc%
                                            }%
         \fi
       \fi%
    \else\DEBUGmessage{Kucs(#5)}%
          \GenUcsCode{#5}\edef\tempc{{\UcsCode}}%
                           \xdef\@kbspecials{\@kbspecials% Set ucs specials.
                                             \protect\def\expandafter%
                                             \protect\tempf\expandafter%
                                             \protect\tempc%
                                            }%
    \fi% tempe
\fi% tempf
                          }% document/format keyboard output target char.
                          \fi%
                         }%
%           #1 -- extended 8bits character to replace accent+letter
%           #2 -- accent macro name invocation for...
%           #3 -- this letter (base character)
%           #4 -- the 7bit accent macro
%           #5 -- extended unicode value
%---------------------------------------------------------------------------
\def\@stdencodedecode#1#2{%
                          \ifx\kbtypeout\typeout\else%
                        {\let\ESC\noexpand%
                         \def\tempd##1##2${\edef\tempf{##2}}%
                         \def\tempg\csname##1\endcsname{\edef\tempf{##1}}%
                         \def\temph##1${\edef\tempf{##1}}%
\def\tempa##1##2${\def\tempi{}%
                  \ifx##1\csname\tempg#2%
                  \else\ifx##1\ESC\temph\ESC#2$%
                       \else\ifx\##1\bgroup\temph\bgroup#2$%
                            \else%
                              \def\tempi{\@GobbleEmpty}%
                              \expandafter\tempd\string##1$%
                            \fi%
                       \fi%
                   \fi}%
                        \tempa#2$%
                        \edef\tempc{\expandafter\csname\tempf @ORI\endcsname}%
                        \xdef\tempg{\tempc}%
                         \expandafter\ifx\tempc\relax%
                                      \def\tempa{\expandafter\noexpand#1}%
                                      \expandafter%
                                      \xdef\tempc{\tempa}\expandafter%
                                      \xdef\tempc{\protect\string%
                                                  \expandafter\expandafter%
                                                  \expandafter\string\tempc}%
                                      \fi%
                         \def\protect{\noexpand\protect\noexpand}%
\expandafter\ifx\tempg\relax\else\xdef\tempg{\tempg}%
                         \xdef\@kbspecials{\@kbspecials%
                                           \protect\def\expandafter%
                                           \protect\csname\tempf\endcsname%
                                           {\protect\string %
                                           \expandafter\protect\tempg%
                                           \expandafter\protect\tempi}%
                                          }%
\fi%
                        }%
                        \fi%
                       }%
%           #1 -- extended 8bits character to replace 
%           #2 -- a specific macro (like \oe {})
%---------------------------------------------------------------------------
\let\KBdefs\relax% Let it be known anyway.
\begingroup% to protect all the marmelade done here
\ifx\XeTeXinputencoding\undefined% Set off the XeTeX feature
\else\XeTeXinputencoding "bytes"% for default utf8 encoding.
\fi%
\ifx\guillemotleft\undefined% 2005/04/12
    \def\guillemotleft{\protect\protect\protect\guillemotleft}\fi%
\ifx\guillemotright\undefined% 2005/04/12
    \def\guillemotright{\protect\protect\protect\guillemotright}\fi%
\def\copyright{\protect\protect\protect\copyright}% Don't expand now
\def\cedilla{\protect\protect\protect\cedilla}% Don't expand now
% Previous usage: \def\outside#1{\expandafter\global #1}% 
\def\outside#1{#1\bgroup% 2005/04/08
                 \def\protect{\noexpand\protect\noexpand}%
                 \def\undefined{\noexpand\undefined\noexpand}%
                 \def\@tempb##1##2{\expandafter%
                                   \ifx##1\edef\def%
                                   \else\expandafter##1\fi\protect##2}%
                 \def\dGs{\protect\dGs}% Don't expand now
                 \edef\@tempc{\expandafter\@tempb #1}%
               \xdef\KBdefs{\KBdefs\@tempc}%
                 \egroup%
              }% 
\def\outsidecase#1`#2=`#3{#1`#2=`#3\bgroup% 2005/04/12
                 \def\protect{\noexpand\protect\noexpand}%
                 \edef\@tempc{#1`\protect #2=`\protect #3}%
               \xdef\KBdefs{\KBdefs\@tempc}%
                 \egroup%
              }%
\def\outsideuns#1{\def\unusedslot{\noexpand #1}\edef\@unusedslot{\unusedslot}%
                  \bgroup%
                \def\protect{\noexpand\protect\noexpand}%
                    \def\@tempc{\protect\def\protect\unusedslot{%
                                 \protect\noexpand\protect #1}%
                                 \protect\edef%
                                 \protect\@unusedslot{\protect\unusedslot}%
                               }%
                    \xdef\KBdefs{\KBdefs\@tempc}%
                  \egroup%
                 }%
\let\KBdefs\empty% Initialization of list.
\ifLEX\let\kbtypeout\typeout\else\let\protect\noexpand\fi%
\catcode`[=13\catcode`@=11%
\catcode`<=13\catcode`>=13% will allow << and >> in keyboard.dat
%%%%%%%%%
% test if ECM can be used (in fact DCM here) 
%
\newif\ifECM% local redefinition for a global expansion.
\global\let\ifECM\ifHB% may be it's already set by \ifHB in lhyphen/plain
\ifx\ifHB\undefined\global\ECMfalse\fi%
\ifECM\else% skip this if already decided
\ifx\encodingdefault\undefined%%%%%%%%%%%% 
  \ifECM\else% if false test (again) if it might be an ec/dc font
  \ifx\rm\undefined% may be \rm isn't allready defined (specially with LaTeX)
                   \def\graveDC{\mathaccent"7000 }% so test such char
                   \ifx\graveDC\grave\ECMtrue\else\ECMfalse\fi%
  \else% try on fontname that is a better security
     \def\is@DC#1#2#3\relax{\if d#11\fi \if e#11\fi \if c#22\fi}%
     \def\dcdo{% \dcdo code Version 3 as of 01/27/92 on DCFONT discussion list
               \ifnum 12=0\expandafter\is@DC\fontname\font xx\relax\space%
                          \expandafter\dc@first%
               \else      \expandafter\dc@second%
               \fi}%
          \def\dc@first#1#2{#1}%
          \def\dc@second#1#2{#2}%
  {\rm\dcdo{\global\ECMtrue}{\global\ECMfalse}}% final DC test
  \fi%\ifx\rm\undefined
  \fi%\ifECM\else..
%
  \ifECM\global\def\encodingdefault{T1}%   T1 is for DC/EC
   \else\global\def\encodingdefault{OT1}% OT1 is for CM
  \fi%
%
\else%
\ifx\f@encoding\undefined\edef\f@encoding{\encodingdefault}\fi%
%     \edef\@tempa{OT1}\ifx\@tempa\f@encoding%
%                          {\global\ECMfalse}%
%                     \else{\global\ECMtrue}%
%                     \fi%
 \def\@tempa{OT1}\ifx\@tempa\f@encoding%
                      \def\@tempa{\global\ECMfalse}%
                 \else\def\@tempa{LO1}\ifx\@tempa\f@encoding%
                                       \def\@tempa{\global\ECMfalse}%
                                      \else%  could be LY1
                                       \def\@tempa{\global\ECMtrue}%
                                      \fi%
                  \fi%
\@tempa%
\fi%\encodingdefault
\fi% ifECM
%%%%%%
% Prevent LaTeX2e invalid chars
\ifx\documentclass\undefined\else
\ifECM%
\catcode`\^^_=11%
\catcode`\^^Y=11%
\else%
\catcode`\^^P=11%
\catcode`\^^Q=11%
\catcode`\^^Y=11%
\catcode`\^^Z=11%
\catcode`\^^]=11%
\catcode`\^^[=11%
\catcode`\^^^=11%
\catcode`\^^\=11%
\catcode`\^^_=11%
\fi\fi%
%%%%%%
\newif\ifMACRO\MACROfalse\newif\ifLIGS\LIGSfalse
%------------------------------------------------------------------
% Now where is the accent in the font? local mods of plain code.
% and how code it: diacritic+letter or accented 8bits char?
%
%Caution: never use TeX V2 hexadecimal notation, lowercase would be wrong
\ifECM\def\POSgr{"00}\def\POSac{"01}\def\POSan{"06}
      \def\POSv{"07}\def\POSu{"08}\def\POSeq{"09}
      \def\POShat{"02}\def\POSdot{"0a}\def\POSH{"05}\def\POStil{"03}
      \def\POSum{"04}\def\POSc{"13}
\else\def\POSgr{18}\def\POSac{19}
     \def\POSv{20}\def\POSu{21}\def\POSeq{22}\def\POSan{23}
     \def\POShat{94}\def\POSdot{95}\def\POSH{125}\def\POStil{126}
     \def\POSum{127}\def\POSc{24} 
\fi%
     \let\MPOSgr\grave\let\MPOSac\acute\let\MPOSv\check\let\MPOSu\breve%
     \let\MPOSeq\bar\let\MPOSan\mathring% 
     \let\MPOShat\hat\let\MPOSdot\dot\let\MPOSH\undefined% Hugarian umlaut
     \let\MPOStil\tilde\let\MPOSum\ddot\let\MPOSc\cedilla%
\ifx\+\undefined\else% Not an outer macro here, with Plain,
\def\+{\tabalign}% just for the following few lines.
\fi%             % Is defaultly reset later.
\ifLEX\begingroup%
                 \catcode`\+=0\catcode`\[= 1\catcode`\]=2
                 \catcode`\{=12\catcode`\}=12\catcode`\\=12 
   +gdef+ESC[\+string]% set escape char for next char \ string
   +gdef+GobbEmpty#1[+ifx#1+empty+else+expandafter[#1]+fi]
   +gdef+ToEight[% Due to lex capacities we keep only one expansion of 
                 % usual accent macros e.g. {\'E} but not \'{E} nor \'E
      +def+ESC##1[+ifx##1+string+expandafter+@GETNEXT%
                   +else+expandafter+@NONEXT+fi[##1]]%
      +def+@NONEXT##1[+expandafter+@ESC+string##1|]%
      +def+@GETNEXT##1##2[+expandafter+@ESC+string##1##2|]%
      +def+@ESC##1##2|[+string##1+string##1"##2"]%
      +def+`##1[\\`##1|\\`\{##1\}]%
      +def+'##1[\\'##1|\\'\{##1\}]%
      +def+r##1[\\"r "##1|\\r\{##1\}]%
      +def+v##1[\\"v "##1|\\v\{##1\}]%
      +def+u##1[\\"u "##1|\\u\{##1\}]%
      +def+d##1[\\"d "##1|\\d\{##1\}]%
      +def+b##1[\\"b "##1|\\b\{##1\}]%
      +def+t##1[\\"t "##1|\\t\{##1\}]%
      +def+k##1[\\"k "##1|\\k\{##1\}]%
      +def+G##1[\\"G "##1|\\G\{##1\}]%
      +def+U##1[\\"U "##1|\\U\{##1\}]%
      +def+=##1[\\=##1|\\=\{##1\}]%
      +def+^##1[\\^##1|\\^\{##1\}]%
      +def+.##1[\\.##1|\\.\{##1\}]%
      +def+H##1[\\"H "##1|\\H\{##1\}]%
      +def+~##1[\\~##1|\\~\{##1\}]%
      +def+"##1[\\\"##1|\\\"\{##1\}]%
      +def+c##1[\\"c "##1|\\c\{##1\}]%
      +def+i[\\i+GobbEmpty]%
      +def+I[\\I+GobbEmpty]%
      +def+j[\\j+GobbEmpty]%
      +def+copyright[\{\\"copyright"\}|\\"copyright"\{\}|\\"copyright "%
                     +GobbEmpty]%
      +def+oe[\\"oe "|\{\\"oe"\}|\\"oe"\{\}+GobbEmpty]%
      +def+OE[\\"OE "|\{\\"OE"\}|\\"OE"\{\}+GobbEmpty]%
      +def+ss[\\"ss "|\{\\"ss"\}|\\"ss"\{\}+GobbEmpty]%
      +def+SS[\\"SS "|\{\\"SS"\}|\\"SS"\{\}+GobbEmpty]%
      +def+ae[\\"ae "|\{\\"ae"\}|\\"ae"\{\}+GobbEmpty]%
      +def+AE[\\"AE "|\{\\"AE"\}|\\"AE"\{\}+GobbEmpty]%
      +def+l[\\"l "|\{\\"l"\}|\\"l"\{\}+GobbEmpty]%
      +def+L[\\"L "|\{\\"L"\}|\\"L"\{\}+GobbEmpty]%
      +def+o[\\"o "|\{\\"o"\}|\\"o"\{\}+GobbEmpty]%
      +def+O[\\"O "|\{\\"O"\}|\\"O"\{\}+GobbEmpty]%
      +def+P[\\"P "|\{\\"P"\}|\\"P"\{\}+GobbEmpty]%
      +def+degre[\\"degre"]% only one expansion
      +def+texteuro[\\"texteuro "|\{\\"texteuro"\}|\\"texteuro"\{\}]%
      +def+pounds[\\"pounds "|\{\\"pounds"\}|\\"pounds"\{\}+GobbEmpty]%
      +def+S[\\"S "|\{\\S\}|\\S\{\}+GobbEmpty]%
      +def+guillemotleft["+string<+string<"]% nothing to gobble.
      +def+guillemotright["+string>+string>"+GobbEmpty]%
            ]%
   +gdef+ToSeven[%
      +def+`##1[\\`{##1}]%
      +def+'##1[\\'{##1}]%
      +def+r##1[\\r{##1}]%
      +def+v##1[\\v{##1}]%
      +def+u##1[\\u{##1}]%
      +def+d##1[\\d{##1}]%
      +def+b##1[\\b{##1}]%
      +def+t##1[\\t{##1}]%
      +def+k##1[\\k{##1}]%
      +def+G##1[\\G{##1}]%
      +def+U##1[\\U{##1}]%
      +def+=##1[\\={##1}]%
      +def+^##1[\\^{##1}]%
      +def+.##1[\\.{##1}]%
      +def+H##1[\\H{##1}]%
      +def+~##1[\\~{##1}]%
      +def+"##1[\\\"{##1}]%
      +def+c##1[\\c{##1}]%
      +def+i[\\i+GobbEmpty]%
      +def+I[\\I+GobbEmpty]%
      +def+j[\\j+GobbEmpty]%
      +def+copyright[{\\copyright}+GobbEmpty]%
      +def+oe[{\\oe}+GobbEmpty]%
      +def+OE[{\\OE}+GobbEmpty]%
      +def+ss[{\\ss}+GobbEmpty]%
      +def+SS[{\\SS}+GobbEmpty]%
      +def+ae[{\\ae}+GobbEmpty]%
      +def+AE[{\\AE}+GobbEmpty]%
      +def+l[{\\l}+GobbEmpty]%
      +def+L[{\\L}+GobbEmpty]%
      +def+o[{\\o}+GobbEmpty]%
      +def+O[{\\O}+GobbEmpty]%
      +def+P[{\\P}+GobbEmpty]%
      +def+pounds[{\\pounds}+GobbEmpty]%
      +def+texteuro[{\\texteuro}]%
      +def+degre##1##2[\\degre##1##2]% no {} 
      +def+S[{\\S}+GobbEmpty]%
      +def+guillemotleft[+string<+string<]% nothing to gobble.
      +def+guillemotright[+string>+string>+GobbEmpty]%
            ]%
      +endgroup
\else%
% Folowing \ifx are not required there are here in case of any misplacement 
% of kbconfig (eg after hyconfig).
\ifx\documentclass\undefined% do it in 2.09
\edef\`#1{\expandafter\ifx\csname @gr@#1\endcsname\relax%
                           \ifECM{\accent"00 #1}\else{\accent18 #1}\fi%
                       \else\csname @gr@#1\endcsname\fi}% 
\edef\'#1{\expandafter\ifx\csname @ac@#1\endcsname\relax%
                           \ifECM{\accent"01 #1}\else{\accent19 #1}\fi%
                       \else\csname @ac@#1\endcsname\fi}% 
\edef\v#1{\expandafter\ifx\csname @v@#1\endcsname\relax%
                           \ifECM{\accent"07 #1}\else{\accent20 #1}\fi%
                       \else\csname @v@#1\endcsname\fi}% 
\edef\u#1{\expandafter\ifx\csname @u@#1\endcsname\relax%
                           \ifECM{\accent"08 #1}\else{\accent21 #1}\fi%
                       \else\csname @u@#1\endcsname\fi}% 
\edef\=#1{\expandafter\ifx\csname @eq@#1\endcsname\relax%
                           \ifECM{\accent"09 #1}\else{\accent22 #1}\fi%
                       \else\csname @eq@#1\endcsname\fi}% 
\edef\^#1{\expandafter\ifx\csname @hat@#1\endcsname\relax%
                           \ifECM{\accent"02 #1}\else{\accent94 #1}\fi%
                       \else\csname @hat@#1\endcsname\fi}% 
\edef\.#1{\expandafter\ifx\csname @dot@#1\endcsname\relax%
                           \ifECM{\accent"0a #1}\else{\accent95 #1}\fi%
                       \else\csname @dot@#1\endcsname\fi}% 
\edef\H#1{\expandafter\ifx\csname @H@#1\endcsname\relax%
                           \ifECM{\accent"05 #1}\else{\accent125 #1}\fi%
                       \else\csname @H@#1\endcsname\fi}% 
\edef\~#1{\expandafter\ifx\csname @til@#1\endcsname\relax%
                           \ifECM{\accent"03 #1}\else{\accent126 #1}\fi%
                       \else\csname @til@#1\endcsname\fi}% 
% plain defined it ``wrongly'' in hex ("7F) and so could be wrongly lowercased
\edef\"#1{\expandafter\ifx\csname @um@#1\endcsname\relax%plain define it in hex
                           \ifECM{\accent"04 #1}\else{\accent127 #1}\fi%
                       \else\csname @um@#1\endcsname\fi}%
\def\c#1{\expandafter\ifx\csname @c@#1\endcsname\relax\noexpand\c#1%
                       \else\csname @c@#1\endcsname\fi}% 
% D. Knuth defined \oalign in a way that we can't use it in
%          an \edef or \xdef so i changed it temporarily
\def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
  \ialign{####\crcr#1\crcr}}}% put characters over each other
% our new def for angstrom bec. undefined in plain as an accent. macro
\def\r#1{\if#1a\@a:a\else\if#1A\@A:A\fi\fi}% 
\def\@a:a{\expandafter\ifx\csname @an@a\endcsname\relax%
                          \ifECM{\accent"06a}\else{\accent23a}\fi%
                       \else\csname @an@a\endcsname\fi}% 
\def\@A:A{\expandafter\ifx\csname @an@A\endcsname\relax%
                          \leavevmode\setbox0\hbox{h}\dimen@\ht0%
                            \advance\dimen@-1ex\rlap{\raise.67\dimen@\hbox{%
                                    \ifECM\char"06\else\char'27\fi}}A%
                       \else\csname @an@A\endcsname\fi}%
\xdef\aa{\r a}\xdef\AA{\r A}%
\fi% done for 2.09
\fi%\ifLEX
%
\catcode`\^^[=11%
\catcode`\^^^=11%
\catcode`\^^Y=11%
\catcode`\^^Z=11%
\catcode`\^^]=11%
\catcode`\^^_=11%
\catcode`\^^\=11%
\catcode`\^^P=11%
\catcode`\^^Q=11%
% Strings def are global to allow \@accent@ to work properly (not for 2e)
\def\@gobbletwo#1#2{}%
\ifx\documentclass\undefined\let\Gdef=\gdef%
\else\let\Gdef\@gobbletwo% Prevent LaTeX2e invalid chars even if gobbled
\fi%
\ifECM\Gdef\oe{\string ^^f7}\else\Gdef\oe{^^[}\fi%
\ifECM\Gdef\OE{\string ^^d7}\else\Gdef\OE{^^^}\fi%
\ifECM\Gdef\ss{\string ^^ff}\else\Gdef\ss{^^Y}\fi%
\ifECM\Gdef\ae{\string ^^e6}% ^^e6 introduce a pb, why?
                          \else\Gdef\ae{^^Z}% 
                          \fi%
\ifECM\Gdef\AE{\string ^^c6}\else\Gdef\AE{^^]}\fi%
\ifECM\else\global\lccode`^^]=`^^Z% a bypass for V2
           \global\uccode`^^Z=`^^]%
           \global\uccode`^^[=`^^^%
           \global\lccode`^^^=`^^[%
           \global\lccode`^^[=`^^[% 98/12
           \global\lccode`^^_=`^^\%
           \global\uccode`^^\=`^^_%
           \global\uccode`^^P=`I%
           \global\uccode`^^Q=`J%
\fi%
\ifECM\Gdef\o {\string ^^f8}\else\Gdef\o {^^\}\fi%
\ifECM\Gdef\O {\string ^^d8}\else\Gdef\O {^^_}\fi%
% but require an uppercase def for \ss different for ec/dc ie:
\ifECM\Gdef\SS{\string ^^df}\fi% valid global def for DC
%
\def\D{\char^^bf}%
\ifx\D\pounds\Gdef\pounds{\string ^^bf}\fi%
% Plain has no definition of \pounds
\ifx\pounds\undefined{\ifECM\Gdef\pounds{\string ^^bf}%lfonts.tex will redef.it
                     \else\Gdef\pounds{{\csname it\endcsname\char'44}}\fi}\fi% 
%
\ifx<\undefined\gdef<{\string <}\fi%  defs until french.sty were activated
\ifx>\undefined\gdef>{\string >}\fi%
%
\ifECM\Gdef\i{^^Y}\else\Gdef\i{^^P}\fi% needed by \csubinverse for patterns
\ifECM\Gdef\j{^^Z}\else\Gdef\j{^^Q}\fi% dotless letters 
% Localy needed anyway:
\ifECM\def\i{^^Y}\else\def\i{^^P}\fi% needed for \csubinverse 
% LaTeX 2e doesn't care of i and j without dot on it
\ifx\documentclass\undefined\else\ifECM\edef\i{i}\edef\j{j}\fi\fi%
% 
% Are we in TeX V2 or V3?
\newif\ifVtwo \newif\ifSkip \Skipfalse 
\newif\ifnonActifCar\nonActifCartrue % 
\def\ACTIVEtrue{\nonActifCarfalse}% user interface is reversed.
\def\ACTIVEfalse{\nonActifCartrue}% 
\newif\ifMlTeXthree \MlTeXthreefalse
\catcode`^=\active% non hexa processing in V2
\ifx\undefined\lefthyphenmin\Vtwotrue% Vtwo means MlTeX V2
                      \def^#1{\ifx#1^\else\string ^#1\fi}% eat ^^ in TeX v2
                      \kbAissue%
                      \message{ -28- ATTENTION : TeX Version 2 ne permet pas 
                                  d'utiliser des caracteres}%
                      \messag@{ accentues 8-bits.}%
                    \ifnum\catcode`\{=1%\} emacs
                      \catcode`^=12%
                      \ifx\kbAissue\relax\newlinechar=`\^\message{^}\fi%
                      \kbAissue%
                      \message{ -92- Vous devez : }%
                      \messag@{ - soit utiliser un moteur avec option MlTeX,}%
                      \messag@{ - soit passer en codage T1 par defaut.}
                      \Stop% a vous de choisir... --bg
                    \fi%
                      \Skiptrue%
\else\ifx\starthyph\undefined\Vtwofalse\else\Vtwotrue%
\fi%
\ifx\charsubdef\undefined\else\MlTeXthreetrue\fi%
\ifLEX\else%
  \ifMlTeXthree\else%
      \ifECM\else{\catcode`\^=12\def\@tempb{^ }%%%\catcode`\^=7%
              \def\@tempa{\noexpand\dGs}%
           \ifx\@tempa\dGs\else%
                \ifx\@kb@msgXXIX\undefined%
                    \gdef\@kb@msgXXIX{\global\let\@kb@msgXXIX\relax%
                     \ifx\kbAissue\relax\newlinechar=`\^\message{^}\fi%
 \kbAissue%
 \message{ -29- ***Warning***\string: TeX engine in use along with CM fonts}%
 \messag@{ (as in current TeX format) isn't sufficient to hyphenate}%
 \messag@{ words containing diacritics (like in French).}%
                                     }\@kb@msgXXIX% 
               \fi%
           \fi%
          }%\catcode`\^=12
      \fi%\ifECM
  \fi%\ifMlTeXthree
\fi% ifLEX
\fi% lefthyphenmin
\ifVtwo\else\catcode`\^=7% reset value of plain
% reset first 32 chars too erroneously (?) illegal since 2e
\catcode`\^^00=11%
\catcode`\^^01=11%
\catcode`\^^02=11%
\catcode`\^^03=11%
\catcode`\^^04=11%
\catcode`\^^05=11%
\catcode`\^^06=11%
\catcode`\^^07=11%
\catcode`\^^08=11%
%\catcode`\^^09=11% is tab ^^I
%\catcode`\^^0a=11% is nl  ^^J
\catcode`\^^0b=11%
%\catcode`\^^0c=11% is ff  ^^L
%\catcode`\^^0d=11% is cr  ^^M
\catcode`\^^0e=11%
\catcode`\^^0f=11%
\catcode`\^^10=11%
\catcode`\^^11=11%
\catcode`\^^12=11%
\catcode`\^^13=11%
\catcode`\^^14=11%
\catcode`\^^15=11%
\catcode`\^^16=11%
\catcode`\^^17=11%
\catcode`\^^18=11%
\catcode`\^^19=11%
\catcode`\^^1a=11%
\catcode`\^^1b=11%
\catcode`\^^1c=11%
\catcode`\^^1d=11%
\catcode`\^^1e=11%
\catcode`\^^1f=11%
\fi%
\ifSkip\else% The code is only for MlTeX or TeX V3.xxxx
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Codage du tableau : definition de l'accentuation
\def\@ac#1#2#3{\ifx.#2\let#1\undefined%
             \else\def#1{#2}%
                  \ifx#2\`\def#3{gr}\else%
                     \ifx#2\'\def#3{ac}\else%
                        \ifx#2\"\def#3{um}\else%
                           \ifx#2\^\def#3{hat}\else%
                              \ifx#2\v\def#3{v}\else%
                                 \ifx#2\u\def#3{u}\else%
                                    \ifx#2\=\def#3{eq}\else%
                                       \ifx#2\.\def#3{dot}\else%
                                          \ifx#2\~\def#3{til}\else%
                                             \ifx#2\H\def#3{H}\else%
                                                \ifx#2\c\def#3{c}\else%
                              \ifx#2\r\def#3{an}\else\let#3\undefined\fi%
                  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
             \fi}%
\def\ac[ #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 ]%
{\ifLEX\kbAissue\message{^^J -56- Processed 8bits characters are:}\fi%
        \@ac\ACa{#1}\ANa%
        \@ac\ACb{#2}\ANb%
        \@ac\ACc{#3}\ANc%
        \@ac\ACd{#4}\ANd%
        \@ac\ACe{#5}\ANe%
        \@ac\ACf{#6}\ANf%
        \@ac\ACg{#7}\ANg%
        \@ac\ACh{#8}\ANh\let[\minu%]
       }%
% La macro precisant les noms internes est devenue inutile.
\def\noms| #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 |%
       {\ifx.#1\let\ANa\undefined\else\def\ANa{#1}\fi%
        \ifx.#2\let\ANb\undefined\else\def\ANb{#2}\fi%
        \ifx.#3\let\ANc\undefined\else\def\ANc{#3}\fi%
        \ifx.#4\let\ANd\undefined\else\def\ANd{#4}\fi%
        \ifx.#5\let\ANe\undefined\else\def\ANe{#5}\fi%
        \ifx.#6\let\ANf\undefined\else\def\ANf{#6}\fi%
        \ifx.#7\let\ANg\undefined\else\def\ANg{#7}\fi%
        \ifx.#8\let\ANh\undefined\else\def\ANh{#8}\fi%
       }%
\newif\ifONE\newif\ifOK%
\def\ONECHAR#1#2/{\ifx9#2\ONEtrue\else\ONEfalse\fi}%
%definition des minuscules
%==>\madef{caract accentue}{accentuation}{Nom minuscule}{lettre}
\def\madef#1#2#3#4#5{\ifx.#1\else\@madef{#1}{#2}{#3}{#4}{#5}\fi}% si pas un . 
\def\@madef#1#2#3#4#5{\ONECHAR#19/%
    \ifx#2\undefined% 
    \else
         \ifVtwo\ifONE% #1 is defaultly \active with MlTeX R1
                              \DEBUGmessage{K0(\noexpand #1)}%
%                              \xdef#1{#2{#4}}%
                     \outside{\edef#1{#2{#4}}}% 2005/04/08
                            \fi% 
         \else%\def\tempb{\global\catcode`}% now in V3
               \def\tempb{\catcode`}% now in V3 2005/04/08
                  \let\A=A\ifMACRO\let\A\active\else\ifLIGS\let\A\active\fi\fi%
                  \ifx#2\empty\let\A=\active\fi%
                  \ifcat\active\A% 
                     \ifECM\OKfalse% normally nothing to do
                       \ifMACRO\OKtrue\fi% except for macros
                       \ifLIGS\OKtrue\fi% except for ligs
                       \ifnonActifCar\ifx\ss #4\OKtrue\fi% \ss is specific
                        \else\OKtrue\fi% except if active char
                       \ifOK%
                          \ifONE% exclude multiletters
                                \ifLEX\else%
\DEBUGmessage{K1(\noexpand #1)}%
%                                       \gdef #1{#4}% 98/12/24
                               \outside{\def #1{#4}}% 2005/04/08
                            \edef\tempe{\noexpand#1}%
                    \ifLIGS\else\@stdencodedecode\tempe{#4}\fi%
                                \fi%
% Defaultly there is no lower/upper case
%\global
\outsidecase\lccode`#1=`#1% 2005/04/12
%\global
\outsidecase\uccode`#1=`#1% 2005/04/12
                          \edef\OldActiveChars{\@tempc}%
                          \xdef\@tempc{\OldActiveChars%
                                            \tempb\string#1=\active}%
                          \fi% ifONE
                       \fi% ifOK
                     \else% Not using ECM
                          \ifONE% will exclude multiletters
\ifnonActifCar\else\tempb#1=\active\fi%
                                \ifMlTeXthree\else\tempb#1=\active\fi%
                             \ifLEX\else%  don't xdef for oe, ae, etc.
% future dev: test if #4 need to be ended by {} or not. Today assumed.
\DEBUGmessage{K2(\noexpand #1)}%
%                                   \gdef #1{#4}% usually ended by {} 1/99
               \outside{\def #1{\protect #4}}% usually ended by {} 2005/04/08
                            \edef\tempe{\noexpand#1}%
                    \ifLIGS\else\@stdencodedecode\tempe{#4}\fi%
% Defaultly there is no lower/upper case
%\global
\outsidecase\lccode`#1=`#1% 2005/04/12
%\global
\outsidecase\uccode`#1=`#1% 2005/04/12
                             \fi%ifLEX
                                \edef\OldActiveChars{\@tempc}%
                                \xdef\@tempc{\OldActiveChars%
                                                  \tempb\string#1=\active}%
                          \fi%
                     \fi%
                  \else% Not a Macro, Not a lig, ..
                        \ifLEX\else\def\D{#4}%
%                                    \if\i #4\def\D{\noexpand\i}\fi%
%                                    \if\j #4\def\D{\noexpand\j}\fi%
                                    \if\i #4\def\D{\protect\i}\fi% 2005/08/29
                                    \if\j #4\def\D{\protect\j}\fi% 2005/08/29
\DEBUGmessage{K3(\noexpand #1)}%
%                                    \xdef#1{\expandafter\noexpand#2{\D}}%
% \noexpand moved to \protect, due to \c wrong expansion. 2005/04/08
           \outside{\edef#1{\expandafter\protect#2{\D}}}% 2005/04/08
% Defaultly there is no lower/upper case
%\global
\outsidecase\lccode`#1=`#1% 2005/04/12
%\global
\outsidecase\uccode`#1=`#1% 2005/04/12
                        \fi%
\ifnonActifCar\else\tempb#1=\active\fi%
                       \ifMlTeXthree\else\tempb#1=\active\fi%
                       \edef\OldActiveChars{\@tempc}%
                       \xdef\@tempc{\OldActiveChars%
                                         \tempb\string#1=\active}%
                  \fi%
         \fi% ifVtwo
     \expandafter\def\csname #3\endcsname{#1}% for further use
     \fi% ifx#2
\iffalse%%%%%%%%%%%%%%%
 \ifLEX\ifLEXhic\ifONE\message{\string#1 \space}
  {\ToSeven\def\GUILL{"}
              \edef\FULL{#2\LaLettre}%
  \ifx\empty#2\edef\FULL{\LaLettre}\fi
  \immediate\write\kbseven{\string#1\space\space\space 
                                     printf(\GUILL\FULL\GUILL);}}
  {\ToEight\def\GUILL{\ifLIGS"\fi}%
              \edef\FULL{#2{\GUILL\LaLettre\GUILL}}%
  \ifx\empty#2\edef\FULL{\GUILL\LaLettre\GUILL}\fi
  \immediate\write\kbeight{\FULL%
                           |\string#1\space\space\space printf("\string#1");}}%
 \fi\fi\fi% ifLEX
\fi%%%%%%%%%%%%%%%%%%%%
%%% Set ORI char if not already defined.
\ifx#5\undefined\else%
  \def\GOfrench{utf8}%
  \ifx\@kbencoding\GOfrench%
  \else\def\GOfrench##1##2\void{##1}% Remove braces. 2005/03/14
   \expandafter%
    \ifx\csname @#5@\GOfrench#4\void ORI\endcsname\relax%
       \expandafter\xdef\csname @#5@\GOfrench#4\void ORI\endcsname{\string #1}%
    \fi%
  \fi%
\def\GOfrench##1##2\void{##1}% Remove braces. 2005/03/14
\DEBUGmessage{KORI (\string\@#5@\GOfrench#4\void ORI=%
                    \csname @#5@\GOfrench#4\void ORI\endcsname)}%
\fi%
%%%
}% @madef 
\def\minu#1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 | #9 |%
    {% The following for doFLEX (new kb2lex)
\DEBUGmessage{^^J low ---- }%
\let\LAa\undefined\let\LAb\undefined\let\LAc\undefined\let\LAd\undefined
\let\LAe\undefined\let\LAf\undefined\let\LAg\undefined\let\LAh\undefined
\ifLEX\edef\@tempc{}\fi% required for LaTeX kb2lex!
\def\@tempa##19{\def\LaLettre{##1}%
                \def\LLa{##1}\def\LLb{##1}\def\LLc{##1}\def\LLd{##1}%
                \def\LLe{##1}\def\LLf{##1}\def\LLg{##1}\def\LLh{##1}%
                                  }\@tempa#19%     
     \madef#2{\ACa}{LAa}{#1}\ANa%
     \madef#3{\ACb}{LAb}{#1}\ANb%
     \madef#4{\ACc}{LAc}{#1}\ANc%
     \madef#5{\ACd}{LAd}{#1}\ANd%
     \madef#6{\ACe}{LAe}{#1}\ANe%
     \madef#7{\ACf}{LAf}{#1}\ANf%
     \madef#8{\ACg}{LAg}{#1}\ANg%
     \madef#9{\ACh}{LAh}{#1}\ANh% 
     \let\A=A\ifMACRO\let\A\active\else\ifLIGS\let\A\active\fi\fi%
     \ifcat\A\active\xdef\Lchar{}\else\xdef\Lchar{#1}\fi%dummy for \oe \ae etc.
     \let\ucs\ucsminu%
     \let\hex\hexminu}%
\def\hexminu| #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 %[
                                                    ]%
    {\ifx.#1\let\HLa\undefined\else\edef\HLa{\noexpand#1}\fi%
     \ifx.#2\let\HLb\undefined\else\edef\HLb{\noexpand#2}\fi%
     \ifx.#3\let\HLc\undefined\else\edef\HLc{\noexpand#3}\fi%
     \ifx.#4\let\HLd\undefined\else\edef\HLd{\noexpand#4}\fi%
     \ifx.#5\let\HLe\undefined\else\edef\HLe{\noexpand#5}\fi%
     \ifx.#6\let\HLf\undefined\else\edef\HLf{\noexpand#6}\fi%
     \ifx.#7\let\HLg\undefined\else\edef\HLg{\noexpand#7}\fi%
     \ifx.#8\let\HLh\undefined\else\edef\HLh{\noexpand#8}\fi%
     \let[\MAJU%]
    }%
\let\ULa\empty\let\ULb\empty\let\ULc\empty\let\ULd\empty\let\ULe\empty%
\let\ULf\empty\let\ULg\empty\let\ULh\empty%
\let\ifucs\iffalse%
\def\ucsminu| #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 %[
                                                    ]%
    {\let\ifucs\iftrue%
     \ifx.#1\let\ULa\empty\else\edef\ULa{\noexpand#1}\fi%
     \ifx.#2\let\ULb\empty\else\edef\ULb{\noexpand#2}\fi%
     \ifx.#3\let\ULc\empty\else\edef\ULc{\noexpand#3}\fi%
     \ifx.#4\let\ULd\empty\else\edef\ULd{\noexpand#4}\fi%
     \ifx.#5\let\ULe\empty\else\edef\ULe{\noexpand#5}\fi%
     \ifx.#6\let\ULf\empty\else\edef\ULf{\noexpand#6}\fi%
     \ifx.#7\let\ULg\empty\else\edef\ULg{\noexpand#7}\fi%
     \ifx.#8\let\ULh\empty\else\edef\ULh{\noexpand#8}\fi%
    }%
%definition des majuscules
%==>\Madef{caract accentue}{accentuation}{Nom majuscule}{lettre}{Nom accent}
\def\Madef#1#2#3#4#5{\ifx.#1\else\@madef{#1}{#2}{#3}{#4}{#5}\fi}% si pas un . 
\def\MAJU#1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 | #9 |%
    {\DEBUGmessage{^^J UP \space ---- }%
     \let\MAa\undefined\let\MAb\undefined\let\MAc\undefined\let\MAd\undefined
     \let\MAe\undefined\let\MAf\undefined\let\MAg\undefined\let\MAh\undefined
     \ifLEX\edef\@tempc{}\fi% required for LaTeX kb2lex!
\def\@tempa##1/{\def\LaLettre{##1}%
                \def\MLa{##1}\def\MLb{##1}\def\MLc{##1}\def\MLd{##1}%
                \def\MLe{##1}\def\MLf{##1}\def\MLg{##1}\def\MLh{##1}%
                                  }\@tempa#1/%
     \Madef#2{\ACa}{MAa}{#1}\ANa%
     \Madef#3{\ACb}{MAb}{#1}\ANb%
     \Madef#4{\ACc}{MAc}{#1}\ANc%
     \Madef#5{\ACd}{MAd}{#1}\ANd%
     \Madef#6{\ACe}{MAe}{#1}\ANe%
     \Madef#7{\ACf}{MAf}{#1}\ANf%
     \Madef#8{\ACg}{MAg}{#1}\ANg%
     \Madef#9{\ACh}{MAh}{#1}\ANh%
     \let\A=A\ifMACRO\let\A\active\else\ifLIGS\let\A\active\fi\fi%
     \ifcat\A\active\xdef\Mchar{}\else%
                   \ifx.#1\xdef\Mchar{}\else\xdef\Mchar{#1}\fi%
     \fi% dummy for \OE etc.
     \let\ucs\ucsMAJU%
     \let\hex\hexMAJU}%
\def\hexMAJU| #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 %[
                                                    ]%
    {\ifx.#1\let\HMa\undefined\else\edef\HMa{\noexpand#1}\fi%
     \ifx.#2\let\HMb\undefined\else\edef\HMb{\noexpand#2}\fi%
     \ifx.#3\let\HMc\undefined\else\edef\HMc{\noexpand#3}\fi%
     \ifx.#4\let\HMd\undefined\else\edef\HMd{\noexpand#4}\fi%
     \ifx.#5\let\HMe\undefined\else\edef\HMe{\noexpand#5}\fi%
     \ifx.#6\let\HMf\undefined\else\edef\HMf{\noexpand#6}\fi%
     \ifx.#7\let\HMg\undefined\else\edef\HMg{\noexpand#7}\fi%
     \ifx.#8\let\HMh\undefined\else\edef\HMh{\noexpand#8}\fi%
     % process hexdecimal codes if necessary
\ifx\HLa\undefined\else\DOhex\ACa{\LAa}{\HLa}{\MAa}{\HMa}{\ANa}{\ULa}{\UMa}\fi%
\ifx\HLb\undefined\else\DOhex\ACb{\LAb}{\HLb}{\MAb}{\HMb}{\ANb}{\ULb}{\UMb}\fi%
\ifx\HLc\undefined\else\DOhex\ACc{\LAc}{\HLc}{\MAc}{\HMc}{\ANc}{\ULc}{\UMc}\fi%
\ifx\HLd\undefined\else\DOhex\ACd{\LAd}{\HLd}{\MAd}{\HMd}{\ANd}{\ULd}{\UMd}\fi%
\ifx\HLe\undefined\else\DOhex\ACe{\LAe}{\HLe}{\MAe}{\HMe}{\ANe}{\ULe}{\UMe}\fi%
\ifx\HLf\undefined\else\DOhex\ACf{\LAf}{\HLf}{\MAf}{\HMf}{\ANf}{\ULf}{\UMf}\fi%
\ifx\HLg\undefined\else\DOhex\ACg{\LAg}{\HLg}{\MAg}{\HMg}{\ANg}{\ULg}{\UMg}\fi%
\ifx\HLh\undefined\else\DOhex\ACh{\LAh}{\HLh}{\MAh}{\HMh}{\ANh}{\ULh}{\UMh}\fi%
%%%%%%%%%%%%%%%%%%
% Process kb2lex %
%%%%%%%%%%%%%%%%%%
\ifx\ULa\empty%
\ifx\LAa\undefined\else\expandafter\doFLEX\expandafter{\LAa}{\ACa}{\LLa}\fi%
\else\GenUcsCode{\ULa}%
\ifx\LAa\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACa}{\LLa}\fi%
\fi%
\ifx\UMa\empty%
\ifx\MAa\undefined\else\expandafter\doFLEX\expandafter{\MAa}{\ACa}{\MLa}\fi%
\else\GenUcsCode{\UMa}%
\ifx\MAa\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACa}{\MLa}\fi%
\fi%
\ifx\ULb\empty%
\ifx\LAb\undefined\else\expandafter\doFLEX\expandafter{\LAb}{\ACb}{\LLb}\fi%
\else\GenUcsCode{\ULb}%
\ifx\LAb\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACb}{\LLb}\fi%
\fi%
\ifx\UMb\empty%
\ifx\MAb\undefined\else\expandafter\doFLEX\expandafter{\MAb}{\ACb}{\MLb}\fi%
\else\GenUcsCode{\UMb}%
\ifx\MAb\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACb}{\MLb}\fi%
\fi%
\ifx\ULc\empty%
\ifx\LAc\undefined\else\expandafter\doFLEX\expandafter{\LAc}{\ACc}{\LLc}\fi%
\else\GenUcsCode{\ULc}%
\ifx\LAc\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACc}{\LLc}\fi%
\fi%
\ifx\UMc\empty%
\ifx\MAc\undefined\else\expandafter\doFLEX\expandafter{\MAc}{\ACc}{\MLc}\fi%
\else\GenUcsCode{\UMc}%
\ifx\MAc\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACc}{\MLc}\fi%
\fi%
\ifx\ULd\empty%
\ifx\LAd\undefined\else\expandafter\doFLEX\expandafter{\LAd}{\ACd}{\LLd}\fi%
\else\GenUcsCode{\ULd}%
\ifx\LAd\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACd}{\LLd}\fi%
\fi%
\ifx\UMd\empty%
\ifx\MAd\undefined\else\expandafter\doFLEX\expandafter{\MAd}{\ACd}{\MLd}\fi%
\else\GenUcsCode{\UMd}%
\ifx\MAd\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACd}{\MLd}\fi%
\fi%
\ifx\ULe\empty%
\ifx\LAe\undefined\else\expandafter\doFLEX\expandafter{\LAe}{\ACe}{\LLe}\fi%
\else\GenUcsCode{\ULe}%
\ifx\LAe\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACe}{\LLe}\fi%
\fi%
\ifx\UMe\empty%
\ifx\MAe\undefined\else\expandafter\doFLEX\expandafter{\MAe}{\ACe}{\MLe}\fi%
\else\GenUcsCode{\UMe}%
\ifx\MAe\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACe}{\MLe}\fi%
\fi%
\ifx\ULf\empty%
\ifx\LAf\undefined\else\expandafter\doFLEX\expandafter{\LAf}{\ACf}{\LLf}\fi%
\else\GenUcsCode{\ULf}%
\ifx\LAf\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACf}{\LLf}\fi%
\fi%
\ifx\UMf\empty%
\ifx\MAf\undefined\else\expandafter\doFLEX\expandafter{\MAf}{\ACf}{\MLf}\fi%
\else\GenUcsCode{\UMf}%
\ifx\MAf\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACf}{\MLf}\fi%
\fi%
\ifx\ULg\empty%
\ifx\LAg\undefined\else\expandafter\doFLEX\expandafter{\LAg}{\ACg}{\LLg}\fi%
\else\GenUcsCode{\ULg}%
\ifx\LAg\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACg}{\LLg}\fi%
\fi%
\ifx\UMg\empty%
\ifx\MAg\undefined\else\expandafter\doFLEX\expandafter{\MAg}{\ACg}{\MLg}\fi%
\else\GenUcsCode{\UMg}%
\ifx\MAg\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACg}{\MLg}\fi%
\fi%
\ifx\ULh\empty%
\ifx\LAh\undefined\else\expandafter\doFLEX\expandafter{\LAh}{\ACh}{\LLh}\fi%
\else\GenUcsCode{\ULh}%
\ifx\LAh\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACh}{\LLh}\fi%
\fi%
\ifx\UMh\empty%
\ifx\MAh\undefined\else\expandafter\doFLEX\expandafter{\MAh}{\ACh}{\MLh}\fi%
\else\GenUcsCode{\UMh}%
\ifx\MAh\undefined\else\expandafter\doFLEX\expandafter{\UcsCode}{\ACh}{\MLh}\fi%
\fi%
     % now ready to start a 4up
     \let[\minu%]
    }%
\let\UMa\empty\let\UMb\empty\let\UMc\empty\let\UMd\empty\let\UMe\empty%
\let\UMf\empty\let\UMg\empty\let\UMh\empty%
\def\ucsMAJU| #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 %[
                                                    ]%
    {\let\ifucs\iftrue%
     \ifx.#1\let\UMa\empty\else\edef\UMa{\noexpand#1}\fi%
     \ifx.#2\let\UMb\empty\else\edef\UMb{\noexpand#2}\fi%
     \ifx.#3\let\UMc\empty\else\edef\UMc{\noexpand#3}\fi%
     \ifx.#4\let\UMd\empty\else\edef\UMd{\noexpand#4}\fi%
     \ifx.#5\let\UMe\empty\else\edef\UMe{\noexpand#5}\fi%
     \ifx.#6\let\UMf\empty\else\edef\UMf{\noexpand#6}\fi%
     \ifx.#7\let\UMg\empty\else\edef\UMg{\noexpand#7}\fi%
     \ifx.#8\let\UMh\empty\else\edef\UMh{\noexpand#8}\fi%
    }%
\def\@tempc{}%
\def\Recycle#1{\def\ligne{}%
               \bgroup\def\tempa{\catcode`}\expandafter\tempa#1=11%
               \edef\ligne{\expandafter\string #1}%
               \edef\tempa{\expandafter\noexpand#1}%
               \edef\tempa{\expandafter\string\tempa}%
               \ifx\ligne\tempa% Do we need to re-input the string?
                 \xdef\ligne{\ligne}%
                 \DEBUGmessage{(stringed \ligne)}%
               \else%
                 \immediate\openout\kbconfigw=\@jobname.tmp%
                 \immediate\write\kbconfigw{\expandafter\string#1}%
                 \immediate\closeout\kbconfigw%
                 \immediate\openin\kbconfigr=\@jobname.tmp%
                 \immediate\read\kbconfigr to \ligne %
                 \immediate\closein\kbconfigr%
                 \xdef\ligne{\expandafter\@firstoftwo\ligne{}}%
                 \DEBUGmessage{%
                    (recycled \expandafter\string #1 ==\string> \ligne)}%
               \fi%
               \egroup%
               }%
\def\DOhex#1#2#3#4#5#6#7#8{%
%                1              2         3           4        5        6
%           accentuation, lettre_min+ code_hex, lettre_maj+code_hex, nom_accent
%      7            8
% ucs-min-code ucs-maj-code
%look firstly to see if there are more than one letter character
\ONEfalse\ifx\undefined#4\else\expandafter\ONECHAR#49/\fi%
    \ifVtwo% nothing to do in MlTeX V2 
           \else% we are with TeX 3 or MlTeX
               \ifECM\ifnonActifCar\else%as just a chardef adjustement in hex.
                            \ifLEX\else% not for LEX 
%                            \def\tempa{\global\catcode`}%
%                            \expandafter\tempa#2=\active%
                            \def\tempa{\catcode`}%
                      \outside{\expandafter\tempa#2=\active}% 2005/04/08
\DEBUGmessage{K4a(#2)}%
\ifx #3\undefined%
%                            \expandafter\xdef#2{\expandafter\string#3}%
              \outside{\expandafter\edef#2{\expandafter\string#3}}% 2005/04/08
\else%
\expandafter\let\expandafter\tempe #2% For plain especially: first expansion,
\expandafter\def\expandafter\tempe\expandafter{\tempe}% second and last.
%                    \expandafter\xdef#2{\noexpand\IeC{%only one expansion
%                                 \expandafter\noexpand\tempe}}%  for plain
       \outside{\expandafter\edef#2{\noexpand\IeC{%only one expansion for Plain
                    \expandafter\noexpand\tempe}}}% 2005/04/08
            \ifx#6\undefined\ifLIGS\else\def\tempa{\@stdencodedecode{#2}}%
                                         \expandafter\tempa\tempe\fi\fi%
\fi% #3\undefined%
                            \fi% not for LEX 
                        \ifONE% exclude multiletters
                         \ifx\undefined#4\else%
%                            \def\tempa{\global\catcode`}%
%                            \expandafter\tempa#4=\active%
                            \def\tempa{\catcode`}%
                      \outside{\expandafter\tempa#4=\active}%
\DEBUGmessage{K4b(#4)}%
\ifx #5\undefined%
%                      \expandafter\xdef#4{\expandafter\string#5}%
              \outside{\expandafter\edef#4{\expandafter\string#5}}% 2005/04/08
\else%
\expandafter\let\expandafter\tempe #4% For plain especially: first expansion,
\expandafter\def\expandafter\tempe\expandafter{\tempe}% second and last.
%                    \expandafter\xdef#4{\noexpand\IeC{%only one expansion
%                                \expandafter\noexpand\tempe}}%  for plain
  \outside{\expandafter\edef#4{\noexpand\IeC{%only one expansion for Plain
                                 \expandafter\noexpand\tempe}}}% 2005/04/08  
            \ifx#6\undefined\ifLIGS\else\def\tempa{\@stdencodedecode{#4}}%
                                         \expandafter\tempa\tempe\fi\fi%
\fi% #5\undefined%
                         \fi%\undefined#4
                        \fi%\ifONE% 
                      \fi%
                \fi% now define \lccode & \uccode %%%%%%%%%%%%%%%%%%%%%%%%%%%%
                \ifx\empty#1\let\X=X%
                         \ifECM\ifnonActifCar%don't activate oe ae etc in 8bits
                          \expandafter\ifx #2\undefined\else\edef\D{#2}\fi%
                                     \edef\E{\noexpand\ss}
                                  \ifx \D\E% but let s-tzet
                                  \else%
%                             \def\tempa{\global\catcode`}%\def\tempb{^}%
%                             \expandafter\tempa#2=11%
                             \def\tempa{\catcode`}%
                     \outside{\expandafter\tempa#2=11}% 2005/04/08
                             \def\tempe{\string}%
                             \edef\OldActiveChars{\@tempc}%  disactivate
                             \xdef\@tempc{\OldActiveChars%
                                             \tempa\expandafter\tempe#2=11}%
                             \ifx\undefined#4\else
                                 \ifONE\expandafter\tempa#4=11%
                                 \edef\OldActiveChars{\@tempc}%disactivate
                                 \xdef\@tempc{\OldActiveChars%
                                             \tempa\expandafter\tempe#4=11}%
                                 \else%
                                   \ifx\undefined#5\else% case hex code is undef
                                     \let\tempc=#5\expandafter\tempa\tempc=11%
                                   \fi% ifx undefined
                                 \fi%
                             \fi
                             \let\X=\active%
                                  \fi% s-tzet
                         \fi\fi%
                \else\let\X\active\ifnonActifCar%
%                       \def\tempa{\global\catcode`}\expandafter\tempa#2=11%
%                              \ifx\undefined#4\else\expandafter\tempa#4=11\fi%
    \def\tempa{\catcode`}\outside{\expandafter\tempa#2=11}% 2005/04/08
         \ifx\undefined#4\else\outside{\expandafter\tempa#4=11}\fi% 2005/04/08
                                  \fi%
                \ifECM\ifnonActifCar\let\X=\active\fi\fi% Usually no lcc/ucc
                \fi%
                \def\tempa{\lccode`}\def\tempb{=`}%
                \ifLIGS\let\X=\active\fi% don't do that for ligs
                \ifMACRO\let\X=\active\fi% don't do that for macros
                \ifcat\X\active% do usual ucc/lcc encoding
%                             \global\expandafter\tempa#2\expandafter\tempb#2%
\edef\GOfrench{\tempa\expandafter\noexpand#2\tempb\expandafter\noexpand#2}%
\expandafter\outsidecase\GOfrench% 2005/04/12
                    \ifx\undefined#4\else% 
                      \ifONE%
%                             \global\expandafter\tempa#4\expandafter\tempb#2%
\edef\GOfrench{\tempa\expandafter\noexpand#4\tempb\expandafter\noexpand#2}%
\expandafter\outsidecase\GOfrench% 2005/04/12
%                           \def\tempa{\global\uccode`}%
%                           \expandafter\tempa#2\expandafter\tempb#4%
%                           \expandafter\tempa#4\expandafter\tempb#4%
                           \def\tempa{\uccode`}%
\edef\GOfrench{\tempa\expandafter\noexpand#2\tempb\expandafter\noexpand#4}%
\expandafter\outsidecase\GOfrench% 2005/04/12
\edef\GOfrench{\tempa\expandafter\noexpand#4\tempb\expandafter\noexpand#4}%
\expandafter\outsidecase\GOfrench% 2005/04/12
                      \else% do it in hexa for #4 ==> #5 replace #4
                        \ifx#5\undefined\else% Code revisited 1999/11/26.
%                        \global\expandafter\tempa #5\expandafter\tempb #2%
\edef\GOfrench{\tempa\expandafter\noexpand#5\tempb\expandafter\noexpand#2}%
\expandafter\outsidecase\GOfrench% 2005/04/12
                        \ifLEX\else%\def\tempa{\global\uccode`}%
                                   \def\tempa{\uccode`}%
                             \edef\D{\expandafter\string #5}\edef\E{#2}%
                         \expandafter\ifx#5\undefined\else\edef\D{#5}\fi%
%
\ifECM% \D expansion could stop to \ss, so let it be the target code for
\def\tempa{\IeC{\ss{}}}% modified 1999/11/26.
\expandafter%
     \ifx\D\tempa\edef\D{\string ^^ff}\fi% the next comparison.
     \ifx\E\tempa\let\D\E\fi% the next comparison. added 1999/11/26.
\fi%
                         \ifx\D\E%
                  \expandafter\ifx \@unusedslot \undefined% do it once
                   {%
%\def\tempa{\global\catcode`}%
%\expandafter\tempa#2=11\def\tempa{\global\uccode`}%
%\edef\tempb{`\expandafter\noexpand\@unusedslot}%
%\expandafter\tempa#2\tempb%
\def\tempa{\catcode`}%
\outside{\expandafter\tempa#2=11}\def\tempa{\uccode`}% 2005/04/08
\edef\tempb{\expandafter\string\@unusedslot}% 2005/04/08
\edef\tempb{`\expandafter\noexpand\tempb}% 2005/04/08
\outside{\expandafter\tempa#2\tempb}% 2005/04/08
                   }%
%                   \expandafter\xdef \@unusedslot{#4}%
           \outside{\expandafter\edef \@unusedslot{#4}}% 2005/04/13
                    \def\tempa{\global\catcode`}%
                     \edef\OldActiveChars{\@tempc}%  disactivate
                      \xdef\@tempc{\OldActiveChars%
                                   \tempa\expandafter\string \@unusedslot =13}%
                              \else%
\ifx\undefined\unusedslot\def\unusedslot{undefined}\fi%
\kbAissue%
\message{ -54- ERROR: \string\unusedslot\space (\unusedslot) is invalid} 
\messag@{ (active char. generating: \@unusedslot)}%
                              \fi%
                          \else%
% When #5 is undefined it is defaulty defined to #4 
% to avoid \uppercase to issue an undefined cs message.
%\expandafter\ifx#5\undefined\expandafter\xdef#5{#4}\fi%
\expandafter\ifx#5\undefined\outside{\expandafter\edef#5{#4}}%
            \fi% 2005/04/08
%                              \expandafter\tempa #2\expandafter\tempb #5%
%                              \expandafter\tempa #5\expandafter\tempb #5%
\edef\GOfrench{\expandafter\tempa\expandafter\noexpand #2%
               \expandafter\tempb\expandafter\noexpand #5}%  2005/04/13
      \expandafter\outsidecase\GOfrench% 2005/04/13
\edef\GOfrench{\expandafter\tempa\expandafter\noexpand #5%
               \expandafter\tempb\expandafter\noexpand #5}%  2005/04/13
      \expandafter\outsidecase\GOfrench%  2005/04/13
                          \fi%    
                        \ifECM\ifnonActifCar\else%
                        \ifx\D\E\else% case estzet and SS
%               \global\expandafter\edef #3{\expandafter\string #3}% dont point
%               \global\expandafter\edef #5{\expandafter\string #5}% elsewhere
             \outside{\expandafter\edef #3{\expandafter\string #3}}% dont point
             \outside{\expandafter\edef #5{\expandafter\string #5}}% elsewhere
                        \fi\fi\fi%
                        \fi% ifLEX
                        \fi% ifx undefined
                      \fi%
                    \fi%
                \else\edef\D{#2}% do ucc/lcc encoding *after* expanding macros
%                    \global\expandafter\tempa\D\expandafter\tempb\D%
                   \outside{\expandafter\tempa\D\expandafter\tempb\D}%
                    \ifx\undefined#4\else\edef\Q{#4}%
%                     \global\expandafter\tempa\Q\expandafter\tempb\D%
                    \outside{\expandafter\tempa\Q\expandafter\tempb\D}%
                    \def\tempa{\uccode`}%
%                     \global\expandafter\tempa\D\expandafter\tempb\Q%
%                     \global\expandafter\tempa\Q\expandafter\tempb\Q\fi%
                    \outside{\expandafter\tempa\D\expandafter\tempb\Q}%
                    \outside{\expandafter\tempa\Q\expandafter\tempb\Q}\fi%
                \fi%
                \ifMlTeXthree\OKfalse% MlTeX V3
                    \ifx\Lchar\empty% ............. this is a control sequence
                    \else% ........................ this is a letter+diacritic
                        \ifx\undefined#6\else%maybe we dont have an accent-name
                        \OKtrue\ifLEX\else%
                        \def\tempa{\charsubdef`}\def\tempb{= }%
                        \edef\tempc{`\Lchar}%
\ifnonActifCar%
%                        \global\expandafter\tempa#2%
%                        \expandafter\tempb\csname POS#6\endcsname \tempc%
                  \edef\GOfrench{\expandafter\protect#2%
                        \expandafter\tempb\csname POS#6\endcsname \tempc}%
                        \outside{\expandafter\tempa\GOfrench}% 2005/04/08
                    %%%% accented chars in maths are activated:
                    %%%% but not when already activated
\ifECM\else%%%%%%%%%%%%% nor when any T1 font in use.
%                        \def\tempa{\global\catcode`}% Global reset to
%                        \expandafter\tempa#2\tempb11% unactive. 99/04/29
                        \def\tempa{\catcode`}% Global reset to 2005/04/08
             \outside{\expandafter\tempa#2\tempb11}% unactive. 2005/04/08
                        \def\tempa{\mathcode`}%
\let\LcharSave\Lchar%
\ifx\i\Lchar\def\Lchar{\imath}\fi%
\edef\tempe{\i{}}\ifx\tempe\Lchar\def\Lchar{\imath}\fi%
\ifx\j\Lchar\def\Lchar{\jmath}\fi%
\edef\tempe{\j{}}\ifx\tempe\Lchar\def\Lchar{\jmath}\fi%
                        \def\tempe##1##2/{##1}% get first char only
                        \edef\tempe{\csname MPOS\tempe#6X/\endcsname}%
                        \expandafter%
                        \ifx\tempe\relax\else%
%                          \global\expandafter\tempa#2\tempb"8000%
                         \outside{\expandafter\tempa#2\tempb"8000}% 2005/04/12
                          \edef\tempe{\expandafter\noexpand%
                                      \csname MPOS#6\endcsname}%
\DEBUGmessage{\string$(\tempe \Lchar)}%
%                          \begingroup\def\tempa{\uccode`\~`}%
%                          \expandafter\tempa#2\uppercase{\endgroup%
%                          \global\edef~}{\tempe \Lchar}%
\outside{\expandafter\edef#2{\tempe \Lchar}}% 2005/04/12
                        \fi% end MPOS#6
\let\Lchar\LcharSave%
                    %%%%
\fi% ECM %%%%%%%%%%%%%%%
\else%
%                        \global\expandafter\tempa#3%
%                        \expandafter\tempb\csname POS#6\endcsname \tempc%
                  \edef\GOfrench{\expandafter\protect#3%
                        \expandafter\tempb\csname POS#6\endcsname \tempc}%
                        \outside{\expandafter\tempa\GOfrench}% 2005/04/08
\fi% nonActifCar
                               \fi%\ifLEX
                        \fi
                    \fi%
                    \ifx\Mchar\empty% and now uppercase
                    \else%
                        \ifx\undefined#6\else%maybe we dont have an accent-name
                        \OKtrue\ifLEX\else%
                        \def\tempa{\charsubdef`}\def\tempb{= }%
                        \edef\tempc{`\Mchar}%
\ifnonActifCar%
%                        \global\expandafter\tempa#4%
%                        \expandafter\tempb\csname POS#6\endcsname \tempc%
                  \edef\GOfrench{\expandafter\protect#4%
                        \expandafter\tempb\csname POS#6\endcsname \tempc}%
                        \outside{\expandafter\tempa\GOfrench}% 2005/04/08
                    %%%% accented chars in maths are activated:
                    %%%% but not when already activated
\ifECM\OKfalse\else%%%%% nor when any T1 font in use.
%                        \def\tempa{\global\catcode`}% reset to
%                        \expandafter\tempa#4\tempb11% unactive
                        \def\tempa{\catcode`}% reset to 2005/04/08
               \outside{\expandafter\tempa#4\tempb11}% unactive 2005/04/08
                        \def\tempa{\mathcode`}%
                        \def\tempe##1##2/{##1}% get first char only
                        \edef\tempe{\csname MPOS\tempe#6X/\endcsname}%
                        \expandafter%
                        \ifx\tempe\relax\else%
%                          \global\expandafter\tempa#4\tempb"8000%
                         \outside{\expandafter\tempa#4\tempb"8000}%  2005/04/12
                          \edef\tempe{\expandafter\noexpand%
                                      \csname MPOS#6\endcsname}
%                          \begingroup\def\tempa{\uccode`\~`}%
%                          \expandafter\tempa#4\uppercase{\endgroup%
%                          \global\edef~}{\tempe \Mchar}%
\outside{\expandafter\edef#4{\tempe \Mchar}}% 2005/04/12
                        \fi% end MPOS#6
                    %%%%
\fi% ECM %%%%%%%%%%%%%%%
\else%
                        \ifx#5\undefined\else% might be undefined
%                        \global\expandafter\tempa#5%
%                        \expandafter\tempb\csname POS#6\endcsname \tempc%
                  \edef\GOfrench{\expandafter\protect#5%
                        \expandafter\tempb\csname POS#6\endcsname \tempc}%
                        \outside{\expandafter\tempa\GOfrench}% 2005/04/08
                        \fi%
\fi% nonActifCar
                               \fi%\ifLEX
                        \fi
                    \fi%
\ifnonActifCar%
                    \ifOK%
%                      \def\tempb{\global\catcode`}%
                      \def\tempb{\catcode`}%
                      \def\tempe{\string}% 2005/04/08
                      \edef\OldActiveChars{\@tempc}% in fact disactivate
                      \xdef\@tempc{\OldActiveChars%
                                        \tempb\expandafter\tempe#2=11}%
                      \ifx\undefined#4\else%
                          \ifONE%
                         \edef\OldActiveChars{\@tempc}% disactivate 
                         \xdef\@tempc{\OldActiveChars%
                                            \tempb\expandafter\tempe#4=11}%
                          \fi%
                      \fi%
                    \fi% ifOK
\fi% nonActifCar
                \fi% MlTeX3
           \fi%\ifVtwo
                \ifx\undefined#6\else%
% remove any trailing {}.
\def\tempe##1##29{\edef\tempa{##1}}\expandafter\tempe\Lchar{}9%
\def\tempe##1##29{\edef\tempb{##1}}\expandafter\tempe\Mchar{}9%
                  \ifnonActifCar%
                    \Recycle#2%
\DEBUGmessage{\string\csubinverse{\ligne}{@#6@}\tempa{\expandafter\noexpand#1}{#7}}%
                     \csubinverse{\ligne}{@#6@}\tempa{#1}{#7}%
                    \ifx\Mchar\empty\else%
                    \Recycle#4%
\DEBUGmessage{\string\csubinverse{\ligne}{@#6@}\tempb{\expandafter\noexpand#1}{#8}}%
                     \csubinverse{\ligne}{@#6@}\tempb{#1}{#8}%
                    \fi%
                  \else%
                    \Recycle#3%
\DEBUGmessage{\string\csubinverse{\ligne}{@#6@}\tempa{\expandafter\noexpand#1}{#7}}%
                     \csubinverse{\ligne}{@#6@}\tempa{#1}{#7}%
                    \ifx\Mchar\empty\else%
                    \Recycle#5%
\DEBUGmessage{\string\csubinverse{\ligne}{@#6@}\tempb{\expandafter\noexpand#1}{#8}}%
                     \csubinverse{\ligne}{@#6@}\tempb{#1}{#8}%
                    \fi%
                  \fi%
% Added since \kb@char introduced in accent macros 2005/03/08
\def\tempb{^^P}%
\ifx\tempa\tempb%
        \edef\tempa{\noexpand\csname @#6@i\endcsname}%
        \edef\tempb{\noexpand\csname @#6@^^P\endcsname}%
        \ifx\charsubdef\undefined%
        \global\expandafter\expandafter\expandafter\let\tempa\relax%
        \else%
        \global\expandafter\expandafter\expandafter\let\tempa\tempb%
        \fi%
        \edef\tempb{\noexpand\csname @#6@iORI\endcsname}%
\fi%
\def\tempb{^^Q}%
\ifx\tempa\tempb%
        \edef\tempa{\noexpand\csname @#6@j\endcsname}%
        \edef\tempb{\noexpand\csname @#6@^^Q\endcsname}%
        \ifx\charsubdef\undefined%
        \global\expandafter\expandafter\expandafter\let\tempa\relax%
        \else%
        \global\expandafter\expandafter\expandafter\let\tempa\tempb%
        \fi%
\fi%
                \fi
                  }%end of DOhex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\doFLEX#1#2#3{% #1=8bits,#2=accentuation,#3=lettre
%%%\iffalse
  \ifLEX\ifLEXhic%
   \DEBUGmessage{KFLEX:{#1}{#2}{#3}}%
   \ifucs%
      \message{\string#1 \space}%
      \flexible{#1}{#2}{#3}% 
   \else\ONECHAR#19/%
      \ifONE%
      \message{\string#1 \space}%
      \flexible{#1}{#2}{#3}% 
      \fi%
   \fi%
  \fi\fi% ifLEX
%%%\fi
                    }%
\def\flexible#1#2#3{%
  {\ToSeven\def\GUILL{"}%
%%%              \edef\FULL{#2#3}%
%%%\expandafter\edef\expandafter\FULL\expandafter{\expandafter#2{#3}}%
              \edef\FULL{#2{#3}}%
  \ifx\empty#2\edef\FULL{#3}\fi%
  \immediate\write\kbseven{\string#1\space\space\space 
                                     printf(\GUILL\FULL\GUILL);}}
  {\ToEight\def\GUILL{\ifLIGS"\fi}%
              \edef\FULL{#2{\GUILL#3\GUILL}}%
  \ifx\empty#2\edef\FULL{\GUILL#3\GUILL}\fi%
  \immediate\write\kbeight{\FULL%
                        |\string#1\space\space\space printf("\string#1");}}%
                   }%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\ifx\degre\undefined%
     \edef\degre{{\ifECM\char\rq006\else\char\rq27\fi}\space}%
\fi%
%
\ifx\texteuro\undefined%
     \edef\texteuro{E}% assuming we have the font
\fi%
%
\ifx\@@input\undefined\let\@@input\input\fi
\ifx\@kbencoding\undefined\def\kbencoding#1{\gdef\@kbencoding{#1}}%
      \ifx\languagename\undefined\@@input keyboard.dat %
       \else\def\@tempa{\languagename.keyboard.dat }%
      \IfFileExists{\@tempa}{}{\def\@tempa{keyboard.dat }}%
      \@@input \@tempa %
      \fi%
  % then check again \unusedslot
  \ifx\unusedslot\undefined \ifnum\catcode`^^9c=\active\let ^^9c\undefined\fi%
                            \edef\@unusedslot{\noexpand ^^9c}%
    \else\edef\@unusedslot{\unusedslot}%
  \fi%
  \expandafter\let \@unusedslot =\undefined%
\fi%
\ifx\@kbencoding\undefined\gdef\@kbencoding{latin9}\fi%
% Don't force MlTeX to map Cork when kbencoding is allready Cork like.
  \def\GOfrench{decmulti}\ifx\GOfrench\@kbencoding\else%
  \def\GOfrench{latin1}\ifx\GOfrench\@kbencoding\else%
  \def\GOfrench{latin9}\ifx\GOfrench\@kbencoding\else%
  \def\GOfrench{utf8}\ifx\GOfrench\@kbencoding\else%
  \def\GOfrench{ansinew}\ifx\GOfrench\@kbencoding%\catcode`^^8d=13
                            \ifnum\catcode`^^8d=\active\let ^^8d\undefined\fi%
%                             \gdef\unusedslot{\noexpand ^^8d}%
%                              \xdef\@unusedslot{\unusedslot}%
     \outsideuns{^^8d}% 2005/04/15
                        \else%
% So, as we don't have a Cork like encoding, force targeting Cork when:
 \ifECM\ifx\documentclass\undefined\ACTIVEtrue\fi% first if plain T1,
 \else\ifx\charsubdef\undefined\else\ACTIVEtrue\fi% secondly when MlTeX (OT1).
 \fi%
\fi\fi\fi\fi\fi%
\let\GOfrench\undefined%
\bgroup% as when loaded by keyboard.sty
\ifx\undefined\@uclclist% is it initex? yes probably % 1999/11/26
  \everypar{\message{^^J *************************************************}
            \ifx\kbAissue\undefined\else\expandafter\kbAissue\fi%
            \message{^^J -59- FATAL ERROR: unusual strange text generated.}
            \message{^^J *************************************************}
            \let\@outputpage\relax% To avoid pb \normalsize undefined.
            \let\normalsize\undefined\stop}%  
\fi%
% load my keyboard specs

\ifx\languagename\undefined\@@input \@kbencoding.kbc % 
\else\def\@tempa{\languagename.\@kbencoding.kbc }%
   \IfFileExists{\@tempa}{}{\def\@tempa{\@kbencoding.kbc }}%
   \@@input\@tempa %
\fi%
\egroup%
  \ifLEX\else%
   \ifx\languagename\undefined\else\expandafter% When a language is active
     \ifx\csname\languagename @hefn\endcsname\relax% we can load any
     \else\@@input \csname\languagename @hefn\endcsname% hyph. exceptions file.
   \fi\fi% \languagename undefined
  \fi% de \ifLEX
\fi% de \ifSkip
\endgroup% end of marmelade. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\expandafter\ifx\csname ^^63\endcsname\c % 128-255 going chars in V3 
\def\reserved@c#1{\catcode#1=11\relax}% 
\reserved@a{"7F}{"FF}%
\ifLEX\else%
\expandafter\catcode\expandafter`\@unusedslot=13%
\fi%
%%%%%%
\ifx\documentclass\undefined
  \ifECM\else% Prevent Plain invalid chars
    \catcode`\^^]=11%
    \catcode`\^^[=11%
  \fi%
\else% Prevent LaTeX2e invalid chars
  \ifECM%
    \catcode`\^^_=11%
    \catcode`\^^Y=11%
    \catcode`\^^Z=11%
    \catcode`\^^P=11%
    \catcode`\^^Q=11%
  \else%
    \catcode`\^^P=11%
    \catcode`\^^Q=11%
    \catcode`\^^Y=11%
    \catcode`\^^Z=11%
    \catcode`\^^]=11%
    \catcode`\^^[=11%
    \catcode`\^^^=11%
    \catcode`\^^\=11%
    \catcode`\^^_=11%
  \fi%
\fi%
%%%%%%
%
{\let\protect\noexpand%
 \def\oalign#1{\leavevmode\vtop{\baselineskip\z@skip \lineskip.25ex%
 \ialign{####\crcr#1\crcr}}}% put characters over each other
 \ifx\KBdefs\relax\else\xdef\KBdefs{\KBdefs}\fi%
}%
\KBdefs%
\let\KBdefs\undefined% now set the char defs.
\let\outside\undefined\let\outsidecase\undefined\let\outsideuns\undefined%
% now intitialize only \oe \ae etc.
\@tempc%
% and \@kbspecials for \kbtypeout
\bgroup%
\ifLEX\else%
      \let\protect\noexpand%
      \xdef\@kbspecials{\@kbspecials}%
\fi%
\ifx\undefined\@uclclist% \@kbspecials, final setting.
          \global\let\@kbsORI\@kbspecials%
\else\ifx\@kbsORI\undefined%
          \global\let\@kbsORI\@kbspecials%
     \else\global\let\@kbspecials\@kbsORI%
     \fi%
\fi%
\egroup% 
%
% Take in account \mathaccent for OT1 and T1 ***PLAIN TeX ONLY***
%
\def\@tempc{plain}%
\ifx\fmtname\@tempc%
% Currently math accents are provided only in cm...
%\ifECM% when the new math font scheme will be available
%\def\acute{\mathaccent"7001 }
%\def\grave{\mathaccent"7000 }
%\def\ddot{\mathaccent"7004 }
%%%%%\def\tilde{\mathaccent"7003 }
%\def\bar{\mathaccent"7009 }
%\def\breve{\mathaccent"7008 }
%\def\check{\mathaccent"7007 }
%\def\hat{\mathaccent"7002 }
%\def\dot{\mathaccent"700A }
%\else
\def\acute{\mathaccent"7013 }
\def\grave{\mathaccent"7012 }
\def\ddot{\mathaccent"707F }
\def\tilde{\mathaccent"707E }
\def\bar{\mathaccent"7016 }
\def\breve{\mathaccent"7015 }
\def\check{\mathaccent"7014 }
\def\hat{\mathaccent"705E }
\def\dot{\mathaccent"705F }
%\fi
\fi% fmtname=plain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reset no more useful macros
\global\let\Lchar\undefined\global\let\Mchar\undefined%
{\catcode`<=\active\catcode`>\active% 2005/04/12
\ifx\guillemotleft\undefined\gdef\guillemotleft{<<}\fi%
\ifx\guillemotright\undefined\gdef\guillemotright{>>}\fi%
}%
%
% Now provide 7-bit new accent macros to produce 8-bit chars
%
\let\next\undefined
\ifx\charsubdef\undefined\else\let\next\relax\fi
%%
%\ifECM\else% The following to avoid invalid char msg.
\catcode`\^^P=11%
\catcode`\^^Q=11%
\catcode`\^^Y=11%
\catcode`\^^Z=11%
%\fi%
\ifx\documentclass\undefined%
     \let\Edef\edef\let\Def\def\let\Let\let%
     \ifECM\let\next\relax\fi% Plain-T1 is a good candidate
\else%
\def\@temp@{LO1}\ifx\@temp@\f@encoding\edef\@temp@{OL}%
                 \else\edef\@temp@{OT}\fi%
   \def\Edef#1{\expandafter\relax% define only for MlTeX OT1
               \expandafter\global%
               \expandafter\edef\csname\@temp@\string1\string#1\endcsname}
    \def\Def#1{\expandafter\relax% define only for MlTeX OT1
               \expandafter\global%
               \expandafter\def\csname\@temp@\string1\string#1\endcsname}
    \def\Let#1{\expandafter\relax% define only for MlTeX OT1
               \expandafter\global%
               \expandafter\let\csname\@temp@\string1\string#1\endcsname}
\ifECM\Edef\i{^^Y}\else\Edef\i{^^P}\fi% needed by \csubinverse for patterns
\ifECM\Edef\j{^^Z}\else\Edef\j{^^Q}\fi% dotless letters 
\fi%
\let\@tempc\undefined%
\ifx\next\relax% then do it (we have 8bits chars)
\gdef\kb@char#1{\expandafter\ifcat\noexpand#1\active%
           \expandafter\expandafter\expandafter%
            \@gobble\expandafter\string\noexpand#1\else\expandafter#1\fi}%
\Edef\`#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @gr@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"00 #1}\else{\accent18 #1}\fi%
          \noexpand\else%
           \noexpand\csname @gr@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\'#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @ac@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"01 #1}\else{\accent19 #1}\fi%
          \noexpand\else%
           \noexpand\csname @ac@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\v#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @v@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"07 #1}\else{\accent20 #1}\fi%
          \noexpand\else%
           \noexpand\csname @v@#1%
             \noexpand\kb@char\noexpand\noexpand\endcsname\noexpand\fi}% 
\Edef\u#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @u@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"08 #1}\else{\accent21 #1}\fi%
          \noexpand\else%
           \noexpand\csname @u@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\=#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @eq@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"09 #1}\else{\accent22 #1}\fi%
          \noexpand\else%
           \noexpand\csname @eq@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\^#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @hat@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"02 #1}\else{\accent94 #1}\fi%
          \noexpand\else%
           \noexpand\csname @hat@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\.#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @dot@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"0a #1}\else{\accent95 #1}\fi%
          \noexpand\else%
           \noexpand\csname @dot@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\H#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @H@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"05 #1}\else{\accent125 #1}\fi%
          \noexpand\else%
           \noexpand\csname @H@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\~#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @til@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"03 #1}\else{\accent126 #1}\fi%
           \noexpand\else%
            \noexpand\csname @til@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}% 
\Edef\"#1{\noexpand\expandafter%
           \noexpand\ifx\noexpand\csname @um@%
           \noexpand\ifcat\noexpand\noexpand#1Z#1\noexpand%
                      \else\noexpand\kb@char\noexpand#1\noexpand\fi%
                        \noexpand\endcsname\noexpand\relax%
                         \ifECM{\accent"04 #1}\else{\accent127 #1}\fi%
           \noexpand\else%
            \noexpand\csname @um@%
             \noexpand\kb@char\noexpand#1\noexpand\endcsname\noexpand\fi}%
\ifx\@c@@\undefined% needed for OT1
\def\@c@@#1{\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
  \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}%
\fi%
\Def\c#1{{\expandafter\ifx%
         \csname @c@#1\endcsname\relax%
         \@c@@{#1}%
                               \else%
         \csname @c@#1\endcsname\fi}}%
\ifx\@an@a\undefined\else\Let\aa\@an@a\fi%
\ifx\@an@A\undefined\else\Let\AA\@an@A\fi%
\ifx\r\undefined%
\global\Def\r#1{\if#1a\@a:a\else\if#1A\@A:A\fi\fi}% 
\global\Def\@a:a{\expandafter\ifx\csname @an@a\endcsname\relax%
                          \ifECM{\accent"06a}\else{\accent23a}\fi%
                       \else\csname @an@a\endcsname\fi}% 
\global\Def\@A:A{\expandafter\ifx\csname @an@A\endcsname\relax%
                          \leavevmode\setbox0\hbox{h}\dimen@\ht0%
                            \advance\dimen@-1ex\rlap{\raise.67\dimen@\hbox{%
                                    \ifECM\char"06\else\char'27\fi}}A%
                       \else\csname @an@A\endcsname\fi}%
\fi% \r undefined
\fi% we have 8bits chars
%
\ifx\next\undefined% we don't have any csubsinverse mechanism
\ifx\documentclass\undefined% and we aren't in LaTeX
%                  % so reset any previous accent macros to usual
\edef\`#1{\ifECM{\accent"00 #1}\else{\accent18 #1}\fi}%
\edef\'#1{\ifECM{\accent"01 #1}\else{\accent19 #1}\fi}%
\edef\v#1{\ifECM{\accent"07 #1}\else{\accent20 #1}\fi}%
\edef\u#1{\ifECM{\accent"08 #1}\else{\accent21 #1}\fi}%
\edef\=#1{\ifECM{\accent"09 #1}\else{\accent22 #1}\fi}%
\edef\^#1{\ifECM{\accent"02 #1}\else{\accent94 #1}\fi}%
\edef\.#1{\ifECM{\accent"0a #1}\else{\accent95 #1}\fi}%
\edef\H#1{\ifECM{\accent"05 #1}\else{\accent125 #1}\fi}%
\edef\~#1{\ifECM{\accent"03 #1}\else{\accent126 #1}\fi}%
\edef\"#1{\ifECM{\accent"04 #1}\else{\accent127 #1}\fi}%
\ifx\@c@@\undefined\else\let\c=\@c@@\fi%
\def\aa{\ifECM{\accent"06a}\else{\accent23a}\fi}%
\def\AA{\leavevmode\setbox0\hbox{h}\dimen@\ht0%
         \advance\dimen@-1ex\rlap{\raise.67\dimen@\hbox{%
         \ifECM\char"06\else\char'27\fi}}A}%
\fi% documentclass
\fi%we don't have any csubsinverse mechanism
%
\fi%
% reset misc
\let\Edef\undefined\let\Def\undefined\let\Let\undefined%
%--------------------------------------------------------------------
\def\GOfrench{utf8}\ifx\GOfrench\@kbencoding%
% final processing of utf8 goes thru inputenc.
\ifx\documentclass\undefined% This is Plain
\kbAissue%
\message{ -72- kbconfig: utf8 encoding can't be completed with plain!}%
\messag@{ -72- kbconfig: continuing with no Unicode characters.}% 
\else% This is LaTeX
\ifx\ProvidesFile\undefined\def\ProvidesFile#1{}%
\fi%
\def\DeclareInputMath#1{\@inpenc@test%
                     \bgroup\uccode`\~#1\uppercase{\egroup\def~}%
                                            }%
                     \def\DeclareInputText#1#2{\def\@tempa{#2}%
                     \def\@tempb##1 ${}%
                     \edef\@tempa{\expandafter\@tempb\meaning\@tempa$ $}%
                     \ifx\@tempa\@empty\DeclareInputMath{#1}{#2}%
                     \else\DeclareInputMath{#1}{\IeC{#2}}%
                     \fi}%
\def\LTXinputencoding#1{% always used with #1=utf8
  \ifx\@inpenc@test\undefined%
       \gdef\@inpenc@test{\global\let\@inpenc@test\relax}%
  \fi%
  \edef\@inpenc@undefined{\noexpand\@inpenc@undefined@{#1}}%
  \@inpenc@loop\^^A\^^H%
  \@inpenc@loop\^^K\^^K%
  \@inpenc@loop\^^N\^^_%
  \@inpenc@loop\^^?\^^ff%
  \advance\endlinechar\@M
  \xdef\saved@space@catcode{\the\catcode`\ }%
  \input #1.def %
  \advance\endlinechar-\@M
  \catcode`\ \saved@space@catcode\relax
  \ifx\@inpenc@test\relax\else
    \def\@tempa{\PackageWarning{kbconfig}}%
    \ifx\kbAissue\undefined\else\expandafter\kbAissue\fi\@tempa%
             {-88- No characters defined\MessageBreak
              by input encoding change to `#1'\MessageBreak}%
  \fi
}
\def\@inpenc@undefined@#1{%
        \def\@tempa{\PackageError{kbconfig}}% always used with #1=utf8
        \ifx\kbAissue\undefined\else\expandafter\kbAissue\fi\@tempa%
        {-89- Keyboard character used is undefined\MessageBreak
         in inputencoding `#1'}%
       {You need to provide a  definition with
        \noexpand\DeclareInputText\MessageBreak or
        \noexpand\DeclareInputMath before using this key.}}%
\def\@inpenc@loop#1#2{%
  \@tempcnta`#1\relax
  \loop
    \catcode\@tempcnta\active
    \bgroup
      \uccode`\~\@tempcnta
      \uppercase{%
    \egroup
         \let~\@inpenc@undefined
      }%
  \ifnum\@tempcnta<`#2\relax
     \advance\@tempcnta\@ne
  \repeat}
\IfFileExists{utf8.def}{\LTXinputencoding{utf8}%
                        \def\UTFviii@defined##1{%
                        \ifx##1\relax
      \ifx\issuemsg\undefined%
      \PackageError{kbconfig}{Unicode char \string##1 not set up\space
                              for use with LaTeX}\@eha
      \else\issuemsg{91}(keyboard)[##1]\relax%
      \fi%
                        \else\expandafter##1%
                        \fi}%
                       }%
                       {%
\kbAissue%
\message{ -75- kbconfig: utf8 encoding not found via inputenc package!}%
\messag@{ -75- kbconfig: continuing with no Unicode characters.}% 
                       }%
%
\fi% \if\documentclass
\fi% \if utf8
%
\let\kbAissue\undefined%
%
\ifx\kbencoding\undefined%
     \def\kbencoding#1{\edef\resetat{\noexpand\catcode\string`%
                       \noexpand\@\the\catcode`\@}\makeatletter%
                       \def\@kbencoding{#1}%
                       \ifx\@prevkbencoding\@kbencoding\else%
                           \@@input kbconfig.tex %
                       \fi\resetat}%
\fi%
%
\csname kb@hook\endcsname% Allow any hook here.
\endinput%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
