Compare commits

...

22 Commits

Author SHA1 Message Date
David F. Skoll
df6b4ac566 Update release notes. 2012-01-23 13:08:22 -05:00
David F. Skoll
4ba21ab526 Fix test-all-languages.sh. 2012-01-23 12:01:11 -05:00
David F. Skoll
acac7a7b31 Add shell script to test all languages. Add %* substitutions to tstlang.rem 2012-01-23 11:58:07 -05:00
David F. Skoll
2290fd09f5 Add altmode to various languages. 2012-01-23 11:49:32 -05:00
David F. Skoll
f02b6a1773 "-x" flag to git-ls-files doesn't work, apparently. 2012-01-23 11:14:00 -05:00
David F. Skoll
efffe05d42 Merge branch 'master' of ssh://source.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2012-01-20 15:49:27 -05:00
David F. Skoll
950d67c522 Update Finnish translation for altmode. 2012-01-20 15:49:03 -05:00
David F. Skoll
a1aa61f54e Fix comment. 2012-01-12 13:12:59 -05:00
David F. Skoll
3c2bd66460 Clarify wording. 2012-01-12 13:05:46 -05:00
David F. Skoll
245cebee56 If multiple -a options are supplied, then *do* trigger timed reminders
that are in the future.
2012-01-12 13:04:53 -05:00
David F. Skoll
c45364fdb3 More WIP on PHP stuff. 2012-01-12 12:48:36 -05:00
David F. Skoll
e380308604 More sunstuff tweaking. 2011-12-28 13:14:24 -05:00
David F. Skoll
bd019524dd Update test output 2011-12-28 08:50:03 -05:00
David F. Skoll
895536d7d3 Use proper value of cos(6 degrees) for dusk/dawn 2011-12-28 08:49:37 -05:00
David F. Skoll
3a0e41afd1 Round off sun times to nearest minute. 2011-12-27 12:34:17 -05:00
David F. Skoll
23dd28471e Update sunrise/sunset calculations with different formula for mean anomaly. 2011-12-27 12:20:36 -05:00
David F. Skoll
761217d403 Add dawn/sunrise/sunset/dusk tests. 2011-12-26 17:44:34 -05:00
David F. Skoll
77ed694111 Use proper formula for dusk/dawn. 2011-12-26 14:41:21 -05:00
David F. Skoll
61bcce3104 Add tests for %*x and upper-case %*X substitutions. 2011-12-25 11:43:07 -05:00
David F. Skoll
bf41b12ccd Paranoia. 2011-12-24 11:04:21 -05:00
David F. Skoll
5eabd7d8d8 Fix dumb error. :) 2011-12-24 11:02:52 -05:00
David F. Skoll
0c66f5f3af Add "alternate" substitution mode: %*X is the same as %x but it leaves
out the preposition "at" or "on".
2011-12-24 10:58:37 -05:00
20 changed files with 1899 additions and 95 deletions

View File

@@ -1,5 +1,17 @@
CHANGES TO REMIND
* Version 3.1 Patch 12 - 2012-01-23
- NEW FEATURE: Many substitution sequences "%x" have an alternate mode
denoted by "%*x". This alternate mode leaves out prepositions. For
example, in English "%i" might yield "on 01-25" while "%*i" yields only
"01-25".
- BUG FIX: The "dusk" and "dawn" calculations were completely wrong. They
have been fixed. Also, sunrise/sunset calculations have been tweaked,
so the results may be off by a minute or two compared to previous versions
of Remind.
* Version 3.1 Patch 11 - 2011-12-16
- BUG FIX: For some inexplicable reason, dawn was considered to happen when

View File

@@ -149,10 +149,16 @@ The \fB\-h\fR option ("hush...") suppresses certain warning and information
messages. In particular, if no reminders are triggered, this mode
produces no output.
.TP
\fB\-a\fR
The \fB\-a\fR option causes \fBRemind\fR not to immediately trigger timed
reminders that would also be queued. It also causes \fBRemind\fR not to
place timed reminders in a calendar.
.B \-a
The \fB\-a\fR option causes \fBRemind\fR not to immediately trigger
timed reminders that trigger on the current day. It also causes
\fBRemind\fR not to place timed reminders in a calendar. If you
supply two or more \fB\-a\fR options, then \fBRemind\fR \fIwill\fR
trigger timed reminders that are in the future, but will not trigger
timed reminders whose time has passed. (Regardless of how many
\fB\-a\fR options you supply, \fBRemind\fR will not include timed
reminders in the calendar if at least one \fB\-a\fR option is used.)
.TP
\fB\-q\fR
The \fB\-q\fR option causes \fBRemind\fR not to queue timed reminders
@@ -1869,7 +1875,7 @@ If non-zero, then the \fB\-c\fR option was supplied on the command line.
.B $Daemon (read-only)
If the daemon mode \fB\-z\fR was invoked, contains the number of
minutes between wakeups. If not running in daemon mode, contains
0. For the MS-DOS version, always contains 0.
0.
.TP
.B $DateSep
This variable can be set only to "/" or "-". It holds the character
@@ -1885,15 +1891,13 @@ from 0 to 9999.
.TP
.B $DontFork (read-only)
If non-zero, then the \fB\-c\fR option was supplied on the command line.
For the MS-DOS version, always contains 1.
.TP
.B $DontTrigAts (read-only)
If non-zero, then the \fB\-a\fR option was supplied on the command line.
For the MS-DOS version, always contains 0.
The number of times that the \fB\-a\fR option was supplied on the
command line.
.TP
.B $DontQueue (read-only)
If non-zero, then the \fB\-q\fR option was supplied on the command line.
For the MS-DOS version, always contains 1.
.TP
.B $EndSent (STRING type)
Contains a list of characters that end a sentence. The \fBMSF\fR
@@ -1996,7 +2000,7 @@ If non-zero, then the \fB\-n\fR option was supplied on the command line.
.TP
.B $NumQueued (read-only)
Contains the number of reminders queued so far for background
timed triggering. For MS-DOS, always returns 0.
timed triggering.
.TP
.B $NumTrig (read-only)
Contains the number of reminders triggered for the current date. One
@@ -2739,7 +2743,7 @@ an algorithm in "Almanac for Computers for the year 1978" by
L. E. Doggett, Nautical Almanac Office, USNO. They require
the latitude and longitude to be specified by setting the appropriate
system variables. (See "System Variables".) The sun functions
should be accurate to within about 2 minutes for latitudes lower
should be accurate to within about 4 minutes for latitudes lower
than 60 degrees. The functions are available starting from version
03.00.07 of \fBRemind\fR.
.RE

View File

@@ -80,13 +80,13 @@ depend:
# Build a tar file based on all files checked into git.
distro:
ln -s . ../remind-$(VERSION)
(cd ..; git ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
(cd ..; git ls-files | fgrep -v .gitignore | fgrep -v remind.php) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
gzip -f -v -9 remind-$(VERSION).tar
rm -f ../remind-$(VERSION)
beta-tgz:
ln -s . ../remind-$(VERSION)-BETA-$(BETA)
(cd ..; git ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)-BETA-$(BETA)\//' | xargs tar -C .. -cvf remind-$(VERSION)-BETA-$(BETA).tar
(cd ..; git ls-files | fgrep -v .gitignore | fgrep -v remind.php) | sed -e 's/^/remind-$(VERSION)-BETA-$(BETA)\//' | xargs tar -C .. -cvf remind-$(VERSION)-BETA-$(BETA).tar
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
rm -f ../remind-$(VERSION)-BETA-$(BETA)

View File

@@ -924,7 +924,17 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
/* Don't trigger timed reminders if DontIssueAts is true, and if the
reminder is for today */
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0;
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) {
if (DontIssueAts > 1) {
/* If two or more -a options, then *DO* issue ats that are in the
future */
if (tim->ttime < SystemTime(0) / 60) {
return 0;
}
} else {
return 0;
}
}
/* Don't trigger "old" timed reminders */
/*** REMOVED...

View File

@@ -62,6 +62,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
char *os;
char s[256];
int origLen = DBufLen(dbuf);
int altmode;
FromJulian(jul, &y, &m, &d);
@@ -141,6 +142,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
continue;
}
altmode = 0;
s[0] = 0;
c = ParseChar(p, &err, 0);
if (err) {
@@ -150,6 +152,17 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
if (!c) {
break;
}
if (c == '*') {
altmode = c;
c = ParseChar(p, &err, 0);
if (err) {
DBufFree(dbuf);
return err;
}
if (!c) {
break;
}
}
done = 0;
if (diff <= 1) {
switch(UPPER(c)) {
@@ -206,8 +219,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_A_OVER
L_A_OVER
#else
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
MonthName[m], y);
if (altmode == '*') {
sprintf(s, "%s, %d %s, %d", DayName[jul%7], d,
MonthName[m], y);
} else {
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
MonthName[m], y);
}
#endif
SHIP_OUT(s);
break;
@@ -225,7 +243,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_C_OVER
L_C_OVER
#else
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
if (altmode == '*') {
sprintf(s, "%s", DayName[jul%7]);
} else {
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
}
#endif
SHIP_OUT(s);
break;
@@ -243,8 +265,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_E_OVER
L_E_OVER
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
m+1, DateSep, y);
if (altmode == '*') {
sprintf(s, "%02d%c%02d%c%04d", d, DateSep,
m+1, DateSep, y);
} else {
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
m+1, DateSep, y);
}
#endif
SHIP_OUT(s);
break;
@@ -253,7 +280,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_F_OVER
L_F_OVER
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
if (altmode == '*') {
sprintf(s, "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
} else {
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
}
#endif
SHIP_OUT(s);
break;
@@ -262,7 +293,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_G_OVER
L_G_OVER
#else
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
if (altmode == '*') {
sprintf(s, "%s, %d %s", DayName[jul%7], d, MonthName[m]);
} else {
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
}
#endif
SHIP_OUT(s);
break;
@@ -271,7 +306,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_H_OVER
L_H_OVER
#else
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
if (altmode == '*') {
sprintf(s, "%02d%c%02d", d, DateSep, m+1);
} else {
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
}
#endif
SHIP_OUT(s);
break;
@@ -280,7 +319,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_I_OVER
L_I_OVER
#else
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
if (altmode == '*') {
sprintf(s, "%02d%c%02d", m+1, DateSep, d);
} else {
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
}
#endif
SHIP_OUT(s);
break;
@@ -289,8 +332,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_J_OVER
L_J_OVER
#else
sprintf(s, "%s %s, %s %d%s, %d", L_ON, DayName[jul%7],
MonthName[m], d, plu, y);
if (altmode == '*') {
sprintf(s, "%s, %s %d%s, %d", DayName[jul%7],
MonthName[m], d, plu, y);
} else {
sprintf(s, "%s %s, %s %d%s, %d", L_ON, DayName[jul%7],
MonthName[m], d, plu, y);
}
#endif
SHIP_OUT(s);
break;
@@ -299,8 +347,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_K_OVER
L_K_OVER
#else
sprintf(s, "%s %s, %s %d%s", L_ON, DayName[jul%7],
MonthName[m], d, plu);
if (altmode == '*') {
sprintf(s, "%s, %s %d%s", DayName[jul%7],
MonthName[m], d, plu);
} else {
sprintf(s, "%s %s, %s %d%s", L_ON, DayName[jul%7],
MonthName[m], d, plu);
}
#endif
SHIP_OUT(s);
break;
@@ -309,7 +362,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_L_OVER
L_L_OVER
#else
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
if (altmode == '*') {
sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
} else {
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
}
#endif
SHIP_OUT(s);
break;
@@ -391,8 +448,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_U_OVER
L_U_OVER
#else
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d,
plu, MonthName[m], y);
if (altmode == '*') {
sprintf(s, "%s, %d%s %s, %d", DayName[jul%7], d,
plu, MonthName[m], y);
} else {
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d,
plu, MonthName[m], y);
}
#endif
SHIP_OUT(s);
break;
@@ -401,8 +463,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_V_OVER
L_V_OVER
#else
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu,
MonthName[m]);
if (altmode == '*') {
sprintf(s, "%s, %d%s %s", DayName[jul%7], d, plu,
MonthName[m]);
} else {
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu,
MonthName[m]);
}
#endif
SHIP_OUT(s);
break;
@@ -464,7 +531,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_2_OVER
L_2_OVER
#else
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
if (altmode == '*') {
sprintf(s, "%d%c%02d%s", hh, TimeSep, min, pm);
} else {
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
}
#endif
SHIP_OUT(s);
break;
@@ -474,7 +545,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
L_3_OVER
#else
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
if (altmode == '*') {
sprintf(s, "%02d%c%02d", h, TimeSep, min);
} else {
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
}
#endif
SHIP_OUT(s);
break;
@@ -590,8 +665,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
}
if (isupper(c)) {
os = DBufValue(dbuf) - strlen(s);
*os = UPPER(*os);
os = DBufValue(dbuf);
os += strlen(os) - strlen(s);
if (os >= DBufValue(dbuf)) {
*os = UPPER(*os);
}
}
}

View File

@@ -1854,10 +1854,11 @@ static int FTimeStuff(int wantmins, func_info *info)
static int SunStuff(int rise, double cosz, int jul)
{
int year, mon, day;
int jan0;
int mins, hours;
int dusk_or_dawn;
int year, mon, day;
int jan0;
double jan0d;
double M, L, tanA, sinDelta, cosDelta, a, a_hr, cosH, t, H, T;
double latitude, longdeg, UT, local;
@@ -1880,25 +1881,34 @@ static int SunStuff(int rise, double cosz, int jul)
FromJulian(jul, &year, &mon, &day);
jan0 = jul - Julian(year, 0, 1);
jan0d = (double) jan0;
dusk_or_dawn = rise;
if (rise > 1)
rise -= 2;
/* Following formula on page B6 exactly... */
t = (double) jan0;
if (rise) t += (6.0 + longdeg/15.0) / 24.0;
else t += (18.0 + longdeg/15.0) / 24.0;
/* Mean anomaly of sun for 1978 ... how accurate for other years??? */
M = 0.985600 * t - 3.251; /* In degrees */
/* Following formula on page B6 exactly... */
t = (double) jul;
if (rise) {
t += (6.0 + longdeg/15.0) / 24.0;
jan0d += (6.0 + longdeg/15.0) / 24.0;
} else {
t += (18.0 + longdeg/15.0) / 24.0;
jan0d += (18.0 + longdeg/15.0) / 24.0;
}
/* Mean anomaly of sun starting from 1 Jan 1990 */
/* NOTE: This assumes that BASE = 1990!!! */
#if BASE != 1990
#error Sun calculations assume a BASE of 1990!
#endif
M = (0.9856002585 * t) + 357.828757; /* In degrees */
/* Make sure M is in the range [0, 360) */
M -= (floor(M/360.0) * 360.0);
/* Sun's true longitude */
L = M + 1.916*sin(DEGRAD*M) + 0.02*sin(2*DEGRAD*M) + 282.565;
if (dusk_or_dawn == 2) {/* dusk */
L += 6;
} else if (dusk_or_dawn == 3) {/* dawn */
L -= 6;
}
if (L > 360.0) L -= 360.0;
/* Tan of sun's right ascension */
@@ -1941,7 +1951,7 @@ static int SunStuff(int rise, double cosz, int jul)
H = RADDEG * acos(cosH);
if (rise) H = 360.0 - H;
T = H / 15.0 + a_hr - 0.065710*t - 6.620;
T = H / 15.0 + a_hr - 0.065710 * jan0d - 6.620;
if (T >= 24.0) T -= 24.0;
else if (T < 0.0) T+= 24.0;
@@ -1952,6 +1962,9 @@ static int SunStuff(int rise, double cosz, int jul)
if (local < 0.0) local += 24.0;
else if (local >= 24.0) local -= 24.0;
/* Round off local time to nearest minute */
local = floor(local * 60.0 + 0.5) / 60.0;
hours = (int) local;
mins = (int) ((local - hours) * 60.0);
@@ -1975,9 +1988,13 @@ static int SunStuff(int rise, double cosz, int jul)
static int FSun(int rise, func_info *info)
{
int jul = JulianToday;
static double cosz = -0.014543897; /* for sunrise and sunset */
double cosz = -0.014543897; /* for sunrise and sunset */
int r;
/* Civil twilight: cos(96 degrees) */
if (rise == 2 || rise == 3) {
cosz = -0.104528463268;
}
if (Nargs >= 1) {
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
jul = DATEPART(ARG(0));

View File

@@ -317,7 +317,7 @@ void InitRemind(int argc, char const *argv[])
case 'a':
case 'A':
DontIssueAts = 1;
DontIssueAts++;
break;
case 'q':

View File

@@ -100,10 +100,10 @@
#define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " om natten" : " om formiddagen" : (hour > 17) ? " om aftenen" : " om eftermiddagen";
#define L_ORDINAL_OVERRIDE plu = ".";
#define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_E_OVER sprintf(s, "den %02d%c%02d%c%04d", d, DateSep, m+1, DateSep, y);
#define L_F_OVER sprintf(s, "den %02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
#define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_H_OVER sprintf(s, "den %02d%c%02d", d, DateSep, m+1);
#define L_I_OVER sprintf(s, "den %02d%c%02d", m+1, DateSep, d);
#define L_U_OVER L_A_OVER

View File

@@ -161,26 +161,19 @@
} \
}
#endif
#define L_A_OVER sprintf(s, "%s%s %d. %s%s %d", DayName[jul%7], L_ON, d, \
MonthName[m], L_PARTIT, y);
#define L_C_OVER sprintf(s, "%s%s", DayName[jul%7], L_ON);
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, \
y);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s%s %d. %s%s %d", DayName[jul%7], L_ON, d, MonthName[m], L_PARTIT, y); }
#define L_C_OVER if (altmode == '*') { sprintf(s, "%s", DayName[jul%7]); } else { sprintf(s, "%s%s", DayName[jul%7], L_ON); }
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, y);
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
#define L_G_OVER sprintf(s, "%s%s %d. %s%s", DayName[jul%7], L_ON, d, \
MonthName[m], L_PARTIT);
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s%s %d. %s%s", DayName[jul%7], L_ON, d, MonthName[m], L_PARTIT); }
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DateSep, m+1);
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DateSep, d);
#define L_J_OVER sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, \
MonthName[m], d, plu, y);
#define L_K_OVER sprintf(s, "%s%s %sn %d%s", DayName[jul%7], L_ON, \
MonthName[m], d, plu);
#define L_J_OVER if (altmode == '*') { sprintf(s, "%s %sn %d%s %d", DayName[jul%7], MonthName[m], d, plu, y); } else { sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, MonthName[m], d, plu, y); }
#define L_K_OVER if (altmode == '*') { sprintf(s, "%s %sn %d%s", DayName[jul%7], MonthName[m], d, plu); } else { sprintf(s, "%s%s %sn %d%s", DayName[jul%7], L_ON, MonthName[m], d, plu); }
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
#define L_Q_OVER sprintf(s, "n");
#define L_U_OVER sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, \
d, plu, MonthName[m], L_PARTIT, y);
#define L_V_OVER sprintf(s, "%s%s %d%s %s%s", DayName[jul%7], L_ON, d, \
plu, MonthName[m], L_PARTIT);
#define L_U_OVER if (altmode == '*') { sprintf(s, "%s %d%s %s %d", DayName[jul%7], d, plu, MonthName[m], y); } else { sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, d, plu, MonthName[m], L_PARTIT, y); }
#define L_V_OVER if (altmode == '*') { sprintf(s, "%s %d%s %s", DayName[jul%7], d, plu, MonthName[m]); } else { sprintf(s, "%s%s %d%s %s%s", DayName[jul%7], L_ON, d, plu, MonthName[m], L_PARTIT); }
#define L_1_OVER \
if (tdiff == 0) \
sprintf(s, "%s", L_NOW); \

View File

@@ -129,13 +129,9 @@ else if (tdiff < 0) { \
sprintf(s, "dans %d heure%s et %d minute%s", hdiff, hplu, mdiff, mplu); \
}
#define L_J_OVER \
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], \
d, plu, MonthName[m], y);
#define L_J_OVER if (altmode == '*') { sprintf(s, "%s, %d%s %s, %d", DayName[jul%7], d, plu, MonthName[m], y); } else { sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d, plu, MonthName[m], y); }
#define L_K_OVER \
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], \
d, plu, MonthName[m]);
#define L_K_OVER if (altmode == '*') { sprintf(s, "%s, %d%s %s", DayName[jul%7], d, plu, MonthName[m]); } else { sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu, MonthName[m]); }
#endif /* L_IN_DOSUBST */

View File

@@ -93,8 +93,8 @@
See the file dosubst.c for more info. */
#define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " nachts" : " vormittags" : (hour > 17) ? " abends" : " nachmittags";
#define L_ORDINAL_OVERRIDE plu = ".";
#define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
#define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER

View File

@@ -101,8 +101,8 @@
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
See the file dosubst.c for more info. */
#define L_ORDINAL_OVERRIDE plu = ".";
#define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
#define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER

View File

@@ -141,8 +141,8 @@ ampm = (hour<12) ? \
: " w nocy";
#endif
#define L_ORDINAL_OVERRIDE plu = "";
#define L_A_OVER sprintf(s, "%s %s, %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
#define L_G_OVER sprintf(s, "%s %s, %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER

11
src/test-all-languages.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Make sure Remind compiles with all supported languages; show
# tstlang.rem output for each language.
ALL=`grep ^#define lang.h | grep -v '#define LANG' | awk '{print $2}'`
for i in $ALL ; do
make clean all LANGDEF=-DLANG=$i || exit 1
./remind -q -r ../tests/tstlang.rem
done
exit 0

13
tests/sun.rem Normal file
View File

@@ -0,0 +1,13 @@
SET $LatDeg 45
SET $LatMin 24
SET $LatSec 0
SET $LongDeg 75
SET $LongMin 39
SET $LongSec 0
SET $MinsFromUTC -300
SET $CalcUTC 0
MSG Dawn: [dawn()]
MSG Sunrise: [sunrise()]
MSG Sunset: [sunset()]
MSG Dusk: [dusk()]

View File

@@ -81,6 +81,24 @@ rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
../src/remind -p ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
../src/remind -p12 ../tests/sun.rem 1 Jan 2011 >> ../tests/test.out 2>&1
# Test -a vs -aa
../src/remind -q -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up
REM 1 Jan 2012 AT 9:00 MSG 9am: Should not show up
REM 1 Jan 2012 AT 10:00 MSG 10am: Should not show up
MSG [$DontTrigAts]
EOF
../src/remind -q -a -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up
REM 1 Jan 2012 AT 9:00 MSG 9am: Should show up
REM 1 Jan 2012 AT 10:00 MSG 10am: Should show up
MSG [$DontTrigAts]
EOF
cmp -s ../tests/test.out ../tests/test.cmp
if [ "$?" = "0" ]; then
echo "Remind: Acceptance test PASSED"

File diff suppressed because it is too large Load Diff

View File

@@ -270,7 +270,29 @@ set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
msg [a075]%
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
msg [a076]%
set a077 dosubst("%y %z", '1992/5/5')
set a074 dosubst("%*a %*b %*c %*d %*e %*f %*g %*h", '1992/5/5')
msg [a074]%
set a075 dosubst("%*i %*j %*k %*l %*m %*n %*o %*p", '1992/5/5')
msg [a075]%
set a076 dosubst("%*q %*r %*s %*t %*u %*v %*w %*x", '1992/5/5')
msg [a076]%
set a077 dosubst("%*y %*z", '1992/5/5')
msg [a077]%
set a074 dosubst("%A %B %C %D %E %F %G %H", '1992/5/5')
msg [a074]%
set a075 dosubst("%I %J %K %L %M %N %O %P", '1992/5/5')
msg [a075]%
set a076 dosubst("%Q %R %S %T %U %V %W %X", '1992/5/5')
msg [a076]%
set a077 dosubst("%Y %Z", '1992/5/5')
msg [a077]%
set a074 dosubst("%*A %*B %*C %*D %*E %*F %*G %*H", '1992/5/5')
msg [a074]%
set a075 dosubst("%*I %*J %*K %*L %*M %*N %*O %*P", '1992/5/5')
msg [a075]%
set a076 dosubst("%*Q %*R %*S %*T %*U %*V %*W %*X", '1992/5/5')
msg [a076]%
set a077 dosubst("%*Y %*Z", '1992/5/5')
msg [a077]%
set a078 easterdate(today())
set a079 easterdate(1992)

View File

@@ -30,7 +30,7 @@ if !$RunOff || !$DontQueue || $DontTrigAts
endif
# Set up a few useful definitions
fset show(x) "%%" + x + " yields: " + char(34) + "%" + x + char(34) + "%"
fset show(x) "%%" + x + " yields: " + char(34) + "%" + x + char(34) + "% and %%*" + x + " yields: " + char(34) + "%*" + x + char(34) + "%"
set a trigger(today()+2) + " ++2"
set l language()
set tt now()+134

View File

@@ -4,8 +4,8 @@ class Remind
{
# For validating commands we send to popen
function is_valid_day($d) {
return (preg_match('/^\d+$/', $d) &&
$d >= 1 && $d <= 31;
return (preg_match('/^\d+$/', $d)) &&
$d >= 1 && $d <= 31;
}
function is_valid_month($m) {
@@ -160,6 +160,22 @@ class Remind
return $html;
}
function small_calendar($results, $month, $monlen, $first_col, $which, &$options)
{
$monday_first = $results['monday_flag'];
if ($monday_first) {
$first_col--;
if ($first_col < 0) {
$first_col = 6;
}
}
$html = "<td class=\"rem-small-calendar\">\n<table class=\"rem-sc-table\">\n<caption class=\"rem-sc-caption\">";
# TODO: URL for small calendar
$html .= $month;
$html .= "</caption>\n";
}
function generate_html(&$results, &$specials, &$options)
{
$monday_first = $results['monday_flag'];
@@ -318,8 +334,8 @@ $fp = popen('rem -p -l', 'r');
$r = new Remind;
$ans = $r->parse_remind_output($fp);
pclose($fp);
#print_r($ans);
print_r($ans);
$options = array();
print $r->generate_html($ans['results'], $ans['specials'], $options);
#print $r->generate_html($ans['results'], $ans['specials'], $options);
?>