Handle some expression regressions.

Explicitly use GNU cpp for preprocessing.
Remove explicit debugging code.
Change some variable names to be less confusing.
Improve some comments.
Improve indentation.

PR:		162211
		168785
MFC after:	2 weeks
This commit is contained in:
Greg Lehey 2013-06-12 07:52:49 +00:00
parent 9625321547
commit 90c72ba909
6 changed files with 113 additions and 71 deletions

View File

@ -101,11 +101,11 @@ extern int EastLongitude;
* program wrong. * program wrong.
*/ */
/* /*
* All the astronomical calculations are carried out for the meridian 120 * All the astronomical calculations are carried out for the meridian 120
* degrees east of Greenwich. * degrees east of Greenwich.
*/ */
#define UTCOFFSET_CNY 8.0 #define UTCOFFSET_CNY 8.0
extern int debug; /* show parsing of the input */ extern int debug; /* show parsing of the input */
extern int year1, year2; extern int year1, year2;
@ -174,7 +174,7 @@ int j2g(int);
/* dates.c */ /* dates.c */
extern int cumdaytab[][14]; extern int cumdaytab[][14];
extern int mondaytab[][14]; extern int monthdaytab[][14];
extern int debug_remember; extern int debug_remember;
void generatedates(struct tm *tp1, struct tm *tp2); void generatedates(struct tm *tp1, struct tm *tp2);
void dumpdates(void); void dumpdates(void);

View File

@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -22,7 +22,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
@ -73,8 +73,8 @@ int cumdaytab[][14] = {
{0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, {0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
}; };
/* 1-based month, individual */ /* 1-based month, individual */
static int *mondays; static int *monthdays;
int mondaytab[][14] = { int monthdaytab[][14] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30}, {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
}; };
@ -192,11 +192,11 @@ generatedates(struct tm *tp1, struct tm *tp2)
* - Take all days from <m1 .. m2> * - Take all days from <m1 .. m2>
* - Take the first days from m2 * - Take the first days from m2
*/ */
mondays = mondaytab[isleap(y1)]; monthdays = monthdaytab[isleap(y1)];
for (d = d1; d <= mondays[m1]; d++) for (d = d1; d <= monthdays[m1]; d++)
createdate(y1, m1, d); createdate(y1, m1, d);
for (m = m1 + 1; m < m2; m++) for (m = m1 + 1; m < m2; m++)
for (d = 1; d <= mondays[m]; d++) for (d = 1; d <= monthdays[m]; d++)
createdate(y1, m, d); createdate(y1, m, d);
for (d = 1; d <= d2; d++) for (d = 1; d <= d2; d++)
createdate(y1, m2, d); createdate(y1, m2, d);
@ -210,21 +210,21 @@ generatedates(struct tm *tp1, struct tm *tp2)
* - Take all days from y2-[1 .. m2> * - Take all days from y2-[1 .. m2>
* - Take the first days of y2-m2 * - Take the first days of y2-m2
*/ */
mondays = mondaytab[isleap(y1)]; monthdays = monthdaytab[isleap(y1)];
for (d = d1; d <= mondays[m1]; d++) for (d = d1; d <= monthdays[m1]; d++)
createdate(y1, m1, d); createdate(y1, m1, d);
for (m = m1 + 1; m <= 12; m++) for (m = m1 + 1; m <= 12; m++)
for (d = 1; d <= mondays[m]; d++) for (d = 1; d <= monthdays[m]; d++)
createdate(y1, m, d); createdate(y1, m, d);
for (y = y1 + 1; y < y2; y++) { for (y = y1 + 1; y < y2; y++) {
mondays = mondaytab[isleap(y)]; monthdays = monthdaytab[isleap(y)];
for (m = 1; m <= 12; m++) for (m = 1; m <= 12; m++)
for (d = 1; d <= mondays[m]; d++) for (d = 1; d <= monthdays[m]; d++)
createdate(y, m, d); createdate(y, m, d);
} }
mondays = mondaytab[isleap(y2)]; monthdays = monthdaytab[isleap(y2)];
for (m = 1; m < m2; m++) for (m = 1; m < m2; m++)
for (d = 1; d <= mondays[m]; d++) for (d = 1; d <= monthdays[m]; d++)
createdate(y2, m, d); createdate(y2, m, d);
for (d = 1; d <= d2; d++) for (d = 1; d <= d2; d++)
createdate(y2, m2, d); createdate(y2, m2, d);
@ -360,12 +360,12 @@ first_dayofweek_of_month(int yy, int mm)
return (m->firstdayofweek); return (m->firstdayofweek);
m = m->nextmonth; m = m->nextmonth;
} }
/* Should not happen */ /* No data for this month */
return (-1); return (-1);
} }
/* Should not happen */ /* No data for this year. Error? */
return (-1); return (-1);
} }
int int

View File

@ -273,7 +273,7 @@ opencal(void)
_exit(1); _exit(1);
} }
execl(_PATH_CPP, "cpp", "-P", execl(_PATH_CPP, "cpp", "-P",
"-traditional", "-nostdinc", /* GCC specific opts */ "-traditional-cpp", "-nostdinc", /* GCC specific opts */
"-I.", "-I", _PATH_INCLUDE, (char *)NULL); "-I.", "-I", _PATH_INCLUDE, (char *)NULL);
warn(_PATH_CPP); warn(_PATH_CPP);
_exit(1); _exit(1);

View File

@ -47,6 +47,7 @@ static int indextooffset(char *s);
static int parseoffset(char *s); static int parseoffset(char *s);
static char *floattoday(int year, double f); static char *floattoday(int year, double f);
static char *floattotime(double f); static char *floattotime(double f);
static int wdayom (int day, int offset, int month, int year);
/* /*
* Expected styles: * Expected styles:
@ -184,7 +185,7 @@ determinestyle(char *date, int *flags,
} }
/* /*
* AFTER this, leave by goto-ing to "allfine" or "fail" to restore the * After this, leave by goto-ing to "allfine" or "fail" to restore the
* original data in `date'. * original data in `date'.
*/ */
pold = *p; pold = *p;
@ -203,15 +204,9 @@ determinestyle(char *date, int *flags,
*flags |= F_YEAR; *flags |= F_YEAR;
} }
/*
printf("p1: %s\n", p1);
printf("p2: %s\n", p2);
printf("year: %s\n", year);
*/
/* Check if there is a month-string in the date */ /* Check if there is a month-string in the date */
if ((checkmonth(p1, &len, &offset, &pmonth) != 0) if ((checkmonth(p1, &len, &offset, &pmonth) != 0)
|| (checkmonth(p2, &len, &offset, &pmonth) != 0 && (p2 = p1))) { || (checkmonth(p2, &len, &offset, &pmonth) != 0 && (p2 = p1))) {
/* p2 is the non-month part */ /* p2 is the non-month part */
*flags |= F_MONTH; *flags |= F_MONTH;
*imonth = offset; *imonth = offset;
@ -239,13 +234,12 @@ determinestyle(char *date, int *flags,
*flags |= F_MODIFIERINDEX; *flags |= F_MODIFIERINDEX;
goto allfine; goto allfine;
} }
goto fail; goto fail;
} }
/* Check if there is an every-day or every-month in the string */ /* Check if there is an every-day or every-month in the string */
if ((strcmp(p1, "*") == 0 && isonlydigits(p2, 1)) if ((strcmp(p1, "*") == 0 && isonlydigits(p2, 1))
|| (strcmp(p2, "*") == 0 && isonlydigits(p1, 1) && (p2 = p1))) { || (strcmp(p2, "*") == 0 && isonlydigits(p1, 1) && (p2 = p1))) {
int d; int d;
*flags |= F_ALLMONTH; *flags |= F_ALLMONTH;
@ -258,7 +252,7 @@ determinestyle(char *date, int *flags,
/* Month as a number, then a weekday */ /* Month as a number, then a weekday */
if (isonlydigits(p1, 1) if (isonlydigits(p1, 1)
&& checkdayofweek(p2, &len, &offset, &dow) != 0) { && checkdayofweek(p2, &len, &offset, &dow) != 0) {
int d; int d;
*flags |= F_MONTH; *flags |= F_MONTH;
@ -316,7 +310,10 @@ allfine:
} }
static void void
remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm,
int dd, char *extra);
void
remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm, remember(int *rememberindex, int *y, int *m, int *d, char **ed, int yy, int mm,
int dd, char *extra) int dd, char *extra)
{ {
@ -367,16 +364,60 @@ debug_determinestyle(int dateonly, char *date, int flags, char *month,
printf("specialday: |%s|\n", specialday); printf("specialday: |%s|\n", specialday);
} }
struct yearinfo { static struct yearinfo {
int year; int year;
int ieaster, ipaskha, firstcnyday; int ieaster, ipaskha, firstcnyday;
double ffullmoon[MAXMOONS], fnewmoon[MAXMOONS]; double ffullmoon[MAXMOONS], fnewmoon[MAXMOONS];
double ffullmooncny[MAXMOONS], fnewmooncny[MAXMOONS]; double ffullmooncny[MAXMOONS], fnewmooncny[MAXMOONS];
int ichinesemonths[MAXMOONS]; int ichinesemonths[MAXMOONS];
double equinoxdays[2], solsticedays[2]; double equinoxdays[2], solsticedays[2];
int *mondays; int *monthdays;
struct yearinfo *next; struct yearinfo *next;
}; } *years, *yearinfo;
/*
* Calculate dates with offset from weekdays, like Thurs-3, Wed+2, etc.
* day is the day of the week,
* offset the ordinal number of the weekday in the month.
*/
static int
wdayom (int day, int offset, int month, int year)
{
/* Weekday of first day in month */
int wday1; /* first day of month */
/* Weekday of last day in month */
int wdayn;
int d;
wday1 = first_dayofweek_of_month(year, month);
if (wday1 < 0) /* not set */
return (wday1);
/*
* Date of zeroth or first of our weekday in month, depending on the
* relationship with the first of the month. The range is -6:6.
*/
d = (day - wday1 + 1) % 7;
/*
* Which way are we counting? Offset 0 is invalid, abs (offset) > 5 is
* meaningless, but that's OK. Offset 5 may or may not be meaningless,
* so there's no point in complaining for complaining's sake.
*/
if (offset < 0) { /* back from end of month */
/* FIXME */
wdayn = d;
while (wdayn <= yearinfo->monthdays[month])
wdayn += 7;
d = offset * 7 + wdayn;
} else if (offset > 0){
if (d > 0)
d += offset * 7 - 7;
else
d += offset * 7;
} else
warnx ("Invalid offset 0");
return (d);
}
/* /*
* Possible date formats include any combination of: * Possible date formats include any combination of:
* 3-charmonth (January, Jan, Jan) * 3-charmonth (January, Jan, Jan)
@ -400,8 +441,6 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
char *ed; char *ed;
int retvalsign = 1; int retvalsign = 1;
static struct yearinfo *years, *yearinfo;
/* /*
* CONVENTION * CONVENTION
* *
@ -419,8 +458,8 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
dayofmonth, idayofmonth, dayofweek, idayofweek, dayofmonth, idayofmonth, dayofweek, idayofweek,
modifieroffset, modifierindex, specialday, syear, iyear); modifieroffset, modifierindex, specialday, syear, iyear);
if (determinestyle(date, flags, month, &imonth, dayofmonth, if (determinestyle(date, flags, month, &imonth, dayofmonth,
&idayofmonth, dayofweek, &idayofweek, modifieroffset, &idayofmonth, dayofweek, &idayofweek, modifieroffset,
modifierindex, specialday, syear, &iyear) == 0) { modifierindex, specialday, syear, &iyear) == 0) {
if (debug) if (debug)
printf("Failed!\n"); printf("Failed!\n");
return (0); return (0);
@ -457,7 +496,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
yearinfo->next = years; yearinfo->next = years;
years = yearinfo; years = yearinfo;
yearinfo->mondays = mondaytab[isleap(year)]; yearinfo->monthdays = monthdaytab[isleap(year)];
yearinfo->ieaster = easter(year); yearinfo->ieaster = easter(year);
yearinfo->ipaskha = paskha(year); yearinfo->ipaskha = paskha(year);
fpom(year, UTCOffset, yearinfo->ffullmoon, fpom(year, UTCOffset, yearinfo->ffullmoon,
@ -514,7 +553,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
/* Every day of a month */ /* Every day of a month */
if (lflags == (F_ALLDAY | F_MONTH)) { if (lflags == (F_ALLDAY | F_MONTH)) {
for (d = 1; d <= yearinfo->mondays[imonth]; d++) { for (d = 1; d <= yearinfo->monthdays[imonth]; d++) {
if (!remember_ymd(year, imonth, d)) if (!remember_ymd(year, imonth, d))
continue; continue;
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
@ -548,14 +587,15 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
continue; continue;
} }
/* Every so-manied dayofweek of every month of the year */ /*
* Every so-manied dayofweek of every month of the year:
* Thu-3
*/
if (lflags == (F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { if (lflags == (F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
offset = indextooffset(modifierindex); offset = indextooffset(modifierindex);
for (m = 0; m < 12; m++) { for (m = 0; m <= 12; m++) {
dow = first_dayofweek_of_month(year, m); d = wdayom (idayofweek, offset, m, year);
d = (idayofweek - dow + 8) % 7;
d += (offset - 1) * 7;
if (remember_ymd(year, m, d)) { if (remember_ymd(year, m, d)) {
remember(&remindex, remember(&remindex,
yearp, monthp, dayp, edp, yearp, monthp, dayp, edp,
@ -566,7 +606,10 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
continue; continue;
} }
/* A certain dayofweek of a month */ /*
* A certain dayofweek of a month
* Jan/Thu-3
*/
if (lflags == if (lflags ==
(F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
offset = indextooffset(modifierindex); offset = indextooffset(modifierindex);
@ -574,9 +617,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
d = (idayofweek - dow + 8) % 7; d = (idayofweek - dow + 8) % 7;
if (offset > 0) { if (offset > 0) {
while (d <= yearinfo->mondays[imonth]) { while (d <= yearinfo->monthdays[imonth]) {
if (--offset == 0 if (--offset == 0
&& remember_ymd(year, imonth, d)) { && remember_ymd(year, imonth, d)) {
remember(&remindex, remember(&remindex,
yearp, monthp, dayp, edp, yearp, monthp, dayp, edp,
year, imonth, d, NULL); year, imonth, d, NULL);
@ -587,7 +630,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
continue; continue;
} }
if (offset < 0) { if (offset < 0) {
while (d <= yearinfo->mondays[imonth]) while (d <= yearinfo->monthdays[imonth])
d += 7; d += 7;
while (offset != 0) { while (offset != 0) {
offset++; offset++;
@ -606,7 +649,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) {
dow = first_dayofweek_of_month(year, imonth); dow = first_dayofweek_of_month(year, imonth);
d = (idayofweek - dow + 8) % 7; d = (idayofweek - dow + 8) % 7;
while (d <= yearinfo->mondays[imonth]) { while (d <= yearinfo->monthdays[imonth]) {
if (remember_ymd(year, imonth, d)) if (remember_ymd(year, imonth, d))
remember(&remindex, remember(&remindex,
yearp, monthp, dayp, edp, yearp, monthp, dayp, edp,
@ -623,7 +666,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if ((lflags & F_MODIFIEROFFSET) != 0) if ((lflags & F_MODIFIEROFFSET) != 0)
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
if (remember_yd(year, yearinfo->ieaster + offset, if (remember_yd(year, yearinfo->ieaster + offset,
&rm, &rd)) &rm, &rd))
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
year, rm, rd, NULL); year, rm, rd, NULL);
continue; continue;
@ -636,7 +679,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if ((lflags & F_MODIFIEROFFSET) != 0) if ((lflags & F_MODIFIEROFFSET) != 0)
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
if (remember_yd(year, yearinfo->ipaskha + offset, if (remember_yd(year, yearinfo->ipaskha + offset,
&rm, &rd)) &rm, &rd))
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
year, rm, rd, NULL); year, rm, rd, NULL);
continue; continue;
@ -649,7 +692,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if ((lflags & F_MODIFIEROFFSET) != 0) if ((lflags & F_MODIFIEROFFSET) != 0)
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
if (remember_yd(year, yearinfo->firstcnyday + offset, if (remember_yd(year, yearinfo->firstcnyday + offset,
&rm, &rd)) &rm, &rd))
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
year, rm, rd, NULL); year, rm, rd, NULL);
continue; continue;
@ -665,7 +708,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { for (i = 0; yearinfo->ffullmoon[i] > 0; i++) {
if (remember_yd(year, if (remember_yd(year,
floor(yearinfo->ffullmoon[i]) + offset, floor(yearinfo->ffullmoon[i]) + offset,
&rm, &rd)) { &rm, &rd)) {
ed = floattotime( ed = floattotime(
yearinfo->ffullmoon[i]); yearinfo->ffullmoon[i]);
@ -687,8 +730,8 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { for (i = 0; yearinfo->ffullmoon[i] > 0; i++) {
if (remember_yd(year, if (remember_yd(year,
floor(yearinfo->fnewmoon[i]) + offset, floor(yearinfo->fnewmoon[i]) + offset,
&rm, &rd)) { &rm, &rd)) {
ed = floattotime(yearinfo->fnewmoon[i]); ed = floattotime(yearinfo->fnewmoon[i]);
remember(&remindex, remember(&remindex,
yearp, monthp, dayp, edp, yearp, monthp, dayp, edp,
@ -705,7 +748,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if ((lflags & F_MODIFIEROFFSET) != 0) if ((lflags & F_MODIFIEROFFSET) != 0)
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
if (remember_yd(year, yearinfo->equinoxdays[0] + offset, if (remember_yd(year, yearinfo->equinoxdays[0] + offset,
&rm, &rd)) { &rm, &rd)) {
ed = floattotime(yearinfo->equinoxdays[0]); ed = floattotime(yearinfo->equinoxdays[0]);
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
year, rm, rd, ed); year, rm, rd, ed);
@ -733,7 +776,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if ((lflags & F_MODIFIEROFFSET) != 0) if ((lflags & F_MODIFIEROFFSET) != 0)
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
if (remember_yd(year, if (remember_yd(year,
yearinfo->solsticedays[0] + offset, &rm, &rd)) { yearinfo->solsticedays[0] + offset, &rm, &rd)) {
ed = floattotime(yearinfo->solsticedays[0]); ed = floattotime(yearinfo->solsticedays[0]);
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
year, rm, rd, ed); year, rm, rd, ed);
@ -746,7 +789,7 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
if ((lflags & F_MODIFIEROFFSET) != 0) if ((lflags & F_MODIFIEROFFSET) != 0)
offset = parseoffset(modifieroffset); offset = parseoffset(modifieroffset);
if (remember_yd(year, if (remember_yd(year,
yearinfo->solsticedays[1] + offset, &rm, &rd)) { yearinfo->solsticedays[1] + offset, &rm, &rd)) {
ed = floattotime(yearinfo->solsticedays[1]); ed = floattotime(yearinfo->solsticedays[1]);
remember(&remindex, yearp, monthp, dayp, edp, remember(&remindex, yearp, monthp, dayp, edp,
year, rm, rd, ed); year, rm, rd, ed);
@ -755,11 +798,11 @@ parsedaymonth(char *date, int *yearp, int *monthp, int *dayp, int *flags,
} }
if (debug) { if (debug) {
printf("Unprocessed:\n"); printf("Unprocessed:\n");
debug_determinestyle(2, date, lflags, month, imonth, debug_determinestyle(2, date, lflags, month, imonth,
dayofmonth, idayofmonth, dayofweek, idayofweek, dayofmonth, idayofmonth, dayofweek, idayofweek,
modifieroffset, modifierindex, specialday, syear, modifieroffset, modifierindex, specialday, syear,
iyear); iyear);
} }
retvalsign = -1; retvalsign = -1;
} }
@ -972,7 +1015,6 @@ indextooffset(char *s)
static int static int
parseoffset(char *s) parseoffset(char *s)
{ {
return strtol(s, NULL, 10); return strtol(s, NULL, 10);
} }

View File

@ -32,5 +32,5 @@
#include <paths.h> #include <paths.h>
#define _PATH_CPP "/usr/bin/cpp" #define _PATH_CPP "/usr/bin/gcpp"
#define _PATH_INCLUDE "/usr/share/calendar" #define _PATH_INCLUDE "/usr/share/calendar"

View File

@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -22,7 +22,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
@ -373,7 +373,7 @@ calculatesunlongitude30(int year, int degreeGMToffset, int *ichinesemonths)
int firstmonth330 = -1; int firstmonth330 = -1;
cumdays = cumdaytab[isleap(year)]; cumdays = cumdaytab[isleap(year)];
monthdays = mondaytab[isleap(year)]; monthdays = monthdaytab[isleap(year)];
pichinesemonths = ichinesemonths; pichinesemonths = ichinesemonths;
h = 0; h = 0;