mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 22:38:37 +02:00
Compare commits
252 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d75587fa7b | ||
|
|
d9a2b15814 | ||
|
|
aa090bf319 | ||
|
|
dc6a229f5f | ||
|
|
5a3840759a | ||
|
|
779174ae32 | ||
|
|
2f70b37d4c | ||
|
|
d15c8f106b | ||
|
|
9d999a0074 | ||
|
|
097dda1750 | ||
|
|
565bca4380 | ||
|
|
adb38fe82e | ||
|
|
57545ddc3f | ||
|
|
804cf14a78 | ||
|
|
641b5cec57 | ||
|
|
df53db19c4 | ||
|
|
d9bf902153 | ||
|
|
53a12de2f9 | ||
|
|
fe2b34da68 | ||
|
|
7e70ffe7f5 | ||
|
|
55975154b1 | ||
|
|
3c6191ba61 | ||
|
|
b00cf9c5b7 | ||
|
|
a6838802ad | ||
|
|
375576fcc5 | ||
|
|
2c9087aa79 | ||
|
|
928f65ae47 | ||
|
|
ed7b4f5ecc | ||
|
|
9aad9401ea | ||
|
|
4574b552b6 | ||
|
|
21e0940257 | ||
|
|
7064893ff2 | ||
|
|
f8781276e2 | ||
|
|
b02f61ea05 | ||
|
|
60447d530d | ||
|
|
2835176ad3 | ||
|
|
b0784feb1a | ||
|
|
ef7021972e | ||
|
|
e449fcdfcf | ||
|
|
47a4456c20 | ||
|
|
e9ee7492f7 | ||
|
|
2baa0405f3 | ||
|
|
3425530c1c | ||
|
|
eeae3298ef | ||
|
|
4237dc4a3f | ||
|
|
faf8947dda | ||
|
|
41a3db3a37 | ||
|
|
f12bcf3fe6 | ||
|
|
f9261bb24f | ||
|
|
2ff9aedba5 | ||
|
|
1b793eff2e | ||
|
|
e4c41e0f45 | ||
|
|
9ec1006804 | ||
|
|
dd048c0557 | ||
|
|
dce1f282f4 | ||
|
|
7120d07d84 | ||
|
|
127358db02 | ||
|
|
a89aaf18b6 | ||
|
|
5734bd7524 | ||
|
|
dfabda7dee | ||
|
|
da146d7989 | ||
|
|
e147925462 | ||
|
|
703907c94d | ||
|
|
bcfee04cae | ||
|
|
5f9e71f9eb | ||
|
|
272336226e | ||
|
|
32f4b125b5 | ||
|
|
7979a69cb9 | ||
|
|
651368fedc | ||
|
|
fe002557cf | ||
|
|
d2785d909c | ||
|
|
c2345a240b | ||
|
|
5b6bf25a20 | ||
|
|
44f9f0f0d4 | ||
|
|
0416d6da9c | ||
|
|
5d46df871f | ||
|
|
c5d661124c | ||
|
|
2f239f77a5 | ||
|
|
1ef05d3f85 | ||
|
|
7c56aad791 | ||
|
|
5f0f68f508 | ||
|
|
71bfe31002 | ||
|
|
4661b454c0 | ||
|
|
d41520a04f | ||
|
|
0206e538e0 | ||
|
|
6689cbfda3 | ||
|
|
5baf102bfe | ||
|
|
c9002d5b54 | ||
|
|
ac3ee7e22b | ||
|
|
f366037b8d | ||
|
|
a46488a50d | ||
|
|
f91a1a2d65 | ||
|
|
2ac8fb50e1 | ||
|
|
7df826f635 | ||
|
|
f8ce7b51da | ||
|
|
35ee94ca6b | ||
|
|
c2a3468e04 | ||
|
|
4ff2064452 | ||
|
|
8e00bd5acc | ||
|
|
86f65e11bb | ||
|
|
0c9ec11fce | ||
|
|
07dcaec176 | ||
|
|
e87849256b | ||
|
|
fd8ecd88a8 | ||
|
|
5e36a6563a | ||
|
|
274a2bf067 | ||
|
|
4aa737e542 | ||
|
|
6474f4e0b6 | ||
|
|
7b7b861399 | ||
|
|
5cb0e82be2 | ||
|
|
d9a4bd19f2 | ||
|
|
1004946d26 | ||
|
|
d877a6cb48 | ||
|
|
3eea329b32 | ||
|
|
7bf23912ae | ||
|
|
6ae0340137 | ||
|
|
0e48ace855 | ||
|
|
d1f1ddf5b7 | ||
|
|
5f9e227dc8 | ||
|
|
b770676cb6 | ||
|
|
5ee415c2fb | ||
|
|
6c2a4b66fd | ||
|
|
6c2d65c08e | ||
|
|
cd2dc3bea3 | ||
|
|
b1b80316ab | ||
|
|
f04835cf6f | ||
|
|
fb19ea6b7e | ||
|
|
e2d7796d4a | ||
|
|
de2ec1aa7b | ||
|
|
b9fb215d9d | ||
|
|
a62ed0e0c5 | ||
|
|
eceb5e3f82 | ||
|
|
d5aa93ae57 | ||
|
|
a66da78b4a | ||
|
|
af69f54bff | ||
|
|
a000a7f17e | ||
|
|
582f388500 | ||
|
|
7762f4f2d6 | ||
|
|
31c9b2afb7 | ||
|
|
119e954e9e | ||
|
|
6aa07edffd | ||
|
|
bdb9ad1a5d | ||
|
|
05384fe7cf | ||
|
|
6125001e55 | ||
|
|
78b307e387 | ||
|
|
460d0a8d88 | ||
|
|
add35377ad | ||
|
|
fccd9ed42e | ||
|
|
a49ecccb34 | ||
|
|
ae9fe78817 | ||
|
|
dbc5576312 | ||
|
|
6cbbebceaf | ||
|
|
4dc27ca7f5 | ||
|
|
d8f97ce0f1 | ||
|
|
0e1a80f2bd | ||
|
|
4a7f703ab5 | ||
|
|
101de948b2 | ||
|
|
0e2d382b33 | ||
|
|
a6c5c3cb90 | ||
|
|
da573929ee | ||
|
|
5217d9b675 | ||
|
|
79a87c6f1a | ||
|
|
cde5ffc84a | ||
|
|
6ef323a4f0 | ||
|
|
8331ea2991 | ||
|
|
db28648d9d | ||
|
|
1a5915bba9 | ||
|
|
94a50fa22c | ||
|
|
fad6076568 | ||
|
|
287039ac40 | ||
|
|
8523218ef2 | ||
|
|
fdaaf2b57a | ||
|
|
19eac9b8d5 | ||
|
|
cda4877229 | ||
|
|
0976cd64f3 | ||
|
|
10f7889ef2 | ||
|
|
2391ff4bc7 | ||
|
|
d21ae56deb | ||
|
|
773980afa6 | ||
|
|
46a80da0e1 | ||
|
|
23516aebcb | ||
|
|
b48ce0b245 | ||
|
|
e4c090374d | ||
|
|
39fcbb72fd | ||
|
|
5f2bf48752 | ||
|
|
9e5354fcb8 | ||
|
|
49bdd135f7 | ||
|
|
f9a6aba81d | ||
|
|
175772d959 | ||
|
|
2f03c75826 | ||
|
|
d617000e95 | ||
|
|
04dee13996 | ||
|
|
ebcf6fd534 | ||
|
|
c7c58e20f3 | ||
|
|
a66ca7cce7 | ||
|
|
35cae5f97c | ||
|
|
6d86d88037 | ||
|
|
89f60358c6 | ||
|
|
781e5a6acd | ||
|
|
1b5d34e5e6 | ||
|
|
cb5fa62022 | ||
|
|
9d6ce5b674 | ||
|
|
1cdd9531a5 | ||
|
|
da4633fab3 | ||
|
|
aeff3606d2 | ||
|
|
2af36b7241 | ||
|
|
a7a22d20a2 | ||
|
|
3fdbf8b3bc | ||
|
|
a7696d659c | ||
|
|
865ebae6f8 | ||
|
|
f21f8ee8d0 | ||
|
|
76b7736266 | ||
|
|
0769e3e9cb | ||
|
|
d9ab9e91b5 | ||
|
|
9199ed5cf7 | ||
|
|
68a4b23b6f | ||
|
|
814dd51270 | ||
|
|
59fdf70732 | ||
|
|
24ed30fee0 | ||
|
|
86dcd9ce89 | ||
|
|
4915dc1e8d | ||
|
|
8c4cff22a5 | ||
|
|
50850134f6 | ||
|
|
a5de77cc91 | ||
|
|
87e4ed23bf | ||
|
|
0fe1d1591e | ||
|
|
dfb137085a | ||
|
|
143cdecb9e | ||
|
|
183ccf9d1c | ||
|
|
56ad4efb1a | ||
|
|
f4805a443b | ||
|
|
977aa3d6cf | ||
|
|
fe7ac980e5 | ||
|
|
aebab73dfa | ||
|
|
9bd0055d4d | ||
|
|
d944ceb32d | ||
|
|
3eadb3f767 | ||
|
|
be8a0621d1 | ||
|
|
235f947dd1 | ||
|
|
93dddec24a | ||
|
|
c13b721550 | ||
|
|
1c961dca83 | ||
|
|
700ac85e54 | ||
|
|
e20a14109a | ||
|
|
a3703173e2 | ||
|
|
7325375ccd | ||
|
|
4b898b2ba1 | ||
|
|
aa3760bc04 | ||
|
|
ea5e8c90ff | ||
|
|
609b68ab21 | ||
|
|
c3ab2a15cf | ||
|
|
418b050b1c |
11
.gitignore
vendored
11
.gitignore
vendored
@@ -4,12 +4,12 @@
|
||||
.gitignore
|
||||
MYMETA.json
|
||||
MYMETA.yml
|
||||
Makefile
|
||||
TAGS
|
||||
autom4te.cache
|
||||
blib/
|
||||
config.log
|
||||
config.status
|
||||
gmon.out
|
||||
man/rem.1
|
||||
man/rem2ps.1
|
||||
man/remind.1
|
||||
@@ -18,6 +18,7 @@ pm_to_blib
|
||||
rem2html/Makefile
|
||||
rem2html/rem2html
|
||||
rem2html/rem2html.1
|
||||
rem2pdf/Makefile
|
||||
rem2pdf/Makefile.PL
|
||||
rem2pdf/Makefile.old
|
||||
rem2pdf/Makefile.top
|
||||
@@ -30,8 +31,8 @@ src/rem2ps
|
||||
src/remind
|
||||
src/test-*.out
|
||||
src/version.h
|
||||
tests/test.out
|
||||
www/Makefile
|
||||
gmon.out
|
||||
tests/once.timestamp
|
||||
src/xlat.c
|
||||
tests/once.timestamp
|
||||
tests/test.out
|
||||
tests/tz.out
|
||||
www/Makefile
|
||||
|
||||
16
Makefile
16
Makefile
@@ -39,11 +39,21 @@ install-stripped:
|
||||
@$(MAKE) -C rem2html install
|
||||
@$(MAKE) -C rem2pdf -f Makefile.top install INSTALL_BASE=$(INSTALL_BASE)
|
||||
|
||||
test:
|
||||
@$(MAKE) -C src -s test
|
||||
test: test-basic test-tz
|
||||
|
||||
test-tz:
|
||||
@$(MAKE) -C src -s all
|
||||
@$(MAKE) -C src -s test-tz
|
||||
|
||||
test-basic:
|
||||
@$(MAKE) -C src -s all
|
||||
@$(MAKE) -C src -s test-basic
|
||||
|
||||
cppcheck:
|
||||
@$(MAKE) -C src cppcheck
|
||||
|
||||
distclean: clean
|
||||
-rm -f config.cache config.log config.status src/Makefile src/version.h src/config.h tests/test.out www/Makefile rem2pdf/Makefile.top rem2pdf/Makefile.old rem2pdf/Makefile rem2pdf/Makefile.PL rem2pdf/bin/rem2pdf rem2html/rem2html
|
||||
-rm -f config.cache config.log config.status src/Makefile src/version.h src/config.h tests/test.out tests/tz.out www/Makefile rem2pdf/Makefile.top rem2pdf/Makefile.old rem2pdf/Makefile rem2pdf/Makefile.PL rem2pdf/bin/rem2pdf rem2html/rem2html
|
||||
-rm -f man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind
|
||||
-rm -rf autom4te.cache rem2html/Makefile rem2html/rem2html.1
|
||||
|
||||
|
||||
24
README.md
24
README.md
@@ -6,10 +6,21 @@ the GNU General Public License, Vesion 2.
|
||||
|
||||
## Prerequisites:
|
||||
|
||||
remind and rem2ps have no prerequisites beyond the standard C library and
|
||||
the standard math library.
|
||||
### Remind and Rem2PS
|
||||
|
||||
rem2html requires the JSON::MaybeXS Perl module and rem2pdf
|
||||
**remind** and **rem2ps** have no prerequisites beyond the standard C
|
||||
library and the standard math library. **remind** will make use of
|
||||
GNU Readline if you have it installed.
|
||||
|
||||
- On Debian-like systems, install GNU Readline as follows:
|
||||
|
||||
`apt install libreadline-dev`
|
||||
|
||||
- On RPM-based systems, you need `readline-devel`
|
||||
|
||||
### Rem2HTML and Rem2PDF
|
||||
|
||||
**rem2html** requires the JSON::MaybeXS Perl module and **rem2pdf**
|
||||
requires the JSON::MaybeXS, Pango and Cairo Perl modules.
|
||||
|
||||
- On Debian-like systems, these prerequisites may be installed with:
|
||||
@@ -24,7 +35,9 @@ requires the JSON::MaybeXS, Pango and Cairo Perl modules.
|
||||
|
||||
- On Arch linux, you need `pango-perl`, `cairo-perl` and `perl-json-maybexs`
|
||||
|
||||
TkRemind requires Tcl/Tk and the tcllib library.
|
||||
### TkRemind
|
||||
|
||||
**tkremind** requires Tcl/Tk and the tcllib library.
|
||||
|
||||
- On Debian-like systems, install with:
|
||||
|
||||
@@ -45,7 +58,8 @@ all of your distribution's Noto Font-related packages.
|
||||
|
||||
## Installation
|
||||
|
||||
Remind can be installed with the usual:
|
||||
Assuming you have a normal C development environment installed, Remind
|
||||
can be installed with the usual:
|
||||
|
||||
`./configure && make && make test && sudo make install`
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(remind, 05.04.02, , , https://dianne.skoll.ca/projects/remind/)
|
||||
AC_INIT(remind, 06.01.01, , , https://dianne.skoll.ca/projects/remind/)
|
||||
AC_CONFIG_SRCDIR([src/queue.c])
|
||||
|
||||
cat <<'EOF'
|
||||
@@ -30,7 +30,8 @@ AC_PATH_PROG([PERL], [perl])
|
||||
|
||||
dnl Checks for libraries.
|
||||
AC_CHECK_LIB(m, sqrt)
|
||||
AC_CHECK_HEADERS_ONCE([sys/time.h stdint.h])
|
||||
AC_CHECK_LIB(readline, readline)
|
||||
AC_CHECK_HEADERS_ONCE([sys/time.h stdint.h readline/readline.h readline/history.h])
|
||||
|
||||
dnl Integer sizes
|
||||
AC_CHECK_SIZEOF(unsigned int)
|
||||
@@ -84,7 +85,7 @@ if test "$?" != 0 ; then
|
||||
echo "*** COULD NOT DETERMINE RELEASE DATE: docs/WHATSNEW is incorrect!"
|
||||
exit 1
|
||||
fi
|
||||
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp setenv unsetenv glob mbstowcs setlocale initgroups inotify_init1)
|
||||
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp setenv unsetenv glob mbstowcs setlocale initgroups inotify_init1 readline)
|
||||
|
||||
VERSION=$PACKAGE_VERSION
|
||||
CONFIG_CMD="$0$ac_configure_args_raw"
|
||||
|
||||
@@ -110,15 +110,17 @@
|
||||
(defconst remind-keywords
|
||||
(sort
|
||||
(list "ADDOMIT" "AFTER" "AT" "BAN" "BANNER" "BEFORE" "CAL" "CLEAR"
|
||||
"CLEAR-OMIT-CONTEXT" "DEBUG" "DO" "DUMP" "DUMPVARS" "DURATION" "ELSE"
|
||||
"ENDIF" "ERRMSG" "EXIT" "EXPR" "FIRST" "FLUSH" "FOURTH" "FRENAME" "FROM" "FSET"
|
||||
"FUNSET" "IF" "IFTRIG" "IN" "INC" "INCLUDE" "INCLUDECMD" "INFO" "LAST"
|
||||
"LASTDAY" "LASTWORKDAY" "MAYBE" "MAYBE-UNCOMPUTABLE" "MSF" "MSG"
|
||||
"NOQUEUE" "OMIT" "OMITFUNC" "ONCE" "POP" "POP-OMIT-CONTEXT" "PRESERVE"
|
||||
"PRIORITY" "PS" "PSFILE" "PUSH" "PUSH-OMIT-CONTEXT" "REM" "RUN"
|
||||
"SATISFY" "SCAN" "SCANFROM" "SCHED" "SECOND" "SET" "SKIP" "SPECIAL"
|
||||
"SYSINCLUDE" "TAG" "THIRD" "THROUGH" "TRANSLATE" "TRANS" "UNSET"
|
||||
"UNTIL" "WARN")
|
||||
"CLEAR-OMIT-CONTEXT" "COMPLETE-THROUGH" "DEBUG" "DO" "DUMP" "DUMPVARS"
|
||||
"DURATION" "ELSE" "ENDIF" "ERRMSG" "EXIT" "EXPR" "FIRST"
|
||||
"FLUSH" "FOURTH" "FRENAME" "FROM" "FSET" "FUNSET" "IF"
|
||||
"IFTRIG" "IN" "INC" "INCLUDE" "INCLUDECMD" "INFO" "LAST"
|
||||
"LASTDAY" "LASTWORKDAY" "MAX-OVERDUE" "MAYBE" "MAYBE-UNCOMPUTABLE" "MSF"
|
||||
"MSG" "NOQUEUE" "OMIT" "OMITFUNC" "ONCE" "POP"
|
||||
"POP-OMIT-CONTEXT" "POP-FUNCS" "POP-VARS" "PRESERVE" "PRIORITY" "PS"
|
||||
"PSFILE" "PUSH" "PUSH-FUNCS" "PUSH-VARS" "PUSH-OMIT-CONTEXT" "REM" "RETURN"
|
||||
"RUN" "SATISFY" "SCAN" "SCANFROM" "SCHED" "SECOND" "SET"
|
||||
"SKIP" "SPECIAL" "SYSINCLUDE" "TAG" "THIRD" "THROUGH" "TODO"
|
||||
"TRANSLATE" "TRANS" "TZ" "UNSET" "UNTIL" "WARN")
|
||||
#'(lambda (a b) (> (length a) (length b)))))
|
||||
|
||||
|
||||
@@ -135,8 +137,8 @@
|
||||
"$DefaultPrio" "$DefaultTDelta" "$DeltaOverride"
|
||||
"$DontFork" "$DontQueue" "$DontTrigAts" "$EndSent" "$EndSentIg"
|
||||
"$ExpressionTimeLimit" "$February" "$FirstIndent" "$FoldYear"
|
||||
"$FormWidth" "$Friday" "$Fromnow" "$Hour" "$Hplu" "$HushMode"
|
||||
"$IgnoreOnce" "$InfDelta" "$IntMax" "$IntMin" "$Is" "$January" "$July"
|
||||
"$FormWidth" "$Friday" "$Fromnow" "$HideCompletedTodos" "$Hour" "$Hplu" "$HushMode"
|
||||
"$IgnoreOnce" "$InfDelta" "$IntMax" "$IntMin" "$Is" "$January" "$JSONMode" "$July"
|
||||
"$June" "$LatDeg" "$Latitude" "$LatMin" "$LatSec" "$Location"
|
||||
"$LongDeg" "$Longitude" "$LongMin" "$LongSec" "$March" "$MaxFullOmits"
|
||||
"$MaxLateMinutes" "$MaxPartialOmits" "$MaxSatIter" "$MaxStringLen"
|
||||
@@ -146,7 +148,7 @@
|
||||
"$PrefixLineNo" "$PSCal" "$RunOff" "$Saturday" "$September"
|
||||
"$SimpleCal" "$SortByDate" "$SortByPrio" "$SortByTime" "$SubsIndent"
|
||||
"$Sunday" "$SuppressImplicitWarnings" "$SuppressLRM" "$SysInclude" "$T" "$Tb" "$Td"
|
||||
"$TerminalBackground" "$Thursday" "$TimeSep" "$TimetIs64bit" "$Tm" "$Today"
|
||||
"$TerminalBackground" "$Thursday" "$TimeSep" "$TimetIs64bit" "$Tm" "$Today" "$TodoFilter"
|
||||
"$Tomorrow" "$Tt" "$Tuesday" "$Tw" "$Ty" "$U" "$Ud" "$Um"
|
||||
"$UntimedFirst" "$Use256Colors" "$UseBGVTColors" "$UseTrueColors"
|
||||
"$UseVTColors" "$Uw" "$Uy" "$Was" "$Wednesday")
|
||||
@@ -164,22 +166,23 @@
|
||||
(defconst remind-builtin-functions
|
||||
(sort
|
||||
(list "_" "abs" "access" "adawn" "adusk" "ampm" "ansicolor" "args" "asc"
|
||||
"baseyr" "catch" "catcherr" "char" "choose" "coerce" "columns" "const" "current" "date"
|
||||
"baseyr" "catch" "catcherr" "char" "choose" "codepoint" "coerce" "columns" "const" "current" "date"
|
||||
"datepart" "datetime" "dawn" "day" "daysinmon" "defined" "dosubst"
|
||||
"dusk" "easterdate" "escape" "eval" "evaltrig" "filedate" "filedatetime"
|
||||
"filedir" "filename" "getenv" "hebdate" "hebday" "hebmon" "hebyear"
|
||||
"filedir" "filename" "getenv" "hebdate" "hebday" "hebmon" "hebyear" "hex"
|
||||
"hour" "htmlescape" "htmlstriptags" "iif" "index" "isany" "isconst" "isdst"
|
||||
"isleap" "isomitted" "language" "localtoutc" "lower" "max" "min"
|
||||
"isleap" "isomitted" "language" "localtoutc" "lower" "max"
|
||||
"mbasc" "mbindex" "mbstrlen" "mbsubstr" "min"
|
||||
"minsfromutc" "minute" "mon" "monnum" "moondate" "moondatetime"
|
||||
"moonphase" "moonrise" "moonrisedir" "moonset" "moonsetdir" "moontime"
|
||||
"multitrig" "ndawn" "ndusk" "nonconst" "nonomitted" "now" "ord" "orthodoxeaster"
|
||||
"ostype" "pad" "plural" "psmoon" "psshade" "realcurrent" "realnow"
|
||||
"realtoday" "rows" "sgn" "shell" "shellescape" "slide" "soleq"
|
||||
"stdout" "strlen" "substr" "sunrise" "sunset" "time" "timepart"
|
||||
"timezone" "today" "trig" "trigback" "trigbase" "trigdate" "trigdatetime"
|
||||
"trigdelta" "trigduration" "trigeventduration" "trigeventstart"
|
||||
"trigfrom" "trigger" "triginfo" "trigpriority" "trigrep"
|
||||
"trigscanfrom" "trigtags" "trigtime" "trigtimedelta" "trigtimerep"
|
||||
"timezone" "today" "trig" "trigback" "trigbase" "trigcompletethrough" "trigdate" "trigdatetime"
|
||||
"trigdelta" "trigduration" "trigeventduration" "trigeventstart" "trigeventstarttz"
|
||||
"trigfrom" "trigger" "triginfo" "trigistodo" "trigmaxoverdue" "trigpriority" "trigrep"
|
||||
"trigscanfrom" "trigtags" "trigtime" "trigtimedelta" "trigtimerep" "trigtimetz" "trigtz"
|
||||
"triguntil" "trigvalid" "typeof" "tzconvert" "upper" "utctolocal"
|
||||
"value" "version" "weekno" "wkday" "wkdaynum" "year"
|
||||
)
|
||||
|
||||
171
docs/WHATSNEW
171
docs/WHATSNEW
@@ -1,6 +1,171 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* VERSION 5,4 Patch 2 - 2025-07-16
|
||||
* VERSION 6.1 Patch 1 - 2025-09-12
|
||||
|
||||
- NEW FEATURE: remind: Add the new --max-expr-complexity=n
|
||||
command-line argument. It is possible to write expressions that use
|
||||
enormous amounts of CPU time, such as the following:
|
||||
|
||||
FSET fib(n) iif(n <= 2, 1, fib(n-1)+fib(n-2))
|
||||
SET a fib(100)
|
||||
|
||||
That will take essentially forever to execute, but will not hit the
|
||||
built-in recursion limit. Using a command-line argument of
|
||||
--max-expr-complexity=1000000 will terminate evaluation in a few
|
||||
dozen milliseconds on modern hardware, and should not affect
|
||||
realistic reminder scripts. See the man page for details.
|
||||
|
||||
- IMPROVEMENT: remind: Add UTF-8-aware functions to complement the
|
||||
byte-aware functions that could give incorrect results by splitting
|
||||
a UTF-8 character sequence. The correspondence between old and new
|
||||
functions is:
|
||||
|
||||
NON-UTF-8-AWARE UTF-8-AWARE
|
||||
=============== ===========
|
||||
strlen mbstrlen
|
||||
substr mbsubstr
|
||||
index mbindex
|
||||
char mbchar
|
||||
asc codepoint
|
||||
|
||||
See the remind(1) man page for details.
|
||||
|
||||
- MINOR NEW FEATURE: remind: You can use hexadecimal integer constants
|
||||
like 0xFE12 in expressions. This is mostly useful for using
|
||||
codepoint() since Unicode code points are often expressed in
|
||||
hexadecimal.
|
||||
|
||||
- BUG FIX: remind: When truncating a string when executing DUMPVARS or
|
||||
during debugging of expression evaluation, Remind could sometimes
|
||||
cut the string in the middle of a UTF-8 sequence. This has been
|
||||
fixed.
|
||||
|
||||
* VERSION 6.1 Patch 0 - 2025-09-08
|
||||
|
||||
- MAJOR NEW FEATURE: remind: The TZ keyword lets you specify a time
|
||||
zone for a REM command. All trigger calculations are performed in
|
||||
the named time zone.
|
||||
|
||||
- DOCUMENTATION: Update README.md to document prerequisites for readline
|
||||
support.
|
||||
|
||||
- DOCUMENTATION: remind.1: Document system variables such as $T that can
|
||||
have multiple types.
|
||||
|
||||
- BUG FIX: remind: If Remind was run interactively ("remind -c -" with
|
||||
readline support enabled) it would not properly cache the input
|
||||
file, but would keep asking for interactive input. This has been
|
||||
fixed.
|
||||
|
||||
* VERSION 6.0 Patch 2 - 2025-09-01
|
||||
|
||||
- CHANGE: Default $ParseUntriggered to 0 instead of 1. The default
|
||||
could cause spurious warnings such as "type mismatch" warnings for
|
||||
untriggered reminders.
|
||||
|
||||
- TEST FIX: Explicitly set latitude and longitude in test files.
|
||||
|
||||
- BUG FIX: remind: Don't add lines to "readline" history unless they
|
||||
are actually being read from standard input.
|
||||
|
||||
- BUG FIX: remind: On the command-line, make '-i$foo' behave the same
|
||||
way as '-i$foo=0' as was documented in the man page.
|
||||
|
||||
- BUG FIX: remind: Clamp the output of trigger() to "1 January 1990 AT
|
||||
00:00" if the UTC flag is used, even if it would actually produce a
|
||||
result in 1989.
|
||||
|
||||
- MINOR FIX: remind: Avoid "unused result" compiler warning.
|
||||
|
||||
* VERSION 6.0 Patch 1 - 2025-08-19
|
||||
|
||||
- NEW FEATURE: remind: Add readline support if input is taken from stdin
|
||||
(ie, "remind -"). This gives you full editing support if you run
|
||||
Remind interactively.
|
||||
|
||||
- BUG FIX: remind: Fix buffer overflow in DUMPVARS command.
|
||||
Thanks to Jochen Sprickerhof for helping me find this bug.
|
||||
|
||||
* VERSION 6.0 Patch 0 - 2025-08-18
|
||||
|
||||
- MAJOR NEW FEATURE: remind: Introduction of TODOs. These are similar
|
||||
to normal reminders, but (in Agenda Mode) you keep getting reminded
|
||||
of them even once they are in the past, unless you specifically mark
|
||||
them as completed.
|
||||
|
||||
- MAJOR NEW FEATURE: remind: The --json long option causes Remind to
|
||||
output JSON in Agenda Mode instead of the normal text output. See
|
||||
tkremind for an example of how a front-end can use this output.
|
||||
|
||||
- MINOR NEW FEATURE: remind: The RETURN statement can be used to skip
|
||||
the rest of the current file. Useful for early exit from an
|
||||
INCLUDEd file.
|
||||
|
||||
- MINOR NEW FEATURE: remind: Allow the %:, %!, %?, %@ and %#
|
||||
substitution sequences to be overridden by defining the functions
|
||||
subst_colon, subst_bang, subst_question, subst_at and subst_hash,
|
||||
respectively.
|
||||
|
||||
- SAFETY IMPROVEMENT: remind: If a function is defined in a context
|
||||
where RUN is disabled, disable RUN during the evaluation of the
|
||||
function. Also disable RUN for all subst_XXX callbacks and the
|
||||
ordx(n) callback.
|
||||
|
||||
- MAJOR IMPROVEMENTS: tkremind: TkRemind has been given an overhaul.
|
||||
The "Show Queue" and "Show Today's Reminders" windows now respect
|
||||
the color scheme. TkRemind lets you create TODO reminders and
|
||||
easily mark them completed. You can right-click on a day number
|
||||
to get a window with Agenda Mode reminders for that day.
|
||||
|
||||
- MINOR IMPROVEMENT: remind: Language packs can define an ordx(n)
|
||||
function that localizes ord(n). If this function is defined, then
|
||||
ord(n) automatically calls it rather than using its built-in English
|
||||
localization. Appropriate ordx(n) definitions have been added to
|
||||
all language packs.
|
||||
|
||||
- MINOR IMPROVEMENT: remind: The %b substitution sequence handles
|
||||
dates in the past (because of TODOs). The %! sequence considers
|
||||
both date and time, and can be used with non-timed reminders. The
|
||||
new %? sequence is similar to %!, but outputs "are" and "were"
|
||||
instead of "is" and "was". The new %*! and %*? sequences are
|
||||
similar to %! and %?, but compare the trigger date to realtoday()
|
||||
instead of to today().
|
||||
|
||||
- MINOR IMPROVEMENT: remind: Downgrade a SPECIAL COLOR... with
|
||||
out-of-range color values to a normal MSG-type reminder.
|
||||
|
||||
- MINOR IMPROVEMENT: include/lang/nl.rem: Use "eergisteren" for "2
|
||||
days ago" and "overmorgen" for "in 2 days' time."
|
||||
|
||||
- MINOR IMPROVEMENT: tkremind: TkRemind now passes all command-line
|
||||
options back to Remind.
|
||||
|
||||
- TEST IMPROVEMENT: remind: Add --flush option and use it in tests to
|
||||
have more predictable interleaving of stdout/stderr output.
|
||||
|
||||
- BUG FIX: tkremind: In a couple of places, the "eval" command was used
|
||||
where the intention was to use "catch". I blame Perl...
|
||||
|
||||
- BUG FIX: remind: SCANFROM and FROM are separated out internally, and
|
||||
in the JSON output, the original FROM or SCANFROM value is
|
||||
preserved, including relative SCANFROMs.
|
||||
|
||||
- BUG FIX: tkremind: Remove some extraneous semicolons.
|
||||
|
||||
- DOCUMENTATION FIX: Fix some man-page format directive errors;
|
||||
tweak wording in several pages.
|
||||
|
||||
* VERSION 5.5 Patch 0 - 2025-07-28
|
||||
|
||||
- NEW FEATURE: remind: Add the PUSH-VARS / POP-VARS commands and the
|
||||
analogous PUSH-FUNCS / POP-FUNCS commands. These let you localize
|
||||
changes to variables and functions and help with writing more modular
|
||||
reminder files.
|
||||
|
||||
- INTERNAL CHANGES: Clean up the code following recommendations from
|
||||
an updated "cppcheck" executable.
|
||||
|
||||
* VERSION 5.4 Patch 2 - 2025-07-16
|
||||
|
||||
- MINOR CHANGE: remind: Allow daysinmon() to take a DATE or DATETIME
|
||||
argument.
|
||||
@@ -8,11 +173,11 @@ CHANGES TO REMIND
|
||||
- MINOR CHANGE: remind: All functions that want an integer month number
|
||||
will now also accept a string naming the month.
|
||||
|
||||
= UPDATE: include/holidays/chinese-new-year.rem: Add dates for Chinese
|
||||
- UPDATE: include/holidays/chinese-new-year.rem: Add dates for Chinese
|
||||
New Year for 2051 through 2100.
|
||||
|
||||
- BUG FIX: remind: Set trigdate() correctly for a fully-specified
|
||||
date, even if it's in the past, as the manual documnented. Bug
|
||||
date, even if it's in the past, as the manual documented. Bug
|
||||
found by Tim Chase.
|
||||
|
||||
- DOCUMENTATION FIX: rem2html: Document the correct Perl module
|
||||
|
||||
1
examples/alignment.rem
Normal file → Executable file
1
examples/alignment.rem
Normal file → Executable file
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env -S remind -@2
|
||||
# Demo the columns() function
|
||||
#
|
||||
# Run as: remind -@2 alignment.rem
|
||||
|
||||
24
examples/tflag.rem
Executable file
24
examples/tflag.rem
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env -S remind -@2
|
||||
# This is a little Easter Egg that simply draws
|
||||
# the Transgender Pride Flag. It's included in
|
||||
# Remind because (1) the author is trans and (2)
|
||||
# trans people are under attack in the USA and many
|
||||
# other places. So this is a little show of support
|
||||
# and resistance for trans people.
|
||||
SET $AddBlankLines 0
|
||||
BANNER %
|
||||
set c max(columns()-1, 10)
|
||||
set r max(rows(), 5)
|
||||
|
||||
set bar "█" * c
|
||||
set dups r/5
|
||||
set bars (bar + "%_") * dups
|
||||
|
||||
set bars mbsubstr(bars, 0, mbstrlen(bars)-2)
|
||||
|
||||
REM SPECIAL COLOR 91 206 250 [bars]
|
||||
REM SPECIAL COLOR 245 169 184 [bars]
|
||||
REM SPECIAL COLOR 255 255 255 [bars]
|
||||
REM SPECIAL COLOR 245 169 184 [bars]
|
||||
REM SPECIAL COLOR 91 206 250 [bars]
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
if !defined("ansi_bold")
|
||||
# Disable ANSI attributes in calandar mode
|
||||
if $CalMode
|
||||
# Disable ANSI attributes in calendar mode or JSON mode
|
||||
if $CalMode || $PSCal || $JSONMode
|
||||
set ansi_normal ""
|
||||
set ansi_bold ""
|
||||
set ansi_faint ""
|
||||
|
||||
@@ -38,10 +38,10 @@ You can use the following trick if you would like (for example) 7 days'
|
||||
advance warning of holidays:
|
||||
|
||||
# Save old definition (if any) of msgsuffix
|
||||
FRENAME msgsuffix saved_msgsuffix
|
||||
PUSH-FUNCS msgsuffix
|
||||
|
||||
# Save old value of $DefaultDelta
|
||||
SET old_delta $DefaultDelta
|
||||
PUSH-VARS $DefaultDelta
|
||||
|
||||
# We want 7 days' advance warning
|
||||
SET $DefaultDelta 7
|
||||
@@ -57,6 +57,9 @@ advance warning of holidays:
|
||||
SYSINCLUDE holidays/us.rem
|
||||
SYSINCLUDE holidays/us/ny.rem
|
||||
|
||||
# Restore old version of msgsuffix and $DefaultDelta
|
||||
FRENAME saved_msgsuffix msgsuffix
|
||||
SET $DefaultDelta old_delta
|
||||
# Restore old value $DefaultDelta
|
||||
POP-VARS
|
||||
|
||||
# Restore old version of msgsuffix
|
||||
POP-FUNCS
|
||||
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
# Major Jewish Holidays
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
# Save variables and functions that we will mess with
|
||||
PUSH-VARS InIsrael IncludeIsraeliHolidays Reform
|
||||
PUSH-FUNCS _chan _h2 _PastSat _BackTwoFri _BackTwoSat
|
||||
|
||||
# Set the variable InIsrael to 1 if you live in Israel. Otherwise,
|
||||
# you get the Diaspora versions of Jewish holidays
|
||||
SET InIsrael value("InIsrael", 0)
|
||||
|
||||
# Set this if you want to include holidays that are not really
|
||||
# Jewish religious holidays, but simply Israeli holidays
|
||||
SET IncludeIsraeliHolidays value("IncludeIsraeliHolidays", 0)
|
||||
|
||||
# Set the variable Reform to 1 if you want the Reform version of the
|
||||
# Jewish calendar. Otherwise, you get the traditional version
|
||||
SET Reform value("Reform", 0)
|
||||
@@ -80,15 +88,18 @@ IF !InIsrael && !Reform
|
||||
ENDIF
|
||||
|
||||
REM [hebdate(27, "Nisan")] INFO "Url: https://en.wikipedia.org/wiki/Yom_HaShoah" MSG Yom HaShoah
|
||||
REM [_BackTwoFri(4, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Yom_HaZikaron" MSG Yom HaZikaron
|
||||
REM [_BackTwoSat(5, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Independence_Day_(Israel)" MSG Yom Ha'atzmaut
|
||||
|
||||
IF IncludeIsraeliHolidays
|
||||
REM [_BackTwoFri(4, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Yom_HaZikaron" MSG Yom HaZikaron
|
||||
REM [_BackTwoSat(5, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Independence_Day_(Israel)" MSG Yom Ha'atzmaut
|
||||
REM [hebdate(28, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Jerusalem_Day" MSG Yom Yerushalayim
|
||||
ENDIF
|
||||
|
||||
# Not sure about Reform's position on Lag B'Omer
|
||||
IF !Reform
|
||||
REM [hebdate(18, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Lag_BaOmer" MSG Lag B'Omer
|
||||
ENDIF
|
||||
|
||||
REM [hebdate(28, "Iyar")] INFO "Url: https://en.wikipedia.org/wiki/Jerusalem_Day" MSG Yom Yerushalayim
|
||||
REM [hebdate(6, "Sivan")] INFO "Url: https://en.wikipedia.org/wiki/Shavuot" MSG Shavuot
|
||||
|
||||
IF !InIsrael && !Reform
|
||||
@@ -102,3 +113,7 @@ IF !Reform
|
||||
REM [_PastSat(17, "Tamuz")] INFO "Url: https://en.wikipedia.org/wiki/Seventeenth_of_Tammuz" MSG Tzom Tammuz
|
||||
REM [_PastSat(9, "Av")] INFO "Url: https://en.wikipedia.org/wiki/Tisha_B%27Av" MSG Tish'a B'Av
|
||||
ENDIF
|
||||
|
||||
# Tidy up
|
||||
POP-FUNCS
|
||||
POP-VARS
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
if !defined("__autolang__")
|
||||
SET __autolang__ 1
|
||||
PRESERVE __autolang__
|
||||
SET autolang getenv("REMIND_LANG")
|
||||
if defined("__autolang__")
|
||||
RETURN
|
||||
endif
|
||||
|
||||
IF autolang == ""
|
||||
SET autolang getenv("LC_ALL")
|
||||
ENDIF
|
||||
IF autolang == ""
|
||||
SET autolang getenv("LANGUAGE")
|
||||
ENDIF
|
||||
IF autolang == ""
|
||||
SET autolang getenv("LANG")
|
||||
ENDIF
|
||||
SET __autolang__ 1
|
||||
PRESERVE __autolang__
|
||||
|
||||
IF autolang != ""
|
||||
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 5)) + ".rem", "r") == 0
|
||||
SYSINCLUDE lang/[lower(substr(autolang, 1, 5))].rem
|
||||
ELSE
|
||||
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 2)) + ".rem", "r") == 0
|
||||
SYSINCLUDE lang/[lower(substr(autolang, 1, 2))].rem
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
UNSET autolang
|
||||
PUSH-VARS autolang
|
||||
SET autolang getenv("REMIND_LANG")
|
||||
|
||||
IF autolang == ""
|
||||
SET autolang getenv("LC_ALL")
|
||||
ENDIF
|
||||
IF autolang == ""
|
||||
SET autolang getenv("LANGUAGE")
|
||||
ENDIF
|
||||
IF autolang == ""
|
||||
SET autolang getenv("LANG")
|
||||
ENDIF
|
||||
|
||||
IF autolang != ""
|
||||
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 5)) + ".rem", "r") == 0
|
||||
SYSINCLUDE lang/[lower(substr(autolang, 1, 5))].rem
|
||||
ELSE
|
||||
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 2)) + ".rem", "r") == 0
|
||||
SYSINCLUDE lang/[lower(substr(autolang, 1, 2))].rem
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
POP-VARS
|
||||
|
||||
|
||||
@@ -28,7 +28,12 @@ SET $December "desembre"
|
||||
|
||||
SET $Today "avui"
|
||||
SET $Tomorrow "demà"
|
||||
FSET subst_bx(a,d,t) iif(d==today()+2, "demà passat", "d'aquí " + (d-today()) + " dies")
|
||||
TRANSLATE "yesterday" "ahir"
|
||||
TRANSLATE "are" "són"
|
||||
TRANSLATE "were" "eren"
|
||||
TRANSLATE "done" "completada"
|
||||
|
||||
FSET subst_bx(a,d,t) iif(d==today()+2, "demà passat", d >= today(), "d'aquí " + (d-today()) + " dies", "fa " + (today()-d) + " dies")
|
||||
|
||||
# 1 d'abril vs 1 de maig.
|
||||
FSET subst_sx(a,d,t) iif(isany(substr(mon(d), 1, 1), "a", "o") , "d'", "de")
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "December"
|
||||
SET $Today "i dag"
|
||||
SET $Tomorrow "i morgen"
|
||||
|
||||
TRANSLATE "yesterday" "i går"
|
||||
TRANSLATE "are" "er"
|
||||
TRANSLATE "were" "var"
|
||||
TRANSLATE "done" "fuldført"
|
||||
|
||||
BANNER Påmindelse for %w, %d. %m, %y%o:
|
||||
|
||||
SET $Am "am"
|
||||
@@ -51,13 +56,14 @@ SET $Mplu "ter"
|
||||
|
||||
FSET subst_ampm(h) iif(h<5, " om natten", h < 12, " om formiddagen", h < 18, " om eftermiddagen", " om aftenen")
|
||||
FSET subst_ordinal(d) "."
|
||||
FSET ordx(n) n + "."
|
||||
|
||||
FSET subst_p(alt, d, t) iif(d==today()+1, "", "e")
|
||||
FSET zeropad(s, len) pad(s, "0", len)
|
||||
FSET subst_a_alt(d) wkday(d) + ", den " + 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_bx(a, d, t) "om " + (d-today()) + " dage"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "om " + (d-today()) + " dage", "for " + (today()-d) + " dage siden")
|
||||
|
||||
FSET subst_ex(alt, d, t) "den " + zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(year(d), 4)
|
||||
FSET subst_fx(alt, d, t) "den " + zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2) + $DateSep + zeropad(year(d), 4)
|
||||
|
||||
@@ -31,6 +31,11 @@ SET $December "Dezember"
|
||||
SET $Today "heute"
|
||||
SET $Tomorrow "morgen"
|
||||
|
||||
TRANSLATE "yesterday" "gestern"
|
||||
TRANSLATE "are" "sind"
|
||||
TRANSLATE "were" "waren"
|
||||
TRANSLATE "done" "abgeschlossen"
|
||||
|
||||
# Banner
|
||||
BANNER Termine für %w, den %d. %m %y%o:
|
||||
|
||||
@@ -51,11 +56,12 @@ SET $Fromnow "von heute"
|
||||
|
||||
FSET subst_ampm(h) iif(h<5, " nachts", h<12, " vormittags", h<=17, " nachmittags", " abends")
|
||||
FSET subst_ordinal(d) "."
|
||||
FSET ordx(n) n + "."
|
||||
|
||||
FSET subst_a_alt(d) wkday(d) + ", den " + 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_bx(a, d, t) "in " + (d-today()) + " Tagen"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "in " + (d-today()) + " Tagen", "vor " + (today()-d) + " Tagen")
|
||||
|
||||
FSET subst_g_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d)
|
||||
FSET subst_gx(alt, d, t) iif(alt, subst_g_alt(d), $On + " " + subst_g_alt(d))
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "Diciembre"
|
||||
SET $Today "hoy"
|
||||
SET $Tomorrow "mañana"
|
||||
|
||||
TRANSLATE "yesterday" "ayer"
|
||||
TRANSLATE "are" "son"
|
||||
TRANSLATE "were" "eran"
|
||||
TRANSLATE "done" "completada"
|
||||
|
||||
BANNER Agenda para el %w, %d%s %m, %y%o:
|
||||
|
||||
SET $Am "am"
|
||||
@@ -47,4 +52,4 @@ SET $And "y"
|
||||
SET $Hplu "s"
|
||||
SET $Mplu "s"
|
||||
|
||||
FSET subst_bx(a, d, t) "dentro de " + (d-today()) + " días"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "dentro de " + (d-today()) + " días", "hace " + (today()-d) + " dias")
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "joulukuu"
|
||||
SET $Today "tänään"
|
||||
SET $Tomorrow "huomenna"
|
||||
|
||||
TRANSLATE "yesterday" "eilen"
|
||||
TRANSLATE "are" "ovat"
|
||||
TRANSLATE "were" "olivat"
|
||||
TRANSLATE "done" "suoritettu"
|
||||
|
||||
BANNER Viestit %wna %d. %mta %y%o:
|
||||
|
||||
SET $Am " ap."
|
||||
@@ -52,11 +57,12 @@ SET $Mplu "a"
|
||||
FSET zeropad(s, len) pad(s, "0", len)
|
||||
|
||||
FSET subst_ordinal(d) iif(d==1, ":senä", d==2, ":sena", (d%10)==2||(d%10)==3||(d%10)==6||(d%10)==8, ":ntena", ":ntenä")
|
||||
FSET ordx(d) d + subst_ordinal(d)
|
||||
|
||||
FSET subst_a_alt(d, o, p) wkday(d) + o + " " + day(d) + ". " + mon(d) + p + " " + year(d)
|
||||
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d, "", ""), subst_a_alt(d, $On, "ta"))
|
||||
|
||||
FSET subst_bx(a, d, t) (d-today()) + " päivän kuluttua"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), (d-today()) + " päivän kuluttua", (today()-d) + " päivää sitten")
|
||||
FSET subst_cx(a, d, t) iif(a, wkday(d), wkday(d) + $On)
|
||||
|
||||
FSET subst_ex(a, d, t) zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(year(d), 4)
|
||||
|
||||
@@ -28,6 +28,12 @@ SET $December "décembre"
|
||||
|
||||
SET $Today "aujourd'hui"
|
||||
SET $Tomorrow "demain"
|
||||
|
||||
TRANSLATE "yesterday" "hier"
|
||||
TRANSLATE "are" "sont"
|
||||
TRANSLATE "were" "étaient"
|
||||
TRANSLATE "done" "accomplie"
|
||||
|
||||
SET $On "le"
|
||||
SET $At "à"
|
||||
SET $Now "maintenant"
|
||||
@@ -46,6 +52,7 @@ BANNER Rappels pour %w, %d%s %m, %y%o:
|
||||
|
||||
# Ordinal for a day (English would be "st", "nd", "rd", "th")
|
||||
FSET subst_ordinal(d) iif(d == 1, "er", "")
|
||||
FSET ordx(n) n + iif(n == 1, "er", "e")
|
||||
|
||||
# "%d hours", "%d minutes", or "%d hours and %d minutes"
|
||||
FSET subst_tdiff(hdiff, mdiff) iif(hdiff==0&&mdiff==0, $Now, \
|
||||
@@ -56,13 +63,14 @@ FSET subst_1(alt, date, time) iif(time == now(), "maintenant", \
|
||||
time > now(), "dans " + subst_tdiff((time-now())/60, (time-now())%60), \
|
||||
"il y a " + subst_tdiff ((now()-time)/60, (now()-time)%60))
|
||||
|
||||
FSET subst_bx(alt, date, time) "dans " + (date-today()) + " jours"
|
||||
FSET subst_bx(alt, date, time) iif(date >= today(), "dans " + (date-today()) + " jours", "il y a " + (today()-date) + " jours")
|
||||
FSET subst_j_alt(date) wkday(date) + ", " + day(date) + subst_ordinal(day(date)) + " " + mon(date) + ", " + year(date)
|
||||
FSET subst_jx(alt, date, time) iif(alt, subst_j_alt(date), $On + " " + subst_j_alt(date))
|
||||
|
||||
FSET subst_k_alt(date) wkday(date) + ", " + day(date) + subst_ordinal(day(date)) + " " + mon(date)
|
||||
FSET subst_kx(alt, date, time) iif(alt, subst_k_alt(date), $On + " " + subst_k_alt(date))
|
||||
|
||||
|
||||
TRANSLATE "Missing ']'" "']' manquant"
|
||||
TRANSLATE "Missing quote" "Apostrophe manquant"
|
||||
TRANSLATE "Expression too complex" "Expression trop complexe"
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "Δεκέμβρ."
|
||||
SET $Today "σήμερα"
|
||||
SET $Tomorrow "αύριο"
|
||||
|
||||
TRANSLATE "yesterday" "εχθές"
|
||||
TRANSLATE "are" "είναι"
|
||||
TRANSLATE "were" "ήταν"
|
||||
TRANSLATE "done" "ολοκληρώθηκε"
|
||||
|
||||
BANNER Υπενθυμίσεις: %w, %d %m, %y%o:
|
||||
|
||||
SET $Am "πμ"
|
||||
@@ -49,8 +54,9 @@ SET $And "και"
|
||||
SET $Hplu ""
|
||||
SET $Mplu ""
|
||||
|
||||
FSET subst_bx(a, d, t) "σε " + (d - today()) + " ημέρες"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "σε " + (d - today()) + " ημέρες", "πριν από " + (today()-d) + " ημέρες")
|
||||
FSET subst_ordinal(d) "."
|
||||
FSET ordx(d) 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)
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "desember"
|
||||
SET $Today "í dag"
|
||||
SET $Tomorrow "á morgun"
|
||||
|
||||
TRANSLATE "yesterday" "í gær"
|
||||
TRANSLATE "are" "eru"
|
||||
TRANSLATE "were" "voru"
|
||||
TRANSLATE "done" "lokið"
|
||||
|
||||
BANNER Minnisatriði: %w, %d%s %m, %y%o:
|
||||
|
||||
SET $Am "fh"
|
||||
@@ -49,5 +54,5 @@ SET $And "og"
|
||||
SET $Hplu "ir"
|
||||
SET $Mplu "r"
|
||||
|
||||
FSET subst_bx(a, d, t) "eftir " + (d - today()) + " daga"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "eftir " + (d - today()) + " daga", "fyrir " + (today()-d) + " dögum")
|
||||
fset subst_p(a, d, t) iif(d == today()+1, "", "a")
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "Dicembre"
|
||||
SET $Today "oggi"
|
||||
SET $Tomorrow "domani"
|
||||
|
||||
TRANSLATE "yesterday" "Ieri"
|
||||
TRANSLATE "are" "sono"
|
||||
TRANSLATE "were" "erano"
|
||||
TRANSLATE "done" "completato"
|
||||
|
||||
BANNER Promemoria per %w, %d %m %y%o:
|
||||
|
||||
SET $Am "am"
|
||||
@@ -48,7 +53,7 @@ SET $And "e"
|
||||
SET $Hplu "a"
|
||||
SET $Mplu "i"
|
||||
|
||||
FSET subst_bx(a, d, t) "fra " + (d-today()) + " giorni"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "fra " + (d-today()) + " giorni", (today()-d) + " giorni fa")
|
||||
FSET subst_p(a, d, t) iif(d==today()+1, "o", "i")
|
||||
FSET subst_q(a, d, t) iif(d==today()+1, "a", "e")
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ SET $December "december"
|
||||
|
||||
SET $Today "vandaag"
|
||||
SET $Tomorrow "morgen"
|
||||
TRANSLATE "yesterday" "gisteren"
|
||||
TRANSLATE "are" "zijn"
|
||||
TRANSLATE "were" "waren"
|
||||
TRANSLATE "done" "voltooid"
|
||||
|
||||
BANNER Herinneringen voor %w, %d %m, %y%o:
|
||||
|
||||
@@ -55,9 +59,12 @@ FSET subst_1b(hdiff, mdiff) iif(hdiff==0, subst_minutes(mdiff), mdiff==0, subst_
|
||||
FSET subst_minutes(m) iif(m==1, "1 minuut", m + " minuten")
|
||||
FSET subst_hours(h) iif(h==1, "1 uur", h + " uren")
|
||||
|
||||
FSET subst_bx(a, d, t) "over " + (d-today()) + " dagen"
|
||||
FSET subst_bx(a, d, t) iif (d == today()+2, "overmorgen", d+2 == today(), "eergisteren", d >= today(), "over " + (d-today()) + " dagen", (today()-d) + " dagen geleden")
|
||||
|
||||
FSET subst_s(a, d, t) iif(day(d) == 1 || day(d) == 8, "e", day(d) < 20, "de", "te")
|
||||
|
||||
FSET ordx(n) n + "e"
|
||||
|
||||
TRANSLATE "New Moon" "Nieuwe maan"
|
||||
TRANSLATE "First Quarter" "Eerste kwartier"
|
||||
TRANSLATE "Full Moon" "Volle maan"
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "Desember"
|
||||
SET $Today "i dag"
|
||||
SET $Tomorrow "i morgen"
|
||||
|
||||
TRANSLATE "yesterday" "i går"
|
||||
TRANSLATE "are" "er"
|
||||
TRANSLATE "were" "var"
|
||||
TRANSLATE "done" "fullført"
|
||||
|
||||
BANNER Påminnelse for %w, %d. %m, %y%o:
|
||||
|
||||
SET $Am "am"
|
||||
@@ -48,8 +53,9 @@ SET $And "og"
|
||||
SET $Hplu "r"
|
||||
SET $Mplu "er"
|
||||
|
||||
FSET subst_bx(a, d, t) "om " + (d-today()) + " dager"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "om " + (d-today()) + " dager", "for " + (today()-d) + " dager siden")
|
||||
FSET subst_ordinal(d) "."
|
||||
FSET ordx(n) n + "."
|
||||
|
||||
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d), $On + " " + subst_a_alt(d))
|
||||
FSET subst_a_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d) + " " + year(d)
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "Grudzień"
|
||||
SET $Today "dzisiaj"
|
||||
SET $Tomorrow "jutro"
|
||||
|
||||
TRANSLATE "yesterday" "wczoraj"
|
||||
TRANSLATE "are" "są"
|
||||
TRANSLATE "were" "byli"
|
||||
TRANSLATE "done" "ukończone"
|
||||
|
||||
BANNER Terminarz na %w, %d. %m %y%o:
|
||||
|
||||
SET $Am "am"
|
||||
@@ -53,7 +58,7 @@ FSET subst_ordinal(d) ""
|
||||
|
||||
FSET subst_a_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d) + " " + year(d)
|
||||
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d), $On + " " + subst_a_alt(d))
|
||||
FSET subst_bx(a, d, t) "za " + (d-today()) + " dni"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "za " + (d-today()) + " dni", (today()-d) + " dni temu")
|
||||
FSET subst_g_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d)
|
||||
FSET subst_gx(a, d, t) iif(a, subst_g_alt(d), $On + " " + subst_g_alt(d))
|
||||
FSET subst_ux(a, d, t) subst_ax(a, d, t)
|
||||
|
||||
@@ -29,6 +29,11 @@ SET $December "dezembro"
|
||||
SET $Today "hoje"
|
||||
SET $Tomorrow "amanhã"
|
||||
|
||||
TRANSLATE "yesterday" "ontem"
|
||||
TRANSLATE "are" "são"
|
||||
TRANSLATE "were" "eram"
|
||||
TRANSLATE "done" "concluída"
|
||||
|
||||
BANNER Avisos para %w, %d de %m de %y%o:
|
||||
|
||||
SET $Am "am"
|
||||
@@ -53,7 +58,7 @@ FSET subst_ordinal(d) ""
|
||||
FSET subst_on_wd(d) iif(wkdaynum(d) == 1 || wkdaynum(d) == 2, "no", "na")
|
||||
|
||||
FSET subst_a_alt(d) wkday(d) + ", " + day(d) + " de " + mon(d) + " de " + year(d)
|
||||
FSET subst_bx(a, d, t) "em " + (d-today()) + " dias"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "em " + (d-today()) + " dias", "há " + (today()-d) + " dias")
|
||||
FSET subst_c_alt(d) wkday(d)
|
||||
FSET subst_g_alt(d) wkday(d) + ", " + day(d) + " " + mon(d)
|
||||
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d), subst_on_wd(d) + " " + subst_a_alt(d))
|
||||
|
||||
@@ -28,6 +28,10 @@ SET $December "Decembrie"
|
||||
|
||||
SET $Today "astăzi"
|
||||
SET $Tomorrow "mâine"
|
||||
TRANSLATE "yesterday" "ieri"
|
||||
TRANSLATE "are" "sunt"
|
||||
TRANSLATE "were" "au fost"
|
||||
TRANSLATE "done" "finalizată"
|
||||
|
||||
BANNER Reamintiri pentru %w, %d %m %y%o:
|
||||
|
||||
@@ -49,7 +53,7 @@ SET $Mplu "e"
|
||||
SET $Hplu "e"
|
||||
SET $And "şi"
|
||||
|
||||
FSET subst_bx(a, d, t) "peste " + (d-today()) + " zile"
|
||||
FSET subst_bx(a, d, t) iif(d >= today(), "peste " + (d-today()) + " zile", "acume " + (today()-d) + " zile")
|
||||
|
||||
FSET subst_ampm(h) iif(h<4, " noaptea", h<12, " dimineaţa", h<18, " după-amiaza", " seara")
|
||||
FSET subst_ordinal(d) ""
|
||||
|
||||
@@ -544,11 +544,20 @@ will produce the following \fBinfo\fR hash:
|
||||
"summary" : "None"
|
||||
},
|
||||
.fi
|
||||
.PP
|
||||
.RE
|
||||
.TP
|
||||
.B tz \fIzone\fR
|
||||
If a non-empty TZ clause was present, this key will contain the time zone
|
||||
name.
|
||||
.TP
|
||||
.B time \fIt\fR
|
||||
If an AT clause was present, this key will contain the time of the AT clause
|
||||
in minutes after midnight.
|
||||
in minutes after midnight \fIin the system default time zone\fR.
|
||||
.TP
|
||||
.B time_in_tz \fIt\fR
|
||||
If a TZ clause was present, this key will contain the time of the AT clause
|
||||
in minutes after midnight \fIin the time zone specified by TZ\fR.
|
||||
.TP
|
||||
.B tdelta \fIn\fR
|
||||
If a time delta (+n after an AT clause) was present, this key contains the
|
||||
@@ -569,7 +578,12 @@ discussion of duration vs. event duration.
|
||||
.TP
|
||||
.B eventstart \fIdt\fR
|
||||
If an AT clause was present, this key contains the event start time in
|
||||
the format \fIYYYY-MM-DDTHH:MM\fR.
|
||||
the format \fIYYYY-MM-DD\fRT\fIHH:MM\fR in the \fIsystem default time zone\fR.
|
||||
.TP
|
||||
.B eventstart_in_tz \fIdt\fR
|
||||
If a TZ clause was present, this key containes the event start time in
|
||||
the format \fIYYYY-MM-DD\fRT\fIHH:MM\fR in the \fItime zone specified
|
||||
by TZ\fR.
|
||||
.TP
|
||||
.B back \fIn\fR
|
||||
If the reminder contained a "back" clause (\-n or \-\-n), this key
|
||||
@@ -622,14 +636,27 @@ will be present. Its value will be a string of the form YYYY-MM-DD.
|
||||
If the reminder contains a ONCE keyword, this key will be present
|
||||
with a value of 1.
|
||||
.TP
|
||||
.B scanfrom \fIYYYY-MM-DD\fR
|
||||
.B scanfrom \fIYYYY-MM-DD\fR or \fBscanfrom\fR \fI-n\fR
|
||||
If the reminder contains a SCANFROM keyword, this key will be present
|
||||
and its value will be a string of the form YYYY-MM-DD.
|
||||
and its value will be a string of the form YYYY-MM-DD for an absolute
|
||||
SCANFROM, or a negative integer of the form -n for a relative scanfrom
|
||||
.TP
|
||||
.B from \fIYYYY-MM-DD\fR
|
||||
If the reminder contains a FROM keyword, this key will be present
|
||||
and its value will be a string of the form YYYY-MM-DD.
|
||||
.TP
|
||||
.B is_todo \fIflag\fR
|
||||
If the reminder is a TODO reminder, then \fIflag\fR will be the integer
|
||||
1. Otherwise, it will be the integer zero.
|
||||
.TP
|
||||
.B complete_through \fIYYYY-MM-DD\fR
|
||||
If the reminder has a COMPLETE-THROUGH date, then this key will be present
|
||||
and its value will be a string of the form YYYY-MM-DD.
|
||||
.TP
|
||||
.B max_overdue \fIn\fR
|
||||
If the reminder has a MAX-OVERDUE clause, then this key will be present and
|
||||
its value will be the integer argument to MAX-OVERDUE.
|
||||
.TP
|
||||
.B priority \fIn\fR
|
||||
The priority of the reminder. Always present; if no PRIORITY keyword
|
||||
is specified, then a reminder has a default priority of 5000.
|
||||
@@ -671,8 +698,8 @@ emits the line:
|
||||
However, back-ends should keep reading until EOF in case more data for
|
||||
subsequent months is forthcoming.
|
||||
.PP
|
||||
|
||||
.SH REM2PS PURE JSON INPUT FORMAT (-PPP OR -P+ OPTION)
|
||||
.PP
|
||||
\fBRemind \-ppp\fR and \fBremind \-p+\fR emit \fIpure JSON\fR output.
|
||||
The format is as follows:
|
||||
.PP
|
||||
|
||||
734
man/remind.1.in
734
man/remind.1.in
File diff suppressed because it is too large
Load Diff
@@ -20,18 +20,16 @@ or the tkpng extension to handle PNG images.
|
||||
|
||||
.SH COMMAND-LINE OPTIONS
|
||||
\fBTkRemind\fR itself has no command-line options. However, it passes
|
||||
certain options on to \fBRemind\fR. The options it passes are
|
||||
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR. See the
|
||||
\fBRemind\fR man page for details about the options. Note that
|
||||
\fBTkRemind\fR will respect the \fB\-m\fR and \fB\-b1\fR options and
|
||||
adjust its appearance accordingly.
|
||||
|
||||
any command-line argument starting with \fB\-\fR to \fBRemind\fR as an
|
||||
option. In addition, \fBTkRemind\fR will respect the \fB\-m\fR and
|
||||
\fB\-b1\fR options and adjust its appearance accordingly.
|
||||
.PP
|
||||
\fIRead_file\fR is the file from which \fBTkRemind\fR reads reminders.
|
||||
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
|
||||
to which \fBTkRemind\fR writes reminders which you add using the GUI.
|
||||
If \fIRead_file\fR is omitted, it defaults to \fB$HOME/.reminders\fR.
|
||||
If \fIWrite_file\fR is omitted, it defaults to \fIRead_file\fR.
|
||||
|
||||
.PP
|
||||
You may wish to have a different \fIWrite_file\fR from \fIRead_file\fR if
|
||||
you want to collect all of \fBTkRemind\fR's reminders in one place. Suppose
|
||||
your main file is \fI$HOME/.reminders\fR and you want \fBTkRemind\fR to put
|
||||
@@ -96,10 +94,19 @@ The fourth control specifies which days \fBRemind\fR considers
|
||||
as part of the weekend. This can affect the interpretation of "weekday"
|
||||
in the second and third types of reminders.
|
||||
|
||||
The fifth control associates a time with the reminder.
|
||||
You can also specify advance notice, possibly repeating.
|
||||
The fifth group of controls associates a time and possible duration
|
||||
with the reminder. You can also specify advance notice, possibly
|
||||
repeating.
|
||||
|
||||
The sixth control specifies what \fBRemind\fR should do if a reminder
|
||||
The sixth control allows you to specify whether the reminder is a
|
||||
TODO, and if so, its completion date. Typing a slash "/" in the
|
||||
"Complete through:" field automatically fills in the date of the
|
||||
calendar entry. Otherwise, enter a completion date in the form
|
||||
YYYY-MM-DD. You can also enter a number in the "Max overdue days:"
|
||||
field to limit how many days past the due date \fBRemind\fR will keep
|
||||
reminding you of the TODO.
|
||||
|
||||
The seventh control specifies what \fBRemind\fR should do if a reminder
|
||||
falls on a holiday or weekend.
|
||||
|
||||
Enter the body of the reminder into the \fBSummary:\fR text entry. If
|
||||
@@ -121,6 +128,16 @@ edit the reminder, thereby gaining access to advanced features of
|
||||
\fBRemind\fR. You can also use it simply to play around and discover
|
||||
\fBRemind\fR's idioms for expressing different types of reminders.
|
||||
|
||||
.SH SEEING A SINGLE DAY'S REMINDERS
|
||||
Right-click on any day number in the calendar to pop up a window with
|
||||
that day's reminders in Agenda Mode. You can left- or right-click the
|
||||
current date and time indicator at the bottom of the window to see today's
|
||||
reminders in Agenda Mode.
|
||||
|
||||
In the Agenda Mode display, hovering over a reminder will show ancillary
|
||||
information such as a Location, URL or Description. Clicking on a reminder
|
||||
will open an editor on the REM command that created the reminder.
|
||||
|
||||
.SH PRINTING
|
||||
To print the current month's calendar, click \fBPrint...\fR on the
|
||||
main calendar window. This brings up the print dialog. Printing
|
||||
@@ -280,12 +297,12 @@ IP address of your SMTP server here.
|
||||
.TP
|
||||
.B Text Editor
|
||||
This specifies a text editor to invoke when a reminder is right-clicked.
|
||||
The characters "%d" are replaced with the lined number of the file
|
||||
containing the reminder, and "%s" are replaced with the file name.
|
||||
The sequence "%d" is replaced with the line number of the file
|
||||
containing the reminder, and "%s" is replaced with the file name.
|
||||
Useful strings might be "emacs +%d %s" or "gvim +%d %s"
|
||||
|
||||
.TP
|
||||
.B Extra Argument for Remind
|
||||
.B Extra Arguments for Remind
|
||||
This specifies any extra arguments that should be passed to Remind
|
||||
when \fBTkRemind\fR invokes \fBremind\fR. Unless you know what
|
||||
you are doing, leave this blank.
|
||||
|
||||
@@ -517,7 +517,7 @@ sub render
|
||||
}
|
||||
}
|
||||
|
||||
if ($so_far > $settings->{height} - $settings->{margin_bottom}) {
|
||||
if ($so_far > $settings->{height} - $settings->{margin_bottom} + 1) {
|
||||
print STDERR "WARNING: overfull calendar box\n";
|
||||
}
|
||||
# The vertical lines
|
||||
@@ -583,7 +583,7 @@ sub draw_row
|
||||
$self->draw_day($cr, $settings, $so_far, $day, $col, $height);
|
||||
}
|
||||
|
||||
return $so_far + $height + $settings->{border_size};
|
||||
return $so_far + $height + $settings->{border_size} * 2;
|
||||
}
|
||||
|
||||
=head2 col_box_coordinates($so_far, $col, $height, $settings)
|
||||
|
||||
@@ -158,11 +158,6 @@ if {[catch {package require json}]} {
|
||||
missing_tcllib json
|
||||
}
|
||||
|
||||
if {$tcl_platform(platform) == "windows"} {
|
||||
tk_messageBox -message "Please do not port Remind to Windows" -icon error -type ok
|
||||
exit 1
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# GetRemindVersion
|
||||
# Arguments:
|
||||
@@ -317,6 +312,8 @@ set TodayDay [string trim [clock format $now -format %e]]
|
||||
set CurMonth $TodayMonth
|
||||
set CurYear $TodayYear
|
||||
|
||||
set DateOfEventBeingEdited ""
|
||||
|
||||
# Reminder option types and skip types
|
||||
set OptionType 1
|
||||
set SkipType 1
|
||||
@@ -364,8 +361,8 @@ set HighestTagSoFar 0
|
||||
# Check Remind version
|
||||
set ver [GetRemindVersion]
|
||||
|
||||
if {"$ver" < "04.03.03"} {
|
||||
tk_messageBox -message "This version of TkRemind requires Remind version 04.03.03 or newer; you have version $ver" -icon error -type ok
|
||||
if {"$ver" < "06.00.00"} {
|
||||
tk_messageBox -message "This version of TkRemind requires Remind version 06.00.00 or newer; you have version $ver" -icon error -type ok
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -447,7 +444,10 @@ proc Initialize {} {
|
||||
if {"[lindex $argv $i]" == "-b1"} {
|
||||
set TwentyFourHourMode 1
|
||||
}
|
||||
} else {
|
||||
} elseif { [regexp -- {-.*} [lindex $argv $i]]} {
|
||||
append CommandLine " [lindex $argv $i]"
|
||||
append PSCmd " [lindex $argv $i]"
|
||||
} else {
|
||||
break
|
||||
}
|
||||
incr i
|
||||
@@ -583,7 +583,7 @@ proc CreateCalFrame { w dayNames } {
|
||||
text $w.t$f -width 12 -height $h -bd 0 -spacing3 3 -wrap word -relief flat \
|
||||
-state disabled -takefocus 0 -cursor {} -font CalboxFont -foreground $Option(TextColor) -background $Option(BackgroundColor) \
|
||||
-highlightthickness 0
|
||||
frame $w.f$f -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0
|
||||
frame $w.f$f -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0 -background $Option(BackgroundColor)
|
||||
$w.t$f tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$f"
|
||||
$w.t$f tag bind REM <ButtonPress-2> "OpenUrl $w.t$f"
|
||||
$w.t$f tag bind REM <ButtonPress-3> "FireEditor $w.t$f"
|
||||
@@ -650,7 +650,8 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
raise $w.t$i
|
||||
set d [expr $i-$first+1]
|
||||
$w.l$i configure -text $d -state normal -relief flat \
|
||||
-command "ModifyDay $d $firstDay" -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
-command "ModifyDay $d $firstDay" -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
bind $w.l$i <ButtonPress-3> [list ShowSpecificDayReminders $d]
|
||||
balloon_add_help $w.l$i "Add a reminder..."
|
||||
$w.t$i configure -relief sunken -takefocus 1 -state normal -foreground $Option(TextColor) -background $Option(BackgroundColor)
|
||||
$w.t$i delete 1.0 end
|
||||
@@ -753,7 +754,13 @@ proc CreateCalWindow { dayNames } {
|
||||
button .b.quit -text {Quit} -command {Quit} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.quit "Quit TkRemind"
|
||||
label .b.status -text "" -width 25 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||
bind .b.status <ButtonPress-1> [list ShowTodaysReminders 1 ""]
|
||||
bind .b.status <ButtonPress-3> [list ShowTodaysReminders 1 ""]
|
||||
balloon_add_help .b.status "Show Today's Reminders"
|
||||
label .b.nqueued -text "" -width 20 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||
balloon_add_help .b.nqueued "See the queue of pending reminders (debugging purposes only)"
|
||||
bind .b.nqueued <ButtonPress-1> [list DoQueue]
|
||||
bind .b.nqueued <ButtonPress-3> [list DoQueue]
|
||||
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.queue .b.quit -side left -fill both -padx 1
|
||||
pack .b.status -side left -fill both -expand 1 -padx 1
|
||||
pack .b.nqueued -side left -fill both -padx 1
|
||||
@@ -968,6 +975,7 @@ proc CancelOptions { } {
|
||||
global Option
|
||||
font configure CalboxFont {*}$Option(CalboxFont)
|
||||
font configure HeadingFont {*}$Option(HeadingFont)
|
||||
font configure BoldFont {*}$Option(HeadingFont) -weight bold
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
@@ -1025,7 +1033,7 @@ proc SaveOptions { w } {
|
||||
set n [expr $i*7]
|
||||
for {set j 0} {$j < 7} {incr j} {
|
||||
set f [expr $n+$j]
|
||||
.cal.l$f configure -anchor $Option(DayAnchor);
|
||||
.cal.l$f configure -anchor $Option(DayAnchor)
|
||||
}
|
||||
}
|
||||
.b.status configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
@@ -1039,8 +1047,8 @@ proc SaveOptions { w } {
|
||||
.b.queue configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
.b.quit configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
.b.options configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
. configure -background $Option(LineColor);
|
||||
.h configure -background $Option(LineColor);
|
||||
. configure -background $Option(LineColor)
|
||||
.h configure -background $Option(LineColor)
|
||||
.cal configure -background $Option(LineColor)
|
||||
.b configure -background $Option(LineColor)
|
||||
}
|
||||
@@ -1105,6 +1113,7 @@ proc LoadOptions {} {
|
||||
}
|
||||
font configure CalboxFont {*}$Option(CalboxFont)
|
||||
font configure HeadingFont {*}$Option(HeadingFont)
|
||||
font configure BoldFont {*}$Option(HeadingFont) -weight bold
|
||||
}
|
||||
|
||||
|
||||
@@ -1180,7 +1189,7 @@ proc FillCalWindow {} {
|
||||
gets $file line
|
||||
set DayNames {}
|
||||
foreach day $line {
|
||||
set day [regsub -all {_} $day " "];
|
||||
set day [regsub -all {_} $day " "]
|
||||
lappend DayNames $day
|
||||
}
|
||||
|
||||
@@ -1376,7 +1385,7 @@ proc ThisMonth {} {
|
||||
|
||||
# Do nothing if already there
|
||||
if { $CurMonth == $TodayMonth && $CurYear == $TodayYear } {
|
||||
return 0;
|
||||
return 0
|
||||
}
|
||||
set CurMonth $TodayMonth
|
||||
set CurYear $TodayYear
|
||||
@@ -1694,6 +1703,39 @@ proc Quit {} {
|
||||
}
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# ShowSpecificDayReminders - show reminders for a specific day
|
||||
# Arguments:
|
||||
# d - day whose reminders should be shown
|
||||
#---------------------------------------------------------------------------
|
||||
proc ShowSpecificDayReminders { d } {
|
||||
global CurYear CurMonth
|
||||
set date [format "%04d-%02d-%02d" $CurYear [expr 1 + $CurMonth] $d]
|
||||
ShowTodaysReminders 1 $date
|
||||
}
|
||||
|
||||
proc toggle_complete_through { w } {
|
||||
global todobut
|
||||
if {$todobut} {
|
||||
$w.complete_through configure -state normal
|
||||
$w.max_overdue configure -state normal
|
||||
} else {
|
||||
$w.complete_through configure -state disabled
|
||||
$w.max_overdue configure -state disabled
|
||||
}
|
||||
}
|
||||
|
||||
proc complete_through_today { w } {
|
||||
global DateOfEventBeingEdited
|
||||
$w.complete_through delete 0 end
|
||||
if {"$DateOfEventBeingEdited" != ""} {
|
||||
$w.complete_through insert end $DateOfEventBeingEdited
|
||||
} else {
|
||||
$w.complete_through insert end [clock format [clock seconds] -format %Y-%m-%d]
|
||||
}
|
||||
return -code break
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# CreateModifyDialog -- create dialog for adding a reminder
|
||||
# Arguments:
|
||||
@@ -1707,7 +1749,9 @@ proc CreateModifyDialog {w day firstDay args} {
|
||||
|
||||
# Set up: Year, Month, Day, WeekdayName
|
||||
global CurYear CurMonth EnglishDayNames MonthNames OptionType SkipType
|
||||
global ModifyDialogResult TwentyFourHourMode
|
||||
global ModifyDialogResult TwentyFourHourMode DateOfEventBeingEdited
|
||||
|
||||
set DateOfEventBeingEdited ""
|
||||
|
||||
set OptionType 1
|
||||
set SkipType 1
|
||||
@@ -1724,12 +1768,13 @@ proc CreateModifyDialog {w day firstDay args} {
|
||||
frame $w.adv -bd 4
|
||||
frame $w.weekend -bd 4
|
||||
frame $w.durationbox -bd 4
|
||||
frame $w.todobox
|
||||
frame $w.time -bd 4
|
||||
frame $w.hol -bd 4
|
||||
frame $w.msg
|
||||
frame $w.buttons
|
||||
pack $w.o1 $w.o2 $w.o3 -side top -anchor w -in $w.o
|
||||
pack $w.o $w.exp $w.adv $w.weekend $w.time $w.durationbox $w.hol $w.msg -side top -anchor w -pady 4 -expand 0 -fill both
|
||||
pack $w.o $w.exp $w.adv $w.weekend $w.time $w.durationbox $w.todobox $w.hol $w.msg -side top -anchor w -pady 4 -expand 0 -fill both
|
||||
pack $w.msg -side top -anchor w -pady 4 -padx 4 -expand true -fill both
|
||||
pack $w.buttons -side top -anchor w -pady 4 -expand 0 -fill x
|
||||
|
||||
@@ -1919,6 +1964,20 @@ proc CreateModifyDialog {w day firstDay args} {
|
||||
}
|
||||
pack $w.durationbut $w.durationh $w.durationcolon $w.durationm -side left -anchor w -in $w.durationbox
|
||||
|
||||
# TODO?
|
||||
checkbutton $w.todobut -text "This is a TODO " -command [list toggle_complete_through $w]
|
||||
|
||||
balloon_add_help $w.todobut "Select if this is a TODO-type reminder"
|
||||
$w.todobut deselect
|
||||
label $w.lcomplete -text "Complete through: "
|
||||
entry $w.complete_through -width 20
|
||||
bind $w.complete_through <KeyPress-slash> [list complete_through_today $w]
|
||||
balloon_add_help $w.complete_through "Enter the date of completed TODO in the form YYYY-MM-DD"
|
||||
label $w.loverdue -text "Max overdue days: "
|
||||
entry $w.max_overdue -width 6
|
||||
balloon_add_help $w.max_overdue "Enter the maximum number of days Remind should nag you about an overdue TODO"
|
||||
pack $w.todobut $w.lcomplete $w.complete_through $w.loverdue $w.max_overdue -side left -anchor w -in $w.todobox
|
||||
|
||||
# SKIP TYPE
|
||||
label $w.labhol -text "On holidays or weekends:"
|
||||
radiobutton $w.issue -variable SkipType -value 1 -text "Issue reminder as usual"
|
||||
@@ -1930,7 +1989,7 @@ proc CreateModifyDialog {w day firstDay args} {
|
||||
# TEXT ENTRY
|
||||
label $w.msglab -text "Summary: "
|
||||
entry $w.entry
|
||||
balloon_add_help $w.entry "Enter the text of the reminder"
|
||||
balloon_add_help $w.entry "Enter the text of the reminder (required)"
|
||||
grid $w.msglab -row 0 -column 0 -in $w.msg -sticky e
|
||||
grid $w.entry -row 0 -column 1 -in $w.msg -sticky nsew
|
||||
|
||||
@@ -1987,7 +2046,7 @@ proc CreateModifyDialog {w day firstDay args} {
|
||||
#***********************************************************************
|
||||
proc RemindDialogToOptions { w } {
|
||||
global OptionType SkipType repbut expbut advbut advcount
|
||||
global timebut timeadvbut timerepbut durationbut
|
||||
global timebut timeadvbut timerepbut durationbut todobut
|
||||
global dSaturday dSunday dMonday dTuesday dWednesday dThursday dFriday
|
||||
set ans {}
|
||||
lappend ans "-global-OptionType" $OptionType
|
||||
@@ -2021,10 +2080,12 @@ proc RemindDialogToOptions { w } {
|
||||
#***********************************************************************
|
||||
proc OptionsToRemindDialog { w opts } {
|
||||
global OptionType SkipType repbut expbut advbut advcount
|
||||
global timebut timeadvbut timerepbut TwentyFourHourMode durationbut
|
||||
global dSaturday dSunday dMonday dTuesday dWednesday dThursday dFriday
|
||||
global timebut timeadvbut timerepbut TwentyFourHourMode durationbut todobut
|
||||
global dSaturday dSunday dMonday dTuesday dWednesday dThursday dFriday DateOfEventBeingEdited
|
||||
set hour ""
|
||||
set ampm ""
|
||||
$w.complete_through configure -state normal
|
||||
$w.max_overdue configure -state normal
|
||||
foreach {flag value} $opts {
|
||||
switch -glob -- $flag {
|
||||
"-text-*" {
|
||||
@@ -2072,6 +2133,7 @@ proc OptionsToRemindDialog { w opts } {
|
||||
}
|
||||
}
|
||||
}
|
||||
toggle_complete_through $w
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2163,6 +2225,7 @@ proc ModifyDay {d firstDay} {
|
||||
wm iconname .mod "Add Reminder"
|
||||
tkwait visibility .mod
|
||||
set oldFocus [focus]
|
||||
toggle_complete_through .mod
|
||||
while {1} {
|
||||
grab .mod
|
||||
raise .mod
|
||||
@@ -2243,7 +2306,7 @@ proc CreateReminder {w} {
|
||||
set body [string trim [$w.entry get]]
|
||||
|
||||
if {"$body" == ""} {
|
||||
error "Blank body in reminder"
|
||||
error "Summary is required"
|
||||
}
|
||||
|
||||
set DidOmit 0
|
||||
@@ -2251,7 +2314,7 @@ proc CreateReminder {w} {
|
||||
# Delegate the first part to CreateReminder1, CreateReminder2, or
|
||||
# CreateReminder3
|
||||
global OptionType SkipType repbut expbut advbut advcount
|
||||
global timebut timeadvbut timerepbut durationbut
|
||||
global timebut timeadvbut timerepbut durationbut todobut
|
||||
|
||||
set rem [CreateReminder$OptionType $w]
|
||||
|
||||
@@ -2299,6 +2362,17 @@ proc CreateReminder {w} {
|
||||
}
|
||||
}
|
||||
|
||||
if {$todobut} {
|
||||
append rem " TODO"
|
||||
set ct [string trim [$w.complete_through get]]
|
||||
if {"$ct" != ""} {
|
||||
append rem " COMPLETE-THROUGH $ct"
|
||||
}
|
||||
set mo [string trim [$w.max_overdue get]]
|
||||
if {"$mo" != ""} {
|
||||
append rem " MAX-OVERDUE $mo"
|
||||
}
|
||||
}
|
||||
global SkipType
|
||||
if {$SkipType == 2} {
|
||||
append rem " SKIP"
|
||||
@@ -2845,14 +2919,15 @@ proc RestartBackgroundRemindDaemon {} {
|
||||
# Dumps the debugging queue listing
|
||||
#---------------------------------------------------------------------------
|
||||
proc ShowQueue { queue } {
|
||||
global Option
|
||||
set w .queuedbg
|
||||
catch { destroy $w }
|
||||
toplevel $w
|
||||
toplevel $w -background $Option(WinBackground)
|
||||
wm title $w "Queue (Debugging Output)"
|
||||
wm iconname $w "Queue Dbg"
|
||||
text $w.t -fg black -bg white -width 80 -height 30 -wrap word -yscrollcommand "$w.sb set"
|
||||
text $w.t -fg black -bg white -width 80 -height 30 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalBoxFont
|
||||
scrollbar $w.sb -orient vertical -command "$w.text yview"
|
||||
button $w.ok -text "OK" -command "destroy $w"
|
||||
button $w.ok -text "OK" -command "destroy $w" -foreground $Option(TextColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
grid $w.t -row 0 -column 0 -sticky nsew
|
||||
grid $w.sb -row 0 -column 1 -sticky ns
|
||||
grid $w.ok -row 1 -column 0 -sticky w
|
||||
@@ -2864,7 +2939,6 @@ proc ShowQueue { queue } {
|
||||
set obj [lsort -command sort_q $queue]
|
||||
set did 0
|
||||
$w.t tag configure grey -background "#DDDDDD" -selectbackground "#999999"
|
||||
set toggle 0
|
||||
foreach q $obj {
|
||||
if { $did > 0 } {
|
||||
$w.t insert end "\n"
|
||||
@@ -2887,24 +2961,17 @@ proc ShowQueue { queue } {
|
||||
}
|
||||
foreach key [list time nexttime body] {
|
||||
set r [dict get $q $key]
|
||||
if { $toggle != 0 } {
|
||||
$w.t insert end "$key=$r" [list grey $fntag]
|
||||
if {"$key" != "body"} {
|
||||
$w.t insert end "; " [list grey $fntag]
|
||||
}
|
||||
} else {
|
||||
$w.t insert end "$key=$r" [list $fntag]
|
||||
if {"$key" != "body"} {
|
||||
$w.t insert end "; " [list $fntag]
|
||||
}
|
||||
$w.t insert end "$key=$r" [list $fntag]
|
||||
if {"$key" != "body"} {
|
||||
$w.t insert end "; " [list $fntag]
|
||||
}
|
||||
}
|
||||
$w.t insert end "\n"
|
||||
set toggle [expr 1 - $toggle]
|
||||
set did 1
|
||||
}
|
||||
if { $did == 0 } {
|
||||
$w.t insert end "(Queue is empty)\n"
|
||||
$w.t tag configure bold -font BoldFont
|
||||
$w.t insert end "(Queue is empty)\n" bold
|
||||
} else {
|
||||
$w.t insert end "\n\nClick on a queue item to open an editor on the corresponding REM command.\n"
|
||||
}
|
||||
@@ -2968,10 +3035,10 @@ proc DaemonReadable { file } {
|
||||
return
|
||||
}
|
||||
if {[catch {set obj [::json::json2dict $line]}]} {
|
||||
return;
|
||||
return
|
||||
}
|
||||
if {![dict exists $obj response]} {
|
||||
return;
|
||||
return
|
||||
}
|
||||
set response [dict get $obj response]
|
||||
switch -- $response {
|
||||
@@ -3014,7 +3081,7 @@ proc DaemonReadable { file } {
|
||||
catch { unset Ignore }
|
||||
Initialize
|
||||
FillCalWindow
|
||||
ShowTodaysReminders
|
||||
ShowTodaysReminders 0 ""
|
||||
}
|
||||
"reread" {
|
||||
if {[dict exists $obj command]} {
|
||||
@@ -3195,6 +3262,7 @@ proc main {} {
|
||||
|
||||
font create CalboxFont {*}[font actual TkFixedFont]
|
||||
font create HeadingFont {*}[font actual TkDefaultFont]
|
||||
font create BoldFont {*}[font actual TkDefaultFont] -weight bold
|
||||
|
||||
global AppendFile HighestTagSoFar DayNames
|
||||
catch {
|
||||
@@ -3212,7 +3280,7 @@ proc main {} {
|
||||
}
|
||||
FindConfigFile
|
||||
LoadOptions
|
||||
ShowTodaysReminders
|
||||
ShowTodaysReminders 0 ""
|
||||
ScanForTags $AppendFile
|
||||
CreateCalWindow $DayNames
|
||||
FillCalWindow
|
||||
@@ -3284,6 +3352,9 @@ proc ReadTaggedOptions { tag date } {
|
||||
}
|
||||
}
|
||||
|
||||
if {[dict exists $obj date]} {
|
||||
lappend ans -global-DateOfEventBeingEdited $date
|
||||
}
|
||||
if {[dict exists $obj d]} {
|
||||
lappend ans -text-day1 [dict get $obj d]
|
||||
lappend ans -text-day2 [dict get $obj d]
|
||||
@@ -3509,6 +3580,24 @@ proc ReadTaggedOptions { tag date } {
|
||||
lappend ans -entry-entry [dict get $obj body]
|
||||
}
|
||||
|
||||
# Is this a TODO?
|
||||
if {[dict exists $obj is_todo]} {
|
||||
lappend ans -global-todobut [dict get $obj is_todo]
|
||||
} else {
|
||||
lappend ans -global-todobut 0
|
||||
}
|
||||
if {[dict exists $obj complete_through]} {
|
||||
lappend ans -entry-complete_through [dict get $obj complete_through]
|
||||
} else {
|
||||
lappend ans -entry-complete_through ""
|
||||
}
|
||||
|
||||
if {[dict exists $obj max_overdue]} {
|
||||
lappend ans -entry-max_overdue [dict get $obj max_overdue]
|
||||
} else {
|
||||
lappend ans -entry-max_overdue ""
|
||||
}
|
||||
|
||||
# Figure out the reminder type
|
||||
if {[dict exists $obj rep]} {
|
||||
# Repeat must be type 1
|
||||
@@ -3684,7 +3773,7 @@ proc EditableEnter { w } {
|
||||
if {"$c" != ""} {
|
||||
$w tag configure $tag -underline 1
|
||||
# underlinefg not supported on older versions of Tk
|
||||
eval { $w tag configure $tag -underlinefg $c }
|
||||
catch { $w tag configure $tag -underlinefg $c }
|
||||
} else {
|
||||
$w tag configure $tag -underline 1
|
||||
}
|
||||
@@ -3750,7 +3839,7 @@ proc details_enter { w } {
|
||||
lappend lines [list "URL:" "Middle-click to open [dict get $info url]"]
|
||||
}
|
||||
if {[llength $lines] < 1} {
|
||||
return;
|
||||
return
|
||||
}
|
||||
balloon_cancel_timer
|
||||
|
||||
@@ -3818,7 +3907,7 @@ proc EditTaggedReminder { w } {
|
||||
wm title .mod "TkRemind Edit Reminder..."
|
||||
wm iconname .mod "Edit Reminder"
|
||||
OptionsToRemindDialog .mod $opts
|
||||
|
||||
toggle_complete_through .mod
|
||||
tkwait visibility .mod
|
||||
set oldFocus [focus]
|
||||
while {1} {
|
||||
@@ -4166,7 +4255,7 @@ proc DisplayTime {} {
|
||||
# .moon_last
|
||||
#***********************************************************************
|
||||
proc CreateMoonWindows {} {
|
||||
global Option;
|
||||
global Option
|
||||
catch { destroy .moon_new }
|
||||
catch { destroy .moon_first }
|
||||
catch { destroy .moon_full }
|
||||
@@ -4230,7 +4319,7 @@ proc DisplayTimeContinuously {} {
|
||||
DisplayTime
|
||||
|
||||
# Reap any zombies
|
||||
eval { exec true }
|
||||
catch { exec true }
|
||||
|
||||
set secs [clock format [clock seconds] -format "%S"]
|
||||
# Doh -- don't interpret as an octal number if leading zero
|
||||
@@ -4240,47 +4329,67 @@ proc DisplayTimeContinuously {} {
|
||||
}
|
||||
|
||||
|
||||
proc daily_rem_enter { lines } {
|
||||
global Balloon
|
||||
balloon_cancel_timer
|
||||
set Balloon(HelpId) [after $Balloon(HelpTime) [list details_popup $lines]]
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: ShowTodaysReminders
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# force -- if true, show today's reminders even if option is disabled.
|
||||
# date -- if non-blank, show reminders for specified date rather than today.
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Shows all of today's non-timed reminders in a window
|
||||
#***********************************************************************
|
||||
proc ShowTodaysReminders {} {
|
||||
proc ShowTodaysReminders { force date } {
|
||||
global Option
|
||||
global Remind
|
||||
global ReminderFile
|
||||
global TwentyFourHourMode
|
||||
if {!$Option(ShowTodaysReminders)} {
|
||||
if {!$force && !$Option(ShowTodaysReminders)} {
|
||||
return
|
||||
}
|
||||
|
||||
set w .today
|
||||
catch { destroy $w }
|
||||
toplevel $w
|
||||
wm title $w "Today's Reminders"
|
||||
toplevel $w -background $Option(WinBackground)
|
||||
if {"$date" == ""} {
|
||||
set wtitle "Today's Reminders"
|
||||
} else {
|
||||
set wtitle "Reminders for $date"
|
||||
}
|
||||
wm iconname $w "Reminders"
|
||||
text $w.text -width 80 -height 20 -wrap word -yscrollcommand "$w.sb set"
|
||||
text $w.text -width 80 -height 20 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalboxFont -spacing1 3
|
||||
scrollbar $w.sb -orient vertical -command "$w.text yview"
|
||||
button $w.ok -text "OK" -command "destroy $w"
|
||||
button $w.ok -text "OK" -command "destroy $w" -foreground $Option(TextColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
|
||||
grid $w.text -row 0 -column 0 -sticky nsew
|
||||
grid $w.sb -row 0 -column 1 -sticky ns
|
||||
grid $w.ok -row 1 -column 0 -sticky w
|
||||
|
||||
grid rowconfigure $w 0 -weight 1
|
||||
grid rowconfigure $w 1 -weight 0
|
||||
grid columnconfigure $w 0 -weight 1
|
||||
grid columnconfigure $w 1 -weight 0
|
||||
CenterWindow $w .
|
||||
|
||||
# Grab the reminders
|
||||
set stuff ""
|
||||
set cmdline "|$Remind -itkremind=1 -g -q -r "
|
||||
set cmdline "|$Remind -itkremind=1 --json -q -r "
|
||||
if {$TwentyFourHourMode} {
|
||||
append cmdline "-b1 "
|
||||
}
|
||||
append cmdline $Option(ExtraRemindArgs);
|
||||
append cmdline " $ReminderFile 2>@1"
|
||||
append cmdline $Option(ExtraRemindArgs)
|
||||
append cmdline " $ReminderFile"
|
||||
if {"$date" != ""} {
|
||||
append cmdline " $date"
|
||||
} else {
|
||||
set date [clock format [clock seconds] -format "%Y-%m-%d" -locale C]
|
||||
}
|
||||
append cmdline " 2>/dev/null"
|
||||
set f [open $cmdline r]
|
||||
while {[gets $f line] >= 0} {
|
||||
append stuff "$line\n"
|
||||
@@ -4290,12 +4399,163 @@ proc ShowTodaysReminders {} {
|
||||
$w.text insert end $stuff
|
||||
$w.text insert end "\n"
|
||||
$w.text insert end $err
|
||||
} else {
|
||||
$w.text insert end $stuff
|
||||
$w.text configure -state disabled
|
||||
return
|
||||
}
|
||||
|
||||
if {[catch {set arr [::json::json2dict $stuff]} err]} {
|
||||
$w.text insert end "Error converting JSON\n\n"
|
||||
$w.text insert end $err
|
||||
$w.text configure -state disabled
|
||||
return
|
||||
}
|
||||
|
||||
# If first element is banner, set window title
|
||||
set first [lindex $arr 0]
|
||||
$w.text tag configure bold -font BoldFont
|
||||
if {"[lindex $first 0]" == "banner"} {
|
||||
set banner [lindex $first 1]
|
||||
# Trim trailing colon
|
||||
set wtitle [string trimright $banner ":"]
|
||||
set arr [lreplace $arr 0 0]
|
||||
$w.text insert end "$banner" bold
|
||||
$w.text insert end "\n\n"
|
||||
}
|
||||
|
||||
# At this point, we can set the window title
|
||||
wm title $w $wtitle
|
||||
|
||||
# If first element is no reminders, FINE.
|
||||
set first [lindex $arr 0]
|
||||
if {"[lindex $first 0]" == "noreminders"} {
|
||||
$w.text insert end [lindex $first 1] bold
|
||||
$w.text insert end "\n"
|
||||
$w.text configure -state disabled
|
||||
return
|
||||
}
|
||||
|
||||
set arr [lsort -command compare_reminders $arr]
|
||||
set old_date {}
|
||||
set did_a_date 0
|
||||
set t_index 0
|
||||
foreach thing $arr {
|
||||
incr t_index
|
||||
set mydate [dict get $thing date]
|
||||
if {"$mydate" != "$old_date"} {
|
||||
if {"$old_date" != ""} {
|
||||
$w.text insert end "\n"
|
||||
}
|
||||
if {$did_a_date || "$mydate" != "$date"} {
|
||||
$w.text insert end "> $mydate\n" bold
|
||||
set did_a_date 1
|
||||
}
|
||||
}
|
||||
set old_date $mydate
|
||||
set tags [list "l_$t_index"]
|
||||
if {[dict exists $thing r] && [dict exists $thing g] && [dict exists $thing g]} {
|
||||
set r [dict get $thing r]
|
||||
set g [dict get $thing g]
|
||||
set b [dict get $thing b]
|
||||
if {$r > 255} {
|
||||
set r 255
|
||||
} elseif {$r < 0} {
|
||||
set r 0
|
||||
}
|
||||
if {$g > 255} {
|
||||
set g 255
|
||||
} elseif {$g < 0} {
|
||||
set g 0
|
||||
}
|
||||
if {$b > 255} {
|
||||
set b 255
|
||||
} elseif {$b < 0} {
|
||||
set b 0
|
||||
}
|
||||
set color [format "%02X%02X%02X" $r $g $b]
|
||||
lappend tags "clr$color"
|
||||
$w.text tag configure "clr$color" -foreground "#$color"
|
||||
}
|
||||
|
||||
set help_lines {}
|
||||
if {[dict exists $thing info]} {
|
||||
set info [dict get $thing info]
|
||||
if {[dict exists $info location]} {
|
||||
lappend help_lines [list "Location:" [dict get $info location]]
|
||||
}
|
||||
if {[dict exists $info description]} {
|
||||
lappend help_lines [list "Description:" [dict get $info description]]
|
||||
}
|
||||
if {[dict exists $info url]} {
|
||||
lappend help_lines [list "URL:" "Middle-click to open [dict get $info url]"]
|
||||
$w.text tag bind "l_$t_index" <ButtonPress-2> [list exec xdg-open [dict get $info url]]
|
||||
}
|
||||
}
|
||||
if {[llength $help_lines] >= 1} {
|
||||
$w.text tag bind "l_$t_index" <Enter> +[list daily_rem_enter $help_lines]
|
||||
$w.text tag bind "l_$t_index" <Leave> +[list details_leave $w]
|
||||
}
|
||||
if {[dict exists $thing filename]} {
|
||||
set fname [dict get $thing filename]
|
||||
# Don't make INCLUDECMD output editable
|
||||
if {![string match "*|" $fname]} {
|
||||
if {[dict exists $thing lineno_start]} {
|
||||
set l [dict get $thing lineno_start]
|
||||
} else {
|
||||
set l [dict get $thing lineno]
|
||||
}
|
||||
set fntag [string cat "FILE_" $l "_" $fname]
|
||||
$w.text tag bind "l_$t_index" <Enter> +[list $w.text tag configure "l_$t_index" -underline 1]
|
||||
$w.text tag bind "l_$t_index" <Leave> +[list $w.text tag configure "l_$t_index" -underline 0]
|
||||
$w.text tag bind "l_$t_index" <ButtonPress-1> [list FireEditor $w.text $fntag]
|
||||
$w.text tag bind "l_$t_index" <ButtonPress-3> [list FireEditor $w.text $fntag]
|
||||
}
|
||||
}
|
||||
$w.text insert end [dict get $thing body] $tags
|
||||
$w.text insert end "\n"
|
||||
}
|
||||
|
||||
#$w.text insert end "\n\n$stuff\n"
|
||||
$w.text configure -state disabled
|
||||
}
|
||||
|
||||
proc compare_reminders { a b } {
|
||||
set a_date [dict get $a date]
|
||||
set b_date [dict get $b date]
|
||||
#puts "Comparing $a_date $b_date"
|
||||
if {"$a_date" < "$b_date"} {
|
||||
return -1
|
||||
}
|
||||
if {"$a_date" > "$b_date"} {
|
||||
return 1
|
||||
}
|
||||
|
||||
if {[dict exists $a time]} {
|
||||
set a_time [dict get $a time]
|
||||
} else {
|
||||
set a_time 1441
|
||||
}
|
||||
if {[dict exists $b time]} {
|
||||
set b_time [dict get $b time]
|
||||
} else {
|
||||
set b_time 1441
|
||||
}
|
||||
if {$a_time < $b_time} {
|
||||
return -1
|
||||
}
|
||||
if {$a_time > $b_time} {
|
||||
return 1
|
||||
}
|
||||
set a_prio [dict get $a priority]
|
||||
set b_prio [dict get $b priority]
|
||||
if {$a_prio < $b_prio} {
|
||||
return -1
|
||||
}
|
||||
if {$a_prio > $b_prio} {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: InteractiveDeleteReminder
|
||||
# %ARGUMENTS:
|
||||
@@ -4516,6 +4776,7 @@ proc ChooseHeadingFont {} {
|
||||
proc SetHeadingFont {font} {
|
||||
global tmpOpt
|
||||
font configure HeadingFont {*}[font actual $font]
|
||||
font configure BoldFont {*}$Option(HeadingFont) -weight bold
|
||||
set tmpOpt(HeadingFont) [font actual $font]
|
||||
raise .opt
|
||||
}
|
||||
@@ -4616,13 +4877,13 @@ proc set_button_to_errors {} {
|
||||
}
|
||||
|
||||
proc ShowErrors {} {
|
||||
global RemindErrors
|
||||
global RemindErrors Option
|
||||
set w ".errors"
|
||||
catch { destroy $w }
|
||||
toplevel $w
|
||||
text $w.t -width 80 -height 30 -wrap word -yscrollcommand "$w.sb set"
|
||||
toplevel $w -background $Option(WinBackground)
|
||||
text $w.t -width 80 -height 30 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalBoxFont
|
||||
scrollbar $w.sb -orient vertical -command "$w.t yview"
|
||||
button $w.ok -text OK -command DoneShowingErrors
|
||||
button $w.ok -text OK -command DoneShowingErrors -foreground $Option(TextColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
grid $w.t -row 0 -column 0 -sticky nsew
|
||||
grid $w.sb -row 0 -column 1 -sticky ns
|
||||
grid $w.ok -row 1 -column 0 -stick w
|
||||
|
||||
@@ -40,16 +40,23 @@ REMINDOBJS= $(REMINDSRCS:.c=.o) $(XLATSRC:.c=.o)
|
||||
|
||||
all: remind rem2ps
|
||||
|
||||
test: all
|
||||
test-basic: all
|
||||
@sh ../tests/test-rem
|
||||
|
||||
test-tz: all
|
||||
@sh ../tests/test-timezone-support
|
||||
|
||||
test: test-basic test-tz
|
||||
|
||||
.c.o:
|
||||
@CC@ -c @CPPFLAGS@ @CFLAGS@ @DEFS@ $(CEXTRA) -DSYSDIR=$(datarootdir)/remind -I. -I$(srcdir) $<
|
||||
|
||||
# Extract all tr() strings into a file. NOTE: SOURCE CODE MUST NOT HAVE
|
||||
# MORE THAN ONE tr() PER LINE!!!
|
||||
xlat.c: $(REMINDSRCS)
|
||||
@echo "#include <stddef.h>" > xlat.c
|
||||
@echo "char const *translatables[] = {" >> xlat.c
|
||||
@cat $(REMINDSRCS) | grep 'tr(".*")' | sed -e 's/.*tr."/"/' -e 's/").*/"/' | LANG=C LC_ALL=C sort | uniq | grep -E -v '^"(am|at|from now|hour|minute|now|on|pm|today|tomorrow|was)"$$' | sed -e 's/^/ /' -e 's/$$/,/' >> xlat.c
|
||||
@cat $(REMINDSRCS) | grep 'tr(".*")' | sed -e 's/.*tr."/"/' -e 's/").*/"/' | LANG=C LC_ALL=C sort | uniq | grep -E -v '^"(ago|am|and|at|from now|is|hour|minute|now|on|pm|today|tomorrow|was)"$$' | sed -e 's/^/ /' -e 's/$$/,/' >> xlat.c
|
||||
@echo " NULL" >> xlat.c
|
||||
@echo "};" >> xlat.c
|
||||
|
||||
@@ -102,7 +109,7 @@ depend:
|
||||
# distributions, etc.
|
||||
|
||||
cppcheck:
|
||||
cppcheck -j`nproc` -v --force --enable=all --suppress=ConfigurationNotChecked --suppress=unmatchedSuppression --suppress=variableScope --inline-suppr .
|
||||
cppcheck -j`nproc` -v --force --enable=all --suppress=missingIncludeSystem --suppress=ConfigurationNotChecked --suppress=unmatchedSuppression --suppress=variableScope --inline-suppr --check-level=exhaustive .
|
||||
|
||||
# Build a tar file based on all files checked into git.
|
||||
distro:
|
||||
@@ -115,6 +122,8 @@ beta-tgz:
|
||||
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
|
||||
gpg --detach-sign -u dianne@skoll.ca remind-$(VERSION)-BETA-$(BETA).tar.gz
|
||||
|
||||
distro-beta: beta-tgz
|
||||
|
||||
#---------------- Stuff after this added by "make depend" -----------------
|
||||
|
||||
|
||||
|
||||
133
src/calendar.c
133
src/calendar.c
@@ -279,6 +279,7 @@ static int DidAMonth;
|
||||
static int DidAWeek;
|
||||
static int DidADay;
|
||||
|
||||
static char const *CalendarTime(int tim, int duration);
|
||||
static void ColorizeEntry(CalEntry const *e, int clamp);
|
||||
static void SortCol (CalEntry **col);
|
||||
static void DoCalendarOneWeek (int nleft);
|
||||
@@ -288,7 +289,7 @@ static int WriteCalendarRow (void);
|
||||
static void WriteWeekHeaderLine (void);
|
||||
static void WritePostHeaderLine (void);
|
||||
static void PrintLeft (char const *s, int width, char pad);
|
||||
static void PrintCentered (char const *s, int width, char *pad);
|
||||
static void PrintCentered (char const *s, int width, char const *pad);
|
||||
static int WriteOneCalLine (int dse, int wd);
|
||||
static int WriteOneColLine (int col);
|
||||
static void GenerateCalEntries (int col);
|
||||
@@ -380,7 +381,7 @@ despace(char const *s)
|
||||
return buf;
|
||||
}
|
||||
|
||||
void PrintJSONChar(char c) {
|
||||
static void PrintJSONChar(char c) {
|
||||
switch(c) {
|
||||
case '\b': printf("\\b"); break;
|
||||
case '\f': printf("\\f"); break;
|
||||
@@ -422,7 +423,7 @@ void PrintJSONString(char const *s)
|
||||
}
|
||||
}
|
||||
|
||||
void PrintJSONStringLC(char const *s)
|
||||
static void PrintJSONStringLC(char const *s)
|
||||
{
|
||||
while (*s) {
|
||||
switch(*s) {
|
||||
@@ -466,7 +467,7 @@ void PrintJSONKeyPairString(char const *name, char const *val)
|
||||
printf("\",");
|
||||
}
|
||||
|
||||
void PrintJSONKeyPairDate(char const *name, int dse)
|
||||
static void PrintJSONKeyPairDate(char const *name, int dse)
|
||||
{
|
||||
int y, m, d;
|
||||
if (dse == NO_DATE) {
|
||||
@@ -480,7 +481,7 @@ void PrintJSONKeyPairDate(char const *name, int dse)
|
||||
|
||||
}
|
||||
|
||||
void PrintJSONKeyPairDateTime(char const *name, int dt)
|
||||
static void PrintJSONKeyPairDateTime(char const *name, int dt)
|
||||
{
|
||||
int y, m, d, h, i, k;
|
||||
if (dt == NO_TIME) {
|
||||
@@ -498,7 +499,7 @@ void PrintJSONKeyPairDateTime(char const *name, int dt)
|
||||
|
||||
}
|
||||
|
||||
void PrintJSONKeyPairTime(char const *name, int t)
|
||||
static void PrintJSONKeyPairTime(char const *name, int t)
|
||||
{
|
||||
int h, i;
|
||||
if (t == NO_TIME) {
|
||||
@@ -646,7 +647,7 @@ Colorize256(int r, int g, int b, int bg, int clamp)
|
||||
int best = -1;
|
||||
int best_dist = 0;
|
||||
int dist;
|
||||
struct xterm256_colors *cur;
|
||||
struct xterm256_colors const *cur;
|
||||
size_t i;
|
||||
|
||||
if (clamp) {
|
||||
@@ -847,6 +848,9 @@ void ProduceCalendar(void)
|
||||
if (CalMonths) {
|
||||
FromDSE(DSEToday, &y, &m, &d);
|
||||
DSEToday = DSE(y, m, 1);
|
||||
LocalDSEToday = DSEToday;
|
||||
LocalSysTime = 0;
|
||||
SysTime = 0;
|
||||
GenerateCalEntries(-1);
|
||||
DidAMonth = 0;
|
||||
if (PsCal == PSCAL_LEVEL3) {
|
||||
@@ -861,8 +865,13 @@ void ProduceCalendar(void)
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (MondayFirst) DSEToday -= (DSEToday%7);
|
||||
else DSEToday -= ((DSEToday+1)%7);
|
||||
if (MondayFirst) {
|
||||
DSEToday -= (DSEToday%7);
|
||||
LocalDSEToday -= (LocalDSEToday%7);
|
||||
} else {
|
||||
DSEToday -= ((DSEToday+1)%7);
|
||||
LocalDSEToday -= ((LocalDSEToday+1)%7);
|
||||
}
|
||||
|
||||
GenerateCalEntries(-1);
|
||||
|
||||
@@ -911,7 +920,7 @@ static void DoCalendarOneWeek(int nleft)
|
||||
int y, m, d, done, i, l, wd;
|
||||
char buf[128];
|
||||
int LinesWritten = 0;
|
||||
int OrigDse = DSEToday;
|
||||
int OrigDse = LocalDSEToday;
|
||||
|
||||
InitMoonsAndShades();
|
||||
/* Fill in the column entries */
|
||||
@@ -919,6 +928,7 @@ static void DoCalendarOneWeek(int nleft)
|
||||
ColToDay[i] = DayOf(DSEToday);
|
||||
GenerateCalEntries(i);
|
||||
DSEToday++;
|
||||
LocalDSEToday++;
|
||||
}
|
||||
|
||||
/* Figure out weekday of first column */
|
||||
@@ -1204,6 +1214,7 @@ static int WriteCalendarRow(void)
|
||||
GenerateCalEntries(i);
|
||||
ColToDay[i] = DayOf(DSEToday);
|
||||
DSEToday++;
|
||||
LocalDSEToday++;
|
||||
}
|
||||
|
||||
/* Output the entries */
|
||||
@@ -1387,7 +1398,7 @@ static void PrintLeft(char const *s, int width, char pad)
|
||||
/* Center a piece of text */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void PrintCentered(char const *s, int width, char *pad)
|
||||
static void PrintCentered(char const *s, int width, char const *pad)
|
||||
{
|
||||
#ifndef REM_USE_WCHAR
|
||||
int len = strlen(s);
|
||||
@@ -1776,6 +1787,7 @@ static void GenerateCalEntries(int col)
|
||||
case T_ErrMsg: r=DoErrMsg(&p); break;
|
||||
case T_Rem: r=DoCalRem(&p, col); break;
|
||||
case T_If: r=DoIf(&p); break;
|
||||
case T_Return: r=DoReturn(&p); break;
|
||||
case T_IfTrig: r=DoIfTrig(&p); break;
|
||||
case T_Else: r=DoElse(&p); break;
|
||||
case T_EndIf: r=DoEndif(&p); break;
|
||||
@@ -1805,6 +1817,18 @@ static void GenerateCalEntries(int col)
|
||||
break;
|
||||
case T_Pop: r=PopOmitContext(&p); break;
|
||||
case T_Push: r=PushOmitContext(&p); break;
|
||||
case T_PushVars:
|
||||
r=PushVars(&p);
|
||||
break;
|
||||
case T_PopVars:
|
||||
r=PopVars(&p);
|
||||
break;
|
||||
case T_PushFuncs:
|
||||
r=PushUserFuncs(&p);
|
||||
break;
|
||||
case T_PopFuncs:
|
||||
r=PopUserFuncs(&p);
|
||||
break;
|
||||
case T_Preserve: r=DoPreserve(&p); break;
|
||||
case T_Expr: r = DoExpr(&p); break;
|
||||
case T_Translate: r = DoTranslate(&p); break;
|
||||
@@ -1918,6 +1942,17 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (trig.tz != NULL && tim.ttime == NO_TIME) {
|
||||
FreeTrig(&trig);
|
||||
return E_TZ_NO_AT;
|
||||
}
|
||||
|
||||
/* An empty string for time zone is just a missing time zone */
|
||||
if (trig.tz != NULL && !*trig.tz) {
|
||||
free( (void *) trig.tz);
|
||||
trig.tz = NULL;
|
||||
}
|
||||
|
||||
if (trig.typ == MSG_TYPE ||
|
||||
trig.typ == CAL_TYPE ||
|
||||
trig.typ == MSF_TYPE) {
|
||||
@@ -1937,7 +1972,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
return E_EOLN;
|
||||
}
|
||||
if (trig.typ == SAT_TYPE) {
|
||||
EnterTimezone(trig.tz);
|
||||
r=DoSatRemind(&trig, &tim, p);
|
||||
ExitTimezone(trig.tz);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
@@ -2005,7 +2042,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
} else {
|
||||
/* Calculate the trigger date */
|
||||
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||
EnterTimezone(trig.tz);
|
||||
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 1);
|
||||
ExitTimezone(trig.tz);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
@@ -2015,6 +2054,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
}
|
||||
|
||||
/* Adjust trigger date/time to time zone */
|
||||
dse = AdjustTriggerForTimeZone(&trig, dse, &tim);
|
||||
|
||||
/* Add to global OMITs if so indicated */
|
||||
if (trig.addomit) {
|
||||
r = AddGlobalOmit(dse);
|
||||
@@ -2036,6 +2078,13 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Filter unwanted events/todos */
|
||||
if ((TodoFilter == ONLY_TODOS && !trig.is_todo) ||
|
||||
(TodoFilter == ONLY_EVENTS && trig.is_todo)) {
|
||||
FreeTrig(&trig);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Save nonconst_expr flag */
|
||||
nonconst_expr = p->nonconst_expr;
|
||||
/* Convert PS and PSF to PASSTHRU */
|
||||
@@ -2135,14 +2184,18 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
(void) sscanf(DBufValue(&pre_buf), "%d %d %d",
|
||||
&col_r, &col_g, &col_b);
|
||||
if (col_r < 0) col_r = 0;
|
||||
else if (col_r > 255) col_r = 255;
|
||||
if (col_g < 0) col_g = 0;
|
||||
else if (col_g > 255) col_g = 255;
|
||||
if (col_b < 0) col_b = 0;
|
||||
else if (col_b > 255) col_b = 255;
|
||||
if (!PsCal && !DoSimpleCalendar) {
|
||||
if (col_r < 0 || col_g < 0 || col_b < 0 ||
|
||||
col_r > 255 || col_g > 255 || col_b > 255) {
|
||||
is_color = 0;
|
||||
col_r = -1;
|
||||
col_g = -1;
|
||||
col_b = -1;
|
||||
trig.passthru[0] = 0;
|
||||
DBufFree(&pre_buf);
|
||||
} else {
|
||||
if (!PsCal && !DoSimpleCalendar) {
|
||||
DBufFree(&pre_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2274,6 +2327,9 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
e->nonconst_expr = nonconst_expr;
|
||||
e->if_depth = get_if_pointer() - get_base_if_pointer();
|
||||
e->trig = trig;
|
||||
if (e->trig.tz) {
|
||||
e->trig.tz = StrDup(e->trig.tz);
|
||||
}
|
||||
e->tt = tim;
|
||||
#ifdef REM_USE_WCHAR
|
||||
e->wc_pos = NULL;
|
||||
@@ -2342,7 +2398,7 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void WriteSimpleEntryProtocol1(CalEntry *e)
|
||||
static void WriteSimpleEntryProtocol1(CalEntry const *e)
|
||||
{
|
||||
if (e->passthru[0]) {
|
||||
printf(" %s", e->passthru);
|
||||
@@ -2370,6 +2426,9 @@ static void WriteSimpleEntryProtocol1(CalEntry *e)
|
||||
void WriteJSONTimeTrigger(TimeTrig const *tt)
|
||||
{
|
||||
PrintJSONKeyPairTime("time", tt->ttime);
|
||||
if (tt->ttime != tt->ttime_orig) {
|
||||
PrintJSONKeyPairTime("time_in_tz", tt->ttime_orig);
|
||||
}
|
||||
PrintJSONKeyPairTime("nexttime", tt->nexttime);
|
||||
PrintJSONKeyPairInt("tdelta", tt->delta);
|
||||
PrintJSONKeyPairInt("trep", tt->rep);
|
||||
@@ -2413,7 +2472,7 @@ WriteJSONInfoChain(TrigInfo *ti)
|
||||
}
|
||||
printf("},");
|
||||
}
|
||||
void WriteJSONTrigger(Trigger const *t, int include_tags, int today)
|
||||
void WriteJSONTrigger(Trigger const *t, int include_tags)
|
||||
{
|
||||
/* wd is an array of days from 0=monday to 6=sunday.
|
||||
We convert to array of strings */
|
||||
@@ -2441,6 +2500,8 @@ void WriteJSONTrigger(Trigger const *t, int include_tags, int today)
|
||||
if (t->y != NO_YR) {
|
||||
PrintJSONKeyPairInt("y", t->y);
|
||||
}
|
||||
PrintJSONKeyPairInt("is_todo", t->is_todo);
|
||||
PrintJSONKeyPairDate("complete_through", t->complete_through);
|
||||
if (t->back) {
|
||||
PrintJSONKeyPairInt("back", t->back);
|
||||
}
|
||||
@@ -2486,12 +2547,23 @@ void WriteJSONTrigger(Trigger const *t, int include_tags, int today)
|
||||
if (t->once != NO_ONCE) {
|
||||
PrintJSONKeyPairInt("once", t->once);
|
||||
}
|
||||
if (t->scanfrom != today) {
|
||||
PrintJSONKeyPairDate("scanfrom", t->scanfrom);
|
||||
if (t->scanfrom != NO_SCANFROM) {
|
||||
if (t->scanfrom >= 0) {
|
||||
PrintJSONKeyPairDate("scanfrom", t->scanfrom);
|
||||
} else {
|
||||
PrintJSONKeyPairInt("scanfrom", t->scanfrom);
|
||||
}
|
||||
}
|
||||
if (t->max_overdue >= 0) {
|
||||
PrintJSONKeyPairInt("max_overdue", t->max_overdue);
|
||||
}
|
||||
PrintJSONKeyPairDate("from", t->from);
|
||||
PrintJSONKeyPairInt("priority", t->priority);
|
||||
PrintJSONKeyPairDateTime("eventstart", t->eventstart);
|
||||
if (t->eventstart_orig != NO_TIME &&
|
||||
t->eventstart_orig != t->eventstart) {
|
||||
PrintJSONKeyPairDateTime("eventstart_in_tz", t->eventstart_orig);
|
||||
}
|
||||
if (t->eventduration != NO_TIME) {
|
||||
PrintJSONKeyPairInt("eventduration", t->eventduration);
|
||||
}
|
||||
@@ -2513,9 +2585,10 @@ void WriteJSONTrigger(Trigger const *t, int include_tags, int today)
|
||||
}
|
||||
PrintJSONKeyPairString("tags", DBufValue(&(t->tags)));
|
||||
}
|
||||
PrintJSONKeyPairString("tz", t->tz);
|
||||
}
|
||||
|
||||
static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
||||
static void WriteSimpleEntryProtocol2(CalEntry *e)
|
||||
{
|
||||
char const *s;
|
||||
if (DoPrefixLineNo) {
|
||||
@@ -2535,6 +2608,9 @@ static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
||||
}
|
||||
if (e->time != NO_TIME) {
|
||||
PrintJSONKeyPairInt("time", e->time);
|
||||
if (e->tt.ttime_orig != e->tt.ttime) {
|
||||
PrintJSONKeyPairInt("time_in_tz", e->tt.ttime_orig);
|
||||
}
|
||||
if (e->tt.delta) {
|
||||
PrintJSONKeyPairInt("tdelta", e->tt.delta);
|
||||
}
|
||||
@@ -2542,7 +2618,7 @@ static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
|
||||
PrintJSONKeyPairInt("trep", e->tt.rep);
|
||||
}
|
||||
}
|
||||
WriteJSONTrigger(&e->trig, 0, today);
|
||||
WriteJSONTrigger(&e->trig, 0);
|
||||
if (e->nonconst_expr) {
|
||||
PrintJSONKeyPairInt("nonconst_expr", e->nonconst_expr);
|
||||
}
|
||||
@@ -2647,7 +2723,7 @@ static void WriteSimpleEntries(int col, int dse)
|
||||
}
|
||||
DidADay = 1;
|
||||
printf("{\"date\":\"%04d-%02d-%02d\",", y, m+1, d);
|
||||
WriteSimpleEntryProtocol2(e, dse);
|
||||
WriteSimpleEntryProtocol2(e);
|
||||
printf("}");
|
||||
if (PsCal != PSCAL_LEVEL3) {
|
||||
printf("\n");
|
||||
@@ -2782,7 +2858,7 @@ static void WriteCalDays(void)
|
||||
/* This takes into account duration */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
char const *
|
||||
static char const *
|
||||
CalendarTime(int tim, int duration)
|
||||
{
|
||||
static char buf[128];
|
||||
@@ -2880,7 +2956,8 @@ char const *SimpleTime(int tim)
|
||||
if (h == 0) hh=12;
|
||||
else if (h > 12) hh=h-12;
|
||||
else hh=h;
|
||||
snprintf(buf, sizeof(buf), "%d%c%02d%.64s ", hh, TimeSep, min, (h>=12) ? tr("pm") : tr("am"));
|
||||
snprintf(buf, sizeof(buf), "%d%c%02d%.64s ", hh, TimeSep, min, (h>=12) ? tr("pm") :
|
||||
tr("am"));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `readline' function. */
|
||||
#undef HAVE_READLINE
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
@@ -81,6 +84,12 @@
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
/* Define to 1 if you have the <readline/history.h> header file. */
|
||||
#undef HAVE_READLINE_HISTORY_H
|
||||
|
||||
/* Define to 1 if you have the <readline/readline.h> header file. */
|
||||
#undef HAVE_READLINE_READLINE_H
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
|
||||
12
src/custom.h
12
src/custom.h
@@ -159,3 +159,15 @@
|
||||
#else
|
||||
#undef REM_USE_WCHAR
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H)
|
||||
#define USE_READLINE 1
|
||||
#else
|
||||
#undef USE_READLINE
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H) && defined(HAVE_READLINE_HISTORY_H)
|
||||
#define USE_READLINE_HISTORY 1
|
||||
#else
|
||||
#undef USE_READLINE_HISTORY
|
||||
#endif
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
/* The default values are initially set to the city hall in Ottawa, */
|
||||
/* Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define DEFAULT_LATITUDE 45.420556
|
||||
#define DEFAULT_LONGITUDE -75.689722
|
||||
#define DEFAULT_LATITUDE 45.42055555555555
|
||||
#define DEFAULT_LONGITUDE -75.68944444444445
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
@@ -159,3 +159,15 @@
|
||||
#else
|
||||
#undef REM_USE_WCHAR
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H)
|
||||
#define USE_READLINE 1
|
||||
#else
|
||||
#undef USE_READLINE
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H) && defined(HAVE_READLINE_HISTORY_H)
|
||||
#define USE_READLINE_HISTORY 1
|
||||
#else
|
||||
#undef USE_READLINE_HISTORY
|
||||
#endif
|
||||
|
||||
12
src/dedupe.c
12
src/dedupe.c
@@ -28,9 +28,9 @@ typedef struct dedupe_entry {
|
||||
|
||||
static hash_table DedupeTable;
|
||||
|
||||
static unsigned int DedupeHashFunc(void *x)
|
||||
static unsigned int DedupeHashFunc(void const *x)
|
||||
{
|
||||
DedupeEntry *e = (DedupeEntry *) x;
|
||||
DedupeEntry const *e = (DedupeEntry const *) x;
|
||||
unsigned int hashval = (unsigned int) e->trigger_date;
|
||||
if (e->trigger_time != NO_TIME) {
|
||||
hashval += (unsigned int) e->trigger_time;
|
||||
@@ -39,10 +39,10 @@ static unsigned int DedupeHashFunc(void *x)
|
||||
return hashval;
|
||||
}
|
||||
|
||||
static int CompareDedupes(void *x, void *y)
|
||||
static int CompareDedupes(void const *x, void const *y)
|
||||
{
|
||||
DedupeEntry *a = (DedupeEntry *) x;
|
||||
DedupeEntry *b = (DedupeEntry *) y;
|
||||
DedupeEntry const *a = (DedupeEntry const *) x;
|
||||
DedupeEntry const *b = (DedupeEntry const *) y;
|
||||
if (a->trigger_date != b->trigger_date) return a->trigger_date - b->trigger_date;
|
||||
if (a->trigger_time != b->trigger_time) return a->trigger_time - b->trigger_time;
|
||||
return strcmp(a->body, b->body);
|
||||
@@ -122,7 +122,7 @@ InsertDedupeEntry(int trigger_date, int trigger_time, char const *body)
|
||||
int
|
||||
ShouldDedupe(int trigger_date, int trigger_time, char const *body)
|
||||
{
|
||||
DedupeEntry *e = FindDedupeEntry(trigger_date, trigger_time, body);
|
||||
DedupeEntry const *e = FindDedupeEntry(trigger_date, trigger_time, body);
|
||||
|
||||
if (e) {
|
||||
return 1;
|
||||
|
||||
708
src/dorem.c
708
src/dorem.c
@@ -18,6 +18,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
@@ -29,8 +30,202 @@ static int ParseLocalOmit (ParsePtr s, Trigger *t);
|
||||
static int ParseScanFrom (ParsePtr s, Trigger *t, int type);
|
||||
static int ParsePriority (ParsePtr s, Trigger *t);
|
||||
static int ParseUntil (ParsePtr s, Trigger *t, int type);
|
||||
static int ShouldTriggerBasedOnWarn (Trigger *t, int dse, int *err);
|
||||
static int ComputeTrigDuration(TimeTrig *t);
|
||||
static int ShouldTriggerBasedOnWarn (Trigger const *t, int dse, int *err);
|
||||
static int ComputeTrigDuration(TimeTrig const *t);
|
||||
|
||||
static int CalledEnterTimezone = 0;
|
||||
|
||||
int AdjustTriggerForTimeZone(Trigger *trig, int dse, TimeTrig *tim)
|
||||
{
|
||||
int y, m, d, hour, minute;
|
||||
int r;
|
||||
struct tm tm;
|
||||
if (!trig->tz || dse < 0) {
|
||||
/* Already local time or did not compute trigger date - no adjustments needed */
|
||||
return dse;
|
||||
}
|
||||
FromDSE(dse, &y, &m, &d);
|
||||
hour = tim->ttime_orig / 60;
|
||||
minute = tim->ttime_orig % 60;
|
||||
|
||||
r = tz_convert(y, m, d, hour, minute, trig->tz, LocalTimeZone, &tm);
|
||||
if (r != 1) {
|
||||
Wprint(tr("Error adjusting trigger to local time zone"));
|
||||
return dse;
|
||||
}
|
||||
|
||||
dse = DSE(tm.tm_year+1900, tm.tm_mon, tm.tm_mday);
|
||||
tim->ttime = tm.tm_hour * 60 + tm.tm_min;
|
||||
/* Adjust eventstart also */
|
||||
trig->eventstart = dse * MINUTES_PER_DAY + tim->ttime;
|
||||
SaveAllTriggerInfo(trig, tim, dse, tim->ttime, 1);
|
||||
if (DebugFlag & DB_PRTTRIG) {
|
||||
fprintf(ErrFp, "%s(%s): Trig(tz_adj %s) = %s, %d %s, %d AT %02d:%02d",
|
||||
GetCurrentFilename(), line_range(LineNoStart, LineNo), trig->tz,
|
||||
get_day_name(dse % 7), tm.tm_mday, get_month_name(tm.tm_mon),
|
||||
1900 + tm.tm_year, tim->ttime / 60, tim->ttime % 60);
|
||||
if (tim->duration != NO_TIME) {
|
||||
fprintf(ErrFp, " DURATION %02d:%02d",
|
||||
(tim->duration / 60),
|
||||
(tim->duration % 60));
|
||||
}
|
||||
fprintf(ErrFp, "\n");
|
||||
}
|
||||
return dse;
|
||||
}
|
||||
|
||||
void ExitTimezone(char const *tz)
|
||||
{
|
||||
if (!CalledEnterTimezone) {
|
||||
fprintf(stderr, "ExitTimezone called without EnterTimezone!!!\n");
|
||||
abort();
|
||||
}
|
||||
CalledEnterTimezone = 0;
|
||||
if (!tz || !*tz) {
|
||||
/* Nothing to do */
|
||||
return;
|
||||
}
|
||||
/* Revert to our local time zone */
|
||||
(void) tz_set_tz(LocalTimeZone);
|
||||
|
||||
DSEToday = LocalDSEToday;
|
||||
SysTime = LocalSysTime;
|
||||
FromDSE(DSEToday, &CurYear, &CurMon, &CurDay);
|
||||
|
||||
if (DebugFlag & DB_SWITCH_ZONE) {
|
||||
fprintf(stderr, "TZ exit %s: %04d-%02d-%02d %02d:%02d\n", tz,
|
||||
CurYear, CurMon+1, CurDay, SysTime / 3600, (SysTime/60) % 60);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void EnterTimezone(char const *tz)
|
||||
{
|
||||
struct tm tm;
|
||||
int y, m, d;
|
||||
time_t t;
|
||||
|
||||
if (CalledEnterTimezone) {
|
||||
fprintf(stderr, "EnterTimezone called twice in a row!!!\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
CalledEnterTimezone = 1;
|
||||
|
||||
if (!tz || !*tz) {
|
||||
/* Stay in local timezone */
|
||||
return;
|
||||
}
|
||||
|
||||
FromDSE(LocalDSEToday, &y, &m, &d);
|
||||
tm.tm_sec = 0;
|
||||
tm.tm_min = (LocalSysTime/60) % 60;
|
||||
tm.tm_hour = LocalSysTime / 3600;
|
||||
tm.tm_mday = d;
|
||||
tm.tm_mon = m;
|
||||
tm.tm_year = y - 1900;
|
||||
tm.tm_wday = 0; /* Ignored by mktime */
|
||||
tm.tm_yday = 0; /* Ignored by mktime */
|
||||
tm.tm_isdst = -1; /* Information not available */
|
||||
|
||||
t = mktime(&tm); /* Convert local time to seconds */
|
||||
|
||||
/* Set target timezone */
|
||||
(void) tz_set_tz(tz);
|
||||
|
||||
/* Update our variables */
|
||||
(void) localtime_r(&t, &tm);
|
||||
|
||||
SysTime = tm.tm_min * 60 + (tm.tm_hour * 3600);
|
||||
CurDay = tm.tm_mday;
|
||||
CurMon = tm.tm_mon;
|
||||
CurYear = tm.tm_year + 1900;
|
||||
/* Adjust DSEToday back by a day if midnight in our time zone requires it */
|
||||
if (SysTime < LocalSysTime) {
|
||||
DSEToday--;
|
||||
FromDSE(DSEToday, &CurYear, &CurMon, &CurDay);
|
||||
}
|
||||
|
||||
if (DebugFlag & DB_SWITCH_ZONE) {
|
||||
fprintf(stderr, "TZ enter %s: %04d-%02d-%02d %02d:%02d\n", tz,
|
||||
CurYear, CurMon+1, CurDay, SysTime / 3600, (SysTime/60) % 60);
|
||||
}
|
||||
}
|
||||
|
||||
void remove_trailing_newlines(DynamicBuffer *buf)
|
||||
{
|
||||
char *s = (char *) DBufValue(buf) + DBufLen(buf) - 1;
|
||||
while (s >= DBufValue(buf)) {
|
||||
if (*s == '\n') {
|
||||
*s = 0;
|
||||
s--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static int todo_filtered(Trigger const *t)
|
||||
{
|
||||
if (t->is_todo && TodoFilter == ONLY_EVENTS) return 1;
|
||||
if (!t->is_todo && TodoFilter == ONLY_TODOS) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
get_raw_scanfrom(Trigger const *t)
|
||||
{
|
||||
if (t->from != NO_DATE) {
|
||||
if (t->from > DSEToday) return t->from;
|
||||
return DSEToday;
|
||||
}
|
||||
if (t->scanfrom == NO_SCANFROM) return NO_SCANFROM;
|
||||
if (t->scanfrom > 0) return t->scanfrom;
|
||||
|
||||
/* Relative SCANFROM is negative, so subtract from today() */
|
||||
return DSEToday + t->scanfrom;
|
||||
}
|
||||
|
||||
int
|
||||
get_scanfrom(Trigger const *t)
|
||||
{
|
||||
int calmode = (DoSimpleCalendar || DoCalendar) ? 1 : 0;
|
||||
|
||||
/* TODOs are treated just like events in calendar mode */
|
||||
if (!calmode && t->is_todo && t->from != NO_DATE) {
|
||||
if (t->complete_through != NO_DATE) {
|
||||
if (t->complete_through+1 > t->from) {
|
||||
return t->complete_through+1;
|
||||
} else {
|
||||
return t->from;
|
||||
}
|
||||
} else {
|
||||
return t->from;
|
||||
}
|
||||
}
|
||||
if (get_raw_scanfrom(t) != NO_SCANFROM) {
|
||||
if (!calmode && t->complete_through != NO_DATE) {
|
||||
if (t->complete_through+1 > get_raw_scanfrom(t)) {
|
||||
return t->complete_through+1;
|
||||
} else {
|
||||
return get_raw_scanfrom(t);
|
||||
}
|
||||
} else {
|
||||
return get_raw_scanfrom(t);
|
||||
}
|
||||
}
|
||||
if (!calmode) {
|
||||
if (t->complete_through != NO_DATE) {
|
||||
return t->complete_through+1;
|
||||
}
|
||||
if (t->is_todo) {
|
||||
/* TODO with no COMPLETE-THROUGH.
|
||||
Scan from the beginning of time */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DSEToday;
|
||||
}
|
||||
|
||||
static int
|
||||
ensure_expr_references_first_local_arg(expr_node *node)
|
||||
@@ -179,7 +374,7 @@ static void ensure_satnode_mentions_trigdate(expr_node *node)
|
||||
|
||||
|
||||
static int
|
||||
ComputeTrigDuration(TimeTrig *t)
|
||||
ComputeTrigDuration(TimeTrig const *t)
|
||||
{
|
||||
if (t->ttime == NO_TIME ||
|
||||
t->duration == NO_TIME) {
|
||||
@@ -213,6 +408,30 @@ int DoRem(ParsePtr p)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (trig.tz != NULL && tim.ttime == NO_TIME) {
|
||||
PurgeEchoLine("%s\n", CurLine);
|
||||
FreeTrig(&trig);
|
||||
return E_TZ_NO_AT;
|
||||
}
|
||||
|
||||
/* An empty string for time zone is just a missing time zone */
|
||||
if (trig.tz != NULL && !*trig.tz) {
|
||||
free( (void *) trig.tz);
|
||||
trig.tz = NULL;
|
||||
}
|
||||
|
||||
if (trig.complete_through != NO_DATE && !trig.is_todo) {
|
||||
PurgeEchoLine("%s\n", CurLine);
|
||||
FreeTrig(&trig);
|
||||
return E_COMPLETE_WITHOUT_TODO;
|
||||
}
|
||||
|
||||
if (trig.max_overdue >= 0 && !trig.is_todo) {
|
||||
PurgeEchoLine("%s\n", CurLine);
|
||||
FreeTrig(&trig);
|
||||
return E_MAX_OVERDUE_WITHOUT_TODO;
|
||||
}
|
||||
|
||||
if (trig.typ == NO_TYPE) {
|
||||
if (!Hush) {
|
||||
PurgeEchoLine("%s\n", "#!P! Cannot parse next line");
|
||||
@@ -226,7 +445,9 @@ int DoRem(ParsePtr p)
|
||||
PurgeEchoLine("%s\n", "#!P: Cannot purge SATISFY-type reminders");
|
||||
}
|
||||
PurgeEchoLine("%s\n", CurLine);
|
||||
EnterTimezone(trig.tz);
|
||||
r=DoSatRemind(&trig, &tim, p);
|
||||
ExitTimezone(trig.tz);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = OK;
|
||||
@@ -286,7 +507,9 @@ int DoRem(ParsePtr p)
|
||||
}
|
||||
} else {
|
||||
/* Calculate the trigger date */
|
||||
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||
EnterTimezone(trig.tz);
|
||||
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 1);
|
||||
ExitTimezone(trig.tz);
|
||||
if (r) {
|
||||
if (PurgeMode) {
|
||||
if (!Hush) {
|
||||
@@ -302,6 +525,9 @@ int DoRem(ParsePtr p)
|
||||
}
|
||||
}
|
||||
|
||||
/* Adjust trigger date/time to time zone */
|
||||
dse = AdjustTriggerForTimeZone(&trig, dse, &tim);
|
||||
|
||||
/* Add to global OMITs if so indicated */
|
||||
if (trig.addomit) {
|
||||
r = AddGlobalOmit(dse);
|
||||
@@ -311,7 +537,7 @@ int DoRem(ParsePtr p)
|
||||
}
|
||||
}
|
||||
if (PurgeMode) {
|
||||
if (trig.expired || dse < DSEToday) {
|
||||
if (trig.expired || (!trig.is_todo && dse < DSEToday)) {
|
||||
if (p->expr_happened) {
|
||||
if (p->nonconst_expr) {
|
||||
if (!Hush) {
|
||||
@@ -339,8 +565,11 @@ int DoRem(ParsePtr p)
|
||||
if (dse == DSEToday &&
|
||||
!(!IgnoreOnce &&
|
||||
trig.once != NO_ONCE &&
|
||||
GetOnceDate() == DSEToday))
|
||||
QueueReminder(p, &trig, &tim, trig.sched);
|
||||
GetOnceDate() == DSEToday)) {
|
||||
if (!todo_filtered(&trig)) {
|
||||
QueueReminder(p, &trig, &tim, trig.sched);
|
||||
}
|
||||
}
|
||||
/* If we're in daemon mode, do nothing over here */
|
||||
if (Daemon) {
|
||||
FreeTrig(&trig);
|
||||
@@ -348,8 +577,77 @@ int DoRem(ParsePtr p)
|
||||
}
|
||||
|
||||
r = OK;
|
||||
|
||||
if (ShouldTriggerReminder(&trig, &tim, dse, &err)) {
|
||||
if ( (r=TriggerReminder(p, &trig, &tim, dse, 0, NULL)) ) {
|
||||
/* Filter unwanted events/todos */
|
||||
if (todo_filtered(&trig)) {
|
||||
FreeTrig(&trig);
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (JSONMode) {
|
||||
DynamicBuffer body;
|
||||
int y, m, d;
|
||||
int if_depth = get_if_pointer() - get_base_if_pointer();
|
||||
DBufInit(&body);
|
||||
int red=-1, green=-1, blue=-1;
|
||||
r=TriggerReminder(p, &trig, &tim, dse, 0, &body, &red, &green, &blue);
|
||||
if (r) {
|
||||
FreeTrig(&trig);
|
||||
return r;
|
||||
}
|
||||
/* Remove trailing newlines from body */
|
||||
remove_trailing_newlines(&body);
|
||||
|
||||
if (!*DBufValue(&body)) {
|
||||
FreeTrig(&trig);
|
||||
return r;
|
||||
}
|
||||
if (JSONLinesEmitted) {
|
||||
printf("},\n");
|
||||
}
|
||||
JSONLinesEmitted++;
|
||||
FromDSE(dse, &y, &m, &d);
|
||||
printf("{\"date\":\"%04d-%02d-%02d\",", y, m+1, d);
|
||||
PrintJSONKeyPairString("filename", GetCurrentFilename());
|
||||
PrintJSONKeyPairInt("lineno", LineNo);
|
||||
if (LineNoStart != LineNo) {
|
||||
PrintJSONKeyPairInt("lineno_start", LineNoStart);
|
||||
}
|
||||
PrintJSONKeyPairString("passthru", trig.passthru);
|
||||
if (trig.duration_days) {
|
||||
PrintJSONKeyPairInt("duration", trig.duration_days);
|
||||
}
|
||||
if (tim.ttime != NO_TIME) {
|
||||
PrintJSONKeyPairInt("time", tim.ttime);
|
||||
if (tim.ttime_orig != tim.ttime) {
|
||||
PrintJSONKeyPairInt("time_in_tz", tim.ttime_orig);
|
||||
}
|
||||
}
|
||||
if (p->nonconst_expr) {
|
||||
PrintJSONKeyPairInt("nonconst_expr", 1);
|
||||
}
|
||||
if (if_depth) {
|
||||
PrintJSONKeyPairInt("if_depth", if_depth);
|
||||
}
|
||||
if (tim.delta) {
|
||||
PrintJSONKeyPairInt("tdelta", tim.delta);
|
||||
}
|
||||
if (tim.rep) {
|
||||
PrintJSONKeyPairInt("trep", tim.rep);
|
||||
}
|
||||
if (red >= 0 && red <= 255 && green >= 0 && green <= 255 && blue >=0 && blue <= 255) {
|
||||
PrintJSONKeyPairInt("r", red);
|
||||
PrintJSONKeyPairInt("g", green);
|
||||
PrintJSONKeyPairInt("b", blue);
|
||||
}
|
||||
|
||||
WriteJSONTrigger(&trig, 1);
|
||||
printf("\"body\":\"");
|
||||
PrintJSONString(DBufValue(&body));
|
||||
printf("\"");
|
||||
} else {
|
||||
r=TriggerReminder(p, &trig, &tim, dse, 0, NULL, NULL, NULL, NULL);
|
||||
FreeTrig(&trig);
|
||||
return r;
|
||||
}
|
||||
@@ -369,6 +667,106 @@ int DoRem(ParsePtr p)
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* GetFullDate - get a full date, either YYYY-MM-DD or */
|
||||
/* YEAR MON DAY */
|
||||
/* */
|
||||
/* Returns OK on success or an error code on failure. Sets */
|
||||
/* *dse on success. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int GetFullDate(ParsePtr s, char const *prefix, int *dse)
|
||||
{
|
||||
Token tok;
|
||||
DynamicBuffer buf;
|
||||
int y = NO_YR, m = NO_MON, d = NO_DAY;
|
||||
int r;
|
||||
*dse = NO_DATE;
|
||||
|
||||
DBufInit(&buf);
|
||||
|
||||
while(1) {
|
||||
r = ParseToken(s, &buf);
|
||||
if (r) return r;
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
switch(tok.type) {
|
||||
case T_Year:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_YR_TWICE));
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
break;
|
||||
|
||||
case T_Month:
|
||||
DBufFree(&buf);
|
||||
if (m != NO_MON) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_MON_TWICE));
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
break;
|
||||
|
||||
case T_Day:
|
||||
DBufFree(&buf);
|
||||
if (d != NO_DAY) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_DAY_TWICE));
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
break;
|
||||
|
||||
case T_Date:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_YR_TWICE));
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
if (m != NO_MON) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_MON_TWICE));
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
if (d != NO_DAY) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_DAY_TWICE));
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
if (*dse != NO_DATE) {
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
*dse = tok.val;
|
||||
/* We're done here! */
|
||||
return OK;
|
||||
|
||||
default:
|
||||
if (tok.type == T_Illegal && tok.val < 0) {
|
||||
Eprint("%s: `%s'", GetErr(-tok.val), DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return -tok.val;
|
||||
}
|
||||
if (*dse == NO_DATE && (y == NO_YR || m == NO_MON || d == NO_DAY)) {
|
||||
Eprint("%s: %s", prefix, GetErr(E_INCOMPLETE));
|
||||
DBufFree(&buf);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
if (*dse != NO_DATE) {
|
||||
PushToken(DBufValue(&buf), s);
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
if (!DateOK(y, m, d)) {
|
||||
DBufFree(&buf);
|
||||
return E_BAD_DATE;
|
||||
}
|
||||
*dse = DSE(y, m, d);
|
||||
PushToken(DBufValue(&buf), s);
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseRem */
|
||||
@@ -383,6 +781,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
DynamicBuffer buf;
|
||||
Token tok;
|
||||
int y, m, d;
|
||||
int dse;
|
||||
int seen_delta = 0;
|
||||
|
||||
DBufInit(&buf);
|
||||
@@ -401,7 +800,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
trig->addomit = 0;
|
||||
trig->noqueue = 0;
|
||||
trig->typ = NO_TYPE;
|
||||
trig->scanfrom = NO_DATE;
|
||||
trig->scanfrom = NO_SCANFROM;
|
||||
trig->from = NO_DATE;
|
||||
trig->priority = DefaultPrio;
|
||||
trig->sched[0] = 0;
|
||||
@@ -409,17 +808,23 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
trig->omitfunc[0] = 0;
|
||||
trig->duration_days = 0;
|
||||
trig->eventstart = NO_TIME;
|
||||
trig->eventstart_orig = NO_TIME;
|
||||
trig->eventduration = NO_TIME;
|
||||
trig->maybe_uncomputable = 0;
|
||||
DBufInit(&(trig->tags));
|
||||
trig->passthru[0] = 0;
|
||||
tim->ttime = NO_TIME;
|
||||
tim->ttime_orig = NO_TIME;
|
||||
tim->delta = DefaultTDelta;
|
||||
tim->rep = NO_REP;
|
||||
tim->duration = NO_TIME;
|
||||
trig->need_wkday = 0;
|
||||
trig->is_todo = 0;
|
||||
trig->max_overdue = -1;
|
||||
trig->complete_through = NO_DATE;
|
||||
trig->adj_for_last = 0;
|
||||
trig->infos = NULL;
|
||||
trig->tz = NULL;
|
||||
|
||||
int parsing = 1;
|
||||
while(parsing) {
|
||||
@@ -430,6 +835,11 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
/* Figure out what we've got */
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
switch(tok.type) {
|
||||
case T_Todo:
|
||||
if (trig->is_todo) return E_TODO_TWICE;
|
||||
trig->is_todo = 1;
|
||||
break;
|
||||
|
||||
case T_In:
|
||||
/* Completely ignored */
|
||||
DBufFree(&buf);
|
||||
@@ -477,6 +887,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
trig->m = m;
|
||||
trig->d = d;
|
||||
tim->ttime = (tok.val % MINUTES_PER_DAY);
|
||||
tim->ttime_orig = tim->ttime;
|
||||
break;
|
||||
|
||||
case T_WkDay:
|
||||
@@ -502,6 +913,25 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
trig->skip = tok.val;
|
||||
break;
|
||||
|
||||
case T_MaxOverdue:
|
||||
if (trig->max_overdue >= 0) return E_MAX_OVERDUE_TWICE;
|
||||
DBufFree(&buf);
|
||||
r = ParseToken(s, &buf);
|
||||
if (r) return r;
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
DBufFree(&buf);
|
||||
if (tok.type == T_Illegal) {
|
||||
return -tok.val;
|
||||
}
|
||||
if (tok.type != T_Day && tok.type != T_Year && tok.type != T_Number) {
|
||||
return E_EXPECTING_NUMBER;
|
||||
}
|
||||
if (tok.val < 0) {
|
||||
return E_2LOW;
|
||||
}
|
||||
trig->max_overdue = tok.val;
|
||||
break;
|
||||
|
||||
case T_Priority:
|
||||
DBufFree(&buf);
|
||||
r=ParsePriority(s, trig);
|
||||
@@ -513,6 +943,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
DBufFree(&buf);
|
||||
if (tim->ttime != NO_TIME) return E_TIME_TWICE;
|
||||
tim->ttime = tok.val;
|
||||
tim->ttime_orig = tok.val;
|
||||
r = ParseTimeTrig(s, tim);
|
||||
if (r) return r;
|
||||
trig->duration_days = ComputeTrigDuration(tim);
|
||||
@@ -556,6 +987,13 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_CompleteThrough:
|
||||
if (trig->complete_through != NO_DATE) return E_COMPLETE_THROUGH_TWICE;
|
||||
r = GetFullDate(s, "COMPLETE-THROUGH", &dse);
|
||||
if (r != OK) return r;
|
||||
trig->complete_through = dse;
|
||||
break;
|
||||
|
||||
case T_Until:
|
||||
DBufFree(&buf);
|
||||
r=ParseUntil(s, trig, tok.type);
|
||||
@@ -662,6 +1100,22 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
DBufFree(&buf);
|
||||
break;
|
||||
|
||||
case T_Tz:
|
||||
if (trig->tz) {
|
||||
return E_TZ_SPECIFIED_TWICE;
|
||||
}
|
||||
|
||||
r = ParseTokenOrQuotedString(s, &buf);
|
||||
if (r != OK) {
|
||||
return r;
|
||||
}
|
||||
trig->tz = StrDup(DBufValue(&buf));
|
||||
if (!trig->tz) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
DBufFree(&buf);
|
||||
break;
|
||||
|
||||
case T_Info:
|
||||
r = ParseQuotedString(s, &buf);
|
||||
if (r != OK) {
|
||||
@@ -767,8 +1221,8 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
if (trig->until != NO_UNTIL && trig->until < trig->from) {
|
||||
Wprint(tr("Warning: UNTIL/THROUGH date earlier than FROM date"));
|
||||
}
|
||||
} else if (trig->scanfrom != NO_DATE) {
|
||||
if (trig->until != NO_UNTIL && trig->until < trig->scanfrom) {
|
||||
} else if (get_raw_scanfrom(trig) != NO_SCANFROM) {
|
||||
if (trig->until != NO_UNTIL && trig->until < get_raw_scanfrom(trig)) {
|
||||
Wprint(tr("Warning: UNTIL/THROUGH date earlier than SCANFROM date"));
|
||||
}
|
||||
}
|
||||
@@ -778,11 +1232,6 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
Wprint(tr("Warning: Useless use of UNTIL with fully-specified date and no *rep"));
|
||||
}
|
||||
|
||||
/* Set scanfrom to default if not set explicitly */
|
||||
if (trig->scanfrom == NO_DATE) {
|
||||
trig->scanfrom = DSEToday;
|
||||
}
|
||||
|
||||
/* Check that any SCHED / WARN / OMITFUNC functions refer to
|
||||
their arguments */
|
||||
check_trigger_function(trig->sched, "SCHED");
|
||||
@@ -813,6 +1262,7 @@ static int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
|
||||
DBufFree(&buf);
|
||||
if (tim->ttime != NO_TIME) return E_TIME_TWICE;
|
||||
tim->ttime = tok.val;
|
||||
tim->ttime_orig = tok.val;
|
||||
break;
|
||||
|
||||
case T_Delta:
|
||||
@@ -884,93 +1334,25 @@ static int ParseLocalOmit(ParsePtr s, Trigger *t)
|
||||
/***************************************************************/
|
||||
static int ParseUntil(ParsePtr s, Trigger *t, int type)
|
||||
{
|
||||
int y = NO_YR,
|
||||
m = NO_MON,
|
||||
d = NO_DAY;
|
||||
|
||||
char const *which;
|
||||
int dse;
|
||||
|
||||
if (type == T_Until) {
|
||||
which = "UNTIL";
|
||||
} else {
|
||||
which = "THROUGH";
|
||||
}
|
||||
Token tok;
|
||||
int r;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
if (t->until != NO_UNTIL) return E_UNTIL_TWICE;
|
||||
|
||||
while(1) {
|
||||
r = ParseToken(s, &buf);
|
||||
if (r) return r;
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
switch(tok.type) {
|
||||
case T_Year:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("%s: %s", which, GetErr(E_YR_TWICE));
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
break;
|
||||
|
||||
case T_Month:
|
||||
DBufFree(&buf);
|
||||
if (m != NO_MON) {
|
||||
Eprint("%s: %s", which, GetErr(E_MON_TWICE));
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
break;
|
||||
|
||||
case T_Day:
|
||||
DBufFree(&buf);
|
||||
if (d != NO_DAY) {
|
||||
Eprint("%s: %s", which, GetErr(E_DAY_TWICE));
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
break;
|
||||
|
||||
case T_Date:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("%s: %s", which, GetErr(E_YR_TWICE));
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
if (m != NO_MON) {
|
||||
Eprint("%s: %s", which, GetErr(E_MON_TWICE));
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
if (d != NO_DAY) {
|
||||
Eprint("%s: %s", which, GetErr(E_DAY_TWICE));
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
FromDSE(tok.val, &y, &m, &d);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (tok.type == T_Illegal && tok.val < 0) {
|
||||
Eprint("%s: `%s'", GetErr(-tok.val), DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return -tok.val;
|
||||
}
|
||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||
Eprint("%s: %s", which, GetErr(E_INCOMPLETE));
|
||||
DBufFree(&buf);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
if (!DateOK(y, m, d)) {
|
||||
DBufFree(&buf);
|
||||
return E_BAD_DATE;
|
||||
}
|
||||
t->until = DSE(y, m, d);
|
||||
PushToken(DBufValue(&buf), s);
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
int r = GetFullDate(s, which, &dse);
|
||||
if (r != OK) {
|
||||
return r;
|
||||
}
|
||||
|
||||
t->until = dse;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -980,12 +1362,9 @@ static int ParseUntil(ParsePtr s, Trigger *t, int type)
|
||||
/***************************************************************/
|
||||
static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
{
|
||||
int y = NO_YR,
|
||||
m = NO_MON,
|
||||
d = NO_DAY;
|
||||
|
||||
Token tok;
|
||||
int r;
|
||||
int y = NO_YR, m = NO_MON, d = NO_DAY;
|
||||
Token tok;
|
||||
DynamicBuffer buf;
|
||||
char const *word;
|
||||
|
||||
@@ -996,8 +1375,8 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
word = "FROM";
|
||||
}
|
||||
|
||||
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
|
||||
|
||||
if (t->scanfrom != NO_SCANFROM) return E_SCAN_TWICE;
|
||||
if (t->from != NO_DATE) return E_SCAN_TWICE;
|
||||
while(1) {
|
||||
r = ParseToken(s, &buf);
|
||||
if (r) return r;
|
||||
@@ -1044,8 +1423,12 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
Eprint("%s: %s", word, GetErr(E_DAY_TWICE));
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
FromDSE(tok.val, &y, &m, &d);
|
||||
break;
|
||||
if (type == FROM_TYPE) {
|
||||
t->from = tok.val;
|
||||
} else {
|
||||
t->scanfrom = tok.val;
|
||||
}
|
||||
return OK;
|
||||
|
||||
case T_Back:
|
||||
DBufFree(&buf);
|
||||
@@ -1065,15 +1448,14 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
Eprint("%s: %s", word, GetErr(E_DAY_TWICE));
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
if (tok.val < 0) {
|
||||
if (tok.val > 0) {
|
||||
tok.val = -tok.val;
|
||||
}
|
||||
FromDSE(DSEToday - tok.val, &y, &m, &d);
|
||||
/* Don't purge reminders with a relative scanfrom */
|
||||
t->scanfrom = tok.val;
|
||||
s->expr_happened = 1;
|
||||
nonconst_debug(s->nonconst_expr, tr("Relative SCANFROM counts as a non-constant expression"));
|
||||
s->nonconst_expr = 1;
|
||||
break;
|
||||
return OK;
|
||||
|
||||
default:
|
||||
if (tok.type == T_Illegal && tok.val < 0) {
|
||||
@@ -1090,14 +1472,10 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
DBufFree(&buf);
|
||||
return E_BAD_DATE;
|
||||
}
|
||||
t->scanfrom = DSE(y, m, d);
|
||||
if (type == FROM_TYPE) {
|
||||
t->from = t->scanfrom;
|
||||
if (t->scanfrom < DSEToday) {
|
||||
t->scanfrom = DSEToday;
|
||||
}
|
||||
t->from = DSE(y, m, d);
|
||||
} else {
|
||||
t->from = NO_DATE;
|
||||
t->scanfrom = DSE(y, m, d);
|
||||
}
|
||||
|
||||
PushToken(DBufValue(&buf), s);
|
||||
@@ -1115,7 +1493,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
/* Trigger the reminder if it's a RUN or MSG type. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queued, DynamicBuffer *output)
|
||||
int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig const *tim, int dse, int is_queued, DynamicBuffer *output, int *rr, int *gg, int *bb)
|
||||
{
|
||||
int r, y, m, d;
|
||||
int adjusted_for_newline = 0;
|
||||
@@ -1180,17 +1558,37 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queue
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
t->typ = MSG_TYPE;
|
||||
|
||||
if (red < 0 || green < 0 || blue < 0 || red > 255 || green > 255 || blue > 255) {
|
||||
red = -1;
|
||||
green = -1;
|
||||
blue = -1;
|
||||
t->passthru[0] = 0;
|
||||
}
|
||||
}
|
||||
/* If it's a MSG-type reminder, and no -k option was used, issue the banner. */
|
||||
if ((t->typ == MSG_TYPE || t->typ == MSF_TYPE)
|
||||
&& !DidMsgReminder && !NextMode && !msg_command && !is_queued) {
|
||||
DynamicBuffer buf2;
|
||||
DBufInit(&buf2);
|
||||
DidMsgReminder = 1;
|
||||
if (!DoSubstFromString(DBufValue(&Banner), &buf,
|
||||
if (!DoSubstFromString(DBufValue(&Banner), &buf2,
|
||||
DSEToday, NO_TIME) &&
|
||||
DBufLen(&buf)) {
|
||||
printf("%s\n", DBufValue(&buf));
|
||||
DBufLen(&buf2)) {
|
||||
if (!JSONMode) {
|
||||
printf("%s\n", DBufValue(&buf2));
|
||||
} else {
|
||||
if (JSONLinesEmitted) {
|
||||
printf("},\n");
|
||||
}
|
||||
JSONLinesEmitted++;
|
||||
printf("{\"banner\":\"");
|
||||
remove_trailing_newlines(&buf2);
|
||||
PrintJSONString(DBufValue(&buf2));
|
||||
printf("\"");
|
||||
}
|
||||
}
|
||||
DBufFree(&buf);
|
||||
DBufFree(&buf2);
|
||||
}
|
||||
|
||||
/* If it's NextMode, process as a ADVANCE_MODE-type entry, and issue
|
||||
@@ -1265,7 +1663,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queue
|
||||
}
|
||||
|
||||
/* Correct colors */
|
||||
if (UseVTColors) {
|
||||
if (JSONMode || UseVTColors) {
|
||||
if (red == -1 && green == -1 && blue == -1) {
|
||||
if (DefaultColorR != -1 && DefaultColorG != -1 && DefaultColorB != -1) {
|
||||
red = DefaultColorR;
|
||||
@@ -1279,6 +1677,17 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queue
|
||||
if (green > 255) green = 255;
|
||||
if (blue > 255) blue = 255;
|
||||
}
|
||||
if (rr) *rr = red;
|
||||
if (gg) *gg = green;
|
||||
if (bb) *bb = blue;
|
||||
|
||||
/* Don't ANSI-colorize JSON output! */
|
||||
if (JSONMode) {
|
||||
is_color = 0;
|
||||
red = -1;
|
||||
green = -1;
|
||||
blue = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put the substituted string into the substitution buffer */
|
||||
@@ -1427,16 +1836,44 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queue
|
||||
/* triggered. Sets *err non-zero in event of an error. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int dse, int *err)
|
||||
int ShouldTriggerReminder(Trigger const *t, TimeTrig const *tim, int dse, int *err)
|
||||
{
|
||||
int r, omit;
|
||||
int calmode = (DoSimpleCalendar || DoCalendar) ? 1 : 0;
|
||||
if (HideCompletedTodos) calmode = 0;
|
||||
|
||||
*err = 0;
|
||||
|
||||
/* Handle the ONCE modifier in the reminder. */
|
||||
if (!IgnoreOnce && t->once !=NO_ONCE && GetOnceDate() == DSEToday)
|
||||
return 0;
|
||||
|
||||
if (dse < DSEToday) return 0;
|
||||
/* TODOs are handled differently */
|
||||
if (t->is_todo && !calmode) {
|
||||
/* Do NOT trigger if TODO has been completed through today (or later) */
|
||||
if (t->complete_through != NO_DATE && t->complete_through >= DSEToday && dse <= t->complete_through) {
|
||||
return 0;
|
||||
}
|
||||
/* DO trigger if has not been completed through trigger date */
|
||||
if (t->complete_through == NO_DATE || t->complete_through < dse) {
|
||||
/* Trigger date is in the past - overdue, Trigger unless we're
|
||||
more than max_overdue days late */
|
||||
if (dse < DSEToday) {
|
||||
if (t->max_overdue >= 0) {
|
||||
if (dse + t->max_overdue < DSEToday) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* Trigger date in future - use normal Remind rules */
|
||||
} else {
|
||||
/* We're complete as of trigger date */
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (dse < DSEToday) return 0;
|
||||
}
|
||||
|
||||
/* Don't trigger timed reminders if DontIssueAts is true, and if the
|
||||
reminder is for today */
|
||||
@@ -1530,7 +1967,7 @@ int DoSatRemind(Trigger *trig, TimeTrig *tt, ParsePtr p)
|
||||
ensure_satnode_mentions_trigdate(sat_node);
|
||||
|
||||
iter = 0;
|
||||
start = trig->scanfrom;
|
||||
start = get_scanfrom(trig);
|
||||
while (iter++ < MaxSatIter) {
|
||||
dse = ComputeTriggerNoAdjustDuration(start, trig, tt, &r, 1, 0);
|
||||
if (r) {
|
||||
@@ -1546,6 +1983,7 @@ int DoSatRemind(Trigger *trig, TimeTrig *tt, ParsePtr p)
|
||||
} else if (dse == start) {
|
||||
if (tt->ttime != NO_TIME) {
|
||||
trig->eventstart = MINUTES_PER_DAY * r + tt->ttime;
|
||||
trig->eventstart_orig = trig->eventstart;
|
||||
if (tt->duration != NO_TIME) {
|
||||
trig->eventduration = tt->duration;
|
||||
}
|
||||
@@ -1569,7 +2007,7 @@ int DoSatRemind(Trigger *trig, TimeTrig *tt, ParsePtr p)
|
||||
}
|
||||
if ((v.type == INT_TYPE && v.v.val) ||
|
||||
(v.type == STR_TYPE && *v.v.str)) {
|
||||
AdjustTriggerForDuration(trig->scanfrom, dse, trig, tt, 1);
|
||||
AdjustTriggerForDuration(get_scanfrom(trig), dse, trig, tt, 1);
|
||||
if (DebugFlag & DB_PRTTRIG) {
|
||||
int y, m, d;
|
||||
FromDSE(LastTriggerDate, &y, &m, &d);
|
||||
@@ -1704,7 +2142,7 @@ finished:
|
||||
/* function. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int ShouldTriggerBasedOnWarn(Trigger *t, int dse, int *err)
|
||||
static int ShouldTriggerBasedOnWarn(Trigger const *t, int dse, int *err)
|
||||
{
|
||||
char buffer[VAR_NAME_LEN+32];
|
||||
int i;
|
||||
@@ -1712,6 +2150,32 @@ static int ShouldTriggerBasedOnWarn(Trigger *t, int dse, int *err)
|
||||
int r, omit;
|
||||
Value v;
|
||||
int lastReturnVal = 0; /* Silence compiler warning */
|
||||
int calmode = (DoSimpleCalendar || DoCalendar) ? 1 : 0;
|
||||
|
||||
/* TODOs are handled differently */
|
||||
if (t->is_todo && !calmode) {
|
||||
/* Do NOT trigger if TODO has been completed through today (or later) */
|
||||
if (t->complete_through != NO_DATE && t->complete_through >= DSEToday) {
|
||||
return 0;
|
||||
}
|
||||
/* DO trigger if has not been completed through trigger date */
|
||||
if (t->complete_through == NO_DATE || t->complete_through < dse) {
|
||||
/* Trigger date is in the past - overdue, Trigger unless we're
|
||||
more than max_overdue days late */
|
||||
if (dse < DSEToday) {
|
||||
if (t->max_overdue >= 0) {
|
||||
if (dse + t->max_overdue < DSEToday) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* Trigger date in future - use normal Remind rules */
|
||||
} else {
|
||||
/* We're complete as of trigger date */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* If no proper function exists, barf... */
|
||||
if (UserFuncExists(t->warn) != 1) {
|
||||
|
||||
129
src/dosubst.c
129
src/dosubst.c
@@ -31,6 +31,39 @@
|
||||
|
||||
#define SHIP_OUT(s) if(DBufPuts(dbuf, s) != OK) return E_NO_MEM
|
||||
|
||||
static char const *
|
||||
get_function_override(int c, int addx)
|
||||
{
|
||||
static char func[32];
|
||||
|
||||
if (isalnum(c) || c == '_') {
|
||||
if (addx) {
|
||||
snprintf(func, sizeof(func), "subst_%cx", tolower(c));
|
||||
} else {
|
||||
snprintf(func, sizeof(func), "subst_%c", tolower(c));
|
||||
}
|
||||
return func;
|
||||
}
|
||||
if (addx) {
|
||||
switch(c) {
|
||||
case ':': return "subst_colonx";
|
||||
case '!': return "subst_bangx";
|
||||
case '?': return "subst_questionx";
|
||||
case '@': return "subst_atx";
|
||||
case '#': return "subst_hashx";
|
||||
}
|
||||
} else {
|
||||
switch(c) {
|
||||
case ':': return "subst_colon";
|
||||
case '!': return "subst_bang";
|
||||
case '?': return "subst_question";
|
||||
case '@': return "subst_at";
|
||||
case '#': return "subst_hash";
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
check_subst_args(UserFunc *f, int n)
|
||||
{
|
||||
@@ -54,9 +87,11 @@ check_subst_args(UserFunc *f, int n)
|
||||
/* If mode==ADVANCE_MODE, ignore %" but don't add newline */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse, int mode)
|
||||
int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int dse, int mode)
|
||||
{
|
||||
int diff = dse - DSEToday;
|
||||
int rdiff = dse - RealToday;
|
||||
int bangdiff = diff;
|
||||
int curtime = MinutesPastMidnight(0);
|
||||
int err, done;
|
||||
int c;
|
||||
@@ -67,12 +102,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
char const *pm, *cpm;
|
||||
int tdiff, adiff, mdiff, hdiff;
|
||||
char const *mplu, *hplu, *when, *plu;
|
||||
char const *is, *was;
|
||||
int has_quote = 0;
|
||||
char *ss;
|
||||
char const *expr;
|
||||
char *os;
|
||||
char s[256];
|
||||
char uf[32];
|
||||
char const *substname;
|
||||
char mypm[64];
|
||||
char mycpm[64];
|
||||
char myplu[64];
|
||||
@@ -98,7 +134,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
mplu = (mdiff == 1 ? "" : DynamicMplu);
|
||||
hplu = (hdiff == 1 ? "" : DynamicHplu);
|
||||
|
||||
when = (tdiff < 0) ? tr("ago") : tr("from now");
|
||||
when = (tdiff < 0) ? tr("ago") :
|
||||
tr("from now");
|
||||
|
||||
h = tim / 60;
|
||||
min = tim % 60;
|
||||
@@ -108,7 +145,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
if (func && check_subst_args(func, 1)) {
|
||||
snprintf(s, sizeof(s), "subst_ampm(%d)", h);
|
||||
expr = (char const *) s;
|
||||
r = EvalExpr(&expr, &v, NULL);
|
||||
r = EvalExprRunDisabled(&expr, &v, NULL);
|
||||
if (r == OK) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
snprintf(mypm, sizeof(mypm), "%s", v.v.str);
|
||||
@@ -122,7 +159,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
}
|
||||
}
|
||||
if (r != OK) {
|
||||
pm = (h < 12) ? tr("am") : tr("pm");
|
||||
pm = (h < 12) ? tr("am") :
|
||||
tr("pm");
|
||||
}
|
||||
|
||||
hh = (h == 12 || h == 0) ? 12 : h % 12;
|
||||
@@ -135,7 +173,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
if (func && check_subst_args(func, 1)) {
|
||||
snprintf(s, sizeof(s), "subst_ampm(%d)", ch);
|
||||
expr = (char const *) s;
|
||||
r = EvalExpr(&expr, &v, NULL);
|
||||
r = EvalExprRunDisabled(&expr, &v, NULL);
|
||||
if (r == OK) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
snprintf(mycpm, sizeof(mycpm), "%s", v.v.str);
|
||||
@@ -149,7 +187,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
}
|
||||
}
|
||||
if (r != OK) {
|
||||
cpm = (h < 12) ? tr("am") : tr("pm");
|
||||
cpm = (h < 12) ? tr("am") :
|
||||
tr("pm");
|
||||
}
|
||||
chh = (ch == 0 || ch == 12) ? 12 : ch % 12;
|
||||
|
||||
@@ -157,7 +196,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
if (func && check_subst_args(func, 1)) {
|
||||
snprintf(s, sizeof(s), "subst_ordinal(%d)", d);
|
||||
expr = (char const *) s;
|
||||
r = EvalExpr(&expr, &v, NULL);
|
||||
r = EvalExprRunDisabled(&expr, &v, NULL);
|
||||
if (r == OK) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
snprintf(myplu, sizeof(myplu), "%s", v.v.str);
|
||||
@@ -321,7 +360,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
snprintf(ss, sizeof(s) - (ss-s), "(%d,'%04d-%02d-%02d',%02d:%02d)",
|
||||
altmode ? 1 : 0, y, m+1, d, h, min);
|
||||
expr = (char const *) s;
|
||||
r = EvalExpr(&expr, &v, NULL);
|
||||
r = EvalExprRunDisabled(&expr, &v, NULL);
|
||||
if (r == OK) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
if (DBufPuts(dbuf, v.v.str) != OK) {
|
||||
@@ -334,13 +373,17 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
continue;
|
||||
}
|
||||
done = 0;
|
||||
snprintf(uf, sizeof(uf), "subst_%c", tolower(c));
|
||||
func = FindUserFunc(uf);
|
||||
substname = get_function_override(c, 0);
|
||||
if (substname) {
|
||||
func = FindUserFunc(substname);
|
||||
} else {
|
||||
func = NULL;
|
||||
}
|
||||
if (func && check_subst_args(func, 3)) {
|
||||
snprintf(s, sizeof(s), "subst_%c(%d,'%04d-%02d-%02d',%02d:%02d)",
|
||||
tolower(c), altmode ? 1 : 0, y, m+1, d, h, min);
|
||||
snprintf(s, sizeof(s), "%s(%d,'%04d-%02d-%02d',%02d:%02d)",
|
||||
substname, altmode ? 1 : 0, y, m+1, d, h, min);
|
||||
expr = (char const *) s;
|
||||
r = EvalExpr(&expr, &v, NULL);
|
||||
r = EvalExprRunDisabled(&expr, &v, NULL);
|
||||
if (r == OK) {
|
||||
if (v.type != INT_TYPE || v.v.val != 0) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
@@ -358,7 +401,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
}
|
||||
}
|
||||
|
||||
if (diff <= 1) {
|
||||
if (abs(diff) <= 1) {
|
||||
switch(UPPER(c)) {
|
||||
case 'A':
|
||||
case 'B':
|
||||
@@ -373,7 +416,9 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
case 'L':
|
||||
case 'U':
|
||||
case 'V':
|
||||
snprintf(s, sizeof(s), "%s", (diff ? tr("tomorrow") : tr("today")));
|
||||
snprintf(s, sizeof(s), "%s", (diff == 1 ? tr("tomorrow") :
|
||||
diff == -1 ? tr("yesterday") :
|
||||
tr("today")));
|
||||
SHIP_OUT(s);
|
||||
done = 1;
|
||||
break;
|
||||
@@ -384,13 +429,17 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
|
||||
|
||||
if (!done) {
|
||||
snprintf(uf, sizeof(uf), "subst_%cx", tolower(c));
|
||||
func = FindUserFunc(uf);
|
||||
substname = get_function_override(c, 1);
|
||||
if (substname) {
|
||||
func = FindUserFunc(substname);
|
||||
} else {
|
||||
func = NULL;
|
||||
}
|
||||
if (func && check_subst_args(func, 3)) {
|
||||
snprintf(s, sizeof(s), "subst_%cx(%d,'%04d-%02d-%02d',%02d:%02d)",
|
||||
tolower(c), altmode ? 1 : 0, y, m+1, d, h, min);
|
||||
snprintf(s, sizeof(s), "%s(%d,'%04d-%02d-%02d',%02d:%02d)",
|
||||
substname, altmode ? 1 : 0, y, m+1, d, h, min);
|
||||
expr = (char const *) s;
|
||||
r = EvalExpr(&expr, &v, NULL);
|
||||
r = EvalExprRunDisabled(&expr, &v, NULL);
|
||||
if (r == OK) {
|
||||
if (v.type != INT_TYPE || v.v.val != 0) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
@@ -408,7 +457,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
}
|
||||
}
|
||||
if (origtime == NO_TIME) {
|
||||
if ((c >= '0' && c <= '9') || (c == '!')) {
|
||||
if ((c >= '0' && c <= '9')) {
|
||||
Wprint(tr("`%%%c' substitution sequence should not be used without an AT clause"), c);
|
||||
}
|
||||
}
|
||||
@@ -426,7 +475,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
snprintf(s, sizeof(s), "in %d days' time", diff);
|
||||
if (diff > 0) {
|
||||
snprintf(s, sizeof(s), "in %d days' time", diff);
|
||||
} else {
|
||||
snprintf(s, sizeof(s), "%d days ago", -diff);
|
||||
}
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
@@ -605,6 +658,12 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
if (t->is_todo && t->complete_through != NO_DATE && t->complete_through >= dse) {
|
||||
snprintf(s, sizeof(s), " (%s)", tr("done"));
|
||||
SHIP_OUT(s);
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (tdiff == 0)
|
||||
snprintf(s, sizeof(s), "%s", tr("now"));
|
||||
@@ -614,7 +673,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
snprintf(s, sizeof(s), "%d %s%s %s", hdiff, tr("hour"), hplu, when);
|
||||
else
|
||||
snprintf(s, sizeof(s), "%d %s%s %s %d %s%s %s", hdiff, tr("hour"), hplu,
|
||||
tr("and"), mdiff, tr("minute"), mplu, when);
|
||||
tr("and"), mdiff,
|
||||
tr("minute"), mplu, when);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
@@ -672,7 +732,26 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
|
||||
break;
|
||||
|
||||
case '!':
|
||||
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? tr("is") : tr("was")));
|
||||
case '?':
|
||||
if (c == '!') {
|
||||
is = tr("is");
|
||||
was = tr("was");
|
||||
} else {
|
||||
is = tr("are");
|
||||
was = tr("were");
|
||||
}
|
||||
if (altmode) {
|
||||
bangdiff = rdiff;
|
||||
} else {
|
||||
bangdiff = diff;
|
||||
}
|
||||
if (bangdiff > 0) {
|
||||
snprintf(s, sizeof(s), "%s", is);
|
||||
} else if (bangdiff < 0) {
|
||||
snprintf(s, sizeof(s), "%s", was);
|
||||
} else {
|
||||
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? is : was));
|
||||
}
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
|
||||
41
src/err.h
41
src/err.h
@@ -30,18 +30,18 @@
|
||||
#define E_CANT_PARSE_WKDAY 8
|
||||
#define E_NO_MEM 9
|
||||
#define E_BAD_NUMBER 10
|
||||
/* #define E_OP_STK_UNDER 11 */
|
||||
/* #define E_VA_STK_UNDER 12 */
|
||||
#define E_PUSHV_NO_POP 11
|
||||
#define E_POPV_NO_PUSH 12
|
||||
#define E_CANT_COERCE 13
|
||||
#define E_BAD_TYPE 14
|
||||
#define E_DATE_OVER 15
|
||||
/* #define E_STACK_ERR 16 */
|
||||
#define E_POPF_NO_PUSH 16
|
||||
#define E_DIV_ZERO 17
|
||||
#define E_NOSUCH_VAR 18
|
||||
#define E_EOLN 19
|
||||
#define E_EOF 20
|
||||
#define E_IO_ERR 21
|
||||
/* #define E_LINE_2_LONG 22 */
|
||||
#define E_PUSHF_NO_POP 22
|
||||
#define E_SWERR 23
|
||||
#define E_BAD_DATE 24
|
||||
#define E_2FEW_ARGS 25
|
||||
@@ -76,7 +76,7 @@
|
||||
#define E_DAY_TWICE 52
|
||||
#define E_UNKNOWN_TOKEN 53
|
||||
#define E_SPEC_MON 54
|
||||
/* #define E_2MANY_PART 55 */
|
||||
#define E_TODO_TWICE 55
|
||||
#define E_2MANY_FULL 56
|
||||
#define E_PUSH_NOPOP 57
|
||||
#define E_ERR_READING 58
|
||||
@@ -114,7 +114,7 @@
|
||||
#define E_MISS_EQ 90
|
||||
#define E_MISS_VAR 91
|
||||
#define E_MISS_EXPR 92
|
||||
/* #define M_CANTSET_ACCESS 93 */
|
||||
#define E_COMPLETE_THROUGH_TWICE 93
|
||||
#define M_I_OPTION 94
|
||||
#define E_NOREMINDERS 95
|
||||
#define M_QUEUED 96
|
||||
@@ -129,7 +129,14 @@
|
||||
#define E_REPEATED_ARG 105
|
||||
#define E_EXPR_DISABLED 106
|
||||
#define E_TIME_EXCEEDED 107
|
||||
|
||||
#define E_COMPLETE_WITHOUT_TODO 108
|
||||
#define E_MAX_OVERDUE_TWICE 109
|
||||
#define E_MAX_OVERDUE_WITHOUT_TODO 110
|
||||
#define E_TZ_SPECIFIED_TWICE 111
|
||||
#define E_TZ_NO_AT 112
|
||||
#define E_NO_MB 113
|
||||
#define E_BAD_MB_SEQ 114
|
||||
#define E_EXPR_NODES_EXCEEDED 115
|
||||
#ifdef MK_GLOBALS
|
||||
#undef EXTERN
|
||||
#define EXTERN
|
||||
@@ -158,18 +165,18 @@ EXTERN char *ErrMsg[]
|
||||
/* E_CANT_PARSE_WKDAY*/ "Invalid weekday name",
|
||||
/* E_NO_MEM */ "Out of memory",
|
||||
/* E_BAD_NUMBER */ "Ill-formed number",
|
||||
/* E_OP_STK_UNDER */ "",
|
||||
/* E_VA_STK_UNDER */ "",
|
||||
/* E_PUSHV_NO_POP */ "Warning: PUSH-VARS without matching POP-VARS",
|
||||
/* E_POPV_NO_PUSH */ "POP-VARS without matching PUSH-VARS",
|
||||
/* E_CANT_COERCE */ "Can't coerce",
|
||||
/* E_BAD_TYPE */ "Type mismatch",
|
||||
/* E_DATE_OVER */ "Date overflow",
|
||||
/* E_STACK_ERR */ "",
|
||||
/* E_POPF_NO_PUSH */ "POP-FUNCS without matching PUSH-FUNCS",
|
||||
/* E_DIV_ZERO */ "Division by zero",
|
||||
/* E_NOSUCH_VAR */ "Undefined variable",
|
||||
/* E_EOLN */ "Unexpected end of line",
|
||||
/* E_EOF */ "Unexpected end of file",
|
||||
/* E_IO_ERR */ "I/O error",
|
||||
/* E_LINE_2_LONG */ "",
|
||||
/* E_PUSHF_NO_POP */ "Warning: PUSH-FUNCS without matching POP-FUNCS",
|
||||
/* E_SWERR */ "Internal error",
|
||||
/* E_BAD_DATE */ "Bad date specification",
|
||||
/* E_2FEW_ARGS */ "Not enough arguments",
|
||||
@@ -202,7 +209,7 @@ EXTERN char *ErrMsg[]
|
||||
/* E_DAY_TWICE */ "Day specified twice",
|
||||
/* E_UNKNOWN_TOKEN */ "Unknown token",
|
||||
/* E_SPEC_MON */ "Must specify month in OMIT command",
|
||||
/* E_2MANY_PART */ "",
|
||||
/* E_TODO_TWICE */ "TODO specified twice",
|
||||
/* E_2MANY_FULL */ "Too many full OMITs (max. " STR(MAX_FULL_OMITS) ")",
|
||||
/* E_PUSH_NOPOP */ "Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
|
||||
/* E_ERR_READING */ "Error reading",
|
||||
@@ -240,7 +247,7 @@ EXTERN char *ErrMsg[]
|
||||
/* E_MISS_EQ */ "Missing '=' sign",
|
||||
/* E_MISS_VAR */ "Missing variable name",
|
||||
/* E_MISS_EXPR */ "Missing expression",
|
||||
/* M_CANTSET_ACCESS */ "",
|
||||
/* E_COMPLETE_THROUGH_TWICE */ "COMPLETE-THROUGH specified twice",
|
||||
/* M_I_OPTION */ "Remind: '-i' option: %s",
|
||||
/* E_NOREMINDERS */ "No reminders.",
|
||||
/* M_QUEUED */ "%d reminder(s) queued for later today.",
|
||||
@@ -255,6 +262,14 @@ EXTERN char *ErrMsg[]
|
||||
/* E_REPEATED_ARG */ "Duplicate argument name",
|
||||
/* E_EXPR_DISABLED */ "Expression evaluation is disabled",
|
||||
/* E_TIME_EXCEEDED */ "Time limit for expression evaluation exceeded",
|
||||
/* E_COMPLETE_WITHOUT_TODO */ "COMPLETE-THROUGH specified without TODO",
|
||||
/* E_MAX_OVERDUE_TWICE */ "MAX-OVERDUE specified twice",
|
||||
/* E_MAX_OVERDUE_WITHOUT_TODO */ "MAX-OVERDUE specified without TODO",
|
||||
/* E_TZ_SPECIFIED_TWICE */ "TZ specified twice",
|
||||
/* E_TZ_NO_AT */ "TZ specified for non-timed reminder",
|
||||
/* E_NO_MB */ "C library does not support multibyte characters",
|
||||
/* E_BAD_MB_SEQ */ "Invalid multibyte sequence",
|
||||
/* E_EXPR_NODES_EXCEEDED */ "Maximum expression complexity exceeded",
|
||||
}
|
||||
#endif /* MK_GLOBALS */
|
||||
;
|
||||
|
||||
193
src/expr.c
193
src/expr.c
@@ -191,6 +191,7 @@ static int ExprNodesUsed = 0;
|
||||
/* Forward references */
|
||||
static expr_node * parse_expression_aux(char const **e, int *r, Var *locals, int level);
|
||||
static char const *get_operator_name(expr_node *node);
|
||||
static void print_expr_tree(expr_node *node, FILE *fp);
|
||||
|
||||
/* This is super-skanky... we keep track of the currently-executing
|
||||
user-defined function in a global var */
|
||||
@@ -315,7 +316,7 @@ add_child(expr_node *parent, expr_node *child)
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void
|
||||
debug_evaluation(Value *ans, int r, char const *fmt, ...)
|
||||
debug_evaluation(Value const *ans, int r, char const *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
@@ -342,7 +343,7 @@ debug_evaluation(Value *ans, int r, char const *fmt, ...)
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void
|
||||
debug_evaluation_binop(Value *ans, int r, Value *v1, Value *v2, char const *fmt, ...)
|
||||
debug_evaluation_binop(Value const *ans, int r, Value const *v1, Value const *v2, char const *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
@@ -380,7 +381,7 @@ debug_evaluation_binop(Value *ans, int r, Value *v1, Value *v2, char const *fmt,
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void
|
||||
debug_evaluation_unop(Value *ans, int r, Value *v1, char const *fmt, ...)
|
||||
debug_evaluation_unop(Value const *ans, int r, Value const *v1, char const *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
@@ -443,7 +444,7 @@ get_var(expr_node *node, Value *ans, int *nonconst)
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int
|
||||
get_sysvar(expr_node *node, Value *ans)
|
||||
get_sysvar(expr_node const *node, Value *ans)
|
||||
{
|
||||
if (node->type == N_SHORT_SYSVAR) {
|
||||
return GetSysVar(node->u.name, ans);
|
||||
@@ -569,7 +570,7 @@ eval_builtin(expr_node *node, Value *locals, Value *ans, int *nonconst)
|
||||
/* All went well; copy the result destructively */
|
||||
(*ans) = info.retval;
|
||||
|
||||
/* Special case of const cunction */
|
||||
/* Special case of const function */
|
||||
if (!strcmp(f->name, "const")) {
|
||||
if (*nonconst) {
|
||||
nonconst_debug(0, tr("Non-constant expression converted to constant by `const' built-in function"));
|
||||
@@ -640,7 +641,7 @@ debug_enter_userfunc(expr_node *node, Value *locals, int nargs)
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void
|
||||
debug_exit_userfunc(expr_node *node, Value *ans, int r, Value *locals, int nargs)
|
||||
debug_exit_userfunc(expr_node *node, Value const *ans, int r, Value *locals, int nargs)
|
||||
{
|
||||
char const *fname;
|
||||
int i;
|
||||
@@ -693,6 +694,7 @@ eval_userfunc(expr_node *node, Value *locals, Value *ans, int *nonconst)
|
||||
Value *new_locals = NULL;
|
||||
expr_node *kid;
|
||||
int i, r, j, pushed;
|
||||
int old_rundisabled;
|
||||
|
||||
/* If we have <= STACK_ARGS_MAX, store them on the stack here */
|
||||
Value stack_locals[STACK_ARGS_MAX];
|
||||
@@ -780,9 +782,15 @@ eval_userfunc(expr_node *node, Value *locals, Value *ans, int *nonconst)
|
||||
|
||||
DBG(debug_enter_userfunc(node, new_locals, f->nargs));
|
||||
|
||||
old_rundisabled = RunDisabled;
|
||||
if (f->run_disabled) {
|
||||
RunDisabled |= RUN_UF;
|
||||
}
|
||||
/* Evaluate the function's expr_node tree */
|
||||
r = evaluate_expr_node(f->node, new_locals, ans, nonconst);
|
||||
|
||||
RunDisabled = old_rundisabled;
|
||||
|
||||
DBG(debug_exit_userfunc(node, ans, r, new_locals, f->nargs));
|
||||
|
||||
if (r != OK) {
|
||||
@@ -833,7 +841,7 @@ evaluate_expression(expr_node *node, Value *locals, Value *ans, int *nonconst)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int CopyShortStr(Value *ans, expr_node *node)
|
||||
static int CopyShortStr(Value *ans, expr_node const *node)
|
||||
{
|
||||
size_t len = strlen(node->u.name);
|
||||
ans->v.str = malloc(len+1);
|
||||
@@ -880,6 +888,15 @@ evaluate_expr_node(expr_node *node, Value *locals, Value *ans, int *nonconst)
|
||||
if (!node) {
|
||||
return E_SWERR;
|
||||
}
|
||||
if (ExpressionNodeLimitPerLine > 0 &&
|
||||
ExpressionNodesEvaluatedThisLine >= ExpressionNodeLimitPerLine) {
|
||||
return E_EXPR_NODES_EXCEEDED;
|
||||
}
|
||||
ExpressionNodesEvaluated++;
|
||||
ExpressionNodesEvaluatedThisLine++;
|
||||
if (ExpressionNodesEvaluatedThisLine > MaxExprNodesPerLine) {
|
||||
MaxExprNodesPerLine = ExpressionNodesEvaluatedThisLine;
|
||||
}
|
||||
switch(node->type) {
|
||||
case N_FREE:
|
||||
case N_ERROR:
|
||||
@@ -1835,6 +1852,78 @@ expr_node * free_expr_tree(expr_node *node)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* clone_expr_tree */
|
||||
/* */
|
||||
/* Clone an entire expr_tree. The clone shares no memory */
|
||||
/* with the original. Returns NULL and sets *r on failure. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
expr_node * clone_expr_tree(expr_node const *src, int *r)
|
||||
{
|
||||
int rc;
|
||||
expr_node *dest = alloc_expr_node(r);
|
||||
if (!dest) return NULL;
|
||||
|
||||
dest->type = src->type;
|
||||
dest->num_kids = src->num_kids;
|
||||
switch(dest->type) {
|
||||
case N_FREE:
|
||||
case N_ERROR:
|
||||
*r = E_SWERR;
|
||||
free_expr_tree(dest);
|
||||
return NULL;
|
||||
|
||||
case N_CONSTANT:
|
||||
case N_VARIABLE:
|
||||
case N_SYSVAR:
|
||||
case N_USER_FUNC:
|
||||
rc = CopyValue(&(dest->u.value), &(src->u.value));
|
||||
if (rc != OK) {
|
||||
*r = rc;
|
||||
free_expr_tree(dest);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case N_SHORT_STR:
|
||||
case N_SHORT_VAR:
|
||||
case N_SHORT_SYSVAR:
|
||||
case N_SHORT_USER_FUNC:
|
||||
strcpy(dest->u.name, src->u.name);
|
||||
break;
|
||||
|
||||
case N_LOCAL_VAR:
|
||||
dest->u.arg = src->u.arg;
|
||||
break;
|
||||
|
||||
case N_BUILTIN_FUNC:
|
||||
dest->u.builtin_func = src->u.builtin_func;
|
||||
break;
|
||||
|
||||
case N_OPERATOR:
|
||||
dest->u.operator_func = src->u.operator_func;
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->child) {
|
||||
dest->child = clone_expr_tree(src->child, r);
|
||||
if (!dest->child) {
|
||||
free_expr_tree(dest);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (src->sibling) {
|
||||
dest->sibling = clone_expr_tree(src->sibling, r);
|
||||
if (!dest->sibling) {
|
||||
free_expr_tree(dest);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* set_long_name - set a long name in an expr_node */
|
||||
@@ -2052,6 +2141,31 @@ static int set_constant_value(expr_node *atom)
|
||||
atom->u.value.type = INT_TYPE;
|
||||
val = 0;
|
||||
prev_val = 0;
|
||||
if (*s == '0' && (*(s+1) == 'x' || *(s+1) == 'X')) {
|
||||
/* Hex constant */
|
||||
s += 2;
|
||||
if (!*s || !isxdigit(*s)) {
|
||||
return E_BAD_NUMBER;
|
||||
}
|
||||
while (*s && isxdigit(*s)) {
|
||||
val *= 16;
|
||||
if (*s >= '0' && *s <= '9') {
|
||||
val += (*s - '0');
|
||||
} else {
|
||||
val += (toupper(*s) - 'A') + 10;
|
||||
}
|
||||
s++;
|
||||
if (val < prev_val) {
|
||||
return E_2HIGH;
|
||||
}
|
||||
prev_val = val;
|
||||
}
|
||||
if (*s) {
|
||||
return E_BAD_NUMBER;
|
||||
}
|
||||
atom->u.value.v.val = val;
|
||||
return OK;
|
||||
}
|
||||
while (*s && isdigit(*s)) {
|
||||
val *= 10;
|
||||
val += (*s++ - '0');
|
||||
@@ -2712,7 +2826,7 @@ static void print_kids(expr_node *node, FILE *fp)
|
||||
/* file. Used for debugging (the "-ds" flag.) */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void print_expr_tree(expr_node *node, FILE *fp)
|
||||
static void print_expr_tree(expr_node *node, FILE *fp)
|
||||
{
|
||||
if (!node) {
|
||||
return;
|
||||
@@ -2796,9 +2910,29 @@ static char const *get_operator_name(expr_node *node)
|
||||
else return "UNKNOWN_OPERATOR";
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* EvalExprRunDisabled - parse and evaluate an expression */
|
||||
/* */
|
||||
/* Evaluate an expression. Return 0 if OK, non-zero if error */
|
||||
/* Put the result into value pointed to by v. During */
|
||||
/* evaluation, RUN will be disabled */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int EvalExprRunDisabled(char const **e, Value *v, ParsePtr p)
|
||||
{
|
||||
int old_run_disabled = RunDisabled;
|
||||
int r;
|
||||
RunDisabled |= RUN_CB;
|
||||
r = EvalExpr(e, v, p);
|
||||
RunDisabled = old_run_disabled;
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* EvalExpr - parse and evaluate an expression. */
|
||||
/* */
|
||||
/* Evaluate an expression. Return 0 if OK, non-zero if error */
|
||||
/* Put the result into value pointed to by v. */
|
||||
/* */
|
||||
@@ -2830,6 +2964,28 @@ int EvalExpr(char const **e, Value *v, ParsePtr p)
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef REM_USE_WCHAR
|
||||
/* Truncate a wide-char string to MAX_PRT_LEN characters */
|
||||
static char const *truncate_string(char const *src)
|
||||
{
|
||||
static wchar_t wbuf[MAX_PRT_LEN+1];
|
||||
static char cbuf[(MAX_PRT_LEN * 8) + 1];
|
||||
size_t l;
|
||||
|
||||
l = mbstowcs(wbuf, src, MAX_PRT_LEN);
|
||||
if (l == (size_t) -1) {
|
||||
return src;
|
||||
}
|
||||
wbuf[MAX_PRT_LEN] = 0;
|
||||
l = wcstombs(cbuf, wbuf, MAX_PRT_LEN*8);
|
||||
if (l == (size_t) -1) {
|
||||
return src;
|
||||
}
|
||||
cbuf[MAX_PRT_LEN*8] = 0;
|
||||
return cbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* PrintValue */
|
||||
@@ -2840,10 +2996,13 @@ int EvalExpr(char const **e, Value *v, ParsePtr p)
|
||||
static DynamicBuffer printbuf = {NULL, 0, 0, ""};
|
||||
|
||||
#define PV_PUTC(fp, c) do { if (fp) { putc((c), fp); } else { DBufPutc(&printbuf, (c)); } } while(0);
|
||||
char const *PrintValue (Value *v, FILE *fp)
|
||||
|
||||
char const *PrintValue (Value const *v, FILE *fp)
|
||||
{
|
||||
int y, m, d;
|
||||
unsigned char const *s;
|
||||
int max_str_put = MAX_PRT_LEN;
|
||||
int truncated = 0;
|
||||
char pvbuf[512];
|
||||
if (!fp) {
|
||||
/* It's OK to DBufFree an uninitialized *BUT STATIC* dynamic buffer */
|
||||
@@ -2851,9 +3010,19 @@ char const *PrintValue (Value *v, FILE *fp)
|
||||
}
|
||||
|
||||
if (v->type == STR_TYPE) {
|
||||
#ifdef REM_USE_WCHAR
|
||||
s = (unsigned char const *) truncate_string(v->v.str);
|
||||
if (s != (unsigned char const *) v->v.str) {
|
||||
max_str_put = INT_MAX;
|
||||
if (strlen((char const *) s) != strlen(v->v.str)) {
|
||||
truncated = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
s = (unsigned char const *) v->v.str;
|
||||
#endif
|
||||
PV_PUTC(fp, '"');
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) {
|
||||
for (y=0; y<max_str_put && *s; y++) {
|
||||
switch(*s) {
|
||||
case '\a': PV_PUTC(fp, '\\'); PV_PUTC(fp, 'a'); break;
|
||||
case '\b': PV_PUTC(fp, '\\'); PV_PUTC(fp, 'b'); break;
|
||||
@@ -2879,7 +3048,7 @@ char const *PrintValue (Value *v, FILE *fp)
|
||||
s++;
|
||||
}
|
||||
PV_PUTC(fp, '"');
|
||||
if (*s) {
|
||||
if (*s || truncated) {
|
||||
if (fp) {
|
||||
fprintf(fp, "...");
|
||||
} else {
|
||||
@@ -2961,7 +3130,7 @@ int CopyValue(Value *dest, const Value *src)
|
||||
/* 4:00PM */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int ParseLiteralTime(char const **s, int *tim)
|
||||
static int ParseLiteralTime(char const **s, int *tim)
|
||||
{
|
||||
int h=0;
|
||||
int m=0;
|
||||
|
||||
109
src/files.c
109
src/files.c
@@ -41,6 +41,13 @@
|
||||
#include "globals.h"
|
||||
#include "err.h"
|
||||
|
||||
#ifdef USE_READLINE
|
||||
#include <readline/readline.h>
|
||||
#endif
|
||||
#ifdef USE_READLINE_HISTORY
|
||||
#include <readline/history.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Convenient macros for closing files */
|
||||
#define FCLOSE(fp) ((((fp)!=stdin)) ? (fclose(fp),(fp)=NULL) : ((fp)=NULL))
|
||||
@@ -114,16 +121,16 @@ static int CheckSafetyAux (struct stat *statbuf);
|
||||
static int PopFile (void);
|
||||
static int IncludeCmd(char const *);
|
||||
|
||||
static unsigned int FnHashFunc(void *x)
|
||||
static unsigned int FnHashFunc(void const *x)
|
||||
{
|
||||
FilenameHashEntry *e = (FilenameHashEntry *) x;
|
||||
FilenameHashEntry const *e = (FilenameHashEntry const *) x;
|
||||
return HashVal_preservecase(e->fname);
|
||||
}
|
||||
|
||||
static int FnCompareFunc(void *a, void *b)
|
||||
static int FnCompareFunc(void const *a, void const *b)
|
||||
{
|
||||
FilenameHashEntry *e1 = (FilenameHashEntry *) a;
|
||||
FilenameHashEntry *e2 = (FilenameHashEntry *) b;
|
||||
FilenameHashEntry const *e1 = (FilenameHashEntry const *) a;
|
||||
FilenameHashEntry const *e2 = (FilenameHashEntry const *) b;
|
||||
return strcmp(e1->fname, e2->fname);
|
||||
}
|
||||
|
||||
@@ -134,6 +141,9 @@ void InitFiles(void)
|
||||
fprintf(ErrFp, "Unable to initialize filename hash table: Out of memory. Exiting.\n");
|
||||
exit(1);
|
||||
}
|
||||
#ifdef USE_READLINE_HISTORY
|
||||
using_history();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetCurrentFilename(char const *fname)
|
||||
@@ -177,19 +187,17 @@ got_a_fresh_line(void)
|
||||
{
|
||||
FreshLine = 1;
|
||||
WarnedAboutImplicit = 0;
|
||||
ExpressionNodesEvaluatedThisLine = 0;
|
||||
}
|
||||
|
||||
void set_cloexec(FILE *fp)
|
||||
void set_cloexec(int fd)
|
||||
{
|
||||
int flags;
|
||||
int fd;
|
||||
if (fp) {
|
||||
fd = fileno(fp);
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
if (flags >= 0) {
|
||||
flags |= FD_CLOEXEC;
|
||||
fcntl(fd, F_SETFD, flags);
|
||||
}
|
||||
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
if (flags >= 0) {
|
||||
flags |= FD_CLOEXEC;
|
||||
fcntl(fd, F_SETFD, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +226,7 @@ static void OpenPurgeFile(char const *fname, char const *mode)
|
||||
fprintf(ErrFp, tr("Cannot open `%s' for writing: %s"), DBufValue(&fname_buf), strerror(errno));
|
||||
fprintf(ErrFp, "\n");
|
||||
}
|
||||
set_cloexec(PurgeFP);
|
||||
set_cloexec(fileno(PurgeFP));
|
||||
DBufFree(&fname_buf);
|
||||
}
|
||||
|
||||
@@ -271,6 +279,8 @@ int ReadLine(void)
|
||||
return ReadLineFromFile(0);
|
||||
}
|
||||
|
||||
#define IS_INTERACTIVE() (fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ReadLineFromFile */
|
||||
@@ -283,6 +293,11 @@ static int ReadLineFromFile(int use_pclose)
|
||||
int l;
|
||||
char copy_buffer[4096];
|
||||
size_t n;
|
||||
int force_eof = 0;
|
||||
|
||||
#ifdef USE_READLINE
|
||||
int read_some = 0;
|
||||
#endif
|
||||
|
||||
DynamicBuffer buf;
|
||||
|
||||
@@ -290,18 +305,56 @@ static int ReadLineFromFile(int use_pclose)
|
||||
DBufFree(&LineBuffer);
|
||||
|
||||
LineNoStart = LineNo+1;
|
||||
|
||||
if (!fp) {
|
||||
return E_EOF;
|
||||
}
|
||||
while(fp) {
|
||||
#ifdef USE_READLINE
|
||||
if (IS_INTERACTIVE()) {
|
||||
char *lin;
|
||||
if (should_ignore_line()) {
|
||||
if (read_some) {
|
||||
lin = readline("Rem...? ");
|
||||
} else {
|
||||
lin = readline("Remind? ");
|
||||
}
|
||||
} else {
|
||||
if (read_some) {
|
||||
lin = readline("Rem...> ");
|
||||
} else {
|
||||
lin = readline("Remind> ");
|
||||
}
|
||||
}
|
||||
if (lin) {
|
||||
read_some = 1;
|
||||
DBufFree(&buf);
|
||||
if (DBufPuts(&buf, lin) != OK) {
|
||||
free(lin);
|
||||
DBufFree(&buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
free(lin);
|
||||
force_eof = 0;
|
||||
} else {
|
||||
force_eof = 1;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
if (DBufGets(&buf, fp) != OK) {
|
||||
DBufFree(&LineBuffer);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
#ifdef USE_READLINE
|
||||
}
|
||||
#endif
|
||||
LineNo++;
|
||||
if (ferror(fp)) {
|
||||
DBufFree(&buf);
|
||||
DBufFree(&LineBuffer);
|
||||
return E_IO_ERR;
|
||||
}
|
||||
if (feof(fp)) {
|
||||
if (feof(fp) || force_eof) {
|
||||
if (use_pclose) {
|
||||
PCLOSE(fp);
|
||||
} else {
|
||||
@@ -363,6 +416,11 @@ static int ReadLineFromFile(int use_pclose)
|
||||
CurLine = DBufValue(&LineBuffer);
|
||||
}
|
||||
|
||||
#ifdef USE_READLINE_HISTORY
|
||||
if (fp && IS_INTERACTIVE()) {
|
||||
add_history(CurLine);
|
||||
}
|
||||
#endif
|
||||
got_a_fresh_line();
|
||||
clear_callstack();
|
||||
if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
|
||||
@@ -381,7 +439,7 @@ static int ReadLineFromFile(int use_pclose)
|
||||
/* ShouldCache is 1, cache the file */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int OpenFile(char const *fname)
|
||||
static int OpenFile(char const *fname)
|
||||
{
|
||||
CachedFile *h = CachedFiles;
|
||||
int r;
|
||||
@@ -401,6 +459,7 @@ int OpenFile(char const *fname)
|
||||
fprintf(ErrFp, tr("Reading `%s': Found in cache"), fname);
|
||||
fprintf(ErrFp, "\n");
|
||||
}
|
||||
fp = NULL;
|
||||
CLine = h->cache;
|
||||
SetCurrentFilename(fname);
|
||||
LineNo = 0;
|
||||
@@ -427,7 +486,9 @@ int OpenFile(char const *fname)
|
||||
}
|
||||
} else {
|
||||
fp = fopen(fname, "r");
|
||||
set_cloexec(fp);
|
||||
if (fp) {
|
||||
set_cloexec(fileno(fp));
|
||||
}
|
||||
if (DebugFlag & DB_TRACE_FILES) {
|
||||
fprintf(ErrFp, tr("Reading `%s': Opening file on disk"), fname);
|
||||
fprintf(ErrFp, "\n");
|
||||
@@ -449,7 +510,7 @@ int OpenFile(char const *fname)
|
||||
if (strcmp(fname, "-")) {
|
||||
fp = fopen(fname, "r");
|
||||
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
||||
set_cloexec(fp);
|
||||
set_cloexec(fileno(fp));
|
||||
if (PurgeMode) OpenPurgeFile(fname, "w");
|
||||
} else {
|
||||
fp = stdin;
|
||||
@@ -616,6 +677,7 @@ static int PopFile(void)
|
||||
IncludeStruct *i;
|
||||
|
||||
pop_excess_ifs(FileName);
|
||||
fp = NULL;
|
||||
|
||||
if (!IStackPtr) return E_EOF;
|
||||
i = &IStack[IStackPtr-1];
|
||||
@@ -628,17 +690,16 @@ static int PopFile(void)
|
||||
RunDisabled = oldRunDisabled;
|
||||
}
|
||||
|
||||
if (IStackPtr <= 1) {
|
||||
if (TopLevel()) {
|
||||
IStackPtr = 0;
|
||||
return E_EOF;
|
||||
}
|
||||
|
||||
IStackPtr--;
|
||||
|
||||
LineNo = i->LineNo;
|
||||
LineNoStart = i->LineNoStart;
|
||||
set_base_if_pointer(i->base_if_pointer);
|
||||
CLine = i->CLine;
|
||||
fp = NULL;
|
||||
SetCurrentFilename(i->filename);
|
||||
if (!i->ownedByMe) {
|
||||
RunDisabled |= RUN_NOTOWNER;
|
||||
@@ -650,7 +711,7 @@ static int PopFile(void)
|
||||
if (strcmp(i->filename, "-")) {
|
||||
fp = fopen(i->filename, "r");
|
||||
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
||||
set_cloexec(fp);
|
||||
set_cloexec(fileno(fp));
|
||||
if (PurgeMode) OpenPurgeFile(i->filename, "a");
|
||||
} else {
|
||||
fp = stdin;
|
||||
@@ -1151,7 +1212,7 @@ int IncludeFile(char const *fname)
|
||||
int GetAccessDate(char const *file)
|
||||
{
|
||||
struct stat statbuf;
|
||||
struct tm *t1;
|
||||
struct tm const *t1;
|
||||
|
||||
if (stat(file, &statbuf)) return -1;
|
||||
t1 = localtime(&(statbuf.st_atime));
|
||||
|
||||
469
src/funcs.c
469
src/funcs.c
@@ -87,6 +87,7 @@ static int FCatch (expr_node *, Value *, Value *, int *);
|
||||
static int FCatchErr (func_info *);
|
||||
static int FChar (func_info *);
|
||||
static int FChoose (expr_node *, Value *, Value *, int *);
|
||||
static int FCodepoint (func_info *);
|
||||
static int FCoerce (func_info *);
|
||||
static int FColumns (func_info *);
|
||||
static int FCurrent (func_info *);
|
||||
@@ -112,6 +113,7 @@ static int FHebdate (func_info *);
|
||||
static int FHebday (func_info *);
|
||||
static int FHebmon (func_info *);
|
||||
static int FHebyear (func_info *);
|
||||
static int FHex (func_info *);
|
||||
static int FHour (func_info *);
|
||||
static int FHtmlEscape (func_info *);
|
||||
static int FHtmlStriptags (func_info *);
|
||||
@@ -126,6 +128,10 @@ static int FLanguage (func_info *);
|
||||
static int FLocalToUTC (func_info *);
|
||||
static int FLower (func_info *);
|
||||
static int FMax (func_info *);
|
||||
static int FMbchar (func_info *);
|
||||
static int FMbindex (func_info *);
|
||||
static int FMbstrlen (func_info *);
|
||||
static int FMbsubstr (func_info *);
|
||||
static int FMin (func_info *);
|
||||
static int FMinsfromutc (func_info *);
|
||||
static int FMinute (func_info *);
|
||||
@@ -173,6 +179,7 @@ static int FToday (func_info *);
|
||||
static int FTrig (func_info *);
|
||||
static int FTrigback (func_info *);
|
||||
static int FTrigbase (func_info *info);
|
||||
static int FTrigcompletethrough (func_info *);
|
||||
static int FTrigdate (func_info *);
|
||||
static int FTrigdatetime (func_info *);
|
||||
static int FTrigdelta (func_info *);
|
||||
@@ -180,15 +187,20 @@ static int FTrigduration (func_info *);
|
||||
static int FTriginfo (func_info *);
|
||||
static int FTrigeventduration(func_info *);
|
||||
static int FTrigeventstart (func_info *);
|
||||
static int FTrigeventstarttz (func_info *);
|
||||
static int FTrigfrom (func_info *);
|
||||
static int FTrigger (func_info *);
|
||||
static int FTrigistodo (func_info *);
|
||||
static int FTrigmaxoverdue (func_info *);
|
||||
static int FTrigpriority (func_info *);
|
||||
static int FTrigrep (func_info *);
|
||||
static int FTrigscanfrom (func_info *);
|
||||
static int FTrigtags (func_info *);
|
||||
static int FTrigtime (func_info *);
|
||||
static int FTrigtimetz (func_info *);
|
||||
static int FTrigtimedelta (func_info *);
|
||||
static int FTrigtimerep (func_info *);
|
||||
static int FTrigtz (func_info *);
|
||||
static int FTriguntil (func_info *);
|
||||
static int FTrigvalid (func_info *);
|
||||
static int FTypeof (func_info *);
|
||||
@@ -203,7 +215,6 @@ static int FWkdaynum (func_info *);
|
||||
static int FYear (func_info *);
|
||||
|
||||
static int SunStuff (int rise, double cosz, int dse);
|
||||
static int tz_set_tz (char const *tz);
|
||||
|
||||
/* Caches for extracting months, days, years from dates - may
|
||||
improve performance slightly. */
|
||||
@@ -234,7 +245,7 @@ static int CacheHebYear, CacheHebMon, CacheHebDay;
|
||||
#define GETMON(x) get_month(&(ARG(x)))
|
||||
|
||||
/* Macro for copying a value while destroying original copy */
|
||||
#define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE )
|
||||
#define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE, (y).v.val = 0 )
|
||||
|
||||
/* Get at RetVal.v.val easily */
|
||||
#define RETVAL info->retval.v.val
|
||||
@@ -260,6 +271,7 @@ BuiltinFunc Func[] = {
|
||||
{ "catcherr", 0, 0, 0, FCatchErr, NULL },
|
||||
{ "char", 1, NO_MAX, 1, FChar, NULL },
|
||||
{ "choose", 2, NO_MAX, 1, NULL, FChoose }, /*NEW-STYLE*/
|
||||
{ "codepoint", 1, 1, 1, FCodepoint, NULL },
|
||||
{ "coerce", 2, 2, 1, FCoerce, NULL },
|
||||
{ "columns", 0, 1, 0, FColumns, NULL },
|
||||
{ "const", 1, 1, 1, FNonconst, NULL },
|
||||
@@ -286,6 +298,7 @@ BuiltinFunc Func[] = {
|
||||
{ "hebday", 1, 1, 0, FHebday, NULL },
|
||||
{ "hebmon", 1, 1, 0, FHebmon, NULL },
|
||||
{ "hebyear", 1, 1, 0, FHebyear, NULL },
|
||||
{ "hex", 1, 1, 1, FHex, NULL },
|
||||
{ "hour", 1, 1, 1, FHour, NULL },
|
||||
{ "htmlescape", 1, 1, 1, FHtmlEscape, NULL },
|
||||
{ "htmlstriptags",1, 1, 1, FHtmlStriptags, NULL },
|
||||
@@ -300,6 +313,10 @@ BuiltinFunc Func[] = {
|
||||
{ "localtoutc", 1, 1, 1, FLocalToUTC, NULL },
|
||||
{ "lower", 1, 1, 1, FLower, NULL },
|
||||
{ "max", 1, NO_MAX, 1, FMax, NULL },
|
||||
{ "mbchar", 1, NO_MAX, 1, FMbchar, NULL },
|
||||
{ "mbindex", 2, 3, 1, FMbindex, NULL },
|
||||
{ "mbstrlen", 1, 1, 1, FMbstrlen, NULL },
|
||||
{ "mbsubstr", 2, 3, 1, FMbsubstr, NULL },
|
||||
{ "min", 1, NO_MAX, 1, FMin, NULL },
|
||||
{ "minsfromutc", 0, 2, 0, FMinsfromutc, NULL },
|
||||
{ "minute", 1, 1, 1, FMinute, NULL },
|
||||
@@ -347,15 +364,19 @@ BuiltinFunc Func[] = {
|
||||
{ "trig", 0, NO_MAX, 0, FTrig, NULL },
|
||||
{ "trigback", 0, 0, 0, FTrigback, NULL },
|
||||
{ "trigbase", 0, 0, 0, FTrigbase, NULL },
|
||||
{ "trigcompletethrough", 0, 0, 0, FTrigcompletethrough, NULL },
|
||||
{ "trigdate", 0, 0, 0, FTrigdate, NULL },
|
||||
{ "trigdatetime", 0, 0, 0, FTrigdatetime, NULL },
|
||||
{ "trigdelta", 0, 0, 0, FTrigdelta, NULL },
|
||||
{ "trigduration", 0, 0, 0, FTrigduration, NULL },
|
||||
{ "trigeventduration", 0, 0, 0, FTrigeventduration, NULL },
|
||||
{ "trigeventstart", 0, 0, 0, FTrigeventstart, NULL },
|
||||
{ "trigeventstarttz", 0, 0, 0, FTrigeventstarttz, NULL },
|
||||
{ "trigfrom", 0, 0, 0, FTrigfrom, NULL },
|
||||
{ "trigger", 1, 3, 0, FTrigger, NULL },
|
||||
{ "triginfo", 1, 1, 0, FTriginfo, NULL },
|
||||
{ "trigistodo", 0, 0, 0, FTrigistodo, NULL },
|
||||
{ "trigmaxoverdue", 0, 0, 0, FTrigmaxoverdue, NULL },
|
||||
{ "trigpriority", 0, 0, 0, FTrigpriority, NULL },
|
||||
{ "trigrep", 0, 0, 0, FTrigrep, NULL },
|
||||
{ "trigscanfrom", 0, 0, 0, FTrigscanfrom, NULL },
|
||||
@@ -363,6 +384,8 @@ BuiltinFunc Func[] = {
|
||||
{ "trigtime", 0, 0, 0, FTrigtime, NULL },
|
||||
{ "trigtimedelta",0, 0, 0, FTrigtimedelta, NULL },
|
||||
{ "trigtimerep", 0, 0, 0, FTrigtimerep, NULL },
|
||||
{ "trigtimetz", 0, 0, 0, FTrigtimetz, NULL },
|
||||
{ "trigtz", 0, 0, 0, FTrigtz, NULL },
|
||||
{ "triguntil", 0, 0, 0, FTriguntil, NULL },
|
||||
{ "trigvalid", 0, 0, 0, FTrigvalid, NULL },
|
||||
{ "typeof", 1, 1, 1, FTypeof, NULL },
|
||||
@@ -465,6 +488,28 @@ static int FStrlen(func_info *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FMBstrlen - string length in wide characters */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FMbstrlen(func_info *info)
|
||||
{
|
||||
#ifdef REM_USE_WCHAR
|
||||
ASSERT_TYPE(0, STR_TYPE);
|
||||
size_t l = mbstowcs(NULL, ARGSTR(0), 0);
|
||||
if (l == (size_t) -1) {
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
if (l > INT_MAX) return E_2HIGH;
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = (int) l;
|
||||
return OK;
|
||||
#else
|
||||
return E_NO_MB;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FBaseyr - system base year */
|
||||
@@ -687,10 +732,50 @@ static int FAsc(func_info *info)
|
||||
{
|
||||
ASSERT_TYPE(0, STR_TYPE);
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = *(ARGSTR(0));
|
||||
RETVAL = (int) *( (unsigned char const *) ARGSTR(0));
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FHex - return hexadecimal representation of an integer */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FHex(func_info *info)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
ASSERT_TYPE(0, INT_TYPE);
|
||||
snprintf(buf, sizeof(buf), "%X", (unsigned int) ARGV(0));
|
||||
return RetStrVal(buf, info);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FCodepoint - wide-character codepoint of start of str */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FCodepoint(func_info *info)
|
||||
{
|
||||
#ifdef REM_USE_WCHAR
|
||||
wchar_t arr[2];
|
||||
size_t len;
|
||||
|
||||
ASSERT_TYPE(0, STR_TYPE);
|
||||
|
||||
len = mbstowcs(arr, ARGSTR(0), sizeof(arr) / sizeof(arr[0]));
|
||||
if (len == (size_t) -1) {
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = (int) arr[0];
|
||||
return OK;
|
||||
#else
|
||||
return E_NO_MB;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FChar - build a string from ASCII values */
|
||||
@@ -739,6 +824,65 @@ static int FChar(func_info *info)
|
||||
*(RetVal.v.str + Nargs) = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FMbchar - build a string from wide character code points */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FMbchar(func_info *info)
|
||||
{
|
||||
#ifdef REM_USE_WCHAR
|
||||
int i;
|
||||
size_t len;
|
||||
wchar_t *arr;
|
||||
char *s;
|
||||
|
||||
for (i=0; i<Nargs; i++) {
|
||||
ASSERT_TYPE(i, INT_TYPE);
|
||||
}
|
||||
|
||||
/* Special case of one arg - if given value 0, create empty string */
|
||||
if (Nargs == 1) {
|
||||
if (ARGV(0) == 0) {
|
||||
return RetStrVal("", info);
|
||||
}
|
||||
}
|
||||
|
||||
arr = calloc(Nargs+1, sizeof(wchar_t));
|
||||
if (!arr) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
for (i=0; i<Nargs; i++) {
|
||||
if (ARGV(i) <= 0) {
|
||||
return E_2LOW;
|
||||
}
|
||||
arr[i] = (wchar_t) ARGV(i);
|
||||
}
|
||||
arr[Nargs] = (wchar_t) 0;
|
||||
|
||||
len = wcstombs(NULL, arr, 0);
|
||||
if (len == (size_t) -1) {
|
||||
free( (void *) arr);
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
|
||||
s = malloc(len+1);
|
||||
if (!s) {
|
||||
free( (void *) arr);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(void) wcstombs(s, arr, len+1);
|
||||
free( (void *) arr);
|
||||
RetVal.type = STR_TYPE;
|
||||
RetVal.v.str = s;
|
||||
return OK;
|
||||
#else
|
||||
return E_NO_MB;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* Functions for extracting the components of a date. */
|
||||
@@ -1150,6 +1294,7 @@ static int FAmpm(func_info *info)
|
||||
/***************************************************************/
|
||||
static int FOrd(func_info *info)
|
||||
{
|
||||
static int in_ford = 0;
|
||||
int t, u, v;
|
||||
char const *s;
|
||||
|
||||
@@ -1157,6 +1302,42 @@ static int FOrd(func_info *info)
|
||||
|
||||
ASSERT_TYPE(0, INT_TYPE);
|
||||
|
||||
if (!in_ford && UserFuncExists("ordx") == 1) {
|
||||
/* Can't use EvalExprRunDisabled here because we need
|
||||
the nonconst result */
|
||||
expr_node *n;
|
||||
int r;
|
||||
char const *e = buf;
|
||||
Value val;
|
||||
int nonconst;
|
||||
int old_rundisabled;
|
||||
|
||||
val.type = ERR_TYPE;
|
||||
snprintf(buf, sizeof(buf), "ordx(%d)", ARGV(0));
|
||||
n = parse_expression(&e, &r, NULL);
|
||||
if (r != OK) {
|
||||
return r;
|
||||
}
|
||||
in_ford = 1;
|
||||
old_rundisabled = RunDisabled;
|
||||
RunDisabled |= RUN_CB;
|
||||
r = evaluate_expr_node(n, NULL, &val, &nonconst);
|
||||
RunDisabled = old_rundisabled;
|
||||
in_ford = 0;
|
||||
free_expr_tree(n);
|
||||
if (r != OK) {
|
||||
return r;
|
||||
}
|
||||
if (nonconst) info->nonconst = nonconst;
|
||||
r = DoCoerce(STR_TYPE, &val);
|
||||
if (r != OK) {
|
||||
DestroyValue(val);
|
||||
return r;
|
||||
}
|
||||
DCOPYVAL(RetVal, val);
|
||||
return OK;
|
||||
}
|
||||
|
||||
v = ARGV(0);
|
||||
if (v < 0) {
|
||||
t = (-v) % 100;
|
||||
@@ -1184,7 +1365,7 @@ static int FOrd(func_info *info)
|
||||
static int FPad(func_info *info)
|
||||
{
|
||||
int r;
|
||||
char *s;
|
||||
char const *s;
|
||||
DynamicBuffer dbuf;
|
||||
size_t len;
|
||||
size_t wantlen;
|
||||
@@ -1866,6 +2047,32 @@ static int FTrigback(func_info *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigcompletethrough(func_info *info)
|
||||
{
|
||||
if (!LastTrigger.is_todo || LastTrigger.complete_through == NO_DATE) {
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = 0;
|
||||
return OK;
|
||||
}
|
||||
RetVal.type = DATE_TYPE;
|
||||
RETVAL = LastTrigger.complete_through;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigistodo(func_info *info)
|
||||
{
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = LastTrigger.is_todo;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigmaxoverdue(func_info *info)
|
||||
{
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = LastTrigger.max_overdue;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigdelta(func_info *info)
|
||||
{
|
||||
RetVal.type = INT_TYPE;
|
||||
@@ -1887,6 +2094,14 @@ static int FTrigtimerep(func_info *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigtz(func_info *info)
|
||||
{
|
||||
if (!LastTrigger.tz) {
|
||||
return RetStrVal("", info);
|
||||
}
|
||||
return RetStrVal(LastTrigger.tz, info);
|
||||
}
|
||||
|
||||
static int FTrigeventduration(func_info *info)
|
||||
{
|
||||
if (LastTrigger.eventduration == NO_TIME) {
|
||||
@@ -1922,6 +2137,22 @@ static int FTrigeventstart(func_info *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigeventstarttz(func_info *info)
|
||||
{
|
||||
if (LastTrigger.eventstart == NO_TIME) {
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = -1;
|
||||
} else {
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
if (LastTrigger.eventstart_orig != NO_TIME) {
|
||||
RETVAL = LastTrigger.eventstart_orig;
|
||||
} else {
|
||||
RETVAL = LastTrigger.eventstart;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigduration(func_info *info)
|
||||
{
|
||||
if (LastTimeTrig.duration == NO_TIME) {
|
||||
@@ -1967,12 +2198,12 @@ static int FTriguntil(func_info *info)
|
||||
|
||||
static int FTrigscanfrom(func_info *info)
|
||||
{
|
||||
if (LastTrigger.scanfrom == NO_DATE) {
|
||||
if (get_scanfrom(&LastTrigger) == NO_DATE) {
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = -1;
|
||||
} else {
|
||||
RetVal.type = DATE_TYPE;
|
||||
RETVAL = LastTrigger.scanfrom;
|
||||
RETVAL = get_scanfrom(&LastTrigger);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@@ -2008,6 +2239,22 @@ static int FTrigtime(func_info *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigtimetz(func_info *info)
|
||||
{
|
||||
if (LastTriggerTime != NO_TIME) {
|
||||
RetVal.type = TIME_TYPE;
|
||||
if (LastTimeTrig.ttime_orig != NO_TIME) {
|
||||
RETVAL = LastTimeTrig.ttime_orig;
|
||||
} else {
|
||||
RETVAL = LastTriggerTime;
|
||||
}
|
||||
} else {
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigdatetime(func_info *info)
|
||||
{
|
||||
if (!LastTrigValid) {
|
||||
@@ -2110,6 +2357,10 @@ static int FTrigger(func_info *info)
|
||||
tim = ARGV(1);
|
||||
if (ARGV(2)) {
|
||||
UTCToLocal(date, tim, &date, &tim);
|
||||
if (date < 0) {
|
||||
date = 0;
|
||||
tim = 0;
|
||||
}
|
||||
}
|
||||
} else if (Nargs > 1) {
|
||||
/* Date Time */
|
||||
@@ -2124,6 +2375,10 @@ static int FTrigger(func_info *info)
|
||||
ASSERT_TYPE(1, INT_TYPE);
|
||||
if (ARGV(1)) {
|
||||
UTCToLocal(date, tim, &date, &tim);
|
||||
if (date < 0) {
|
||||
date = 0;
|
||||
tim = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2256,6 +2511,75 @@ static int FSubstr(func_info *info)
|
||||
return RetStrVal(t, info);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FMbubstr */
|
||||
/* */
|
||||
/* The mbsubstr function. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FMbsubstr(func_info *info)
|
||||
{
|
||||
#ifdef REM_USE_WCHAR
|
||||
wchar_t *str;
|
||||
wchar_t *s;
|
||||
wchar_t const *t;
|
||||
size_t mblen;
|
||||
char *converted;
|
||||
size_t len;
|
||||
int start;
|
||||
int end;
|
||||
|
||||
if (ARG(0).type != STR_TYPE || ARG(1).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (Nargs == 3 && ARG(2).type != INT_TYPE) return E_BAD_TYPE;
|
||||
|
||||
mblen = mbstowcs(NULL, ARGSTR(0), 0);
|
||||
if (mblen == (size_t) -1) {
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
str = calloc(mblen+1, sizeof(wchar_t));
|
||||
if (!str) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(void) mbstowcs(str, ARGSTR(0), mblen+1);
|
||||
s = str;
|
||||
start = 1;
|
||||
while (start < ARGV(1)) {
|
||||
if (!*s) break;
|
||||
s++;
|
||||
start++;
|
||||
}
|
||||
t = s;
|
||||
if (Nargs >= 3) {
|
||||
end = start;
|
||||
while (end <= ARGV(2)) {
|
||||
if (!*s) break;
|
||||
s++;
|
||||
end++;
|
||||
}
|
||||
*s = (wchar_t) 0;
|
||||
}
|
||||
|
||||
len = wcstombs(NULL, t, 0);
|
||||
if (len == (size_t) -1) {
|
||||
free( (void *) str);
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
converted = malloc(len+1);
|
||||
if (!converted) {
|
||||
free( (void *) str);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(void) wcstombs(converted, t, len+1);
|
||||
RetVal.type = STR_TYPE;
|
||||
RetVal.v.str = converted;
|
||||
free( (void *) str);
|
||||
return OK;
|
||||
#else
|
||||
return E_NO_MB;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FIndex */
|
||||
@@ -2294,6 +2618,73 @@ static int FIndex(func_info *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FMbindex */
|
||||
/* */
|
||||
/* The wide-char of one string embedded in another. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FMbindex(func_info *info)
|
||||
{
|
||||
#ifdef REM_USE_WCHAR
|
||||
wchar_t *haystack;
|
||||
wchar_t *needle;
|
||||
wchar_t const *s;
|
||||
size_t haylen, needlelen;
|
||||
|
||||
if (ARG(0).type != STR_TYPE || ARG(1).type != STR_TYPE ||
|
||||
(Nargs == 3 && ARG(2).type != INT_TYPE)) return E_BAD_TYPE;
|
||||
|
||||
haylen = mbstowcs(NULL, ARGSTR(0), INT_MAX);
|
||||
if (haylen == (size_t) -1) {
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
haystack = calloc(haylen+1, sizeof(wchar_t));
|
||||
if (!haystack) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(void) mbstowcs(haystack, ARGSTR(0), haylen+1);
|
||||
needlelen = mbstowcs(NULL, ARGSTR(1), INT_MAX);
|
||||
if (needlelen == (size_t) -1) {
|
||||
free( (void *) haystack);
|
||||
return E_BAD_MB_SEQ;
|
||||
}
|
||||
needle = calloc(needlelen+1, sizeof(wchar_t));
|
||||
if (!needle) {
|
||||
free( (void *) haystack);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(void) mbstowcs(needle, ARGSTR(1), needlelen+1);
|
||||
s = haystack;
|
||||
|
||||
/* If 3 args, bump up the start */
|
||||
if (Nargs == 3) {
|
||||
if (ARGV(2) > (int) haylen) {
|
||||
s += haylen;
|
||||
} else {
|
||||
s += ARGV(2) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the string */
|
||||
RetVal.type = INT_TYPE;
|
||||
s = wcsstr(s, needle);
|
||||
if (!s) {
|
||||
free( (void *) haystack);
|
||||
free( (void *) needle);
|
||||
RETVAL = 0;
|
||||
return OK;
|
||||
}
|
||||
RETVAL = s - haystack + 1;
|
||||
free( (void *) haystack);
|
||||
free( (void *) needle);
|
||||
return OK;
|
||||
#else
|
||||
return E_NO_MB;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FIif */
|
||||
@@ -2990,7 +3381,8 @@ static int FTimeStuff(int wantmins, func_info *info)
|
||||
static int FTimezone(func_info *info)
|
||||
{
|
||||
int yr, mon, day, hr, min, dse, now;
|
||||
struct tm local, *withzone;
|
||||
struct tm local;
|
||||
struct tm const * withzone;
|
||||
time_t t;
|
||||
char buf[64];
|
||||
|
||||
@@ -3379,7 +3771,7 @@ static int FADusk(func_info *info)
|
||||
static int FFiledate(func_info *info)
|
||||
{
|
||||
struct stat statbuf;
|
||||
struct tm *t1;
|
||||
struct tm const *t1;
|
||||
|
||||
RetVal.type = DATE_TYPE;
|
||||
|
||||
@@ -3410,7 +3802,7 @@ static int FFiledate(func_info *info)
|
||||
static int FFiledatetime(func_info *info)
|
||||
{
|
||||
struct stat statbuf;
|
||||
struct tm *t1;
|
||||
struct tm const *t1;
|
||||
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
|
||||
@@ -3801,7 +4193,7 @@ static void unsetenv(char const *varname)
|
||||
/* Conversion between different timezones. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int tz_set_tz(char const *tz)
|
||||
int tz_set_tz(char const *tz)
|
||||
{
|
||||
int r;
|
||||
if (tz == NULL) {
|
||||
@@ -3814,14 +4206,14 @@ static int tz_set_tz(char const *tz)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int tz_convert(int year, int month, int day,
|
||||
int tz_convert(int year, int month, int day,
|
||||
int hour, int minute,
|
||||
char const *src_tz, char const *tgt_tz,
|
||||
struct tm *tm)
|
||||
{
|
||||
int r;
|
||||
time_t t;
|
||||
struct tm *res;
|
||||
struct tm const *res;
|
||||
char const *old_tz;
|
||||
|
||||
/* init tm struct */
|
||||
@@ -3841,9 +4233,12 @@ static int tz_convert(int year, int month, int day,
|
||||
old_tz = StrDup(old_tz);
|
||||
if (!old_tz) return E_NO_MEM;
|
||||
}
|
||||
if (tgt_tz == NULL) {
|
||||
if (tgt_tz == NULL || !*tgt_tz) {
|
||||
tgt_tz = old_tz;
|
||||
}
|
||||
if (src_tz == NULL || !*src_tz) {
|
||||
src_tz = old_tz;
|
||||
}
|
||||
|
||||
/* set source TZ */
|
||||
r = tz_set_tz(src_tz);
|
||||
@@ -4092,7 +4487,7 @@ FEval(func_info *info)
|
||||
{
|
||||
expr_node *n;
|
||||
int r;
|
||||
int run_was_enabled = 0;
|
||||
int old_run_disabled;
|
||||
|
||||
ASSERT_TYPE(0, STR_TYPE);
|
||||
char const *e = ARGSTR(0);
|
||||
@@ -4104,14 +4499,13 @@ FEval(func_info *info)
|
||||
}
|
||||
|
||||
/* Disable shell() command in eval */
|
||||
if (! (RunDisabled & RUN_IN_EVAL)) {
|
||||
run_was_enabled = 1;
|
||||
RunDisabled |= RUN_IN_EVAL;
|
||||
}
|
||||
old_run_disabled = RunDisabled;
|
||||
RunDisabled |= RUN_IN_EVAL;
|
||||
|
||||
r = evaluate_expr_node(n, NULL, &(info->retval), &(info->nonconst));
|
||||
if (run_was_enabled) {
|
||||
RunDisabled &= ~RUN_IN_EVAL;
|
||||
}
|
||||
|
||||
RunDisabled = old_run_disabled;
|
||||
|
||||
free_expr_tree(n);
|
||||
return r;
|
||||
}
|
||||
@@ -4140,25 +4534,32 @@ FEvalTrig(func_info *info)
|
||||
DestroyParser(&p);
|
||||
return r;
|
||||
}
|
||||
if (trig.tz != NULL && tim.ttime == NO_TIME) {
|
||||
FreeTrig(&trig);
|
||||
return E_TZ_NO_AT;
|
||||
}
|
||||
if (trig.typ != NO_TYPE) {
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
if (scanfrom == NO_DATE) {
|
||||
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
|
||||
EnterTimezone(trig.tz);
|
||||
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 0);
|
||||
ExitTimezone(trig.tz);
|
||||
} else {
|
||||
/* Hokey... */
|
||||
if (trig.scanfrom != DSEToday) {
|
||||
if (get_scanfrom(&trig) != DSEToday) {
|
||||
Wprint(tr("Warning: SCANFROM is ignored in two-argument form of evaltrig()"));
|
||||
}
|
||||
EnterTimezone(trig.tz);
|
||||
dse = ComputeTrigger(scanfrom, &trig, &tim, &r, 0);
|
||||
ExitTimezone(trig.tz);
|
||||
}
|
||||
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
|
||||
r = 0;
|
||||
dse = -1;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
DestroyParser(&p);
|
||||
if (r) return r;
|
||||
if (dse < 0) {
|
||||
@@ -4168,9 +4569,11 @@ FEvalTrig(func_info *info)
|
||||
RetVal.type = DATE_TYPE;
|
||||
RETVAL = dse;
|
||||
} else {
|
||||
dse = AdjustTriggerForTimeZone(&trig, dse, &tim);
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RETVAL = (MINUTES_PER_DAY * dse) + tim.ttime;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -4199,6 +4602,10 @@ FMultiTrig(func_info *info)
|
||||
DestroyParser(&p);
|
||||
return r;
|
||||
}
|
||||
if (trig.tz != NULL && tim.ttime == NO_TIME) {
|
||||
FreeTrig(&trig);
|
||||
return E_TZ_NO_AT;
|
||||
}
|
||||
if (trig.typ != NO_TYPE) {
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
@@ -4208,7 +4615,10 @@ FMultiTrig(func_info *info)
|
||||
Eprint(tr("Cannot use AT clause in multitrig() function"));
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
|
||||
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 0);
|
||||
|
||||
/* multitrig only does untimed reminders, so no need to worry
|
||||
about time zones */
|
||||
DestroyParser(&p);
|
||||
|
||||
if (r != E_CANT_TRIG) {
|
||||
@@ -4256,18 +4666,25 @@ FTrig(func_info *info)
|
||||
DestroyParser(&p);
|
||||
return r;
|
||||
}
|
||||
if (trig.tz != NULL && tim.ttime == NO_TIME) {
|
||||
FreeTrig(&trig);
|
||||
return E_TZ_NO_AT;
|
||||
}
|
||||
if (trig.typ != NO_TYPE) {
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
|
||||
EnterTimezone(trig.tz);
|
||||
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 0);
|
||||
ExitTimezone(trig.tz);
|
||||
DestroyParser(&p);
|
||||
|
||||
if (r == E_CANT_TRIG) {
|
||||
FreeTrig(&trig);
|
||||
continue;
|
||||
}
|
||||
dse = AdjustTriggerForTimeZone(&trig, dse, &tim);
|
||||
if (ShouldTriggerReminder(&trig, &tim, dse, &r)) {
|
||||
LastTrig = dse;
|
||||
RETVAL = dse;
|
||||
|
||||
@@ -35,6 +35,10 @@ EXTERN FILE *ErrFp;
|
||||
|
||||
#define MINUTES_PER_DAY 1440
|
||||
|
||||
#define TODOS_AND_EVENTS 0
|
||||
#define ONLY_TODOS 1
|
||||
#define ONLY_EVENTS 2
|
||||
|
||||
#define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
|
||||
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
|
||||
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
|
||||
@@ -43,6 +47,7 @@ EXTERN FILE *ErrFp;
|
||||
|
||||
EXTERN int DSEToday;
|
||||
EXTERN int RealToday;
|
||||
EXTERN int LocalDSEToday;
|
||||
EXTERN int CurDay;
|
||||
EXTERN int CurMon;
|
||||
EXTERN int CurYear;
|
||||
@@ -52,6 +57,8 @@ EXTERN int FreshLine;
|
||||
EXTERN int WarnedAboutImplicit;
|
||||
EXTERN uid_t TrustedUsers[MAX_TRUSTED_USERS];
|
||||
|
||||
EXTERN INIT( int JSONMode, 0);
|
||||
EXTERN INIT( int JSONLinesEmitted, 0);
|
||||
EXTERN INIT( int MaxLateMinutes, 0);
|
||||
EXTERN INIT( int NumTrustedUsers, 0);
|
||||
EXTERN INIT( char const *MsgCommand, NULL);
|
||||
@@ -61,6 +68,7 @@ EXTERN INIT( int DebugFlag, 0);
|
||||
EXTERN INIT( int DoCalendar, 0);
|
||||
EXTERN INIT( int DoSimpleCalendar, 0);
|
||||
EXTERN INIT( int DoSimpleCalDelta, 0);
|
||||
EXTERN INIT( int HideCompletedTodos, 0);
|
||||
EXTERN INIT( int DoPrefixLineNo, 0);
|
||||
EXTERN INIT( int MondayFirst, 0);
|
||||
EXTERN INIT( int AddBlankLines, 1);
|
||||
@@ -72,6 +80,7 @@ EXTERN INIT( int CalMonths, 0);
|
||||
EXTERN INIT( char const *CalType, "none");
|
||||
EXTERN INIT( int Hush, 0);
|
||||
EXTERN INIT( int NextMode, 0);
|
||||
EXTERN INIT( int TodoFilter, TODOS_AND_EVENTS);
|
||||
EXTERN INIT( int InfiniteDelta, 0);
|
||||
EXTERN INIT( int DefaultTDelta, 0);
|
||||
EXTERN INIT( int DefaultDelta, NO_DELTA);
|
||||
@@ -79,6 +88,10 @@ EXTERN INIT( int DeltaOverride, 0);
|
||||
EXTERN INIT( int RunDisabled, 0);
|
||||
EXTERN INIT( int ExpressionEvaluationDisabled, 0);
|
||||
EXTERN INIT( int ExpressionEvaluationTimeLimit, 0);
|
||||
EXTERN INIT( int ExpressionNodesEvaluated, 0);
|
||||
EXTERN INIT( int MaxExprNodesPerLine, 0);
|
||||
EXTERN INIT( int ExpressionNodesEvaluatedThisLine, 0);
|
||||
EXTERN INIT( int ExpressionNodeLimitPerLine, 0);
|
||||
EXTERN INIT( volatile sig_atomic_t ExpressionTimeLimitExceeded, 0);
|
||||
EXTERN INIT( int IgnoreOnce, 0);
|
||||
EXTERN INIT( char const *OnceFile, NULL);
|
||||
@@ -90,9 +103,11 @@ EXTERN INIT( int SortByPrio, SORT_NONE);
|
||||
EXTERN INIT( int UntimedBeforeTimed, 0);
|
||||
EXTERN INIT( int DefaultPrio, NO_PRIORITY);
|
||||
EXTERN INIT( int SysTime, -1);
|
||||
EXTERN INIT( int ParseUntriggered, 1);
|
||||
EXTERN INIT( int LocalSysTime, -1);
|
||||
EXTERN INIT( int ParseUntriggered, 0);
|
||||
|
||||
EXTERN char const *InitialFile;
|
||||
EXTERN char const *LocalTimeZone;
|
||||
EXTERN int FileAccessDate;
|
||||
|
||||
EXTERN INIT( int WeekdayOmits, 0);
|
||||
|
||||
@@ -99,8 +99,8 @@ static size_t bucket_choices[] = {
|
||||
int
|
||||
hash_table_init(hash_table *t,
|
||||
size_t link_offset,
|
||||
unsigned int (*hashfunc)(void *x),
|
||||
int (*compare)(void *a, void *b))
|
||||
unsigned int (*hashfunc)(void const *x),
|
||||
int (*compare)(void const *a, void const *b))
|
||||
{
|
||||
t->bucket_choice_index = 0;
|
||||
t->num_entries = 0;
|
||||
@@ -141,7 +141,7 @@ hash_table_free(hash_table *t)
|
||||
* \return The number of items in the hash table
|
||||
*/
|
||||
size_t
|
||||
hash_table_num_entries(hash_table *t)
|
||||
hash_table_num_entries(hash_table const *t)
|
||||
{
|
||||
return t->num_entries;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ hash_table_num_entries(hash_table *t)
|
||||
* \return The number of buckets in the hash table
|
||||
*/
|
||||
size_t
|
||||
hash_table_num_buckets(hash_table *t)
|
||||
hash_table_num_buckets(hash_table const *t)
|
||||
{
|
||||
if (t->bucket_choice_index >= NUM_BUCKET_CHOICES) {
|
||||
return 0;
|
||||
@@ -321,7 +321,7 @@ hash_table_find(hash_table *t, void *candidate)
|
||||
*
|
||||
* \return 0 on success, -1 on failure
|
||||
*/
|
||||
int
|
||||
static int
|
||||
hash_table_delete_helper(hash_table *t, void *item, int resize_ok)
|
||||
{
|
||||
if (!item) {
|
||||
|
||||
@@ -34,8 +34,8 @@ typedef struct {
|
||||
size_t num_entries; /**< Number of entries in the hash table */
|
||||
size_t hash_link_offset; /**< Offset of the struct hash_link in the container */
|
||||
void **buckets; /**< Array of buckets */
|
||||
unsigned int (*hashfunc)(void *x); /**< Pointer to the hashing function */
|
||||
int (*compare)(void *a, void *b); /**< Pointer to the comparison function */
|
||||
unsigned int (*hashfunc)(void const *x); /**< Pointer to the hashing function */
|
||||
int (*compare)(void const *a, void const *b); /**< Pointer to the comparison function */
|
||||
} hash_table;
|
||||
|
||||
/**
|
||||
@@ -56,11 +56,11 @@ struct hash_table_stats {
|
||||
|
||||
int hash_table_init(hash_table *t,
|
||||
size_t link_offset,
|
||||
unsigned int (*hashfunc)(void *x),
|
||||
int (*compare)(void *a, void *b));
|
||||
unsigned int (*hashfunc)(void const *x),
|
||||
int (*compare)(void const *a, void const *b));
|
||||
void hash_table_free(hash_table *t);
|
||||
size_t hash_table_num_entries(hash_table *t);
|
||||
size_t hash_table_num_buckets(hash_table *t);
|
||||
size_t hash_table_num_entries(hash_table const *t);
|
||||
size_t hash_table_num_buckets(hash_table const *t);
|
||||
size_t hash_table_chain_len(hash_table *t, size_t i);
|
||||
int hash_table_insert(hash_table *t, void *item);
|
||||
void *hash_table_find(hash_table *t, void *candidate);
|
||||
@@ -68,7 +68,6 @@ int hash_table_delete(hash_table *t, void *item);
|
||||
int hash_table_delete_no_resize(hash_table *t, void *item);
|
||||
void *hash_table_next(hash_table *t, void *cur);
|
||||
void hash_table_dump_stats(hash_table *t, FILE *fp);
|
||||
void hash_table_get_stats(hash_table *t, struct hash_table_stats *stat);
|
||||
|
||||
/**
|
||||
* \brief Iterate over all items in a hash table
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
static void hash_table_get_stats(hash_table *t, struct hash_table_stats *stat);
|
||||
|
||||
/**
|
||||
* \brief Dump hash table statistics to a stdio FILE
|
||||
*
|
||||
@@ -53,7 +55,7 @@ hash_table_dump_stats(hash_table *t, FILE *fp)
|
||||
* \param t A pointer to a hash_table object
|
||||
* \param stat A pointer to a hash_table_stats object that will be filled in
|
||||
*/
|
||||
void
|
||||
static void
|
||||
hash_table_get_stats(hash_table *t, struct hash_table_stats *stat)
|
||||
{
|
||||
size_t n = hash_table_num_buckets(t);
|
||||
|
||||
10
src/hbcal.c
10
src/hbcal.c
@@ -70,6 +70,8 @@ static char MaxMonLen[] = {
|
||||
|
||||
static char HebIsLeap[] = {0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1};
|
||||
|
||||
static long DaysToHebYear(int y);
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* RoshHashana */
|
||||
@@ -78,7 +80,7 @@ static char HebIsLeap[] = {0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1};
|
||||
/* Hebrew year. (ie, 5751, not 1990) */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int RoshHashana(int i)
|
||||
static int RoshHashana(int i)
|
||||
{
|
||||
long j;
|
||||
j = DaysToHebYear(i-3744) - CORRECTION;
|
||||
@@ -93,7 +95,7 @@ int RoshHashana(int i)
|
||||
/* from new moon before Tishrey 1 5701. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
long DaysToHebYear(int y)
|
||||
static long DaysToHebYear(int y)
|
||||
{
|
||||
long m, nm, dw, s, l;
|
||||
|
||||
@@ -126,7 +128,7 @@ long DaysToHebYear(int y)
|
||||
/* */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DaysInHebYear(int y)
|
||||
static int DaysInHebYear(int y)
|
||||
{
|
||||
long thisyear, nextyear;
|
||||
|
||||
@@ -143,7 +145,7 @@ int DaysInHebYear(int y)
|
||||
/* given the LENGTH of the Hebrew year. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
char const *DaysInHebMonths(int ylen)
|
||||
static char const *DaysInHebMonths(int ylen)
|
||||
{
|
||||
static char monlen[14] =
|
||||
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29, 29};
|
||||
|
||||
22
src/ifelse.c
22
src/ifelse.c
@@ -24,6 +24,9 @@ static int if_pointer = 0;
|
||||
/* The base pointer for the current file */
|
||||
static int base_pointer = 0;
|
||||
|
||||
/* True if a "RETURN" statement was encountered in current file */
|
||||
static int return_encountered = 0;
|
||||
|
||||
/*
|
||||
* The current state of the IF...ELSE...ENDIF context is stored in
|
||||
* an array of "ifentry" objects, from the outermost to the
|
||||
@@ -103,6 +106,19 @@ encounter_else(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DoReturn - handle the RETURN command */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int
|
||||
DoReturn(ParsePtr p)
|
||||
{
|
||||
int r = VerifyEoln(p);
|
||||
return_encountered = 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* encounter_endif - note that the most-recently-pushed IF */
|
||||
@@ -162,6 +178,10 @@ int
|
||||
should_ignore_line(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (return_encountered) {
|
||||
return 1;
|
||||
}
|
||||
for (i=base_pointer; i<if_pointer; i++) {
|
||||
if (( IfArray[i].if_true && !IfArray[i].before_else) ||
|
||||
(!IfArray[i].if_true && IfArray[i].before_else)) {
|
||||
@@ -193,11 +213,13 @@ in_constant_context(void)
|
||||
/* */
|
||||
/* pop_excess_ifs - pop excess IFs from the stack, printing */
|
||||
/* error messages as needed. */
|
||||
/* Also resets return_encountered */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void
|
||||
pop_excess_ifs(char const *fname)
|
||||
{
|
||||
return_encountered = 0;
|
||||
if (if_pointer <= base_pointer) {
|
||||
return;
|
||||
}
|
||||
|
||||
114
src/init.c
114
src/init.c
@@ -177,8 +177,25 @@ void InitRemind(int argc, char const *argv[])
|
||||
int dse;
|
||||
int ttyfd;
|
||||
|
||||
/* Make sure remind is not installed set-uid or set-gid */
|
||||
if (getgid() != getegid() ||
|
||||
getuid() != geteuid()) {
|
||||
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
dse = NO_DATE;
|
||||
|
||||
/* Initialize local time zone */
|
||||
LocalTimeZone = getenv("TZ");
|
||||
if (LocalTimeZone) {
|
||||
LocalTimeZone = StrDup(LocalTimeZone);
|
||||
if (!LocalTimeZone) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize variable hash table */
|
||||
InitVars();
|
||||
|
||||
@@ -203,13 +220,6 @@ void InitRemind(int argc, char const *argv[])
|
||||
|
||||
InitDedupeTable();
|
||||
|
||||
/* Make sure remind is not installed set-uid or set-gid */
|
||||
if (getgid() != getegid() ||
|
||||
getuid() != geteuid()) {
|
||||
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
y = NO_YR;
|
||||
m = NO_MON;
|
||||
d = NO_DAY;
|
||||
@@ -221,7 +231,9 @@ void InitRemind(int argc, char const *argv[])
|
||||
fprintf(ErrFp, "\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
LocalSysTime = SystemTime(0);
|
||||
DSEToday = RealToday;
|
||||
LocalDSEToday = DSEToday;
|
||||
FromDSE(DSEToday, &CurYear, &CurMon, &CurDay);
|
||||
|
||||
/* Initialize Latitude and Longitude */
|
||||
@@ -646,6 +658,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
case 'q': case 'Q': DebugFlag |= DB_TRANSLATE; break;
|
||||
case 'n': case 'N': DebugFlag |= DB_NONCONST; break;
|
||||
case 'u': case 'U': DebugFlag |= DB_UNUSED_VARS; break;
|
||||
case 'z': case 'Z': DebugFlag |= DB_SWITCH_ZONE; break;
|
||||
default:
|
||||
fprintf(ErrFp, GetErr(M_BAD_DB_FLAG), *(arg-1));
|
||||
fprintf(ErrFp, "\n");
|
||||
@@ -711,6 +724,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
if (SysTime != -1L) Usage();
|
||||
else {
|
||||
SysTime = (long) tok.val * 60L;
|
||||
LocalSysTime = SysTime;
|
||||
DontQueue = 1;
|
||||
Daemon = 0;
|
||||
}
|
||||
@@ -720,6 +734,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
if (SysTime != -1L) Usage();
|
||||
if (m != NO_MON || d != NO_DAY || y != NO_YR || dse != NO_DATE) Usage();
|
||||
SysTime = (tok.val % MINUTES_PER_DAY) * 60;
|
||||
LocalSysTime = SysTime;
|
||||
DontQueue = 1;
|
||||
Daemon = 0;
|
||||
dse = tok.val / MINUTES_PER_DAY;
|
||||
@@ -790,6 +805,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
fprintf(ErrFp, "%s", BadDate);
|
||||
Usage();
|
||||
}
|
||||
LocalDSEToday = DSEToday;
|
||||
CurYear = y;
|
||||
CurMon = m;
|
||||
CurDay = d;
|
||||
@@ -798,6 +814,15 @@ void InitRemind(int argc, char const *argv[])
|
||||
|
||||
}
|
||||
|
||||
/* JSON mode turns off sorting */
|
||||
if (JSONMode) {
|
||||
SortByTime = SORT_NONE;
|
||||
SortByDate = SORT_NONE;
|
||||
SortByPrio = SORT_NONE;
|
||||
/* Make sure we don't blat errors to stdout! */
|
||||
ErrFp = stderr;
|
||||
}
|
||||
|
||||
/* Figure out the offset from UTC */
|
||||
if (CalculateUTC) {
|
||||
(void) CalcMinsFromUTC(DSEToday, MinutesPastMidnight(0),
|
||||
@@ -848,6 +873,17 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -m Start calendar with Monday rather than Sunday\n");
|
||||
fprintf(ErrFp, " -y Synthesize tags for tagless reminders\n");
|
||||
fprintf(ErrFp, " -j[n] Run in 'purge' mode. [n = INCLUDE depth]\n");
|
||||
fprintf(ErrFp, "\nLong Options:\n");
|
||||
fprintf(ErrFp, " --version Print Remind version\n");
|
||||
fprintf(ErrFp, " --hide-completed-todos Don't show completed todos on calendar\n");
|
||||
fprintf(ErrFp, " --only-todos Only issue TODO reminders\n");
|
||||
fprintf(ErrFp, " --only-events Do not issue TODO reminders\n");
|
||||
fprintf(ErrFp, " --json Use JSON output instead of plain-text\n");
|
||||
fprintf(ErrFp, " --max-execution-time=n Limit execution time to n seconds\n");
|
||||
fprintf(ErrFp, " --max-expr-complexity=n Limit expression evaluation to n nodes per line\n");
|
||||
fprintf(ErrFp, " --print-config-cmd Print ./configure cmd used to build Remind\n");
|
||||
fprintf(ErrFp, " --print-errs Print all possible error messages\n");
|
||||
fprintf(ErrFp, " --print-tokens Print all possible Remind tokens\n");
|
||||
fprintf(ErrFp, "\nRemind home page: %s\n", PACKAGE_URL);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -998,17 +1034,15 @@ static void InitializeVar(char const *str)
|
||||
return;
|
||||
}
|
||||
if (!*str) {
|
||||
/* Setting a system var does require =expr on the commandline */
|
||||
if (*varname == '$') {
|
||||
fprintf(ErrFp, GetErr(M_I_OPTION), GetErr(E_MISS_EQ));
|
||||
fprintf(ErrFp, "\n");
|
||||
return;
|
||||
}
|
||||
val.type = INT_TYPE;
|
||||
val.v.val = 0;
|
||||
r = SetVar(varname, &val, 1);
|
||||
if (!r) {
|
||||
r = PreserveVar(varname);
|
||||
if (*varname == '$') {
|
||||
r = SetSysVar(varname+1, &val);
|
||||
} else {
|
||||
r = SetVar(varname, &val, 1);
|
||||
if (!r) {
|
||||
r = PreserveVar(varname);
|
||||
}
|
||||
}
|
||||
if (r) {
|
||||
fprintf(ErrFp, GetErr(M_I_OPTION), GetErr(r));
|
||||
@@ -1017,11 +1051,6 @@ static void InitializeVar(char const *str)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!*varname) {
|
||||
fprintf(ErrFp, GetErr(M_I_OPTION), GetErr(E_MISS_VAR));
|
||||
fprintf(ErrFp, "\n");
|
||||
return;
|
||||
}
|
||||
expr = str+1;
|
||||
if (!*expr) {
|
||||
fprintf(ErrFp, GetErr(M_I_OPTION), GetErr(E_MISS_EXPR));
|
||||
@@ -1063,7 +1092,7 @@ static void InitializeVar(char const *str)
|
||||
static void
|
||||
AddTrustedUser(char const *username)
|
||||
{
|
||||
struct passwd *pwent;
|
||||
struct passwd const *pwent;
|
||||
if (NumTrustedUsers >= MAX_TRUSTED_USERS) {
|
||||
fprintf(ErrFp, "Too many trusted users (%d max)\n",
|
||||
MAX_TRUSTED_USERS);
|
||||
@@ -1132,10 +1161,38 @@ ProcessLongOption(char const *arg)
|
||||
/* Update RealToday because of TestMode */
|
||||
RealToday = SystemDate(&CurYear, &CurMon, &CurDay);
|
||||
DSEToday = RealToday;
|
||||
LocalDSEToday = DSEToday;
|
||||
FromDSE(DSEToday, &CurYear, &CurMon, &CurDay);
|
||||
|
||||
return;
|
||||
}
|
||||
if (!strcmp(arg, "only-todos")) {
|
||||
if (TodoFilter == ONLY_EVENTS) {
|
||||
fprintf(ErrFp, "remind: Cannot combine --only-todos and --only-events\n");
|
||||
exit(1);
|
||||
}
|
||||
TodoFilter = ONLY_TODOS;
|
||||
return;
|
||||
}
|
||||
if (!strcmp(arg, "only-events")) {
|
||||
if (TodoFilter == ONLY_TODOS) {
|
||||
fprintf(ErrFp, "remind: Cannot combine --only-todos and --only-events\n");
|
||||
exit(1);
|
||||
}
|
||||
TodoFilter = ONLY_EVENTS;
|
||||
return;
|
||||
}
|
||||
if (!strcmp(arg, "flush")) {
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
return;
|
||||
}
|
||||
if (!strcmp(arg, "json")) {
|
||||
JSONMode = 1;
|
||||
DontQueue = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(arg, "version")) {
|
||||
printf("%s\n", VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
@@ -1154,12 +1211,25 @@ ProcessLongOption(char const *arg)
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (!strcmp(arg, "hide-completed-todos")) {
|
||||
HideCompletedTodos = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(arg, "print-tokens")) {
|
||||
print_remind_tokens();
|
||||
print_builtinfunc_tokens();
|
||||
print_sysvar_tokens();
|
||||
exit(0);
|
||||
}
|
||||
if (sscanf(arg, "max-expr-complexity=%d", &t) == 1) {
|
||||
if (t < 0) {
|
||||
fprintf(ErrFp, "%s: --max-expr-complexity must be non-negative\n", ArgV[0]);
|
||||
return;
|
||||
}
|
||||
ExpressionNodeLimitPerLine = t;
|
||||
return;
|
||||
}
|
||||
if (sscanf(arg, "max-execution-time=%d", &t) == 1) {
|
||||
if (t < 0) {
|
||||
fprintf(ErrFp, "%s: --max-execution-time must be non-negative\n", ArgV[0]);
|
||||
|
||||
27
src/json.c
27
src/json.c
@@ -47,19 +47,8 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifndef JSON_INT_T_OVERRIDDEN
|
||||
#if defined(_MSC_VER)
|
||||
/* https://docs.microsoft.com/en-us/cpp/cpp/data-type-ranges */
|
||||
#define JSON_INT_MAX 9223372036854775807LL
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
/* C99 */
|
||||
#define JSON_INT_MAX INT_FAST64_MAX
|
||||
#else
|
||||
/* C89 */
|
||||
#include <limits.h>
|
||||
#define JSON_INT_MAX LONG_MAX
|
||||
#endif
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#define JSON_INT_MAX LONG_MAX
|
||||
|
||||
#ifndef JSON_INT_MAX
|
||||
#define JSON_INT_MAX (json_int_t)(((unsigned json_int_t)(-1)) / (unsigned json_int_t)2);
|
||||
@@ -69,6 +58,8 @@ typedef unsigned int json_uchar;
|
||||
|
||||
const struct _json_value json_value_none;
|
||||
|
||||
static void json_value_free_ex (json_settings * settings, json_value * value);
|
||||
|
||||
static unsigned char hex_value (json_char c)
|
||||
{
|
||||
if (isdigit((unsigned char)c))
|
||||
@@ -252,10 +243,10 @@ static const long
|
||||
flag_block_comment = 1 << 14,
|
||||
flag_num_got_decimal = 1 << 15;
|
||||
|
||||
json_value * json_parse_ex (json_settings * settings,
|
||||
const json_char * json,
|
||||
size_t length,
|
||||
char * error_buf)
|
||||
static json_value * json_parse_ex (json_settings const * settings,
|
||||
const json_char * json,
|
||||
size_t length,
|
||||
char * error_buf)
|
||||
{
|
||||
char error [json_error_max];
|
||||
const json_char * end;
|
||||
@@ -999,7 +990,7 @@ json_value * json_parse (const json_char * json, size_t length)
|
||||
return json_parse_ex (&settings, json, length, 0);
|
||||
}
|
||||
|
||||
void json_value_free_ex (json_settings * settings, json_value * value)
|
||||
static void json_value_free_ex (json_settings * settings, json_value * value)
|
||||
{
|
||||
json_value * cur_value;
|
||||
|
||||
|
||||
12
src/json.h
12
src/json.h
@@ -266,21 +266,9 @@ json_value * json_parse (const json_char * json,
|
||||
size_t length);
|
||||
|
||||
#define json_error_max 128
|
||||
json_value * json_parse_ex (json_settings * settings,
|
||||
const json_char * json,
|
||||
size_t length,
|
||||
char * error);
|
||||
|
||||
void json_value_free (json_value *);
|
||||
|
||||
|
||||
/* Not usually necessary, unless you used a custom mem_alloc and now want to
|
||||
* use a custom mem_free.
|
||||
*/
|
||||
void json_value_free_ex (json_settings * settings,
|
||||
json_value *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
132
src/main.c
132
src/main.c
@@ -50,11 +50,15 @@
|
||||
#include "err.h"
|
||||
|
||||
static void DoReminders(void);
|
||||
static int DoDebug(ParsePtr p);
|
||||
static void ClearLastTriggers(void);
|
||||
static int DoBanner(ParsePtr p);
|
||||
static void SaveLastTimeTrig(TimeTrig const *t);
|
||||
|
||||
/* Macro for simplifying common block so as not to litter code */
|
||||
#define OUTPUT(c) do { if (output) { DBufPutc(output, c); } else { putchar(c); } } while(0)
|
||||
|
||||
void
|
||||
static void
|
||||
exitfunc(void)
|
||||
{
|
||||
/* Kill any execution-time-limiter process */
|
||||
@@ -80,6 +84,8 @@ exitfunc(void)
|
||||
|
||||
UnsetAllUserFuncs();
|
||||
print_expr_nodes_stats();
|
||||
fprintf(ErrFp, "Max expr node evaluations per line: %d\n", MaxExprNodesPerLine);
|
||||
fprintf(ErrFp, "Total expression node evaluations: %d\n", ExpressionNodesEvaluated);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +155,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
DBufInit(&(LastTrigger.tags));
|
||||
LastTrigger.infos = NULL;
|
||||
LastTrigger.tz = NULL;
|
||||
ClearLastTriggers();
|
||||
|
||||
atexit(exitfunc);
|
||||
@@ -168,6 +175,9 @@ int main(int argc, char *argv[])
|
||||
ShouldCache = (Iterations > 1);
|
||||
|
||||
while (Iterations--) {
|
||||
if (JSONMode) {
|
||||
printf("[\n");
|
||||
}
|
||||
PerIterationInit();
|
||||
DoReminders();
|
||||
|
||||
@@ -177,10 +187,48 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!Hush) {
|
||||
if (DestroyOmitContexts(1))
|
||||
if (DestroyOmitContexts(1)) {
|
||||
FreshLine = 1;
|
||||
Eprint("%s", GetErr(E_PUSH_NOPOP));
|
||||
}
|
||||
if (EmptyVarStack(1)) {
|
||||
FreshLine = 1;
|
||||
Eprint("%s", GetErr(E_PUSHV_NO_POP));
|
||||
}
|
||||
if (EmptyUserFuncStack(1)) {
|
||||
FreshLine = 1;
|
||||
Eprint("%s", GetErr(E_PUSHF_NO_POP));
|
||||
}
|
||||
if (!Daemon && !NextMode && !NumTriggered && !NumQueued) {
|
||||
printf("%s\n", GetErr(E_NOREMINDERS));
|
||||
if (!JSONMode) {
|
||||
printf("%s\n", GetErr(E_NOREMINDERS));
|
||||
} else {
|
||||
if (!DidMsgReminder) {
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
/* Do a banner in JSON mode*/
|
||||
if (!DoSubstFromString(DBufValue(&Banner), &buf,
|
||||
DSEToday, NO_TIME) &&
|
||||
DBufLen(&buf)) {
|
||||
if (JSONLinesEmitted) {
|
||||
printf("},\n");
|
||||
}
|
||||
JSONLinesEmitted++;
|
||||
printf("{\"banner\":\"");
|
||||
remove_trailing_newlines(&buf);
|
||||
PrintJSONString(DBufValue(&buf));
|
||||
printf("\"");
|
||||
}
|
||||
DBufFree(&buf);
|
||||
}
|
||||
if (JSONLinesEmitted) {
|
||||
printf("},\n");
|
||||
}
|
||||
printf("{\"noreminders\":\"");
|
||||
PrintJSONString(GetErr(E_NOREMINDERS));
|
||||
printf("\"");
|
||||
JSONLinesEmitted++;
|
||||
}
|
||||
} else if (!Daemon && !NextMode && !NumTriggered) {
|
||||
printf(GetErr(M_QUEUED), NumQueued);
|
||||
printf("\n");
|
||||
@@ -190,6 +238,12 @@ int main(int argc, char *argv[])
|
||||
/* If there are sorted reminders, handle them */
|
||||
if (SortByDate) IssueSortedReminders();
|
||||
|
||||
if (JSONMode) {
|
||||
if (JSONLinesEmitted) {
|
||||
printf("}\n");
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
/* If there are any background reminders queued up, handle them */
|
||||
if (NumQueued || Daemon) {
|
||||
|
||||
@@ -231,11 +285,14 @@ PerIterationInit(void)
|
||||
{
|
||||
ClearGlobalOmits();
|
||||
DestroyOmitContexts(1);
|
||||
EmptyVarStack(1);
|
||||
EmptyUserFuncStack(1);
|
||||
DestroyVars(0);
|
||||
DefaultColorR = -1;
|
||||
DefaultColorG = -1;
|
||||
DefaultColorB = -1;
|
||||
NumTriggered = 0;
|
||||
JSONLinesEmitted = 0;
|
||||
ClearLastTriggers();
|
||||
ClearDedupeTable();
|
||||
}
|
||||
@@ -317,6 +374,7 @@ static void DoReminders(void)
|
||||
case T_Rem: r=DoRem(&p); purge_handled = 1; break;
|
||||
case T_ErrMsg: r=DoErrMsg(&p); break;
|
||||
case T_If: r=DoIf(&p); break;
|
||||
case T_Return: r=DoReturn(&p); break;
|
||||
case T_IfTrig: r=DoIfTrig(&p); break;
|
||||
case T_Else: r=DoElse(&p); break;
|
||||
case T_EndIf: r=DoEndif(&p); break;
|
||||
@@ -362,6 +420,18 @@ static void DoReminders(void)
|
||||
case T_Pop: r=PopOmitContext(&p); break;
|
||||
case T_Preserve: r=DoPreserve(&p); break;
|
||||
case T_Push: r=PushOmitContext(&p); break;
|
||||
case T_PushVars:
|
||||
r=PushVars(&p);
|
||||
break;
|
||||
case T_PopVars:
|
||||
r=PopVars(&p);
|
||||
break;
|
||||
case T_PushFuncs:
|
||||
r=PushUserFuncs(&p);
|
||||
break;
|
||||
case T_PopFuncs:
|
||||
r=PopUserFuncs(&p);
|
||||
break;
|
||||
case T_Expr: r = DoExpr(&p); break;
|
||||
case T_Translate: r = DoTranslate(&p); break;
|
||||
case T_RemType: if (tok.val == RUN_TYPE) {
|
||||
@@ -1067,7 +1137,7 @@ int PushToken(char const *tok, ParsePtr p)
|
||||
int SystemTime(int realtime)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *t;
|
||||
struct tm const *t;
|
||||
|
||||
if (!realtime && (SysTime != -1)) return SysTime;
|
||||
|
||||
@@ -1107,7 +1177,7 @@ int MinutesPastMidnight(int realtime)
|
||||
int SystemDate(int *y, int *m, int *d)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *t;
|
||||
struct tm const *t;
|
||||
|
||||
/* In test mode, always return 6 January 2025 */
|
||||
if (TestMode) {
|
||||
@@ -1223,7 +1293,9 @@ int DoIfTrig(ParsePtr p)
|
||||
} else {
|
||||
if ( (r=ParseRem(p, &trig, &tim)) ) return r;
|
||||
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
|
||||
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||
EnterTimezone(trig.tz);
|
||||
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 1);
|
||||
ExitTimezone(trig.tz);
|
||||
if (r) {
|
||||
if (r != E_CANT_TRIG || !trig.maybe_uncomputable) {
|
||||
if (!Hush || r != E_RUN_DISABLED) {
|
||||
@@ -1232,6 +1304,9 @@ int DoIfTrig(ParsePtr p)
|
||||
}
|
||||
push_if(0, 0);
|
||||
} else {
|
||||
if (dse >= 0) {
|
||||
dse = AdjustTriggerForTimeZone(&trig, dse, &tim);
|
||||
}
|
||||
if (ShouldTriggerReminder(&trig, &tim, dse, &err)) {
|
||||
push_if(1, 0);
|
||||
} else {
|
||||
@@ -1281,7 +1356,7 @@ int VerifyEoln(ParsePtr p)
|
||||
/* Set the debug options under program control. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DoDebug(ParsePtr p)
|
||||
static int DoDebug(ParsePtr p)
|
||||
{
|
||||
int err;
|
||||
int ch;
|
||||
@@ -1372,6 +1447,11 @@ int DoDebug(ParsePtr p)
|
||||
if (val) DebugFlag |= DB_UNUSED_VARS;
|
||||
else DebugFlag &= ~DB_UNUSED_VARS;
|
||||
break;
|
||||
case 'z':
|
||||
case 'Z':
|
||||
if (val) DebugFlag |= DB_SWITCH_ZONE;
|
||||
else DebugFlag &= ~DB_SWITCH_ZONE;
|
||||
break;
|
||||
default:
|
||||
Wprint(GetErr(M_BAD_DB_FLAG), ch);
|
||||
break;
|
||||
@@ -1387,7 +1467,7 @@ int DoDebug(ParsePtr p)
|
||||
/* reminder is issued. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DoBanner(ParsePtr p)
|
||||
static int DoBanner(ParsePtr p)
|
||||
{
|
||||
int err;
|
||||
int c;
|
||||
@@ -1509,6 +1589,15 @@ void DoExit(ParsePtr p)
|
||||
|
||||
if (PurgeMode) return;
|
||||
|
||||
if (JSONMode) {
|
||||
if (JSONLinesEmitted) {
|
||||
printf("}\n");
|
||||
}
|
||||
/* Close the reminder list */
|
||||
printf("]\n");
|
||||
}
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
r = EvaluateExpr(p, &v);
|
||||
if (r || v.type != INT_TYPE) exit(99);
|
||||
exit(v.v.val);
|
||||
@@ -1571,7 +1660,8 @@ int CalcMinsFromUTC(int dse, int tim, int *mins, int *isdst)
|
||||
/* Convert dse and tim to an Unix tm struct */
|
||||
int yr, mon, day;
|
||||
int tdiff;
|
||||
struct tm local, utc, *temp;
|
||||
struct tm local, utc;
|
||||
struct tm const * temp;
|
||||
time_t loc_t, utc_t;
|
||||
int isdst_tmp;
|
||||
|
||||
@@ -1962,10 +2052,14 @@ FreeTrig(Trigger *t)
|
||||
if (t->infos) {
|
||||
FreeTrigInfoChain(t->infos);
|
||||
}
|
||||
if (t->tz) {
|
||||
free( (void *) t->tz);
|
||||
}
|
||||
t->tz = NULL;
|
||||
t->infos = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ClearLastTriggers(void)
|
||||
{
|
||||
LastTrigger.expired = 0;
|
||||
@@ -1988,11 +2082,17 @@ ClearLastTriggers(void)
|
||||
LastTrigger.warn[0] = 0;
|
||||
LastTrigger.omitfunc[0] = 0;
|
||||
LastTrigger.passthru[0] = 0;
|
||||
LastTrigger.is_todo = 0;
|
||||
LastTrigger.complete_through = NO_DATE;
|
||||
LastTrigger.max_overdue = -1;
|
||||
FreeTrig(&LastTrigger);
|
||||
|
||||
LastTimeTrig.ttime = NO_TIME;
|
||||
LastTimeTrig.ttime_orig = NO_TIME;
|
||||
LastTimeTrig.delta = NO_DELTA;
|
||||
LastTimeTrig.rep = NO_REP;
|
||||
LastTimeTrig.duration = NO_TIME;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2017,6 +2117,9 @@ SaveLastTrigger(Trigger const *t)
|
||||
LastTrigger.infos = NULL;
|
||||
DBufInit(&(LastTrigger.tags));
|
||||
|
||||
if (LastTrigger.tz) {
|
||||
LastTrigger.tz = StrDup(LastTrigger.tz);
|
||||
}
|
||||
DBufPuts(&(LastTrigger.tags), DBufValue(&(t->tags)));
|
||||
TrigInfo *cur = t->infos;
|
||||
while(cur) {
|
||||
@@ -2025,7 +2128,7 @@ SaveLastTrigger(Trigger const *t)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SaveLastTimeTrig(TimeTrig const *t)
|
||||
{
|
||||
memcpy(&LastTimeTrig, t, sizeof(LastTimeTrig));
|
||||
@@ -2041,6 +2144,7 @@ System(char const *cmd, int is_queued)
|
||||
int fd;
|
||||
int status;
|
||||
int do_exit = 0;
|
||||
|
||||
if (is_queued && IsServerMode()) {
|
||||
do_exit = 1;
|
||||
/* Server mode... redirect stdin and stdout to /dev/null */
|
||||
@@ -2069,7 +2173,11 @@ System(char const *cmd, int is_queued)
|
||||
}
|
||||
}
|
||||
/* This is the child process or original if we never forked */
|
||||
(void) system(cmd);
|
||||
if (JSONMode) {
|
||||
(void) system_to_stderr(cmd);
|
||||
} else {
|
||||
(void) system1(cmd);
|
||||
}
|
||||
if (do_exit) {
|
||||
/* In the child process, so exit! */
|
||||
exit(0);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "md5.h"
|
||||
|
||||
static void byteReverse(unsigned char *buf, unsigned longs);
|
||||
static void MD5Transform(uint32 buf[4], uint32 const in[16]);
|
||||
|
||||
/*
|
||||
* Note: this code is harmless on little-endian machines.
|
||||
@@ -163,7 +164,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void MD5Transform(uint32 buf[4], uint32 const in[16])
|
||||
static void MD5Transform(uint32 buf[4], uint32 const in[16])
|
||||
{
|
||||
register uint32 a, b, c, d;
|
||||
|
||||
|
||||
@@ -29,6 +29,5 @@ void MD5Init(struct MD5Context *context);
|
||||
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
||||
unsigned len);
|
||||
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
||||
void MD5Transform(uint32 buf[4], uint32 const in[16]);
|
||||
|
||||
#endif /* !MD5_H */
|
||||
|
||||
@@ -636,7 +636,7 @@ static time_t time_t_from_dse(int dse)
|
||||
|
||||
static int datetime_from_time_t(time_t t)
|
||||
{
|
||||
struct tm *local;
|
||||
struct tm const *local;
|
||||
int ans;
|
||||
|
||||
/* Round to nearest minute */
|
||||
@@ -665,7 +665,7 @@ static double interpolate(double f0, double f1, double f2, double p)
|
||||
|
||||
/* Moon position using fundamental arguments
|
||||
Van Flandern & Pulkkinen, 1979) */
|
||||
void moon_position(double dayOffset, double *ra, double *declination, double *distance)
|
||||
static void moon_position(double dayOffset, double *ra, double *declination, double *distance)
|
||||
{
|
||||
double l = 0.606434 + 0.03660110129 * dayOffset;
|
||||
double m = 0.374897 + 0.03629164709 * dayOffset;
|
||||
|
||||
15
src/omit.c
15
src/omit.c
@@ -121,12 +121,9 @@ int PushOmitContext(ParsePtr p)
|
||||
context = NEW(OmitContext);
|
||||
if (!context) return E_NO_MEM;
|
||||
|
||||
if (GetCurrentFilename()) {
|
||||
context->filename = GetCurrentFilename();
|
||||
} else {
|
||||
context->filename = "";
|
||||
}
|
||||
context->filename = GetCurrentFilename();
|
||||
context->lineno = LineNo;
|
||||
|
||||
context->numfull = NumFullOmits;
|
||||
context->numpart = NumPartialOmits;
|
||||
context->weekdaysave = WeekdayOmits;
|
||||
@@ -515,6 +512,14 @@ DumpOmits(void)
|
||||
{
|
||||
int i;
|
||||
int y, m, d;
|
||||
|
||||
/* Do nothing in --json mode */
|
||||
if (JSONMode) {
|
||||
return;
|
||||
}
|
||||
if (PurgeMode) {
|
||||
return;
|
||||
}
|
||||
printf("Global Full OMITs (%d of maximum allowed %d):\n", NumFullOmits, MAX_FULL_OMITS);
|
||||
if (!NumFullOmits) {
|
||||
printf("\tNone.\n");
|
||||
|
||||
59
src/protos.h
59
src/protos.h
@@ -47,32 +47,30 @@ int DoFrename (ParsePtr p);
|
||||
void UnsetAllUserFuncs(void);
|
||||
void ProduceCalendar (void);
|
||||
char const *SimpleTime (int tim);
|
||||
char const *CalendarTime (int tim, int duration);
|
||||
int DoRem (ParsePtr p);
|
||||
int DoFlush (ParsePtr p);
|
||||
void DoExit (ParsePtr p);
|
||||
int ParseRem (ParsePtr s, Trigger *trig, TimeTrig *tim);
|
||||
int TriggerReminder (ParsePtr p, Trigger *t, TimeTrig *tim, int dse, int is_queued, DynamicBuffer *output);
|
||||
int ShouldTriggerReminder (Trigger *t, TimeTrig *tim, int dse, int *err);
|
||||
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse, int mode);
|
||||
int TriggerReminder (ParsePtr p, Trigger *t, TimeTrig const *tim, int dse, int is_queued, DynamicBuffer *output, int *r, int *g, int *b);
|
||||
int ShouldTriggerReminder (Trigger const *t, TimeTrig const *tim, int dse, int *err);
|
||||
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int dse, int mode);
|
||||
int DoSubstFromString (char const *source, DynamicBuffer *dbuf, int dse, int tim);
|
||||
int ParseLiteralDateOrTime (char const **s, int *dse, int *tim);
|
||||
int ParseLiteralTime (char const **s, int *tim);
|
||||
expr_node *parse_expression(char const **e, int *r, Var *locals);
|
||||
|
||||
int evaluate_expression(expr_node *node, Value *locals, Value *ans, int *nonconst);
|
||||
int evaluate_expr_node(expr_node *node, Value *locals, Value *ans, int *nonconst);
|
||||
int truthy(Value const *v);
|
||||
|
||||
void print_expr_tree(expr_node *node, FILE *fp);
|
||||
void unlimit_execution_time(void);
|
||||
expr_node *free_expr_tree(expr_node *node);
|
||||
expr_node *clone_expr_tree(expr_node const *node, int *r);
|
||||
int EvalExpr (char const **e, Value *v, ParsePtr p);
|
||||
int EvalExprRunDisabled(char const **e, Value *v, ParsePtr p);
|
||||
int DoCoerce (char type, Value *v);
|
||||
char const *PrintValue (Value *v, FILE *fp);
|
||||
char const *PrintValue (Value const *v, FILE *fp);
|
||||
int CopyValue (Value *dest, const Value *src);
|
||||
int ReadLine (void);
|
||||
int OpenFile (char const *fname);
|
||||
int DoInclude (ParsePtr p, enum TokTypes tok);
|
||||
int DoIncludeCmd (ParsePtr p);
|
||||
int IncludeFile (char const *fname);
|
||||
@@ -106,11 +104,9 @@ int SystemDate (int *y, int *m, int *d);
|
||||
int DoIf (ParsePtr p);
|
||||
int DoElse (ParsePtr p);
|
||||
int DoEndif (ParsePtr p);
|
||||
int DoReturn (ParsePtr p);
|
||||
int DoIfTrig (ParsePtr p);
|
||||
int ShouldIgnoreLine (void);
|
||||
int VerifyEoln (ParsePtr p);
|
||||
int DoDebug (ParsePtr p);
|
||||
int DoBanner (ParsePtr p);
|
||||
int DoRun (ParsePtr p);
|
||||
int DoExpr (ParsePtr p);
|
||||
int DoTranslate (ParsePtr p);
|
||||
@@ -124,13 +120,12 @@ int PushOmitContext (ParsePtr p);
|
||||
int PopOmitContext (ParsePtr p);
|
||||
int IsOmitted (int dse, int localomit, char const *omitfunc, int *omit);
|
||||
int DoOmit (ParsePtr p);
|
||||
int QueueReminder (ParsePtr p, Trigger *trig, TimeTrig *tim, char const *sched);
|
||||
int QueueReminder (ParsePtr p, Trigger *trig, TimeTrig const *tim, char const *sched);
|
||||
void HandleQueuedReminders (void);
|
||||
char const *FindInitialToken (Token *tok, char const *s);
|
||||
void FindToken (char const *s, Token *tok);
|
||||
void FindNumericToken (char const *s, Token *t);
|
||||
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 const *tim, int *err, int save_in_globals, int duration_days);
|
||||
int AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals);
|
||||
char *StrnCpy (char *dest, char const *source, int n);
|
||||
|
||||
@@ -150,12 +145,16 @@ void strtolower(char *s);
|
||||
|
||||
Var *FindVar (char const *str, int create);
|
||||
SysVar *FindSysVar (char const *name);
|
||||
int DeleteVar (char const *str);
|
||||
int SetVar (char const *str, Value const *val, int nonconst_expr);
|
||||
int GetVarValue (char const *str, Value *val);
|
||||
int DoSet (Parser *p);
|
||||
int DoUnset (Parser *p);
|
||||
int DoDump (ParsePtr p);
|
||||
int PushVars(ParsePtr p);
|
||||
int EmptyVarStack(int print_unmatched);
|
||||
int PopVars(ParsePtr p);
|
||||
int PushUserFuncs(ParsePtr p);
|
||||
int EmptyUserFuncStack(int print_unmatched);
|
||||
int PopUserFuncs(ParsePtr p);
|
||||
void DumpVarTable (int dump_constness);
|
||||
void DumpUnusedVars(void);
|
||||
void DestroyVars (int all);
|
||||
@@ -164,7 +163,6 @@ int DoPreserve (Parser *p);
|
||||
int DoSatRemind (Trigger *trig, TimeTrig *tt, ParsePtr p);
|
||||
int DoMsgCommand (char const *cmd, char const *msg, int is_queued);
|
||||
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
|
||||
unsigned int HashVal_ignorecase(char const *str);
|
||||
unsigned int HashVal_preservecase(char const *str);
|
||||
int DateOK (int y, int m, int d);
|
||||
BuiltinFunc *FindBuiltinFunc (char const *name);
|
||||
@@ -175,10 +173,6 @@ int UserFuncExists (char const *fn);
|
||||
void DSEToHeb (int dse, int *hy, int *hm, int *hd);
|
||||
int HebNameToNum (char const *mname);
|
||||
char const *HebMonthName (int m, int y);
|
||||
int RoshHashana (int i);
|
||||
long DaysToHebYear (int y);
|
||||
int DaysInHebYear (int y);
|
||||
char const *DaysInHebMonths (int ylen);
|
||||
int HebToDSE (int hy, int hm, int hd);
|
||||
int GetValidHebDate (int yin, int min, int din, int adarbehave, int *mout, int *dout, int yahr);
|
||||
int GetNextHebrewDate (int dsestart, int hm, int hd, int yahr, int adarbehave, int *ans);
|
||||
@@ -199,9 +193,7 @@ void PurgeEchoLine(char const *fmt, ...);
|
||||
void FreeTrig(Trigger *t);
|
||||
void AppendTag(DynamicBuffer *buf, char const *s);
|
||||
char const *SynthesizeTag(void);
|
||||
void ClearLastTriggers(void);
|
||||
void SaveLastTrigger(Trigger const *t);
|
||||
void SaveLastTimeTrig(TimeTrig const *t);
|
||||
void SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigtime, int valid);
|
||||
|
||||
void PerIterationInit(void);
|
||||
@@ -210,13 +202,9 @@ char const *Colorize(int r, int g, int b, int bg, int clamp);
|
||||
void PrintJSONString(char const *s);
|
||||
void PrintJSONKeyPairInt(char const *name, int val);
|
||||
void PrintJSONKeyPairString(char const *name, char const *val);
|
||||
void PrintJSONKeyPairDate(char const *name, int dse);
|
||||
void PrintJSONKeyPairDateTime(char const *name, int dt);
|
||||
void PrintJSONKeyPairTime(char const *name, int t);
|
||||
void System(char const *cmd, int queued);
|
||||
int ShellEscape(char const *in, DynamicBuffer *out);
|
||||
int AddGlobalOmit(int dse);
|
||||
void set_lat_and_long_from_components(void);
|
||||
void set_components_from_lat_and_long(void);
|
||||
|
||||
void DebugExitFunc(void);
|
||||
@@ -226,13 +214,12 @@ int GetTerminalBackground(void);
|
||||
char const *get_day_name(int wkday);
|
||||
char const *get_month_name(int mon);
|
||||
|
||||
void set_cloexec(FILE *fp);
|
||||
int push_call(char const *filename, char const *func, int lineno, int lineno_start);
|
||||
void clear_callstack(void);
|
||||
int print_callstack(FILE *fp);
|
||||
void pop_call(void);
|
||||
void FixSpecialType(Trigger *trig);
|
||||
void WriteJSONTrigger(Trigger const *t, int include_tags, int today);
|
||||
void WriteJSONTrigger(Trigger const *t, int include_tags);
|
||||
void WriteJSONTimeTrigger(TimeTrig const *tt);
|
||||
int GetOnceDate(void);
|
||||
#ifdef REM_USE_WCHAR
|
||||
@@ -279,12 +266,8 @@ void print_escaped_string(FILE *fp, char const *s);
|
||||
void print_escaped_string_helper(FILE *fp, char const *s, int esc_for_remind, int json);
|
||||
void GenerateSysvarTranslationTemplates(void);
|
||||
void TranslationTemplate(char const *msg);
|
||||
TrigInfo *NewTrigInfo(char const *i);
|
||||
void FreeTrigInfo(TrigInfo *ti);
|
||||
void FreeTrigInfoChain(TrigInfo *ti);
|
||||
int AppendTrigInfo(Trigger *t, char const *info);
|
||||
int TrigInfoHeadersAreTheSame(char const *i1, char const *i2);
|
||||
int TrigInfoIsValid(char const *info);
|
||||
char const *FindTrigInfo(Trigger *t, char const *header);
|
||||
void WriteJSONInfoChain(TrigInfo *ti);
|
||||
char const *line_range(int lineno_start, int lineno);
|
||||
@@ -308,3 +291,13 @@ void pop_excess_ifs(char const *fname);
|
||||
|
||||
void SetCurrentFilename(char const *fname);
|
||||
char const *GetCurrentFilename(void);
|
||||
int get_scanfrom(Trigger const *t);
|
||||
void remove_trailing_newlines(DynamicBuffer *buf);
|
||||
void set_cloexec(int fd);
|
||||
int system_to_stderr(char const *cmd);
|
||||
int system1(char const *cmd);
|
||||
int tz_set_tz (char const *tz);
|
||||
int tz_convert(int year, int month, int day, int hour, int minute, char const *src_tz, char const *tgt_tz, struct tm *tm);
|
||||
int AdjustTriggerForTimeZone(Trigger *trig, int dse, TimeTrig *tim);
|
||||
void EnterTimezone(char const *tz);
|
||||
void ExitTimezone(char const *tz);
|
||||
|
||||
23
src/queue.c
23
src/queue.c
@@ -85,7 +85,7 @@ static void chomp(DynamicBuffer *buf)
|
||||
}
|
||||
}
|
||||
|
||||
char const *SimpleTimeNoSpace(int tim)
|
||||
static char const *SimpleTimeNoSpace(int tim)
|
||||
{
|
||||
char *s = (char *) SimpleTime(tim);
|
||||
if (s && *s) {
|
||||
@@ -97,7 +97,7 @@ char const *SimpleTimeNoSpace(int tim)
|
||||
return s;
|
||||
}
|
||||
|
||||
static void del_reminder(QueuedRem *qid)
|
||||
static void del_reminder(QueuedRem const *qid)
|
||||
{
|
||||
QueuedRem *q = QueueHead;
|
||||
QueuedRem *next;
|
||||
@@ -137,7 +137,7 @@ static void del_reminder_ul(unsigned long qid) {
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
TimeTrig *tim, char const *sched)
|
||||
TimeTrig const *tim, char const *sched)
|
||||
{
|
||||
QueuedRem *qelem;
|
||||
|
||||
@@ -209,7 +209,7 @@ maybe_close(int fd)
|
||||
(void) close(new_fd);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SigContHandler(int d)
|
||||
{
|
||||
UNUSED(d);
|
||||
@@ -395,7 +395,6 @@ void HandleQueuedReminders(void)
|
||||
(MaxLateMinutes == 0 || SystemTime(1) - (q->tt.nexttime * 60) <= 60 * MaxLateMinutes))) {
|
||||
/* Trigger the reminder */
|
||||
CreateParser(q->text, &p);
|
||||
RunDisabled = q->RunDisabled;
|
||||
if (IsServerMode() && q->typ != RUN_TYPE) {
|
||||
if (DaemonJSON) {
|
||||
printf("{\"response\":\"reminder\",");
|
||||
@@ -436,7 +435,7 @@ void HandleQueuedReminders(void)
|
||||
if (DaemonJSON) {
|
||||
DynamicBuffer out;
|
||||
DBufInit(&out);
|
||||
(void) TriggerReminder(&p, &tcopy, &q->tt, DSEToday, 1, &out);
|
||||
(void) TriggerReminder(&p, &tcopy, &q->tt, DSEToday, 1, &out, NULL, NULL, NULL);
|
||||
if (q->typ != RUN_TYPE) {
|
||||
printf("\"body\":\"");
|
||||
chomp(&out);
|
||||
@@ -445,7 +444,7 @@ void HandleQueuedReminders(void)
|
||||
}
|
||||
DBufFree(&out);
|
||||
} else {
|
||||
(void) TriggerReminder(&p, &tcopy, &q->tt, DSEToday, 1, NULL);
|
||||
(void) TriggerReminder(&p, &tcopy, &q->tt, DSEToday, 1, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
if (IsServerMode() && !DaemonJSON && q->typ != RUN_TYPE) {
|
||||
printf("NOTE endreminder\n");
|
||||
@@ -640,13 +639,15 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
|
||||
return NO_TIME;
|
||||
}
|
||||
|
||||
RunDisabled = q->RunDisabled; /* Don't want weird scheduling functions
|
||||
to be a security hole! */
|
||||
while(1) {
|
||||
char exprBuf[VAR_NAME_LEN+32];
|
||||
snprintf(exprBuf, sizeof(exprBuf), "%s(%d)", q->sched, q->ntrig);
|
||||
s = exprBuf;
|
||||
r = EvalExpr(&s, &v, NULL);
|
||||
if (q->RunDisabled) {
|
||||
r = EvalExprRunDisabled(&s, &v, NULL);
|
||||
} else {
|
||||
r = EvalExpr(&s, &v, NULL);
|
||||
}
|
||||
if (r) {
|
||||
q->sched[0] = 0;
|
||||
return NO_TIME;
|
||||
@@ -704,7 +705,7 @@ json_queue(QueuedRem const *q)
|
||||
}
|
||||
done = 1;
|
||||
printf("{");
|
||||
WriteJSONTrigger(&(q->t), 1, DSEToday);
|
||||
WriteJSONTrigger(&(q->t), 1);
|
||||
WriteJSONTimeTrigger(&(q->tt));
|
||||
if (TestMode) {
|
||||
snprintf(idbuf, sizeof(idbuf), "42424242");
|
||||
|
||||
44
src/rem2ps.c
44
src/rem2ps.c
@@ -131,16 +131,16 @@ int LeftMarg, RightMarg, TopMarg, BotMarg;
|
||||
int FillPage;
|
||||
int Verbose = 0;
|
||||
|
||||
void Init (int argc, char *argv[]);
|
||||
void Usage (char const *s);
|
||||
void DoPsCal (void);
|
||||
int DoQueuedPs (void);
|
||||
void DoSmallCal (char const *m, int days, int first, int col, int which);
|
||||
void WriteProlog (void);
|
||||
void WriteCalEntry (void);
|
||||
void WriteOneEntry (CalEntry *c);
|
||||
void GetSmallLocations (void);
|
||||
char const *EatToken(char const *in, char *out, int maxlen);
|
||||
static void Init (int argc, char const *argv[]);
|
||||
static void Usage (char const *s);
|
||||
static void DoPsCal (void);
|
||||
static int DoQueuedPs (void);
|
||||
static void DoSmallCal (char const *m, int days, int first, int col, int which);
|
||||
static void WriteProlog (void);
|
||||
static void WriteCalEntry (void);
|
||||
static void WriteOneEntry (CalEntry const *c);
|
||||
static void GetSmallLocations (void);
|
||||
static char const *EatToken(char const *in, char *out, int maxlen);
|
||||
|
||||
static void
|
||||
put_escaped_string(char const *s)
|
||||
@@ -161,7 +161,7 @@ put_escaped_string(char const *s)
|
||||
/* Compare strings, case insensitive. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int StrCmpi(char const *s1, char const *s2)
|
||||
static int StrCmpi(char const *s1, char const *s2)
|
||||
{
|
||||
int r;
|
||||
while (*s1 && *s2) {
|
||||
@@ -178,7 +178,7 @@ int StrCmpi(char const *s1, char const *s2)
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static CalEntry *
|
||||
JSONToCalEntry(DynamicBuffer *buf)
|
||||
JSONToCalEntry(DynamicBuffer const *buf)
|
||||
{
|
||||
CalEntry *c;
|
||||
json_value *val;
|
||||
@@ -325,7 +325,7 @@ TextToCalEntry(DynamicBuffer *buf)
|
||||
/* MAIN PROGRAM */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
/* If stdin is a tty - probably wrong. */
|
||||
|
||||
@@ -375,7 +375,7 @@ int main(int argc, char *argv[])
|
||||
/* DoPsCal - emit PostScript for the calendar. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void DoPsCal(void)
|
||||
static void DoPsCal(void)
|
||||
{
|
||||
char month[40], year[40];
|
||||
char prevm[40], nextm[40];
|
||||
@@ -595,7 +595,7 @@ void DoPsCal(void)
|
||||
/* WriteProlog - write the PostScript prologue */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void WriteProlog(void)
|
||||
static void WriteProlog(void)
|
||||
{
|
||||
int i;
|
||||
int x = CurPage->xsize;
|
||||
@@ -702,7 +702,7 @@ void WriteProlog(void)
|
||||
/* WriteCalEntry - write all entries for one day */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void WriteCalEntry(void)
|
||||
static void WriteCalEntry(void)
|
||||
{
|
||||
CalEntry *c = CurEntries;
|
||||
CalEntry *d;
|
||||
@@ -789,7 +789,7 @@ void WriteCalEntry(void)
|
||||
/* WriteOneEntry - write an entry for one day */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void WriteOneEntry(CalEntry *c)
|
||||
static void WriteOneEntry(CalEntry const *c)
|
||||
{
|
||||
int ch, i;
|
||||
char const *s = c->entry;
|
||||
@@ -851,7 +851,7 @@ void WriteOneEntry(CalEntry *c)
|
||||
/* Init - set up parameters */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void Init(int argc, char *argv[])
|
||||
static void Init(int argc, char const *argv[])
|
||||
{
|
||||
char const *s;
|
||||
char const *t;
|
||||
@@ -1043,7 +1043,7 @@ void Usage(char const *s)
|
||||
/* month. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void DoSmallCal(char const *m, int days, int first, int col, int which)
|
||||
static void DoSmallCal(char const *m, int days, int first, int col, int which)
|
||||
{
|
||||
/* Do the small calendar */
|
||||
int i, j;
|
||||
@@ -1097,7 +1097,7 @@ void DoSmallCal(char const *m, int days, int first, int col, int which)
|
||||
/* DoQueuedPs - do the queued PS and PSFILE reminders. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DoQueuedPs(void)
|
||||
static int DoQueuedPs(void)
|
||||
{
|
||||
int i;
|
||||
int HadPS = 0;
|
||||
@@ -1305,7 +1305,7 @@ int DoQueuedPs(void)
|
||||
/* Set up the locations for the small calendars. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void GetSmallLocations(void)
|
||||
static void GetSmallLocations(void)
|
||||
{
|
||||
char c;
|
||||
char const *s = SmallLocation;
|
||||
@@ -1370,7 +1370,7 @@ void GetSmallLocations(void)
|
||||
/* Read a space-delimited token into an output buffer. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
char const *EatToken(char const *in, char *out, int maxlen)
|
||||
static char const *EatToken(char const *in, char *out, int maxlen)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
||||
20
src/token.c
20
src/token.c
@@ -46,7 +46,8 @@ Token TokArray[] = {
|
||||
{ "banner", 3, T_Banner, 0 },
|
||||
{ "before", 6, T_Skip, BEFORE_SKIP },
|
||||
{ "cal", 3, T_RemType, CAL_TYPE },
|
||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||
{ "complete-through", 16, T_CompleteThrough, 0 },
|
||||
{ "debug", 5, T_Debug, 0 },
|
||||
{ "december", 3, T_Month, 11 },
|
||||
{ "do", 2, T_IncludeR, 0 },
|
||||
@@ -79,6 +80,7 @@ Token TokArray[] = {
|
||||
{ "lastday", 7, T_BackAdj, -1 },
|
||||
{ "lastworkday", 11, T_BackAdj, 1 },
|
||||
{ "march", 3, T_Month, 2 },
|
||||
{ "max-overdue", 11, T_MaxOverdue, 0 },
|
||||
{ "may", 3, T_Month, 4 },
|
||||
{ "maybe-uncomputable", 5, T_MaybeUncomputable, 0},
|
||||
{ "monday", 3, T_WkDay, 0 },
|
||||
@@ -90,13 +92,18 @@ Token TokArray[] = {
|
||||
{ "omit", 4, T_Omit, 0 },
|
||||
{ "omitfunc", 8, T_OmitFunc, 0 },
|
||||
{ "once", 4, T_Once, 0 },
|
||||
{ "pop-funcs", 9, T_PopFuncs, 0 },
|
||||
{ "pop-omit-context", 3, T_Pop, 0 },
|
||||
{ "pop-vars", 8, T_PopVars, 0 },
|
||||
{ "preserve", 8, T_Preserve, 0 },
|
||||
{ "priority", 8, T_Priority, 0 },
|
||||
{ "ps", 2, T_RemType, PS_TYPE },
|
||||
{ "psfile", 6, T_RemType, PSF_TYPE },
|
||||
{ "psfile", 6, T_RemType, PSF_TYPE },
|
||||
{ "push-funcs", 10, T_PushFuncs, 0 },
|
||||
{ "push-omit-context", 4, T_Push, 0 },
|
||||
{ "push-vars", 9, T_PushVars, 0 },
|
||||
{ "rem", 3, T_Rem, 0 },
|
||||
{ "return", 6, T_Return, 0 },
|
||||
{ "run", 3, T_RemType, RUN_TYPE },
|
||||
{ "satisfy", 7, T_RemType, SAT_TYPE },
|
||||
{ "saturday", 3, T_WkDay, 5 },
|
||||
@@ -113,8 +120,10 @@ Token TokArray[] = {
|
||||
{ "third", 5, T_Ordinal, 2 },
|
||||
{ "through", 7, T_Through, 0 },
|
||||
{ "thursday", 3, T_WkDay, 3 },
|
||||
{ "todo", 4, T_Todo, 0 },
|
||||
{ "translate", 5, T_Translate, 0 },
|
||||
{ "tuesday", 3, T_WkDay, 1 },
|
||||
{ "tz", 2, T_Tz, 0 },
|
||||
{ "unset", 5, T_UnSet, 0 },
|
||||
{ "until", 5, T_Until, 0 },
|
||||
{ "warn", 4, T_Warn, 0 },
|
||||
@@ -122,6 +131,7 @@ Token TokArray[] = {
|
||||
};
|
||||
|
||||
static int TokStrCmp (Token const *t, char const *s);
|
||||
static void FindNumericToken(char const *s, Token *t);
|
||||
|
||||
static void
|
||||
init_token(Token *t)
|
||||
@@ -247,7 +257,7 @@ void FindToken(char const *s, Token *tok)
|
||||
/* Rep - *n */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void FindNumericToken(char const *s, Token *t)
|
||||
static void FindNumericToken(char const *s, Token *t)
|
||||
{
|
||||
int mult = 1, hour, min;
|
||||
char const *s_orig = s;
|
||||
@@ -443,7 +453,7 @@ static int TokStrCmp(Token const *t, char const *s)
|
||||
}
|
||||
|
||||
static void
|
||||
print_token(Token *tok)
|
||||
print_token(Token const *tok)
|
||||
{
|
||||
if (tok->MinLen < (int) strlen(tok->name)) {
|
||||
printf("%.*s\n", tok->MinLen, tok->name);
|
||||
@@ -455,7 +465,7 @@ void
|
||||
print_remind_tokens(void)
|
||||
{
|
||||
int i;
|
||||
Token *tok;
|
||||
Token const *tok;
|
||||
int num = (int) (sizeof(TokArray) / sizeof(TokArray[0]));
|
||||
printf("# Remind Tokens\n\n");
|
||||
for (i=0; i<num; i++) {
|
||||
|
||||
20
src/trans.c
20
src/trans.c
@@ -16,6 +16,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
@@ -63,6 +64,9 @@ GenerateTranslationTemplate(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (JSONMode) {
|
||||
return;
|
||||
}
|
||||
printf("# Translation table template\n\n");
|
||||
|
||||
printf("TRANSLATE \"LANGID\" ");
|
||||
@@ -233,6 +237,10 @@ DumpTranslationTable(FILE *fp, int json)
|
||||
XlateItem *item;
|
||||
int done = 0;
|
||||
char const *t;
|
||||
|
||||
if (fileno(fp) == STDOUT_FILENO && JSONMode) {
|
||||
return;
|
||||
}
|
||||
if (!json) {
|
||||
fprintf(fp, "# Translation table\n");
|
||||
/* Always to LANGID first */
|
||||
@@ -272,17 +280,17 @@ DumpTranslationTable(FILE *fp, int json)
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
HashXlateItem(void *x)
|
||||
HashXlateItem(void const *x)
|
||||
{
|
||||
XlateItem *item = (XlateItem *) x;
|
||||
XlateItem const *item = (XlateItem const *) x;
|
||||
return HashVal_preservecase(item->orig);
|
||||
}
|
||||
|
||||
static int
|
||||
CompareXlateItems(void *a, void *b)
|
||||
CompareXlateItems(void const *a, void const *b)
|
||||
{
|
||||
XlateItem *i = (XlateItem *) a;
|
||||
XlateItem *j = (XlateItem *) b;
|
||||
XlateItem const *i = (XlateItem const *) a;
|
||||
XlateItem const *j = (XlateItem const *) b;
|
||||
return strcmp(i->orig, j->orig);
|
||||
}
|
||||
|
||||
@@ -339,7 +347,7 @@ InsertTranslation(char const *orig, char const *translated)
|
||||
char const *
|
||||
GetTranslatedString(char const *orig)
|
||||
{
|
||||
XlateItem *item = FindTranslation(orig);
|
||||
XlateItem const *item = FindTranslation(orig);
|
||||
if (!item) return NULL;
|
||||
return item->translated;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
|
||||
static int DSEYear(int dse);
|
||||
static int DSEMonth(int dse);
|
||||
static int NextSimpleTrig(int startdate, Trigger *trig, int *err);
|
||||
static int NextSimpleTrig(int startdate, Trigger const *trig, int *err);
|
||||
static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart);
|
||||
static int TrigInfoIsValid(char const *info);
|
||||
static int TrigInfoHeadersAreTheSame(char const *i1, char const *i2);
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -44,7 +46,7 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
|
||||
/* so that dates with a REP can be handled properly. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
|
||||
static int NextSimpleTrig(int startdate, Trigger const *trig, int *err)
|
||||
{
|
||||
int typ = 0;
|
||||
int d, m, y, j, d2, m2, y2;
|
||||
@@ -309,14 +311,26 @@ static int DSEYear(int dse)
|
||||
static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart)
|
||||
{
|
||||
int simple, mod, omit;
|
||||
int calmode = (DoSimpleCalendar || DoCalendar) ? 1 : 0;
|
||||
if (HideCompletedTodos) calmode = 0;
|
||||
|
||||
/* First: Have we passed the UNTIL date? */
|
||||
if (trig->until != NO_UNTIL &&
|
||||
if (!trig->is_todo &&
|
||||
trig->until != NO_UNTIL &&
|
||||
trig->until < start) {
|
||||
trig->expired = 1;
|
||||
return -1; /* expired */
|
||||
}
|
||||
|
||||
/* If it's a TODO and complete_through is past today, we're good */
|
||||
if (!calmode &&
|
||||
trig->is_todo &&
|
||||
trig->complete_through != NO_DATE &&
|
||||
trig->complete_through >= start) {
|
||||
trig->expired = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Next: If it's an "AFTER"-type skip, back up
|
||||
until we're at the start of a block of holidays */
|
||||
if (trig->skip == AFTER_SKIP) {
|
||||
@@ -439,6 +453,7 @@ AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int sav
|
||||
/* If we have an AT, save the original event start */
|
||||
if (tim->ttime != NO_TIME) {
|
||||
trig->eventstart = MINUTES_PER_DAY * r + tim->ttime;
|
||||
trig->eventstart_orig = trig->eventstart;
|
||||
if (tim->duration != NO_TIME) {
|
||||
trig->eventduration = tim->duration;
|
||||
}
|
||||
@@ -501,6 +516,7 @@ int ComputeTrigger(int today, Trigger *trig, TimeTrig *tim,
|
||||
if (r == today) {
|
||||
if (tim->ttime != NO_TIME) {
|
||||
trig->eventstart = MINUTES_PER_DAY * r + tim->ttime;
|
||||
trig->eventstart_orig = trig->eventstart;
|
||||
if (tim->duration != NO_TIME) {
|
||||
trig->eventduration = tim->duration;
|
||||
}
|
||||
@@ -529,7 +545,7 @@ int ComputeTrigger(int today, Trigger *trig, TimeTrig *tim,
|
||||
/* duration. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
||||
int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig const *tim,
|
||||
int *err, int save_in_globals, int duration_days)
|
||||
{
|
||||
int nattempts = 0,
|
||||
@@ -599,6 +615,21 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
||||
omit = 0;
|
||||
}
|
||||
|
||||
/** FIXME: If a timed reminder moves to yesterday because of a time
|
||||
zone adjustment, try again! */
|
||||
|
||||
if (trig->tz) {
|
||||
TimeTrig copy = *tim;
|
||||
int new_result;
|
||||
ExitTimezone(trig->tz);
|
||||
new_result = AdjustTriggerForTimeZone(trig, result, ©);
|
||||
EnterTimezone(trig->tz);
|
||||
if (new_result + duration_days < today) {
|
||||
nextstart = start+1;
|
||||
start = nextstart;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/** FIXME: Fix bad interaction with SATISFY... need to rethink!!! */
|
||||
if (result+duration_days >= today &&
|
||||
(trig->skip != SKIP_SKIP || !omit)) {
|
||||
@@ -683,7 +714,7 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
||||
/* Returns NULL if memory allocation fails. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
TrigInfo *
|
||||
static TrigInfo *
|
||||
NewTrigInfo(char const *i)
|
||||
{
|
||||
TrigInfo *ti = malloc(sizeof(TrigInfo));
|
||||
@@ -707,7 +738,7 @@ NewTrigInfo(char const *i)
|
||||
/* Free a TrigInfo objects. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
void
|
||||
static void
|
||||
FreeTrigInfo(TrigInfo *ti)
|
||||
{
|
||||
if (ti->info) {
|
||||
@@ -774,7 +805,7 @@ AppendTrigInfo(Trigger *t, char const *info)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
TrigInfoHeadersAreTheSame(char const *i1, char const *i2)
|
||||
{
|
||||
char const *c1 = strchr(i1, ':');
|
||||
@@ -785,7 +816,7 @@ TrigInfoHeadersAreTheSame(char const *i1, char const *i2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
TrigInfoIsValid(char const *info)
|
||||
{
|
||||
char const *t;
|
||||
|
||||
36
src/types.h
36
src/types.h
@@ -136,23 +136,29 @@ typedef struct {
|
||||
int from;
|
||||
int adj_for_last; /* Adjust month/year for use of LAST */
|
||||
int need_wkday; /* Set if we *need* a weekday */
|
||||
int is_todo; /* This is a TODO reminder */
|
||||
int complete_through; /* DSE of complete-through date */
|
||||
int priority;
|
||||
int duration_days; /* Duration converted to days to search */
|
||||
int eventstart; /* Original event start (datetime) */
|
||||
int eventstart_orig; /* Original event start in TZ (datetime) */
|
||||
int eventduration; /* Original event duration (minutes) */
|
||||
int maybe_uncomputable; /* Suppress "can't compute trigger" warnings */
|
||||
int addomit; /* Add trigger date to global OMITs */
|
||||
int noqueue; /* Don't queue even if timed */
|
||||
int max_overdue; /* Stop warning if TODO is too far overdue */
|
||||
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
|
||||
char warn[VAR_NAME_LEN+1]; /* Warning function */
|
||||
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
|
||||
DynamicBuffer tags;
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
TrigInfo *infos;
|
||||
char const *tz; /* Time Zone */
|
||||
} Trigger;
|
||||
|
||||
/* A time trigger */
|
||||
typedef struct {
|
||||
int ttime_orig;
|
||||
int ttime;
|
||||
int nexttime;
|
||||
int delta;
|
||||
@@ -194,6 +200,7 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
|
||||
#define AFTER_SKIP 3
|
||||
|
||||
#define NO_TIME INT_MAX
|
||||
#define NO_SCANFROM INT_MIN
|
||||
|
||||
#define NO_PRIORITY 5000 /* Default priority is midway between 0 and 9999 */
|
||||
|
||||
@@ -222,19 +229,22 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
|
||||
#define DB_TRANSLATE 0x100
|
||||
#define DB_NONCONST 0x200
|
||||
#define DB_UNUSED_VARS 0x400
|
||||
#define DB_SWITCH_ZONE 0x800
|
||||
|
||||
/* Enumeration of the tokens */
|
||||
enum TokTypes
|
||||
{ T_Illegal,
|
||||
T_AddOmit, T_At, T_Back, T_BackAdj, T_Banner, T_Clr, T_Comment,
|
||||
T_AddOmit, T_At, T_Back, T_BackAdj, T_Banner, T_Clr, T_Comment, T_CompleteThrough,
|
||||
T_Date, T_DateTime, T_Day, T_Debug, T_Delta, T_Dumpvars, T_Duration,
|
||||
T_Else, T_Empty, T_EndIf, T_ErrMsg, T_Exit, T_Expr,
|
||||
T_Flush, T_Frename, T_Fset, T_Funset, T_If, T_IfTrig, T_In,
|
||||
T_Include, T_IncludeCmd, T_IncludeR, T_IncludeSys, T_Info, T_LastBack,
|
||||
T_LongTime, T_MaybeUncomputable, T_Month, T_NoQueue, T_Number, T_Omit,
|
||||
T_OmitFunc, T_Once, T_Ordinal, T_Pop, T_Preserve, T_Priority, T_Push,T_Rem,
|
||||
T_RemType, T_Rep, T_Scanfrom, T_Sched, T_Set, T_Skip, T_Tag, T_Through,
|
||||
T_Time, T_Translate, T_UnSet, T_Until, T_Warn, T_WkDay, T_Year
|
||||
T_Else, T_Empty, T_EndIf, T_ErrMsg, T_Exit, T_Expr, T_Flush,
|
||||
T_Frename, T_Fset, T_Funset, T_If, T_IfTrig, T_In, T_Include,
|
||||
T_IncludeCmd, T_IncludeR, T_IncludeSys, T_Info, T_LastBack,
|
||||
T_LongTime, T_MaxOverdue, T_MaybeUncomputable, T_Month, T_NoQueue, T_Number,
|
||||
T_Omit, T_OmitFunc, T_Once, T_Ordinal, T_Pop, T_PopFuncs, T_PopVars,
|
||||
T_Preserve, T_Priority, T_Push, T_PushFuncs, T_PushVars, T_Rem,
|
||||
T_RemType, T_Rep, T_Return, T_Scanfrom, T_Sched, T_Set, T_Skip, T_Tag,
|
||||
T_Through, T_Time, T_Todo, T_Translate, T_Tz, T_UnSet, T_Until, T_Warn,
|
||||
T_WkDay, T_Year,
|
||||
};
|
||||
|
||||
/* The structure of a token */
|
||||
@@ -257,6 +267,8 @@ typedef struct {
|
||||
#define RUN_SCRIPT 0x02
|
||||
#define RUN_NOTOWNER 0x04
|
||||
#define RUN_IN_EVAL 0x08
|
||||
#define RUN_UF 0x10 /* A user-function defined with RUN OFF */
|
||||
#define RUN_CB 0x20 /* A callback */
|
||||
|
||||
/* Flags for the SimpleCalendar format */
|
||||
#define SC_AMPM 0 /* Time shown as 3:00am, etc. */
|
||||
@@ -310,4 +322,12 @@ typedef struct udf_struct {
|
||||
int lineno;
|
||||
int lineno_start;
|
||||
int recurse_flag;
|
||||
int been_pushed;
|
||||
int run_disabled;
|
||||
} UserFunc;
|
||||
|
||||
/* A pushed systtem variable */
|
||||
typedef struct {
|
||||
char const *name;
|
||||
Value v;
|
||||
} PushedSysvar;
|
||||
|
||||
242
src/userfns.c
242
src/userfns.c
@@ -36,16 +36,16 @@ static void FUnset (char const *name);
|
||||
static void FSet (UserFunc *f);
|
||||
static void RenameUserFunc(char const *oldname, char const *newname);
|
||||
|
||||
static unsigned int HashUserFunc(void *x)
|
||||
static unsigned int HashUserFunc(void const *x)
|
||||
{
|
||||
UserFunc *f = (UserFunc *) x;
|
||||
UserFunc const *f = (UserFunc const *) x;
|
||||
return HashVal_preservecase(f->name);
|
||||
}
|
||||
|
||||
static int CompareUserFuncs(void *a, void *b)
|
||||
static int CompareUserFuncs(void const *a, void const *b)
|
||||
{
|
||||
UserFunc *f = (UserFunc *) a;
|
||||
UserFunc *g = (UserFunc *) b;
|
||||
UserFunc const *f = (UserFunc const *) a;
|
||||
UserFunc const *g = (UserFunc const *) b;
|
||||
return strcmp(f->name, g->name);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ int DoFset(ParsePtr p)
|
||||
return OK;
|
||||
}
|
||||
/* Warn about redefinition */
|
||||
if (!suppress_redefined_function_warning) {
|
||||
if (!suppress_redefined_function_warning && !existing->been_pushed) {
|
||||
Wprint(tr("Function `%s' redefined: previously defined at %s(%s)"),
|
||||
existing->name, existing->filename, line_range(existing->lineno_start, existing->lineno));
|
||||
}
|
||||
@@ -274,6 +274,12 @@ int DoFset(ParsePtr p)
|
||||
func->lineno = LineNo;
|
||||
func->lineno_start = LineNoStart;
|
||||
func->recurse_flag = 0;
|
||||
func->been_pushed = 0;
|
||||
if (RunDisabled) {
|
||||
func->run_disabled = 1;
|
||||
} else {
|
||||
func->run_disabled = 0;
|
||||
}
|
||||
if (in_constant_context()) {
|
||||
func->is_constant = 1;
|
||||
} else {
|
||||
@@ -378,6 +384,10 @@ int DoFset(ParsePtr p)
|
||||
/* Save the argument names */
|
||||
if (func->nargs) {
|
||||
func->args = calloc(func->nargs, sizeof(char *));
|
||||
if (!func->args) {
|
||||
DestroyUserFunc(func);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
for (i=0; i<func->nargs; i++) {
|
||||
func->args[i] = StrDup(local_array[i].name);
|
||||
if (!func->args[i]) {
|
||||
@@ -549,3 +559,223 @@ dump_userfunc_hash_stats(void)
|
||||
hash_table_dump_stats(&FuncHash, ErrFp);
|
||||
}
|
||||
|
||||
typedef struct pushed_userfuncs {
|
||||
struct pushed_userfuncs *next;
|
||||
char const *filename;
|
||||
int lineno;
|
||||
int num_funcs;
|
||||
int alloc_funcs;
|
||||
UserFunc **funcs;
|
||||
} PushedUserFuncs;
|
||||
|
||||
static PushedUserFuncs *UserFuncStack = NULL;
|
||||
static UserFunc *clone_userfunc(char const *name, int *r)
|
||||
{
|
||||
int i;
|
||||
UserFunc *src;
|
||||
UserFunc *dest = NEW(UserFunc);
|
||||
*r = E_NO_MEM;
|
||||
if (!dest) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the source function */
|
||||
src = FindUserFunc(name);
|
||||
|
||||
/* If it doesn't exist, use sentinal values to indicate that */
|
||||
if (!src) {
|
||||
*r = OK;
|
||||
StrnCpy(dest->name, name, VAR_NAME_LEN);
|
||||
dest->is_constant = 0;
|
||||
dest->node = NULL;
|
||||
dest->args = NULL;
|
||||
dest->nargs = -1;
|
||||
dest->filename = NULL;
|
||||
dest->lineno = -1;
|
||||
dest->lineno_start = -1;
|
||||
dest->recurse_flag = 0;
|
||||
dest->been_pushed = 0;
|
||||
return dest;
|
||||
}
|
||||
/* Copy the whole thing; then adjust */
|
||||
*dest = *src;
|
||||
|
||||
/* Allow warning-free redefinition of original function */
|
||||
src->been_pushed = 1;
|
||||
|
||||
/* For safety */
|
||||
dest->node = NULL;
|
||||
dest->args = NULL;
|
||||
|
||||
/* Copy args */
|
||||
if (dest->nargs) {
|
||||
dest->args = calloc(dest->nargs, sizeof(char *));
|
||||
if (!dest->args) {
|
||||
DestroyUserFunc(dest);
|
||||
return NULL;
|
||||
}
|
||||
for (i=0; i<dest->nargs; i++) {
|
||||
dest->args[i] = StrDup(src->args[i]);
|
||||
if (!dest->args[i]) {
|
||||
DestroyUserFunc(dest);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy expr */
|
||||
dest->node = clone_expr_tree(src->node, r);
|
||||
if (!dest->node) {
|
||||
DestroyUserFunc(dest);
|
||||
return NULL;
|
||||
}
|
||||
*r = OK;
|
||||
return dest;
|
||||
}
|
||||
|
||||
static int add_func_to_push(char const *name, PushedUserFuncs *pf)
|
||||
{
|
||||
int r;
|
||||
UserFunc *clone = clone_userfunc(name, &r);
|
||||
if (!clone) {
|
||||
return r;
|
||||
}
|
||||
if (!pf->alloc_funcs) {
|
||||
pf->funcs = calloc(4, sizeof(UserFunc *));
|
||||
if (!pf->funcs) {
|
||||
DestroyUserFunc(clone);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
pf->alloc_funcs = 4;
|
||||
} else {
|
||||
if (pf->num_funcs == pf->alloc_funcs) {
|
||||
pf->funcs = realloc(pf->funcs, 2 * pf->alloc_funcs * sizeof(UserFunc *));
|
||||
if (!pf->funcs) {
|
||||
DestroyUserFunc(clone);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
pf->alloc_funcs *= 2;
|
||||
}
|
||||
}
|
||||
pf->funcs[pf->num_funcs] = clone;
|
||||
pf->num_funcs++;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void free_pushed_funcs(PushedUserFuncs *pf)
|
||||
{
|
||||
int i;
|
||||
if (pf->funcs) {
|
||||
for(i=0; i<pf->num_funcs; i++) {
|
||||
if (pf->funcs[i]) {
|
||||
DestroyUserFunc(pf->funcs[i]);
|
||||
}
|
||||
}
|
||||
free(pf->funcs);
|
||||
}
|
||||
free(pf);
|
||||
}
|
||||
|
||||
int PushUserFuncs(ParsePtr p)
|
||||
{
|
||||
int r;
|
||||
DynamicBuffer buf;
|
||||
char const *name;
|
||||
|
||||
DBufInit(&buf);
|
||||
PushedUserFuncs *pf = NEW(PushedUserFuncs);
|
||||
if (!pf) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
pf->next = NULL;
|
||||
pf->funcs = NULL;
|
||||
pf->filename = GetCurrentFilename();
|
||||
pf->lineno = LineNo;
|
||||
pf->num_funcs = 0;
|
||||
pf->alloc_funcs = 0;
|
||||
|
||||
while(1) {
|
||||
r = ParseIdentifier(p, &buf);
|
||||
if (r == E_EOLN) {
|
||||
break;
|
||||
}
|
||||
if (r) {
|
||||
DBufFree(&buf);
|
||||
free_pushed_funcs(pf);
|
||||
return r;
|
||||
}
|
||||
name = DBufValue(&buf);
|
||||
if (*name == '$') {
|
||||
DBufFree(&buf);
|
||||
free_pushed_funcs(pf);
|
||||
return E_BAD_ID;
|
||||
}
|
||||
|
||||
r = add_func_to_push(name, pf);
|
||||
|
||||
DBufFree(&buf);
|
||||
if (r != OK) {
|
||||
free_pushed_funcs(pf);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (pf->num_funcs == 0) {
|
||||
free_pushed_funcs(pf);
|
||||
return E_EOLN;
|
||||
}
|
||||
pf->next = UserFuncStack;
|
||||
UserFuncStack = pf;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int PopUserFuncs(ParsePtr p)
|
||||
{
|
||||
int i;
|
||||
PushedUserFuncs *pf = UserFuncStack;
|
||||
int r = VerifyEoln(p);
|
||||
if (r != OK) {
|
||||
return r;
|
||||
}
|
||||
if (!pf) {
|
||||
return E_POPF_NO_PUSH;
|
||||
}
|
||||
UserFuncStack = UserFuncStack->next;
|
||||
if (strcmp(pf->filename, GetCurrentFilename())) {
|
||||
Wprint(tr("POP-FUNCS at %s:%d matches PUSH-FUNCS in different file: %s:%d"), GetCurrentFilename(), LineNo, pf->filename, pf->lineno);
|
||||
}
|
||||
for (i=0; i<pf->num_funcs; i++) {
|
||||
UserFunc *clone = pf->funcs[i];
|
||||
FUnset(clone->name);
|
||||
if (clone->nargs < 0 && !clone->node) {
|
||||
/* Popping a function that should simply be unset... we are done */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Insert the clone into the hash table */
|
||||
FSet(clone);
|
||||
|
||||
/* Make sure we don't free the clone! */
|
||||
pf->funcs[i] = NULL;
|
||||
}
|
||||
free_pushed_funcs(pf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int EmptyUserFuncStack(int print_unmatched)
|
||||
{
|
||||
int j = 0;
|
||||
PushedUserFuncs *next;
|
||||
while(UserFuncStack) {
|
||||
if (print_unmatched) {
|
||||
Wprint(tr("Unmatched PUSH-FUNCS at %s(%d)"),
|
||||
UserFuncStack->filename,
|
||||
UserFuncStack->lineno);
|
||||
}
|
||||
j++;
|
||||
next = UserFuncStack->next;
|
||||
free_pushed_funcs(UserFuncStack);
|
||||
UserFuncStack = next;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
47
src/utils.c
47
src/utils.c
@@ -17,6 +17,7 @@ static char const DontEscapeMe[] =
|
||||
#include "err.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
@@ -30,6 +31,50 @@ static char const DontEscapeMe[] =
|
||||
#include "globals.h"
|
||||
#include "protos.h"
|
||||
|
||||
/* Call this instead of system() so if called ignores return code,
|
||||
we don't get a compiler warning */
|
||||
int system1(char const *cmd)
|
||||
{
|
||||
return system(cmd);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* system_to_stderr */
|
||||
/* */
|
||||
/* Run system(...) but with stdout redirected to stderr */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int system_to_stderr(char const *cmd)
|
||||
{
|
||||
int stdout_dup = dup(STDOUT_FILENO);
|
||||
int r;
|
||||
|
||||
if (stdout_dup < 0) {
|
||||
perror("dup");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Duplicate STDERR onto STDOUT */
|
||||
if (dup2(STDERR_FILENO, STDOUT_FILENO) < 0) {
|
||||
(void) close(stdout_dup);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set close-on-exec flag on stdout_dup */
|
||||
set_cloexec(stdout_dup);
|
||||
|
||||
r = system(cmd);
|
||||
|
||||
/* Restore original stdout */
|
||||
/* If this dup2 fails... there's not a whole lot we can do. */
|
||||
(void) dup2(stdout_dup, STDOUT_FILENO);
|
||||
if (STDOUT_FILENO != stdout_dup) {
|
||||
(void) close(stdout_dup);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* StrnCpy */
|
||||
@@ -247,7 +292,7 @@ print_callstack_aux(FILE *fp, cs *entry)
|
||||
{
|
||||
int i = 0;
|
||||
char const *in = tr("In");
|
||||
cs *prev = NULL;
|
||||
cs const *prev = NULL;
|
||||
while(entry) {
|
||||
if (prev) {
|
||||
in = tr("Called from");
|
||||
|
||||
305
src/var.c
305
src/var.c
@@ -37,14 +37,16 @@ static int IntMax = INT_MAX;
|
||||
|
||||
static hash_table VHashTbl;
|
||||
static int SetSysVarHelper(SysVar *v, Value *value);
|
||||
static unsigned int HashVal_ignorecase(char const *str);
|
||||
static void set_lat_and_long_from_components(void);
|
||||
|
||||
static unsigned int VarHashFunc(void *x)
|
||||
static unsigned int VarHashFunc(void const *x)
|
||||
{
|
||||
Var *v = (Var *) x;
|
||||
Var const *v = (Var const *) x;
|
||||
return HashVal_ignorecase(v->name);
|
||||
}
|
||||
|
||||
static int VarCompareFunc(void *a, void *b)
|
||||
static int VarCompareFunc(void const *a, void const *b)
|
||||
{
|
||||
Var *x = (Var *) a;
|
||||
Var *y = (Var *) b;
|
||||
@@ -153,7 +155,7 @@ static int latitude_longitude_func(int do_set, Value *val, double *var, double m
|
||||
if (loc) {
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%f", *var);
|
||||
snprintf(buf, sizeof(buf), "%.8f", *var);
|
||||
if (loc) {
|
||||
setlocale(LC_NUMERIC, loc);
|
||||
}
|
||||
@@ -523,7 +525,7 @@ static int time_sep_func(int do_set, Value *val)
|
||||
/* Given a string, compute the hash value case-insensitively */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
unsigned int HashVal_ignorecase(char const *str)
|
||||
static unsigned int HashVal_ignorecase(char const *str)
|
||||
{
|
||||
unsigned int h = 0, high;
|
||||
while(*str) {
|
||||
@@ -576,7 +578,7 @@ Var *FindVar(char const *str, int create)
|
||||
/* string and delete it. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DeleteVar(char const *str)
|
||||
static int DeleteVar(char const *str)
|
||||
{
|
||||
Var *v;
|
||||
|
||||
@@ -622,27 +624,6 @@ int SetVar(char const *str, Value const *val, int nonconst_expr)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* GetVarValue */
|
||||
/* */
|
||||
/* Get a copy of the value of the variable. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int GetVarValue(char const *str, Value *val)
|
||||
{
|
||||
Var *v;
|
||||
|
||||
v=FindVar(str, 0);
|
||||
|
||||
if (!v) {
|
||||
Eprint("%s: `%s'", GetErr(E_NOSUCH_VAR), str);
|
||||
return E_NOSUCH_VAR;
|
||||
}
|
||||
v->used_since_set = 1;
|
||||
return CopyValue(val, &v->v);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DoSet - set a variable. */
|
||||
@@ -780,6 +761,7 @@ int DoDump(ParsePtr p)
|
||||
int dump_constness = 0;
|
||||
|
||||
if (PurgeMode) return OK;
|
||||
if (JSONMode) return OK;
|
||||
|
||||
DBufInit(&buf);
|
||||
r = ParseToken(p, &buf);
|
||||
@@ -804,9 +786,14 @@ int DoDump(ParsePtr p)
|
||||
DumpSysVarByName(DBufValue(&buf)+1);
|
||||
} else {
|
||||
v = FindVar(DBufValue(&buf), 0);
|
||||
DBufValue(&buf)[VAR_NAME_LEN] = 0;
|
||||
if (!v) fprintf(ErrFp, "%s %s\n",
|
||||
if (!v) {
|
||||
if (DBufLen(&buf) > VAR_NAME_LEN) {
|
||||
/* Truncate over-long variable name */
|
||||
DBufValue(&buf)[VAR_NAME_LEN] = 0;
|
||||
}
|
||||
fprintf(ErrFp, "%s %s\n",
|
||||
DBufValue(&buf), UNDEF);
|
||||
}
|
||||
else {
|
||||
fprintf(ErrFp, "%s ", v->name);
|
||||
PrintValue(&(v->v), ErrFp);
|
||||
@@ -1011,6 +998,7 @@ static SysVar SysVarArr[] = {
|
||||
{"FormWidth", 1, INT_TYPE, &FormWidth, 20, 500 },
|
||||
{"Friday", 1, TRANS_TYPE, "Friday", 0, 0 },
|
||||
{"Fromnow", 1, TRANS_TYPE, "from now", 0, 0 },
|
||||
{"HideCompletedTodos", 0, INT_TYPE, &HideCompletedTodos, 0, 0 },
|
||||
{"Hour", 1, TRANS_TYPE, "hour", 0, 0 },
|
||||
{"Hplu", 1, STR_TYPE, &DynamicHplu, 0, 0 },
|
||||
{"HushMode", 0, INT_TYPE, &Hush, 0, 0 },
|
||||
@@ -1020,6 +1008,7 @@ static SysVar SysVarArr[] = {
|
||||
{"IntMin", 0, INT_TYPE, &IntMin, 0, 0 },
|
||||
{"Is", 1, TRANS_TYPE, "is", 0, 0 },
|
||||
{"January", 1, TRANS_TYPE, "January", 0, 0 },
|
||||
{"JSONMode", 0, INT_TYPE, &JSONMode, 0, 0 },
|
||||
{"July", 1, TRANS_TYPE, "July", 0, 0 },
|
||||
{"June", 1, TRANS_TYPE, "June", 0, 0 },
|
||||
{"LatDeg", 1, SPECIAL_TYPE, latdeg_func, 0, 0 },
|
||||
@@ -1077,6 +1066,7 @@ static SysVar SysVarArr[] = {
|
||||
{"TimetIs64bit", 0, SPECIAL_TYPE, timet_is_64_func, 0, 0 },
|
||||
{"Tm", 0, SPECIAL_TYPE, trig_mon_func, 0, 0 },
|
||||
{"Today", 1, TRANS_TYPE, "today", 0, 0 },
|
||||
{"TodoFilter", 0, INT_TYPE, &TodoFilter, 0, 0 },
|
||||
{"Tomorrow", 1, TRANS_TYPE, "tomorrow", 0, 0 },
|
||||
{"Tt", 0, SPECIAL_TYPE, trig_time_func, 0, 0 },
|
||||
{"Tu", 0, SPECIAL_TYPE, trig_until_func, 0, 0 },
|
||||
@@ -1098,14 +1088,263 @@ static SysVar SysVarArr[] = {
|
||||
};
|
||||
|
||||
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
|
||||
|
||||
typedef struct pushed_vars {
|
||||
struct pushed_vars *next;
|
||||
char const *filename;
|
||||
int lineno;
|
||||
int num_sysvars;
|
||||
int num_vars;
|
||||
int alloc_sysvars;
|
||||
int alloc_vars;
|
||||
PushedSysvar *sysvars;
|
||||
Var *vars;
|
||||
} PushedVars;
|
||||
|
||||
static void free_pushedvars(PushedVars *pv);
|
||||
|
||||
static PushedVars *VarStack = NULL;
|
||||
|
||||
int EmptyVarStack(int print_unmatched)
|
||||
{
|
||||
int j=0;
|
||||
PushedVars *next;
|
||||
while(VarStack) {
|
||||
if (print_unmatched) {
|
||||
Wprint(tr("Unmatched PUSH-VARS at %s(%d)"),
|
||||
VarStack->filename,
|
||||
VarStack->lineno);
|
||||
}
|
||||
j++;
|
||||
next = VarStack->next;
|
||||
free_pushedvars(VarStack);
|
||||
VarStack = next;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
static int add_sysvar_to_push(char const *name, PushedVars *pv)
|
||||
{
|
||||
int n = pv->alloc_sysvars;
|
||||
if (*name == '$') {
|
||||
name++;
|
||||
}
|
||||
SysVar *v = FindSysVar(name);
|
||||
if (!v) {
|
||||
return E_NOSUCH_VAR;
|
||||
}
|
||||
if (!v->modifiable) {
|
||||
Eprint("%s: `$%s'", GetErr(E_CANT_MODIFY), v->name);
|
||||
return E_CANT_MODIFY;
|
||||
}
|
||||
if (!n) {
|
||||
n = 4;
|
||||
pv->sysvars = malloc(n * sizeof(PushedSysvar));
|
||||
pv->alloc_sysvars = n;
|
||||
} else {
|
||||
if (pv->num_sysvars >= n) {
|
||||
n *= 2;
|
||||
pv->sysvars = realloc(pv->sysvars, n * sizeof(PushedSysvar));
|
||||
pv->alloc_sysvars = n;
|
||||
}
|
||||
}
|
||||
if (!pv->sysvars) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
n = pv->num_sysvars;
|
||||
pv->num_sysvars++;
|
||||
pv->sysvars[n].name = v->name;
|
||||
pv->sysvars[n].v.type = ERR_TYPE;
|
||||
return GetSysVar(name, &(pv->sysvars[n].v));
|
||||
}
|
||||
|
||||
static int add_var_to_push(char const *name, PushedVars *pv)
|
||||
{
|
||||
int n = pv->alloc_vars;
|
||||
if (!n) {
|
||||
n = 4;
|
||||
pv->vars = malloc(n * sizeof(Var));
|
||||
pv->alloc_vars = n;
|
||||
} else {
|
||||
if (pv->num_vars >= n) {
|
||||
n *= 2;
|
||||
pv->vars = realloc(pv->vars, n * sizeof(Var));
|
||||
pv->alloc_vars = n;
|
||||
}
|
||||
}
|
||||
if (!pv->vars) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
n = pv->num_vars;
|
||||
pv->num_vars++;
|
||||
Var *v = FindVar(name, 0);
|
||||
Var *dest = &(pv->vars[n]);
|
||||
int r = OK;
|
||||
if (!v) {
|
||||
StrnCpy(dest->name, name, VAR_NAME_LEN);
|
||||
dest->preserve = 0;
|
||||
dest->is_constant = 0;
|
||||
dest->used_since_set = 0;
|
||||
dest->filename = NULL;
|
||||
dest->lineno = -1;
|
||||
dest->v.type = ERR_TYPE;
|
||||
dest->v.v.val = E_NOSUCH_VAR;
|
||||
} else {
|
||||
StrnCpy(dest->name, v->name, VAR_NAME_LEN);
|
||||
dest->preserve = v->preserve;
|
||||
dest->is_constant = v->is_constant;
|
||||
dest->used_since_set = v->used_since_set;
|
||||
dest->filename = v->filename;
|
||||
dest->lineno = v->lineno;
|
||||
r = CopyValue(&(dest->v), &(v->v));
|
||||
/* Pretend we've used v */
|
||||
v->used_since_set = 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static void free_pushedvars(PushedVars *pv)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<pv->num_sysvars; i++) {
|
||||
DestroyValue(pv->sysvars[i].v);
|
||||
}
|
||||
for (i=0; i<pv->num_vars; i++) {
|
||||
DestroyValue(pv->vars[i].v);
|
||||
}
|
||||
if (pv->sysvars) {
|
||||
free(pv->sysvars);
|
||||
}
|
||||
if (pv->vars) {
|
||||
free(pv->vars);
|
||||
}
|
||||
free(pv);
|
||||
}
|
||||
|
||||
int
|
||||
PushVars(ParsePtr p)
|
||||
{
|
||||
int r;
|
||||
DynamicBuffer buf;
|
||||
char const *name;
|
||||
|
||||
PushedVars *pv = NEW(PushedVars);
|
||||
if (!pv) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
pv->next = NULL;
|
||||
pv->filename = GetCurrentFilename();
|
||||
pv->lineno = LineNo;
|
||||
pv->num_sysvars = 0;
|
||||
pv->num_vars = 0;
|
||||
pv->alloc_sysvars = 0;
|
||||
pv->alloc_vars = 0;
|
||||
pv->sysvars = NULL;
|
||||
pv->vars = NULL;
|
||||
|
||||
DBufInit(&buf);
|
||||
while(1) {
|
||||
r = ParseIdentifier(p, &buf);
|
||||
if (r == E_EOLN) {
|
||||
break;
|
||||
}
|
||||
if (r) {
|
||||
DBufFree(&buf);
|
||||
free_pushedvars(pv);
|
||||
return r;
|
||||
}
|
||||
name = DBufValue(&buf);
|
||||
if (*name == '$') {
|
||||
r = add_sysvar_to_push(name+1, pv);
|
||||
} else {
|
||||
r = add_var_to_push(name, pv);
|
||||
}
|
||||
DBufFree(&buf);
|
||||
if (r != OK) {
|
||||
free_pushedvars(pv);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if ((pv->num_vars + pv->num_sysvars) == 0) {
|
||||
free_pushedvars(pv);
|
||||
return E_EOLN;
|
||||
}
|
||||
pv->next = VarStack;
|
||||
VarStack = pv;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
PopVars(ParsePtr p)
|
||||
{
|
||||
int r = VerifyEoln(p);
|
||||
int i;
|
||||
int ret = OK;
|
||||
PushedVars *pv = VarStack;
|
||||
if (r != OK) {
|
||||
return r;
|
||||
}
|
||||
if (!pv) {
|
||||
return E_POPV_NO_PUSH;
|
||||
}
|
||||
VarStack = VarStack->next;
|
||||
if (strcmp(pv->filename, GetCurrentFilename())) {
|
||||
Wprint(tr("POP-VARS at %s:%d matches PUSH-VARS in different file: %s:%d"), GetCurrentFilename(), LineNo, pv->filename, pv->lineno);
|
||||
}
|
||||
|
||||
/* Pop the sysvars */
|
||||
for (i=0; i<pv->num_sysvars; i++) {
|
||||
r = SetSysVar(pv->sysvars[i].name, &(pv->sysvars[i].v));
|
||||
if (r != OK) {
|
||||
ret = r;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pop the vars */
|
||||
for (i=0; i<pv->num_vars; i++) {
|
||||
Var *src = &(pv->vars[i]);
|
||||
if (src->v.type == ERR_TYPE && src->v.v.val == E_NOSUCH_VAR) {
|
||||
/* Delete the variable if it exists */
|
||||
(void) DeleteVar(src->name);
|
||||
} else {
|
||||
Var *dest = FindVar(src->name, 0);
|
||||
if ((DebugFlag & DB_UNUSED_VARS) && dest && !dest->used_since_set) {
|
||||
Eprint(tr("`%s' UNSET without being used (previous SET: %s:%d)"), dest->name, dest->filename, dest->lineno);
|
||||
}
|
||||
if (!dest) {
|
||||
dest = FindVar(src->name, 1);
|
||||
}
|
||||
if (!dest) {
|
||||
ret = E_NO_MEM;
|
||||
continue;
|
||||
}
|
||||
dest->preserve = src->preserve;
|
||||
dest->is_constant = src->is_constant;
|
||||
dest->used_since_set = src->used_since_set;
|
||||
dest->filename = src->filename;
|
||||
dest->lineno = src->lineno;
|
||||
DestroyValue(dest->v);
|
||||
|
||||
/* Destructively copy value */
|
||||
dest->v = src->v;
|
||||
|
||||
/* Make sure free_pushedvars doesn't destroy our value! */
|
||||
src->v.type = ERR_TYPE;
|
||||
src->v.v.val = 0;
|
||||
}
|
||||
}
|
||||
free_pushedvars(pv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void DumpSysVar (char const *name, const SysVar *v);
|
||||
|
||||
static int SetTranslatableVariable(SysVar *v, Value *value)
|
||||
static int SetTranslatableVariable(SysVar const *v, Value const *value)
|
||||
{
|
||||
return InsertTranslation((char const *) v->value, value->v.str);
|
||||
}
|
||||
|
||||
static int GetTranslatableVariable(SysVar *v, Value *value)
|
||||
static int GetTranslatableVariable(SysVar const *v, Value *value)
|
||||
{
|
||||
char const *translated = tr((char const *) v->value);
|
||||
if (translated) {
|
||||
@@ -1256,7 +1495,7 @@ SysVar *FindSysVar(char const *name)
|
||||
void DumpSysVarByName(char const *name)
|
||||
{
|
||||
size_t i;
|
||||
SysVar *v;
|
||||
SysVar const *v;
|
||||
|
||||
if (!name || !*name) {
|
||||
for (i=0; i<NUMSYSVARS; i++) DumpSysVar(name, SysVarArr + i);
|
||||
@@ -1333,7 +1572,7 @@ static void DumpSysVar(char const *name, const SysVar *v)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
set_lat_and_long_from_components(void)
|
||||
{
|
||||
Latitude = (double) LatDeg + ((double) LatMin) / 60.0 + ((double) LatSec) / 3600.0;
|
||||
|
||||
2
tests/Makefile
Normal file
2
tests/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
%:
|
||||
@make -s -C.. $@
|
||||
5
tests/json-redirect.rem
Normal file
5
tests/json-redirect.rem
Normal file
@@ -0,0 +1,5 @@
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
REM MSG Hello
|
||||
REM RUN echo This is executed by the shell.
|
||||
REM MSG Goodbye
|
||||
@@ -83,6 +83,8 @@ UNSET a
|
||||
CLEAR-OMIT-CONTEXT
|
||||
PUSH-OMIT-CONTEXT
|
||||
POP-OMIT-CONTEXT
|
||||
PUSH-VARS foo
|
||||
POP-VARS
|
||||
BANNER wow
|
||||
DEBUG +x
|
||||
DEBUG -x
|
||||
|
||||
5
tests/ret1.rem
Normal file
5
tests/ret1.rem
Normal file
@@ -0,0 +1,5 @@
|
||||
DO ret2.rem
|
||||
IF ($Ud % 5) != 0
|
||||
RETURN
|
||||
ENDIF
|
||||
REM MSG On days divisible by 5
|
||||
7
tests/ret2.rem
Normal file
7
tests/ret2.rem
Normal file
@@ -0,0 +1,7 @@
|
||||
REM MSG Always
|
||||
IF $Ud % 2
|
||||
REM MSG On odd days
|
||||
RETURN
|
||||
REM MSG Won't appear
|
||||
ENDIF
|
||||
REM MSG On even days
|
||||
44
tests/safety.rem
Normal file
44
tests/safety.rem
Normal file
@@ -0,0 +1,44 @@
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
|
||||
FSET danger(x) shell("echo oops")
|
||||
|
||||
RUN OFF
|
||||
FSET safe(x) shell("echo nope")
|
||||
FSET safe2(x) danger(x)
|
||||
RUN ON
|
||||
|
||||
DEBUG +x
|
||||
set a danger(1)
|
||||
set b safe(1)
|
||||
set c safe2(1)
|
||||
|
||||
PUSH-FUNCS safe
|
||||
FSET safe(x) shell("echo this will work")
|
||||
SET b safe(1)
|
||||
POP-FUNCS
|
||||
SET b safe(1)
|
||||
|
||||
FRENAME safe gloopy
|
||||
FRENAME danger bork
|
||||
set a bork(1)
|
||||
set b gloopy(1)
|
||||
FRENAME gloopy safe
|
||||
FRENAME bork danger
|
||||
|
||||
RUN OFF
|
||||
set a danger(1)
|
||||
set b safe(1)
|
||||
set b safe2(1)
|
||||
|
||||
RUN ON
|
||||
|
||||
DEBUG -x
|
||||
FSET subst_b(a, b, c) shell("echo nooooo....")
|
||||
|
||||
REM MSG [subst_b(1, 2, 3)]
|
||||
FLUSH
|
||||
REM MSG %b
|
||||
FLUSH
|
||||
REM MSG [subst_b(1, 2, 3)]
|
||||
FLUSH
|
||||
@@ -1,4 +1,6 @@
|
||||
set $AddBlankLines 0
|
||||
SET $Latitude "45.42055556"
|
||||
SET $Longitude "-75.68944444"
|
||||
banner %
|
||||
|
||||
set d '2011-01-01'
|
||||
|
||||
344
tests/test-rem
344
tests/test-rem
@@ -33,7 +33,7 @@ fi
|
||||
alias remind="echo You should be using ../src/remind explicitly in test-rem >&2; exit 1"
|
||||
|
||||
# Set a known timezone so moon phases show up in predictable places
|
||||
TZ=UTC
|
||||
TZ=Universal
|
||||
export TZ
|
||||
|
||||
# If we're already in a utf-8 locale, do
|
||||
@@ -59,87 +59,87 @@ chmod 000 include_dir/04cantread.rem
|
||||
TEST_GETENV="foo bar baz" ; export TEST_GETENV
|
||||
echo "Test 1" > ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -e -dxte ../tests/test.rem 16 feb 1991 12:13 2>&1 | grep -v 'TimetIs64bit' >> ../tests/test.out
|
||||
../src/remind --flush -e -dxte ../tests/test.rem 16 feb 1991 12:13 2>&1 | grep -v -a 'TimetIs64bit' >> ../tests/test.out 2>&1
|
||||
echo "" >> ../tests/test.out
|
||||
echo "Test 2" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -p -l ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -p -l ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
echo "" >> ../tests/test.out
|
||||
echo "Test 3" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -s ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -s ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
echo "" >> ../tests/test.out
|
||||
echo "Test 4" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -sa ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -sa ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
echo "Test 5" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -p -l -b0 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -p -l -b0 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
echo "Test 6" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -p -l -b1 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -p -l -b1 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
echo "Test 7" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -p -l -b2 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -p -l -b2 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Test 8" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -df -p -l -b2 ../tests/include_dir 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -df -p -l -b2 ../tests/include_dir 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Test 9" >> ../tests/test.out
|
||||
echo "" >> ../tests/test.out
|
||||
../src/remind -df -p -l -b2 ../tests/nonexistent_include_dir 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind -df -p -l -b2 ../tests/include_dir_no_rems 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind -df -p -l -b2 ../tests/include_test.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -df -p -l -b2 ../tests/nonexistent_include_dir 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -df -p -l -b2 ../tests/include_dir_no_rems 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -df -p -l -b2 ../tests/include_test.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
|
||||
chmod 644 include_dir/04cantread.rem
|
||||
|
||||
# Feb 29 bug
|
||||
echo "Feb 29 Bug Test" >> ../tests/test.out
|
||||
echo 'REM Sun 29 Feb MSG [$T]' | ../src/remind -dt - 1 feb 2021 >> ../tests/test.out 2>&1
|
||||
echo 'REM Sun 29 Feb MSG [$T]' | ../src/remind --flush -dt - 1 feb 2021 >> ../tests/test.out 2>&1
|
||||
|
||||
# Day Weekday Year out-of-year bug
|
||||
echo "Mon 31 Dec Bug Test" >> ../tests/test.out
|
||||
echo 'REM Mon 31 2021 MSG [$T]' | ../src/remind -dt - 31 dec 2021 >> ../tests/test.out 2>&1
|
||||
echo 'REM Mon 31 2021 MSG [$T]' | ../src/remind --flush -dt - 31 dec 2021 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Color Test" >> ../tests/test.out
|
||||
../src/remind -ccl ../tests/colors.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -ccl ../tests/colors.rem 1 aug 2007 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "ANSI Color Test" >> ../tests/test.out
|
||||
../src/remind ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@2 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@0,0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@1,0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@2,0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@2,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@0,,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@1,,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@2,,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@0,0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@1,0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@2,0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@0,1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@1,1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind -@2,1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@2 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@0,0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@1,0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@2,0 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@2,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@0,,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@1,,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@2,,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@0,0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@1,0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@2,0,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@0,1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@1,1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -@2,1,1 ../tests/ansicolors.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
|
||||
echo '$AddBlankLines test' >> ../tests/test.out
|
||||
../src/remind ../tests/blanks.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind '-i$AddBlankLines=1' ../tests/blanks.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind '-i$AddBlankLines=0' ../tests/blanks.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/blanks.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush '-i$AddBlankLines=1' ../tests/blanks.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush '-i$AddBlankLines=0' ../tests/blanks.rem 1 Jan 2022 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "MON WKDAY DAY across year test" >> ../tests/test.out
|
||||
echo 'REM Mon 29 Dec MSG x' | ../src/remind -dt - 1 Jan 2000 >> ../tests/test.out 2>&1
|
||||
echo 'REM Mon 29 Dec MSG x' | ../src/remind --flush -dt - 1 Jan 2000 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Sort Test" >> ../tests/test.out
|
||||
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -q -gaaa - 1 Jan 2000 >> ../tests/test.out 2>&1
|
||||
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -q -gaaad - 1 Jan 2000 >> ../tests/test.out 2>&1
|
||||
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind --flush -q -gaaa - 1 Jan 2000 >> ../tests/test.out 2>&1
|
||||
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind --flush -q -gaaad - 1 Jan 2000 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Purge Test" >> ../tests/test.out
|
||||
../src/remind -j999 ../tests/purge_dir/f1.rem 3 Feb 2012 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -j999 ../tests/purge_dir/f1.rem 3 Feb 2012 >> ../tests/test.out 2>&1
|
||||
echo "F1" >> ../tests/test.out
|
||||
cat ../tests/purge_dir/f1.rem.purged >> ../tests/test.out
|
||||
echo "F2" >> ../tests/test.out
|
||||
@@ -150,7 +150,7 @@ cat ../tests/purge_dir/f3.rem.purged >> ../tests/test.out
|
||||
rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Hush Purge Test" >> ../tests/test.out
|
||||
../src/remind -h -j999 ../tests/purge_dir/f1.rem 3 Feb 2012 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -h -j999 ../tests/purge_dir/f1.rem 3 Feb 2012 >> ../tests/test.out 2>&1
|
||||
echo "F1" >> ../tests/test.out
|
||||
cat ../tests/purge_dir/f1.rem.purged >> ../tests/test.out
|
||||
echo "F2" >> ../tests/test.out
|
||||
@@ -160,22 +160,22 @@ cat ../tests/purge_dir/f3.rem.purged >> ../tests/test.out
|
||||
|
||||
rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
|
||||
|
||||
../src/remind ../tests/runtest.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/runtest.rem >> ../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 -pp ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -p ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -pp ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
|
||||
|
||||
TZ=America/Toronto ../src/remind ../tests/sunmoon.rem 1 Jan 2011 >> ../tests/test.out 2>&1
|
||||
TZ=America/Toronto ../src/remind --flush ../tests/sunmoon.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
|
||||
../src/remind --flush -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
|
||||
../src/remind --flush -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
|
||||
@@ -183,12 +183,12 @@ MSG [$DontTrigAts]
|
||||
EOF
|
||||
|
||||
# OMITFUNC should indicate nonconst_expr
|
||||
../src/remind -pp - 1 jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -pp - 1 jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||
REM Mon OMITFUNC foo MSG bar
|
||||
EOF
|
||||
|
||||
# Test default color
|
||||
../src/remind -pppq - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -pppq - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||
REM 2 MSG Normal
|
||||
SET $DefaultColor "255 0 0"
|
||||
REM 3 \
|
||||
@@ -201,7 +201,7 @@ SET $DefaultColor \
|
||||
EOF
|
||||
|
||||
# Test default color with weekly calendar
|
||||
../src/remind -pq+ - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -pq+ - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||
REM 2 MSG Normal
|
||||
SET $DefaultColor "255 0 0"
|
||||
REM 3 MSG %"Red%" on the calendar!
|
||||
@@ -212,18 +212,18 @@ SET $DefaultColor "256 0 0"
|
||||
EOF
|
||||
|
||||
# Test stdout
|
||||
../src/remind - 1 jan 2012 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - 1 jan 2012 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
MSG STDOUT is a: [stdout()]%
|
||||
EOF
|
||||
|
||||
../src/remind - 1 jan 2012 <<'EOF' 2>&1 | cat >> ../tests/test.out
|
||||
../src/remind --flush - 1 jan 2012 <<'EOF' 2>&1 | cat >> ../tests/test.out
|
||||
BANNER %
|
||||
MSG STDOUT is a: [stdout()]%
|
||||
EOF
|
||||
|
||||
# Test -@ option
|
||||
../src/remind -w,0,0 -@0,,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@0,,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -246,7 +246,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@0,0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@0,0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -269,7 +269,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@0,1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@0,1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -292,7 +292,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@1,,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@1,,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -315,7 +315,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@1,0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@1,0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -338,7 +338,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@1,1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@1,1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -361,7 +361,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@2,,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@2,,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -384,7 +384,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@2,0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@2,0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -407,7 +407,7 @@ rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
|
||||
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
../src/remind -w,0,0 -@2,1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -w,0,0 -@2,1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||
SET $SuppressLRM 1
|
||||
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||
@@ -431,59 +431,59 @@ rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
|
||||
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
|
||||
EOF
|
||||
|
||||
../src/remind -w128 -c ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
../src/remind -c ../tests/test-addomit.rem 1 Sep 2021 >> ../tests/test.out
|
||||
../src/remind --flush -w128 -c ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
../src/remind --flush -c ../tests/test-addomit.rem 1 Sep 2021 >> ../tests/test.out
|
||||
|
||||
../src/remind -cu ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
../src/remind -cu '-i$SuppressLRM=1' ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
../src/remind --flush -cu ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
../src/remind --flush -cu '-i$SuppressLRM=1' ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
|
||||
|
||||
TZ=America/Toronto ../src/remind -dxe ../tests/tz.rem >> ../tests/test.out 2>&1
|
||||
TZ=Europe/Berlin ../src/remind -dxe ../tests/tz.rem >> ../tests/test.out 2>&1
|
||||
TZ=America/Toronto ../src/remind --flush -dxe ../tests/tz.rem >> ../tests/test.out 2>&1
|
||||
TZ=Europe/Berlin ../src/remind --flush -dxe ../tests/tz.rem >> ../tests/test.out 2>&1
|
||||
|
||||
../src/remind ../tests/soleq.rem 1 April 2044 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/soleq.rem 1 April 2044 >> ../tests/test.out 2>&1
|
||||
|
||||
# Test that banner is printed on every iteration
|
||||
echo "MSG Should be three banners." | ../src/remind - 2022-10-20 '*3' >> ../tests/test.out 2>&1
|
||||
echo "MSG Should be three banners." | ../src/remind --flush - 2022-10-20 '*3' >> ../tests/test.out 2>&1
|
||||
|
||||
# Test the -tn option
|
||||
echo "REM May 23 +10 MSG Orange %b" | ../src/remind - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 +10 MSG Quux %b" | ../src/remind -t1 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 +10 MSG Cabbage %b" | ../src/remind -t2 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 MSG Banana %b" | ../src/remind - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 MSG Carrot %b" | ../src/remind -t1 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 MSG Apple %b" | ../src/remind -t2 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 +10 MSG Orange %b" | ../src/remind --flush - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 +10 MSG Quux %b" | ../src/remind --flush -t1 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 +10 MSG Cabbage %b" | ../src/remind --flush -t2 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 MSG Banana %b" | ../src/remind --flush - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 MSG Carrot %b" | ../src/remind --flush -t1 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 23 MSG Apple %b" | ../src/remind --flush -t2 - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
|
||||
# Test the -tz option
|
||||
echo "REM May 22 +10 MSG Foo %b" | ../src/remind - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 22 +10 MSG Bar %b" | ../src/remind -tz - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 22 +10 MSG Foo %b" | ../src/remind --flush - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
echo "REM May 22 +10 MSG Bar %b" | ../src/remind --flush -tz - 2023-05-21 >> ../tests/test.out 2>&1
|
||||
|
||||
# World-writable file
|
||||
rm -rf include_dir/ww
|
||||
touch include_dir/ww
|
||||
chmod 0666 include_dir/ww
|
||||
../src/remind include_dir/ww >> ../tests/test.out 2>&1
|
||||
../src/remind --flush include_dir/ww >> ../tests/test.out 2>&1
|
||||
rm -rf include_dir/ww
|
||||
|
||||
# World-writable directory
|
||||
mkdir -p include_dir/ww
|
||||
touch include_dir/ww/0.rem
|
||||
chmod 0777 include_dir/ww
|
||||
../src/remind include_dir/ww >> ../tests/test.out 2>&1
|
||||
../src/remind --flush include_dir/ww >> ../tests/test.out 2>&1
|
||||
rm -rf include_dir/ww
|
||||
|
||||
# This segfaulted in 04.02.03
|
||||
../src/remind -h '-imsgprefix(x)="foo"' /dev/null >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -h '-imsgprefix(x)="foo"' /dev/null >> ../tests/test.out 2>&1
|
||||
|
||||
# Test --version long option
|
||||
../src/remind --version >> ../tests/test.out 2>&1
|
||||
../src/remind --flush --version >> ../tests/test.out 2>&1
|
||||
|
||||
# Test queueing. Because eventstart depends on the actual system
|
||||
# date, we use the --test flag to fake the date and time.
|
||||
echo JSONQUEUE | ../src/remind --test -z0 ../tests/queue1.rem >> ../tests/test.out 2>&1
|
||||
echo QUEUE | ../src/remind --test -zj ../tests/queue1.rem >> ../tests/test.out 2>&1
|
||||
echo JSONQUEUE | ../src/remind --flush --test -z0 ../tests/queue1.rem >> ../tests/test.out 2>&1
|
||||
echo QUEUE | ../src/remind --flush --test -zj ../tests/queue1.rem >> ../tests/test.out 2>&1
|
||||
|
||||
# Test for leap year bug that was fixed
|
||||
../src/remind -dte - 28 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -dte - 28 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
REM 29 MSG One
|
||||
REM 29 Feb MSG two
|
||||
@@ -503,7 +503,7 @@ REM Friday 29 2024 MSG three
|
||||
REM Friday 29 Feb 2024 MSG four
|
||||
EOF
|
||||
|
||||
../src/remind -dte - 1 Mar 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -dte - 1 Mar 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
REM 29 MSG One
|
||||
REM 29 Feb MSG two
|
||||
@@ -523,7 +523,7 @@ REM Friday 29 2024 MSG three
|
||||
REM Friday 29 Feb 2024 MSG four
|
||||
EOF
|
||||
|
||||
../src/remind -dte - 28 Feb 2025 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -dte - 28 Feb 2025 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
REM 29 MSG One
|
||||
REM 29 Feb MSG two
|
||||
@@ -543,7 +543,7 @@ REM Friday 29 2025 MSG three
|
||||
REM Friday 29 Feb 2025 MSG four
|
||||
EOF
|
||||
|
||||
../src/remind -dte - 1 Mar 2025 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -dte - 1 Mar 2025 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
REM 29 MSG One
|
||||
REM 29 Feb MSG two
|
||||
@@ -564,21 +564,21 @@ REM Friday 29 Feb 2025 MSG four
|
||||
EOF
|
||||
|
||||
|
||||
(echo 'BANNER %'; echo 'REM 29 MSG No bug') | ../src/remind -dt - 29 Feb 2024 >> ../tests/test.out 2>&1
|
||||
(echo 'BANNER %'; echo 'REM 29 MSG No bug') | ../src/remind --flush -dt - 29 Feb 2024 >> ../tests/test.out 2>&1
|
||||
|
||||
../src/remind -ifoo - <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -ifoo - <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
DUMP
|
||||
EOF
|
||||
|
||||
../src/remind '-i$AddBlankLines' - <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush '-i$AddBlankLines' - <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
DUMP
|
||||
DUMP $AddBlankLines
|
||||
EOF
|
||||
|
||||
../src/remind ../tests/expr.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/expr.rem >> ../tests/test.out 2>&1
|
||||
|
||||
../src/remind - <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - <<'EOF' >> ../tests/test.out 2>&1
|
||||
PUSH
|
||||
POP
|
||||
PUSH
|
||||
@@ -594,48 +594,53 @@ PUSH
|
||||
POP
|
||||
EOF
|
||||
|
||||
../src/remind ../tests/if1.rem 2020-03-03 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/if1.rem 2020-03-03 >> ../tests/test.out 2>&1
|
||||
|
||||
# Test ONCE with a timestamp file
|
||||
rm -f ../tests/once.timestamp
|
||||
../src/remind ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
tail -n+2 ../tests/once.timestamp >> ../tests/test.out 2>&1
|
||||
rm -f ../tests/once.timestamp
|
||||
|
||||
../src/remind - < ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind - < ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind - < ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - < ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - < ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - < ../tests/test-once.rem >> ../tests/test.out 2>&1
|
||||
tail -n+2 ../tests/once.timestamp >> ../tests/test.out 2>&1
|
||||
rm -f ../tests/once.timestamp
|
||||
|
||||
# Newlines in calendar output
|
||||
(echo 'SET $SuppressLRM 1'; echo 'REM 16 MSG foo%_bar%_baz wookie quux apple %_ %_ %_ blech'; echo "REM 16 MSG ANOTHER") | ../src/remind -c -w80 - 1 sep 1990 >> ../tests/test.out 2>&1
|
||||
(echo 'SET $SuppressLRM 1'; echo 'REM 16 MSG foo%_bar%_baz wookie quux apple %_ %_ %_ blech'; echo "REM 16 MSG ANOTHER") | ../src/remind --flush -c -w80 - 1 sep 1990 >> ../tests/test.out 2>&1
|
||||
|
||||
# Dedupe feature
|
||||
../src/remind -c ../tests/dedupe.rem 1 November 2023 >> ../tests/test.out 2>&1
|
||||
../src/remind -q ../tests/dedupe.rem 8 November 2023 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -c ../tests/dedupe.rem 1 November 2023 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -q ../tests/dedupe.rem 8 November 2023 >> ../tests/test.out 2>&1
|
||||
|
||||
# Remove references to SysInclude, which is build-specific
|
||||
grep -F -v '$SysInclude' < ../tests/test.out > ../tests/test.out.1 && mv -f ../tests/test.out.1 ../tests/test.out
|
||||
grep -F -v -a '$SysInclude' < ../tests/test.out > ../tests/test.out.1 && mv -f ../tests/test.out.1 ../tests/test.out
|
||||
|
||||
# If "man" accepts the --warnings flag, test all the man pages.
|
||||
man man | grep -e --warnings > /dev/null 2>&1
|
||||
if test $? = 0 ; then
|
||||
for i in ../man/*.1 ; do
|
||||
man --warnings=w $i 2>>../tests/test.out 1>/dev/null
|
||||
done
|
||||
RUNMAN=0
|
||||
man man 2>&1 | grep -e --warnings > /dev/null 2>&1
|
||||
if test "$?" = 0 ; then
|
||||
RUNMAN=1
|
||||
fi
|
||||
for i in ../man/*.1 ; do
|
||||
echo "Checking $i..." >> ../tests/test.out
|
||||
if test "$RUNMAN" = 1 ; then
|
||||
man --warnings=w $i 2>>../tests/test.out 1>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
# Test --print-tokens long option
|
||||
../src/remind --print-tokens < /dev/null >> ../tests/test.out 2>&1
|
||||
../src/remind --flush --print-tokens < /dev/null >> ../tests/test.out 2>&1
|
||||
|
||||
# Torture test #2
|
||||
../src/remind ../tests/torture2.rem >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/torture2.rem >> ../tests/test.out 2>&1
|
||||
|
||||
# Expression error-reporting
|
||||
../src/remind -de - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -de - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
set a 8 * "]]]" & 6
|
||||
msg [8 * "]]]" & 6] is weird
|
||||
set a 9 *
|
||||
@@ -643,13 +648,13 @@ set a 9 * ]
|
||||
EOF
|
||||
|
||||
# Translation template generateion
|
||||
../src/remind -h - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -h - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
TRANSLATE GENERATE
|
||||
EOF
|
||||
|
||||
# Make sure stupidly-long translations of "am" and "pm" can't cause a
|
||||
# segmentation fault
|
||||
../src/remind -c - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -c - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
TRANS "am" "alsdkjalksdj alksjd alksdj alksjd laksjd laksjd laksjd laksjd laksjd laksjd laksjd laksjd lkasjd laksjd laksjd lkajs dlkajs dlkasj dlkasjd lkajsd lkajs dlkasjd lkasj dlkajsd lkasjd lkasjd laksjd laksjd laksjd alskdj alskdj alksdj alksdj alskdj alksdj aslkdj"
|
||||
TRANS "pm" "oiwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwjwwwwwwwwwwwwwwwjwpqoejkpqwojepqowjepqojwepqowjepqowjepqowjepqowjepqowjepqowjepqojwepqowjepqowjepqowjepqowjepqowjeqpweoj"
|
||||
|
||||
@@ -658,12 +663,12 @@ REM WED AT 13:00 MSG blah
|
||||
EOF
|
||||
|
||||
# The INFO keyword
|
||||
../src/remind -pp - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -pp - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
REM Wed INFO "Location: here" INFO "Summary: Nope" MSG Meeting [triginfo("location")] %<summary> %<nonexist> [triginfo("cabbage")]
|
||||
EOF
|
||||
|
||||
# Invalid info strings
|
||||
../src/remind - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
REM Thu INFO "Invalid" MSG wookie
|
||||
REM Fri INFO ": foo" MSG blat
|
||||
REM Sun INFO "foo bar baz : blork" MSG uua
|
||||
@@ -673,7 +678,7 @@ REM Sat INFO "Location: here" INFO "location: there" MSG blort
|
||||
EOF
|
||||
|
||||
# Test parsing of quoted strings and the "escape" function
|
||||
../src/remind - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - 1 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
TRANSLATE "foo" "test: \\\" \a\b\f\\n\r\t\v\x3\x1b haha"
|
||||
@@ -703,35 +708,40 @@ set a "\x00P"
|
||||
EOF
|
||||
|
||||
# Test diagnostics when using a timed substitution without an AT clause
|
||||
../src/remind - 1 Feb 2024 1:00 <<EOF >> ../tests/test.out 2>&1
|
||||
REM MSG %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %! hahaha
|
||||
../src/remind --flush - 1 Feb 2024 1:00 <<EOF >> ../tests/test.out 2>&1
|
||||
REM MSG %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 hahaha
|
||||
EOF
|
||||
|
||||
# Test translate table dumping
|
||||
../src/remind - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
|
||||
../src/remind --flush - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
|
||||
TRANSLATE "\x03" "BREAK"
|
||||
TRANSLATE DUMP
|
||||
EOF
|
||||
|
||||
../src/remind -ppp - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -ppp - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
|
||||
TRANSLATE "\x03" "BREAK"
|
||||
EOF
|
||||
|
||||
# SCANFROM should be preserved even if it is today
|
||||
../src/remind --flush -ppp - 1 Feb 2024 <<EOF >> ../tests/test.out 2>&1
|
||||
REM SCANFROM 2024-02-01 MSG Preserve SCANFROM
|
||||
EOF
|
||||
# Languages
|
||||
for i in ../include/lang/??.rem ; do
|
||||
../src/remind -r -q "-ii=\"$i\"" ../tests/tstlang.rem 1 Feb 2024 13:34 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -r -q "-ii=\"$i\"" ../tests/tstlang.rem 1 Feb 2024 13:34 >> ../tests/test.out 2>&1
|
||||
done
|
||||
|
||||
# Fix for $DefaultColor bug with remind -s
|
||||
../src/remind -s - 1 Feb 2024 >> ../tests/test.out 2>&1 <<'EOF'
|
||||
../src/remind --flush -s - 1 Feb 2024 >> ../tests/test.out 2>&1 <<'EOF'
|
||||
SET $DefaultColor "255 0 0"
|
||||
REM Wed MSG Wookie
|
||||
EOF
|
||||
|
||||
# Test year-folding
|
||||
TZ=America/Toronto ../src/remind -dx ../tests/yearfold.rem >> ../tests/test.out 2>&1
|
||||
TZ=America/Toronto ../src/remind --flush -dx ../tests/yearfold.rem >> ../tests/test.out 2>&1
|
||||
|
||||
# Test unused-variable debugging
|
||||
../src/remind -du - <<'EOF' >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -du - <<'EOF' >> ../tests/test.out 2>&1
|
||||
set a 1
|
||||
set b a*2
|
||||
set c "What"
|
||||
@@ -745,8 +755,88 @@ set y 1000
|
||||
unset y
|
||||
EOF
|
||||
|
||||
# Test RETURN statement
|
||||
../src/remind --flush ../tests/ret1.rem 4 June 2000 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/ret1.rem 5 June 2000 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/ret1.rem 7 June 2000 >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -s ../tests/ret1.rem 1 June 2000 >> ../tests/test.out 2>&1
|
||||
|
||||
# Make sure all the include files are ok
|
||||
find ../include -type f -name '*.rem' | while read x; do ../src/remind -du -n $x 1 Jan 2024 2>>../tests/test.out 1>/dev/null; done
|
||||
find ../include -type f -name '*.rem' | while read x; do ../src/remind --flush -du -n $x 1 Jan 2024 2>>../tests/test.out 1>/dev/null; done
|
||||
|
||||
# Test todos
|
||||
echo "" >> ../tests/test.out 2>&1
|
||||
echo "Testing TODOS in agenda mode" >> ../tests/test.out 2>&1
|
||||
../src/remind --flush ../tests/todos.rem 2025-08-13 >> ../tests/test.out 2>&1
|
||||
echo "" >> ../tests/test.out 2>&1
|
||||
echo "Testing TODOS in calendar mode" >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -s ../tests/todos.rem 2025-08-13 >> ../tests/test.out 2>&1
|
||||
echo "" >> ../tests/test.out 2>&1
|
||||
echo "Testing TODOS in calendar mode with completed todos hidden" >> ../tests/test.out 2>&1
|
||||
../src/remind --flush -s --hide-completed-todos ../tests/todos.rem 2025-08-13 >> ../tests/test.out 2>&1
|
||||
echo "Testing TODOS and JSON mode" >> ../tests/test.out 2>&1
|
||||
../src/remind --flush --json ../tests/todos.rem 2025-08-13 >> ../tests/test.out 2>&1
|
||||
|
||||
echo "Testing proper redirection of RUN stdout in JSON mode... here's stdout" >> ../tests/test.out 2>&1
|
||||
../src/remind --flush --json ../tests/json-redirect.rem 1 Jan 2025 >> ../tests/test.out 2>/dev/null
|
||||
|
||||
echo "... and here is stderr" >> ../tests/test.out 2>&1
|
||||
../src/remind --flush --json ../tests/json-redirect.rem 1 Jan 2025 > /dev/null 2>> ../tests/test.out
|
||||
|
||||
# Test %: substitution sequence in all the languages
|
||||
for i in ../include/lang/??.rem ; do
|
||||
../src/remind --flush "-ii=\"$i\"" -p - 2025-08-13 <<'EOF' 2>&1 | grep -a 2025/ >> ../tests/test.out
|
||||
DO [i]
|
||||
REM TODO 2025-08-13 MSG %(LANGID) Task1%:
|
||||
REM TODO 2025-08-13 COMPLETE-THROUGH 2025-08-12 MSG %(LANGID) Task2%:
|
||||
REM TODO 2025-08-13 COMPLETE-THROUGH 2025-08-13 MSG %(LANGID) Task3%:
|
||||
EOF
|
||||
done
|
||||
|
||||
../src/remind --flush -q ../tests/safety.rem 2025-08-13 >> ../tests/test.out 2>&1
|
||||
|
||||
# Test --max-expr-complexity
|
||||
../src/remind -dh --flush -q --max-expr-complexity=1000000 - 2025-01-01 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
FSET fib(n) iif(n < 3, 1, fib(n-1) + fib(n-2))
|
||||
|
||||
REM MSG fib(10) = [fib(10)]
|
||||
REM MSG fib(15) = [fib(15)]
|
||||
REM MSG fib(20) = [fib(20)]
|
||||
REM MSG fib(21) = [fib(21)]
|
||||
REM MSG fib(22) = [fib(22)]
|
||||
REM MSG fib(23) = [fib(23)]
|
||||
REM MSG fib(24) = [fib(24)]
|
||||
REM MSG fib(25) = [fib(25)]
|
||||
REM MSG fib(30) = [fib(30)]
|
||||
|
||||
EOF
|
||||
|
||||
# Test hex constants
|
||||
../src/remind -dh --flush -q - 2025-01-01 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
set a 0xfe + 0xef
|
||||
rem msg a = [a]; hex(a) = [hex(a)]
|
||||
rem msg hex(-1) = [hex(-1)]
|
||||
set a 0x7fff
|
||||
rem msg a = [a]; hex(a) = [hex(a)]
|
||||
EOF
|
||||
|
||||
# Test proper truncation by "dumpvars"
|
||||
../src/remind -h --flush -q - 2025-01-01 <<'EOF' >> ../tests/test.out 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
set a "¢" * 41
|
||||
set b "D" * 41
|
||||
set c mbchar(0x1F642) * 41
|
||||
DUMP
|
||||
set a "¢" * 40
|
||||
set b "D" * 40
|
||||
set c mbchar(0x1F642) * 40
|
||||
DUMP
|
||||
EOF
|
||||
|
||||
cmp -s ../tests/test.out ../tests/test.cmp
|
||||
if [ "$?" = "0" ]; then
|
||||
|
||||
177
tests/test-timezone-support
Executable file
177
tests/test-timezone-support
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/bin/sh
|
||||
DIR=`dirname $0`
|
||||
cd $DIR
|
||||
if test $? != 0 ; then
|
||||
echo ""
|
||||
echo "Unable to cd $DIR" >&2
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test `id -u` = 0 ; then
|
||||
echo ""
|
||||
echo "*** Please do not run the test suite as root; it will fail."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We alias "remind" here so that we don't inadvertently add code that
|
||||
# runs the system-installed verion of Remind rather than
|
||||
# ../src/remind. This trick was suggested by Jochen Sprickerhof
|
||||
alias remind="echo You should be using ../src/remind explicitly in test-rem >&2; exit 1"
|
||||
|
||||
REMIND="../src/remind -h -q --flush"
|
||||
OUT=../tests/tz.out
|
||||
CMP=../tests/tz.cmp
|
||||
|
||||
echo -n "" > $OUT 2>&1
|
||||
|
||||
TZ=Europe/Amsterdam $REMIND - 2025-09-03@14:00 <<'EOF' >> $OUT 2>&1
|
||||
SET $AddBlankLines=0
|
||||
BANNER %
|
||||
REM Fri AT 23:30 TZ America/Toronto +1000 SATISFY [$Td == 13] MSG Fri 13th @23:30 Eastern is %a %2 here
|
||||
DEBUG +x
|
||||
SET a $T
|
||||
SET b $Tt
|
||||
SET c trigtz()
|
||||
SET d trigtime()
|
||||
SET e trigtimetz()
|
||||
SET f trigeventstart()
|
||||
SET g trigeventstarttz()
|
||||
DEBUG -x
|
||||
EOF
|
||||
|
||||
TZ=Europe/Amsterdam $REMIND - 2026-02-14@14:00 <<'EOF' >> $OUT 2>&1
|
||||
SET $AddBlankLines=0
|
||||
BANNER %
|
||||
REM Fri AT 23:30 TZ America/Toronto +1000 SATISFY [$Td == 13] MSG Fri 13th @23:30 Eastern is %a %2 here
|
||||
DEBUG +x
|
||||
SET a $T
|
||||
SET b $Tt
|
||||
SET c trigtz()
|
||||
SET d trigtime()
|
||||
SET e trigtimetz()
|
||||
SET f trigeventstart()
|
||||
SET g trigeventstarttz()
|
||||
DEBUG -x
|
||||
EOF
|
||||
|
||||
TZ=Europe/Amsterdam $REMIND - 2026-02-15@14:00 <<'EOF' >> $OUT 2>&1
|
||||
SET $AddBlankLines=0
|
||||
BANNER %
|
||||
REM Fri AT 23:30 TZ America/Toronto +1000 SATISFY [$Td == 13] MSG Fri 13th @23:30 Eastern is %a %2 here
|
||||
SET a $T
|
||||
SET b $Tt
|
||||
SET c trigtz()
|
||||
SET d trigtime()
|
||||
SET e trigtimetz()
|
||||
SET f trigeventstart()
|
||||
SET g trigeventstarttz()
|
||||
EOF
|
||||
|
||||
TZ=America/Toronto $REMIND -p12 - 2025-01-01 <<'EOF' 2>&1 | grep Locally >> $OUT 2>&1
|
||||
REM Second Thursday AT 15:00 TZ Europe/Amsterdam MSG Locally: %3
|
||||
EOF
|
||||
|
||||
TZ=America/Toronto $REMIND -g - 2026-01-01 <<'EOF' >> $OUT 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
SET new '2026-01-18@14:53'
|
||||
SET first '2026-01-25@23:48'
|
||||
SET full '2026-01-03@05:04'
|
||||
SET last '2026-01-10@10:49'
|
||||
|
||||
REM [new] +100 MSG New Moon %*l %3.
|
||||
|
||||
SET a trigtz()
|
||||
SET b trigtime()
|
||||
SET c trigtimetz()
|
||||
SET d trigeventstart()
|
||||
SET e trigeventstarttz()
|
||||
|
||||
REM MSG trigtz = [a], trigtime = [b], trigtimetz = [c], trigeventstart = [d], trigeventstarttz = [e]
|
||||
|
||||
REM [first] +100 MSG First Quarter %*l %3.
|
||||
REM [full] +100 MSG Full Moon %*l %3.
|
||||
REM [last] +100 MSG Last Quarter %*l %3.
|
||||
|
||||
SET new tzconvert(new, "America/Toronto", "Australia/Sydney")
|
||||
SET first tzconvert(first, "America/Toronto", "Australia/Sydney")
|
||||
SET full tzconvert(full, "America/Toronto", "Australia/Sydney")
|
||||
SET last tzconvert(last, "America/Toronto", "Australia/Sydney")
|
||||
|
||||
REM [new] +100 TZ Australia/Sydney MSG New Moon %*l %3. (*)
|
||||
|
||||
SET a trigtz()
|
||||
SET b trigtime()
|
||||
SET c trigtimetz()
|
||||
SET d trigeventstart()
|
||||
SET e trigeventstarttz()
|
||||
|
||||
REM MSG trigtz = [a], trigtime = [b], trigtimetz = [c], trigeventstart = [d], trigeventstarttz = [e]
|
||||
|
||||
REM [first] +100 TZ Australia/Sydney MSG First Quarter %*l %3. (*)
|
||||
REM [full] +100 TZ Australia/Sydney MSG Full Moon %*l %3. (*)
|
||||
REM [last] +100 TZ Australia/Sydney MSG Last Quarter %*l %3. (*)
|
||||
|
||||
REM MSG new=[new] first=[first] full=[full] last=[last]
|
||||
|
||||
EOF
|
||||
|
||||
TZ=America/Los_Angeles $REMIND - 2026-01-01 <<'EOF' >> $OUT 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
|
||||
REM AT 13:33 MSG Whatsup? %*l %3.
|
||||
REM AT 13:33 TZ "" MSG Whatsup? %*l %3.
|
||||
EOF
|
||||
|
||||
TZ=America/Los_Angeles $REMIND - 2026-01-01 <<'EOF' >> $OUT 2>&1
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
|
||||
REM AT 13:33 TZ America/Los_Angeles TZ Universal MSG Whatsup? %*l %3.
|
||||
REM AT 13:33 TZ "" TZ America/Los_Angeles MSG Whatsup? %*l %3.
|
||||
REM TZ Universal MSG Borked
|
||||
EOF
|
||||
|
||||
TZ=America/Toronto $REMIND -dx - 2025-09-01@01:00 <<'EOF' >> $OUT 2>&1
|
||||
SET a tzconvert('2025-09-01@14:44', "", "Europe/Berlin")
|
||||
SET a tzconvert('2025-09-01@14:44', "America/Toronto", "Europe/Berlin")
|
||||
SET a tzconvert('2025-09-01@14:44', "Europe/Berlin", "")
|
||||
SET a tzconvert('2025-09-01@14:44', "Europe/Berlin")
|
||||
SET a tzconvert('2025-09-01@14:44', "", "")
|
||||
SET a tzconvert('2025-09-01@14:44', "")
|
||||
|
||||
SET b evaltrig("Wednesday at 23:00 TZ Australia/Sydney")
|
||||
SET b evaltrig("Wednesday at 23:00 TZ Europe/Amsterdam")
|
||||
SET b evaltrig("Wednesday at 23:00 TZ America/Los_Angeles")
|
||||
set b evaltrig("Wednesday TZ Europe/Amsterdam")
|
||||
|
||||
debug +t
|
||||
set c trig("Mon at 00:00 TZ Australia/Sydney",\
|
||||
"Tue at 00:00 TZ America/Toronto",\
|
||||
"Wed at 00:00 TZ Europe/Amsterdam",\
|
||||
"Thu at 00:00 TZ America/Los_Angeles",\
|
||||
"Fri at 00:00 TZ Australia/Sydney",\
|
||||
"Sat at 00:00 TZ Australia/Sydney",\
|
||||
"Sun at 00:00 TZ Australia/Sydney", \
|
||||
"at 14:42")
|
||||
debug -t
|
||||
|
||||
EOF
|
||||
|
||||
cmp -s $OUT $CMP
|
||||
if [ "$?" = "0" ] ; then
|
||||
echo "Remind: Time zone test PASSED"
|
||||
exit 0
|
||||
else
|
||||
echo "Remind: Time zone test FAILED"
|
||||
echo "Examine the file tz.out to see where it differs from the"
|
||||
echo "reference file tz.cmp. Here are the first 200 lines of"
|
||||
echo "diff -u tz.out tz.cmp"
|
||||
echo ""
|
||||
diff -u $OUT $CMP | head -n 200
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
7634
tests/test.cmp
7634
tests/test.cmp
File diff suppressed because one or more lines are too long
114
tests/test.rem
114
tests/test.rem
@@ -5,6 +5,9 @@
|
||||
#
|
||||
# ./test-rem # From WITHIN Remind source directory!
|
||||
|
||||
SET $Latitude "45.42055556"
|
||||
SET $Longitude "-75.68944444"
|
||||
|
||||
# Should issue a warning
|
||||
fset year(x) 1
|
||||
|
||||
@@ -272,7 +275,7 @@ set $LatDeg 30
|
||||
set $LatMin 30
|
||||
set $LatSec 0
|
||||
set $LongDeg -25
|
||||
set $LongMin 15
|
||||
set $LongMin -15
|
||||
set $LongSec 0
|
||||
|
||||
set a000 abs(1)
|
||||
@@ -478,7 +481,16 @@ REM MAYBE-UNCOMPUTABLE Mon OMIT Mon SKIP MSG Never ever ever...
|
||||
REM MAYBE-UNCOMPUTABLE Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
|
||||
|
||||
dump
|
||||
dump $
|
||||
set axx 1
|
||||
PUSH-VARS $Tomorrow $Latitude $DefaultColor axx bxbxbx
|
||||
set $Tomorrow "HAHA, tomorrow"
|
||||
set $Latitude "0"
|
||||
set $DefaultColor "42 42 42"
|
||||
set bxbxbx 1
|
||||
dump $Tomorrow $Latitude $DefaultColor axx bxbxbx a136 $Today
|
||||
POP-VARS
|
||||
dump $Tomorrow $Latitude $DefaultColor axx bxbxbx a136 $Today
|
||||
|
||||
msg [$April]%
|
||||
msg [$August]%
|
||||
msg [$CalcUTC]%
|
||||
@@ -968,10 +980,17 @@ set a htmlstriptags("this is > whut <b>foo</b>")
|
||||
set a htmlstriptags("<img src=\"foo\">")
|
||||
|
||||
# $ParseUntriggered
|
||||
|
||||
# Default is 0
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
|
||||
# Set to 1 explicitly
|
||||
SET $ParseUntriggered 1
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
|
||||
# Set to 0 explicitly
|
||||
SET $ParseUntriggered 0
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
SET $ParseUntriggered 1
|
||||
|
||||
# String multiplication
|
||||
|
||||
@@ -1658,6 +1677,95 @@ DEBUG -x
|
||||
# Output expression-node stats
|
||||
DEBUG +h
|
||||
|
||||
# Long list of pushing/popping variables
|
||||
PUSH-VARS $AddBlankLines $Ago $Am $And $April $At $August $CalcUTC $DateSep $DateTimeSep $December $DedupeReminders $DefaultColor $DefaultDelta $DefaultPrio $DefaultTDelta $EndSent $EndSentIg $ExpressionTimeLimit $February $FirstIndent $FoldYear $FormWidth $Friday $Fromnow $Hour $Hplu $Is $January $July $June $LatDeg $Latitude $LatMin $LatSec $Location $LongDeg $Longitude $LongMin $LongSec $March $MaxLateMinutes $MaxSatIter $MaxStringLen $May $MinsFromUTC $Minute $Monday $Mplu $November $Now $October $On $OnceFile $ParseUntriggered $Pm $Saturday $September $SubsIndent $Sunday $SuppressImplicitWarnings $SuppressLRM $Thursday $TimeSep $Today $Tomorrow $Tuesday $Was $Wednesday a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31 a32 a33 a34 a35 a36 a37 a38 a39 a40 a41 a42 a43 a44 a45 a46 a47 a48 a49 a50 a51 a52 a53 a54 a55 a56 a57 a58 a59 a60 a61 a62 a63 a64 a65 a66 a67 a68 a69 a70 a71 a72 a73 a74 a75 a76 a77 a78 a79 a80 a81 a82 a83 a84 a85 a86 a87 a88 a89 a90 a91 a92 a93 a94 a95 a96 a97 a98 a99 a100 a101 a102 a103 a104 a105 a106 a107 a108 a109 a110 a111 a112 a113 a114 a115 a116 a117 a118 a119 a120 a121 a122 a123 a124 a125 a126 a127 a128 a129 a130 a131 a132 a133 a134 a135 a136 a137 a138 a139 a140 a141 a142 a143 a144 a145 a146 a147 a148 a149 a150 a151 a152 a153 a154 a155 a156 a157 a158 a159 a160 a161 a162 a163 a164 a165 a166 a167 a168 a169 a170 a171 a172 a173 a174 a175 a176 a177 a178 a179 a180 a181 a182 a183 a184 a185 a186 a187 a188 a189 a190 a191 a192 a193 a194 a195 a196 a197 a198 a199 a200 a201 a202 a203 a204 a205 a206 a207 a208 a209 a210 a211 a212 a213 a214 a215 a216 a217 a218 a219 a220 a221 a222 a223 a224 a225 a226 a227 a228 a229 a230 a231 a232 a233 a234 a235 a236 a237 a238 a239 a240 a241 a242 a243 a244 a245 a246 a247 a248 a249 a250 a251 a252 a253 a254 a255 a256 a257 a258 a259 a260 a261 a262 a263 a264 a265 a266 a267 a268 a269 a270 a271 a272 a273 a274 a275 a276 a277 a278 a279 a280 a281 a282 a283 a284 a285 a286 a287 a288 a289 a290 a291 a292 a293 a294 a295 a296 a297 a298 a299 a300
|
||||
POP-VARS
|
||||
|
||||
# Try pushing a read-only one
|
||||
PUSH-VARS $NumTrig
|
||||
POP-VARS
|
||||
|
||||
# Test push/pop of functions
|
||||
DEBUG +xe
|
||||
|
||||
FUNSET a
|
||||
FSET b(x, y) x*y
|
||||
FSET c() 33
|
||||
|
||||
set a a(2)
|
||||
set a b(2)
|
||||
set a b(2, 3)
|
||||
set a c()
|
||||
|
||||
PUSH-FUNCS a b c
|
||||
|
||||
FSET a(x) 42
|
||||
FSET b(x, y) x*y*2
|
||||
FSET c() 66
|
||||
|
||||
set a a(2)
|
||||
set a b(2)
|
||||
set a b(2, 3)
|
||||
set a c()
|
||||
|
||||
POP-FUNCS
|
||||
|
||||
set a a(2)
|
||||
set a b(2)
|
||||
set a b(2, 3)
|
||||
set a c()
|
||||
|
||||
DEBUG -xe
|
||||
|
||||
fset subst_colon(a, b, c) "subst_colon"
|
||||
fset subst_bang(a, b, c) "subst_bang"
|
||||
fset subst_question(a, b, c) "subst_question"
|
||||
fset subst_at(a, b, c) "subst_at"
|
||||
fset subst_hash(a, b, c) "subst_hash"
|
||||
|
||||
REM MSG Overridden: %: %! %? %@ %#
|
||||
|
||||
# mbstrlen and friends
|
||||
DEBUG -xe
|
||||
set bad char(255)
|
||||
set faces "🙂" * 5 + "xyz" + "çççéfoo"
|
||||
|
||||
DEBUG +x
|
||||
set a mbstrlen(bad)
|
||||
set a strlen(bad)
|
||||
|
||||
set a mbstrlen(faces)
|
||||
set a strlen(faces)
|
||||
|
||||
set a mbindex(faces, "ç")
|
||||
set a index(faces, "ç")
|
||||
set a mbindex(bad, bad)
|
||||
|
||||
set a mbindex(faces, "ç", 11)
|
||||
set a index(faces, "ç", 25)
|
||||
|
||||
set a index(faces, "whoopér")
|
||||
set a mbindex(faces, "whoopér")
|
||||
set a index(faces, "whoopér", 3)
|
||||
set a mbindex(faces, "whoopér", 3)
|
||||
|
||||
set a mbsubstr(faces, 2)
|
||||
set a mbsubstr(faces, 2, 9)
|
||||
set a mbsubstr(bad, 1)
|
||||
set a mbsubstr(bad, 1, 20)
|
||||
|
||||
set a substr(faces, 2)
|
||||
set a substr(faces, 2, 9)
|
||||
|
||||
set a codepoint(faces)
|
||||
set a mbchar(128578, 162, 122)
|
||||
set a codepoint(bad)
|
||||
set a codepoint("")
|
||||
set a mbchar(0)
|
||||
set a mbchar(0, 120)
|
||||
set a mbchar(120, 0)
|
||||
|
||||
DEBUG -x
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
|
||||
|
||||
32
tests/todos.rem
Normal file
32
tests/todos.rem
Normal file
@@ -0,0 +1,32 @@
|
||||
BANNER %
|
||||
SET $AddBlankLines 0
|
||||
|
||||
REM TODO 1 Aug 2025 MSG %"First%" %l
|
||||
REM TODO 1 Aug COMPLETE-THROUGH 2022-07-31 MSG %"Second%" %l
|
||||
REM TODO 1 Aug COMPLETE-THROUGH 2022-08-01 MSG %"Third%" %l
|
||||
REM TODO 20 Aug 2025 +7 MSG %"Fourth%" %l
|
||||
REM TODO 13 Aug 2025 +7 MSG %"Fifth%" %l
|
||||
REM TODO 6 Aug 2025 +7 MSG %"Sixth%" %l
|
||||
REM TODO COMPLETE-THROUGH 2025-08-06 6 Aug 2025 +7 MSG %"Seventh%" %l
|
||||
REM TODO Wed +7 COMPLETE-THROUGH 2025-08-13 MSG %"Eighth%" %l
|
||||
REM TODO Wed +7 COMPLETE-THROUGH 2025-08-12 MSG %"Ninth%" %l
|
||||
|
||||
# Test MAX-OVERDUE
|
||||
REM TODO 2025-08-13 MAX-OVERDUE 3 MSG %"Yup%" %l
|
||||
REM TODO 2025-08-12 MAX-OVERDUE 3 MSG %"Yup2%" %l
|
||||
REM TODO 2025-08-11 MAX-OVERDUE 3 MSG %"Yup3%" %l
|
||||
REM TODO 2025-08-10 MAX-OVERDUE 3 MSG %"Yup4%" %l
|
||||
REM TODO 2025-08-9 MAX-OVERDUE 3 MSG %"Nope%" %l
|
||||
|
||||
IF !$JSONMode
|
||||
REM TODO 2025-09-09 COMPLETE-THROUGH 2024-12-31 MAX-OVERDUE 3 MSG %"Nope%" %l
|
||||
debug +x
|
||||
set a trigistodo()
|
||||
set a trigcompletethrough()
|
||||
set a trigmaxoverdue()
|
||||
REM 2025-09-09 MSG blork
|
||||
set a trigistodo()
|
||||
set a trigcompletethrough()
|
||||
set a trigmaxoverdue()
|
||||
debug -x
|
||||
ENDIF
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -29,6 +29,7 @@ if !$RunOff || !$DontQueue || $DontTrigAts
|
||||
exit
|
||||
endif
|
||||
|
||||
set $AddBlankLines 0
|
||||
# Include a language file, if that's given as "-ii=/path"
|
||||
|
||||
if defined("i")
|
||||
@@ -37,7 +38,7 @@ endif
|
||||
|
||||
REM MSG Language: %(LANGID)
|
||||
# Set up a few useful definitions
|
||||
fset show(x) "%%" + x + " yields: " + char(34) + "%" + x + char(34) + "% and %%*" + x + " yields: " + char(34) + "%*" + x + char(34) + "%"
|
||||
fset show(x) iif(x == "!" || x == "?", "%%" + x + " yields: " + char(34) + "%" + x + char(34), "%%" + 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
|
||||
@@ -298,6 +299,14 @@ REM [a] MSG [show("x")]
|
||||
REM [a] MSG [show("y")]
|
||||
REM [a] MSG [show("z")]
|
||||
|
||||
MSG %_%_The %%b substitutions for 1, 2 and 3 days ago
|
||||
SET a today()-1
|
||||
REM TODO [a] MSG [show("b")]
|
||||
SET a today()-2
|
||||
REM TODO [a] MSG [show("b")]
|
||||
SET a today()-3
|
||||
REM TODO [a] MSG [show("b")]
|
||||
|
||||
MSG %_Time substitutions for [now()] where now() = [now()]
|
||||
REM AT [now()] MSG [show("1")]
|
||||
REM AT [now()] MSG [show("2")]
|
||||
@@ -310,6 +319,7 @@ REM AT [now()] MSG [show("8")]
|
||||
REM AT [now()] MSG [show("9")]
|
||||
REM AT [now()] MSG [show("0")]
|
||||
REM AT [now()] MSG [show("!")]
|
||||
REM AT [now()] MSG [show("?")]
|
||||
REM AT [now()] MSG [show("@")]
|
||||
REM AT [now()] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()+134] where now() = [now()]
|
||||
@@ -324,6 +334,7 @@ REM AT [now()+134] MSG [show("8")]
|
||||
REM AT [now()+134] MSG [show("9")]
|
||||
REM AT [now()+134] MSG [show("0")]
|
||||
REM AT [now()+134] MSG [show("!")]
|
||||
REM AT [now()+134] MSG [show("?")]
|
||||
REM AT [now()+134] MSG [show("@")]
|
||||
REM AT [now()+134] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()-134] where now() = [now()]
|
||||
@@ -338,6 +349,7 @@ REM AT [now()-134] MSG [show("8")]
|
||||
REM AT [now()-134] MSG [show("9")]
|
||||
REM AT [now()-134] MSG [show("0")]
|
||||
REM AT [now()-134] MSG [show("!")]
|
||||
REM AT [now()-134] MSG [show("?")]
|
||||
REM AT [now()-134] MSG [show("@")]
|
||||
REM AT [now()-134] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()+60] where now() = [now()]
|
||||
@@ -352,6 +364,7 @@ REM AT [now()+60] MSG [show("8")]
|
||||
REM AT [now()+60] MSG [show("9")]
|
||||
REM AT [now()+60] MSG [show("0")]
|
||||
REM AT [now()+60] MSG [show("!")]
|
||||
REM AT [now()+60] MSG [show("?")]
|
||||
REM AT [now()+60] MSG [show("@")]
|
||||
REM AT [now()+60] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()-60] where now() = [now()]
|
||||
@@ -366,6 +379,7 @@ REM AT [now()-60] MSG [show("8")]
|
||||
REM AT [now()-60] MSG [show("9")]
|
||||
REM AT [now()-60] MSG [show("0")]
|
||||
REM AT [now()-60] MSG [show("!")]
|
||||
REM AT [now()-60] MSG [show("?")]
|
||||
REM AT [now()-60] MSG [show("@")]
|
||||
REM AT [now()-60] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()+120] where now() = [now()]
|
||||
@@ -380,6 +394,7 @@ REM AT [now()+120] MSG [show("8")]
|
||||
REM AT [now()+120] MSG [show("9")]
|
||||
REM AT [now()+120] MSG [show("0")]
|
||||
REM AT [now()+120] MSG [show("!")]
|
||||
REM AT [now()+120] MSG [show("?")]
|
||||
REM AT [now()+120] MSG [show("@")]
|
||||
REM AT [now()+120] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()-120] where now() = [now()]
|
||||
@@ -394,6 +409,7 @@ REM AT [now()-120] MSG [show("8")]
|
||||
REM AT [now()-120] MSG [show("9")]
|
||||
REM AT [now()-120] MSG [show("0")]
|
||||
REM AT [now()-120] MSG [show("!")]
|
||||
REM AT [now()-120] MSG [show("?")]
|
||||
REM AT [now()-120] MSG [show("@")]
|
||||
REM AT [now()-120] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()+1] where now() = [now()]
|
||||
@@ -408,6 +424,7 @@ REM AT [now()+1] MSG [show("8")]
|
||||
REM AT [now()+1] MSG [show("9")]
|
||||
REM AT [now()+1] MSG [show("0")]
|
||||
REM AT [now()+1] MSG [show("!")]
|
||||
REM AT [now()+1] MSG [show("?")]
|
||||
REM AT [now()+1] MSG [show("@")]
|
||||
REM AT [now()+1] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()-1] where now() = [now()]
|
||||
@@ -422,6 +439,7 @@ REM AT [now()-1] MSG [show("8")]
|
||||
REM AT [now()-1] MSG [show("9")]
|
||||
REM AT [now()-1] MSG [show("0")]
|
||||
REM AT [now()-1] MSG [show("!")]
|
||||
REM AT [now()-1] MSG [show("?")]
|
||||
REM AT [now()-1] MSG [show("@")]
|
||||
REM AT [now()-1] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()+2] where now() = [now()]
|
||||
@@ -436,6 +454,7 @@ REM AT [now()+2] MSG [show("8")]
|
||||
REM AT [now()+2] MSG [show("9")]
|
||||
REM AT [now()+2] MSG [show("0")]
|
||||
REM AT [now()+2] MSG [show("!")]
|
||||
REM AT [now()+2] MSG [show("?")]
|
||||
REM AT [now()+2] MSG [show("@")]
|
||||
REM AT [now()+2] MSG [show("#")]
|
||||
MSG %_Time substitutions for [now()-2] where now() = [now()]
|
||||
@@ -450,6 +469,7 @@ REM AT [now()-2] MSG [show("8")]
|
||||
REM AT [now()-2] MSG [show("9")]
|
||||
REM AT [now()-2] MSG [show("0")]
|
||||
REM AT [now()-2] MSG [show("!")]
|
||||
REM AT [now()-2] MSG [show("?")]
|
||||
REM AT [now()-2] MSG [show("@")]
|
||||
REM AT [now()-2] MSG [show("#")]
|
||||
MSG %_Time substitutions for [0:00] where now() = [now()]
|
||||
@@ -464,6 +484,7 @@ REM AT [0:00] MSG [show("8")]
|
||||
REM AT [0:00] MSG [show("9")]
|
||||
REM AT [0:00] MSG [show("0")]
|
||||
REM AT [0:00] MSG [show("!")]
|
||||
REM AT [0:00] MSG [show("?")]
|
||||
REM AT [0:00] MSG [show("@")]
|
||||
REM AT [0:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [1:00] where now() = [now()]
|
||||
@@ -478,6 +499,7 @@ REM AT [1:00] MSG [show("8")]
|
||||
REM AT [1:00] MSG [show("9")]
|
||||
REM AT [1:00] MSG [show("0")]
|
||||
REM AT [1:00] MSG [show("!")]
|
||||
REM AT [1:00] MSG [show("?")]
|
||||
REM AT [1:00] MSG [show("@")]
|
||||
REM AT [1:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [2:00] where now() = [now()]
|
||||
@@ -492,6 +514,7 @@ REM AT [2:00] MSG [show("8")]
|
||||
REM AT [2:00] MSG [show("9")]
|
||||
REM AT [2:00] MSG [show("0")]
|
||||
REM AT [2:00] MSG [show("!")]
|
||||
REM AT [2:00] MSG [show("?")]
|
||||
REM AT [2:00] MSG [show("@")]
|
||||
REM AT [2:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [3:00] where now() = [now()]
|
||||
@@ -506,6 +529,7 @@ REM AT [3:00] MSG [show("8")]
|
||||
REM AT [3:00] MSG [show("9")]
|
||||
REM AT [3:00] MSG [show("0")]
|
||||
REM AT [3:00] MSG [show("!")]
|
||||
REM AT [3:00] MSG [show("?")]
|
||||
REM AT [3:00] MSG [show("@")]
|
||||
REM AT [3:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [4:00] where now() = [now()]
|
||||
@@ -520,6 +544,7 @@ REM AT [4:00] MSG [show("8")]
|
||||
REM AT [4:00] MSG [show("9")]
|
||||
REM AT [4:00] MSG [show("0")]
|
||||
REM AT [4:00] MSG [show("!")]
|
||||
REM AT [4:00] MSG [show("?")]
|
||||
REM AT [4:00] MSG [show("@")]
|
||||
REM AT [4:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [5:00] where now() = [now()]
|
||||
@@ -534,6 +559,7 @@ REM AT [5:00] MSG [show("8")]
|
||||
REM AT [5:00] MSG [show("9")]
|
||||
REM AT [5:00] MSG [show("0")]
|
||||
REM AT [5:00] MSG [show("!")]
|
||||
REM AT [5:00] MSG [show("?")]
|
||||
REM AT [5:00] MSG [show("@")]
|
||||
REM AT [5:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [6:00] where now() = [now()]
|
||||
@@ -548,6 +574,7 @@ REM AT [6:00] MSG [show("8")]
|
||||
REM AT [6:00] MSG [show("9")]
|
||||
REM AT [6:00] MSG [show("0")]
|
||||
REM AT [6:00] MSG [show("!")]
|
||||
REM AT [6:00] MSG [show("?")]
|
||||
REM AT [6:00] MSG [show("@")]
|
||||
REM AT [6:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [7:00] where now() = [now()]
|
||||
@@ -562,6 +589,7 @@ REM AT [7:00] MSG [show("8")]
|
||||
REM AT [7:00] MSG [show("9")]
|
||||
REM AT [7:00] MSG [show("0")]
|
||||
REM AT [7:00] MSG [show("!")]
|
||||
REM AT [7:00] MSG [show("?")]
|
||||
REM AT [7:00] MSG [show("@")]
|
||||
REM AT [7:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [8:00] where now() = [now()]
|
||||
@@ -576,6 +604,7 @@ REM AT [8:00] MSG [show("8")]
|
||||
REM AT [8:00] MSG [show("9")]
|
||||
REM AT [8:00] MSG [show("0")]
|
||||
REM AT [8:00] MSG [show("!")]
|
||||
REM AT [8:00] MSG [show("?")]
|
||||
REM AT [8:00] MSG [show("@")]
|
||||
REM AT [8:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [9:00] where now() = [now()]
|
||||
@@ -590,6 +619,7 @@ REM AT [9:00] MSG [show("8")]
|
||||
REM AT [9:00] MSG [show("9")]
|
||||
REM AT [9:00] MSG [show("0")]
|
||||
REM AT [9:00] MSG [show("!")]
|
||||
REM AT [9:00] MSG [show("?")]
|
||||
REM AT [9:00] MSG [show("@")]
|
||||
REM AT [9:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [10:00] where now() = [now()]
|
||||
@@ -604,6 +634,7 @@ REM AT [10:00] MSG [show("8")]
|
||||
REM AT [10:00] MSG [show("9")]
|
||||
REM AT [10:00] MSG [show("0")]
|
||||
REM AT [10:00] MSG [show("!")]
|
||||
REM AT [10:00] MSG [show("?")]
|
||||
REM AT [10:00] MSG [show("@")]
|
||||
REM AT [10:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [11:00] where now() = [now()]
|
||||
@@ -618,6 +649,7 @@ REM AT [11:00] MSG [show("8")]
|
||||
REM AT [11:00] MSG [show("9")]
|
||||
REM AT [11:00] MSG [show("0")]
|
||||
REM AT [11:00] MSG [show("!")]
|
||||
REM AT [11:00] MSG [show("?")]
|
||||
REM AT [11:00] MSG [show("@")]
|
||||
REM AT [11:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [11:59] where now() = [now()]
|
||||
@@ -632,6 +664,7 @@ REM AT [11:59] MSG [show("8")]
|
||||
REM AT [11:59] MSG [show("9")]
|
||||
REM AT [11:59] MSG [show("0")]
|
||||
REM AT [11:59] MSG [show("!")]
|
||||
REM AT [11:59] MSG [show("?")]
|
||||
REM AT [11:59] MSG [show("@")]
|
||||
REM AT [11:59] MSG [show("#")]
|
||||
MSG %_Time substitutions for [12:00] where now() = [now()]
|
||||
@@ -646,6 +679,7 @@ REM AT [12:00] MSG [show("8")]
|
||||
REM AT [12:00] MSG [show("9")]
|
||||
REM AT [12:00] MSG [show("0")]
|
||||
REM AT [12:00] MSG [show("!")]
|
||||
REM AT [12:00] MSG [show("?")]
|
||||
REM AT [12:00] MSG [show("@")]
|
||||
REM AT [12:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [12:01] where now() = [now()]
|
||||
@@ -660,6 +694,7 @@ REM AT [12:01] MSG [show("8")]
|
||||
REM AT [12:01] MSG [show("9")]
|
||||
REM AT [12:01] MSG [show("0")]
|
||||
REM AT [12:01] MSG [show("!")]
|
||||
REM AT [12:01] MSG [show("?")]
|
||||
REM AT [12:01] MSG [show("@")]
|
||||
REM AT [12:01] MSG [show("#")]
|
||||
MSG %_Time substitutions for [13:00] where now() = [now()]
|
||||
@@ -674,6 +709,7 @@ REM AT [13:00] MSG [show("8")]
|
||||
REM AT [13:00] MSG [show("9")]
|
||||
REM AT [13:00] MSG [show("0")]
|
||||
REM AT [13:00] MSG [show("!")]
|
||||
REM AT [13:00] MSG [show("?")]
|
||||
REM AT [13:00] MSG [show("@")]
|
||||
REM AT [13:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [14:00] where now() = [now()]
|
||||
@@ -688,6 +724,7 @@ REM AT [14:00] MSG [show("8")]
|
||||
REM AT [14:00] MSG [show("9")]
|
||||
REM AT [14:00] MSG [show("0")]
|
||||
REM AT [14:00] MSG [show("!")]
|
||||
REM AT [14:00] MSG [show("?")]
|
||||
REM AT [14:00] MSG [show("@")]
|
||||
REM AT [14:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [15:00] where now() = [now()]
|
||||
@@ -702,6 +739,7 @@ REM AT [15:00] MSG [show("8")]
|
||||
REM AT [15:00] MSG [show("9")]
|
||||
REM AT [15:00] MSG [show("0")]
|
||||
REM AT [15:00] MSG [show("!")]
|
||||
REM AT [15:00] MSG [show("?")]
|
||||
REM AT [15:00] MSG [show("@")]
|
||||
REM AT [15:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [16:00] where now() = [now()]
|
||||
@@ -716,6 +754,7 @@ REM AT [16:00] MSG [show("8")]
|
||||
REM AT [16:00] MSG [show("9")]
|
||||
REM AT [16:00] MSG [show("0")]
|
||||
REM AT [16:00] MSG [show("!")]
|
||||
REM AT [16:00] MSG [show("?")]
|
||||
REM AT [16:00] MSG [show("@")]
|
||||
REM AT [16:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [17:00] where now() = [now()]
|
||||
@@ -730,6 +769,7 @@ REM AT [17:00] MSG [show("8")]
|
||||
REM AT [17:00] MSG [show("9")]
|
||||
REM AT [17:00] MSG [show("0")]
|
||||
REM AT [17:00] MSG [show("!")]
|
||||
REM AT [17:00] MSG [show("?")]
|
||||
REM AT [17:00] MSG [show("@")]
|
||||
REM AT [17:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [18:00] where now() = [now()]
|
||||
@@ -744,6 +784,7 @@ REM AT [18:00] MSG [show("8")]
|
||||
REM AT [18:00] MSG [show("9")]
|
||||
REM AT [18:00] MSG [show("0")]
|
||||
REM AT [18:00] MSG [show("!")]
|
||||
REM AT [18:00] MSG [show("?")]
|
||||
REM AT [18:00] MSG [show("@")]
|
||||
REM AT [18:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [19:00] where now() = [now()]
|
||||
@@ -758,6 +799,7 @@ REM AT [19:00] MSG [show("8")]
|
||||
REM AT [19:00] MSG [show("9")]
|
||||
REM AT [19:00] MSG [show("0")]
|
||||
REM AT [19:00] MSG [show("!")]
|
||||
REM AT [19:00] MSG [show("?")]
|
||||
REM AT [19:00] MSG [show("@")]
|
||||
REM AT [19:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [20:00] where now() = [now()]
|
||||
@@ -772,6 +814,7 @@ REM AT [20:00] MSG [show("8")]
|
||||
REM AT [20:00] MSG [show("9")]
|
||||
REM AT [20:00] MSG [show("0")]
|
||||
REM AT [20:00] MSG [show("!")]
|
||||
REM AT [20:00] MSG [show("?")]
|
||||
REM AT [20:00] MSG [show("@")]
|
||||
REM AT [20:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [21:00] where now() = [now()]
|
||||
@@ -786,6 +829,7 @@ REM AT [21:00] MSG [show("8")]
|
||||
REM AT [21:00] MSG [show("9")]
|
||||
REM AT [21:00] MSG [show("0")]
|
||||
REM AT [21:00] MSG [show("!")]
|
||||
REM AT [21:00] MSG [show("?")]
|
||||
REM AT [21:00] MSG [show("@")]
|
||||
REM AT [21:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [22:00] where now() = [now()]
|
||||
@@ -800,6 +844,7 @@ REM AT [22:00] MSG [show("8")]
|
||||
REM AT [22:00] MSG [show("9")]
|
||||
REM AT [22:00] MSG [show("0")]
|
||||
REM AT [22:00] MSG [show("!")]
|
||||
REM AT [22:00] MSG [show("?")]
|
||||
REM AT [22:00] MSG [show("@")]
|
||||
REM AT [22:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [23:00] where now() = [now()]
|
||||
@@ -814,6 +859,7 @@ REM AT [23:00] MSG [show("8")]
|
||||
REM AT [23:00] MSG [show("9")]
|
||||
REM AT [23:00] MSG [show("0")]
|
||||
REM AT [23:00] MSG [show("!")]
|
||||
REM AT [23:00] MSG [show("?")]
|
||||
REM AT [23:00] MSG [show("@")]
|
||||
REM AT [23:00] MSG [show("#")]
|
||||
MSG %_Time substitutions for [23:59] where now() = [now()]
|
||||
@@ -828,6 +874,7 @@ REM AT [23:59] MSG [show("8")]
|
||||
REM AT [23:59] MSG [show("9")]
|
||||
REM AT [23:59] MSG [show("0")]
|
||||
REM AT [23:59] MSG [show("!")]
|
||||
REM AT [23:59] MSG [show("?")]
|
||||
REM AT [23:59] MSG [show("@")]
|
||||
REM AT [23:59] MSG [show("#")]
|
||||
|
||||
@@ -857,6 +904,49 @@ msg [showmon(10)]
|
||||
msg [showmon(11)]
|
||||
msg [showmon(12)]
|
||||
|
||||
msg %_Here are some ordinal numbers for %(LANGID):
|
||||
MSG ord(0) = [ord(0)]
|
||||
MSG ord(1) = [ord(1)]
|
||||
MSG ord(2) = [ord(2)]
|
||||
MSG ord(3) = [ord(3)]
|
||||
MSG ord(4) = [ord(4)]
|
||||
MSG ord(5) = [ord(5)]
|
||||
MSG ord(6) = [ord(6)]
|
||||
MSG ord(7) = [ord(7)]
|
||||
MSG ord(8) = [ord(8)]
|
||||
MSG ord(9) = [ord(9)]
|
||||
MSG ord(10) = [ord(10)]
|
||||
MSG ord(11) = [ord(11)]
|
||||
MSG ord(12) = [ord(12)]
|
||||
MSG ord(13) = [ord(13)]
|
||||
MSG ord(14) = [ord(14)]
|
||||
MSG ord(15) = [ord(15)]
|
||||
MSG ord(16) = [ord(16)]
|
||||
MSG ord(17) = [ord(17)]
|
||||
MSG ord(18) = [ord(18)]
|
||||
MSG ord(19) = [ord(19)]
|
||||
MSG ord(20) = [ord(20)]
|
||||
MSG ord(21) = [ord(21)]
|
||||
MSG ord(22) = [ord(22)]
|
||||
MSG ord(23) = [ord(23)]
|
||||
MSG ord(24) = [ord(24)]
|
||||
MSG ord(25) = [ord(25)]
|
||||
MSG ord(26) = [ord(26)]
|
||||
MSG ord(27) = [ord(27)]
|
||||
MSG ord(28) = [ord(28)]
|
||||
MSG ord(29) = [ord(29)]
|
||||
MSG ord(30) = [ord(30)]
|
||||
MSG ord(31) = [ord(31)]
|
||||
MSG ord(32) = [ord(32)]
|
||||
MSG ord(33) = [ord(33)]
|
||||
MSG ord(34) = [ord(34)]
|
||||
MSG ord(35) = [ord(35)]
|
||||
MSG ord(36) = [ord(36)]
|
||||
MSG ord(37) = [ord(37)]
|
||||
MSG ord(38) = [ord(38)]
|
||||
MSG ord(39) = [ord(39)]
|
||||
MSG ord(40) = [ord(40)]
|
||||
|
||||
MSG $Ago is [$Ago]%
|
||||
MSG $Am is [$Am]%
|
||||
MSG $And is [$And]%
|
||||
|
||||
80
tests/tz.cmp
Normal file
80
tests/tz.cmp
Normal file
@@ -0,0 +1,80 @@
|
||||
Fri 13th @23:30 Eastern is on Saturday, 14 February, 2026 at 5:30am here
|
||||
$T => 2026-02-14
|
||||
$Tt => 05:30
|
||||
trigtz() => "America/Toronto"
|
||||
trigtime() => 05:30
|
||||
trigtimetz() => 23:30
|
||||
trigeventstart() => 2026-02-14@05:30
|
||||
trigeventstarttz() => 2026-02-13@23:30
|
||||
Fri 13th @23:30 Eastern is today at 5:30am here
|
||||
$T => 2026-02-14
|
||||
$Tt => 05:30
|
||||
trigtz() => "America/Toronto"
|
||||
trigtime() => 05:30
|
||||
trigtimetz() => 23:30
|
||||
trigeventstart() => 2026-02-14@05:30
|
||||
trigeventstarttz() => 2026-02-13@23:30
|
||||
Fri 13th @23:30 Eastern is on Saturday, 14 March, 2026 at 4:30am here
|
||||
2025/01/09 * * * 540 9:00am Locally: at 09:00
|
||||
2025/02/13 * * * 540 9:00am Locally: at 09:00
|
||||
2025/03/13 * * * 600 10:00am Locally: at 10:00
|
||||
2025/04/10 * * * 540 9:00am Locally: at 09:00
|
||||
2025/05/08 * * * 540 9:00am Locally: at 09:00
|
||||
2025/06/12 * * * 540 9:00am Locally: at 09:00
|
||||
2025/07/10 * * * 540 9:00am Locally: at 09:00
|
||||
2025/08/14 * * * 540 9:00am Locally: at 09:00
|
||||
2025/09/11 * * * 540 9:00am Locally: at 09:00
|
||||
2025/10/09 * * * 540 9:00am Locally: at 09:00
|
||||
2025/11/13 * * * 540 9:00am Locally: at 09:00
|
||||
2025/12/11 * * * 540 9:00am Locally: at 09:00
|
||||
trigtz = , trigtime = 14:53, trigtimetz = 14:53, trigeventstart = 2026-01-18@14:53, trigeventstarttz = 2026-01-18@14:53
|
||||
trigtz = Australia/Sydney, trigtime = 14:53, trigtimetz = 06:53, trigeventstart = 2026-01-18@14:53, trigeventstarttz = 2026-01-19@06:53
|
||||
new=2026-01-19@06:53 first=2026-01-26@15:48 full=2026-01-03@21:04 last=2026-01-11@02:49
|
||||
Full Moon 2026-01-03 at 05:04.
|
||||
Full Moon 2026-01-03 at 05:04. (*)
|
||||
Last Quarter 2026-01-10 at 10:49.
|
||||
Last Quarter 2026-01-10 at 10:49. (*)
|
||||
New Moon 2026-01-18 at 14:53.
|
||||
New Moon 2026-01-18 at 14:53. (*)
|
||||
First Quarter 2026-01-25 at 23:48.
|
||||
First Quarter 2026-01-25 at 23:48. (*)
|
||||
Whatsup? today at 13:33.
|
||||
Whatsup? today at 13:33.
|
||||
-stdin-(4): TZ specified twice
|
||||
-stdin-(5): TZ specified twice
|
||||
-stdin-(6): TZ specified for non-timed reminder
|
||||
tzconvert(2025-09-01@14:44, "", "Europe/Berlin") => 2025-09-01@20:44
|
||||
tzconvert(2025-09-01@14:44, "America/Toronto", "Europe/Berlin") => 2025-09-01@20:44
|
||||
tzconvert(2025-09-01@14:44, "Europe/Berlin", "") => 2025-09-01@08:44
|
||||
tzconvert(2025-09-01@14:44, "Europe/Berlin") => 2025-09-01@08:44
|
||||
tzconvert(2025-09-01@14:44, "", "") => 2025-09-01@14:44
|
||||
tzconvert(2025-09-01@14:44, "") => 2025-09-01@14:44
|
||||
evaltrig("Wednesday at 23:00 TZ Australia/Sydney") => 2025-09-03@09:00
|
||||
evaltrig("Wednesday at 23:00 TZ Europe/Amsterdam") => 2025-09-03@17:00
|
||||
evaltrig("Wednesday at 23:00 TZ America/Los_Angele"...) => 2025-09-04@02:00
|
||||
evaltrig("Wednesday TZ Europe/Amsterdam") => TZ specified for non-timed reminder
|
||||
-stdin-(11): evaltrig(): TZ specified for non-timed reminder
|
||||
trig("Mon at 00:00 TZ Australia/Sydney", "Tue at 00:00 TZ America/Toronto", "Wed at 00:00 TZ Europe/Amsterdam", "Thu at 00:00 TZ America/Los_Angeles", "Fri at 00:00 TZ Australia/Sydney", "Sat at 00:00 TZ Australia/Sydney", "Sun at 00:00 TZ Australia/Sydney", "at 14:42") => -stdin-(14:21): Trig(tz_adj Australia/Sydney) = Sunday, 31 August, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Sunday, 7 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig = Monday, 8 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Sunday, 7 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig(tz_adj America/Toronto) = Tuesday, 2 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig = Tuesday, 2 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj America/Toronto) = Tuesday, 2 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj Europe/Amsterdam) = Tuesday, 2 September, 2025 AT 18:00
|
||||
-stdin-(14:21): Trig = Wednesday, 3 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj Europe/Amsterdam) = Tuesday, 2 September, 2025 AT 18:00
|
||||
-stdin-(14:21): Trig(tz_adj America/Los_Angeles) = Thursday, 4 September, 2025 AT 03:00
|
||||
-stdin-(14:21): Trig = Thursday, 4 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj America/Los_Angeles) = Thursday, 4 September, 2025 AT 03:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Thursday, 4 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig = Friday, 5 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Thursday, 4 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Friday, 5 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig = Saturday, 6 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Friday, 5 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Saturday, 6 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig = Sunday, 7 September, 2025 AT 00:00
|
||||
-stdin-(14:21): Trig(tz_adj Australia/Sydney) = Saturday, 6 September, 2025 AT 10:00
|
||||
-stdin-(14:21): Trig = Monday, 1 September, 2025 AT 14:42
|
||||
2025-09-01
|
||||
@@ -34,3 +34,5 @@ set a utctolocal('2051-01-01@04:44')
|
||||
set a utctolocal('2050-03-13@05:00')
|
||||
set a utctolocal('2050-11-06@04:00')
|
||||
set a utctolocal('2050-11-06@07:00')
|
||||
|
||||
set a trigger('1990-01-01@1:22', 1)
|
||||
|
||||
Reference in New Issue
Block a user