-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmas2.c
97 lines (89 loc) · 3.1 KB
/
xmas2.c
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
#include "romcal.h"
void christmas2(struct Info *info,
struct Cal cal[])
{
/*----------------------------------------------------------------------*
*
* @(#)ROMCAL xmas2.c 6.1 02/12/06 17:23:56
*
* Copyright (C) 1993,1995,1999 Kenneth G. Bath
* Permission to use and modify this software and its
* documentation for any purpose other than its incorporation
* into a commercial product is hereby granted without fee.
*
* Permission to copy and distribute this software and its
* documentation only for non-commercial use is also granted
* without fee, provided, however, that the above copyright
* notice appear in all copies, that both that copyright
* notice and this permission notice appear in supporting
* documentation. The author makes no representations about
* the suitability of this software for any purpose. It is
* provided "as is" without express or implied warranty.
*
*-------------------- Software Unit Description -----------------------*
*
* This module computes the portion of the Christmas season
* that occurs at the end of the year. That is, from Christmas
* Day until Jan. 31.
*
*---------------------- Software Unit History -------------------------*
*
* 16Mar93 : created, kgb
* 06Feb94 : renamed to xmas2.c for use on a PC, kgb
* 21Dec01 : corrected the Octave of Christmas; added dow_t, kgb
*
*----------------------------------------------------------------------*/
static char *hf = "Holy Family";
/*
* Note that the first three days of the Octave will be overwritten by
* the fixed feasts of Stephen, M; John, Ap and Ev; and Holy Innocents,
* Mm. This will happen later when the fixed celebrations are added to
* the calendar.
*/
static char *cmoctave[] =
{
"Second day in the Octave of Christmas",
"Third day in the Octave of Christmas",
"Fourth day in the Octave of Christmas",
"Fifth day in the Octave of Christmas",
"Sixth day in the Octave of Christmas",
"Seventh day in the Octave of Christmas"
};
int iday,
dec26,
dec30;
dow_t dow;
/*----------------------------------------------------------------------*
* begin code *
*----------------------------------------------------------------------*/
/*
* Compute the week following Christmas. The Sunday between Dec. 26 and Dec.
* 31 is Holy Family.
*/
dec26 = info->cdoy + 1;
for (iday = dec26; iday < info->numdays; iday++) {
dow = DOW(iday, info->sunmod);
if (dow == DOW_SUNDAY) {
cal[iday].celebration = hf;
cal[iday].rank = LORD;
}
else {
cal[iday].celebration = cmoctave[iday - dec26];
}
cal[iday].season = CHRISTMAS;
cal[iday].color = WHITE;
cal[iday].invitatory = NULL;
}
/*
* If Christmas falls on a Sunday, then there is no Sunday between Dec. 26
* and Dec. 31. In that case, Holy Family is celebrated on Dec. 30.
*/
if (DOW(info->cdoy, info->sunmod) == DOW_SUNDAY) {
dec30 = doy(info->year, 12, 30);
cal[dec30].celebration = hf;
cal[iday].season = CHRISTMAS;
cal[iday].rank = LORD;
cal[iday].color = WHITE;
cal[iday].invitatory = NULL;
}
}