<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% tone.sty -- TIPA option package
% 1996/06/10 FUKUI Rei

\RequirePackage{tipa}[1996/06/10 TIPA version 1.0]

\newif\if@longtone
\newdimen\@tonebarhtunit
\newdimen\@tonebarhalfwd

\newcommand\tone[1]{\@inittone\leavevmode
  \hbox{\kern\@sidegap\@tone#1\relax\kern-\@tonebarhalfwd{\tipaencoding|}}}

\newcommand\rtone[1]{\@inittone\leavevmode
  \hbox{{\tipaencoding|}\kern-\@tonebarhalfwd\@tone#1\relax\kern\@sidegap}}

\newcommand\@tone[1]{%
  \ifx#1\relax
    \ifx\pr@vpr@vtone\relax \@outputtone\pr@vtone\pr@vtone
    \else \@outputtone\pr@vpr@vtone\pr@vtone\fi
    \let\next\relax
  \else
    \ifx\pr@vpr@vtone\relax\else
      \@longtonefalse\@outputtone\pr@vpr@vtone\pr@vtone\fi
    \let\pr@vpr@vtone\pr@vtone\def\pr@vtone{#1}%
    \let\next\@tone \fi
  \next}

\newcommand\@outputtone[2]{{%
  \count\z@ #1\advance\count\z@ -#2\def\@mintone{#2}%
  \ifnum\count\z@&gt;0\count\@ne128\advance\count\@ne \count\z@
    \edef\@tonecode{\the\count\@ne}% falling tone
  \else
    \ifnum\count\z@&lt;0\count\@ne132\advance\count\@ne -\count\z@
      \edef\@tonecode{\the\count\@ne}\def\@mintone{#1}% rising tone
    \else
      \def\@tonecode{128}\fi\fi % level tone
  \if@longtone\else\count\z@\@tonecode
    \advance\count\z@ 9 \def\@tonecode{\the\count\z@}\fi
  \@longtonefalse
  \count\@ne\@mintone \advance\count\@ne \m@ne
  \dimen\z@\the\count\@ne\@tonebarhtunit
  \raise\dimen\z@\hbox{%
    \@accshift{-\dimen\z@}%
    {\tipaencoding\char\@tonecode}%
    \@accshift{\dimen\z@}}}}

\newcommand\@toneshift[1]{\dimen\@ne#1}

\newcommand\@inittone{%
  \@getaccshift \let\c@lcshift\@toneshift
  \let\pr@vtone\relax\let\pr@vpr@vtone\relax
  \@longtonetrue{\setbox\z@\hbox{\tipaencoding|}%
  \global\@tonebarhtunit.25\ht\z@
  \global\@tonebarhalfwd.5\wd\z@}}

\endinput
</pre></body></html>