%%% ====================================================================
%%% @TeX-file{
%%%   filename  = "cyracc.def",
%%%   version   = "2.2b",
%%%   date      = "26 February 1997",
%%%   time      = "15:26:08 EST",
%%%   checksum  = "ยค50915 285 1398 10151",
%%%   author    = "American Mathematical Society",
%%%   copyright = "Copyright (C) 1996 American Mathematical Society,
%%%                all rights reserved.  Copying of this file is
%%%                authorized only if either:
%%%                (1) you make absolutely no changes to your copy,
%%%                including name; OR
%%%                (2) if you do make changes, you first rename it
%%%                to some other name.",
%%%   address   = "American Mathematical Society,
%%%                Technical Support,
%%%                Electronic Products and Services,
%%%                P. O. Box 6248,
%%%                Providence, RI 02940,
%%%                USA",
%%%   telephone = "401-455-4080 or (in the USA and Canada)
%%%                800-321-4AMS (321-4267)",
%%%   FAX       = "401-331-3842",
%%%   email     = "tech-support@ams.org (Internet)",
%%%   codetable = "ISO/ASCII",
%%%   keywords  = "amsfonts, tex, cyrillic",
%%%   supported = "yes",
%%%   abstract  = "This file contains definitions of accents and
%%%                special characters required for use of cyrillic
%%%                fonts arranged according to the AMS scheme.",
%%%   docstring = "The checksum field above contains a CRC-16
%%%                checksum as the first value, followed by the
%%%                equivalent of the standard UNIX wc (word
%%%                count) utility output of lines, words, and
%%%                characters.  This is produced by Robert
%%%                Solovay's checksum utility.",
%%% }
%%% ====================================================================
%%
%%    The \font specification(s) should be made elsewhere, and should include
%%            \newfam\cyrfam
%%            \font\...cyr=wncyr...   (e.g. \font\tencyr=wncyr10 )
%%    An appropriate definition for cyrillic, usable in math and text, is
%%            \def\cyr{\fam\cyrfam\...cyr\cyracc}
%%    More extensive instructions for using cyrillic fonts are included in
%%    the AMSFonts 2.2 User's Guide.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chardef\tempcat=\the\catcode`\@
\catcode`\@=11

%  The first set of definitions is what will be in effect outside of cyrillic,
%  i.e., in transliterated text.

%  Definition of \cydot is not ideal; real dot should be in an accent font.
\def\cydot{{\mathsurround=0pt$\cdot$}}

%  \ubar is the definition of \b from PLAIN; it may not work in math mode.
\def\ubar#1{\oalign{#1\crcr\hidewidth
    \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}

%  Soft and hard signs are represented in transliteration by prime and
%  double prime respectively.
\def\cprime{\/{\mathsurround=0pt$'$}}
\def\Cprime{{\mathsurround=0pt$'$}}
\def\cdprime{\/{\mathsurround=0pt$''$}}
\def\Cdprime{{\mathsurround=0pt$\ubar{\hbox{$''$}}$}}

\def\dbar{dj}           % make real barred d when accent font available
\def\Dbar{Dj}           %  ""

%  It would be nice to make these control sequences unnecessary; that will
%  probably require d to become active.
\def\dz{dz}
\def\Dz{Dz}
\def\dzh{dzh\cydot }
\def\Dzh{Dzh\cydot }


%  Stress marks are sometimes used in cyrillic text, mainly for pedagogic
%  reasons.  These definitions support stress marks within {\cyr ...};
%  in transliteration, they are suppressed.  Stress is indicated in
%  input by \! preceding a letter on which a stress mark is to appear;
%  an acute accent will appear in the output.  Since \! is also a plain
%  command, for negative thin space in math mode, test for math mode and
%  include the plain definition as appropriate.

\def\@gobble#1{}
\def\@testgrave{\`}
\def\@stressit{\futurelet\chartest\@stresschar }

\def\@stresschar#1{%
  \ifx #1y\def\result{\futurelet\chartest\@yligature}%
  \else \ifx #1Y\def\result{\futurelet\chartest\@Yligature}%
  \else \ifx\chartest\@testgrave \d