summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/churchslavonic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-15 22:16:48 +0000
committerKarl Berry <karl@freefriends.org>2016-05-15 22:16:48 +0000
commit4f080f1e6b8bb62696c07e145f7409340531f24e (patch)
treef32f753eb85bd701f92c7253489b58fd36ae963d /Master/texmf-dist/tex/latex/churchslavonic
parent0268f77d41324e2fcc74e3d36cec0039fef41151 (diff)
churchslavonic (15may16)
git-svn-id: svn://tug.org/texlive/trunk@41167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/churchslavonic')
-rw-r--r--Master/texmf-dist/tex/latex/churchslavonic/churchslavonic.sty16
-rw-r--r--Master/texmf-dist/tex/latex/churchslavonic/cu-calendar.sty182
-rw-r--r--Master/texmf-dist/tex/latex/churchslavonic/cu-kinovar.sty37
-rw-r--r--Master/texmf-dist/tex/latex/churchslavonic/cu-num.sty341
-rw-r--r--Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty196
5 files changed, 772 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/churchslavonic/churchslavonic.sty b/Master/texmf-dist/tex/latex/churchslavonic/churchslavonic.sty
new file mode 100644
index 00000000000..b988b8e41a2
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/churchslavonic/churchslavonic.sty
@@ -0,0 +1,16 @@
+% Copyright 2016 Slavonic Computing Initialive
+% http://sci.ponomar.net
+%
+\ProvidesPackage{churchslavonic}[2016/04/19 v0.1 Typesetting in Church Slavonic]
+
+\DeclareOption{gray}{
+ \PassOptionsToPackage{\CurrentOption}{cu-kinovar}
+}
+\ProcessOptions\relax
+
+\RequirePackage{cu-num}
+\RequirePackage{cu-calendar}
+\RequirePackage{cu-util}
+\RequirePackage{cu-kinovar}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/churchslavonic/cu-calendar.sty b/Master/texmf-dist/tex/latex/churchslavonic/cu-calendar.sty
new file mode 100644
index 00000000000..eb1a80914bb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/churchslavonic/cu-calendar.sty
@@ -0,0 +1,182 @@
+% Copyright 2016 Slavonic Computing Initialive
+% http://sci.ponomar.net
+%
+\ProvidesPackage{cu-calendar}[2016/03/30 v1.0 CU Calendars]
+
+\RequirePackage{intcalc}
+\RequirePackage{cu-num}
+
+%
+% Tools
+%
+\def\cu@jdn#1-#2-#3-#4{%
+ \expandafter\cu@@jdn
+ \expandafter{\the\numexpr \intcalcDiv{14 - #2}{12} \relax}{#1}{#2}{#3}{#4}%
+}%
+\def\cu@@jdn#1#2#3#4#5{%
+ \expandafter\cu@@@jdn
+ \expandafter{\the\numexpr #2 + 4800 - #1\relax}{#1}{#2}{#3}{#4}{#5}%
+}%
+\def\cu@@@jdn#1#2#3#4#5#6{% y a year month day
+ \expandafter\cu@@@@jdn
+ \expandafter{\the\numexpr #4 - 3 + 12 * (#2)\relax}{#1}{#2}{#3}{#4}{#5}{#6}%
+}%
+\def\cu@@@@jdn#1#2#3#4#5#6#7{% m y a year month day
+ \expandafter #7%
+ \expandafter{\the\numexpr #6 +
+ \intcalcDiv{153 * (#1) + 2}{5} + (365 * (#2)) + \intcalcDiv{#2}{4} - 32083\relax}{#2}%
+}%
+\def\greg@#1#2{% jdn_julian y
+ \expandafter\greg@@
+ \expandafter{\the\numexpr #1 - \intcalcDiv{#2}{100}\relax}{#2}%
+}%
+\def\greg@@#1#2{% jdn_julian y
+ \the\numexpr #1 + \intcalcDiv{#2}{400} + 32083 - 32045\relax%
+}%
+%
+\def\cu@jdnFromJulianDate#1{%
+ \cu@jdn #1-\@firstoftwo
+}%
+\def\cu@jdnFromGregorianDate#1{%
+ \cu@jdn #1-\greg@
+}%
+%
+\def\cu@calendar#1{%
+ \expandafter\cu@@calendar
+ \expandafter{\the\numexpr (#1 + 1401) * 4 + 3\relax}%
+}%
+\def\cu@@calendar#1{% e
+ \expandafter\cu@@@calendar
+ \expandafter{\the\numexpr 2 +
+ \intcalcMul{5}{\intcalcDiv{\intcalcMod{#1}{1461}}{4}} \relax}{#1}%
+}%
+\def\cu@@@calendar#1#2{% h e
+ \expandafter\cu@@@@calendar
+ \expandafter{\the\numexpr 1 + \intcalcDiv{\intcalcMod{#1}{153}}{5}\relax}{#1}{#2}%
+}%
+\def\cu@@@@calendar#1#2#3{% day h e
+ \expandafter\cu@@@@@calendar
+ \expandafter{\the\numexpr 1 +
+ \intcalcMod{\intcalcAdd{\intcalcDiv{#2}{153}}{2}}{12}\relax}{#1}{#2}{#3}%
+}%
+\def\cu@@@@@calendar#1#2#3#4{% month day h e
+ \the\numexpr
+ \intcalcDiv{#4}{1461} - 4716 + \intcalcDiv{14-#1}{12}\relax -#1-#2%
+}%
+\def\cu@calendarJulian#1{\cu@calendar{#1}}%
+\def\cu@calendarGregorian#1{%
+ \expandafter\cu@calendar\expandafter{%
+ \the\numexpr #1 +
+ \intcalcDiv{\intcalcMul{\intcalcDiv{274277 + 4 * (#1)}{146097}}{3}}{4} - 38
+ \relax
+}}%
+%
+\def\cu@julianToGregorian#1{%
+ \cu@calendarGregorian{\cu@jdnFromJulianDate{#1}}%
+}%
+\def\cu@gregorianToJulian#1{%
+ \cu@calendarJulian{\cu@jdnFromGregorianDate{#1}}%
+}%
+\let\cu@julianFromGregorian\cu@gregorianToJulian
+\let\cu@gregorianFromJulian\cu@julianToGregorian
+%
+% User API
+%
+\let\cuAsJulian\cu@julianFromGregorian
+\let\cuAsGregorian\cu@gregorianFromJulian
+%
+\def\cuJulianDate#1{%
+ \expandafter\cu@formatDate\number\cu@julianFromGregorian{#1}\relax
+}%
+\def\cuJulianToday{%
+ \cu@julianFromGregorian{\year -\month -\day}%
+}%
+\def\cuToday{%
+ \year -\month -\day
+}%
+\def\cuDate#1{%
+ \expandafter\cu@formatDate\number #1\relax
+}%
+%
+\def\cuMonthName#1{%
+ \ifcase#1\or%
+ і҆аннꙋа́рїа\or
+ феврꙋа́рїа\or
+ ма́рта\or
+ а҆прі́ллїа\or
+ ма́їа\or
+ і҆ꙋ́нїа\or
+ і҆ꙋ́лїа\or
+ а҆́ѵгꙋста\or
+ септе́мврїа\or
+ ѻ҆ктѡ́врїа\or
+ ное́мврїа\or
+ деке́мврїа\fi
+}%
+%
+\def\cuDayName#1{%
+ \ifcase#1 недѣ́лѧ\or%
+ понедѣ́льникъ\or
+ вто́рникъ\or
+ среда̀\or
+ четверто́къ\or
+ пѧто́къ\or
+ сꙋббѡ́та\fi
+}%
+%
+\def\cuDayNameAccusative#1{%
+ \ifcase#1 недѣ́лю\or%
+ понедѣ́льникъ\or
+ вто́рникъ\or
+ сре́дꙋ\or
+ четверто́къ\or
+ пѧто́къ\or
+ сꙋббѡ́тꙋ\fi
+}%
+%
+\def\cuDefineDateFormat#1#2{%
+ \expandafter\def\csname cs@dateformat@#1\endcsname{#2}%
+}%
+\def\cuUseDateFormat#1{%
+ \expandafter\let\expandafter\cu@current@dateformat\csname cs@dateformat@#1\endcsname
+}%
+\def\cu@@formatDate#1-#2-#3\relax{%
+ \edef\cu@JDN{\cu@jdnFromGregorianDate{#1-#2-#3}}%
+ \edef\cu@JDN@March@First{\cu@jdnFromJulianDate{#1-3-1}}%
+ \edef\cuYEAR{\number #1}%
+ \edef\cuYEARAM{\the\numexpr #1 + 5508\ifnum\cu@JDN<\cu@JDN@March@First\else + 1\fi}%
+ \edef\cuMONTH{\number #2}%
+ \edef\cuDAY{\number #3}%
+ \edef\cuDOW{\intcalcMod{1+\cu@JDN}{7}}%
+ \edef\cuINDICTION{\intcalcAdd{15}{\intcalcMod{#1 - 312}{-15}}}%
+ \edef\cuDISPLAYDATE{\cu@current@dateformat}%
+}%
+\def\cu@@formatJulianDate#1-#2-#3\relax{%
+ \edef\cu@JDN{\cu@jdnFromJulianDate{#1-#2-#3}}%
+ \edef\cu@JDN@March@First{\cu@jdnFromJulianDate{#1-3-1}}%
+ \edef\cuYEAR{\number #1}%
+ \edef\cuYEARAM{\the\numexpr #1 + 5508\ifnum\cu@JDN<\cu@JDN@March@First\else + 1\fi}%
+ \edef\cuMONTH{\number #2}%
+ \edef\cuDAY{\number #3}%
+ \edef\cuDOW{\intcalcMod{1+\cu@JDN}{7}}%
+ \edef\cuINDICTION{\intcalcAdd{15}{\intcalcMod{#1 - 312}{-15}}}%
+ \edef\cuDISPLAYDATE{\cu@current@dateformat}%
+}%
+\protected\def\cu@formatDate#1-#2-#3\relax{%
+ \bgroup
+ \cu@@formatDate#1-#2-#3\relax
+ \cuDISPLAYDATE
+ \egroup
+}%
+%
+\protected\def\cu@formatJulianDate#1-#2-#3\relax{%
+ \bgroup
+ \cu@@formatJulianDate#1-#2-#3\relax
+ \cuDISPLAYDATE
+ \egroup
+}%
+\cuDefineDateFormat{default}{%
+ \cuNum{\cuDAY}~\cuMonthName{\cuMONTH}~лѣ́та~\cuNum{\cuYEAR}%
+}%
+\cuUseDateFormat{default}%
+%
diff --git a/Master/texmf-dist/tex/latex/churchslavonic/cu-kinovar.sty b/Master/texmf-dist/tex/latex/churchslavonic/cu-kinovar.sty
new file mode 100644
index 00000000000..f678b623d76
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/churchslavonic/cu-kinovar.sty
@@ -0,0 +1,37 @@
+\ProvidesPackage{cu-kinovar}[2016/03/31 v1.0 CU Kinovar]
+
+\RequirePackage{cu-util}
+\RequirePackage{etoolbox}
+\RequirePackage{xcolor}
+
+%% 'color' option (default)
+\def\cu@kinovar{\relax}
+\def\cu@kinovar@color{\relax}
+
+\DeclareOption{color}{
+ \renewcommand{\cu@kinovar}[1]{\textcolor{kinovar}{#1}}
+ \renewcommand{\cu@kinovar@color}{\color{kinovar}}
+}
+\DeclareOption{gray}{
+ \renewcommand{\cu@kinovar}[1]{\textcolor{kinovar-gray}{#1}}
+ \renewcommand{\cu@kinovar@color}{\color{kinovar-gray}}
+}
+\DeclareOption{bw}{
+ \renewcommand{\cu@kinovar}[1]{#1}
+ \renewcommand{\cu@kinovar@color}{\relax}
+}
+
+\ExecuteOptions{color}
+\ProcessOptions\relax
+
+% define standard colors
+\definecolor{kinovar}{rgb}{0.80,0.03,0.01}
+\definecolor{kinovar-gray}{rgb}{0.45,0.45,0.45}
+
+% cuKinovar command colors just one letter with all accents if any
+\newrobustcmd{\cuKinovar}{\cu@tokenizeletter{\cu@kinovar}}
+
+% cuKinovarColorr switches foregrouond color to Kinovar
+\newrobustcmd{\cuKinovarColor}{\cu@kinovar@color}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/churchslavonic/cu-num.sty b/Master/texmf-dist/tex/latex/churchslavonic/cu-num.sty
new file mode 100644
index 00000000000..1a84190eadf
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/churchslavonic/cu-num.sty
@@ -0,0 +1,341 @@
+% Copyright 2016 Slavonic Computing Initialive
+% http://sci.ponomar.net
+%
+\ProvidesPackage{cu-num}[2016/03/03 v1.0 CU Numerics]
+
+\@ifundefined{detokenize}{%
+ \PackageError{cu-num}%
+ {You must upgrade your TeX distribution to be able to use this package}%
+ {This package depends on eTeX-based engine}%
+}{}
+
+%
+% Tools
+%
+\def\cu@ifempty#1{%
+ \if\relax\detokenize{#1}\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}%
+%
+\def\@firstoffour\cu@repeat #1\stop@ #2#3#4#5{#2}%
+\def\@firstofthree\cu@repeat@i #1\stop@ #2#3#4{#2}%
+\def\cu@switch #1{%
+ \if\relax\detokenize{#1}\relax
+ \expandafter\@firstoffour
+ \fi
+ \cu@repeat #1\stop@
+}%
+\def\cu@repeat #1#2\stop@ #3{%
+ \if\relax\detokenize{#2}\relax
+ \expandafter\@firstofthree
+ \fi
+ \cu@repeat@i #2\stop@
+}%
+\def\cu@repeat@i #1#2\stop@ #3{%
+ \if\relax\detokenize{#2}\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}%
+%
+% Slavonic numbering system. Internals.
+%
+\def\cu@format@small@number#1#2#3{%
+ \ifcase#1 \or
+ \expandafter р\or
+ \expandafter с\or
+ \expandafter т\or
+ \expandafter у\or
+ \expandafter ф\or
+ \expandafter х\or
+ \expandafter ѱ\or
+ \expandafter ѿ\or
+ \expandafter ц\else
+ \errmessage{cu-num: Internal error}%
+ \fi
+ \if 1#2%
+ \ifcase#3 \or
+ \expandafter а\or
+ \expandafter в\or
+ \expandafter г\or
+ \expandafter д\or
+ \expandafter є\or
+ \expandafter ѕ\or
+ \expandafter з\or
+ \expandafter и\or
+ \expandafter ѳ\else
+ \errmessage{cu-num: Internal error}%
+ \fi
+ і%
+ \else
+ \ifcase#2 \or
+ \expandafter і\or
+ \expandafter к\or
+ \expandafter л\or
+ \expandafter м\or
+ \expandafter н\or
+ \expandafter ѯ\or
+ \expandafter ѻ\or
+ \expandafter п\or
+ \expandafter ч\else
+ \errmessage{cu-num: Internal error}%
+ \fi
+ \ifcase#3 \or
+ \expandafter а\or
+ \expandafter в\or
+ \expandafter г\or
+ \expandafter д\or
+ \expandafter є\or
+ \expandafter ѕ\or
+ \expandafter з\or
+ \expandafter и\or
+ \expandafter ѳ\else
+ \errmessage{cu-num: Internal error}%
+ \fi
+ \fi
+}%
+%
+%
+\protected\def\cu@titlo{\char"0483}%
+\def\cu@thousand{҂}%
+\protected\def\cu@spacer{\,}%
+%
+\protected\def\stop@{}%
+\protected\def\divider@{DIVIDER}%
+%
+\def\cu@format#1{%
+ \ifnum#1<0%
+ \errmessage{cu-num: negative numbers not supported}%
+ \else\ifnum#1=0%
+ 0\cu@titlo
+ \else\ifnum#1<10%
+ {}%
+ {}%
+ \cu@format@xxx 00#1\stop@
+ \else\ifnum#1<100%
+ {}%
+ {}%
+ \cu@format@xxx 0#1\stop@
+ \else\ifnum#1<1000%
+ {}%
+ {}%
+ \cu@format@xxx #1\stop@
+ \else\ifnum#1<10000%
+ {}%
+ \cu@format@xxxxxx 00#1\stop@
+ \else\ifnum#1<100000%
+ {}%
+ \cu@format@xxxxxx 0#1\stop@
+ \else\ifnum#1<1000000%
+ {}%
+ \cu@format@xxxxxx #1\stop@
+ \else\ifnum#1<10000000%
+ \cu@format@xxxxxxxxx 00#1\stop@
+ \else\ifnum#1<100000000%
+ \cu@format@xxxxxxxxx 0#1\stop@
+ \else\ifnum#1<1000000000%
+ \cu@format@xxxxxxxxx #1\stop@
+ \else
+ \errmessage{cu-num: number too big "#1"}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}%
+%
+\def\cu@format@xxx#1#2#3\stop@{%
+ {%
+ \cu@format@small@number#1#2#3%
+ }%
+}%
+%
+\def\cu@format@xxxxxx#1#2#3#4#5#6\stop@{%
+ {\cu@format@small@number#1#2#3}%
+ {\cu@format@small@number#4#5#6}%
+}%
+%
+\def\cu@format@xxxxxxxxx#1#2#3#4#5#6#7#8#9\stop@{%
+ {\cu@format@small@number#1#2#3}%
+ \cu@format@xxxxxx#4#5#6#7#8#9\stop@
+}%
+%
+\def\cu@place@titlo #1{%
+ \cu@switch{#1}{%
+ {}%
+ }{%
+ {\cu@place@titlo@i #1\stop@}%
+ }{%
+ {\cu@place@titlo@ii #1\stop@}%
+ }{%
+ {\cu@place@titlo@iii #1\stop@}%
+ }%
+}%
+\def\cu@place@titlo@iii #1#2#3#4\stop@{%
+ \cu@ifempty{#4}{%
+ #1\cu@place@titlo@ii #2#3\stop@
+ }{%
+ #1\cu@place@titlo@iii #2#3#4\stop@
+ }%
+}%
+\def\cu@place@titlo@ii #1#2\stop@{%
+ \if #1ѿ%
+ #1#2\cu@titlo\else #1\cu@titlo #2\fi
+}%
+\def\cu@place@titlo@i #1\stop@{%
+ \if #10%
+ 0\else #1\cu@titlo \fi
+}%
+%
+\def\cu@merge@historic #1#2#3{%
+ \cu@switch{#2}{%
+ {#1}{#2}{#3}%
+ }{%
+ {#1}{#2#3}{0}%
+ }{%
+ {#1}{#2}{#3}%
+ }{%
+ {#1}{#2}{#3}%
+ }%
+}%
+%
+\def\cu@place@thousands#1#2#3{%
+ \cu@ifempty{#1}{%
+ {}%
+ }{%
+ {\cu@thousand\cu@thousand #1}%
+ }%
+ \cu@ifempty{#2}{%
+ {}%
+ }{%
+ \if#30%
+ {\cu@thousand #2}%
+ \else
+ \cu@ifempty{#3}{%
+ {\cu@interleave #2\stop@}%
+ }{%
+ {\cu@thousand #2}%
+ }%
+ \fi
+ }%
+ \if#30%
+ {}%
+ \else
+ {#3}%
+ \fi
+}%
+%
+\def\cu@interleave#1#2\stop@{%
+ \ifx#1\cu@titlo
+ \cu@ifempty{#2}{#1}{%
+ #1\cu@interleave #2\stop@
+ }%
+ \else
+ \cu@ifempty{#2}{%
+ \cu@thousand #1%
+ }{%
+ \cu@thousand #1\cu@interleave #2\stop@
+ }%
+ \fi
+}%
+%
+\def\cu@place@all@titlo#1#2#3{%
+ \cu@place@titlo{#1}%
+ \cu@place@titlo{#2}%
+ \cu@place@titlo{#3}%
+}%
+\def\cu@place#1{%
+ \if\relax\detokenize{#1}\relax
+ {}%
+ \else
+ \cu@place@i #1\stop@
+ \fi
+}%
+\def\cu@place@i#1#2\stop@{%
+ \if\relax\detokenize{#2}\relax
+ {#1\cu@titlo}%
+ \else
+ \cu@place@ii #1#2\stop@
+ \fi
+}%
+\def\cu@place@ii #1#2#3\stop@{%
+ \if\relax\detokenize{#3}\relax
+ \if#1ѿ{#1#2\cu@titlo}\else
+ {#1\cu@titlo #2}\fi
+ \else
+ \if#2ѿ{#1#2#3\cu@titlo}\else
+ {#1#2\cu@titlo #3}\fi
+ \fi
+}%
+%
+\def\cu@compose#1#2#3{%
+ \cu@ifempty{#1}{%
+ \cu@compose@ii{#2}{#3}%
+ }{%
+ \cu@ifempty{#2}{%
+ \cu@compose@ii{#1}{#3}%
+ }{%
+ \cu@ifempty{#3}{%
+ \cu@compose@ii{#1}{#2}%
+ }{%
+ #1\cu@spacer #2\cu@spacer #3%
+ }%
+ }%
+ }%
+}%
+%
+\def\cu@compose@ii#1#2{%
+ \cu@ifempty{#1}{%
+ \cu@ifempty{#2}{}{#2}%
+ }{%
+ \cu@ifempty{#2}{#1}{#1\cu@spacer #2}%
+ }%
+}%
+%
+\def\cu@fmt@#1{%
+ %\tracingmacros=1%
+ %\tracingonline=1%
+ \edef\@x{\number #1}%
+ \ifnum\@x=0\relax
+ \edef\@x{0\cu@titlo}%
+ \else\ifnum\@x<0%
+ \edef\@x{\number-\@x}%
+ \edef\@x{\noexpand\cu@format{\@x}}%
+ \edef\@x{\@x}%
+ \edef\@x{\noexpand\cu@merge@historic\@x}%
+ \edef\@x{\@x}%
+ \edef\@x{\noexpand\cu@place@all@titlo\@x}%
+ \edef\@x{\@x}%
+ \edef\@x{\noexpand\cu@place@thousands\@x}%
+ \edef\@x{\@x}%
+ \edef\@x{\noexpand\cu@compose\@x}%
+ \edef\@x{\@x}%
+ \edef\@x{-\@x}%
+ \else
+ \edef\@x{\noexpand\cu@format{\@x}}%
+ \edef\@x{\@x}%
+ %\show\@x
+ \edef\@x{\noexpand\cu@merge@historic\@x}%
+ \edef\@x{\@x}%
+ %\show\@x
+ \edef\@x{\noexpand\cu@place@all@titlo\@x}%
+ \edef\@x{\@x}%
+ %\show\@x
+ \edef\@x{\noexpand\cu@place@thousands\@x}%
+ \edef\@x{\@x}%
+ %\show\@x
+ \edef\@x{\noexpand\cu@compose\@x}%
+ \edef\@x{\@x}%
+ %\show\@x
+ \fi\fi
+ %\tracingmacros=0%
+}%
+%
+% User API
+%
+\protected\def\cuNum#1{%
+ \bgroup
+ \cu@fmt@{#1}%
+ \@x
+ \egroup
+}%
diff --git a/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty b/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty
new file mode 100644
index 00000000000..212b58886b0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/churchslavonic/cu-util.sty
@@ -0,0 +1,196 @@
+\ProvidesPackage{cu-util}[2016/03/31 v1.0 CU Util]
+
+\RequirePackage{etoolbox}
+%
+% Some ideas taken from:
+% http://tex.stackexchange.com/questions/33197/parsing-a-macro-argument-character-by-character-for-conditional-execution
+%
+\def\cu@declare@accent#1{%
+ \def\cu@@declare@accent##1##2\relax{%
+ \@namedef{cu@accent@\detokenize{##2}}{\relax}%
+ }%
+ \cu@@declare@accent#1\relax
+}%
+%
+\newcommand\cu@tokenizeletter[1]{%
+ \bgroup
+ \def\@accum{}%
+ \def\cu@collectworker{%
+ \cu@ifnextaccent{%
+ \cu@collectworker@one
+ }{%
+ \expandafter \egroup \expandafter #1\expandafter {\@accum}%
+ }%
+ }%
+ \def\cu@collectworker@one##1{%
+ \edef\@accum{\@accum ##1}%
+ \cu@collectworker
+ }%
+ \def\cu@collectworker@two##1##2{%
+ \edef\@accum{\@accum ##1##2}%
+ \cu@collectworker
+ }%
+ \cu@ifnextbgroup{\egroup #1}{%
+ \cu@ifnextdigraph{\cu@collectworker@two}{\cu@collectworker@one}%
+ }%
+}%
+%
+\newrobustcmd\cu@ifnextletter[2]{%
+ \bgroup
+ \def\cu@worker{%
+ \ifcat\noexpand\@let@token a%
+ \expandafter\egroup\expandafter\@firstoftwo
+ \else
+ \expandafter\egroup\expandafter\@secondoftwo
+ \fi
+ {#1}{#2}%
+ }%
+ \futurelet\@let@token\cu@worker
+}
+%
+\newrobustcmd\cu@ifnextaccent[2]{%
+ \bgroup
+ \def\cu@letter@i{%
+ \ifdefequal{\@let@token}{ }{%
+ \egroup #2% false
+ }{%
+ \cu@letter@ii
+ }%
+ }%
+ \def\cu@letter@ii##1{%
+ \ifcsdef{cu@accent@\detokenize{##1}}{%
+ \egroup #1##1% true
+ }{%
+ \egroup #2##1% false
+ }%
+ }%
+ \futurelet\@let@token\cu@letter@i
+}%
+%
+% Detect Oy and oy digraphs
+% kv command colors just one letter with all accents if any
+\def\cu@declare@digraph#1#2\relax{%
+ \@namedef{cu@digraph@start@\detokenize{#1}}{\relax}%
+ \@namedef{cu@digraph@end@\detokenize{#2}}{\relax}%
+}%
+%
+\cu@declare@digraph оу\relax
+\cu@declare@digraph Оу\relax
+\cu@declare@digraph ᲂу\relax
+%
+\newrobustcmd{\cu@ifnextdigraph}[2]{%
+ \bgroup
+ \def\cu@digraph@i{%
+ \ifdefequal{\@let@token}{ }{%
+ \egroup #2% false!
+ }{%
+ \cu@digraph@ii
+ }%
+ }%
+ \def\cu@digraph@ii##1{%
+ \ifcsdef{cu@digraph@start@\detokenize{##1}}{%
+ \edef\@accum{\@accum##1}%
+ \futurelet\@let@token\cu@digraph@iii
+ }{%
+ \egroup #2##1% false!
+ }%
+ }%
+ \def\cu@digraph@iii##1{%
+ \ifcsdef{cu@digraph@end@\detokenize{##1}}{%
+ \expandafter \egroup \expandafter #1\@accum ##1% true!
+ }{%
+ \expandafter \egroup \expandafter #2\@accum ##1% false!
+ }%
+ }%
+ \def\@accum{}%
+ \futurelet\@let@token\cu@digraph@i
+}%
+%
+\newrobustcmd{\cu@ifnextbgroup}[2]{%
+ \bgroup
+ \def\cu@bgroup{%
+ \ifdefequal{\@let@token}{ }{%
+ \egroup #2% false!
+ }{%
+ \egroup\@ifnextchar\bgroup{#1}{#2}%
+ }%
+ }%
+ \futurelet\@let@token\cu@bgroup
+}%
+%
+\def\cu@test@tokenizeletter#1#2{%
+ \bgroup
+ \def\cu@testframe##1##2\@nnil{%
+ \edef\@aa{##1-##2}%
+ }%
+ \cu@tokenizeletter\cu@testframe #1\@nnil
+ \def\@bb{#2}%
+ \ifx\@aa\@bb\else
+ \errmessage{TEST FAILED: #1: "\@aa" expected "\@bb"}%
+ \fi
+ \egroup
+}%
+%
+% List all accents
+%
+%% declare all possible combineres (generated by make_declare_accents)
+\cu@declare@accent{◌̀}
+\cu@declare@accent{◌́}
+\cu@declare@accent{◌̑}
+\cu@declare@accent{◌̈}
+\cu@declare@accent{◌҆}
+\cu@declare@accent{◌̆}
+\cu@declare@accent{◌̾}
+\cu@declare@accent{◌꙽}
+\cu@declare@accent{◌꙼}
+\cu@declare@accent{◌̇}
+\cu@declare@accent{◌̏}
+\cu@declare@accent{◌҃}
+\cu@declare@accent{◌҇}
+\cu@declare@accent{◌ⷠ}
+\cu@declare@accent{◌ⷡ}
+\cu@declare@accent{◌ⷢ}
+\cu@declare@accent{◌ⷣ}
+\cu@declare@accent{◌ⷤ}
+\cu@declare@accent{◌ⷥ}
+\cu@declare@accent{◌ⷦ}
+\cu@declare@accent{◌ⷧ}
+\cu@declare@accent{◌ⷨ}
+\cu@declare@accent{◌ⷩ}
+\cu@declare@accent{◌ⷪ}
+\cu@declare@accent{◌ⷫ}
+\cu@declare@accent{◌ⷬ}
+\cu@declare@accent{◌ⷭ}
+\cu@declare@accent{◌ⷮ}
+\cu@declare@accent{◌ⷯ}
+\cu@declare@accent{◌ⷰ}
+\cu@declare@accent{◌ⷱ}
+\cu@declare@accent{◌ⷲ}
+\cu@declare@accent{◌ⷳ}
+\cu@declare@accent{◌ⷴ}
+\cu@declare@accent{◌ⷵ}
+\cu@declare@accent{◌ⷶ}
+\cu@declare@accent{◌ⷷ}
+\cu@declare@accent{◌ⷸ}
+\cu@declare@accent{◌ⷹ}
+\cu@declare@accent{◌ⷺ}
+\cu@declare@accent{◌ⷻ}
+\cu@declare@accent{◌ⷼ}
+\cu@declare@accent{◌ⷽ}
+\cu@declare@accent{◌ⷾ}
+\cu@declare@accent{◌ⷿ}
+\cu@declare@accent{◌ꙴ}
+\cu@declare@accent{◌ꙵ}
+\cu@declare@accent{◌ꙶ}
+\cu@declare@accent{◌ꙷ}
+\cu@declare@accent{◌ꙸ}
+\cu@declare@accent{◌ꙹ}
+\cu@declare@accent{◌ꙺ}
+\cu@declare@accent{◌ꙻ}
+\cu@declare@accent{◌꙼}
+\cu@declare@accent{◌꙽}
+\cu@declare@accent{◌҆}
+\cu@declare@accent{◌҅}
+%% end of generated block
+
+\endinput