diff options
author | Karl Berry <karl@freefriends.org> | 2008-07-12 18:23:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-07-12 18:23:29 +0000 |
commit | 9bca6550cfe2de5380ebe394480ccb24126f2863 (patch) | |
tree | 2abb49bb229bed346f86399bc005c1ed7038d867 /Master/texmf-dist/tex/xelatex/polyglossia/cal-util.def | |
parent | 037cf3d536e0f1fa1cccb00e1f26e8279abceb40 (diff) |
new xetex package polyglossia (11jul08)
git-svn-id: svn://tug.org/texlive/trunk@9485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/polyglossia/cal-util.def')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/polyglossia/cal-util.def | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/polyglossia/cal-util.def b/Master/texmf-dist/tex/xelatex/polyglossia/cal-util.def new file mode 100644 index 00000000000..85576f39f71 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/polyglossia/cal-util.def @@ -0,0 +1,69 @@ +%%%%%%%%%%%%% cal-util.def %%%%%%%%%%%%%%%% +% Macros shared by hijrical and hebrewcal % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the following is adapted from hebcal.sty in babel +\def\@Remainder#1#2#3{% + #3 = #1% % c = a + \divide #3 by #2% % c = a/b + \multiply #3 by -#2% % c = -b(a/b) + \advance #3 by #1}% % c = a - b(a/b) +\newif\if@Divisible +\def\@CheckIfDivisible#1#2{% + {% + \countdef\tmpx=0% % temporary variable + \@Remainder{#1}{#2}{\tmpx}% + \ifnum\tmpx=0% + \global\@Divisibletrue% + \else% + \global\@Divisiblefalse% + \fi}} +\newif\if@GregorianLeap +\def\@CheckIfGregorianLeap#1{% + {% + \@CheckIfDivisible{#1}{4}% + \if@Divisible% + \@CheckIfDivisible{#1}{100}% + \if@Divisible% + \@CheckIfDivisible{#1}{400}% + \if@Divisible% + \global\@GregorianLeaptrue% + \else% + \global\@GregorianLeapfalse% + \fi% + \else% + \global\@GregorianLeaptrue% + \fi% + \else% + \global\@GregorianLeapfalse% + \fi% + }} +%% + +\newcounter{tmpA}\newcounter{tmpB} +\newcounter{tmpC}\newcounter{tmpD} +\newcounter{tmpE}\newcounter{tmpF} + + +%% This is an algorithm from Reingold & Dershowitz, +%% Calendrical Calculations, The Millenium Edition +%% +\def\@FixedFromGregorian#1#2#3#4{% + \setcounter{tmpA}{(#1-1)*365}% + \setcounter{tmpB}{(#1-1)/4}% + \setcounter{tmpC}{(#1-1)/100}% + \setcounter{tmpD}{(#1-1)/400}% + \setcounter{tmpE}{(367*#2-362)/12}% + \ifnum#2<3% + \setcounter{tmpF}{0}% + \else% + \@CheckIfGregorianLeap{#1}% + \if@GregorianLeap% + \setcounter{tmpF}{-1}% + \else% + \setcounter{tmpF}{-2}% + \fi% + \fi% + \@ifundefined{c@#4}{\global\newcounter{#4}}{}% + \setcounter{#4}{\value{tmpA}+\value{tmpB}-\value{tmpC}+\value{tmpD}+\value{tmpE}+\value{tmpF}+#3}% +} +\endinput |