mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 14:59:20 +02:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffbba7d4d1 | ||
|
|
fdcc2d8acf | ||
|
|
f1aa4d16af | ||
|
|
a55c5580f3 | ||
|
|
569e315306 | ||
|
|
acd641845d | ||
|
|
6b7e6f6788 | ||
|
|
4248b9c624 | ||
|
|
6de98d1357 | ||
|
|
18f21693af | ||
|
|
6fa500a860 | ||
|
|
941c02582e | ||
|
|
e56e3924d9 | ||
|
|
d1384a8f69 | ||
|
|
0488d689aa | ||
|
|
988a94e669 | ||
|
|
ac7e93ac1c | ||
|
|
bb7e9ee676 | ||
|
|
ac949ce7bd | ||
|
|
0fa8eed11f | ||
|
|
df8694a128 | ||
|
|
13df3d96e5 |
2
configure
vendored
2
configure
vendored
@@ -4025,7 +4025,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
VERSION=04.02.02
|
VERSION=04.02.03
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ if test "$?" != 0 ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
||||||
VERSION=04.02.02
|
VERSION=04.02.03
|
||||||
AC_SUBST(VERSION)
|
AC_SUBST(VERSION)
|
||||||
AC_SUBST(PERL)
|
AC_SUBST(PERL)
|
||||||
AC_SUBST(PERLARTIFACTS)
|
AC_SUBST(PERLARTIFACTS)
|
||||||
|
|||||||
@@ -1,5 +1,34 @@
|
|||||||
CHANGES TO REMIND
|
CHANGES TO REMIND
|
||||||
|
|
||||||
|
* VERSION 4.2 Patch 3 - 2023-02-10
|
||||||
|
|
||||||
|
- NEW FEATURE: Remind: add the orthodoxeaster() function to return the
|
||||||
|
date of Orthodox Easter.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Add Greek language support courtesy of JeiEl.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Add Greek holiday file courtesy of JeiEl.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Fix the Perl code (rem2pdf, rem2html) to silence Perl::Critic
|
||||||
|
warnings
|
||||||
|
|
||||||
|
- IMPROVEMENT: Many internal code tweaks to eliminate many cppcheck
|
||||||
|
static analysis warnings.
|
||||||
|
|
||||||
|
- DOCUMENTATION IMPROVEMENT: Clarify the distinction between a "time"
|
||||||
|
and a "duration" as suggested by Ian! D. Allen.
|
||||||
|
|
||||||
|
- BUG FIX: Remind: Fix incorrect interaction between sortbanner() and
|
||||||
|
MSF-type reminders. Bug found by Tim Chase.
|
||||||
|
|
||||||
|
- BUG FIX: examples/defs.rem: Fix the calculation of US Tax Day as per
|
||||||
|
Tavis Ormandy and Tim Chase. Also fixed in include/holidays/us.rem
|
||||||
|
|
||||||
|
- BUG FIX: Remind: Add missing #include <fcntl.h> to funcs.c
|
||||||
|
|
||||||
|
- BUG FIX: Remind: Fix undefined integer-overflow behavior in built-in abs()
|
||||||
|
function. Pointed out on IRC by "ubitux".
|
||||||
|
|
||||||
* VERSION 4.2 Patch 2 - 2023-01-01
|
* VERSION 4.2 Patch 2 - 2023-01-01
|
||||||
|
|
||||||
- NEW FEATURE: Remind: Add the NOQUEUE modifier to the REM statement for
|
- NEW FEATURE: Remind: Add the NOQUEUE modifier to the REM statement for
|
||||||
|
|||||||
@@ -157,7 +157,24 @@ REM Last Sunday in October ++2 UNTIL 1 Jan 2007 MSG Daylight Saving Time - %"DST
|
|||||||
REM First Sunday in November ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
|
REM First Sunday in November ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
|
||||||
|
|
||||||
REM Apr 1 MSG %"April Fool's%" Day
|
REM Apr 1 MSG %"April Fool's%" Day
|
||||||
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
|
|
||||||
|
# US Tax Day
|
||||||
|
PUSH-OMIT-CONTEXT
|
||||||
|
# Normal case: 16 April falls Mon-Fri
|
||||||
|
REM 16 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw >= 1 && $Tw <= 5] MSG Emancipation Day
|
||||||
|
|
||||||
|
# 16 April falls on Saturday: Observe on the 15th
|
||||||
|
REM 15 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Emancipation Day (observed)
|
||||||
|
|
||||||
|
# 16 April falls on Sunday: Observe on the 17th
|
||||||
|
REM 17 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Emancipation Day (observed)
|
||||||
|
|
||||||
|
# If you live in Maine or Massachussetts, uncomment the next line
|
||||||
|
# REM Third Monday in April SCANFROM -7 ADDOMIT MSG Patriots Day
|
||||||
|
|
||||||
|
REM Apr 15 OMIT Sat Sun AFTER MSG Tax Day
|
||||||
|
POP-OMIT-CONTEXT
|
||||||
|
|
||||||
REM May 5 MSG %"Cinco de Mayo%"
|
REM May 5 MSG %"Cinco de Mayo%"
|
||||||
REM First Sat in May MSG %"Kentucky Derby%"
|
REM First Sat in May MSG %"Kentucky Derby%"
|
||||||
REM Second Sun in May MSG %"Mother's Day%"
|
REM Second Sun in May MSG %"Mother's Day%"
|
||||||
|
|||||||
39
include/holidays/gr.rem
Normal file
39
include/holidays/gr.rem
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Greek national holidays
|
||||||
|
# ΑΡΓΙΕΣ (για όλους)
|
||||||
|
|
||||||
|
# fixed
|
||||||
|
REM 1 Jan MSG ΠΡΩΤΟΧΡΟΝΙΑ
|
||||||
|
REM 6 Jan MSG ΤΑ ΦΩΤΑ/ ΘΕΟΦΑΝΕΙΑ
|
||||||
|
REM 25 Mar MSG η 25η Μαρτίου
|
||||||
|
REM 15 Aug MSG 15Αύγουστος
|
||||||
|
REM 28 Oct MSG ΟΧΙ
|
||||||
|
REM 25 Dec MSG ΧΡΙΣΤΟΥΓΕΝΝΑ
|
||||||
|
REM 26 Dec MSG ΧΡΙΣΤΟΥΓΕΝΝΑ2
|
||||||
|
|
||||||
|
REM [orthodoxeaster($Uy)+1] ΔΕΥΤΕΡΑ ΤΟΥ ΠΑΣΧΑ
|
||||||
|
|
||||||
|
|
||||||
|
# May first is a national holiday except if Sunday, day of great week (week before easter) or Monday after easter, then
|
||||||
|
# minister decides moving that holiday. Here is a likely assumption of how this day might be moved.
|
||||||
|
# Uncomment following lines to enable.
|
||||||
|
|
||||||
|
set PM date($Uy,5,1)
|
||||||
|
# IF PM>=orthodoxeaster($Uy)-7 && PM<=orthodoxeaster($Uy)+1
|
||||||
|
# IF PM<orthodoxeaster($Uy)-3
|
||||||
|
# REM orthodoxeaster($Uy) -8 MSG πιθανόν ΕΡΓΑΤΙΚΗ Πρωτομαγιά
|
||||||
|
# ELSE
|
||||||
|
# REM [plusfunc(2)] MSG πιθανόν ΕΡΓΑΤΙΚΗ Πρωτομαγιά
|
||||||
|
# ENDIF
|
||||||
|
# ENDIF
|
||||||
|
# REM [PM] OMIT Sun AFTER MSG Πρωτομαγιά
|
||||||
|
|
||||||
|
REM 1 May MSG Πρωτομαγιά
|
||||||
|
# end of May 1 speculations
|
||||||
|
|
||||||
|
# The following are main national holidays per custom (observed by most but not all)
|
||||||
|
REM [orthodoxeaster($Uy)] -48 MSG Καθαρά Δευτέρα
|
||||||
|
REM [orthodoxeaster($Uy)] -2 MSG Μεγάλη Παρασκευή
|
||||||
|
REM [orthodoxeaster($Uy)] -1 MSG Μεγάλο Σάββατο
|
||||||
|
REM [orthodoxeaster($Uy)+50] MSG Αγίου Πνεύματος
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +25,23 @@ REM MAYBE-UNCOMPUTABLE Sun November SATISFY [isdst($T) != isdst($T+1)] MSG Dayli
|
|||||||
REM MAYBE-UNCOMPUTABLE Sun March SATISFY [isdst($T) != isdst($T+1)] MSG Daylight Saving Time Starts
|
REM MAYBE-UNCOMPUTABLE Sun March SATISFY [isdst($T) != isdst($T+1)] MSG Daylight Saving Time Starts
|
||||||
|
|
||||||
REM Apr 1 MSG %"April Fool's%" Day
|
REM Apr 1 MSG %"April Fool's%" Day
|
||||||
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
|
|
||||||
|
PUSH-OMIT-CONTEXT
|
||||||
|
# Normal case: 16 April falls Mon-Fri
|
||||||
|
REM 16 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw >= 1 && $Tw <= 5] MSG Emancipation Day
|
||||||
|
|
||||||
|
# 16 April falls on Saturday: Observe on the 15th
|
||||||
|
REM 15 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Emancipation Day (observed)
|
||||||
|
|
||||||
|
# 16 April falls on Sunday: Observe on the 17th
|
||||||
|
REM 17 Apr SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Emancipation Day (observed)
|
||||||
|
|
||||||
|
# If you live in Maine or Massachussetts, uncomment the next line
|
||||||
|
# REM Third Monday in April SCANFROM -7 ADDOMIT MSG Patriots Day
|
||||||
|
|
||||||
|
REM Apr 15 OMIT Sat Sun AFTER MSG %"Income tax%" due
|
||||||
|
POP-OMIT-CONTEXT
|
||||||
|
|
||||||
REM May 5 MSG Cinco de Mayo
|
REM May 5 MSG Cinco de Mayo
|
||||||
REM First Sat in May MSG Kentucky Derby
|
REM First Sat in May MSG Kentucky Derby
|
||||||
REM Second Sun in May MSG Mother's Day
|
REM Second Sun in May MSG Mother's Day
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
SET autolang getenv("LC_ALL")
|
SET autolang getenv("REMIND_LANG")
|
||||||
|
|
||||||
|
IF autolang == ""
|
||||||
|
SET autolang getenv("LC_ALL")
|
||||||
|
ENDIF
|
||||||
IF autolang == ""
|
IF autolang == ""
|
||||||
SET autolang getenv("LANGUAGE")
|
SET autolang getenv("LANGUAGE")
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|||||||
83
include/lang/gr.rem
Normal file
83
include/lang/gr.rem
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Support for the Hellenic (Greek) language.
|
||||||
|
# This file is part of REMIND.
|
||||||
|
# REMIND is Copyright (C) 1992-2023 by Dianne Skoll
|
||||||
|
# This file is derived from a translation by jarlaxl lamat (jarlaxl@freemail.gr)
|
||||||
|
|
||||||
|
SET $Sunday "Κυριακή"
|
||||||
|
SET $Monday "Δευτέρα"
|
||||||
|
SET $Tuesday "Τρίτη"
|
||||||
|
SET $Wednesday "Τετάρτη"
|
||||||
|
SET $Thursday "Πέμπτη"
|
||||||
|
SET $Friday "Παρασκευή"
|
||||||
|
SET $Saturday "Σάββατο"
|
||||||
|
|
||||||
|
SET $January "Ιανουάρ."
|
||||||
|
SET $February "Φεβρουάρ."
|
||||||
|
SET $March "Μάρτ."
|
||||||
|
SET $April "Απρίλ."
|
||||||
|
SET $May "Μαι."
|
||||||
|
SET $June "Ιούν."
|
||||||
|
SET $July "Ιούλ."
|
||||||
|
SET $August "Αυγουστ."
|
||||||
|
SET $September "Σεπτέμβρ."
|
||||||
|
SET $October "Οκτώβρ."
|
||||||
|
SET $November "Νοέμβρ."
|
||||||
|
SET $December "Δεκέμβρ."
|
||||||
|
|
||||||
|
SET $Today "σήμερα"
|
||||||
|
SET $Tomorrow "αύριο"
|
||||||
|
|
||||||
|
BANNER Υπενθυμίσεις: %w, %d %m, %y%o:
|
||||||
|
|
||||||
|
SET $Am "πμ"
|
||||||
|
SET $Pm "μμ"
|
||||||
|
|
||||||
|
SET $Ago "πριν"
|
||||||
|
SET $Fromnow "από τώρα"
|
||||||
|
|
||||||
|
SET $On "την"
|
||||||
|
|
||||||
|
SET $Now "τώρα"
|
||||||
|
SET $At "στις"
|
||||||
|
SET $Minute "λεπτά"
|
||||||
|
SET $Hour "ώρες"
|
||||||
|
SET $Is "είναι"
|
||||||
|
SET $Was "ήταν"
|
||||||
|
SET $And "και"
|
||||||
|
SET $Hplu ""
|
||||||
|
SET $Mplu ""
|
||||||
|
|
||||||
|
FSET subst_bx(a, d, t) "σε " + (d - today()) + " ημέρες"
|
||||||
|
FSET subst_ordinal(d) "."
|
||||||
|
FSET subst_a_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d) + " " + year(d)
|
||||||
|
FSET subst_ax(alt, d, t) iif(alt, subst_a_alt(d), $On + " " + subst_a_alt(d))
|
||||||
|
FSET subst_g_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d)
|
||||||
|
FSET subst_gx(alt, d, t) iif(alt, subst_g_alt(d), $On + " " + subst_g_alt(d))
|
||||||
|
FSET subst_ux(alt, d, t) subst_ax(alt, d, t)
|
||||||
|
FSET subst_vx(alt, d, t) subst_gx(alt, d, t)
|
||||||
|
|
||||||
|
# Localization of various astronomical events
|
||||||
|
|
||||||
|
# Perihelion
|
||||||
|
SET earthseasons_Perihelion_str "Περιήλιον"
|
||||||
|
|
||||||
|
# Vernal equinox
|
||||||
|
SET earthseasons_EquinoxMar_str "Εαρινή ισημερία"
|
||||||
|
|
||||||
|
# Summer solstice
|
||||||
|
SET earthseasons_SolsticeJun_str "Θερινό ηλιοστάσιο"
|
||||||
|
|
||||||
|
# Aphelion
|
||||||
|
SET earthseasons_Aphelion_str "Αφήλιον"
|
||||||
|
|
||||||
|
# Autumnal Equinox
|
||||||
|
SET earthseasons_EquinoxSep_str "Φθινοπωρινή ισημερία"
|
||||||
|
|
||||||
|
# Winter Solstice
|
||||||
|
SET earthseasons_SolsticeDec_str "Χειμερινό ηλιοστάσιο"
|
||||||
|
|
||||||
|
# Daylight saving time starts
|
||||||
|
SET daylightST_starts_str "Έναρξη θέρους"
|
||||||
|
|
||||||
|
# Daylight saving time ends
|
||||||
|
SET daylightST_ends_str "Τέλος θέρους"
|
||||||
@@ -1215,11 +1215,25 @@ specifies the duration of an event. For example, if you have a
|
|||||||
REM 5 March 2021 AT 1:00pm DURATION 90 MSG Meeting
|
REM 5 March 2021 AT 1:00pm DURATION 90 MSG Meeting
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
For long-duration reminders, it is convenient to use expressions
|
||||||
Note that \fIduration\fR is specified either in hours and minutes as a
|
to simplify writing the DURATION. For example, if you are away
|
||||||
\fItime\fR, or in minutes as an \fIinteger\fR. If you specify a
|
from 20 Feb 2023 through 23 Feb 2023 (a total of 4 days) you
|
||||||
duration of 00:00 or 0, then \fBRemind\fR behaves exactly as if no
|
could write:
|
||||||
\fBDURATION\fR at all had been present.
|
.PP
|
||||||
|
.nf
|
||||||
|
REM 20 Feb AT 00:00 DURATION [4*24]:00 MSG away
|
||||||
|
REM 20 Feb AT 00:00 DURATION [4*24*60] MSG away
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
Note that \fIduration\fR is specified either as
|
||||||
|
\fIhours\fR:\fIminutes\fR or just as \fIminutes\fR specified as an
|
||||||
|
\fIinteger\fR.
|
||||||
|
.PP
|
||||||
|
If you specify a duration of 00:00 or 0, then \fBRemind\fR behaves
|
||||||
|
exactly as if no \fBDURATION\fR at all had been present. Although
|
||||||
|
durations specified as \fIhours\fR:\fIminutes\fR look superficially like a
|
||||||
|
time-of-day, they are not; the \fIhours\fR component is not limited
|
||||||
|
to the range 00-23.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
.SH SYNTACTIC SUGAR FOR REM
|
.SH SYNTACTIC SUGAR FOR REM
|
||||||
@@ -1961,9 +1975,23 @@ somewhat comparable to a C character array, but more closely resembles
|
|||||||
the string type in BASIC.
|
the string type in BASIC.
|
||||||
.TP
|
.TP
|
||||||
.B TIME
|
.B TIME
|
||||||
The \fBTIME\fR data type consists of times of the day. The \fBTIME\fR
|
The \fBTIME\fR data type is used for two different purposes: To represent
|
||||||
data type is internally stored as an integer representing the number
|
a time of day with one-minute precision or to represent a duration
|
||||||
of minutes since midnight.
|
with one-minute precision. The context of where a \fBTIME\fR is used
|
||||||
|
determines whether it is interpreted as a time of day or a duration.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
In contexts where a \fBTIME\fR represents a time of day, it may range
|
||||||
|
from 00:00 to 23:59 and is stored internally as an integer from 0 to
|
||||||
|
1439 representing the number of minutes since midnight.
|
||||||
|
.PP
|
||||||
|
In contexts where a \fBTIME\fR represents a duration, there is no
|
||||||
|
upper limit on the hour component (beyond that imposed by the
|
||||||
|
restriction that a duration expressed in minutes must fit into the
|
||||||
|
signed integer type of your CPU architecture.) Internally, a duration
|
||||||
|
is stored as an integer number of minutes.
|
||||||
|
.RE
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B DATE
|
.B DATE
|
||||||
The \fBDATE\fR data type consists of dates (later than 1 January 1990.)
|
The \fBDATE\fR data type consists of dates (later than 1 January 1990.)
|
||||||
@@ -2006,6 +2034,15 @@ range from 1 to 12. Either a period or colon can be used to separate
|
|||||||
the minutes from the hours. However, Remind will consistently output
|
the minutes from the hours. However, Remind will consistently output
|
||||||
times in 24-hour format using only one separator character. (The
|
times in 24-hour format using only one separator character. (The
|
||||||
output separator character is chosen at compile-time.)
|
output separator character is chosen at compile-time.)
|
||||||
|
.PP
|
||||||
|
If the \fBTIME\fR is used where \fBRemind\fR expects a time-of-day
|
||||||
|
(for example, in an \fBAT\fR clause), then it can be written in
|
||||||
|
24-hour format (ranging from 00:00 to 23:59) or 12-hour format
|
||||||
|
(ranging from 12:00am to 11:59pm). If the \fBTIME\fR is used where
|
||||||
|
\fBRemind\fR expects a duration, it must not have an \fIam\fR or
|
||||||
|
\fIpm\fR suffix and the hour can be as large as you want, so long
|
||||||
|
as the total number of minutes in the duration fits in a signed integer
|
||||||
|
variable.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B DATE constants
|
.B DATE constants
|
||||||
@@ -2939,6 +2976,11 @@ If \fIarg\fR is an \fBINT\fR, then returns the date of Easter Sunday
|
|||||||
for the specified year. If \fIarg\fR is a \fBDATE\fR or
|
for the specified year. If \fIarg\fR is a \fBDATE\fR or
|
||||||
\fBDATETIME\fR, then returns the date of the next Easter Sunday on or
|
\fBDATETIME\fR, then returns the date of the next Easter Sunday on or
|
||||||
after \fIarg\fR. (The time component of a datetime is ignored.)
|
after \fIarg\fR. (The time component of a datetime is ignored.)
|
||||||
|
.RS
|
||||||
|
.P
|
||||||
|
Note that \fBeasterdate\fR computes the Western Easter. For the Orthodox
|
||||||
|
Easter date, see \fBorthodoxeaster\fR.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B evaltrig(s_trigger [,dq_start])
|
.B evaltrig(s_trigger [,dq_start])
|
||||||
Evaluates \fItrigger\fR as if it were a REM or IFTRIG trigger specification
|
Evaluates \fItrigger\fR as if it were a REM or IFTRIG trigger specification
|
||||||
@@ -3261,6 +3303,17 @@ the actual time, or a time supplied on the command line.
|
|||||||
Returns a string that is the ordinal number \fInum\fR. For example,
|
Returns a string that is the ordinal number \fInum\fR. For example,
|
||||||
\fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
|
\fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
|
||||||
.TP
|
.TP
|
||||||
|
.B orthodoxeaster(dqi_arg)
|
||||||
|
If \fIarg\fR is an \fBINT\fR, then returns the date of Orthodox Easter Sunday
|
||||||
|
for the specified year. If \fIarg\fR is a \fBDATE\fR or
|
||||||
|
\fBDATETIME\fR, then returns the date of the next Orthodox Easter Sunday on or
|
||||||
|
after \fIarg\fR. (The time component of a datetime is ignored.)
|
||||||
|
.RS
|
||||||
|
.P
|
||||||
|
Note that \fBorthodoxeaster\fR computes the Orthodox Easter. For the Western
|
||||||
|
Easter date, see \fBeasterdate\fR.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
.B ostype()
|
.B ostype()
|
||||||
Returns "UNIX". Remind used to run on OS/2 and MS-DOS, but does not
|
Returns "UNIX". Remind used to run on OS/2 and MS-DOS, but does not
|
||||||
any longer.
|
any longer.
|
||||||
|
|||||||
@@ -687,7 +687,7 @@ if ($Options{help}) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-t STDIN) {
|
if (-t STDIN) { ## no critic
|
||||||
print STDERR "$TIDY_PROGNAME: Input should not come from a terminal.\n\n";
|
print STDERR "$TIDY_PROGNAME: Input should not come from a terminal.\n\n";
|
||||||
usage(1);
|
usage(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ if ($settings->{landscape}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Don't read from a terminal
|
# Don't read from a terminal
|
||||||
if (-t STDIN) {
|
if (-t STDIN) { ## no critic
|
||||||
print STDERR "I can't read data from a terminal. Please run like this:\n";
|
print STDERR "I can't read data from a terminal. Please run like this:\n";
|
||||||
print STDERR " remind -pp [options] filename | $me [options] > out.pdf\n";
|
print STDERR " remind -pp [options] filename | $me [options] > out.pdf\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -249,20 +249,21 @@ sub set_media
|
|||||||
sub set_media_from_file
|
sub set_media_from_file
|
||||||
{
|
{
|
||||||
my ($fn) = @_;
|
my ($fn) = @_;
|
||||||
if (!open(IN, '<', $fn)) {
|
my $IN;
|
||||||
|
if (!open($IN, '<', $fn)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
while(<IN>) {
|
while(<$IN>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/^\s+//;
|
s/^\s+//;
|
||||||
s/\s+$//;
|
s/\s+$//;
|
||||||
next if ($_ eq '');
|
next if ($_ eq '');
|
||||||
next if ($_ =~ /^#/);
|
next if ($_ =~ /^#/);
|
||||||
my $m = $_;
|
my $m = $_;
|
||||||
close(IN);
|
close($IN);
|
||||||
return set_media($m);
|
return set_media($m);
|
||||||
}
|
}
|
||||||
close(IN);
|
close($IN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ sub read_one_month
|
|||||||
$line = $in->getline();
|
$line = $in->getline();
|
||||||
chomp($line);
|
chomp($line);
|
||||||
if ($line =~ /^\S+ \S+ \S+ \S+ \S+ \S+ \S+$/) {
|
if ($line =~ /^\S+ \S+ \S+ \S+ \S+ \S+ \S+$/) {
|
||||||
@{$self->{daynames}} = map { s/_/ /g; $_; } (split(/ /, $line));
|
@{$self->{daynames}} = map { s/_/ /g; $_; } (split(/ /, $line)); ## no critic
|
||||||
} else {
|
} else {
|
||||||
return (undef, "Cannot interpret line: $line");
|
return (undef, "Cannot interpret line: $line");
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ hash keys found in the newer "remind -pp" JSON output.
|
|||||||
sub parse_oldstyle_line
|
sub parse_oldstyle_line
|
||||||
{
|
{
|
||||||
my ($self, $line) = @_;
|
my ($self, $line) = @_;
|
||||||
return undef unless $line =~ m|^(\d+)/(\d+)/(\d+) (\S+) (\S+) (\S+) (\S+) (.*)$|;
|
return unless $line =~ m|^(\d+)/(\d+)/(\d+) (\S+) (\S+) (\S+) (\S+) (.*)$|;
|
||||||
|
|
||||||
my $hash = {
|
my $hash = {
|
||||||
date => "$1-$2-$3",
|
date => "$1-$2-$3",
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ install-stripped: install
|
|||||||
clean:
|
clean:
|
||||||
rm -f *.o *~ core *.bak $(PROGS)
|
rm -f *.o *~ core *.bak $(PROGS)
|
||||||
|
|
||||||
|
cppcheck:
|
||||||
|
cppcheck --force --enable=all --suppress=variableScope --suppress=ConfigurationNotChecked *.c
|
||||||
|
|
||||||
clobber:
|
clobber:
|
||||||
rm -f *.o *~ remind rem2ps test.out core *.bak
|
rm -f *.o *~ remind rem2ps test.out core *.bak
|
||||||
|
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ get_month_abbrev(char const *mon)
|
|||||||
return buf;
|
return buf;
|
||||||
#else
|
#else
|
||||||
char *s;
|
char *s;
|
||||||
wchar_t tmp_buf[128];
|
wchar_t tmp_buf[128] = {0};
|
||||||
wchar_t *ws;
|
wchar_t *ws;
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
@@ -621,7 +621,6 @@ Colorize256(int r, int g, int b, int bg, int clamp)
|
|||||||
best = (int) i;
|
best = (int) i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur = &XTerm256Colors[best];
|
|
||||||
if (bg) {
|
if (bg) {
|
||||||
sprintf(buf, "\x1B[48;5;%dm", best);
|
sprintf(buf, "\x1B[48;5;%dm", best);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
912
src/dosubst.c
912
src/dosubst.c
@@ -363,464 +363,464 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
|||||||
Eprint("%s", ErrMsg[r]);
|
Eprint("%s", ErrMsg[r]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch(UPPER(c)) {
|
||||||
|
case 'A':
|
||||||
|
#ifdef L_A_OVER
|
||||||
|
L_A_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s, %d %s, %d", get_day_name(dse%7), d,
|
||||||
|
get_month_name(m), y);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s, %d %s, %d", DynamicOn, get_day_name(dse%7), d,
|
||||||
|
get_month_name(m), y);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
#ifdef L_B_OVER
|
||||||
|
L_B_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), L_INXDAYS, diff);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
#ifdef L_C_OVER
|
||||||
|
L_C_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s", get_day_name(dse%7));
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s", DynamicOn, get_day_name(dse%7));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
#ifdef L_D_OVER
|
||||||
|
L_D_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", d);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'E':
|
||||||
|
#ifdef L_E_OVER
|
||||||
|
L_E_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%02d%c%02d%c%04d", d, DateSep,
|
||||||
|
m+1, DateSep, y);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %02d%c%02d%c%04d", DynamicOn, d, DateSep,
|
||||||
|
m+1, DateSep, y);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
#ifdef L_F_OVER
|
||||||
|
L_F_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %02d%c%02d%c%04d", DynamicOn, m+1, DateSep, d, DateSep, y);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'G':
|
||||||
|
#ifdef L_G_OVER
|
||||||
|
L_G_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s, %d %s", get_day_name(dse%7), d, get_month_name(m));
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s, %d %s", DynamicOn, get_day_name(dse%7), d, get_month_name(m));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'H':
|
||||||
|
#ifdef L_H_OVER
|
||||||
|
L_H_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%02d%c%02d", d, DateSep, m+1);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicOn, d, DateSep, m+1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'I':
|
||||||
|
#ifdef L_I_OVER
|
||||||
|
L_I_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%02d%c%02d", m+1, DateSep, d);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicOn, m+1, DateSep, d);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'J':
|
||||||
|
#ifdef L_J_OVER
|
||||||
|
L_J_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s, %s %d%s, %d", get_day_name(dse%7),
|
||||||
|
get_month_name(m), d, plu, y);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s, %s %d%s, %d", DynamicOn, get_day_name(dse%7),
|
||||||
|
get_month_name(m), d, plu, y);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'K':
|
||||||
|
#ifdef L_K_OVER
|
||||||
|
L_K_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s, %s %d%s", get_day_name(dse%7),
|
||||||
|
get_month_name(m), d, plu);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s, %s %d%s", DynamicOn, get_day_name(dse%7),
|
||||||
|
get_month_name(m), d, plu);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'L':
|
||||||
|
#ifdef L_L_OVER
|
||||||
|
L_L_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %04d%c%02d%c%02d", DynamicOn, y, DateSep, m+1, DateSep, d);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
#ifdef L_M_OVER
|
||||||
|
L_M_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", get_month_name(m));
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'N':
|
||||||
|
#ifdef L_N_OVER
|
||||||
|
L_N_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", m+1);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'O':
|
||||||
|
#ifdef L_O_OVER
|
||||||
|
L_O_OVER
|
||||||
|
#else
|
||||||
|
if (RealToday == DSEToday) snprintf(s, sizeof(s), " (%s)", DynamicToday);
|
||||||
|
else *s = 0;
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
#ifdef L_P_OVER
|
||||||
|
L_P_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", (diff == 1 ? "" : L_PLURAL));
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Q':
|
||||||
|
#ifdef L_Q_OVER
|
||||||
|
L_Q_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", (diff == 1 ? "'s" : "s'"));
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'R':
|
||||||
|
#ifdef L_R_OVER
|
||||||
|
L_R_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%02d", d);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S':
|
||||||
|
#ifdef L_S_OVER
|
||||||
|
L_S_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", plu);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'T':
|
||||||
|
#ifdef L_T_OVER
|
||||||
|
L_T_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%02d", m+1);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'U':
|
||||||
|
#ifdef L_U_OVER
|
||||||
|
L_U_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s, %d%s %s, %d", get_day_name(dse%7), d,
|
||||||
|
plu, get_month_name(m), y);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s, %d%s %s, %d", DynamicOn, get_day_name(dse%7), d,
|
||||||
|
plu, get_month_name(m), y);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'V':
|
||||||
|
#ifdef L_V_OVER
|
||||||
|
L_V_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
||||||
|
snprintf(s, sizeof(s), "%s, %d%s %s", get_day_name(dse%7), d, plu,
|
||||||
|
get_month_name(m));
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %s, %d%s %s", DynamicOn, get_day_name(dse%7), d, plu,
|
||||||
|
get_month_name(m));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'W':
|
||||||
|
#ifdef L_W_OVER
|
||||||
|
L_W_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", get_day_name(dse%7));
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'X':
|
||||||
|
#ifdef L_X_OVER
|
||||||
|
L_X_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", diff);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Y':
|
||||||
|
#ifdef L_Y_OVER
|
||||||
|
L_Y_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", y);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Z':
|
||||||
|
#ifdef L_Z_OVER
|
||||||
|
L_Z_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", y % 100);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '1':
|
||||||
|
#ifdef L_1_OVER
|
||||||
|
L_1_OVER
|
||||||
|
#else
|
||||||
|
if (tdiff == 0)
|
||||||
|
snprintf(s, sizeof(s), "%s", DynamicNow);
|
||||||
|
else if (hdiff == 0)
|
||||||
|
snprintf(s, sizeof(s), "%d %s%s %s", mdiff, DynamicMinute, mplu, when);
|
||||||
|
else if (mdiff == 0)
|
||||||
|
snprintf(s, sizeof(s), "%d %s%s %s", hdiff, DynamicHour, hplu, when);
|
||||||
|
else
|
||||||
|
snprintf(s, sizeof(s), "%d %s%s %s %d %s%s %s", hdiff, DynamicHour, hplu,
|
||||||
|
DynamicAnd, mdiff, DynamicMinute, mplu, when);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '2':
|
||||||
|
#ifdef L_2_OVER
|
||||||
|
L_2_OVER
|
||||||
|
#else
|
||||||
|
if (altmode == '*') {
|
||||||
|
snprintf(s, sizeof(s), "%d%c%02d%s", hh, TimeSep, min, pm);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %d%c%02d%s", DynamicAt, hh, TimeSep, min, pm);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '3':
|
||||||
|
#ifdef L_3_OVER
|
||||||
|
L_3_OVER
|
||||||
|
#else
|
||||||
|
|
||||||
|
if (altmode == '*') {
|
||||||
|
snprintf(s, sizeof(s), "%02d%c%02d", h, TimeSep, min);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicAt, h, TimeSep, min);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '4':
|
||||||
|
#ifdef L_4_OVER
|
||||||
|
L_4_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", tdiff);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '5':
|
||||||
|
#ifdef L_5_OVER
|
||||||
|
L_5_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", adiff);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '6':
|
||||||
|
#ifdef L_6_OVER
|
||||||
|
L_6_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", when);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '7':
|
||||||
|
#ifdef L_7_OVER
|
||||||
|
L_7_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", hdiff);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '8':
|
||||||
|
#ifdef L_8_OVER
|
||||||
|
L_8_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d", mdiff);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '9':
|
||||||
|
#ifdef L_9_OVER
|
||||||
|
L_9_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", mplu);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '0':
|
||||||
|
#ifdef L_0_OVER
|
||||||
|
L_0_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", hplu);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '!':
|
||||||
|
#ifdef L_BANG_OVER
|
||||||
|
L_BANG_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? DynamicIs : DynamicWas));
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '@':
|
||||||
|
#ifdef L_AT_OVER
|
||||||
|
L_AT_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%d%c%02d%s", chh, TimeSep, cmin, cpm);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '#':
|
||||||
|
#ifdef L_HASH_OVER
|
||||||
|
L_HASH_OVER
|
||||||
|
#else
|
||||||
|
snprintf(s, sizeof(s), "%02d%c%02d", ch, TimeSep, cmin);
|
||||||
|
#endif
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '_':
|
||||||
|
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)) {
|
||||||
|
snprintf(s, sizeof(s), "%s", NL);
|
||||||
|
} else {
|
||||||
|
snprintf(s, sizeof(s), " ");
|
||||||
|
}
|
||||||
|
SHIP_OUT(s);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QUOTE_MARKER:
|
||||||
|
/* Swallow any QUOTE_MARKERs which may somehow creep in... */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
if (DontSuppressQuoteMarkers) {
|
||||||
|
if (DBufPutc(dbuf, '%') != OK) return E_NO_MEM;
|
||||||
|
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
||||||
|
} else {
|
||||||
|
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
|
||||||
|
has_quote = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done) switch(UPPER(c)) {
|
|
||||||
case 'A':
|
|
||||||
#ifdef L_A_OVER
|
|
||||||
L_A_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s, %d %s, %d", get_day_name(dse%7), d,
|
|
||||||
get_month_name(m), y);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s, %d %s, %d", DynamicOn, get_day_name(dse%7), d,
|
|
||||||
get_month_name(m), y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'B':
|
|
||||||
#ifdef L_B_OVER
|
|
||||||
L_B_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), L_INXDAYS, diff);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'C':
|
|
||||||
#ifdef L_C_OVER
|
|
||||||
L_C_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s", get_day_name(dse%7));
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s", DynamicOn, get_day_name(dse%7));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'D':
|
|
||||||
#ifdef L_D_OVER
|
|
||||||
L_D_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", d);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'E':
|
|
||||||
#ifdef L_E_OVER
|
|
||||||
L_E_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%02d%c%02d%c%04d", d, DateSep,
|
|
||||||
m+1, DateSep, y);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %02d%c%02d%c%04d", DynamicOn, d, DateSep,
|
|
||||||
m+1, DateSep, y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'F':
|
|
||||||
#ifdef L_F_OVER
|
|
||||||
L_F_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %02d%c%02d%c%04d", DynamicOn, m+1, DateSep, d, DateSep, y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'G':
|
|
||||||
#ifdef L_G_OVER
|
|
||||||
L_G_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s, %d %s", get_day_name(dse%7), d, get_month_name(m));
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s, %d %s", DynamicOn, get_day_name(dse%7), d, get_month_name(m));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'H':
|
|
||||||
#ifdef L_H_OVER
|
|
||||||
L_H_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%02d%c%02d", d, DateSep, m+1);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicOn, d, DateSep, m+1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'I':
|
|
||||||
#ifdef L_I_OVER
|
|
||||||
L_I_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%02d%c%02d", m+1, DateSep, d);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicOn, m+1, DateSep, d);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'J':
|
|
||||||
#ifdef L_J_OVER
|
|
||||||
L_J_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s, %s %d%s, %d", get_day_name(dse%7),
|
|
||||||
get_month_name(m), d, plu, y);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s, %s %d%s, %d", DynamicOn, get_day_name(dse%7),
|
|
||||||
get_month_name(m), d, plu, y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'K':
|
|
||||||
#ifdef L_K_OVER
|
|
||||||
L_K_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s, %s %d%s", get_day_name(dse%7),
|
|
||||||
get_month_name(m), d, plu);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s, %s %d%s", DynamicOn, get_day_name(dse%7),
|
|
||||||
get_month_name(m), d, plu);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'L':
|
|
||||||
#ifdef L_L_OVER
|
|
||||||
L_L_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %04d%c%02d%c%02d", DynamicOn, y, DateSep, m+1, DateSep, d);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'M':
|
|
||||||
#ifdef L_M_OVER
|
|
||||||
L_M_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", get_month_name(m));
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'N':
|
|
||||||
#ifdef L_N_OVER
|
|
||||||
L_N_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", m+1);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'O':
|
|
||||||
#ifdef L_O_OVER
|
|
||||||
L_O_OVER
|
|
||||||
#else
|
|
||||||
if (RealToday == DSEToday) snprintf(s, sizeof(s), " (%s)", DynamicToday);
|
|
||||||
else *s = 0;
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'P':
|
|
||||||
#ifdef L_P_OVER
|
|
||||||
L_P_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", (diff == 1 ? "" : L_PLURAL));
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'Q':
|
|
||||||
#ifdef L_Q_OVER
|
|
||||||
L_Q_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", (diff == 1 ? "'s" : "s'"));
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'R':
|
|
||||||
#ifdef L_R_OVER
|
|
||||||
L_R_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%02d", d);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'S':
|
|
||||||
#ifdef L_S_OVER
|
|
||||||
L_S_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", plu);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'T':
|
|
||||||
#ifdef L_T_OVER
|
|
||||||
L_T_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%02d", m+1);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'U':
|
|
||||||
#ifdef L_U_OVER
|
|
||||||
L_U_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s, %d%s %s, %d", get_day_name(dse%7), d,
|
|
||||||
plu, get_month_name(m), y);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s, %d%s %s, %d", DynamicOn, get_day_name(dse%7), d,
|
|
||||||
plu, get_month_name(m), y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'V':
|
|
||||||
#ifdef L_V_OVER
|
|
||||||
L_V_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*' || !strcmp(DynamicOn, "")) {
|
|
||||||
snprintf(s, sizeof(s), "%s, %d%s %s", get_day_name(dse%7), d, plu,
|
|
||||||
get_month_name(m));
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %s, %d%s %s", DynamicOn, get_day_name(dse%7), d, plu,
|
|
||||||
get_month_name(m));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'W':
|
|
||||||
#ifdef L_W_OVER
|
|
||||||
L_W_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", get_day_name(dse%7));
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'X':
|
|
||||||
#ifdef L_X_OVER
|
|
||||||
L_X_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", diff);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'Y':
|
|
||||||
#ifdef L_Y_OVER
|
|
||||||
L_Y_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", y);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'Z':
|
|
||||||
#ifdef L_Z_OVER
|
|
||||||
L_Z_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", y % 100);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '1':
|
|
||||||
#ifdef L_1_OVER
|
|
||||||
L_1_OVER
|
|
||||||
#else
|
|
||||||
if (tdiff == 0)
|
|
||||||
snprintf(s, sizeof(s), "%s", DynamicNow);
|
|
||||||
else if (hdiff == 0)
|
|
||||||
snprintf(s, sizeof(s), "%d %s%s %s", mdiff, DynamicMinute, mplu, when);
|
|
||||||
else if (mdiff == 0)
|
|
||||||
snprintf(s, sizeof(s), "%d %s%s %s", hdiff, DynamicHour, hplu, when);
|
|
||||||
else
|
|
||||||
snprintf(s, sizeof(s), "%d %s%s %s %d %s%s %s", hdiff, DynamicHour, hplu,
|
|
||||||
DynamicAnd, mdiff, DynamicMinute, mplu, when);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '2':
|
|
||||||
#ifdef L_2_OVER
|
|
||||||
L_2_OVER
|
|
||||||
#else
|
|
||||||
if (altmode == '*') {
|
|
||||||
snprintf(s, sizeof(s), "%d%c%02d%s", hh, TimeSep, min, pm);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %d%c%02d%s", DynamicAt, hh, TimeSep, min, pm);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '3':
|
|
||||||
#ifdef L_3_OVER
|
|
||||||
L_3_OVER
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (altmode == '*') {
|
|
||||||
snprintf(s, sizeof(s), "%02d%c%02d", h, TimeSep, min);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicAt, h, TimeSep, min);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '4':
|
|
||||||
#ifdef L_4_OVER
|
|
||||||
L_4_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", tdiff);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '5':
|
|
||||||
#ifdef L_5_OVER
|
|
||||||
L_5_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", adiff);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '6':
|
|
||||||
#ifdef L_6_OVER
|
|
||||||
L_6_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", when);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '7':
|
|
||||||
#ifdef L_7_OVER
|
|
||||||
L_7_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", hdiff);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '8':
|
|
||||||
#ifdef L_8_OVER
|
|
||||||
L_8_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d", mdiff);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '9':
|
|
||||||
#ifdef L_9_OVER
|
|
||||||
L_9_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", mplu);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '0':
|
|
||||||
#ifdef L_0_OVER
|
|
||||||
L_0_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", hplu);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '!':
|
|
||||||
#ifdef L_BANG_OVER
|
|
||||||
L_BANG_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? DynamicIs : DynamicWas));
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '@':
|
|
||||||
#ifdef L_AT_OVER
|
|
||||||
L_AT_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%d%c%02d%s", chh, TimeSep, cmin, cpm);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '#':
|
|
||||||
#ifdef L_HASH_OVER
|
|
||||||
L_HASH_OVER
|
|
||||||
#else
|
|
||||||
snprintf(s, sizeof(s), "%02d%c%02d", ch, TimeSep, cmin);
|
|
||||||
#endif
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '_':
|
|
||||||
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)) {
|
|
||||||
snprintf(s, sizeof(s), "%s", NL);
|
|
||||||
} else {
|
|
||||||
snprintf(s, sizeof(s), " ");
|
|
||||||
}
|
|
||||||
SHIP_OUT(s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QUOTE_MARKER:
|
|
||||||
/* Swallow any QUOTE_MARKERs which may somehow creep in... */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '"':
|
|
||||||
if (DontSuppressQuoteMarkers) {
|
|
||||||
if (DBufPutc(dbuf, '%') != OK) return E_NO_MEM;
|
|
||||||
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
|
||||||
} else {
|
|
||||||
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
|
|
||||||
has_quote = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
|
||||||
}
|
|
||||||
if (isupper(c)) {
|
if (isupper(c)) {
|
||||||
os = DBufValue(dbuf);
|
os = DBufValue(dbuf);
|
||||||
os += strlen(os) - strlen(s);
|
os += strlen(os) - strlen(s);
|
||||||
|
|||||||
@@ -376,12 +376,10 @@ int Evaluate(char const **s, Var *locals, ParsePtr p)
|
|||||||
DBufFree(&ExprBuf);
|
DBufFree(&ExprBuf);
|
||||||
r = Evaluate(s, locals, p); /* Leaves the last parsed token in ExprBuf */
|
r = Evaluate(s, locals, p); /* Leaves the last parsed token in ExprBuf */
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
r = OK;
|
if (*DBufValue(&ExprBuf) != ')') {
|
||||||
if (*DBufValue(&ExprBuf) != ')') {
|
|
||||||
DBufFree(&ExprBuf);
|
DBufFree(&ExprBuf);
|
||||||
return E_MISS_RIGHT_PAREN;
|
return E_MISS_RIGHT_PAREN;
|
||||||
}
|
}
|
||||||
if (r) return r;
|
|
||||||
} else if (*DBufValue(&ExprBuf) == '+') {
|
} else if (*DBufValue(&ExprBuf) == '+') {
|
||||||
continue; /* Ignore unary + */
|
continue; /* Ignore unary + */
|
||||||
}
|
}
|
||||||
|
|||||||
50
src/funcs.c
50
src/funcs.c
@@ -27,7 +27,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_FILE_H
|
#ifdef HAVE_SYS_FILE_H
|
||||||
@@ -124,6 +124,7 @@ static int FNDusk (func_info *);
|
|||||||
static int FNonomitted (func_info *);
|
static int FNonomitted (func_info *);
|
||||||
static int FNow (func_info *);
|
static int FNow (func_info *);
|
||||||
static int FOrd (func_info *);
|
static int FOrd (func_info *);
|
||||||
|
static int FOrthodoxeaster (func_info *);
|
||||||
static int FOstype (func_info *);
|
static int FOstype (func_info *);
|
||||||
static int FPad (func_info *);
|
static int FPad (func_info *);
|
||||||
static int FPlural (func_info *);
|
static int FPlural (func_info *);
|
||||||
@@ -288,6 +289,7 @@ BuiltinFunc Func[] = {
|
|||||||
{ "nonomitted", 2, NO_MAX, 0, FNonomitted },
|
{ "nonomitted", 2, NO_MAX, 0, FNonomitted },
|
||||||
{ "now", 0, 0, 0, FNow },
|
{ "now", 0, 0, 0, FNow },
|
||||||
{ "ord", 1, 1, 1, FOrd },
|
{ "ord", 1, 1, 1, FOrd },
|
||||||
|
{ "orthodoxeaster",1, 1, 0, FOrthodoxeaster },
|
||||||
{ "ostype", 0, 0, 1, FOstype },
|
{ "ostype", 0, 0, 1, FOstype },
|
||||||
{ "pad", 3, 4, 1, FPad },
|
{ "pad", 3, 4, 1, FPad },
|
||||||
{ "plural", 1, 3, 1, FPlural },
|
{ "plural", 1, 3, 1, FPlural },
|
||||||
@@ -912,9 +914,14 @@ static int FAbs(func_info *info)
|
|||||||
|
|
||||||
ASSERT_TYPE(0, INT_TYPE);
|
ASSERT_TYPE(0, INT_TYPE);
|
||||||
v = ARGV(0);
|
v = ARGV(0);
|
||||||
|
if (v == INT_MIN) return E_2HIGH;
|
||||||
|
|
||||||
RetVal.type = INT_TYPE;
|
RetVal.type = INT_TYPE;
|
||||||
RETVAL = (v < 0) ? (-v) : v;
|
RETVAL = (v < 0) ? (-v) : v;
|
||||||
v = RETVAL;
|
v = RETVAL;
|
||||||
|
|
||||||
|
/* The following test is probably redundant given the test
|
||||||
|
for v == INT_MIN above, but I'll leave it in just in case. */
|
||||||
if (v < 0) return E_2HIGH;
|
if (v < 0) return E_2HIGH;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -955,7 +962,7 @@ static int parse_color_helper(char const *str, int *r, int *g, int *b)
|
|||||||
static int FAnsicolor(func_info *info)
|
static int FAnsicolor(func_info *info)
|
||||||
{
|
{
|
||||||
int r=0, g=0, b=0, bg=0, clamp=1;
|
int r=0, g=0, b=0, bg=0, clamp=1;
|
||||||
int status = 0;
|
int status;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
bg = 0;
|
bg = 0;
|
||||||
clamp = 1;
|
clamp = 1;
|
||||||
@@ -2292,6 +2299,45 @@ static int FEasterdate(func_info *info)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FOrthodoxeaster - calc. Orthodox easter Sunday */
|
||||||
|
/* */
|
||||||
|
/* From Meeus, Astronomical Algorithms */
|
||||||
|
/* */
|
||||||
|
/****************************************************************/
|
||||||
|
static int FOrthodoxeaster(func_info *info)
|
||||||
|
{
|
||||||
|
int y, m, d;
|
||||||
|
int a, b, c, dd, e, f, dse;
|
||||||
|
if (ARG(0).type == INT_TYPE) {
|
||||||
|
y = ARGV(0);
|
||||||
|
if (y < BASE) return E_2LOW;
|
||||||
|
else if (y > BASE+YR_RANGE) return E_2HIGH;
|
||||||
|
} else if (HASDATE(ARG(0))) {
|
||||||
|
FromDSE(DATEPART(ARG(0)), &y, &m, &d); /* We just want the year */
|
||||||
|
} else return E_BAD_TYPE;
|
||||||
|
|
||||||
|
do {
|
||||||
|
a = y % 4;
|
||||||
|
b = y % 7;
|
||||||
|
c = y % 19;
|
||||||
|
dd = (19 * c + 15) % 30;
|
||||||
|
e = (2*a + 4*b - dd + 34) % 7;
|
||||||
|
f = dd + e + 114;
|
||||||
|
m = (f / 31) - 1;
|
||||||
|
d = (f % 31) + 1;
|
||||||
|
|
||||||
|
dse = DSE(y, m, d);
|
||||||
|
dse += JulianToGregorianOffset(y, m);
|
||||||
|
RetVal.type = DATE_TYPE;
|
||||||
|
RETVAL = dse;
|
||||||
|
y++;
|
||||||
|
} while (HASDATE(ARG(0)) && RETVAL < DATEPART(ARG(0)));
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* FIsdst and FMinsfromutc */
|
/* FIsdst and FMinsfromutc */
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ EXTERN FILE *ErrFp;
|
|||||||
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
|
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
|
||||||
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
|
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
|
||||||
|
|
||||||
#define DestroyValue(x) (void) (((x).type == STR_TYPE && (x).v.str) ? (free((x).v.str),(x).type = ERR_TYPE) : 0)
|
#define DestroyValue(x) (void) (((x).type == STR_TYPE && (x).v.str) ? (free((x).v.str),(x).v.str = NULL,(x).type = ERR_TYPE) : 0)
|
||||||
|
|
||||||
EXTERN int DSEToday;
|
EXTERN int DSEToday;
|
||||||
EXTERN int RealToday;
|
EXTERN int RealToday;
|
||||||
|
|||||||
44
src/json.c
44
src/json.c
@@ -249,7 +249,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
const json_char * end;
|
const json_char * end;
|
||||||
json_value * top, * root, * alloc = 0;
|
json_value * top, * root, * alloc = 0;
|
||||||
json_state state = { 0 };
|
json_state state = { 0 };
|
||||||
long flags = 0;
|
long flags;
|
||||||
double num_digits = 0, num_e = 0;
|
double num_digits = 0, num_e = 0;
|
||||||
double num_fraction = 0;
|
double num_fraction = 0;
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
if (flags & flag_string)
|
if (flags & flag_string)
|
||||||
{
|
{
|
||||||
if (!b)
|
if (!b)
|
||||||
{ sprintf (error, "Unexpected EOF in string (at %d:%d)", line_and_col);
|
{ sprintf (error, "Unexpected EOF in string (at %u:%u)", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
(uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
|
(uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
|
||||||
(uc_b4 = hex_value (*++ state.ptr)) == 0xFF)
|
(uc_b4 = hex_value (*++ state.ptr)) == 0xFF)
|
||||||
{
|
{
|
||||||
sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col);
|
sprintf (error, "Invalid character value `%c` (at %u:%u)", b, line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
(uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
|
(uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
|
||||||
(uc_b4 = hex_value (*++ state.ptr)) == 0xFF)
|
(uc_b4 = hex_value (*++ state.ptr)) == 0xFF)
|
||||||
{
|
{
|
||||||
sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col);
|
sprintf (error, "Invalid character value `%c` (at %u:%u)", b, line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
if (flags & flag_block_comment)
|
if (flags & flag_block_comment)
|
||||||
{
|
{
|
||||||
if (!b)
|
if (!b)
|
||||||
{ sprintf (error, "%d:%d: Unexpected EOF in block comment", line_and_col);
|
{ sprintf (error, "%u:%u: Unexpected EOF in block comment", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,12 +488,12 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
else if (b == '/')
|
else if (b == '/')
|
||||||
{
|
{
|
||||||
if (! (flags & (flag_seek_value | flag_done)) && top->type != json_object)
|
if (! (flags & (flag_seek_value | flag_done)) && top->type != json_object)
|
||||||
{ sprintf (error, "%d:%d: Comment not allowed here", line_and_col);
|
{ sprintf (error, "%u:%u: Comment not allowed here", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++ state.ptr == end)
|
if (++ state.ptr == end)
|
||||||
{ sprintf (error, "%d:%d: EOF unexpected", line_and_col);
|
{ sprintf (error, "%u:%u: EOF unexpected", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,7 +508,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf (error, "%d:%d: Unexpected `%c` in comment opening sequence", line_and_col, b);
|
sprintf (error, "%u:%u: Unexpected `%c` in comment opening sequence", line_and_col, b);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
sprintf (error, "%d:%d: Trailing garbage: `%c`",
|
sprintf (error, "%u:%u: Trailing garbage: `%c`",
|
||||||
state.cur_line, state.cur_col, b);
|
state.cur_line, state.cur_col, b);
|
||||||
|
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
@@ -545,7 +545,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
if (top && top->type == json_array)
|
if (top && top->type == json_array)
|
||||||
flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next;
|
flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next;
|
||||||
else
|
else
|
||||||
{ sprintf (error, "%d:%d: Unexpected ]", line_and_col);
|
{ sprintf (error, "%u:%u: Unexpected ]", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf (error, "%d:%d: Expected , before %c",
|
sprintf (error, "%u:%u: Expected , before %c",
|
||||||
state.cur_line, state.cur_col, b);
|
state.cur_line, state.cur_col, b);
|
||||||
|
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
@@ -576,7 +576,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf (error, "%d:%d: Expected : before %c",
|
sprintf (error, "%u:%u: Expected : before %c",
|
||||||
state.cur_line, state.cur_col, b);
|
state.cur_line, state.cur_col, b);
|
||||||
|
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
@@ -702,7 +702,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sprintf (error, "%d:%d: Unexpected %c when seeking value", line_and_col, b);
|
{ sprintf (error, "%u:%u: Unexpected %c when seeking value", line_and_col, b);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -722,7 +722,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
case '"':
|
case '"':
|
||||||
|
|
||||||
if (flags & flag_need_comma)
|
if (flags & flag_need_comma)
|
||||||
{ sprintf (error, "%d:%d: Expected , before \"", line_and_col);
|
{ sprintf (error, "%u:%u: Expected , before \"", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -747,7 +747,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
sprintf (error, "%d:%d: Unexpected `%c` in object", line_and_col, b);
|
sprintf (error, "%u:%u: Unexpected `%c` in object", line_and_col, b);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -765,7 +765,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
if (! (flags & flag_num_e))
|
if (! (flags & flag_num_e))
|
||||||
{
|
{
|
||||||
if (flags & flag_num_zero)
|
if (flags & flag_num_zero)
|
||||||
{ sprintf (error, "%d:%d: Unexpected `0` before `%c`", line_and_col, b);
|
{ sprintf (error, "%u:%u: Unexpected `0` before `%c`", line_and_col, b);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,7 +814,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
else if (b == '.' && top->type == json_integer)
|
else if (b == '.' && top->type == json_integer)
|
||||||
{
|
{
|
||||||
if (!num_digits)
|
if (!num_digits)
|
||||||
{ sprintf (error, "%d:%d: Expected digit before `.`", line_and_col);
|
{ sprintf (error, "%u:%u: Expected digit before `.`", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
if (top->type == json_double)
|
if (top->type == json_double)
|
||||||
{
|
{
|
||||||
if (!num_digits)
|
if (!num_digits)
|
||||||
{ sprintf (error, "%d:%d: Expected digit after `.`", line_and_col);
|
{ sprintf (error, "%u:%u: Expected digit after `.`", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,11 +857,11 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!num_digits)
|
if (!num_digits)
|
||||||
{ sprintf (error, "%d:%d: Expected digit after `e`", line_and_col);
|
{ sprintf (error, "%u:%u: Expected digit after `e`", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
top->u.dbl *= pow (10.0, (flags & flag_num_e_negative ? - num_e : num_e));
|
top->u.dbl *= pow (10.0, ((flags & flag_num_e_negative) ? - num_e : num_e));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & flag_num_negative)
|
if (flags & flag_num_negative)
|
||||||
@@ -942,7 +942,7 @@ json_value * json_parse_ex (json_settings * settings,
|
|||||||
|
|
||||||
e_unknown_value:
|
e_unknown_value:
|
||||||
|
|
||||||
sprintf (error, "%d:%d: Unknown value", line_and_col);
|
sprintf (error, "%u:%u: Unknown value", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
|
|
||||||
e_alloc_failure:
|
e_alloc_failure:
|
||||||
@@ -952,7 +952,7 @@ e_alloc_failure:
|
|||||||
|
|
||||||
e_overflow:
|
e_overflow:
|
||||||
|
|
||||||
sprintf (error, "%d:%d: Too long (caught overflow)", line_and_col);
|
sprintf (error, "%u:%u: Too long (caught overflow)", line_and_col);
|
||||||
goto e_failed;
|
goto e_failed;
|
||||||
|
|
||||||
e_failed:
|
e_failed:
|
||||||
|
|||||||
19
src/main.c
19
src/main.c
@@ -385,6 +385,23 @@ void FromDSE(int dse, int *y, int *m, int *d)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int JulianToGregorianOffset(int y, int m)
|
||||||
|
{
|
||||||
|
int offset = 13;
|
||||||
|
int centuries;
|
||||||
|
int four_centuries;
|
||||||
|
if (y >= 2100) {
|
||||||
|
centuries = (y - 2000) / 100;
|
||||||
|
four_centuries = (y - 2000) / 400;
|
||||||
|
offset += centuries - four_centuries;
|
||||||
|
if (!(y%100) && (y % 400)) {
|
||||||
|
if (m < 2) {
|
||||||
|
offset--; /* Offset increments in March */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ParseChar */
|
/* ParseChar */
|
||||||
@@ -1634,7 +1651,7 @@ System(char const *cmd)
|
|||||||
int r;
|
int r;
|
||||||
r = system(cmd);
|
r = system(cmd);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
r = 1;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ static double phase(double pdate,
|
|||||||
|
|
||||||
double Day, N, M, Ec, Lambdasun, ml, MM, Ev, Ae, A3, MmP,
|
double Day, N, M, Ec, Lambdasun, ml, MM, Ev, Ae, A3, MmP,
|
||||||
mEc, A4, lP, V, lPP,
|
mEc, A4, lP, V, lPP,
|
||||||
MoonAge, MoonPhase,
|
MoonAge, Phase,
|
||||||
MoonDist, MoonDFrac, MoonAng,
|
MoonDist, MoonDFrac, MoonAng,
|
||||||
F, SunDist, SunAng;
|
F, SunDist, SunAng;
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ static double phase(double pdate,
|
|||||||
MoonAge = lPP - Lambdasun;
|
MoonAge = lPP - Lambdasun;
|
||||||
|
|
||||||
/* Phase of the Moon */
|
/* Phase of the Moon */
|
||||||
MoonPhase = (1 - cos(torad(MoonAge))) / 2;
|
Phase = (1 - cos(torad(MoonAge))) / 2;
|
||||||
|
|
||||||
/* Calculate distance of moon from the centre of the Earth */
|
/* Calculate distance of moon from the centre of the Earth */
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ static double phase(double pdate,
|
|||||||
MoonDFrac = MoonDist / msmax;
|
MoonDFrac = MoonDist / msmax;
|
||||||
MoonAng = mangsiz / MoonDFrac;
|
MoonAng = mangsiz / MoonDFrac;
|
||||||
|
|
||||||
if(pphase) *pphase = MoonPhase;
|
if(pphase) *pphase = Phase;
|
||||||
if(mage) *mage = synmonth * (fixangle(MoonAge) / 360.0);
|
if(mage) *mage = synmonth * (fixangle(MoonAge) / 360.0);
|
||||||
if(dist) *dist = MoonDist;
|
if(dist) *dist = MoonDist;
|
||||||
if(angdia) *angdia = MoonAng;
|
if(angdia) *angdia = MoonAng;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ void InitRemind (int argc, char const *argv[]);
|
|||||||
void Usage (void);
|
void Usage (void);
|
||||||
int DSE (int year, int month, int day);
|
int DSE (int year, int month, int day);
|
||||||
void FromDSE (int dse, int *y, int *m, int *d);
|
void FromDSE (int dse, int *y, int *m, int *d);
|
||||||
|
int JulianToGregorianOffset(int y, int m);
|
||||||
int ParseChar (ParsePtr p, int *err, int peek);
|
int ParseChar (ParsePtr p, int *err, int peek);
|
||||||
int ParseToken (ParsePtr p, DynamicBuffer *dbuf);
|
int ParseToken (ParsePtr p, DynamicBuffer *dbuf);
|
||||||
int ParseIdentifier (ParsePtr p, DynamicBuffer *dbuf);
|
int ParseIdentifier (ParsePtr p, DynamicBuffer *dbuf);
|
||||||
@@ -97,9 +98,7 @@ void FindNumericToken (char const *s, Token *t);
|
|||||||
int ComputeTrigger (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals);
|
int ComputeTrigger (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals);
|
||||||
int ComputeTriggerNoAdjustDuration (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals, int duration_days);
|
int ComputeTriggerNoAdjustDuration (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals, int duration_days);
|
||||||
int AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals);
|
int AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals);
|
||||||
int ComputeScanStart(int today, Trigger *trig, TimeTrig *tt);
|
|
||||||
char *StrnCpy (char *dest, char const *source, int n);
|
char *StrnCpy (char *dest, char const *source, int n);
|
||||||
int StrMatch (char const *s1, char const *s2, int n);
|
|
||||||
int StrinCmp (char const *s1, char const *s2, int n);
|
int StrinCmp (char const *s1, char const *s2, int n);
|
||||||
char *StrDup (char const *s);
|
char *StrDup (char const *s);
|
||||||
int StrCmpi (char const *s1, char const *s2);
|
int StrCmpi (char const *s1, char const *s2);
|
||||||
@@ -176,7 +175,6 @@ char const *get_month_name(int mon);
|
|||||||
|
|
||||||
int push_call(char const *filename, char const *func, int lineno);
|
int push_call(char const *filename, char const *func, int lineno);
|
||||||
void clear_callstack(void);
|
void clear_callstack(void);
|
||||||
int have_callstack(void);
|
|
||||||
int print_callstack(FILE *fp);
|
int print_callstack(FILE *fp);
|
||||||
void pop_call(void);
|
void pop_call(void);
|
||||||
#ifdef REM_USE_WCHAR
|
#ifdef REM_USE_WCHAR
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ void DoPsCal(void)
|
|||||||
month */
|
month */
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
DBufGets(&buf, stdin);
|
DBufGets(&buf, stdin);
|
||||||
sscanf(DBufValue(&buf), "%s %s %d %d %d", month, year, &days, &wkday,
|
sscanf(DBufValue(&buf), "%39s %39s %d %d %d", month, year, &days, &wkday,
|
||||||
&MondayFirst);
|
&MondayFirst);
|
||||||
|
|
||||||
/* Replace underscores in month name with spaces */
|
/* Replace underscores in month name with spaces */
|
||||||
@@ -422,9 +422,9 @@ void DoPsCal(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBufGets(&buf, stdin);
|
DBufGets(&buf, stdin);
|
||||||
sscanf(DBufValue(&buf), "%s %d", prevm, &prevdays);
|
sscanf(DBufValue(&buf), "%39s %d", prevm, &prevdays);
|
||||||
DBufGets(&buf, stdin);
|
DBufGets(&buf, stdin);
|
||||||
sscanf(DBufValue(&buf), "%s %d", nextm, &nextdays);
|
sscanf(DBufValue(&buf), "%39s %d", nextm, &nextdays);
|
||||||
|
|
||||||
/* Replace underscores with spaces in names of next/prev month */
|
/* Replace underscores with spaces in names of next/prev month */
|
||||||
s = prevm;
|
s = prevm;
|
||||||
|
|||||||
@@ -147,6 +147,10 @@ void IssueSortedReminders(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MSF_TYPE:
|
case MSF_TYPE:
|
||||||
|
if (cur->trigdate != olddate) {
|
||||||
|
IssueSortBanner(cur->trigdate);
|
||||||
|
olddate = cur->trigdate;
|
||||||
|
}
|
||||||
FillParagraph(cur->text);
|
FillParagraph(cur->text);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -258,7 +258,6 @@ void FindNumericToken(char const *s, Token *t)
|
|||||||
/* If we hit a comma, swallow it. This allows stuff
|
/* If we hit a comma, swallow it. This allows stuff
|
||||||
like Jan 6, 1998 */
|
like Jan 6, 1998 */
|
||||||
if (*s == ',') {
|
if (*s == ',') {
|
||||||
s++;
|
|
||||||
/* Classify the number we've got */
|
/* Classify the number we've got */
|
||||||
if (t->val >= BASE && t->val <= BASE+YR_RANGE) t->type = T_Year;
|
if (t->val >= BASE && t->val <= BASE+YR_RANGE) t->type = T_Year;
|
||||||
else if (t->val >= 1 && t->val <= 31) t->type = T_Day;
|
else if (t->val >= 1 && t->val <= 31) t->type = T_Day;
|
||||||
|
|||||||
@@ -622,12 +622,10 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
|||||||
fprintf(ErrFp, "%s(%d): %s\n",
|
fprintf(ErrFp, "%s(%d): %s\n",
|
||||||
FileName, LineNo, ErrMsg[E_EXPIRED]);
|
FileName, LineNo, ErrMsg[E_EXPIRED]);
|
||||||
}
|
}
|
||||||
if (result != -1) {
|
if (save_in_globals) {
|
||||||
if (save_in_globals) {
|
LastTriggerDate = result;
|
||||||
LastTriggerDate = result;
|
LastTrigValid = 1;
|
||||||
LastTrigValid = 1;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,12 +638,10 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
|||||||
|
|
||||||
/* Keep scanning... unless there's no point in doing it.*/
|
/* Keep scanning... unless there's no point in doing it.*/
|
||||||
if (nextstart <= start) {
|
if (nextstart <= start) {
|
||||||
if (result != -1) {
|
if (save_in_globals) {
|
||||||
if (save_in_globals) {
|
LastTriggerDate = result;
|
||||||
LastTriggerDate = result;
|
LastTrigValid = 1;
|
||||||
LastTrigValid = 1;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
trig->expired = 1;
|
trig->expired = 1;
|
||||||
if (DebugFlag & DB_PRTTRIG) {
|
if (DebugFlag & DB_PRTTRIG) {
|
||||||
fprintf(ErrFp, "%s(%d): %s\n",
|
fprintf(ErrFp, "%s(%d): %s\n",
|
||||||
@@ -662,40 +658,3 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* ComputeScanStart */
|
|
||||||
/* */
|
|
||||||
/* Figure out where to start scan from by examining SCANFROM */
|
|
||||||
/* and DURATION */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
int
|
|
||||||
ComputeScanStart(int today, Trigger *trig, TimeTrig *tt)
|
|
||||||
{
|
|
||||||
int minutes, days;
|
|
||||||
|
|
||||||
/* If we don't have a time/duration, just use scanfrom */
|
|
||||||
if (tt->ttime == NO_TIME ||
|
|
||||||
tt->duration == NO_TIME) {
|
|
||||||
if (trig->scanfrom == NO_DATE) {
|
|
||||||
return today;
|
|
||||||
}
|
|
||||||
return trig->scanfrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate time-based SCANFROM */
|
|
||||||
minutes = tt->ttime + tt->duration - 1;
|
|
||||||
|
|
||||||
/* Figure out how many days to scan backwards from */
|
|
||||||
days = minutes / MINUTES_PER_DAY;
|
|
||||||
|
|
||||||
if (trig->scanfrom != NO_DATE) {
|
|
||||||
if (trig->scanfrom <= today - days) {
|
|
||||||
return trig->scanfrom;
|
|
||||||
} else {
|
|
||||||
return today - days;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return today - days;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ int DoFset(ParsePtr p)
|
|||||||
}
|
}
|
||||||
func->filename = StrDup(FileName);
|
func->filename = StrDup(FileName);
|
||||||
if (!func->filename) {
|
if (!func->filename) {
|
||||||
|
free(func);
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
}
|
}
|
||||||
func->lineno = LineNo;
|
func->lineno = LineNo;
|
||||||
@@ -182,7 +183,7 @@ int DoFset(ParsePtr p)
|
|||||||
/* Allow an optional = sign: FSET f(x) = x*x */
|
/* Allow an optional = sign: FSET f(x) = x*x */
|
||||||
c = ParseNonSpaceChar(p, &r, 1);
|
c = ParseNonSpaceChar(p, &r, 1);
|
||||||
if (c == '=') {
|
if (c == '=') {
|
||||||
c = ParseNonSpaceChar(p, &r, 0);
|
(void) ParseNonSpaceChar(p, &r, 0);
|
||||||
}
|
}
|
||||||
/* Copy the text over */
|
/* Copy the text over */
|
||||||
if (p->isnested) {
|
if (p->isnested) {
|
||||||
|
|||||||
23
src/utils.c
23
src/utils.c
@@ -41,22 +41,6 @@ char *StrnCpy(char *dest, char const *source, int n)
|
|||||||
return odest;
|
return odest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* StrMatch */
|
|
||||||
/* */
|
|
||||||
/* Checks that two strings match (case-insensitive) to at */
|
|
||||||
/* least the specified number of characters, or the length */
|
|
||||||
/* of the first string, whichever is greater. */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
int StrMatch(char const *s1, char const *s2, int n)
|
|
||||||
{
|
|
||||||
int l;
|
|
||||||
if ((l = strlen(s1)) < n) return 0;
|
|
||||||
return !StrinCmp(s1, s2, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* StrinCmp - compare strings, case-insensitive */
|
/* StrinCmp - compare strings, case-insensitive */
|
||||||
@@ -223,13 +207,6 @@ clear_callstack(void)
|
|||||||
callstack = NULL;
|
callstack = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
have_callstack(void)
|
|
||||||
{
|
|
||||||
if (callstack) return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_callstack_aux(FILE *fp, cs *entry)
|
print_callstack_aux(FILE *fp, cs *entry)
|
||||||
{
|
{
|
||||||
|
|||||||
1155
tests/test.cmp
1155
tests/test.cmp
File diff suppressed because one or more lines are too long
@@ -383,6 +383,14 @@ msg [a077]%
|
|||||||
set a078 easterdate(today())
|
set a078 easterdate(today())
|
||||||
set a079 easterdate(1992)
|
set a079 easterdate(1992)
|
||||||
set a080 easterdate(1995)
|
set a080 easterdate(1995)
|
||||||
|
set a078 orthodoxeaster(today())
|
||||||
|
set a079 orthodoxeaster(1992)
|
||||||
|
set a080 orthodoxeaster(1995)
|
||||||
|
set a080 orthodoxeaster(2023)
|
||||||
|
set a080 orthodoxeaster(2024)
|
||||||
|
set a080 orthodoxeaster(2025)
|
||||||
|
set a080 orthodoxeaster(2026)
|
||||||
|
set a080 orthodoxeaster(2027)
|
||||||
set a081 ""
|
set a081 ""
|
||||||
OMIT 1991-03-11
|
OMIT 1991-03-11
|
||||||
set a082 slide('1991-03-01', 7, "Sat", "Sun")
|
set a082 slide('1991-03-01', 7, "Sat", "Sun")
|
||||||
|
|||||||
Reference in New Issue
Block a user