%%
%% This is file `babel-ca-chinese.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% babel.dtx  (with options: `ca-chinese')
%% 
%%
%% Copyright (C) 2012-2024 Javier Bezos and Johannes L. Braams.
%% Copyright (C) 1989-2012 Johannes L. Braams and
%%           any individual authors listed elsewhere in this file.
%% All rights reserved.
%%
%%
%% This file is part of the Babel system.
%% --------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% The Current Maintainer of this work is Javier Bezos.
%%
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension |.ins|) which are part of the distribution.
%%

\ExplSyntaxOn
\def\bbl@fpmod#1#2{(#1-#2*floor(#1/#2))}
\def\bbl@cs@gregleap#1{%
  (\bbl@fpmod{#1}{4} == 0) &&
    (!((\bbl@fpmod{#1}{100} == 0) && (\bbl@fpmod{#1}{400} != 0)))}
\def\bbl@cs@jd#1#2#3{% year, month, day
  \fp_eval:n{ 1721424.5   + (365 * (#1 - 1)) +
    floor((#1 - 1) / 4)   + (-floor((#1 - 1) / 100)) +
    floor((#1 - 1) / 400) + floor((((367 * #2) - 362) / 12) +
    ((#2 <= 2) ? 0 : (\bbl@cs@gregleap{#1} ? -1 : -2)) + #3) }}
\def\bbl@ca@chinese#1-#2-#3\@@#4#5#6{%
  \edef\bbl@tempd{\fp_eval:n{%
    \bbl@cs@jd{#1}{#2}{#3} - 2457072.5 }}%
  \count@\z@
  \@tempcnta=2015
  \bbl@foreach\bbl@cs@chinese@data{%
    \ifnum##1>\bbl@tempd\else
      \advance\count@\@ne
      \ifnum\count@>12
        \count@\@ne
        \advance\@tempcnta\@ne\fi
      \bbl@xin@{,##1,}{,\bbl@cs@chinese@leap,}%
      \ifin@
        \advance\count@\m@ne
        \edef\bbl@tempe{\the\numexpr\count@+12\relax}%
      \else
        \edef\bbl@tempe{\the\count@}%
      \fi
      \edef\bbl@tempb{##1}%
    \fi}%
  \edef#4{\the\@tempcnta}%
  \edef#5{\bbl@tempe}%
  \edef#6{\the\numexpr\bbl@tempd-\bbl@tempb+1\relax}}
\def\bbl@cs@chinese@leap{%
  885,1920,2953,3809,4873,5906,6881,7825,8889,9893,10778}
\def\bbl@cs@chinese@data{0,29,59,88,117,147,176,206,236,266,295,325,
  354,384,413,443,472,501,531,560,590,620,649,679,709,738,%
  768,797,827,856,885,915,944,974,1003,1033,1063,1093,1122,%
  1152,1181,1211,1240,1269,1299,1328,1358,1387,1417,1447,1477,%
  1506,1536,1565,1595,1624,1653,1683,1712,1741,1771,1801,1830,%
  1860,1890,1920,1949,1979,2008,2037,2067,2096,2126,2155,2185,%
  2214,2244,2274,2303,2333,2362,2392,2421,2451,2480,2510,2539,%
  2569,2598,2628,2657,2687,2717,2746,2776,2805,2835,2864,2894,%
  2923,2953,2982,3011,3041,3071,3100,3130,3160,3189,3219,3248,%
  3278,3307,3337,3366,3395,3425,3454,3484,3514,3543,3573,3603,%
  3632,3662,3691,3721,3750,3779,3809,3838,3868,3897,3927,3957,%
  3987,4016,4046,4075,4105,4134,4163,4193,4222,4251,4281,4311,%
  4341,4370,4400,4430,4459,4489,4518,4547,4577,4606,4635,4665,%
  4695,4724,4754,4784,4814,4843,4873,4902,4931,4961,4990,5019,%
  5049,5079,5108,5138,5168,5197,5227,5256,5286,5315,5345,5374,%
  5403,5433,5463,5492,5522,5551,5581,5611,5640,5670,5699,5729,%
  5758,5788,5817,5846,5876,5906,5935,5965,5994,6024,6054,6083,%
  6113,6142,6172,6201,6231,6260,6289,6319,6348,6378,6408,6437,%
  6467,6497,6526,6556,6585,6615,6644,6673,6703,6732,6762,6791,%
  6821,6851,6881,6910,6940,6969,6999,7028,7057,7087,7116,7146,%
  7175,7205,7235,7264,7294,7324,7353,7383,7412,7441,7471,7500,%
  7529,7559,7589,7618,7648,7678,7708,7737,7767,7796,7825,7855,%
  7884,7913,7943,7972,8002,8032,8062,8092,8121,8151,8180,8209,%
  8239,8268,8297,8327,8356,8386,8416,8446,8475,8505,8534,8564,%
  8593,8623,8652,8681,8711,8740,8770,8800,8829,8859,8889,8918,%
  8948,8977,9007,9036,9066,9095,9124,9154,9183,9213,9243,9272,%
  9302,9331,9361,9391,9420,9450,9479,9508,9538,9567,9597,9626,%
  9656,9686,9715,9745,9775,9804,9834,9863,9893,9922,9951,9981,%
  10010,10040,10069,10099,10129,10158,10188,10218,10247,10277,%
  10306,10335,10365,10394,10423,10453,10483,10512,10542,10572,%
  10602,10631,10661,10690,10719,10749,10778,10807,10837,10866,%
  10896,10926,10956,10986,11015,11045,11074,11103}
\ExplSyntaxOff
\endinput
%%
%% End of file `babel-ca-chinese.tex'.
