\def\lt{<}
\def\gt{>}
\newcount\fontnumber
\fontnumber=0
\newif\ifoneaccent\oneaccenttrue
\def\ifnextchar#1#2#3{\let\tempe #1\def\tempa{#2}\def\tempb{#3}\futurelet
  \tempc\ifnch}
\def\ifnch{\ifx\tempc\tempe\let\tempd\tempa\else\let\tempd\tempb\fi\tempd}
\def\gobble#1{}
\def\greekmode{%
\catcode`\<=13%
\catcode`\>=13%
\catcode`\'=11%
\catcode`\`=13%
\catcode`\~=11%
\catcode`\"=13%
\lccode`\<=`\<%
\lccode`\>=`\>%
\lccode`\'=`\'%
\lccode`\~=`\~%
\lccode`\"=`\"%
\def\rg{\fontnumber=1\tengr}%
\def\sl{\fontnumber=2\tengrsl}%
\def\it{\fontnumber=3\tengrit}%
\def\bf{\fontnumber=4\tengrbf}%
\def\smc{\fontnumber=5\tengrsmc}%
\def\I##1{\setbox0\hbox{##1}\ifdim\ht0=1ex\accent'174 ##1%
  \else{\ooalign{\hidewidth\char'174\hidewidth\crcr\unhbox0}}\fi}}%
\newcount\vwl
\newcount\acct
{
  \greekmode
  \gdef>{\ifnextchar ~{\expandafter\smoothcircumflex\gobble}{\char\lq\>}}
  \gdef<{\ifnextchar ~{\expandafter\roughcircumflex\gobble}{\char\lq\<}}
  \gdef\smoothcircumflex#1{\acct=\rq134 \vwl=\lq#1 \dobreathingcircumflex}
  \gdef\roughcircumflex#1{\acct=\rq100 \vwl=\lq#1 \dobreathingcircumflex}
  \gdef\dobreathingcircumflex{\ifnum\vwl\lt\rq140 %if uppercase
    \char\the\acct\kern -.2em\char\the\vwl\else
    \doaccent\fi}
  \gdef\doaccent{\accent\the\acct \char\the\vwl\relax}
  \gdef"{\ifnextchar '{\expandafter\diaeresisacute\gobble}{\accent\lq\"}}
  \gdef\diaeresisacute#1{\accent\rq043 #1}
  \gdef`{'}
}
 
\newif\ifgreek\greekfalse
 
\def\begingreek{\bgroup\font\tengr=rgrrg10\font\tengrsl=rgrsl10%
\font\tengrbf=rgrbf10\font\tengrit=rgrti10\font\tengrsmc=rgrsc10%
\greektrue\greekmode\rg}
\def\beginmgreek{\bgroup\font\tengr=mrgrrg10\font\tengrsl=mrgrsl10%
\font\tengrbf=mrgrbf10\font\tengrit=mrgrti10\font\tengrsmc=rgrsc10%
\greektrue\greekmode\rg}
\def\endgreek{\egroup}
\def\endmgreek{\egroup}
\def\monotoniko{%
\font\tengr=mrgrrg10\font\tengrsl=mrgrsl10%
\font\tengrbf=mrgrbf10\font\tengrit=mrgrti10%
\ifnum\fontnumber=5\smc%
  \else\ifnum\fontnumber=4\bf%
    \else\ifnum\fontnumber=3\it%
      \else\ifnum\fontnumber=2\sl%
        \else\rg%
      \fi%
    \fi%
  \fi%
\fi%
}
\def\polutoniko{%
\font\tengr=rgrrg10\font\tengrsl=rgrsl10%
\font\tengrbf=rgrbf10\font\tengrit=rgrti10%
\ifnum\fontnumber=5\smc%
  \else\ifnum\fontnumber=4\bf%
    \else\ifnum\fontnumber=3\it%
      \else\ifnum\fontnumber=2\sl%
        \else\rg%
      \fi%
    \fi%
  \fi%
\fi%
}
\let\math=$%
{\catcode`\$=13%
\gdef\greekdelims{\catcode`\$=13%
\def${\ifgreek\endgreek\else\begingreek\fi}
\def\display{\math\math}\def\enddisplay{\math\math}}}
\def\grave#1{{\edef\next{\the\font}\smc\accent\rq001\next#1}}
\def\roughgrave#1{{\edef\next{\the\font}\smc\accent\rq002\next#1}}
\def\smoothgrave#1{{\edef\next{\the\font}\smc\accent\rq003\next#1}}
\def\diaeresisgrave#1{{\edef\next{\the\font}\smc\accent\rq004\next#1}}
\def\diaeresiscircumflex#1{{\edef\next{\the\font}\smc\accent\rq005\next#1}}
\def\breve#1{{\edef\next{\the\font}\smc\accent\rq006\next#1}}
\def\macron#1{{\edef\next{\the\font}\smc\accent\rq007\next#1}}
\def\rhorough{{\tengrsmc
\ifnum\fontnumber=5\char\rq162
  \else\ifnum\fontnumber=4\char\rq016
    \else\ifnum\fontnumber=3\char\rq014
      \else\ifnum\fontnumber=2\char\rq012
        \else\char\rq010
      \fi
    \fi
  \fi
\fi
}}
\def\rhosmooth{{\tengrsmc
\ifnum\fontnumber=5\char\rq162
  \else\ifnum\fontnumber=4\char\rq017
    \else\ifnum\fontnumber=3\char\rq015
      \else\ifnum\fontnumber=2\char\rq013
        \else\char\rq011
      \fi
    \fi
  \fi
\fi
}}
\def\digamma{{\smc\char\rq135}}
\def\smallDigamma{{\smc\char\rq140}}
\def\Digamma{{\tengrsmc
\ifnum\fontnumber=5\char\rq021
  \else\ifnum\fontnumber=4\char\rq027
    \else\ifnum\fontnumber=3\char\rq025
      \else\ifnum\fontnumber=2\char\rq023
        \else\char\rq021
      \fi
    \fi
  \fi
\fi
}}
\def\vardigamma{{\tengrsmc
\ifnum\fontnumber=5\char\rq020
  \else\ifnum\fontnumber=4\char\rq026
    \else\ifnum\fontnumber=3\char\rq024
      \else\ifnum\fontnumber=2\char\rq022
        \else\char\rq020
      \fi
    \fi
  \fi
\fi
}}
\def\understroke{{\smc\char\rq046}}
\def\overstroke{{\smc\char\rq044}}
\def\sanpi{{\smc\char\rq136}}
\def\Sanpi{{\smc\char\rq137}}
\def\qoppa{{\smc\char\rq133}}
\def\varqoppa{{\smc\char\rq134}}
\def\Qoppa{{\smc\char\rq103}}
\def\Tao{{\smc\char\rq177}}
\def\ssh{\breve{s}}\def\SSH{\breve{S}}
\def\dz{\breve{z}}\def\DZ{\breve{Z}}
\def\psh{\breve{y}}\def\PSH{\breve{Y}}
\def\ksh{\breve{x}}\def\KSH{\breve{X}}
\def\inviota{{\smc\char\rq126}}
\def\grMF{{\smc\char\rq030\char\rq031\char\rq032\char\rq033}\-{\smc%
\char\rq034\char\rq036\char\rq037\char\rq032}}
\def\MF{{\smc\char\rq030\char\rq031\char\rq032\char\rq033}\-{\smc%
\char\rq040\char\rq036\char\rq037\char\rq032}}
 
\endinput
 
