1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
|
/* $Id: tables.h,v 1.4 2001/10/29 05:55:39 fflee Exp $ */
/*----------------------------------------------------------------------------
# Copyright (C) 1988,1989,1991,1992,2001 Fung F. Lee and Ricky Yeung
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
----------------------------------------------------------------------------*/
/*
* tables.h: contains tables and parameters for lunar.c
*/
#define Cyear 1900 /* Note that LC1900.1.1 is SC1900.1.31 */
#define Nyear 150 /* number of years covered by the table */
#define Nmonth 13 /* maximum number of months in a lunar year */
static Date SolarFirstDate = {
/* Wednesday, 12 a.m., 31 January, 1900 */
1900, 1, 31, 0, 3, 0
};
static Date LunarFirstDate = {
/* Wednesday, 12 a.m., First day, First month, 1900 */
1900, 1, 1, 0, 3, 0
};
static Date GanFirstDate = {
/* geng1-nian2 wu4-yue4 jia3-ri4 jia3-shi2 */
6, 4, 0, 0, 3, 0
};
static Date ZhiFirstDate = {
/* zi3-nian2 yin2-yue4 chen2-ri4 zi3-shi2 */
0, 2, 4, 0, 3, 0
};
static long yearInfo[Nyear] = {
/* encoding:
b bbbbbbbbbbbb bbbb
bit# 1 111111000000 0000
6 543210987654 3210
. ............ ....
month# 000000000111
M 123456789012 L
b_j = 1 for long month, b_j = 0 for short month
L is the leap month of the year if 1<=L<=12; NO leap month if L = 0.
The leap month (if exists) is long one iff M = 1.
*/
0x04bd8, /* 1900 */
0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, /* 1905 */
0x16554, 0x056a0, 0x09ad0, 0x055d2, 0x04ae0, /* 1910 */
0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, /* 1915 */
0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, /* 1920 */
0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, /* 1925 */
0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566, /* 1930 */
0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, /* 1935 */
0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, /* 1940 */
0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, /* 1945 */
0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, /* 1950 */
0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, /* 1955 */
0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, /* 1960 */
0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, /* 1965 */
0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, /* 1970 */
0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, /* 1975 */
0x0d558, 0x0b540, 0x0b5a0, 0x195a6, 0x095b0, /* 1980 */
0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, /* 1985 */
0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, /* 1990 */
0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, /* 1995 */
0x05ac0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, /* 2000 */
0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, /* 2005 */
0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, /* 2010 */
0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, /* 2015 */
0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, /* 2020 */
0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, /* 2025 */
0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, 0x05aa0, /* 2030 */
0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, /* 2035 */
0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, /* 2040 */
0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, /* 2045 */
0x0aa50, 0x1b255, 0x06d20, 0x0ada0 /* 2049 */
};
/*
In "4-column" calculation, a "mingli" (fortune-telling) calculation,
the beginning of a month is not the first day of the month as in
the Lunar Calendar; it is instead governed by "jie2" (festival).
Interestingly, in the Solar calendar, a jie always comes around certain
day. For example, the jie "li4chun1" (beginning of spring) always comes
near Feburary 4 of the Solar Calendar.
Meaning of array fest:
Each element, fest[i][j] stores the jie day (in term of the following Solar
month) of the lunar i-th year, j-th month.
For example, in 1992, fest[92][0] is 4, that means the jie "li4chun1"
(beginning of spring) is on Feb. 4, 1992; fest[92][11] is 5, that means
the jie of the 12th lunar month is on Jan. 5, 1993.
*/
static byte fest[N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