Compare commits
229 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6dbf05af4 | ||
|
|
8ab78fd8be | ||
|
|
4f119031a4 | ||
|
|
19bdd6c2db | ||
|
|
f1557b8243 | ||
|
|
85f96e2e01 | ||
|
|
47331cd919 | ||
|
|
d9f18ed6a7 | ||
|
|
efa4816371 | ||
|
|
2dc8c63adb | ||
|
|
c3c1781021 | ||
|
|
cd39480a98 | ||
|
|
281a1a206e | ||
|
|
cbff2a7bf2 | ||
|
|
2a08be8fd0 | ||
|
|
0826678209 | ||
|
|
f2e421bfa5 | ||
|
|
ce53a9b91a | ||
|
|
b166b1cf82 | ||
|
|
d09fbb03b2 | ||
|
|
7a835f3b10 | ||
|
|
6b991cdf9c | ||
|
|
018e9d0323 | ||
|
|
f499ae096f | ||
|
|
725e046a15 | ||
|
|
275b1f62b6 | ||
|
|
6e58dea198 | ||
|
|
ad4e62c8c3 | ||
|
|
a5768d55d8 | ||
|
|
7db49971c8 | ||
|
|
45ca6631ac | ||
|
|
d51944f36c | ||
|
|
037c79fb0f | ||
|
|
993373414f | ||
|
|
38a0a9992a | ||
|
|
a82bbe3776 | ||
|
|
a32ba217ba | ||
|
|
d322cf54ac | ||
|
|
b1d07a231d | ||
|
|
97851a08e6 | ||
|
|
8547b30a8f | ||
|
|
405c7d9ed0 | ||
|
|
ac5b641d93 | ||
|
|
06a79989c0 | ||
|
|
671db64436 | ||
|
|
33344cefe6 | ||
|
|
5ef0341537 | ||
|
|
6abca08189 | ||
|
|
35670ce651 | ||
|
|
e230d53d84 | ||
|
|
88537a3471 | ||
|
|
7c9d74da73 | ||
|
|
3b582935ee | ||
|
|
508fafb875 | ||
|
|
6f718f0fe5 | ||
|
|
53acbf2052 | ||
|
|
1606dbbe77 | ||
|
|
adced3ac6c | ||
|
|
14f207140a | ||
|
|
d2da32de6c | ||
|
|
e5d6a36f05 | ||
|
|
68ecfcf876 | ||
|
|
fcb14b9dfe | ||
|
|
6a4b4257a6 | ||
|
|
385b57e269 | ||
|
|
a8e81e3984 | ||
|
|
46c5f0e752 | ||
|
|
454d859fdd | ||
|
|
57134a182c | ||
|
|
5801e143ea | ||
|
|
4e0d0ff98b | ||
|
|
d4ac1849ae | ||
|
|
c16ac1bd8c | ||
|
|
16222ac3bc | ||
|
|
8d88931fb1 | ||
|
|
63f0356e70 | ||
|
|
786b0dee6f | ||
|
|
e7ef9dc295 | ||
|
|
f59461b95d | ||
|
|
566a86b9fd | ||
|
|
8589a3730d | ||
|
|
c05fd366df | ||
|
|
fc9fd1e53c | ||
|
|
a5e6eb9f7c | ||
|
|
a9430fea5f | ||
|
|
828a0d6589 | ||
|
|
32601da748 | ||
|
|
ac50f119cf | ||
|
|
7622ebaa0a | ||
|
|
a586d5cd37 | ||
|
|
edbc88bd19 | ||
|
|
94f99f3414 | ||
|
|
fd4f84349e | ||
|
|
f86350b2ff | ||
|
|
564b72066a | ||
|
|
2890c52090 | ||
|
|
c1d45485c1 | ||
|
|
8b2a69cf8d | ||
|
|
034c1341b3 | ||
|
|
29bbf1a030 | ||
|
|
be6661d6be | ||
|
|
3f876e792c | ||
|
|
f2457b90ff | ||
|
|
e999e9009b | ||
|
|
46326c001b | ||
|
|
b84c2c403c | ||
|
|
861ad72187 | ||
|
|
7dbbc34ccc | ||
|
|
4ea45d1d14 | ||
|
|
c1b9243e2f | ||
|
|
a41c40c7a4 | ||
|
|
318d4547ef | ||
|
|
6f98b60a6a | ||
|
|
baa8f7f3c4 | ||
|
|
6297622072 | ||
|
|
9f3ba0bf2b | ||
|
|
9591dec708 | ||
|
|
ee2d0b7518 | ||
|
|
2d46749c58 | ||
|
|
494664d1b6 | ||
|
|
49686210ae | ||
|
|
ddfa44188b | ||
|
|
73cf93d27b | ||
|
|
60d1a34bf0 | ||
|
|
6f80986801 | ||
|
|
2078f087b2 | ||
|
|
68d110826e | ||
|
|
9fb04c54ae | ||
|
|
d82314594b | ||
|
|
ad169a5248 | ||
|
|
a9bab81226 | ||
|
|
fa63a9ba51 | ||
|
|
1e7a630737 | ||
|
|
de1afce8da | ||
|
|
ac3cb19c26 | ||
|
|
af0479d11d | ||
|
|
0d9c04707f | ||
|
|
c2218f133b | ||
|
|
1ad0645fab | ||
|
|
3c16f6839a | ||
|
|
e8bac1e469 | ||
|
|
b3b69596f4 | ||
|
|
6a7bcb0956 | ||
|
|
f18a0704c1 | ||
|
|
d6f24b7c1e | ||
|
|
e2c9bbf94c | ||
|
|
f53aa4f656 | ||
|
|
a7ab9b8bf8 | ||
|
|
4448271166 | ||
|
|
4861b535a2 | ||
|
|
167f0100c7 | ||
|
|
b0367c7a5c | ||
|
|
4ae8ad52f5 | ||
|
|
dbd64828ab | ||
|
|
158ca882ba | ||
|
|
623ed44608 | ||
|
|
f13b867626 | ||
|
|
ff85325886 | ||
|
|
aa830116ea | ||
|
|
1a4504ba28 | ||
|
|
20365c4627 | ||
|
|
fae8f89ed6 | ||
|
|
a0689999fe | ||
|
|
a42a0ab032 | ||
|
|
b66eb5d3ec | ||
|
|
8b4bc0f56e | ||
|
|
c9d984983f | ||
|
|
47125b051a | ||
|
|
e5e6ff6031 | ||
|
|
9f0aedb608 | ||
|
|
08af33ece5 | ||
|
|
9b421d0b94 | ||
|
|
7bd8d2dd25 | ||
|
|
a7c4879a0a | ||
|
|
8b3585a6b8 | ||
|
|
a223149aee | ||
|
|
9185341b0c | ||
|
|
bf2d707e13 | ||
|
|
f081e5c54d | ||
|
|
18a3db0f31 | ||
|
|
d2c115127d | ||
|
|
c12e7e1b8f | ||
|
|
d3495ab3aa | ||
|
|
b93a7a6195 | ||
|
|
e5519a8498 | ||
|
|
eb2256f873 | ||
|
|
637b137b1c | ||
|
|
e2d14e73bf | ||
|
|
fbbffb4672 | ||
|
|
422e098727 | ||
|
|
87347e30b2 | ||
|
|
3314ce9823 | ||
|
|
402c1fe614 | ||
|
|
1d57856aa8 | ||
|
|
c027c215d6 | ||
|
|
fa0428b9fe | ||
|
|
b01c499ce5 | ||
|
|
4e5033dd24 | ||
|
|
00863f3830 | ||
|
|
2d4b35e8b9 | ||
|
|
6e4f2b9466 | ||
|
|
9a6fc0253b | ||
|
|
3180c781ed | ||
|
|
632152e8b6 | ||
|
|
1048f7e98d | ||
|
|
3de265216e | ||
|
|
2bdcadc7ab | ||
|
|
421ddfc68e | ||
|
|
41594bc1ac | ||
|
|
e85199d464 | ||
|
|
a6ee3bc704 | ||
|
|
2909106f30 | ||
|
|
05b97aabb2 | ||
|
|
84af60d817 | ||
|
|
72403a2512 | ||
|
|
4ec619d646 | ||
|
|
6178a627a0 | ||
|
|
3095fd7e4a | ||
|
|
74a6041760 | ||
|
|
96127e37ff | ||
|
|
df5484ea35 | ||
|
|
0ae3dae030 | ||
|
|
e5979139ac | ||
|
|
f81f6deb20 | ||
|
|
f9951909d8 | ||
|
|
bbda972b05 | ||
|
|
4445e9c434 | ||
|
|
709adacac2 | ||
|
|
9841cdd355 |
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.gitignore export-ignore
|
||||||
|
.gitattributes export-ignore
|
||||||
|
remind.php export-ignore
|
||||||
|
sync-to-dianne-git export-ignore
|
||||||
1
.gitignore
vendored
@@ -13,3 +13,4 @@ tests/test.out
|
|||||||
*~
|
*~
|
||||||
src/rem2ps
|
src/rem2ps
|
||||||
src/version.h
|
src/version.h
|
||||||
|
TAGS
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ THE REMIND COPYRIGHT
|
|||||||
1. REMIND refers to the entire set of files and documentation in the
|
1. REMIND refers to the entire set of files and documentation in the
|
||||||
REMIND package.
|
REMIND package.
|
||||||
|
|
||||||
2. REMIND is Copyright 1992-2018 Dianne Skoll, except where noted in
|
2. REMIND is Copyright 1992-2020 Dianne Skoll, except where noted in
|
||||||
individual files.
|
individual files.
|
||||||
|
|
||||||
3. DISTRIBUTION AND USE
|
3. DISTRIBUTION AND USE
|
||||||
|
|||||||
8
Makefile
@@ -8,7 +8,7 @@ all: src/Makefile
|
|||||||
@echo "* *"
|
@echo "* *"
|
||||||
@echo "*******************"
|
@echo "*******************"
|
||||||
@echo ""
|
@echo ""
|
||||||
@cd src; $(MAKE) all LANGDEF=$(LANGDEF)
|
@cd src && $(MAKE) all LANGDEF=$(LANGDEF)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@echo ""
|
@echo ""
|
||||||
@@ -18,14 +18,14 @@ install:
|
|||||||
@echo "* *"
|
@echo "* *"
|
||||||
@echo "*********************"
|
@echo "*********************"
|
||||||
@echo ""
|
@echo ""
|
||||||
cd src; $(MAKE) install
|
@cd src && $(MAKE) install
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
find . -name '*~' -exec rm {} \;
|
find . -name '*~' -exec rm {} \;
|
||||||
cd src; $(MAKE) clean
|
cd src && $(MAKE) clean
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@cd src && $(MAKE) test
|
@cd src && $(MAKE) -s test
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out www/Makefile
|
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out www/Makefile
|
||||||
|
|||||||
4
configure
vendored
@@ -3976,7 +3976,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if test "$GCC" = yes; then
|
if test "$GCC" = yes; then
|
||||||
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
|
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ac_func in setenv unsetenv glob mbstowcs setlocale
|
for ac_func in setenv unsetenv glob mbstowcs setlocale
|
||||||
@@ -3991,7 +3991,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
VERSION=03.01.16
|
VERSION=03.03.01
|
||||||
|
|
||||||
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h"
|
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h"
|
||||||
|
|
||||||
|
|||||||
@@ -71,10 +71,10 @@ AC_FUNC_UTIME_NULL
|
|||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
if test "$GCC" = yes; then
|
if test "$GCC" = yes; then
|
||||||
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
|
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale)
|
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale)
|
||||||
VERSION=03.01.16
|
VERSION=03.03.01
|
||||||
AC_SUBST(VERSION)
|
AC_SUBST(VERSION)
|
||||||
AC_OUTPUT(src/Makefile www/Makefile src/version.h)
|
AC_OUTPUT(src/Makefile www/Makefile src/version.h)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
REMIND version 3.1 for UNIX
|
REMIND version 3.2 for UNIX
|
||||||
|
|
||||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||||
in the man page, "remind.1".
|
in the man page, "remind.1".
|
||||||
@@ -6,16 +6,16 @@ in the man page, "remind.1".
|
|||||||
INSTALLING REMIND:
|
INSTALLING REMIND:
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
If you have Tcl/Tk (wish 4.1 or higher) installed and are running X Windows:
|
If you have Tcl/Tk (wish 4.1 or higher) installed and are running X11:
|
||||||
--------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
1) Type: wish ./build.tk from the top-level Remind directory.
|
1) Type: wish ./build.tk from the top-level Remind directory.
|
||||||
Fill in the various options and hit "Build Remind"
|
Fill in the various options and hit "Build Remind"
|
||||||
|
|
||||||
2) Type: "make install" -- you may need to be root to do this.
|
2) Type: "make install" -- you may need to be root to do this.
|
||||||
|
|
||||||
If you do NOT have Tcl/Tk or are NOT running X Windows:
|
If you do NOT have Tcl/Tk or are NOT running X11:
|
||||||
-------------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
1) Edit the file "src/custom.h" according to your preferences.
|
1) Edit the file "src/custom.h" according to your preferences.
|
||||||
|
|
||||||
@@ -73,12 +73,12 @@ RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
|||||||
|
|
||||||
1. POPUP REMINDERS
|
1. POPUP REMINDERS
|
||||||
|
|
||||||
If you're running under X-Windows and you have the TCL tools,
|
If you're running under X11 and you have the Tcl tools, you can create
|
||||||
you can create simple pop-up reminders by creating the following
|
simple pop-up reminders by creating the following Tcl script called
|
||||||
TCL script called 'popup'. It pops a message on to the screen and
|
'popup'. It pops a message on to the screen and waits for you to
|
||||||
waits for you to press the 'OK' button. If you don't press the OK button
|
press the 'OK' button. If you don't press the OK button within 15
|
||||||
within 15 seconds, it exits anyway. To use it, you can use the '-k' option
|
seconds, it exits anyway. To use it, you can use the '-k' option for
|
||||||
for Remind as follows:
|
Remind as follows:
|
||||||
|
|
||||||
remind "-kpopup '%s'&" .reminders
|
remind "-kpopup '%s'&" .reminders
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ Norman Walsh.
|
|||||||
#!/usr/local/bin/wish
|
#!/usr/local/bin/wish
|
||||||
wm withdraw .
|
wm withdraw .
|
||||||
after 15000 { destroy . ; exit }
|
after 15000 { destroy . ; exit }
|
||||||
tk_dialog .d { Message } $argv warning 0 { OK }
|
tk_dialog .d { Message } $argv warning 0 { OK }
|
||||||
destroy .
|
destroy .
|
||||||
exit
|
exit
|
||||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
|
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
|
||||||
|
|||||||
125
docs/WHATSNEW
@@ -1,5 +1,130 @@
|
|||||||
CHANGES TO REMIND
|
CHANGES TO REMIND
|
||||||
|
|
||||||
|
* VERSION 3.3 Patch 1 - 2020-03-20
|
||||||
|
|
||||||
|
- CHANGE: For overlapping multi-day events, issue a reminder for the
|
||||||
|
most *recent* event rather than the earliest event. NOTE
|
||||||
|
INCOMPATIBILITY: This is a behavior change!
|
||||||
|
|
||||||
|
- CHANGE: Do not convert 90-99 to 1990-1999 when parsing numbers to
|
||||||
|
recognize years. NOTE INCOMPATIBILITY: This is a behavior change!
|
||||||
|
|
||||||
|
- CHANGE: Revert change to -y option that included filename and line
|
||||||
|
number in the hash.
|
||||||
|
|
||||||
|
- CHANGE: Retain newlines (produced by %_) in JSON output.
|
||||||
|
|
||||||
|
- FIX: Document $FormWidth system variable
|
||||||
|
|
||||||
|
- FIX: Highlight today's date in "remind -c" output
|
||||||
|
|
||||||
|
- FIX: Eliminate compiler warnings on Ubuntu 18.04.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Allow times to be specified either in 24-hour mode
|
||||||
|
(HH:MM or HH.MM) or AM/PM mode (HH:MMam; HH:MMpm, etc.)
|
||||||
|
|
||||||
|
- IMPROVEMENT: Allow DURATION to be specified as a time (1:30) or a
|
||||||
|
number of minutes (90).
|
||||||
|
|
||||||
|
- IMPROVEMENT: If terminal size can be determined, set $FormWidth to
|
||||||
|
terminal width - 8; if not, set $FormWidth to 72.
|
||||||
|
|
||||||
|
- MINOR IMPROVEMENT: Add the "ampm()" built-in function.
|
||||||
|
|
||||||
|
* Version 3.3 Patch 0 - 2020-01-31
|
||||||
|
|
||||||
|
- FIX: rem2ps: Add a %%PageBoundingBox: document structuring convention
|
||||||
|
comment.
|
||||||
|
|
||||||
|
- FIX: rem2ps: Ignore unknown SPECIAL-type reminders.
|
||||||
|
|
||||||
|
- IMPROVEMENT: In calendar mode ("-c" option), Remind automatically adjusts
|
||||||
|
the width of the calendar to fit the terminal window if standard output
|
||||||
|
is a TTY.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Add JSON-based output with "remind -pp" and "remind -ppp"
|
||||||
|
The JSON-based intermediate format preserves a lot more information
|
||||||
|
about the original reminder, allowing back-ends more insight into
|
||||||
|
the intent of the reminder, the recurrence used, etc. See the documentation
|
||||||
|
in "man rem2ps"
|
||||||
|
|
||||||
|
- IMPROVEMENT: TkRemind can "reverse-engineer" reminders that it creates
|
||||||
|
using the additional information in the "remind -pp" format, so it
|
||||||
|
doesn't create or use ugly comment blocks to delimit the reminders
|
||||||
|
it creates.
|
||||||
|
|
||||||
|
- IMPROVEMENT: TkRemind: Add popup help to most buttons and controls.
|
||||||
|
|
||||||
|
- NEW FEATURE: Add support for $DefaultColor system variable, suggested
|
||||||
|
by Tim Chase.
|
||||||
|
|
||||||
|
- NEW FEATURE: The "-@[n][,m]" command-line option allows colored reminders
|
||||||
|
in Agenda Mode as well as in Calendar Mode. It also adds support for
|
||||||
|
terminal emulators that can handle the xterm 256-color escape sequences
|
||||||
|
as well as the true 24-bit color escape sequences.
|
||||||
|
|
||||||
|
- CHANGE: SPECIALs are now case-insensitive. Before, only SPECIAL COLOR
|
||||||
|
would work. Now you can use Special Color, special color, etc.
|
||||||
|
|
||||||
|
* Version 3.2 Patch 0 - 2020-01-03
|
||||||
|
|
||||||
|
- IMPROVEMENT: Add support for events spanning multiple days (with AT
|
||||||
|
and DURATION). Add trigeventstart() and trigeventduration()
|
||||||
|
introspection functions; see "MULTI-DAY EVENTS" in the man page.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Add introspection functions trigback(), trigdelta(),
|
||||||
|
trigduration(), trigfrom(), trigpriority(), trigrep(),
|
||||||
|
trigscanfrom(), trigtimedelta(), trigtimerep(), and triguntil(). See
|
||||||
|
man page for details; thanks to Tim Chase for the suggestion.
|
||||||
|
|
||||||
|
- IMPROVEMENT: TkRemind: Use PNG images for the next month / previous
|
||||||
|
month buttons rather than -> and <-. Also use nice anti-aliased
|
||||||
|
moon phase images instead of ugly blocky bitmaps.
|
||||||
|
|
||||||
|
- CHANGE: Modify addition so that previously-illegal combinations
|
||||||
|
TIME + TIME, TIME + DATETIME and DATETIME + TIME are now allowed.
|
||||||
|
Also allow DATETIME - TIME. If t1 and t2 are expressions of type TIME
|
||||||
|
and dt is an expression of type DATETIME, then the following are now
|
||||||
|
equivalent (before, the expressions on the left-hand side would fail
|
||||||
|
with a "Type mismatch" error.)
|
||||||
|
|
||||||
|
t1 + t2 == t1 + coerce("INT", t2)
|
||||||
|
dt + t2 == dt + coerce("INT", t2)
|
||||||
|
t1 + dt == coerce("INT", t1) + dt
|
||||||
|
dt - t2 == dt - coerce("INT", t2)
|
||||||
|
|
||||||
|
- DOC FIX: Document previously-undocumented $MaxStringLen system variable
|
||||||
|
|
||||||
|
- DOC FIX: Various minor documentation fixes.
|
||||||
|
|
||||||
|
- BUG FIX: Specifying a DURATION without an AT clause results in an error.
|
||||||
|
Before, it would be accepted but not do anything useful.
|
||||||
|
|
||||||
|
- BUG FIX: Catch potential date overflow in slide() function
|
||||||
|
|
||||||
|
- BUG FIX: Fix compile error when compiling Romanian version; eliminate
|
||||||
|
compiler warning when compiling non-English versions.
|
||||||
|
|
||||||
|
- BUG FIX: TkRemind: Fix startup failure of TkRemind if options are at
|
||||||
|
default. :(
|
||||||
|
|
||||||
|
* Version 3.1 Patch 17 - 2019-11-15
|
||||||
|
|
||||||
|
- IMPROVEMENT: Add "Extra Remind Options" setting to TkRemind.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Enable warning-free compilation even with gcc -Wextra flag.
|
||||||
|
|
||||||
|
- IMPROVEMENT: Warn if "OMIT a THROUGH b" has a > b.
|
||||||
|
|
||||||
|
- SYNTACTIC SUGAR: Make "SCANFROM -n" the same as "SCANFROM [today() - n]"
|
||||||
|
|
||||||
|
- BUG FIX: Don't dump expired reminders when dumping queue.
|
||||||
|
|
||||||
|
- BUG FIX: Fix failure when specifying a Jahrzeit in Adar. Fix
|
||||||
|
courtesy of Dov Feldstern
|
||||||
|
|
||||||
|
- BUG FIX: Fix various documentation errors and update man page.
|
||||||
|
|
||||||
* Version 3.1 Patch 16 - 2018-11-09
|
* Version 3.1 Patch 16 - 2018-11-09
|
||||||
|
|
||||||
- IMPROVEMENT: Add patch from Stephen Morgan to calculate astronomical and
|
- IMPROVEMENT: Add patch from Stephen Morgan to calculate astronomical and
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.TH REM 1 "30 August 2007"
|
.TH REM 1 "1 January 2020"
|
||||||
.UC 4
|
.UC 4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
rem \- Invoke Remind with a default filename
|
rem \- Invoke Remind with a default filename
|
||||||
|
|||||||
262
man/rem2ps.1
@@ -1,13 +1,13 @@
|
|||||||
.TH REM2PS 1 "11 April 2005"
|
.TH REM2PS 1 "1 January 2020"
|
||||||
.UC 4
|
.UC 4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
rem2ps \- draw a PostScript calendar from Remind output
|
rem2ps \- draw a PostScript calendar from Remind output
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B rem2ps [\fIoptions\fR]
|
.B rem2ps [\fIoptions\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBRem2ps\fR reads the standard input, which should be the results of running
|
\fBRem2ps\fR reads the standard input, which should be the results of
|
||||||
\fBRemind\fR with the \fB\-p\fR option. It emits PostScript code (which
|
running \fBRemind\fR with the \fB\-p\fR or \fB\-pp\fR option. It
|
||||||
draws a calendar) to the standard output.
|
emits PostScript code (which draws a calendar) to the standard output.
|
||||||
.PP
|
.PP
|
||||||
See the section "Rem2PS Input Format" for details about the \fB\-p\fR
|
See the section "Rem2PS Input Format" for details about the \fB\-p\fR
|
||||||
data. This may be useful if you wish to create other \fBRemind\fR
|
data. This may be useful if you wish to create other \fBRemind\fR
|
||||||
@@ -267,7 +267,7 @@ hold:
|
|||||||
.TP
|
.TP
|
||||||
o
|
o
|
||||||
The PostScript origin is at the bottom left-hand corner of the page, and
|
The PostScript origin is at the bottom left-hand corner of the page, and
|
||||||
PostScript units of 1/72" are in effect.
|
PostScript units of 1/72 inch are in effect.
|
||||||
.TP
|
.TP
|
||||||
o
|
o
|
||||||
The variables MinX, MinY, MaxX and MaxY define the bounding box within
|
The variables MinX, MinY, MaxX and MaxY define the bounding box within
|
||||||
@@ -313,7 +313,13 @@ Use that file with the \fBRem2ps\fR \fB\-p\fR option to create calendars
|
|||||||
with the year and month in large grey letters in the background of the
|
with the year and month in large grey letters in the background of the
|
||||||
calendar.
|
calendar.
|
||||||
.PP
|
.PP
|
||||||
.SH REM2PS INPUT FORMAT
|
.SH REM2PS INPUT FORMAT (-P OPTION)
|
||||||
|
The \fB\-p\fR option is an older, simpler interchange format used by
|
||||||
|
\fBRemind\fR to communicate with back-ends. New back-ends are
|
||||||
|
encoraged to support the new \fB\-pp\fR format preferably, though they
|
||||||
|
are encouraged to support the older \fB\-p\fR format as well if the
|
||||||
|
older format contains enough information for them to work properly.
|
||||||
|
.PP
|
||||||
\fBRemind \-p\fR sends the following lines to standard output.
|
\fBRemind \-p\fR sends the following lines to standard output.
|
||||||
The information is designed to be easily parsed by back-end programs:
|
The information is designed to be easily parsed by back-end programs:
|
||||||
.TP
|
.TP
|
||||||
@@ -375,6 +381,9 @@ was provided.
|
|||||||
.PP
|
.PP
|
||||||
\fIbody\fR is the body of the reminder.
|
\fIbody\fR is the body of the reminder.
|
||||||
.PP
|
.PP
|
||||||
|
Future versions of \fBRemind\fR may add additional keys to the JSON
|
||||||
|
object. Back-ends \fImust\fR ignore keys they don't recognize.
|
||||||
|
.PP
|
||||||
After a month's worth of reminders have been emitted, \fBRemind\fR
|
After a month's worth of reminders have been emitted, \fBRemind\fR
|
||||||
emits the line:
|
emits the line:
|
||||||
.PP
|
.PP
|
||||||
@@ -393,6 +402,247 @@ the line number and file name of the file containing the reminder. Back-ends
|
|||||||
that don't care about this information should ignore lines starting with
|
that don't care about this information should ignore lines starting with
|
||||||
"#" (except, of course, for the # rem2ps lines.)
|
"#" (except, of course, for the # rem2ps lines.)
|
||||||
.PP
|
.PP
|
||||||
|
.SH REM2PS PARTIAL JSON INPUT FORMAT (-PP OPTION)
|
||||||
|
\fBRemind \-pp\fR sends the following lines to standard output. They
|
||||||
|
are designed to be easily parsed, but contain much more information
|
||||||
|
than the old-style \fBremind -p\fR output. The extra information
|
||||||
|
contains a representation of the parsed "REM" statement, which could
|
||||||
|
allow converters to better preserve semantics of a reminder. For
|
||||||
|
example, this format passes enough information to allow a back-end to
|
||||||
|
(in many cases) determine a reminder's recurrence rather than just treating
|
||||||
|
each reminder as a one-off event.
|
||||||
|
.PP
|
||||||
|
The lines emitted by \fBremind \-pp\fR are as follows:
|
||||||
|
.TP
|
||||||
|
.B # rem2ps2 begin
|
||||||
|
This line signifies the start of calendar data. Back-ends can search
|
||||||
|
for it to verify they are being fed correct information. Note the
|
||||||
|
"2" after "rem2ps", which distinguishes this format from the older \fB\-p\fR
|
||||||
|
format.
|
||||||
|
.TP
|
||||||
|
\fImonth_name year num_days first_day monday_first\fR
|
||||||
|
Same as the \fB\-p\fR format
|
||||||
|
.TP
|
||||||
|
\fIsun mon tue wed thu fri sat\fR
|
||||||
|
Same as the \fB\-p\fR format
|
||||||
|
.TP
|
||||||
|
\fInext_mon next_days\fR
|
||||||
|
Same as the \fB\-p\fR format
|
||||||
|
.TP
|
||||||
|
\fIprev_mon prev_days\fR
|
||||||
|
Same as the \fB\-p\fR format
|
||||||
|
.PP
|
||||||
|
.B CALENDAR ENTRIES
|
||||||
|
.PP
|
||||||
|
The remaining data consists of calendar entries expressed as a JSON object
|
||||||
|
on a single line. Each such line will begin with "{" and will be a well-formed
|
||||||
|
JSON object. The keys that may be present in the JSON object are as
|
||||||
|
follows:
|
||||||
|
.TP
|
||||||
|
.B date \fIYYYY-MM-DD\fR
|
||||||
|
The \fbdate\fR key will \fIalways\fR be present; it is the trigger date
|
||||||
|
of the reminder expressed as a string in the format \fIYYYY-MM-DD\fR
|
||||||
|
.TP
|
||||||
|
.B filename \fIf\fR
|
||||||
|
The filename in which the reminder was found.
|
||||||
|
.TP
|
||||||
|
.B lineno \fIn\fR
|
||||||
|
The line number within the file on which the reminder was found.
|
||||||
|
.TP
|
||||||
|
.B nonconst_expr 1
|
||||||
|
If the reminder contained a non-constant expression that had to be evaluated
|
||||||
|
to determine the trigger date, this key will be present with the value 1.
|
||||||
|
If this key is present, then it is unsafe for a back-end to rely on
|
||||||
|
recurrence semantics or even the semantics of any part of the parsed
|
||||||
|
reminder, as they may have been computed in a way that cannot be expressed
|
||||||
|
in JSON.
|
||||||
|
.TP
|
||||||
|
.B if_depth \fIn\fR
|
||||||
|
If the reminder is inside one or more IF or ELSE statements, this key
|
||||||
|
will be present and the value will be the number of nested IFs from
|
||||||
|
the top-level to the reminder. Back-ends should be wary of
|
||||||
|
interpreting recurrence semantics of reminders within an IF or ELSE
|
||||||
|
block.
|
||||||
|
.TP
|
||||||
|
.B passthru \fIspecial\fR
|
||||||
|
If the reminder was a SPECIAL reminder, the \fBpassthru\fR key will be
|
||||||
|
present and the value will be the type of SPECIAL (such as SHADE, COLOR,
|
||||||
|
MOON, etc.)
|
||||||
|
.TP
|
||||||
|
.B tags \fIdata\fR
|
||||||
|
If any TAG clauses are present, the \fBtag\fR key will be present and consist
|
||||||
|
of a comma-separated list of tags.
|
||||||
|
.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.
|
||||||
|
.TP
|
||||||
|
.B tdelta \fIn\fR
|
||||||
|
If a time delta (+n after an AT clause) was present, this key contains the
|
||||||
|
delta value in minutes.
|
||||||
|
.TP
|
||||||
|
.B trep \fIn\fR
|
||||||
|
If a time repeat (*n after an AT clause) was present, this key contains the
|
||||||
|
repeat value in minutes.
|
||||||
|
.TP
|
||||||
|
.B eventduration \fIn\fR
|
||||||
|
If a DURATION clause was present, this key contains the event duration in
|
||||||
|
minutes.
|
||||||
|
.TP
|
||||||
|
.B duration \fIn\fR
|
||||||
|
If a DURATION clause was present, this key contains today's duration in
|
||||||
|
minutes. See the \fBremind(1)\fR man page, "MULTI-DAY EVENTS", for a
|
||||||
|
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.
|
||||||
|
.TP
|
||||||
|
.B back \fIn\fR
|
||||||
|
If the reminder contained a "back" clause (\-n or \-\-n), this key
|
||||||
|
contains the back value. If the "back" value was \-n, the value will
|
||||||
|
be positive; if it was \-\-n, the value will be negative.
|
||||||
|
.TP
|
||||||
|
.B delta \fIn\fR
|
||||||
|
If the reminder contained a "delta" clause (\+n or \+\+n), this key
|
||||||
|
contains the delta value. If the "delta" value was \+n, the value will
|
||||||
|
be positive; if it was \+\+n, the value will be negative.
|
||||||
|
.TP
|
||||||
|
.B rep \fIn\fR
|
||||||
|
If the reminder contained a "repeat" clause (*n), this key contains
|
||||||
|
the repeat value.
|
||||||
|
.TP
|
||||||
|
.B skip \fItype\fR
|
||||||
|
If the reminder contained a SKIP, BEFORE or AFTER keyword, then this
|
||||||
|
key will contain that keyword.
|
||||||
|
.TP
|
||||||
|
.B localomit \fIarray\fR
|
||||||
|
If the reminder contains a local OMIT keyword, this key will be present.
|
||||||
|
Its value will be an array of English day names that are OMITted.
|
||||||
|
.TP
|
||||||
|
.B wd \fIarray\fR
|
||||||
|
If the reminder contains one or more weekdays, this key will be present.
|
||||||
|
Its value will be an array of English day names that are present.
|
||||||
|
.TP
|
||||||
|
.B d \fIn\fR
|
||||||
|
If a day-of-month is present in the reminder specification, this key
|
||||||
|
will be present and its value will be the day number.
|
||||||
|
.TP
|
||||||
|
.B m \fIn\fR
|
||||||
|
If a month is present in the reminder specification, this key
|
||||||
|
will be present and its value will be the month number.
|
||||||
|
.TP
|
||||||
|
.B y \fIn\fR
|
||||||
|
If a year is present in the reminder specification, this key
|
||||||
|
will be present and its value will be the year.
|
||||||
|
.TP
|
||||||
|
.B until \fIYYYY-MM-DD\fR
|
||||||
|
If the reminder contains an UNTIL or THROUGH clause, this key
|
||||||
|
will be present. Its value will be a string of the form YYYY-MM-DD.
|
||||||
|
.TP
|
||||||
|
.B once 1
|
||||||
|
If the reminder contains a ONCE keyword, this key will be present
|
||||||
|
with a value of 1.
|
||||||
|
.TP
|
||||||
|
.B scanfrom \fIYYYY-MM-DD\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.
|
||||||
|
.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 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.
|
||||||
|
.TP
|
||||||
|
.B r \fIn\fR
|
||||||
|
For a SHADE or COLOR special, the red color component.
|
||||||
|
.TP
|
||||||
|
.B g \fIn\fR
|
||||||
|
For a SHADE or COLOR special, the green color component.
|
||||||
|
.TP
|
||||||
|
.B b \fIn\fR
|
||||||
|
For a SHADE or COLOR special, the blue color component.
|
||||||
|
.TP
|
||||||
|
.B body \fIbody\fR
|
||||||
|
The body of the reminder to issue. Always present.
|
||||||
|
.TP
|
||||||
|
.B rawbody \fIraw\fR
|
||||||
|
The "raw" body of the reminder, before any expression-pasting or
|
||||||
|
substitution-sequence processing. If the raw body would be the same
|
||||||
|
as the processed body, then this key is not present.
|
||||||
|
.PP
|
||||||
|
After a month's worth of reminders have been emitted, \fBRemind\fR
|
||||||
|
emits the line:
|
||||||
|
.PP
|
||||||
|
\fB# rem2ps2 end
|
||||||
|
.PP
|
||||||
|
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 OPTION)
|
||||||
|
\fBRemind \-ppp\fR emits \fIpure JSON\fR output. The format is
|
||||||
|
as follows:
|
||||||
|
.PP
|
||||||
|
\fBRemind\fR outputs a JSON array. Each element of the array is a
|
||||||
|
\fImonth descriptor\fR.
|
||||||
|
.PP
|
||||||
|
Each month descriptor is a JSON object with the following elements:
|
||||||
|
.TP
|
||||||
|
.B monthname \fIname\fR
|
||||||
|
The name of the month.
|
||||||
|
.TP
|
||||||
|
.B year \fIyyyy\fR
|
||||||
|
The year.
|
||||||
|
.TP
|
||||||
|
.B daysinmonnth \fIn\fR
|
||||||
|
The number of days in the current month.
|
||||||
|
.TP
|
||||||
|
.B firstwkday \fIn\fR
|
||||||
|
The weekday of the first day of the month (0 = Sunday, 1 = Monday, 6 = Saturday).
|
||||||
|
.TP
|
||||||
|
.B mondayfirst \fIn\fR
|
||||||
|
An indicator of whether or not the calendar week should start with
|
||||||
|
Sunday (n=0) or Monday (n=1).
|
||||||
|
.TP
|
||||||
|
.B daynames \fR[\fIdays\fR]
|
||||||
|
A seven-element array of day names; each element is a string representing
|
||||||
|
the names of the days from Sunday through Saturday.
|
||||||
|
.TP
|
||||||
|
.B prevmonthname \fIname\fR
|
||||||
|
The name of the previous month.
|
||||||
|
.TP
|
||||||
|
.B daysinprevmonth \fIn\fR
|
||||||
|
The number of days in the previous month.
|
||||||
|
.TP
|
||||||
|
.B prevmonthyear \fIyyyy\fR
|
||||||
|
The year of the previous month. (The same as \fByear\fR unless the current
|
||||||
|
month is January.)
|
||||||
|
.TP
|
||||||
|
.B nextmonthname \fIname\fR
|
||||||
|
The name of the following month.
|
||||||
|
.TP
|
||||||
|
.B daysinnextmonth \fIn\fR
|
||||||
|
The number of days in the following month.
|
||||||
|
.TP
|
||||||
|
.B nextmonthyear \fIyyyy\fR
|
||||||
|
The year of the following month. (The same as \fByear\fR unless the
|
||||||
|
current month is December.)
|
||||||
|
.TP
|
||||||
|
.B entries \fR[\fIarray\fR]
|
||||||
|
The \fBentries\fR key consists of an array of calendar entries; each
|
||||||
|
entry is a JSON object that has the same format as described in the
|
||||||
|
\fBCALENDAR ENTRIES\fR section in the \fB\-PP FORMAT\fR section,
|
||||||
|
\fIwith the following difference\fR: In \fB\-PP\fR mode, if a reminder
|
||||||
|
has \fB%"\fR markers, only the text between the markers
|
||||||
|
is included in the \fBbody\fR element. In \fB\-PPP\fR mode, the
|
||||||
|
entire text \fIincluding\fR the \fB%"\fR markers is included and it's up to
|
||||||
|
the back-end to extract the portion between the markers if that
|
||||||
|
is desired.
|
||||||
|
|
||||||
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Rem2PS was written by Dianne Skoll <dianne@skoll.ca>
|
Rem2PS was written by Dianne Skoll <dianne@skoll.ca>
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|||||||
426
man/remind.1
@@ -1,4 +1,4 @@
|
|||||||
.TH REMIND 1 "31 August 2008"
|
.TH REMIND 1 "1 January 2020"
|
||||||
.UC 4
|
.UC 4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
remind \- a sophisticated reminder service
|
remind \- a sophisticated reminder service
|
||||||
@@ -46,7 +46,8 @@ The \fB\-c\fR option causes \fBRemind\fR to produce a calendar that is
|
|||||||
sent to standard output. If you supply a number \fIn\fR, then a
|
sent to standard output. If you supply a number \fIn\fR, then a
|
||||||
calendar will be generated for \fIn\fR months, starting with the
|
calendar will be generated for \fIn\fR months, starting with the
|
||||||
current month. By default, a calendar for only the current month is
|
current month. By default, a calendar for only the current month is
|
||||||
produced.
|
produced.
|
||||||
|
.RS
|
||||||
.PP
|
.PP
|
||||||
You can precede \fIn\fR (if any) with a set of flags. The flags
|
You can precede \fIn\fR (if any) with a set of flags. The flags
|
||||||
are as follows:
|
are as follows:
|
||||||
@@ -72,24 +73,54 @@ only work on terminals that are set to UTF-8 character encoding.
|
|||||||
.TP
|
.TP
|
||||||
.B 'c'
|
.B 'c'
|
||||||
causes \fBRemind\fR to use VT100 escape sequences to approximate
|
causes \fBRemind\fR to use VT100 escape sequences to approximate
|
||||||
SPECIAL COLOR reminders. The approximation is (of necessity) very
|
SPECIAL COLOR reminders. Note that this flag is kept for
|
||||||
|
backwards-compatibility; you should use the \fB\-@\fI[n][,m]\fR
|
||||||
|
command-line option instead.
|
||||||
|
.RE
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-@\fR[\fIn\fR][,\fIm\fR]
|
||||||
|
Tells \fBRemind\fR to approximate SPECIAL COLOR reminders using VT100
|
||||||
|
escape sequences. The approximation is (of necessity) very
|
||||||
coarse, because the VT100 only has eight different color sequences,
|
coarse, because the VT100 only has eight different color sequences,
|
||||||
each with one of two brightnesses. A color component greater than
|
each with one of two brightnesses. A color component greater than
|
||||||
64 is considered "on", and if any of the three color components is
|
64 is considered "on", and if any of the three color components is
|
||||||
greater than 128, the color is considered "bright".
|
greater than 128, the color is considered "bright".
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
If you supply the optional numeric parameters, the have the following
|
||||||
|
meanings: \fIn\fR=0 tells \fBRemind\fR to use the standard 16 VT100
|
||||||
|
colors. \fIn\fR=1 tells it to use an extended 256-color palette supported
|
||||||
|
by many terminal emulators such as xterm. And \fIn\fR=2 tells it to
|
||||||
|
use escape sequences that support true 24-bit colors, again supported
|
||||||
|
by many terminal emulators such as xterm.
|
||||||
|
.PP
|
||||||
|
If the optional \fIm\fR parameter is supplied following a comma,
|
||||||
|
then \fIm\fR=0 tells \fBRemind\fR that the terminal background is dark,
|
||||||
|
and \fBRemind\fR will brighten up dark colors to make them visible. If
|
||||||
|
\fIm\fR=1, then \fBRemind\fR assumes the terminal background is light
|
||||||
|
and it will darken bright colors to make them visible. If no \fIm\fR
|
||||||
|
is supplied, then \fBRemind\fR does not perform any adjustments, and
|
||||||
|
some reminders may be hard or impossible to see if the color is too close
|
||||||
|
to the terminal background color.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B \-w\fR\fIcol\fR[,\fIpad\fR[,\fIspc\fR]]]
|
.B \-w\fR\fIcol\fR[,\fIpad\fR[,\fIspc\fR]]]
|
||||||
The \fB\-w\fR option specifies the output width, padding and spacing
|
The \fB\-w\fR option specifies the output width, padding and spacing
|
||||||
of the formatted calendar output. \fICol\fR specifies the number of
|
of the formatted calendar output. \fICol\fR specifies the number of
|
||||||
columns in the output device, and defaults to 80. \fIPad\fR specifies
|
columns in the output device. If not specified, or specified as 0,
|
||||||
how many lines to use to "pad" empty calendar boxes. This defaults to
|
it defaults to the larger of 71 or the actual width of your terminal,
|
||||||
5. If you have many reminders on certain days that make your calendar
|
or to 80 if standard output is not a terminal.
|
||||||
too large to fit on a page, you can try reducing \fIpad\fR to make the
|
|
||||||
empty boxes smaller. \fISpc\fR specifies how many blank lines to leave
|
|
||||||
between the day number and the first reminder entry. It defaults to 1.
|
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
|
\fIPad\fR specifies how many lines
|
||||||
|
to use to "pad" empty calendar boxes. This defaults to 5. If you
|
||||||
|
have many reminders on certain days that make your calendar too large
|
||||||
|
to fit on a page, you can try reducing \fIpad\fR to make the empty
|
||||||
|
boxes smaller. \fISpc\fR specifies how many blank lines to leave
|
||||||
|
between the day number and the first reminder entry. It defaults to
|
||||||
|
1.
|
||||||
|
.PP
|
||||||
Any of \fIcol\fR, \fIpad\fR or \fIspc\fR can be omitted, providing you
|
Any of \fIcol\fR, \fIpad\fR or \fIspc\fR can be omitted, providing you
|
||||||
provide the correct number of commas. Don't use any spaces in the option.
|
provide the correct number of commas. Don't use any spaces in the option.
|
||||||
.RE
|
.RE
|
||||||
@@ -106,17 +137,27 @@ If you immediately follow the \fBs\fR with the letter
|
|||||||
day they actually occur \fIas well as\fR on any preceding days specified
|
day they actually occur \fIas well as\fR on any preceding days specified
|
||||||
by the reminder's \fIdelta\fR.
|
by the reminder's \fIdelta\fR.
|
||||||
.TP
|
.TP
|
||||||
.B \-p\fR[\fBa\fR]\fIn\fR
|
.B \-p\fR[\fBa\fR][\fBp\fR][\fBp\fR]\fIn\fR
|
||||||
The \fB\-p\fR option is very similar to the \fB\-s\fR option, except
|
The \fB\-p\fR option is very similar to the \fB\-s\fR option, except
|
||||||
that the output contains additional information for use by the
|
that the output contains additional information for use by the
|
||||||
\fBRem2PS\fR program, which creates a PostScript calendar. For this
|
\fBRem2PS\fR program, which creates a PostScript calendar, and various
|
||||||
|
other back-end programs. For this
|
||||||
option, \fIn\fR cannot start with "+"; it must specify a number of months.
|
option, \fIn\fR cannot start with "+"; it must specify a number of months.
|
||||||
The format of the \fB\-p\fR output is described in the \fBrem2ps(1)\fR
|
The format of the \fB\-p\fR output is described in the \fBrem2ps(1)\fR
|
||||||
man page. If you immediately follow the \fBp\fR with the letter
|
man page. If you immediately follow the \fBp\fR with the letter
|
||||||
\fBa\fR, then \fBRemind\fR displays reminders on the calendar on the
|
\fBa\fR, then \fBRemind\fR displays reminders on the calendar on the
|
||||||
day they actually occur \fIas well as\fR on any preceding days specified
|
day they actually occur \fIas well as\fR on any preceding days specified
|
||||||
by the reminder's \fIdelta\fR.
|
by the reminder's \fIdelta\fR. If you follow the \fBp\fR with another
|
||||||
|
\fBp\fR, then \fBRemind\fR uses a more comprehensive JSON-based
|
||||||
|
format rather than the "simple calendar" format. This format is
|
||||||
|
also documented in the \fBrem2ps(1)\fR man page. Finally, if you use
|
||||||
|
three p's, as in \fB\-ppp\fR, then \fBRemind\fR uses a pure JSON
|
||||||
|
format, again documented in \fBrem2ps(1)\fR.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Note that the \fB\-pp\fR or \fB\-ppp\fR options also enable the \fB\-l\fR
|
||||||
|
option.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B \-l
|
.B \-l
|
||||||
If you use the \-l option in conjunction with the \-p option, then
|
If you use the \-l option in conjunction with the \-p option, then
|
||||||
@@ -293,14 +334,15 @@ If you supply a \fIdate\fR on the command line, it must consist of
|
|||||||
of the month, and \fIyear\fR is a year (all 4 digits) from 1990 to
|
of the month, and \fIyear\fR is a year (all 4 digits) from 1990 to
|
||||||
about 2075. You can leave out the \fIday\fR, which then defaults to 1.
|
about 2075. You can leave out the \fIday\fR, which then defaults to 1.
|
||||||
.PP
|
.PP
|
||||||
If you do supply a \fIdate\fR on the command line, then \fBRemind\fR uses
|
If you do supply a \fIdate\fR on the command line, then \fBRemind\fR
|
||||||
it, rather than the actual system date, as its notion of "today."
|
uses it, rather than the actual system date, as its notion of "today."
|
||||||
This lets you create calendars for future months, or test to see
|
This lets you create calendars for future months, or test to see how
|
||||||
how your reminders will be triggered in the future. Similarly,
|
your reminders will be triggered in the future. Similarly, you can
|
||||||
you can supply a \fItime\fR (in 24-hour format -- for example, 17:15) to
|
supply a \fItime\fR to set \fBRemind\fR's notion of "now" to a
|
||||||
set \fBRemind\fR's notion of "now" to a particular time. Supplying
|
particular time. Supplying a \fItime\fR on the command line also
|
||||||
a \fItime\fR on the command line also implicitly enables the \fB\-q\fR
|
implicitly enables the \fB\-q\fR option and disables the \fB\-z\fR
|
||||||
option and disables the \fB\-z\fR option.
|
option. The \fItime\fR may be specified in 24-hour format (eg, 13:20)
|
||||||
|
or common "AM/PM" format (1:20pm).
|
||||||
.PP
|
.PP
|
||||||
If you would rather specify the date more succinctly, you can supply
|
If you would rather specify the date more succinctly, you can supply
|
||||||
it as YYYY-MM-DD or YYYY/MM/DD. You can even supply a date and
|
it as YYYY-MM-DD or YYYY/MM/DD. You can even supply a date and
|
||||||
@@ -448,7 +490,8 @@ of a special reminder depends on the back-end. For the \fBRem2PS\fR
|
|||||||
back-end, \fBSPECIAL PostScript\fR is equivalent to a \fBPS\fR-type
|
back-end, \fBSPECIAL PostScript\fR is equivalent to a \fBPS\fR-type
|
||||||
reminder, and \fBSPECIAL PSFile\fR is equivalent to a \fBPSFILE\fR-type
|
reminder, and \fBSPECIAL PSFile\fR is equivalent to a \fBPSFILE\fR-type
|
||||||
reminder. The body of a \fBSPECIAL\fR reminder is obviously dependent
|
reminder. The body of a \fBSPECIAL\fR reminder is obviously dependent
|
||||||
upon the back-end.
|
upon the back-end. A back-end \fImust\fR ignore a \fBSPECIAL\fR that
|
||||||
|
it does not recognize.
|
||||||
.PP
|
.PP
|
||||||
.B DATE SPECIFICATIONS
|
.B DATE SPECIFICATIONS
|
||||||
.PP
|
.PP
|
||||||
@@ -475,7 +518,7 @@ characters must be used. The following are examples of the various parts of a
|
|||||||
JANUARY, feb, March, ApR, may, Aug
|
JANUARY, feb, March, ApR, may, Aug
|
||||||
.TP
|
.TP
|
||||||
.I year:
|
.I year:
|
||||||
1990, 1993, 2030, 95 (interpreted as 1995). The year can range
|
1990, 1993, 2030. The year can range
|
||||||
from 1990 to 2075.
|
from 1990 to 2075.
|
||||||
.TP
|
.TP
|
||||||
.I weekday:
|
.I weekday:
|
||||||
@@ -925,8 +968,13 @@ it terminates the search after the \fBSATISFY\fR iteration limit
|
|||||||
.PP
|
.PP
|
||||||
Timed reminders are those that have an \fBAT\fR keyword followed
|
Timed reminders are those that have an \fBAT\fR keyword followed
|
||||||
by a \fItime\fR and optional \fItdelta\fR and \fItrepeat\fR. The \fItime\fR
|
by a \fItime\fR and optional \fItdelta\fR and \fItrepeat\fR. The \fItime\fR
|
||||||
must be specified in 24-hour format, with 0:00 representing midnight,
|
mau be specified in 24-hour format, with 0:00 representing midnight,
|
||||||
12:00 representing noon, and 23:59 representing one minute to midnight.
|
12:00 representing noon, and 23:59 representing one minute to midnight.
|
||||||
|
Alternatively, it may be specified in common "AM/PM" format; in this case,
|
||||||
|
the hour must range from 1 to 12. 12:00am represents midnight, 12:00pm
|
||||||
|
represents noon, and 11:59pm represents one minute to midnight. The "am"
|
||||||
|
and "pm" portions are case-insensitive and the "m" is optional.
|
||||||
|
.PP
|
||||||
You can use either a colon or a period to separate the hours from the
|
You can use either a colon or a period to separate the hours from the
|
||||||
minutes. That is, 13:39 and 13.39 are equivalent.
|
minutes. That is, 13:39 and 13.39 are equivalent.
|
||||||
.PP
|
.PP
|
||||||
@@ -953,7 +1001,7 @@ The following reminder will be triggered on Thursdays and Fridays,
|
|||||||
but will only be queued on Fridays:
|
but will only be queued on Fridays:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
REM Fri ++1 AT 13:00 MSG Lunch at 1pm Friday.
|
REM Fri ++1 AT 1:00PM MSG Lunch at 1pm Friday.
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
The \fItdelta\fR and \fItrepeat\fR have the same form as a \fIrepeat\fR
|
The \fItdelta\fR and \fItrepeat\fR have the same form as a \fIrepeat\fR
|
||||||
@@ -1033,17 +1081,23 @@ by the hexadecimal representation of the MD5 sum of the REM
|
|||||||
command line. This lets you give a more-or-less unique identifier
|
command line. This lets you give a more-or-less unique identifier
|
||||||
to each distinct REM command.
|
to each distinct REM command.
|
||||||
.PP
|
.PP
|
||||||
The \fBDURATION\fR keyword makes sense only for timed reminders;
|
The \fBDURATION\fR keyword makes sense only for timed reminders; it
|
||||||
it specifies the duration of an event. Currently, this is not
|
specifies the duration of an event. For example, if you have a
|
||||||
used, but it may be used in future by back-ends or scheduling
|
90-minute meeting starting at 1:00pm, you could use any of the following:
|
||||||
systems built around \fBRemind\fR. For example, if you have
|
|
||||||
a 90-minute meeting starting at 1:00pm, you could use:
|
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
REM 5 March 1999 AT 13:00 DURATION 1:30 MSG Meeting
|
REM 5 March 2021 AT 13:00 DURATION 1:30 MSG Meeting
|
||||||
|
REM 5 March 2021 AT 13:00 DURATION 90 MSG Meeting
|
||||||
|
REM 5 March 2021 AT 1:00pm DURATION 1:30 MSG Meeting
|
||||||
|
REM 5 March 2021 AT 1:00pm DURATION 90 MSG Meeting
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
Note that \fIduration\fR is specified in hours and minutes.
|
|
||||||
|
Note that \fIduration\fR is specified either in hours and minutes as a
|
||||||
|
\fItime\fR, or in minutes as an \fIinteger\fR. If you specify a
|
||||||
|
duration of 00:00 or 0, then \fBRemind\fR behaves exactly as if no
|
||||||
|
\fBDURATION\fR at all had been present.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
.SH THE SUBSTITUTION FILTER
|
.SH THE SUBSTITUTION FILTER
|
||||||
.PP
|
.PP
|
||||||
@@ -1623,13 +1677,15 @@ in C.
|
|||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B TIME constants
|
.B TIME constants
|
||||||
12:33, 0:01, 14:15, 16:42, 12.16, 13.00, 1.11
|
12:33, 0:01, 14:15, 16:42, 12.16, 13.00, 1.11, 4:30PM, 12:20am
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
Note that \fBTIME\fR constants are written in 24-hour format. Either the
|
Note that \fBTIME\fR constants may be written in 24-hour format or in
|
||||||
period or colon can be used to separate the minutes from the hours.
|
common "AM/PM" format. If you use "AM/PM" format, then the hour can
|
||||||
However, Remind will consistently output times using only one separator
|
range from 1 to 12. Either a period or colon can be used to separate
|
||||||
character. (The output separator character is chosen at compile-time.)
|
the minutes from the hours. However, Remind will consistently output
|
||||||
|
times in 24-hour format using only one separator character. (The
|
||||||
|
output separator character is chosen at compile-time.)
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B DATE constants
|
.B DATE constants
|
||||||
@@ -1652,11 +1708,12 @@ versions prior to 03.00.02 did not support the '-' date separator.
|
|||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B DATETIME constants
|
.B DATETIME constants
|
||||||
\fBDATETIME\fR constants are expressed similarly to \fBDATE\fR constants
|
\fBDATETIME\fR constants are expressed similarly to \fBDATE\fR
|
||||||
with the addition of an "@HH:MM" part. For example:
|
constants with the addition of an "@HH:MM" part, optionally followed
|
||||||
|
by "am" or "pm". For example:
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
\'2008-04-05@23:11', '1999/02/03@14:06', '2001-04-07@08:30'
|
\'2008-04-05@23:11', '1999/02/03@14:06', '2001-04-07@08:30', '2020-01-01@3:20pm'
|
||||||
.PP
|
.PP
|
||||||
\fBDATETIME\fR values are printed without the quotes. Notes about date
|
\fBDATETIME\fR values are printed without the quotes. Notes about date
|
||||||
and time separator characters for \fBDATE\fR and \fBTIME\fR constants apply
|
and time separator characters for \fBDATE\fR and \fBTIME\fR constants apply
|
||||||
@@ -1709,7 +1766,12 @@ Has several uses. These are:
|
|||||||
.PP
|
.PP
|
||||||
\fBINT\fR + \fBTIME\fR or \fBTIME\fR + \fBINT\fR - returns a \fBTIME\fR
|
\fBINT\fR + \fBTIME\fR or \fBTIME\fR + \fBINT\fR - returns a \fBTIME\fR
|
||||||
obtained by adding
|
obtained by adding
|
||||||
\fBINT\fR minutes to the original \fBTIME\fR.
|
\fBINT\fR minutes to the original \fBTIME\fR. The result will always
|
||||||
|
range from 00:00 through 23:59.
|
||||||
|
.PP
|
||||||
|
\fBTIME\fR + \fBTIME\fR treats the second \fBTIME\fR parameter as a
|
||||||
|
duration, converting it to an integer number of minutes past midnight,
|
||||||
|
and then performs addition as with \fBTIME\fR + \fBINT\fR.
|
||||||
.PP
|
.PP
|
||||||
\fBINT\fR + \fBDATE\fR or \fBDATE\fR + \fBINT\fR - returns a \fBDATE\fR
|
\fBINT\fR + \fBDATE\fR or \fBDATE\fR + \fBINT\fR - returns a \fBDATE\fR
|
||||||
obtained by adding \fBINT\fR days to the original \fBDATE\fR.
|
obtained by adding \fBINT\fR days to the original \fBDATE\fR.
|
||||||
@@ -1718,6 +1780,11 @@ obtained by adding \fBINT\fR days to the original \fBDATE\fR.
|
|||||||
\fBDATETIME\fR obtained by adding \fBINT\fR minutes to the original
|
\fBDATETIME\fR obtained by adding \fBINT\fR minutes to the original
|
||||||
\fBDATETIME\fR.
|
\fBDATETIME\fR.
|
||||||
.PP
|
.PP
|
||||||
|
\fBDATETIME\fR + \fBTIME\fR or \fBTIME\fR + \fBDATETIME\fR
|
||||||
|
treats the \fBTIME\fR parameter as a
|
||||||
|
duration, converting it to an integer number of minutes past midnight,
|
||||||
|
and then performs addition as with \fBDATETIME\fR + \fBINT\fR.
|
||||||
|
.PP
|
||||||
\fBSTRING\fR + \fBSTRING\fR - returns a \fBSTRING\fR that is the
|
\fBSTRING\fR + \fBSTRING\fR - returns a \fBSTRING\fR that is the
|
||||||
concatenation of the two original
|
concatenation of the two original
|
||||||
\fBSTRING\fRs.
|
\fBSTRING\fRs.
|
||||||
@@ -1751,9 +1818,11 @@ the original \fBDATE\fR.
|
|||||||
earlier
|
earlier
|
||||||
than the original \fBTIME\fR.
|
than the original \fBTIME\fR.
|
||||||
.PP
|
.PP
|
||||||
\fBDATETIME\fR - \fBINT\fR - returns a \fBDATETIME\fR that is \fBINT\fR minutes
|
\fBDATETIME\fR - \fBINT\fR - returns a \fBDATETIME\fR that is
|
||||||
earlier
|
\fBINT\fR minutes earlier than the original \fBDATETIME\fR.
|
||||||
than the original \fBDATETIME\fR.
|
.PP
|
||||||
|
\fBDATETIME\fR - \fBTIME\fR - coerces the \fBTIME\fR to an \fBINT\fR
|
||||||
|
and then performs subtraction as above.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B <, <=, >, and >=
|
.B <, <=, >, and >=
|
||||||
@@ -1883,6 +1952,22 @@ This variable can be set only to "/" or "-". It holds the character
|
|||||||
used to separate portions of a date when \fBRemind\fR prints a DATE or
|
used to separate portions of a date when \fBRemind\fR prints a DATE or
|
||||||
DATETIME value.
|
DATETIME value.
|
||||||
.TP
|
.TP
|
||||||
|
.B $DefaultColor
|
||||||
|
This variable can be set to a string that has the form of three
|
||||||
|
space-separated numbers. Each number must be an integer from 0 to
|
||||||
|
255, or all three numbers must be -1. The default value of
|
||||||
|
\fB$DefaultColor\fR is "-1 -1 -1", which suppresses default coloring
|
||||||
|
of MSG-type reminders. If you set \fB$DefaultColor\fR to any other
|
||||||
|
value, then all MSG-, MSF- and CAL-type reminders are effectively
|
||||||
|
converted into SPECIAL COLOR reminders whose color value is specified
|
||||||
|
by \fB$DefaultColor\fR.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Unlike other system variables, the value of \fB$DefaultColor\fR is
|
||||||
|
\fInot\fR preserved between calendar iterations; rather, it is reset
|
||||||
|
to "-1 -1 -1" at the start of each iteration.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
.B $DefaultPrio
|
.B $DefaultPrio
|
||||||
The default priority assigned to reminders without a \fBPRIORITY\fR
|
The default priority assigned to reminders without a \fBPRIORITY\fR
|
||||||
clause. You can set this as required to adjust the priorities of
|
clause. You can set this as required to adjust the priorities of
|
||||||
@@ -1941,9 +2026,11 @@ for years greater than 2037.
|
|||||||
.TP
|
.TP
|
||||||
.B $FormWidth
|
.B $FormWidth
|
||||||
The maximum width of each line of text for formatting \fBMSF\fR-type
|
The maximum width of each line of text for formatting \fBMSF\fR-type
|
||||||
reminders. The default is 72. If an \fBMSF\fR-type reminder contains
|
reminders. The default is the width of the terminal in columns, minus
|
||||||
a word too long to fit in this width, it will not be truncated - the
|
8, but clamped at a minimum of 20 and a maximum of 500. If standard
|
||||||
width limit will be ignored.
|
output is not a terminal, then the default is 72.If an \fBMSF\fR-type
|
||||||
|
reminder contains a word too long to fit in this width, it will not be
|
||||||
|
truncated - the width limit will be ignored.
|
||||||
.TP
|
.TP
|
||||||
.B $HushMode (read-only)
|
.B $HushMode (read-only)
|
||||||
If non-zero, then the \fB\-h\fR option was supplied on the command line.
|
If non-zero, then the \fB\-h\fR option was supplied on the command line.
|
||||||
@@ -1986,6 +2073,10 @@ start of your reminder scripts.
|
|||||||
The maximum number of iterations for the \fBSATISFY\fR clause
|
The maximum number of iterations for the \fBSATISFY\fR clause
|
||||||
(described later.) Must be at least 10.
|
(described later.) Must be at least 10.
|
||||||
.TP
|
.TP
|
||||||
|
.B $MaxStringLen
|
||||||
|
A limit on the longest string that \fBRemind\fR will allow you
|
||||||
|
to create. The default is 65535.
|
||||||
|
.TP
|
||||||
.B $MinsFromUTC
|
.B $MinsFromUTC
|
||||||
The number of minutes between Universal Time Coordinated and local time. If
|
The number of minutes between Universal Time Coordinated and local time. If
|
||||||
\fB$CalcUTC\fR is non-zero, this is calculated upon startup of \fBRemind\fR.
|
\fB$CalcUTC\fR is non-zero, this is calculated upon startup of \fBRemind\fR.
|
||||||
@@ -2132,6 +2223,23 @@ is supplied, only the date component is used.
|
|||||||
Returns the time of "astronomical twilight" on the specified \fIdate\fR. If
|
Returns the time of "astronomical twilight" on the specified \fIdate\fR. If
|
||||||
\fIdate\fR is omitted, defaults to \fBtoday()\fR.
|
\fIdate\fR is omitted, defaults to \fBtoday()\fR.
|
||||||
.TP
|
.TP
|
||||||
|
.B ampm(tq_time [,s_am [,s_pm]])
|
||||||
|
Returns a \fBSTRING\fR that is the result of converting \fItime\fR
|
||||||
|
(which is either a \fBTIME\R or a \fBDATETIME\fR object) to "AM/PM"
|
||||||
|
format. The optional arguments \fIam\fR and \fIpm\fR are the strings
|
||||||
|
to append in the AM and PM case, respectively; they default to "AM"
|
||||||
|
and "PM". The function obeys the system variables $DateSep,
|
||||||
|
$TimeSep and $DateTimeSep when formatting its output. For example:
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
ampm(0:22) returns "12:22AM"
|
||||||
|
ampm(17:45, "am", "pm") returns "5:45pm"
|
||||||
|
ampm('2020-03-14@21:34') returns "2020-03-14@9:34PM"
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
.B args(s_fname)
|
.B args(s_fname)
|
||||||
Returns the number of arguments expected by the user-defined function
|
Returns the number of arguments expected by the user-defined function
|
||||||
\fIfname\fR, or \-1 if no such user-defined function exists. Note that
|
\fIfname\fR, or \-1 if no such user-defined function exists. Note that
|
||||||
@@ -2791,10 +2899,77 @@ date, returns the integer 0.
|
|||||||
Similar to trigdate(), but returns a \fBDATETIME\fR if the most recent
|
Similar to trigdate(), but returns a \fBDATETIME\fR if the most recent
|
||||||
triggerable \fBREM\fR command had an \fBAT\fR clause. If there was no
|
triggerable \fBREM\fR command had an \fBAT\fR clause. If there was no
|
||||||
\fBAT\fR clause, returns a \fBDATE\fR. If no trigger could be computed,
|
\fBAT\fR clause, returns a \fBDATE\fR. If no trigger could be computed,
|
||||||
returns the integer 0.
|
returns the integer 0. See "MULTI-DAY EVENTS" for more information.
|
||||||
|
.TP
|
||||||
|
.B trigeventstart()
|
||||||
|
Returns a \fBDATETIME\fR representing the start of the most recent
|
||||||
|
triggerable \fBREM\fR command that had an \fBAT\fR clause. For events
|
||||||
|
without a \fBDURATION\fR or that do not span multiple days, returns
|
||||||
|
the same as \fBtrigdatetime()\fR. If the \fBREM\fR command did not
|
||||||
|
have an \fBAT\fR clause, returns the integer -1 (and differs from
|
||||||
|
\fBtrigdatetime()\fR in this respect.) See "MULTI-DAY EVENTS" for more
|
||||||
|
information.
|
||||||
|
.TP
|
||||||
|
.B trigeventduration()
|
||||||
|
Returns a \fBTIME\fR representing the duration of the most recent
|
||||||
|
triggerable \fBREM\fR command that had an \fBAT\fR and a
|
||||||
|
\fBDURATION\fR clause. If the event does not span multiple days,
|
||||||
|
returns the same thing as \fBtrigduration()\fR. If the \fBREM\fR
|
||||||
|
command lacked an \fBAT\fR or \fBDURATION\fR clause, returns -1. See
|
||||||
|
"MULTI-DAY EVENTS" for more information.
|
||||||
|
.TP
|
||||||
|
.B trigback()
|
||||||
|
Returns the "back" amount of the last \fBREM\fR or \fBIFTRIG\fR command.
|
||||||
|
Returns a positive integer N if the "back" is of the form -N, or a negative
|
||||||
|
integer if it is of the form --N. If there is no "back", then returns 0.
|
||||||
|
.TP
|
||||||
|
.B trigdelta()
|
||||||
|
Returns the "delta" amount of the last \fBREM\fR or \fBIFTRIG\fR command.
|
||||||
|
Returns a positive integer N if the "delta" is of the form +N, or a negative
|
||||||
|
integer if it is of the form ++N. If there is no "delta", then returns 0.
|
||||||
|
.TP
|
||||||
|
.B trigtimedelta()
|
||||||
|
Similar to \fBtrigdelta()\fR, but returns the delta used in the
|
||||||
|
\fBAT\fR clause of a timed reminder.
|
||||||
|
.TP
|
||||||
|
.B trigrep()
|
||||||
|
Returns the "repeat" amount of the last \fBREM\fR or \fBIFTRIG\fR
|
||||||
|
command. Returns a positive integer N if the "repeat" is of the form
|
||||||
|
*N. If there is no "repeat", then returns 0.
|
||||||
|
.TP
|
||||||
|
.B trigtimerep()
|
||||||
|
Similar to \fBtrigrep()\fR, but returns the repeat used in the \fBAT\fR clause
|
||||||
|
of a timed reminder.
|
||||||
|
.TP
|
||||||
|
.B trigduration()
|
||||||
|
Returns (as a TIME type) the \fBDURATION\fR parameter of a timed
|
||||||
|
reminder. If there is no \fBDURATION\fR parameter, returns the
|
||||||
|
integer -1. See "MULTI-DAY EVENTS" for more information.
|
||||||
|
.TP
|
||||||
|
.B trigpriority()
|
||||||
|
Returns the \fBPRIORITY\fR of the last \fBREM\fR or \fBIFTRIG\fR command.
|
||||||
|
.TP
|
||||||
|
.B triguntil()
|
||||||
|
Returns (as a \fBDATE\fR type) the \fBUNTIL\fR parameter of the last
|
||||||
|
\fBREM\fR or \fBIFTRIG\fR command. If there was no \fBUNTIL\fR
|
||||||
|
parameter, returns the integer -1. If there is a \fBTHROUGH\fR parameter,
|
||||||
|
that will be returned by \fBtriguntil()\fR since "THROUGH yyyy-mm-dd" is simply
|
||||||
|
syntactic sugar for "*1 UNTIL yyyy-mm-dd".
|
||||||
|
.TP
|
||||||
|
.B trigscanfrom()
|
||||||
|
Returns (as a \fBDATE\fR type) the \fBSCANFROM\fR parameter of the last \fBREM\fR
|
||||||
|
or \fBIFTRIG\fR command. If there was no \fBSCANFROM\fR parameter, returns
|
||||||
|
the integer -1. Note that \fBFROM\fR and \fBSCANFROM\fR interact; a reminder that
|
||||||
|
has a "FROM yyyy-mm-dd" parameter will act as if it has a \fBSCANFROM\fR parameter
|
||||||
|
whose value is the maximum of "yyyy-mm-dd" and today.
|
||||||
|
.TP
|
||||||
|
.B trigfrom()
|
||||||
|
Returns (as a \fBDATE\fR type) the \fBFROM\fR parameter of the last \fBREM\fR or
|
||||||
|
\fBIFTRIG\fR command. If there was no \fBFROM\fR parameter, returns the integer -1.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B trigger(d_date [,t_time [,i_utcflag]]) \fRor\fB trigger(q_datetime [,i_utcflag])
|
.B trigger(d_date [,t_time [,i_utcflag]]) \fRor\fB trigger(q_datetime [,i_utcflag])
|
||||||
Returns a string suitable for use in a \fBREM\fR command or a SCANFROM
|
Returns a string suitable for use in a \fBREM\fR command or a \fBSCANFROM\fR
|
||||||
or UNTIL clause, allowing you to calculate trigger dates in advance.
|
or UNTIL clause, allowing you to calculate trigger dates in advance.
|
||||||
Note that in earlier versions of \fBRemind\fR, \fBtrigger\fR was
|
Note that in earlier versions of \fBRemind\fR, \fBtrigger\fR was
|
||||||
required to convert a date into something the \fBREM\fR command could
|
required to convert a date into something the \fBREM\fR command could
|
||||||
@@ -2827,9 +3002,11 @@ The value for your time zone may differ.
|
|||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B trigtime()
|
.B trigtime()
|
||||||
Returns the time of the last \fBREM\fR command with an \fBAT\fR clause.
|
Returns the time of the last \fBREM\fR command with an \fBAT\fR
|
||||||
If the last \fBREM\fR did not have an \fBAT\fR clause, returns the integer
|
clause. If the last \fBREM\fR did not have an \fBAT\fR clause,
|
||||||
0.
|
returns the integer 0. If a \fBREM\fR command has an \fBAT\fR clause
|
||||||
|
with a \fBDURATION\fR, then you can compute the end time as
|
||||||
|
\fBtrigtime() + trigduration()\fR.
|
||||||
.TP
|
.TP
|
||||||
.B trigvalid()
|
.B trigvalid()
|
||||||
Returns 1 if the value returned by \fBtrigdate()\fR is valid for the most
|
Returns 1 if the value returned by \fBtrigdate()\fR is valid for the most
|
||||||
@@ -2909,6 +3086,98 @@ Returns a number from 0 to 6 representing the day-of-week of the specified
|
|||||||
.TP
|
.TP
|
||||||
.B year(dq_date)
|
.B year(dq_date)
|
||||||
Returns a \fBINT\fR that is the year component of \fIdate\fR.
|
Returns a \fBINT\fR that is the year component of \fIdate\fR.
|
||||||
|
|
||||||
|
.SH MULTI-DAY EVENTS
|
||||||
|
|
||||||
|
If you specify a start time with \fBAT\fR and a duration with
|
||||||
|
\fBDURATION\fR, you can create events that span multiple days.
|
||||||
|
Consider these two REM statements:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
REM 1991-02-13 AT 16:00 DURATION 72:00 MSG 72-hour event
|
||||||
|
REM 1991-02-13 THROUGH 1991-02-16 AT 16:00 MSG Four events
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
The first statement creates a \fIsingle\fR event that starts on
|
||||||
|
13 February 1991 at 16:00 and runs through 16 February 1991 at 16:00
|
||||||
|
.PP
|
||||||
|
The second statements creates \fIfour separate\fR events that start
|
||||||
|
at 16:00 on 13, 14, 15 and 16 February 1991 and have indefinite duration.
|
||||||
|
.PP
|
||||||
|
Remind handles multi-day events specially. These are the rules:
|
||||||
|
.PP
|
||||||
|
On the \fIfirst\fR day of a multi-day event, \fBtrigdatetime()\fR will
|
||||||
|
return the starting date and time of the event, and \fBtrigduration()\fR
|
||||||
|
will return the original DURATION.
|
||||||
|
.PP
|
||||||
|
On each \fIsubsequent\fR day of a multi-day event, \fBtrigdatetime()\fR
|
||||||
|
will return midnight on the day in question, and \fBtrigduration()\fR
|
||||||
|
will return the \fIremaining\fR duration. Consider this example:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
#!/bin/sh
|
||||||
|
remind - 12 feb 1991 '*6' <<'EOF'
|
||||||
|
BANNER %
|
||||||
|
REM 1991-02-13 AT 16:00 DURATION 72:00 SATISFY 1
|
||||||
|
set a trigdatetime()
|
||||||
|
set b trigduration()
|
||||||
|
set c trigeventstart()
|
||||||
|
set d trigeventduration()
|
||||||
|
MSG now=[today()] dt=[a] dur=[b] estart=[c] edur=[d]%
|
||||||
|
EOF
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
The output is:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
now=1991-02-12 dt=1991-02-13@16:00 dur=72:00 estart=1991-02-13@16:00 edur=72:00
|
||||||
|
now=1991-02-13 dt=1991-02-13@16:00 dur=72:00 estart=1991-02-13@16:00 edur=72:00
|
||||||
|
now=1991-02-14 dt=1991-02-14@00:00 dur=64:00 estart=1991-02-13@16:00 edur=72:00
|
||||||
|
now=1991-02-15 dt=1991-02-15@00:00 dur=40:00 estart=1991-02-13@16:00 edur=72:00
|
||||||
|
now=1991-02-16 dt=1991-02-16@00:00 dur=16:00 estart=1991-02-13@16:00 edur=72:00
|
||||||
|
now=1991-02-17 dt=1991-02-13@16:00 dur=72:00 estart=-1 edur=-1
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
As you see, the \fBtrigdatetime()\fR and \fBtrigduration()\fR functions
|
||||||
|
return the start time and duration of the \fIremaining\fR portion of
|
||||||
|
a multi-day event, whereas \fBtrigeventstart\fR and \fBtrigeventduration\fR
|
||||||
|
always return the original start and duration of the multi-day event. Note also
|
||||||
|
that the return value for expired reminders is not reliable; the fact
|
||||||
|
that \fBtrigeventstart\fR and \fBtrigeventduration\fR return -1 in that case
|
||||||
|
is an implementation artifact.
|
||||||
|
.PP
|
||||||
|
.B SELF-OVERLAPPING EVENTS
|
||||||
|
.PP
|
||||||
|
A multi-day event has the possibility of "overlapping itself". When this
|
||||||
|
happens, \fBRemind\fR prefers the \fIlater\fR event (only one copy of
|
||||||
|
an event is ever triggered for a given date.) Consider this example:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
#!/bin/sh
|
||||||
|
remind - '*5' 10 Feb 1991 <<'EOF'
|
||||||
|
|
||||||
|
BANNER %
|
||||||
|
REM MON at 0:00 DURATION 192:0 MSG [today()] [trigeventstart()] [trigduration()]%
|
||||||
|
|
||||||
|
EOF
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
The output is:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
1991-02-10 1991-02-04@00:00 48:00
|
||||||
|
1991-02-11 1991-02-11@00:00 192:00
|
||||||
|
1991-02-12 1991-02-11@00:00 168:00
|
||||||
|
1991-02-13 1991-02-11@00:00 144:00
|
||||||
|
1991-02-14 1991-02-11@00:00 120:00
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
|
Although the event from 1991-02-04 still has 24 hours left on 1991-02-11,
|
||||||
|
the fresh occurrence on 1991-02-11 takes precedences and is the one that
|
||||||
|
is triggered.
|
||||||
|
.PP
|
||||||
|
I do not recommend constructing self-overlapping multi-day events.
|
||||||
|
.PP
|
||||||
.SH EXPRESSION PASTING
|
.SH EXPRESSION PASTING
|
||||||
.PP
|
.PP
|
||||||
An extremely powerful feature of \fBRemind\fR is its macro capability,
|
An extremely powerful feature of \fBRemind\fR is its macro capability,
|
||||||
@@ -2984,7 +3253,7 @@ three commands are equivalent:
|
|||||||
o
|
o
|
||||||
You cannot use expression-pasting to determine the type (\fBMSG\fR,
|
You cannot use expression-pasting to determine the type (\fBMSG\fR,
|
||||||
\fBCAL\fR, etc.) of a \fBREM\fR command. You can paste expressions
|
\fBCAL\fR, etc.) of a \fBREM\fR command. You can paste expressions
|
||||||
before and after the \fBMSG\fR, etc keywords, but cannot do something like
|
before and after the \fBMSG\fR, etc. keywords, but cannot do something like
|
||||||
this:
|
this:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
@@ -3080,8 +3349,10 @@ to true if a corresponding \fBREM\fR command would trigger. Examples:
|
|||||||
.PP
|
.PP
|
||||||
Note that the \fBIFTRIG\fR command computes a trigger date, which can
|
Note that the \fBIFTRIG\fR command computes a trigger date, which can
|
||||||
be retrieved with the \fBtrigdate()\fR function. You can use all of
|
be retrieved with the \fBtrigdate()\fR function. You can use all of
|
||||||
the normal trigger components, such as \fBUNTIL\fR, \fIdelta\fR, etc in the
|
the normal trigger components, such as \fBUNTIL\fR, \fIdelta\fR, etc. in the
|
||||||
\fBIFTRIG\fR command.
|
\fBIFTRIG\fR command. However, you cannot use a type specifier such
|
||||||
|
as \fBCAL\fR, \fBMSG\fR or \fBSATISFY\fR; attempting to do so
|
||||||
|
yields a parse error.
|
||||||
.PP
|
.PP
|
||||||
.SH USER-DEFINED FUNCTIONS
|
.SH USER-DEFINED FUNCTIONS
|
||||||
.PP
|
.PP
|
||||||
@@ -3279,12 +3550,12 @@ ends. Otherwise, \fBRemind\fR computes the next trigger date, and re-tests
|
|||||||
or non-null, or until the iteration limit specified with the \fB\-x\fR
|
or non-null, or until the iteration limit specified with the \fB\-x\fR
|
||||||
command-line option is reached.
|
command-line option is reached.
|
||||||
.PP
|
.PP
|
||||||
If \fIexpr\fR is not satisfied, then \fBtrigvalid()\fR is set to 0.
|
If \fIexpr\fR is not satisfied, then \fBtrigvalid()\fR is set to 0 and
|
||||||
Otherwise, \fBtrigvalid()\fR is set to 1. In any event, no error message
|
the error message "Can't compute trigger" is issued. Otherwise,
|
||||||
is issued.
|
\fBtrigvalid()\fR is set to 1.
|
||||||
.PP
|
.PP
|
||||||
This is really useful only if \fIexpr\fR involves a call to the
|
This is really useful only if \fIexpr\fR involves a call to the
|
||||||
\fBtrigdate()\fR function; otherwise, \fIexpr\fR will not change as
|
\fBtrigdate()\fR or related functions; otherwise, \fIexpr\fR will not change as
|
||||||
\fBRemind\fR iterates.
|
\fBRemind\fR iterates.
|
||||||
.PP
|
.PP
|
||||||
An example of the usefulness of \fBSATISFY\fR: Suppose you wish to
|
An example of the usefulness of \fBSATISFY\fR: Suppose you wish to
|
||||||
@@ -3307,6 +3578,12 @@ more complicated sequence:
|
|||||||
ENDIF
|
ENDIF
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
You can write the REM statement a little more concisely:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
REM 13 SATISFY $Tw == 5
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
Let's see how this works. The \fBSATISFY\fR clause iterates through
|
Let's see how this works. The \fBSATISFY\fR clause iterates through
|
||||||
all the 13ths of successive months, until a trigger date is found whose
|
all the 13ths of successive months, until a trigger date is found whose
|
||||||
day-of-week is Friday (== 5). If a valid date was found, we use the
|
day-of-week is Friday (== 5). If a valid date was found, we use the
|
||||||
@@ -3361,7 +3638,7 @@ follows:
|
|||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
Note that for this case only, the \fIexpr\fR after \fBSATISFY\fR
|
Note that for this case only, the \fIexpr\fR after \fBSATISFY\fR
|
||||||
\fImust\fR be enclosed in braces. It must come after all the other
|
\fImust\fR be enclosed in square brackets. It must come after all the other
|
||||||
components of the trigger, and immediately before the \fBMSG\fR,
|
components of the trigger, and immediately before the \fBMSG\fR,
|
||||||
\fBRUN\fR, etc. keyword. If \fIexpr\fR cannot be satisfied, then
|
\fBRUN\fR, etc. keyword. If \fIexpr\fR cannot be satisfied, then
|
||||||
the reminder is not triggered.
|
the reminder is not triggered.
|
||||||
@@ -3369,16 +3646,14 @@ the reminder is not triggered.
|
|||||||
Thus, the "Friday the 13th" example can be expressed more compactly as:
|
Thus, the "Friday the 13th" example can be expressed more compactly as:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
REM 13 +2 SATISFY [wkdaynum(trigdate()) == 5] \\
|
REM 13 +2 SATISFY [$Tw == 5] MSG Friday the 13th is %b.
|
||||||
MSG Friday the 13th is %b.
|
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
And you can trigger a reminder on Mondays, Wednesdays and Thursdays
|
And you can trigger a reminder on Mondays, Wednesdays and Thursdays
|
||||||
occurring on odd-numbered days of the month with the following:
|
occurring on odd-numbered days of the month with the following:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
REM Mon Wed Thu SATISFY [day(trigdate())%2] \\
|
REM Mon Wed Thu SATISFY [$Td %2 ] MSG Here it is!!!
|
||||||
MSG Here it is!!!
|
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
Note that \fBSATISFY\fR and \fBOMITFUNC\fR can often be used to solve the
|
Note that \fBSATISFY\fR and \fBOMITFUNC\fR can often be used to solve the
|
||||||
@@ -3547,7 +3822,7 @@ iterations. On the next iteration, the commands are skipped, since
|
|||||||
initialized has remained defined. Thus, time-consuming operations that
|
initialized has remained defined. Thus, time-consuming operations that
|
||||||
do not depend on the value of \fBtoday()\fR are done only once.
|
do not depend on the value of \fBtoday()\fR are done only once.
|
||||||
.PP
|
.PP
|
||||||
System variables (those whose names start with '$') are automatically
|
Most system variables (those whose names start with '$') are automatically
|
||||||
preserved between calendar iterations.
|
preserved between calendar iterations.
|
||||||
.PP
|
.PP
|
||||||
Note that for efficiency, \fBRemind\fR caches the reminder script
|
Note that for efficiency, \fBRemind\fR caches the reminder script
|
||||||
@@ -4136,7 +4411,7 @@ They are used only when piping data from a \fBremind \-p\fR line.
|
|||||||
equivalent of MSG in \fBremind's\fR normal mode of operation.)
|
equivalent of MSG in \fBremind's\fR normal mode of operation.)
|
||||||
.PP
|
.PP
|
||||||
The various \fBSPECIAL\fRs recognized are particular for each
|
The various \fBSPECIAL\fRs recognized are particular for each
|
||||||
backend; however, there are three \fBSPECIAL\fRs that all backends
|
backend; however, there are four \fBSPECIAL\fRs that all backends
|
||||||
should attempt to support. They are currently supported by
|
should attempt to support. They are currently supported by
|
||||||
\fBRem2PS\fR, \fBtkremind\fR and \fBrem2html\fR.
|
\fBRem2PS\fR, \fBtkremind\fR and \fBrem2html\fR.
|
||||||
.PP
|
.PP
|
||||||
@@ -4199,9 +4474,12 @@ The rest of the line is the text to put in the calendar.
|
|||||||
.PP
|
.PP
|
||||||
The COLOR special is "doubly special", because in its normal operating
|
The COLOR special is "doubly special", because in its normal operating
|
||||||
mode, \fBremind\fR treats a COLOR special just like a MSG-type reminder.
|
mode, \fBremind\fR treats a COLOR special just like a MSG-type reminder.
|
||||||
Also, if you invoke \fBRemind\fR with \fB\-cc\fR..., then it approximates
|
Also, if you invoke \fBRemind\fR with \fB\-@\fR[\fIn\fR], then it approximates
|
||||||
SPECIAL COLOR reminders on your terminal.
|
SPECIAL COLOR reminders on your terminal.
|
||||||
.PP
|
.PP
|
||||||
|
See also the documentation of the \fB$DefaultColor\fR system variable
|
||||||
|
in the section "SYSTEM VARIABLES".
|
||||||
|
.PP
|
||||||
The \fBWEEK\fR special lets you place annotations such as the week
|
The \fBWEEK\fR special lets you place annotations such as the week
|
||||||
number in the calendar. For example, this would number each Monday
|
number in the calendar. For example, this would number each Monday
|
||||||
with the ISO 8601 week number. The week number is shown like this:
|
with the ISO 8601 week number. The week number is shown like this:
|
||||||
@@ -4354,6 +4632,18 @@ from 7 days before the current date. This ensures that Labour Day for
|
|||||||
the current year will continue to be triggered until 7 days after it has
|
the current year will continue to be triggered until 7 days after it has
|
||||||
occurred. This allows you to safely use the AFTER keyword as shown.
|
occurred. This allows you to safely use the AFTER keyword as shown.
|
||||||
.PP
|
.PP
|
||||||
|
As a special case, you can simply use a negative number after SCANFROM;
|
||||||
|
a negative numbner \-N is interpreted as N days before today. Thus,
|
||||||
|
the previous example could also be written like this:
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
# This form of SCANFROM requires Remind 03.01.17 or later.
|
||||||
|
REM Mon 1 Sept SCANFROM \-7 SATISFY 1
|
||||||
|
OMIT [trigdate()]
|
||||||
|
|
||||||
|
REM Mon AFTER MSG Hello
|
||||||
|
.fi
|
||||||
|
.PP
|
||||||
In general, use \fBSCANFROM\fR as shown for safe movable \fBOMITs\fR. The
|
In general, use \fBSCANFROM\fR as shown for safe movable \fBOMITs\fR. The
|
||||||
amount you should scan back by (7 days in the example above) depends on
|
amount you should scan back by (7 days in the example above) depends on
|
||||||
the number of possible consecutive \fBOMITted\fR days that may occur, and
|
the number of possible consecutive \fBOMITted\fR days that may occur, and
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.TH TKREMIND 1 "15 February 1998"
|
.TH TKREMIND 1 "1 January 2020"
|
||||||
.UC 4
|
.UC 4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
tkremind \- graphical front-end to Remind calendar program
|
tkremind \- graphical front-end to Remind calendar program
|
||||||
@@ -104,7 +104,7 @@ edit the reminder, thereby gaining access to advanced features of
|
|||||||
\fBRemind\fR's idioms for expressing different types of reminders.
|
\fBRemind\fR's idioms for expressing different types of reminders.
|
||||||
|
|
||||||
.SH PRINTING
|
.SH PRINTING
|
||||||
To print the current month's calender, click \fBPrint...\fR on the
|
To print the current month's calendar, click \fBPrint...\fR on the
|
||||||
main calendar window. This brings up the print dialog. Printing
|
main calendar window. This brings up the print dialog. Printing
|
||||||
either produces a PostScript file or sends PostScript to a UNIX command.
|
either produces a PostScript file or sends PostScript to a UNIX command.
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ This line is emitted in response to a \fBSTATUS\fR command. The number
|
|||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
|
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
|
||||||
|
|
||||||
\fBTkRemind\fR is Copyright 1996-2018 by Dianne Skoll.
|
\fBTkRemind\fR is Copyright 1996-2020 by Dianne Skoll.
|
||||||
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
|
|
||||||
|
|||||||
886
scripts/tkremind
@@ -43,8 +43,10 @@ test: remind
|
|||||||
.c.o:
|
.c.o:
|
||||||
@CC@ -c @CPPFLAGS@ @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
|
@CC@ -c @CPPFLAGS@ @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
|
||||||
|
|
||||||
rem2ps: rem2ps.o dynbuf.o
|
$(REMINDOBJS): $(REMINDHDRS)
|
||||||
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o
|
|
||||||
|
rem2ps: rem2ps.o dynbuf.o json.o
|
||||||
|
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o json.o -lm
|
||||||
|
|
||||||
remind: $(REMINDOBJS)
|
remind: $(REMINDOBJS)
|
||||||
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
|
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
|
||||||
@@ -72,23 +74,21 @@ clobber:
|
|||||||
rm -f *.o *~ remind rem2ps test.out core *.bak
|
rm -f *.o *~ remind rem2ps test.out core *.bak
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
gccmakedep @DEFS@ $(REMINDSRCS) rem2ps.c
|
gccmakedep @DEFS@ $(REMINDSRCS) rem2ps.c json.c
|
||||||
|
|
||||||
# The next targets are not very useful to you. I use them to build
|
# The next targets are not very useful to you. I use them to build
|
||||||
# distributions, etc.
|
# distributions, etc.
|
||||||
|
|
||||||
# Build a tar file based on all files checked into git.
|
# Build a tar file based on all files checked into git.
|
||||||
distro:
|
distro:
|
||||||
ln -s . ../remind-$(VERSION)
|
cd .. && git archive --worktree-attributes --format=tar --prefix=remind-$(VERSION)/ HEAD > src/remind-$(VERSION).tar
|
||||||
(cd ..; git ls-files | fgrep -v .gitignore | fgrep -v remind.php) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
|
|
||||||
gzip -f -v -9 remind-$(VERSION).tar
|
gzip -f -v -9 remind-$(VERSION).tar
|
||||||
rm -f ../remind-$(VERSION)
|
gpg --detach-sign -u dianne@skoll.ca remind-$(VERSION).tar.gz
|
||||||
|
|
||||||
beta-tgz:
|
beta-tgz:
|
||||||
ln -s . ../remind-$(VERSION)-BETA-$(BETA)
|
cd .. && git archive --worktree-attributes --format=tar --prefix=remind-$(VERSION)-BETA-$(BETA)/ HEAD > src/remind-$(VERSION)-BETA-$(BETA).tar
|
||||||
(cd ..; git ls-files | fgrep -v .gitignore | fgrep -v remind.php) | sed -e 's/^/remind-$(VERSION)-BETA-$(BETA)\//' | xargs tar -C .. -cvf remind-$(VERSION)-BETA-$(BETA).tar
|
|
||||||
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
|
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
|
||||||
rm -f ../remind-$(VERSION)-BETA-$(BETA)
|
gpg --detach-sign -u dianne@skoll.ca remind-$(VERSION)-BETA-$(BETA).tar.gz
|
||||||
|
|
||||||
#---------------- Stuff after this added by "make depend" -----------------
|
#---------------- Stuff after this added by "make depend" -----------------
|
||||||
|
|
||||||
|
|||||||
735
src/calendar.c
@@ -6,7 +6,7 @@
|
|||||||
/* which you can customize. */
|
/* which you can customize. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -220,6 +220,9 @@
|
|||||||
#define PSBEGIN "# rem2ps begin"
|
#define PSBEGIN "# rem2ps begin"
|
||||||
#define PSEND "# rem2ps end"
|
#define PSEND "# rem2ps end"
|
||||||
|
|
||||||
|
#define PSBEGIN2 "# rem2ps2 begin"
|
||||||
|
#define PSEND2 "# rem2ps2 end"
|
||||||
|
|
||||||
#ifdef BROKEN_PUTC
|
#ifdef BROKEN_PUTC
|
||||||
#define Putc SafePutc
|
#define Putc SafePutc
|
||||||
#define PutChar SafePutChar
|
#define PutChar SafePutChar
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* which you can customize. */
|
/* which you can customize. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -220,6 +220,9 @@
|
|||||||
#define PSBEGIN "# rem2ps begin"
|
#define PSBEGIN "# rem2ps begin"
|
||||||
#define PSEND "# rem2ps end"
|
#define PSEND "# rem2ps end"
|
||||||
|
|
||||||
|
#define PSBEGIN2 "# rem2ps2 begin"
|
||||||
|
#define PSEND2 "# rem2ps2 end"
|
||||||
|
|
||||||
#ifdef BROKEN_PUTC
|
#ifdef BROKEN_PUTC
|
||||||
#define Putc SafePutc
|
#define Putc SafePutc
|
||||||
#define PutChar SafePutChar
|
#define PutChar SafePutChar
|
||||||
|
|||||||
170
src/dorem.c
@@ -7,7 +7,7 @@
|
|||||||
/* commands. */
|
/* commands. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "types.h"
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
|
||||||
@@ -34,6 +34,17 @@ static int ParseScanFrom (ParsePtr s, Trigger *t, int type);
|
|||||||
static int ParsePriority (ParsePtr s, Trigger *t);
|
static int ParsePriority (ParsePtr s, Trigger *t);
|
||||||
static int ParseUntil (ParsePtr s, Trigger *t);
|
static int ParseUntil (ParsePtr s, Trigger *t);
|
||||||
static int ShouldTriggerBasedOnWarn (Trigger *t, int jul, int *err);
|
static int ShouldTriggerBasedOnWarn (Trigger *t, int jul, int *err);
|
||||||
|
static int ComputeTrigDuration(TimeTrig *t);
|
||||||
|
|
||||||
|
static int
|
||||||
|
ComputeTrigDuration(TimeTrig *t)
|
||||||
|
{
|
||||||
|
if (t->ttime == NO_TIME ||
|
||||||
|
t->duration == NO_TIME) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (t->ttime + t->duration - 1) / MINUTES_PER_DAY;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -117,7 +128,7 @@ int DoRem(ParsePtr p)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Calculate the trigger date */
|
/* Calculate the trigger date */
|
||||||
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 1);
|
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||||
if (r) {
|
if (r) {
|
||||||
if (PurgeMode) {
|
if (PurgeMode) {
|
||||||
PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", ErrMsg[r]);
|
PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", ErrMsg[r]);
|
||||||
@@ -200,10 +211,14 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
|||||||
trig->once = NO_ONCE;
|
trig->once = NO_ONCE;
|
||||||
trig->typ = NO_TYPE;
|
trig->typ = NO_TYPE;
|
||||||
trig->scanfrom = NO_DATE;
|
trig->scanfrom = NO_DATE;
|
||||||
|
trig->from = NO_DATE;
|
||||||
trig->priority = DefaultPrio;
|
trig->priority = DefaultPrio;
|
||||||
trig->sched[0] = 0;
|
trig->sched[0] = 0;
|
||||||
trig->warn[0] = 0;
|
trig->warn[0] = 0;
|
||||||
trig->omitfunc[0] = 0;
|
trig->omitfunc[0] = 0;
|
||||||
|
trig->duration_days = 0;
|
||||||
|
trig->eventstart = NO_TIME;
|
||||||
|
trig->eventduration = NO_TIME;
|
||||||
DBufInit(&(trig->tags));
|
DBufInit(&(trig->tags));
|
||||||
trig->passthru[0] = 0;
|
trig->passthru[0] = 0;
|
||||||
tim->ttime = NO_TIME;
|
tim->ttime = NO_TIME;
|
||||||
@@ -245,6 +260,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
|||||||
tim->ttime = (tok.val % MINUTES_PER_DAY);
|
tim->ttime = (tok.val % MINUTES_PER_DAY);
|
||||||
if (save_in_globals) {
|
if (save_in_globals) {
|
||||||
LastTriggerTime = tim->ttime;
|
LastTriggerTime = tim->ttime;
|
||||||
|
SaveLastTimeTrig(tim);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -276,6 +292,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
|||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
r=ParseTimeTrig(s, tim, save_in_globals);
|
r=ParseTimeTrig(s, tim, save_in_globals);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
trig->duration_days = ComputeTrigDuration(tim);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_Scanfrom:
|
case T_Scanfrom:
|
||||||
@@ -372,6 +389,10 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
|||||||
r=ParseToken(s, &buf);
|
r=ParseToken(s, &buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
StrnCpy(trig->omitfunc, DBufValue(&buf), VAR_NAME_LEN);
|
StrnCpy(trig->omitfunc, DBufValue(&buf), VAR_NAME_LEN);
|
||||||
|
|
||||||
|
/* An OMITFUNC counts as a nonconst_expr! */
|
||||||
|
s->expr_happened = 1;
|
||||||
|
s->nonconst_expr = 1;
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -396,7 +417,18 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
|||||||
switch(tok.type) {
|
switch(tok.type) {
|
||||||
case T_Time:
|
case T_Time:
|
||||||
case T_LongTime:
|
case T_LongTime:
|
||||||
tim->duration = tok.val;
|
case T_Year:
|
||||||
|
case T_Day:
|
||||||
|
case T_Number:
|
||||||
|
if (tok.val != 0) {
|
||||||
|
tim->duration = tok.val;
|
||||||
|
} else {
|
||||||
|
tim->duration = NO_TIME;
|
||||||
|
}
|
||||||
|
if (save_in_globals) {
|
||||||
|
SaveLastTimeTrig(tim);
|
||||||
|
}
|
||||||
|
trig->duration_days = ComputeTrigDuration(tim);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return E_BAD_TIME;
|
return E_BAD_TIME;
|
||||||
@@ -468,6 +500,7 @@ static int ParseTimeTrig(ParsePtr s, TimeTrig *tim, int save_in_globals)
|
|||||||
/* Save trigger time in global variable */
|
/* Save trigger time in global variable */
|
||||||
if (save_in_globals) {
|
if (save_in_globals) {
|
||||||
LastTriggerTime = tim->ttime;
|
LastTriggerTime = tim->ttime;
|
||||||
|
SaveLastTimeTrig(tim);
|
||||||
}
|
}
|
||||||
PushToken(DBufValue(&buf), s);
|
PushToken(DBufValue(&buf), s);
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
@@ -666,6 +699,30 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
|||||||
FromJulian(tok.val, &y, &m, &d);
|
FromJulian(tok.val, &y, &m, &d);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_Back:
|
||||||
|
DBufFree(&buf);
|
||||||
|
if (type != SCANFROM_TYPE) {
|
||||||
|
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
|
||||||
|
return E_INCOMPLETE;
|
||||||
|
}
|
||||||
|
if (y != NO_YR) {
|
||||||
|
Eprint("%s: %s", word, ErrMsg[E_YR_TWICE]);
|
||||||
|
return E_YR_TWICE;
|
||||||
|
}
|
||||||
|
if (m != NO_MON) {
|
||||||
|
Eprint("%s: %s", word, ErrMsg[E_MON_TWICE]);
|
||||||
|
return E_MON_TWICE;
|
||||||
|
}
|
||||||
|
if (d != NO_DAY) {
|
||||||
|
Eprint("%s: %s", word, ErrMsg[E_DAY_TWICE]);
|
||||||
|
return E_DAY_TWICE;
|
||||||
|
}
|
||||||
|
if (tok.val < 0) {
|
||||||
|
tok.val = -tok.val;
|
||||||
|
}
|
||||||
|
FromJulian(JulianToday - tok.val, &y, &m, &d);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||||
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
|
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
|
||||||
@@ -678,9 +735,12 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
|||||||
}
|
}
|
||||||
t->scanfrom = Julian(y, m, d);
|
t->scanfrom = Julian(y, m, d);
|
||||||
if (type == FROM_TYPE) {
|
if (type == FROM_TYPE) {
|
||||||
|
t->from = t->scanfrom;
|
||||||
if (t->scanfrom < JulianToday) {
|
if (t->scanfrom < JulianToday) {
|
||||||
t->scanfrom = JulianToday;
|
t->scanfrom = JulianToday;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
t->from = NO_DATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PushToken(DBufValue(&buf), s);
|
PushToken(DBufValue(&buf), s);
|
||||||
@@ -706,20 +766,24 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
char const *s;
|
char const *s;
|
||||||
Value v;
|
Value v;
|
||||||
|
|
||||||
|
int red = -1, green = -1, blue = -1;
|
||||||
|
int is_color = 0;
|
||||||
|
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
DBufInit(&calRow);
|
DBufInit(&calRow);
|
||||||
DBufInit(&pre_buf);
|
DBufInit(&pre_buf);
|
||||||
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
|
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
|
||||||
if ((t->typ == PASSTHRU_TYPE && strcmp(t->passthru, "COLOR") && strcmp(t->passthru, "COLOUR")) ||
|
if ((t->typ == PASSTHRU_TYPE && StrCmpi(t->passthru, "COLOR") && StrCmpi(t->passthru, "COLOUR")) ||
|
||||||
t->typ == CAL_TYPE ||
|
t->typ == CAL_TYPE ||
|
||||||
t->typ == PS_TYPE ||
|
t->typ == PS_TYPE ||
|
||||||
t->typ == PSF_TYPE)
|
t->typ == PSF_TYPE)
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
/* Handle COLOR types */
|
/* Handle COLOR types */
|
||||||
if (t->typ == PASSTHRU_TYPE && (!strcmp(t->passthru, "COLOR") || !strcmp(t->passthru, "COLOUR"))) {
|
if (t->typ == PASSTHRU_TYPE && (!StrCmpi(t->passthru, "COLOR") || !StrCmpi(t->passthru, "COLOUR"))) {
|
||||||
/* Strip off three tokens */
|
/* Strip off three tokens */
|
||||||
r = ParseToken(p, &buf);
|
r = ParseToken(p, &buf);
|
||||||
|
sscanf(DBufValue(&buf), "%d", &red);
|
||||||
if (!NextMode) {
|
if (!NextMode) {
|
||||||
DBufPuts(&pre_buf, DBufValue(&buf));
|
DBufPuts(&pre_buf, DBufValue(&buf));
|
||||||
DBufPutc(&pre_buf, ' ');
|
DBufPutc(&pre_buf, ' ');
|
||||||
@@ -727,6 +791,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
r = ParseToken(p, &buf);
|
r = ParseToken(p, &buf);
|
||||||
|
sscanf(DBufValue(&buf), "%d", &green);
|
||||||
if (!NextMode) {
|
if (!NextMode) {
|
||||||
DBufPuts(&pre_buf, DBufValue(&buf));
|
DBufPuts(&pre_buf, DBufValue(&buf));
|
||||||
DBufPutc(&pre_buf, ' ');
|
DBufPutc(&pre_buf, ' ');
|
||||||
@@ -734,6 +799,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
r = ParseToken(p, &buf);
|
r = ParseToken(p, &buf);
|
||||||
|
sscanf(DBufValue(&buf), "%d", &blue);
|
||||||
if (!NextMode) {
|
if (!NextMode) {
|
||||||
DBufPuts(&pre_buf, DBufValue(&buf));
|
DBufPuts(&pre_buf, DBufValue(&buf));
|
||||||
DBufPutc(&pre_buf, ' ');
|
DBufPutc(&pre_buf, ' ');
|
||||||
@@ -817,6 +883,23 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Correct colors */
|
||||||
|
if (UseVTColors) {
|
||||||
|
if (red == -1 && green == -1 && blue == -1) {
|
||||||
|
if (DefaultColorR != -1 && DefaultColorG != -1 && DefaultColorB != -1) {
|
||||||
|
red = DefaultColorR;
|
||||||
|
green = DefaultColorG;
|
||||||
|
blue = DefaultColorB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (red >= 0 && green >= 0 && blue >= 0) {
|
||||||
|
is_color = 1;
|
||||||
|
if (red > 255) red = 255;
|
||||||
|
if (green > 255) green = 255;
|
||||||
|
if (blue > 255) blue = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Put the substituted string into the substitution buffer */
|
/* Put the substituted string into the substitution buffer */
|
||||||
|
|
||||||
/* Don't use msgprefix() on RUN-type reminders */
|
/* Don't use msgprefix() on RUN-type reminders */
|
||||||
@@ -827,6 +910,9 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
r = EvalExpr(&s, &v, NULL);
|
r = EvalExpr(&s, &v, NULL);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if (!DoCoerce(STR_TYPE, &v)) {
|
if (!DoCoerce(STR_TYPE, &v)) {
|
||||||
|
if (is_color) {
|
||||||
|
DBufPuts(&buf, Colorize(red, green, blue));
|
||||||
|
}
|
||||||
if (DBufPuts(&buf, v.v.str) != OK) {
|
if (DBufPuts(&buf, v.v.str) != OK) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
DestroyValue(v);
|
DestroyValue(v);
|
||||||
@@ -838,6 +924,9 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_color) {
|
||||||
|
DBufPuts(&buf, Colorize(red, green, blue));
|
||||||
|
}
|
||||||
if ( (r=DoSubst(p, &buf, t, tim, jul, NORMAL_MODE)) ) return r;
|
if ( (r=DoSubst(p, &buf, t, tim, jul, NORMAL_MODE)) ) return r;
|
||||||
if (t->typ != RUN_TYPE) {
|
if (t->typ != RUN_TYPE) {
|
||||||
if (UserFuncExists("msgsuffix") == 1) {
|
if (UserFuncExists("msgsuffix") == 1) {
|
||||||
@@ -846,6 +935,9 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
r = EvalExpr(&s, &v, NULL);
|
r = EvalExpr(&s, &v, NULL);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
if (!DoCoerce(STR_TYPE, &v)) {
|
if (!DoCoerce(STR_TYPE, &v)) {
|
||||||
|
if (is_color) {
|
||||||
|
DBufPuts(&buf, Colorize(red, green, blue));
|
||||||
|
}
|
||||||
if (DBufPuts(&buf, v.v.str) != OK) {
|
if (DBufPuts(&buf, v.v.str) != OK) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
DestroyValue(v);
|
DestroyValue(v);
|
||||||
@@ -857,6 +949,10 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_color) {
|
||||||
|
DBufPuts(&buf, Decolorize(red, green, blue));
|
||||||
|
}
|
||||||
|
|
||||||
if ((!MsgCommand && t->typ == MSG_TYPE) || t->typ == MSF_TYPE) {
|
if ((!MsgCommand && t->typ == MSG_TYPE) || t->typ == MSF_TYPE) {
|
||||||
if (DBufPutc(&buf, '\n') != OK) {
|
if (DBufPutc(&buf, '\n') != OK) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
@@ -891,7 +987,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_TYPE:
|
case RUN_TYPE:
|
||||||
system(DBufValue(&buf));
|
System(DBufValue(&buf));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* Unknown/illegal type? */
|
default: /* Unknown/illegal type? */
|
||||||
@@ -995,21 +1091,35 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
|
|||||||
/* Do the "satisfying..." remind calculation. */
|
/* Do the "satisfying..." remind calculation. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
int DoSatRemind(Trigger *trig, TimeTrig *tt, ParsePtr p)
|
||||||
{
|
{
|
||||||
int iter, jul, r;
|
int iter, jul, r, start;
|
||||||
Value v;
|
Value v;
|
||||||
char const *s;
|
char const *s;
|
||||||
char const *t;
|
char const *t;
|
||||||
|
|
||||||
t = p->pos;
|
t = p->pos;
|
||||||
iter = 0;
|
iter = 0;
|
||||||
jul = trig->scanfrom;
|
start = trig->scanfrom;
|
||||||
while (iter++ < MaxSatIter) {
|
while (iter++ < MaxSatIter) {
|
||||||
jul = ComputeTrigger(jul, trig, &r, 1);
|
jul = ComputeTriggerNoAdjustDuration(start, trig, tt, &r, 1, 0);
|
||||||
if (r) {
|
if (r) {
|
||||||
if (r == E_CANT_TRIG) return OK; else return r;
|
if (r == E_CANT_TRIG) return OK; else return r;
|
||||||
}
|
}
|
||||||
|
if (jul != start && trig->duration_days) {
|
||||||
|
jul = ComputeTriggerNoAdjustDuration(start, trig, tt, &r, 1, trig->duration_days);
|
||||||
|
if (r) {
|
||||||
|
if (r == E_CANT_TRIG) return OK; else return r;
|
||||||
|
}
|
||||||
|
} else if (jul == start) {
|
||||||
|
if (tt->ttime != NO_TIME) {
|
||||||
|
trig->eventstart = MINUTES_PER_DAY * r + tt->ttime;
|
||||||
|
if (tt->duration != NO_TIME) {
|
||||||
|
trig->eventduration = tt->duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SaveAllTriggerInfo(trig, tt, jul, tt->ttime, 1);
|
||||||
|
}
|
||||||
if (jul == -1) {
|
if (jul == -1) {
|
||||||
return E_EXPIRED;
|
return E_EXPIRED;
|
||||||
}
|
}
|
||||||
@@ -1018,14 +1128,42 @@ int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
|||||||
t = p->pos;
|
t = p->pos;
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
if (v.type != INT_TYPE && v.type != STR_TYPE) return E_BAD_TYPE;
|
if (v.type != INT_TYPE && v.type != STR_TYPE) return E_BAD_TYPE;
|
||||||
if (v.type == INT_TYPE && v.v.val) return OK;
|
if ((v.type == INT_TYPE && v.v.val) ||
|
||||||
if (v.type == STR_TYPE && *v.v.str) return OK;
|
(v.type == STR_TYPE && *v.v.str)) {
|
||||||
|
AdjustTriggerForDuration(trig->scanfrom, jul, trig, tt, 1);
|
||||||
|
if (DebugFlag & DB_PRTTRIG) {
|
||||||
|
int y, m, d;
|
||||||
|
FromJulian(LastTriggerDate, &y, &m, &d);
|
||||||
|
fprintf(ErrFp, "%s(%d): Trig(satisfied) = %s, %d %s, %d",
|
||||||
|
FileName, LineNo,
|
||||||
|
DayName[LastTriggerDate % 7],
|
||||||
|
d,
|
||||||
|
MonthName[m],
|
||||||
|
y);
|
||||||
|
if (tt->ttime != NO_TIME) {
|
||||||
|
fprintf(ErrFp, " AT %02d:%02d",
|
||||||
|
(tt->ttime / 60),
|
||||||
|
(tt->ttime % 60));
|
||||||
|
if (tt->duration != NO_TIME) {
|
||||||
|
fprintf(ErrFp, " DURATION %02d:%02d",
|
||||||
|
(tt->duration / 60),
|
||||||
|
(tt->duration % 60));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(ErrFp, "\n");
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
p->pos = s;
|
p->pos = s;
|
||||||
jul++;
|
if (jul+trig->duration_days < start) {
|
||||||
|
start++;
|
||||||
|
} else {
|
||||||
|
start = jul+trig->duration_days+1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p->pos = t;
|
p->pos = t;
|
||||||
LastTrigValid = 0;
|
LastTrigValid = 0;
|
||||||
return OK;
|
return E_CANT_TRIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@@ -1119,7 +1257,7 @@ int DoMsgCommand(char const *cmd, char const *msg)
|
|||||||
}
|
}
|
||||||
r = OK;
|
r = OK;
|
||||||
|
|
||||||
system(DBufValue(&execBuffer));
|
System(DBufValue(&execBuffer));
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* reminders are triggered. */
|
/* reminders are triggered. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "types.h"
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#define UPPER(c) (islower(c) ? toupper(c) : (c))
|
#define UPPER(c) (islower(c) ? toupper(c) : (c))
|
||||||
@@ -644,10 +644,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '_':
|
case '_':
|
||||||
if (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)
|
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)) {
|
||||||
sprintf(s, "%s", NL);
|
sprintf(s, "%s", NL);
|
||||||
else
|
} else {
|
||||||
sprintf(s, " ");
|
sprintf(s, " ");
|
||||||
|
}
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -656,8 +657,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '"':
|
case '"':
|
||||||
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
|
if (PsCal != PSCAL_LEVEL3) {
|
||||||
has_quote = 1;
|
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
|
||||||
|
has_quote = 1;
|
||||||
|
} else {
|
||||||
|
if (DBufPutc(dbuf, '%') != OK) return E_NO_MEM;
|
||||||
|
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* buffers. */
|
/* buffers. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -150,7 +150,9 @@ int DBufGets(DynamicBuffer *dbuf, FILE *fp)
|
|||||||
we can usually save some unnecessary copying */
|
we can usually save some unnecessary copying */
|
||||||
|
|
||||||
*(dbuf->buffer) = 0;
|
*(dbuf->buffer) = 0;
|
||||||
fgets(dbuf->buffer, dbuf->allocatedLen, fp);
|
if (fgets(dbuf->buffer, dbuf->allocatedLen, fp) == NULL) {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
if (!*(dbuf->buffer)) return OK;
|
if (!*(dbuf->buffer)) return OK;
|
||||||
dbuf->len = strlen(dbuf->buffer);
|
dbuf->len = strlen(dbuf->buffer);
|
||||||
l = dbuf->len - 1;
|
l = dbuf->len - 1;
|
||||||
@@ -162,7 +164,7 @@ int DBufGets(DynamicBuffer *dbuf, FILE *fp)
|
|||||||
|
|
||||||
while(busy) {
|
while(busy) {
|
||||||
*tmp = 0;
|
*tmp = 0;
|
||||||
fgets(tmp, 256, fp);
|
if (fgets(tmp, 256, fp) == NULL) return OK;
|
||||||
if (!*tmp) return OK;
|
if (!*tmp) return OK;
|
||||||
l = strlen(tmp) - 1;
|
l = strlen(tmp) - 1;
|
||||||
if (tmp[l] == '\n') {
|
if (tmp[l] == '\n') {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Declaration of functions for manipulating dynamic buffers */
|
/* Declaration of functions for manipulating dynamic buffers */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Error definitions. */
|
/* Error definitions. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -119,6 +119,7 @@
|
|||||||
#define E_NO_MATCHING_REMS 100
|
#define E_NO_MATCHING_REMS 100
|
||||||
#define E_STRING_TOO_LONG 101
|
#define E_STRING_TOO_LONG 101
|
||||||
#define E_TIME_TWICE 102
|
#define E_TIME_TWICE 102
|
||||||
|
#define E_DURATION_NO_AT 103
|
||||||
#ifdef MK_GLOBALS
|
#ifdef MK_GLOBALS
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#define EXTERN
|
#define EXTERN
|
||||||
@@ -234,7 +235,8 @@ EXTERN char *ErrMsg[]
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
}
|
}
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
;
|
;
|
||||||
|
|||||||
137
src/expr.c
@@ -5,7 +5,7 @@
|
|||||||
/* This file contains routines to parse and evaluate */
|
/* This file contains routines to parse and evaluate */
|
||||||
/* expressions. */
|
/* expressions. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1992-2018 by Dianne Skoll */
|
/* Copyright 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -30,7 +30,6 @@
|
|||||||
#define LE 4
|
#define LE 4
|
||||||
#define NE 5
|
#define NE 5
|
||||||
|
|
||||||
static char CoerceBuf[512];
|
|
||||||
extern int NumFuncs;
|
extern int NumFuncs;
|
||||||
|
|
||||||
static int Multiply(void), Divide(void), Mod(void), Add(void),
|
static int Multiply(void), Divide(void), Mod(void), Add(void),
|
||||||
@@ -493,6 +492,7 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int h, m, r;
|
int h, m, r;
|
||||||
|
int ampm = 0;
|
||||||
|
|
||||||
if (*s == '\"') { /* It's a literal string "*/
|
if (*s == '\"') { /* It's a literal string "*/
|
||||||
len = strlen(s)-1;
|
len = strlen(s)-1;
|
||||||
@@ -533,7 +533,27 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
|
|||||||
m += *s - '0';
|
m += *s - '0';
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
/* Check for p[m] or a[m] */
|
||||||
|
if (*s == 'A' || *s == 'a' || *s == 'P' || *s == 'p') {
|
||||||
|
ampm = tolower(*s);
|
||||||
|
s++;
|
||||||
|
if (*s == 'm' || *s == 'M') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (*s || h>23 || m>59) return E_BAD_TIME;
|
if (*s || h>23 || m>59) return E_BAD_TIME;
|
||||||
|
if (ampm) {
|
||||||
|
if (h < 1 || h > 12) return E_BAD_TIME;
|
||||||
|
if (ampm == 'a') {
|
||||||
|
if (h == 12) {
|
||||||
|
h = 0;
|
||||||
|
}
|
||||||
|
} else if (ampm == 'p') {
|
||||||
|
if (h < 12) {
|
||||||
|
h += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
v->type = TIME_TYPE;
|
v->type = TIME_TYPE;
|
||||||
v->v.val = h*60 + m;
|
v->v.val = h*60 + m;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -578,6 +598,8 @@ int DoCoerce(char type, Value *v)
|
|||||||
int h, d, m, y, i, k;
|
int h, d, m, y, i, k;
|
||||||
char const *s;
|
char const *s;
|
||||||
|
|
||||||
|
char coerce_buf[128];
|
||||||
|
|
||||||
/* Do nothing if value is already the right type */
|
/* Do nothing if value is already the right type */
|
||||||
if (type == v->type) return OK;
|
if (type == v->type) return OK;
|
||||||
|
|
||||||
@@ -605,12 +627,12 @@ int DoCoerce(char type, Value *v)
|
|||||||
}
|
}
|
||||||
case STR_TYPE:
|
case STR_TYPE:
|
||||||
switch(v->type) {
|
switch(v->type) {
|
||||||
case INT_TYPE: sprintf(CoerceBuf, "%d", v->v.val); break;
|
case INT_TYPE: sprintf(coerce_buf, "%d", v->v.val); break;
|
||||||
case TIME_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
|
case TIME_TYPE: sprintf(coerce_buf, "%02d%c%02d", v->v.val / 60,
|
||||||
TimeSep, v->v.val % 60);
|
TimeSep, v->v.val % 60);
|
||||||
break;
|
break;
|
||||||
case DATE_TYPE: FromJulian(v->v.val, &y, &m, &d);
|
case DATE_TYPE: FromJulian(v->v.val, &y, &m, &d);
|
||||||
sprintf(CoerceBuf, "%04d%c%02d%c%02d",
|
sprintf(coerce_buf, "%04d%c%02d%c%02d",
|
||||||
y, DateSep, m+1, DateSep, d);
|
y, DateSep, m+1, DateSep, d);
|
||||||
break;
|
break;
|
||||||
case DATETIME_TYPE:
|
case DATETIME_TYPE:
|
||||||
@@ -619,13 +641,13 @@ int DoCoerce(char type, Value *v)
|
|||||||
k = v->v.val % MINUTES_PER_DAY;
|
k = v->v.val % MINUTES_PER_DAY;
|
||||||
h = k / 60;
|
h = k / 60;
|
||||||
i = k % 60;
|
i = k % 60;
|
||||||
sprintf(CoerceBuf, "%04d%c%02d%c%02d%c%02d%c%02d",
|
sprintf(coerce_buf, "%04d%c%02d%c%02d%c%02d%c%02d",
|
||||||
y, DateSep, m+1, DateSep, d, DateTimeSep, h, TimeSep, i);
|
y, DateSep, m+1, DateSep, d, DateTimeSep, h, TimeSep, i);
|
||||||
break;
|
break;
|
||||||
default: return E_CANT_COERCE;
|
default: return E_CANT_COERCE;
|
||||||
}
|
}
|
||||||
v->type = STR_TYPE;
|
v->type = STR_TYPE;
|
||||||
v->v.str = StrDup(CoerceBuf);
|
v->v.str = StrDup(coerce_buf);
|
||||||
if (!v->v.str) {
|
if (!v->v.str) {
|
||||||
v->type = ERR_TYPE;
|
v->type = ERR_TYPE;
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
@@ -700,26 +722,12 @@ int DoCoerce(char type, Value *v)
|
|||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
case STR_TYPE:
|
case STR_TYPE:
|
||||||
h = 0;
|
|
||||||
m = 0;
|
|
||||||
s = v->v.str;
|
s = v->v.str;
|
||||||
if (!isdigit(*s)) return E_CANT_COERCE;
|
if (ParseLiteralTime(&s, &i)) return E_CANT_COERCE;
|
||||||
while (isdigit(*s)) {
|
if (*s) return E_CANT_COERCE;
|
||||||
h *= 10;
|
|
||||||
h += *s++ - '0';
|
|
||||||
}
|
|
||||||
if (*s != ':' && *s != '.' && *s != TimeSep)
|
|
||||||
return E_CANT_COERCE;
|
|
||||||
s++;
|
|
||||||
if (!isdigit(*s)) return E_CANT_COERCE;
|
|
||||||
while (isdigit(*s)) {
|
|
||||||
m *= 10;
|
|
||||||
m += *s++ - '0';
|
|
||||||
}
|
|
||||||
if (*s || h>23 || m>59) return E_CANT_COERCE;
|
|
||||||
v->type = TIME_TYPE;
|
v->type = TIME_TYPE;
|
||||||
free(v->v.str);
|
free(v->v.str);
|
||||||
v->v.val = h*60+m;
|
v->v.val = i;
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
default: return E_CANT_COERCE;
|
default: return E_CANT_COERCE;
|
||||||
@@ -765,9 +773,9 @@ static int Add(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a datetime plus an int, add 'em */
|
/* If it's a datetime plus an int or a time, add 'em */
|
||||||
if ((v1.type == DATETIME_TYPE && v2.type == INT_TYPE) ||
|
if ((v1.type == DATETIME_TYPE && (v2.type == INT_TYPE || v2.type == TIME_TYPE)) ||
|
||||||
(v1.type == INT_TYPE && v2.type == DATETIME_TYPE)) {
|
((v1.type == INT_TYPE || v1.type == TIME_TYPE) && v2.type == DATETIME_TYPE)) {
|
||||||
v1.v.val += v2.v.val;
|
v1.v.val += v2.v.val;
|
||||||
if (v1.v.val < 0) return E_DATE_OVER;
|
if (v1.v.val < 0) return E_DATE_OVER;
|
||||||
v1.type = DATETIME_TYPE;
|
v1.type = DATETIME_TYPE;
|
||||||
@@ -775,9 +783,11 @@ static int Add(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a time plus an int, add 'em mod MINUTES_PER_DAY */
|
/* If it's a time plus an int or a time plus a time,
|
||||||
|
add 'em mod MINUTES_PER_DAY */
|
||||||
if ((v1.type == TIME_TYPE && v2.type == INT_TYPE) ||
|
if ((v1.type == TIME_TYPE && v2.type == INT_TYPE) ||
|
||||||
(v1.type == INT_TYPE && v2.type == TIME_TYPE)) {
|
(v1.type == INT_TYPE && v2.type == TIME_TYPE) ||
|
||||||
|
(v1.type == TIME_TYPE && v2.type == TIME_TYPE)) {
|
||||||
v1.v.val = (v1.v.val + v2.v.val) % MINUTES_PER_DAY;
|
v1.v.val = (v1.v.val + v2.v.val) % MINUTES_PER_DAY;
|
||||||
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
|
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
|
||||||
v1.type = TIME_TYPE;
|
v1.type = TIME_TYPE;
|
||||||
@@ -798,7 +808,7 @@ static int Add(void)
|
|||||||
v3.type = STR_TYPE;
|
v3.type = STR_TYPE;
|
||||||
l1 = strlen(v1.v.str);
|
l1 = strlen(v1.v.str);
|
||||||
l2 = strlen(v2.v.str);
|
l2 = strlen(v2.v.str);
|
||||||
if (MaxStringLen && (l1 + l2 > MaxStringLen)) {
|
if (MaxStringLen && (l1 + l2 > (size_t) MaxStringLen)) {
|
||||||
DestroyValue(v1); DestroyValue(v2);
|
DestroyValue(v1); DestroyValue(v2);
|
||||||
return E_STRING_TOO_LONG;
|
return E_STRING_TOO_LONG;
|
||||||
}
|
}
|
||||||
@@ -808,7 +818,7 @@ static int Add(void)
|
|||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
}
|
}
|
||||||
strcpy(v3.v.str, v1.v.str);
|
strcpy(v3.v.str, v1.v.str);
|
||||||
strcat(v3.v.str, v2.v.str);
|
strcpy(v3.v.str+l1, v2.v.str);
|
||||||
DestroyValue(v1); DestroyValue(v2);
|
DestroyValue(v1); DestroyValue(v2);
|
||||||
PushValStack(v3);
|
PushValStack(v3);
|
||||||
return OK;
|
return OK;
|
||||||
@@ -851,8 +861,9 @@ static int Subtract(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a datetime minus an int, do subtraction, checking for underflow */
|
/* If it's a datetime minus an int or a time, do subtraction,
|
||||||
if (v1.type == DATETIME_TYPE && v2.type == INT_TYPE) {
|
* checking for underflow */
|
||||||
|
if (v1.type == DATETIME_TYPE && (v2.type == INT_TYPE || v2.type == TIME_TYPE)) {
|
||||||
v1.v.val -= v2.v.val;
|
v1.v.val -= v2.v.val;
|
||||||
if (v1.v.val < 0) return E_DATE_OVER;
|
if (v1.v.val < 0) return E_DATE_OVER;
|
||||||
PushValStack(v1);
|
PushValStack(v1);
|
||||||
@@ -1218,6 +1229,48 @@ int CopyValue(Value *dest, const Value *src)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ParseLiteralTime(char const **s, int *tim)
|
||||||
|
{
|
||||||
|
int h=0;
|
||||||
|
int m=0;
|
||||||
|
int ampm=0;
|
||||||
|
if (!isdigit(**s)) return E_BAD_TIME;
|
||||||
|
while(isdigit(**s)) {
|
||||||
|
h *= 10;
|
||||||
|
h += *(*s)++ - '0';
|
||||||
|
}
|
||||||
|
if (**s != ':' && **s != '.' && **s != TimeSep) return E_BAD_TIME;
|
||||||
|
(*s)++;
|
||||||
|
if (!isdigit(**s)) return E_BAD_TIME;
|
||||||
|
while(isdigit(**s)) {
|
||||||
|
m *= 10;
|
||||||
|
m += *(*s)++ - '0';
|
||||||
|
}
|
||||||
|
/* Check for p[m] or a[m] */
|
||||||
|
if (**s == 'A' || **s == 'a' || **s == 'P' || **s == 'p') {
|
||||||
|
ampm = tolower(**s);
|
||||||
|
(*s)++;
|
||||||
|
if (**s == 'm' || **s == 'M') {
|
||||||
|
(*s)++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (h>23 || m>59) return E_BAD_TIME;
|
||||||
|
if (ampm) {
|
||||||
|
if (h < 1 || h > 12) return E_BAD_TIME;
|
||||||
|
if (ampm == 'a') {
|
||||||
|
if (h == 12) {
|
||||||
|
h = 0;
|
||||||
|
}
|
||||||
|
} else if (ampm == 'p') {
|
||||||
|
if (h < 12) {
|
||||||
|
h += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*tim = h * 60 + m;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ParseLiteralDate */
|
/* ParseLiteralDate */
|
||||||
@@ -1229,10 +1282,9 @@ int CopyValue(Value *dest, const Value *src)
|
|||||||
int ParseLiteralDate(char const **s, int *jul, int *tim)
|
int ParseLiteralDate(char const **s, int *jul, int *tim)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
int hour, min;
|
int r;
|
||||||
|
|
||||||
y=0; m=0; d=0;
|
y=0; m=0; d=0;
|
||||||
hour=0; min=0;
|
|
||||||
|
|
||||||
*tim = NO_TIME;
|
*tim = NO_TIME;
|
||||||
if (!isdigit(**s)) return E_BAD_DATE;
|
if (!isdigit(**s)) return E_BAD_DATE;
|
||||||
@@ -1262,20 +1314,9 @@ int ParseLiteralDate(char const **s, int *jul, int *tim)
|
|||||||
/* Do we have a time part as well? */
|
/* Do we have a time part as well? */
|
||||||
if (**s == ' ' || **s == '@' || **s == 'T' || **s == 't') {
|
if (**s == ' ' || **s == '@' || **s == 'T' || **s == 't') {
|
||||||
(*s)++;
|
(*s)++;
|
||||||
while(isdigit(**s)) {
|
r = ParseLiteralTime(s, tim);
|
||||||
hour *= 10;
|
if (r != OK) return r;
|
||||||
hour += *(*s)++ - '0';
|
|
||||||
}
|
|
||||||
if (**s != ':' && **s != '.' && **s != TimeSep) return E_BAD_TIME;
|
|
||||||
(*s)++;
|
|
||||||
while(isdigit(**s)) {
|
|
||||||
min *= 10;
|
|
||||||
min += *(*s)++ - '0';
|
|
||||||
}
|
|
||||||
if (hour > 23 || min > 59) return E_BAD_TIME;
|
|
||||||
*tim = hour * 60 + min;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Contains a few definitions used by expression evaluator. */
|
/* Contains a few definitions used by expression evaluator. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
/* files. */
|
/* files. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
430
src/funcs.c
@@ -6,7 +6,7 @@
|
|||||||
/* expressions. */
|
/* expressions. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -53,94 +53,108 @@
|
|||||||
#define RetVal (info->retval)
|
#define RetVal (info->retval)
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
static int FCurrent (func_info *);
|
static int FADawn (func_info *);
|
||||||
static int FNonomitted (func_info *);
|
static int FADusk (func_info *);
|
||||||
static int FTimepart(func_info *);
|
static int FAbs (func_info *);
|
||||||
static int FDatepart(func_info *);
|
static int FAccess (func_info *);
|
||||||
static int FRealCurrent(func_info *);
|
static int FAmpm (func_info *);
|
||||||
static int FAbs (func_info *);
|
static int FArgs (func_info *);
|
||||||
static int FAccess (func_info *);
|
static int FAsc (func_info *);
|
||||||
static int FArgs (func_info *);
|
static int FBaseyr (func_info *);
|
||||||
static int FAsc (func_info *);
|
static int FChar (func_info *);
|
||||||
static int FBaseyr (func_info *);
|
static int FChoose (func_info *);
|
||||||
static int FChar (func_info *);
|
static int FCoerce (func_info *);
|
||||||
static int FChoose (func_info *);
|
static int FCurrent (func_info *);
|
||||||
static int FCoerce (func_info *);
|
static int FDate (func_info *);
|
||||||
static int FDate (func_info *);
|
static int FDateTime (func_info *);
|
||||||
static int FDateTime (func_info *);
|
static int FDatepart (func_info *);
|
||||||
static int FDay (func_info *);
|
static int FDawn (func_info *);
|
||||||
static int FDaysinmon (func_info *);
|
static int FDay (func_info *);
|
||||||
static int FDefined (func_info *);
|
static int FDaysinmon (func_info *);
|
||||||
static int FDosubst (func_info *);
|
static int FDefined (func_info *);
|
||||||
static int FEasterdate (func_info *);
|
static int FDosubst (func_info *);
|
||||||
static int FEvalTrig (func_info *);
|
static int FDusk (func_info *);
|
||||||
static int FFiledate (func_info *);
|
static int FEasterdate (func_info *);
|
||||||
static int FFiledatetime (func_info *);
|
static int FEvalTrig (func_info *);
|
||||||
static int FFiledir (func_info *);
|
static int FFiledate (func_info *);
|
||||||
static int FFilename (func_info *);
|
static int FFiledatetime (func_info *);
|
||||||
static int FGetenv (func_info *);
|
static int FFiledir (func_info *);
|
||||||
static int FHebdate (func_info *);
|
static int FFilename (func_info *);
|
||||||
static int FHebday (func_info *);
|
static int FGetenv (func_info *);
|
||||||
static int FHebmon (func_info *);
|
static int FHebdate (func_info *);
|
||||||
static int FHebyear (func_info *);
|
static int FHebday (func_info *);
|
||||||
static int FHour (func_info *);
|
static int FHebmon (func_info *);
|
||||||
static int FIif (func_info *);
|
static int FHebyear (func_info *);
|
||||||
static int FIndex (func_info *);
|
static int FHour (func_info *);
|
||||||
static int FIsdst (func_info *);
|
static int FIif (func_info *);
|
||||||
static int FIsomitted (func_info *);
|
static int FIndex (func_info *);
|
||||||
static int FSlide (func_info *);
|
static int FIsdst (func_info *);
|
||||||
static int FLanguage (func_info *);
|
static int FIsleap (func_info *);
|
||||||
static int FMax (func_info *);
|
static int FIsomitted (func_info *);
|
||||||
static int FMin (func_info *);
|
static int FLanguage (func_info *);
|
||||||
static int FMinute (func_info *);
|
static int FLower (func_info *);
|
||||||
static int FMinsfromutc (func_info *);
|
static int FMax (func_info *);
|
||||||
static int FMoondate (func_info *);
|
static int FMin (func_info *);
|
||||||
static int FMoondatetime (func_info *);
|
static int FMinsfromutc (func_info *);
|
||||||
static int FMoonphase (func_info *);
|
static int FMinute (func_info *);
|
||||||
static int FMoontime (func_info *);
|
static int FMon (func_info *);
|
||||||
static int FMon (func_info *);
|
static int FMonnum (func_info *);
|
||||||
static int FMonnum (func_info *);
|
static int FMoondate (func_info *);
|
||||||
static int FOrd (func_info *);
|
static int FMoondatetime (func_info *);
|
||||||
static int FOstype (func_info *);
|
static int FMoonphase (func_info *);
|
||||||
static int FPlural (func_info *);
|
static int FMoontime (func_info *);
|
||||||
static int FSgn (func_info *);
|
static int FNDawn (func_info *);
|
||||||
static int FPsmoon (func_info *);
|
static int FNDusk (func_info *);
|
||||||
static int FPsshade (func_info *);
|
static int FNonomitted (func_info *);
|
||||||
static int FShell (func_info *);
|
static int FNow (func_info *);
|
||||||
static int FStrlen (func_info *);
|
static int FOrd (func_info *);
|
||||||
static int FSubstr (func_info *);
|
static int FOstype (func_info *);
|
||||||
static int FADawn (func_info *);
|
static int FPlural (func_info *);
|
||||||
static int FADusk (func_info *);
|
static int FPsmoon (func_info *);
|
||||||
static int FNDawn (func_info *);
|
static int FPsshade (func_info *);
|
||||||
static int FNDusk (func_info *);
|
static int FRealCurrent (func_info *);
|
||||||
static int FDawn (func_info *);
|
static int FRealnow (func_info *);
|
||||||
static int FDusk (func_info *);
|
static int FRealtoday (func_info *);
|
||||||
static int FSunset (func_info *);
|
static int FSgn (func_info *);
|
||||||
static int FSunrise (func_info *);
|
static int FShell (func_info *);
|
||||||
static int FTime (func_info *);
|
static int FSlide (func_info *);
|
||||||
static int FTrigdate (func_info *);
|
static int FStrlen (func_info *);
|
||||||
static int FTrigdatetime (func_info *);
|
static int FSubstr (func_info *);
|
||||||
static int FTrigtime (func_info *);
|
static int FSunrise (func_info *);
|
||||||
static int FTrigvalid (func_info *);
|
static int FSunset (func_info *);
|
||||||
static int FTypeof (func_info *);
|
static int FTime (func_info *);
|
||||||
static int FUpper (func_info *);
|
static int FTimepart (func_info *);
|
||||||
static int FValue (func_info *);
|
static int FToday (func_info *);
|
||||||
static int FVersion (func_info *);
|
static int FTrigback (func_info *);
|
||||||
static int FWkday (func_info *);
|
static int FTrigdate (func_info *);
|
||||||
static int FWkdaynum (func_info *);
|
static int FTrigdatetime (func_info *);
|
||||||
static int FYear (func_info *);
|
static int FTrigdelta (func_info *);
|
||||||
static int FIsleap (func_info *);
|
static int FTrigduration (func_info *);
|
||||||
static int FLower (func_info *);
|
static int FTrigeventduration(func_info *);
|
||||||
static int FNow (func_info *);
|
static int FTrigeventstart (func_info *);
|
||||||
static int FRealnow (func_info *);
|
static int FTrigfrom (func_info *);
|
||||||
static int FRealtoday (func_info *);
|
static int FTrigger (func_info *);
|
||||||
static int FToday (func_info *);
|
static int FTrigpriority (func_info *);
|
||||||
static int FTrigger (func_info *);
|
static int FTrigrep (func_info *);
|
||||||
static int FTzconvert (func_info *);
|
static int FTrigscanfrom (func_info *);
|
||||||
static int FWeekno (func_info *);
|
static int FTrigtime (func_info *);
|
||||||
static int CheckArgs (BuiltinFunc *f, int nargs);
|
static int FTrigtimedelta (func_info *);
|
||||||
static int CleanUpAfterFunc (func_info *);
|
static int FTrigtimerep (func_info *);
|
||||||
static int SunStuff (int rise, double cosz, int jul);
|
static int FTriguntil (func_info *);
|
||||||
|
static int FTrigvalid (func_info *);
|
||||||
|
static int FTypeof (func_info *);
|
||||||
|
static int FTzconvert (func_info *);
|
||||||
|
static int FUpper (func_info *);
|
||||||
|
static int FValue (func_info *);
|
||||||
|
static int FVersion (func_info *);
|
||||||
|
static int FWeekno (func_info *);
|
||||||
|
static int FWkday (func_info *);
|
||||||
|
static int FWkdaynum (func_info *);
|
||||||
|
static int FYear (func_info *);
|
||||||
|
|
||||||
|
static int CleanUpAfterFunc (func_info *);
|
||||||
|
static int CheckArgs (BuiltinFunc *f, int nargs);
|
||||||
|
static int SunStuff (int rise, double cosz, int jul);
|
||||||
|
|
||||||
/* "Overload" the struct Operator definition */
|
/* "Overload" the struct Operator definition */
|
||||||
#define NO_MAX 127
|
#define NO_MAX 127
|
||||||
@@ -193,6 +207,7 @@ BuiltinFunc Func[] = {
|
|||||||
{ "access", 2, 2, 0, FAccess },
|
{ "access", 2, 2, 0, FAccess },
|
||||||
{ "adawn", 0, 1, 0, FADawn},
|
{ "adawn", 0, 1, 0, FADawn},
|
||||||
{ "adusk", 0, 1, 0, FADusk},
|
{ "adusk", 0, 1, 0, FADusk},
|
||||||
|
{ "ampm", 1, 3, 1, FAmpm },
|
||||||
{ "args", 1, 1, 0, FArgs },
|
{ "args", 1, 1, 0, FArgs },
|
||||||
{ "asc", 1, 1, 1, FAsc },
|
{ "asc", 1, 1, 1, FAsc },
|
||||||
{ "baseyr", 0, 0, 1, FBaseyr },
|
{ "baseyr", 0, 0, 1, FBaseyr },
|
||||||
@@ -260,10 +275,22 @@ BuiltinFunc Func[] = {
|
|||||||
{ "time", 2, 2, 1, FTime },
|
{ "time", 2, 2, 1, FTime },
|
||||||
{ "timepart", 1, 1, 1, FTimepart },
|
{ "timepart", 1, 1, 1, FTimepart },
|
||||||
{ "today", 0, 0, 0, FToday },
|
{ "today", 0, 0, 0, FToday },
|
||||||
|
{ "trigback", 0, 0, 0, FTrigback },
|
||||||
{ "trigdate", 0, 0, 0, FTrigdate },
|
{ "trigdate", 0, 0, 0, FTrigdate },
|
||||||
{ "trigdatetime", 0, 0, 0, FTrigdatetime },
|
{ "trigdatetime", 0, 0, 0, FTrigdatetime },
|
||||||
|
{ "trigdelta", 0, 0, 0, FTrigdelta },
|
||||||
|
{ "trigduration", 0, 0, 0, FTrigduration },
|
||||||
|
{ "trigeventduration", 0, 0, 0, FTrigeventduration },
|
||||||
|
{ "trigeventstart", 0, 0, 0, FTrigeventstart },
|
||||||
|
{ "trigfrom", 0, 0, 0, FTrigfrom },
|
||||||
{ "trigger", 1, 3, 0, FTrigger },
|
{ "trigger", 1, 3, 0, FTrigger },
|
||||||
|
{ "trigpriority", 0, 0, 0, FTrigpriority },
|
||||||
|
{ "trigrep", 0, 0, 0, FTrigrep },
|
||||||
|
{ "trigscanfrom", 0, 0, 0, FTrigscanfrom },
|
||||||
{ "trigtime", 0, 0, 0, FTrigtime },
|
{ "trigtime", 0, 0, 0, FTrigtime },
|
||||||
|
{ "trigtimedelta",0, 0, 0, FTrigtimedelta },
|
||||||
|
{ "trigtimerep", 0, 0, 0, FTrigtimerep },
|
||||||
|
{ "triguntil", 0, 0, 0, FTriguntil },
|
||||||
{ "trigvalid", 0, 0, 0, FTrigvalid },
|
{ "trigvalid", 0, 0, 0, FTrigvalid },
|
||||||
{ "typeof", 1, 1, 1, FTypeof },
|
{ "typeof", 1, 1, 1, FTypeof },
|
||||||
{ "tzconvert", 2, 3, 0, FTzconvert },
|
{ "tzconvert", 2, 3, 0, FTzconvert },
|
||||||
@@ -861,6 +888,76 @@ static int FSgn(func_info *info)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* FAmpm - return a time as a string with "AM" or "PM" suffix */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
static int FAmpm(func_info *info)
|
||||||
|
{
|
||||||
|
int h, m;
|
||||||
|
int yr=0, mo=0, da=0;
|
||||||
|
|
||||||
|
char const *am = "AM";
|
||||||
|
char const *pm = "PM";
|
||||||
|
char const *ampm = NULL;
|
||||||
|
|
||||||
|
char outbuf[128];
|
||||||
|
|
||||||
|
if (ARG(0).type != DATETIME_TYPE && ARG(0).type != TIME_TYPE) {
|
||||||
|
return E_BAD_TYPE;
|
||||||
|
}
|
||||||
|
if (HASDATE(ARG(0))) {
|
||||||
|
FromJulian(DATEPART(ARG(0)), &yr, &mo, &da);
|
||||||
|
}
|
||||||
|
if (Nargs >= 2) {
|
||||||
|
ASSERT_TYPE(1, STR_TYPE);
|
||||||
|
am = ARGSTR(1);
|
||||||
|
if (Nargs >= 3) {
|
||||||
|
ASSERT_TYPE(2, STR_TYPE);
|
||||||
|
pm = ARGSTR(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h = TIMEPART(ARG(0)) / 60;
|
||||||
|
m = TIMEPART(ARG(0)) % 60;
|
||||||
|
if (h <= 11) {
|
||||||
|
/* AM */
|
||||||
|
if (h == 0) {
|
||||||
|
if (ARG(0).type == DATETIME_TYPE) {
|
||||||
|
snprintf(outbuf, sizeof(outbuf), "%04d%c%02d%c%02d%c12%c%02d", yr, DateSep, mo+1, DateSep, da, DateTimeSep, TimeSep, m);
|
||||||
|
} else {
|
||||||
|
snprintf(outbuf, sizeof(outbuf), "12%c%02d", TimeSep, m);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ARG(0).type == DATETIME_TYPE) {
|
||||||
|
snprintf(outbuf, sizeof(outbuf), "%04d%c%02d%c%02d%c%d%c%02d", yr, DateSep, mo+1, DateSep, da, DateTimeSep, h, TimeSep, m);
|
||||||
|
} else {
|
||||||
|
snprintf(outbuf, sizeof(outbuf), "%d%c%02d", h, TimeSep, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ampm = am;
|
||||||
|
} else {
|
||||||
|
if (h > 12) {
|
||||||
|
h -= 12;
|
||||||
|
}
|
||||||
|
if (ARG(0).type == DATETIME_TYPE) {
|
||||||
|
snprintf(outbuf, sizeof(outbuf), "%04d%c%02d%c%02d%c%d%c%02d", yr, DateSep, mo+1, DateSep, da, DateTimeSep, h, TimeSep, m);
|
||||||
|
} else {
|
||||||
|
snprintf(outbuf, sizeof(outbuf), "%d%c%02d", h, TimeSep, m);
|
||||||
|
}
|
||||||
|
ampm = pm;
|
||||||
|
}
|
||||||
|
RetVal.type = STR_TYPE;
|
||||||
|
RetVal.v.str = malloc(strlen(outbuf) + strlen(ampm) + 1);
|
||||||
|
if (!RetVal.v.str) {
|
||||||
|
RetVal.type = ERR_TYPE;
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
strcpy(RetVal.v.str, outbuf);
|
||||||
|
strcat(RetVal.v.str, ampm);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* FOrd - returns a string containing ordinal number. */
|
/* FOrd - returns a string containing ordinal number. */
|
||||||
@@ -1137,6 +1234,120 @@ static int FTrigdate(func_info *info)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int FTrigback(func_info *info)
|
||||||
|
{
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = LastTrigger.back;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigdelta(func_info *info)
|
||||||
|
{
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = LastTrigger.delta;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigtimedelta(func_info *info)
|
||||||
|
{
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = LastTimeTrig.delta;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigtimerep(func_info *info)
|
||||||
|
{
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = LastTimeTrig.rep;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigeventduration(func_info *info)
|
||||||
|
{
|
||||||
|
if (LastTrigger.eventduration == NO_TIME) {
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = -1;
|
||||||
|
} else {
|
||||||
|
RetVal.type = TIME_TYPE;
|
||||||
|
RETVAL = LastTrigger.eventduration;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigeventstart(func_info *info)
|
||||||
|
{
|
||||||
|
if (LastTrigger.eventstart == NO_TIME) {
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = -1;
|
||||||
|
} else {
|
||||||
|
RetVal.type = DATETIME_TYPE;
|
||||||
|
RETVAL = LastTrigger.eventstart;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigduration(func_info *info)
|
||||||
|
{
|
||||||
|
if (LastTimeTrig.duration == NO_TIME) {
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = -1;
|
||||||
|
} else {
|
||||||
|
RetVal.type = TIME_TYPE;
|
||||||
|
RETVAL = LastTimeTrig.duration;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigrep(func_info *info)
|
||||||
|
{
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = LastTrigger.rep;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigpriority(func_info *info)
|
||||||
|
{
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = LastTrigger.priority;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTriguntil(func_info *info)
|
||||||
|
{
|
||||||
|
if (LastTrigger.until == NO_UNTIL) {
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = -1;
|
||||||
|
} else {
|
||||||
|
RetVal.type = DATE_TYPE;
|
||||||
|
RETVAL = LastTrigger.until;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigscanfrom(func_info *info)
|
||||||
|
{
|
||||||
|
if (LastTrigger.scanfrom == NO_DATE) {
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = -1;
|
||||||
|
} else {
|
||||||
|
RetVal.type = DATE_TYPE;
|
||||||
|
RETVAL = LastTrigger.scanfrom;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FTrigfrom(func_info *info)
|
||||||
|
{
|
||||||
|
if (LastTrigger.from == NO_DATE) {
|
||||||
|
RetVal.type = INT_TYPE;
|
||||||
|
RETVAL = -1;
|
||||||
|
} else {
|
||||||
|
RetVal.type = DATE_TYPE;
|
||||||
|
RETVAL = LastTrigger.from;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int FTrigvalid(func_info *info)
|
static int FTrigvalid(func_info *info)
|
||||||
{
|
{
|
||||||
RetVal.type = INT_TYPE;
|
RetVal.type = INT_TYPE;
|
||||||
@@ -1880,7 +2091,7 @@ static int SunStuff(int rise, double cosz, int jul)
|
|||||||
+ (double) LongSec / 3600.0;
|
+ (double) LongSec / 3600.0;
|
||||||
|
|
||||||
latitude = DEGRAD * ((double) LatDeg + (double) LatMin / 60.0
|
latitude = DEGRAD * ((double) LatDeg + (double) LatMin / 60.0
|
||||||
+ (double) LatSec / 3600.0);
|
+ (double) LatSec / 3600.0);
|
||||||
|
|
||||||
|
|
||||||
FromJulian(jul, &year, &mon, &day);
|
FromJulian(jul, &year, &mon, &day);
|
||||||
@@ -1919,10 +2130,10 @@ static int SunStuff(int rise, double cosz, int jul)
|
|||||||
/* Sine of sun's declination */
|
/* Sine of sun's declination */
|
||||||
sinDelta = 0.39782 * sin(DEGRAD*L);
|
sinDelta = 0.39782 * sin(DEGRAD*L);
|
||||||
cosDelta = sqrt(1 - sinDelta*sinDelta);
|
cosDelta = sqrt(1 - sinDelta*sinDelta);
|
||||||
|
|
||||||
/* Cosine of sun's local hour angle */
|
/* Cosine of sun's local hour angle */
|
||||||
cosH = (cosz - sinDelta * sin(latitude)) / (cosDelta * cos(latitude));
|
cosH = (cosz - sinDelta * sin(latitude)) / (cosDelta * cos(latitude));
|
||||||
|
|
||||||
if (cosH < -1.0) { /* Summer -- permanent daylight */
|
if (cosH < -1.0) { /* Summer -- permanent daylight */
|
||||||
if (rise) return NO_TIME;
|
if (rise) return NO_TIME;
|
||||||
else return -NO_TIME;
|
else return -NO_TIME;
|
||||||
@@ -1940,9 +2151,9 @@ static int SunStuff(int rise, double cosz, int jul)
|
|||||||
|
|
||||||
if (T >= 24.0) T -= 24.0;
|
if (T >= 24.0) T -= 24.0;
|
||||||
else if (T < 0.0) T+= 24.0;
|
else if (T < 0.0) T+= 24.0;
|
||||||
|
|
||||||
UT = T + longdeg / 15.0;
|
UT = T + longdeg / 15.0;
|
||||||
|
|
||||||
|
|
||||||
local = UT + (double) mins / 60.0;
|
local = UT + (double) mins / 60.0;
|
||||||
if (local < 0.0) local += 24.0;
|
if (local < 0.0) local += 24.0;
|
||||||
@@ -1953,7 +2164,7 @@ static int SunStuff(int rise, double cosz, int jul)
|
|||||||
|
|
||||||
hours = (int) local;
|
hours = (int) local;
|
||||||
mins = (int) ((local - hours) * 60.0);
|
mins = (int) ((local - hours) * 60.0);
|
||||||
|
|
||||||
/* Sometimes, we get roundoff error. Check for "reasonableness" of
|
/* Sometimes, we get roundoff error. Check for "reasonableness" of
|
||||||
answer. */
|
answer. */
|
||||||
if (rise) {
|
if (rise) {
|
||||||
@@ -2422,16 +2633,16 @@ static int tz_set_tz(char const *tz)
|
|||||||
unsetenv("TZ");
|
unsetenv("TZ");
|
||||||
r = 0;
|
r = 0;
|
||||||
} else {
|
} else {
|
||||||
r = setenv("TZ", tz, 1);
|
r = setenv("TZ", tz, 1);
|
||||||
}
|
}
|
||||||
tzset();
|
tzset();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tz_convert(int year, int month, int day,
|
static int tz_convert(int year, int month, int day,
|
||||||
int hour, int minute,
|
int hour, int minute,
|
||||||
char const *src_tz, char const *tgt_tz,
|
char const *src_tz, char const *tgt_tz,
|
||||||
struct tm *tm)
|
struct tm *tm)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
time_t t;
|
time_t t;
|
||||||
@@ -2452,28 +2663,28 @@ static int tz_convert(int year, int month, int day,
|
|||||||
/* backup old TZ env var */
|
/* backup old TZ env var */
|
||||||
old_tz = getenv("TZ");
|
old_tz = getenv("TZ");
|
||||||
if (tgt_tz == NULL) {
|
if (tgt_tz == NULL) {
|
||||||
tgt_tz = old_tz;
|
tgt_tz = old_tz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set source TZ */
|
/* set source TZ */
|
||||||
r = tz_set_tz(src_tz);
|
r = tz_set_tz(src_tz);
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create timestamp in UTC */
|
/* create timestamp in UTC */
|
||||||
t = mktime(tm);
|
t = mktime(tm);
|
||||||
|
|
||||||
if (t == (time_t) -1) {
|
if (t == (time_t) -1) {
|
||||||
tz_set_tz(old_tz);
|
tz_set_tz(old_tz);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set target TZ */
|
/* set target TZ */
|
||||||
r = tz_set_tz(tgt_tz);
|
r = tz_set_tz(tgt_tz);
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
tz_set_tz(old_tz);
|
tz_set_tz(old_tz);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert to target TZ */
|
/* convert to target TZ */
|
||||||
@@ -2484,9 +2695,9 @@ static int tz_convert(int year, int month, int day,
|
|||||||
|
|
||||||
/* return result */
|
/* return result */
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2557,6 +2768,7 @@ FSlide(func_info *info)
|
|||||||
} else {
|
} else {
|
||||||
while(amt) {
|
while(amt) {
|
||||||
d--;
|
d--;
|
||||||
|
if (d < 0) return E_DATE_OVER;
|
||||||
r = IsOmitted(d, localomit, NULL,&omit);
|
r = IsOmitted(d, localomit, NULL,&omit);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
if (!omit) amt++;
|
if (!omit) amt++;
|
||||||
@@ -2697,13 +2909,13 @@ FEvalTrig(func_info *info)
|
|||||||
return E_PARSE_ERR;
|
return E_PARSE_ERR;
|
||||||
}
|
}
|
||||||
if (scanfrom == NO_DATE) {
|
if (scanfrom == NO_DATE) {
|
||||||
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 0);
|
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
|
||||||
} else {
|
} else {
|
||||||
/* Hokey... */
|
/* Hokey... */
|
||||||
if (trig.scanfrom != JulianToday) {
|
if (trig.scanfrom != JulianToday) {
|
||||||
Eprint("Warning: SCANFROM is ignored in two-argument form of evaltrig()");
|
Eprint("Warning: SCANFROM is ignored in two-argument form of evaltrig()");
|
||||||
}
|
}
|
||||||
jul = ComputeTrigger(scanfrom, &trig, &r, 0);
|
jul = ComputeTrigger(scanfrom, &trig, &tim, &r, 0);
|
||||||
}
|
}
|
||||||
FreeTrig(&trig);
|
FreeTrig(&trig);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/* globals.h and err.h */
|
/* globals.h and err.h */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
/* MK_GLOBALS. Also contains useful macro definitions. */
|
/* MK_GLOBALS. Also contains useful macro definitions. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ EXTERN INIT( int DoPrefixLineNo, 0);
|
|||||||
EXTERN INIT( int MondayFirst, 0);
|
EXTERN INIT( int MondayFirst, 0);
|
||||||
EXTERN INIT( int Iterations, 1);
|
EXTERN INIT( int Iterations, 1);
|
||||||
EXTERN INIT( int PsCal, 0);
|
EXTERN INIT( int PsCal, 0);
|
||||||
EXTERN INIT( int CalWidth, 80);
|
EXTERN INIT( int CalWidth, -1);
|
||||||
EXTERN INIT( int CalWeeks, 0);
|
EXTERN INIT( int CalWeeks, 0);
|
||||||
EXTERN INIT( int CalMonths, 0);
|
EXTERN INIT( int CalMonths, 0);
|
||||||
EXTERN INIT( int Hush, 0);
|
EXTERN INIT( int Hush, 0);
|
||||||
@@ -73,6 +73,9 @@ EXTERN INIT( int Daemon, 0);
|
|||||||
EXTERN INIT( char DateSep, DATESEP);
|
EXTERN INIT( char DateSep, DATESEP);
|
||||||
EXTERN INIT( char TimeSep, TIMESEP);
|
EXTERN INIT( char TimeSep, TIMESEP);
|
||||||
EXTERN INIT( char DateTimeSep, DATETIMESEP);
|
EXTERN INIT( char DateTimeSep, DATETIMESEP);
|
||||||
|
EXTERN INIT( int DefaultColorR, -1);
|
||||||
|
EXTERN INIT( int DefaultColorB, -1);
|
||||||
|
EXTERN INIT( int DefaultColorG, -1);
|
||||||
EXTERN INIT( int SynthesizeTags, 0);
|
EXTERN INIT( int SynthesizeTags, 0);
|
||||||
EXTERN INIT( int ScFormat, SC_AMPM);
|
EXTERN INIT( int ScFormat, SC_AMPM);
|
||||||
EXTERN INIT( int MaxSatIter, 150);
|
EXTERN INIT( int MaxSatIter, 150);
|
||||||
@@ -85,8 +88,10 @@ EXTERN FILE *ErrFp;
|
|||||||
EXTERN INIT( FILE *PurgeFP, NULL);
|
EXTERN INIT( FILE *PurgeFP, NULL);
|
||||||
EXTERN INIT( int NumIfs, 0);
|
EXTERN INIT( int NumIfs, 0);
|
||||||
EXTERN INIT( unsigned int IfFlags, 0);
|
EXTERN INIT( unsigned int IfFlags, 0);
|
||||||
EXTERN INIT( int LastTriggerDate, 0);
|
|
||||||
EXTERN INIT( int LastTrigValid, 0);
|
EXTERN INIT( int LastTrigValid, 0);
|
||||||
|
EXTERN Trigger LastTrigger;
|
||||||
|
EXTERN TimeTrig LastTimeTrig;
|
||||||
|
EXTERN INIT( int LastTriggerDate, 0);
|
||||||
EXTERN INIT( int LastTriggerTime, 0);
|
EXTERN INIT( int LastTriggerTime, 0);
|
||||||
EXTERN INIT( int ShouldCache, 0);
|
EXTERN INIT( int ShouldCache, 0);
|
||||||
EXTERN char const *CurLine;
|
EXTERN char const *CurLine;
|
||||||
@@ -98,6 +103,9 @@ EXTERN INIT( int CalPad, 1);
|
|||||||
EXTERN INIT( int UseVTChars, 0);
|
EXTERN INIT( int UseVTChars, 0);
|
||||||
EXTERN INIT( int UseUTF8Chars, 0);
|
EXTERN INIT( int UseUTF8Chars, 0);
|
||||||
EXTERN INIT( int UseVTColors, 0);
|
EXTERN INIT( int UseVTColors, 0);
|
||||||
|
EXTERN INIT( int Use256Colors, 0);
|
||||||
|
EXTERN INIT( int UseTrueColors, 0);
|
||||||
|
EXTERN INIT( int TerminalBackground, TERMINAL_BACKGROUND_UNKNOWN);
|
||||||
|
|
||||||
/* Latitude and longitude */
|
/* Latitude and longitude */
|
||||||
EXTERN INIT( int LatDeg, LAT_DEG);
|
EXTERN INIT( int LatDeg, LAT_DEG);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Support for the Hebrew calendar */
|
/* Support for the Hebrew calendar */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/* Derived from code written by Amos Shapir in 1978; revised */
|
/* Derived from code written by Amos Shapir in 1978; revised */
|
||||||
/* 1985. */
|
/* 1985. */
|
||||||
@@ -138,8 +138,8 @@ int DaysInHebYear(int y)
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
char const *DaysInHebMonths(int ylen)
|
char const *DaysInHebMonths(int ylen)
|
||||||
{
|
{
|
||||||
static char monlen[13] =
|
static char monlen[14] =
|
||||||
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29};
|
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29, 29};
|
||||||
|
|
||||||
|
|
||||||
if (ylen > 355) {
|
if (ylen > 355) {
|
||||||
|
|||||||
65
src/init.c
@@ -7,7 +7,7 @@
|
|||||||
/* in normal mode. */
|
/* in normal mode. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
* simple calendar format.
|
* simple calendar format.
|
||||||
* -r = Disallow RUN mode
|
* -r = Disallow RUN mode
|
||||||
* -c[n] = Produce a calendar for n months (default = 1)
|
* -c[n] = Produce a calendar for n months (default = 1)
|
||||||
|
* -@[n,m] = Colorize n=0 VT100 n=1 85 n=2 True m=0 dark terminal m=1 light
|
||||||
* -w[n,n,n] = Specify output device width, padding and spacing
|
* -w[n,n,n] = Specify output device width, padding and spacing
|
||||||
* -s[n] = Produce calendar in "simple calendar" format
|
* -s[n] = Produce calendar in "simple calendar" format
|
||||||
* -p[n] = Produce calendar in format compatible with rem2ps
|
* -p[n] = Produce calendar in format compatible with rem2ps
|
||||||
@@ -135,7 +137,7 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
int InvokedAsRem = 0;
|
int InvokedAsRem = 0;
|
||||||
char const *s;
|
char const *s;
|
||||||
int weeks;
|
int weeks;
|
||||||
|
int x;
|
||||||
int jul;
|
int jul;
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
@@ -146,6 +148,17 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
|
|
||||||
jul = NO_DATE;
|
jul = NO_DATE;
|
||||||
|
|
||||||
|
/* If stdout is a terminal, initialize $FormWidth to terminal width-8,
|
||||||
|
but clamp to [20, 500] */
|
||||||
|
if (isatty(STDOUT_FILENO)) {
|
||||||
|
struct winsize w;
|
||||||
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0) {
|
||||||
|
FormWidth = w.ws_col - 8;
|
||||||
|
if (FormWidth < 20) FormWidth = 20;
|
||||||
|
if (FormWidth > 500) FormWidth = 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize global dynamic buffers */
|
/* Initialize global dynamic buffers */
|
||||||
DBufInit(&Banner);
|
DBufInit(&Banner);
|
||||||
DBufInit(&LineBuffer);
|
DBufInit(&LineBuffer);
|
||||||
@@ -190,6 +203,7 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
|
|
||||||
/* Parse the command-line options */
|
/* Parse the command-line options */
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
while (i < argc) {
|
while (i < argc) {
|
||||||
arg = argv[i];
|
arg = argv[i];
|
||||||
if (*arg != '-') break; /* Exit the loop if it's not an option */
|
if (*arg != '-') break; /* Exit the loop if it's not an option */
|
||||||
@@ -204,6 +218,27 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
while (*arg) {
|
while (*arg) {
|
||||||
switch(*arg++) {
|
switch(*arg++) {
|
||||||
|
|
||||||
|
case '@':
|
||||||
|
UseVTColors = 1;
|
||||||
|
if (*arg) {
|
||||||
|
PARSENUM(x, arg);
|
||||||
|
if (x == 1) {
|
||||||
|
Use256Colors = 1;
|
||||||
|
} else if (x == 2) {
|
||||||
|
UseTrueColors = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*arg == ',') {
|
||||||
|
arg++;
|
||||||
|
PARSENUM(x, arg);
|
||||||
|
if (x == 0) {
|
||||||
|
TerminalBackground = TERMINAL_BACKGROUND_DARK;
|
||||||
|
} else if (x == 1) {
|
||||||
|
TerminalBackground = TERMINAL_BACKGROUND_LIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'j':
|
case 'j':
|
||||||
case 'J':
|
case 'J':
|
||||||
PurgeMode = 1;
|
PurgeMode = 1;
|
||||||
@@ -400,9 +435,21 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
case 'p':
|
case 'p':
|
||||||
case 'P':
|
case 'P':
|
||||||
DoSimpleCalendar = 1;
|
DoSimpleCalendar = 1;
|
||||||
PsCal = 1;
|
PsCal = PSCAL_LEVEL1;
|
||||||
if (*arg == 'a' || *arg == 'A') {
|
while (*arg == 'a' || *arg == 'A' ||
|
||||||
DoSimpleCalDelta = 1;
|
*arg == 'p' || *arg == 'P') {
|
||||||
|
if (*arg == 'a' || *arg == 'A') {
|
||||||
|
DoSimpleCalDelta = 1;
|
||||||
|
} else if (*arg == 'p' || *arg == 'P') {
|
||||||
|
/* JSON interchange formats always include
|
||||||
|
file and line number info */
|
||||||
|
DoPrefixLineNo = 1;
|
||||||
|
if (PsCal == PSCAL_LEVEL1) {
|
||||||
|
PsCal = PSCAL_LEVEL2;
|
||||||
|
} else {
|
||||||
|
PsCal = PSCAL_LEVEL3;
|
||||||
|
}
|
||||||
|
}
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
PARSENUM(CalMonths, arg);
|
PARSENUM(CalMonths, arg);
|
||||||
@@ -418,7 +465,10 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
case 'W':
|
case 'W':
|
||||||
if (*arg != ',') {
|
if (*arg != ',') {
|
||||||
PARSENUM(CalWidth, arg);
|
PARSENUM(CalWidth, arg);
|
||||||
if (CalWidth < 71) CalWidth = 71;
|
if (CalWidth != 0 && CalWidth < 71) CalWidth = 71;
|
||||||
|
if (CalWidth == 0) {
|
||||||
|
CalWidth = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (*arg == ',') {
|
if (*arg == ',') {
|
||||||
arg++;
|
arg++;
|
||||||
@@ -599,7 +649,7 @@ void InitRemind(int argc, char const *argv[])
|
|||||||
#ifndef L_USAGE_OVERRIDE
|
#ifndef L_USAGE_OVERRIDE
|
||||||
void Usage(void)
|
void Usage(void)
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2018 Dianne Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2020 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -607,6 +657,7 @@ void Usage(void)
|
|||||||
fprintf(ErrFp, "Options:\n");
|
fprintf(ErrFp, "Options:\n");
|
||||||
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
|
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
|
||||||
fprintf(ErrFp, " -r Disable RUN directives\n");
|
fprintf(ErrFp, " -r Disable RUN directives\n");
|
||||||
|
fprintf(ErrFp, " -@[n,m] Colorize COLOR reminders\n");
|
||||||
fprintf(ErrFp, " -c[a][n] Produce a calendar for n (default 1) months\n");
|
fprintf(ErrFp, " -c[a][n] Produce a calendar for n (default 1) months\n");
|
||||||
fprintf(ErrFp, " -c[a]+[n] Produce a calendar for n (default 1) weeks\n");
|
fprintf(ErrFp, " -c[a]+[n] Produce a calendar for n (default 1) weeks\n");
|
||||||
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");
|
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");
|
||||||
|
|||||||
1045
src/json.c
Normal file
280
src/json.h
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
/* vim: set et ts=3 sw=3 sts=3 ft=c:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved.
|
||||||
|
* https://github.com/udp/json-parser
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JSON_H
|
||||||
|
#define _JSON_H
|
||||||
|
|
||||||
|
#ifndef json_char
|
||||||
|
#define json_char char
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef json_int_t
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#include <inttypes.h>
|
||||||
|
#define json_int_t int64_t
|
||||||
|
#else
|
||||||
|
#define json_int_t __int64
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned long max_memory;
|
||||||
|
int settings;
|
||||||
|
|
||||||
|
/* Custom allocator support (leave null to use malloc/free)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void * (* mem_alloc) (size_t, int zero, void * user_data);
|
||||||
|
void (* mem_free) (void *, void * user_data);
|
||||||
|
|
||||||
|
void * user_data; /* will be passed to mem_alloc and mem_free */
|
||||||
|
|
||||||
|
size_t value_extra; /* how much extra space to allocate for values? */
|
||||||
|
|
||||||
|
} json_settings;
|
||||||
|
|
||||||
|
#define json_enable_comments 0x01
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
json_none,
|
||||||
|
json_object,
|
||||||
|
json_array,
|
||||||
|
json_integer,
|
||||||
|
json_double,
|
||||||
|
json_string,
|
||||||
|
json_boolean,
|
||||||
|
json_null
|
||||||
|
|
||||||
|
} json_type;
|
||||||
|
|
||||||
|
extern const struct _json_value json_value_none;
|
||||||
|
|
||||||
|
typedef struct _json_object_entry
|
||||||
|
{
|
||||||
|
json_char * name;
|
||||||
|
unsigned int name_length;
|
||||||
|
|
||||||
|
struct _json_value * value;
|
||||||
|
|
||||||
|
} json_object_entry;
|
||||||
|
|
||||||
|
typedef struct _json_value
|
||||||
|
{
|
||||||
|
struct _json_value * parent;
|
||||||
|
|
||||||
|
json_type type;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
int boolean;
|
||||||
|
json_int_t integer;
|
||||||
|
double dbl;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned int length;
|
||||||
|
json_char * ptr; /* null terminated */
|
||||||
|
|
||||||
|
} string;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned int length;
|
||||||
|
|
||||||
|
json_object_entry * values;
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||||
|
decltype(values) begin () const
|
||||||
|
{ return values;
|
||||||
|
}
|
||||||
|
decltype(values) end () const
|
||||||
|
{ return values + length;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} object;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned int length;
|
||||||
|
struct _json_value ** values;
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||||
|
decltype(values) begin () const
|
||||||
|
{ return values;
|
||||||
|
}
|
||||||
|
decltype(values) end () const
|
||||||
|
{ return values + length;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} array;
|
||||||
|
|
||||||
|
} u;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct _json_value * next_alloc;
|
||||||
|
void * object_mem;
|
||||||
|
|
||||||
|
} _reserved;
|
||||||
|
|
||||||
|
#ifdef JSON_TRACK_SOURCE
|
||||||
|
|
||||||
|
/* Location of the value in the source JSON
|
||||||
|
*/
|
||||||
|
unsigned int line, col;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Some C++ operator sugar */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
inline _json_value ()
|
||||||
|
{ memset (this, 0, sizeof (_json_value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const struct _json_value &operator [] (int index) const
|
||||||
|
{
|
||||||
|
if (type != json_array || index < 0
|
||||||
|
|| ((unsigned int) index) >= u.array.length)
|
||||||
|
{
|
||||||
|
return json_value_none;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *u.array.values [index];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const struct _json_value &operator [] (const char * index) const
|
||||||
|
{
|
||||||
|
if (type != json_object)
|
||||||
|
return json_value_none;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < u.object.length; ++ i)
|
||||||
|
if (!strcmp (u.object.values [i].name, index))
|
||||||
|
return *u.object.values [i].value;
|
||||||
|
|
||||||
|
return json_value_none;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator const char * () const
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case json_string:
|
||||||
|
return u.string.ptr;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator json_int_t () const
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case json_integer:
|
||||||
|
return u.integer;
|
||||||
|
|
||||||
|
case json_double:
|
||||||
|
return (json_int_t) u.dbl;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator bool () const
|
||||||
|
{
|
||||||
|
if (type != json_boolean)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return u.boolean != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator double () const
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case json_integer:
|
||||||
|
return (double) u.integer;
|
||||||
|
|
||||||
|
case json_double:
|
||||||
|
return u.dbl;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} json_value;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Header file for language support for various languages. */
|
/* Header file for language support for various languages. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-2018 by Dianne Skoll */
|
/* REMIND is Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
|
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
/* Further corrections by Erik-Jan Vens */
|
/* Further corrections by Erik-Jan Vens */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Support for the English language. */
|
/* Support for the English language. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
|
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
|
||||||
/* REMIND is Copyright (C) 1992-2018 by Dianne Skoll */
|
/* REMIND is Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -302,7 +302,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
|
|
||||||
#elif IBMEXTENDED
|
#elif IBMEXTENDED
|
||||||
"Ok",
|
"Ok",
|
||||||
@@ -407,7 +408,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
"Ok",
|
"Ok",
|
||||||
@@ -512,7 +514,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -524,7 +527,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
void Usage(void)
|
void Usage(void)
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2018 Dianne Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2020 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
|
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-2018 by Dianne Skoll */
|
/* REMIND is Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* This file is Copyright (C) 1993 by Laurent Duperval and */
|
/* This file is Copyright (C) 1993 by Laurent Duperval and */
|
||||||
/* Dianne Skoll. */
|
/* Dianne Skoll. */
|
||||||
/* */
|
/* */
|
||||||
@@ -242,7 +242,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
|
|
||||||
#else /* ISOLATIN1 */
|
#else /* ISOLATIN1 */
|
||||||
"Ok",
|
"Ok",
|
||||||
@@ -347,7 +348,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
#endif /* ISOLATIN1 */
|
#endif /* ISOLATIN1 */
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
@@ -357,7 +359,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
void Usage(void)
|
void Usage(void)
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2018 Dianne Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2020 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/* I don't speak German. */
|
/* I don't speak German. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Support for the Icelandic language. */
|
/* Support for the Icelandic language. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
|
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* It is Copyright (C) 1996 by Valerio Aimale */
|
/* It is Copyright (C) 1996 by Valerio Aimale */
|
||||||
/* */
|
/* */
|
||||||
/* Remind is copyright (C) 1992-2018 by Dianne Skoll */
|
/* Remind is copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* This file is Copyright (C) 1993 by Trygve Randen. */
|
/* This file is Copyright (C) 1993 by Trygve Randen. */
|
||||||
/* Remind is Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Remind is Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/* Polish. */
|
/* Polish. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -281,7 +281,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
#else /* ISOLATIN1 */
|
#else /* ISOLATIN1 */
|
||||||
"OK",
|
"OK",
|
||||||
"Brakujacy ']'",
|
"Brakujacy ']'",
|
||||||
@@ -385,7 +386,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
#endif /* ISOLATIN1 */
|
#endif /* ISOLATIN1 */
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
@@ -395,7 +397,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
void Usage(void)
|
void Usage(void)
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2018 Dianne Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2020 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-2018 by Dianne Skoll */
|
/* REMIND is Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* This file is Copyright (C) 1996 by Marco Paganini and */
|
/* This file is Copyright (C) 1996 by Marco Paganini and */
|
||||||
/* Dianne Skoll. */
|
/* Dianne Skoll. */
|
||||||
/* */
|
/* */
|
||||||
@@ -247,7 +247,8 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Can't convert between time zones",
|
"Can't convert between time zones",
|
||||||
"No files matching *.rem",
|
"No files matching *.rem",
|
||||||
"String too long",
|
"String too long",
|
||||||
"Time specified twice"
|
"Time specified twice",
|
||||||
|
"Cannot specify DURATION without specifying AT"
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
|
|
||||||
@@ -256,7 +257,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
void Usage(void)
|
void Usage(void)
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2018 Dianne Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2020 Dianne Skoll\n", VERSION, L_LANGNAME);
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
|
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
!/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ROMANIAN.H */
|
/* ROMANIAN.H */
|
||||||
/* */
|
/* */
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-2018 by Dianne Skoll */
|
/* REMIND is Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
|
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
/* Author: Rafa Couto <rafacouto@biogate.com> */
|
/* Author: Rafa Couto <rafacouto@biogate.com> */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
104
src/main.c
@@ -6,7 +6,7 @@
|
|||||||
/* routines, etc. */
|
/* routines, etc. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -63,14 +63,16 @@ int main(int argc, char *argv[])
|
|||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The very first thing to do is to set up ErrFp to be stderr */
|
/* The very first thing to do is to set up ErrFp to be stderr */
|
||||||
ErrFp = stderr;
|
ErrFp = stderr;
|
||||||
|
|
||||||
/* Set up global vars */
|
/* Set up global vars */
|
||||||
ArgC = argc;
|
ArgC = argc;
|
||||||
ArgV = (char const **) argv;
|
ArgV = (char const **) argv;
|
||||||
|
|
||||||
InitRemind(argc, (char const **) argv);
|
InitRemind(argc, (char const **) argv);
|
||||||
|
ClearLastTriggers();
|
||||||
|
|
||||||
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
|
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
|
||||||
ProduceCalendar();
|
ProduceCalendar();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -125,10 +127,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Iterations) {
|
if (Iterations) {
|
||||||
ClearGlobalOmits();
|
PerIterationInit();
|
||||||
DestroyOmitContexts();
|
|
||||||
DestroyVars(0);
|
|
||||||
NumTriggered = 0;
|
|
||||||
JulianToday++;
|
JulianToday++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,6 +145,19 @@ void PurgeEchoLine(char const *fmt, ...)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PerIterationInit(void)
|
||||||
|
{
|
||||||
|
ClearGlobalOmits();
|
||||||
|
DestroyOmitContexts();
|
||||||
|
DestroyVars(0);
|
||||||
|
DefaultColorR = -1;
|
||||||
|
DefaultColorG = -1;
|
||||||
|
DefaultColorB = -1;
|
||||||
|
NumTriggered = 0;
|
||||||
|
ClearLastTriggers();
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* DoReminders */
|
/* DoReminders */
|
||||||
@@ -713,7 +725,7 @@ int DoIf(ParsePtr p)
|
|||||||
int r;
|
int r;
|
||||||
unsigned syndrome;
|
unsigned syndrome;
|
||||||
|
|
||||||
if (NumIfs >= IF_NEST) return E_NESTED_IF;
|
if ((size_t) NumIfs >= IF_NEST) return E_NESTED_IF;
|
||||||
|
|
||||||
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
|
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
|
||||||
else {
|
else {
|
||||||
@@ -794,13 +806,18 @@ int DoIfTrig(ParsePtr p)
|
|||||||
int jul;
|
int jul;
|
||||||
|
|
||||||
|
|
||||||
if (NumIfs >= IF_NEST) return E_NESTED_IF;
|
if ((size_t) NumIfs >= IF_NEST) return E_NESTED_IF;
|
||||||
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
|
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
|
||||||
else {
|
else {
|
||||||
if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r;
|
if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r;
|
||||||
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
|
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
|
||||||
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 1);
|
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
|
||||||
if (r) syndrome = IF_TRUE | BEFORE_ELSE;
|
if (r) {
|
||||||
|
if (!Hush || r != E_RUN_DISABLED) {
|
||||||
|
Eprint("%s", ErrMsg[r]);
|
||||||
|
}
|
||||||
|
syndrome = IF_TRUE | BEFORE_ELSE;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
|
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
|
||||||
syndrome = IF_TRUE | BEFORE_ELSE;
|
syndrome = IF_TRUE | BEFORE_ELSE;
|
||||||
@@ -1302,6 +1319,7 @@ void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
|
|||||||
|
|
||||||
void SigIntHandler(int d)
|
void SigIntHandler(int d)
|
||||||
{
|
{
|
||||||
|
UNUSED(d);
|
||||||
signal(SIGINT, SigIntHandler);
|
signal(SIGINT, SigIntHandler);
|
||||||
GotSigInt();
|
GotSigInt();
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -1321,3 +1339,67 @@ FreeTrig(Trigger *t)
|
|||||||
{
|
{
|
||||||
DBufFree(&(t->tags));
|
DBufFree(&(t->tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClearLastTriggers(void)
|
||||||
|
{
|
||||||
|
LastTrigger.expired = 0;
|
||||||
|
LastTrigger.wd = NO_WD;
|
||||||
|
LastTrigger.d = NO_DAY;
|
||||||
|
LastTrigger.m = NO_MON;
|
||||||
|
LastTrigger.y = NO_YR;
|
||||||
|
LastTrigger.back = NO_BACK;
|
||||||
|
LastTrigger.delta = NO_DELTA;
|
||||||
|
LastTrigger.rep = NO_REP;
|
||||||
|
LastTrigger.localomit = NO_WD;
|
||||||
|
LastTrigger.skip = NO_SKIP;
|
||||||
|
LastTrigger.until = NO_UNTIL;
|
||||||
|
LastTrigger.typ = NO_TYPE;
|
||||||
|
LastTrigger.once = NO_ONCE;
|
||||||
|
LastTrigger.scanfrom = NO_DATE;
|
||||||
|
LastTrigger.from = NO_DATE;
|
||||||
|
LastTrigger.priority = DefaultPrio;
|
||||||
|
LastTrigger.sched[0] = 0;
|
||||||
|
LastTrigger.warn[0] = 0;
|
||||||
|
LastTrigger.omitfunc[0] = 0;
|
||||||
|
LastTrigger.passthru[0] = 0;
|
||||||
|
|
||||||
|
LastTimeTrig.ttime = NO_TIME;
|
||||||
|
LastTimeTrig.delta = NO_DELTA;
|
||||||
|
LastTimeTrig.rep = NO_REP;
|
||||||
|
LastTimeTrig.duration = NO_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigtime, int valid)
|
||||||
|
{
|
||||||
|
SaveLastTrigger(t);
|
||||||
|
SaveLastTimeTrig(tt);
|
||||||
|
LastTriggerDate = trigdate;
|
||||||
|
LastTriggerTime = trigtime;
|
||||||
|
LastTrigValid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaveLastTrigger(Trigger const *t)
|
||||||
|
{
|
||||||
|
memcpy(&LastTrigger, t, sizeof(LastTrigger));
|
||||||
|
DBufInit(&(LastTrigger.tags));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SaveLastTimeTrig(TimeTrig const *t)
|
||||||
|
{
|
||||||
|
memcpy(&LastTimeTrig, t, sizeof(LastTimeTrig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapper to ignore warnings about ignoring return value of system() */
|
||||||
|
void
|
||||||
|
System(char const *cmd)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
r = system(cmd);
|
||||||
|
if (r == 0) {
|
||||||
|
r = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Calculations for figuring out moon phases. */
|
/* Calculations for figuring out moon phases. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* the data structures for OMITted dates. */
|
/* the data structures for OMITted dates. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -453,6 +453,7 @@ DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
|
|||||||
end = Julian(yend, mend, dend);
|
end = Julian(yend, mend, dend);
|
||||||
|
|
||||||
if (end < start) {
|
if (end < start) {
|
||||||
|
Eprint("Warning: Swapping dates on OMIT ... THROUGH ... line");
|
||||||
tmp = start;
|
tmp = start;
|
||||||
start = end;
|
start = end;
|
||||||
end = tmp;
|
end = tmp;
|
||||||
|
|||||||
28
src/protos.h
@@ -5,10 +5,13 @@
|
|||||||
/* Function Prototypes. */
|
/* Function Prototypes. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
/* Suppress unused variable warnings */
|
||||||
|
#define UNUSED(x) (void) x
|
||||||
|
|
||||||
/* Define a string assignment macro - be careful!!! */
|
/* Define a string assignment macro - be careful!!! */
|
||||||
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
|
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
|
||||||
|
|
||||||
@@ -34,6 +37,7 @@ int ShouldTriggerReminder (Trigger *t, TimeTrig *tim, int jul, int *err);
|
|||||||
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode);
|
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode);
|
||||||
int DoSubstFromString (char const *source, DynamicBuffer *dbuf, int jul, int tim);
|
int DoSubstFromString (char const *source, DynamicBuffer *dbuf, int jul, int tim);
|
||||||
int ParseLiteralDate (char const **s, int *jul, int *tim);
|
int ParseLiteralDate (char const **s, int *jul, int *tim);
|
||||||
|
int ParseLiteralTime (char const **s, int *tim);
|
||||||
int EvalExpr (char const **e, Value *v, ParsePtr p);
|
int EvalExpr (char const **e, Value *v, ParsePtr p);
|
||||||
int DoCoerce (char type, Value *v);
|
int DoCoerce (char type, Value *v);
|
||||||
void PrintValue (Value *v, FILE *fp);
|
void PrintValue (Value *v, FILE *fp);
|
||||||
@@ -85,7 +89,10 @@ void HandleQueuedReminders (void);
|
|||||||
char const *FindInitialToken (Token *tok, char const *s);
|
char const *FindInitialToken (Token *tok, char const *s);
|
||||||
void FindToken (char const *s, Token *tok);
|
void FindToken (char const *s, Token *tok);
|
||||||
void FindNumericToken (char const *s, Token *t);
|
void FindNumericToken (char const *s, Token *t);
|
||||||
int ComputeTrigger (int today, Trigger *trig, int *err, int save_in_globals);
|
int ComputeTrigger (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals);
|
||||||
|
int ComputeTriggerNoAdjustDuration (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals, int duration_days);
|
||||||
|
int AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals);
|
||||||
|
int ComputeScanStart(int today, Trigger *trig, TimeTrig *tt);
|
||||||
char *StrnCpy (char *dest, char const *source, int n);
|
char *StrnCpy (char *dest, char const *source, int n);
|
||||||
int StrMatch (char const *s1, char const *s2, int n);
|
int StrMatch (char const *s1, char const *s2, int n);
|
||||||
int StrinCmp (char const *s1, char const *s2, int n);
|
int StrinCmp (char const *s1, char const *s2, int n);
|
||||||
@@ -102,7 +109,7 @@ void DumpVarTable (void);
|
|||||||
void DestroyVars (int all);
|
void DestroyVars (int all);
|
||||||
int PreserveVar (char const *name);
|
int PreserveVar (char const *name);
|
||||||
int DoPreserve (Parser *p);
|
int DoPreserve (Parser *p);
|
||||||
int DoSatRemind (Trigger *trig, TimeTrig *tim, ParsePtr p);
|
int DoSatRemind (Trigger *trig, TimeTrig *tt, ParsePtr p);
|
||||||
int DoMsgCommand (char const *cmd, char const *msg);
|
int DoMsgCommand (char const *cmd, char const *msg);
|
||||||
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
|
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
|
||||||
unsigned int HashVal (char const *str);
|
unsigned int HashVal (char const *str);
|
||||||
@@ -139,3 +146,18 @@ void PurgeEchoLine(char const *fmt, ...);
|
|||||||
void FreeTrig(Trigger *t);
|
void FreeTrig(Trigger *t);
|
||||||
void AppendTag(DynamicBuffer *buf, char const *s);
|
void AppendTag(DynamicBuffer *buf, char const *s);
|
||||||
char const *SynthesizeTag(void);
|
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);
|
||||||
|
char const *Decolorize(int r, int g, int b);
|
||||||
|
char const *Colorize(int r, int g, int b);
|
||||||
|
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 jul);
|
||||||
|
void PrintJSONKeyPairDateTime(char const *name, int dt);
|
||||||
|
void PrintJSONKeyPairTime(char const *name, int t);
|
||||||
|
void System(char const *cmd);
|
||||||
|
|||||||
117
src/queue.c
@@ -5,7 +5,7 @@
|
|||||||
/* Queue up reminders for subsequent execution. */
|
/* Queue up reminders for subsequent execution. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "types.h"
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
|
||||||
@@ -43,6 +43,7 @@ typedef struct queuedrem {
|
|||||||
char passthru[PASSTHRU_LEN+1];
|
char passthru[PASSTHRU_LEN+1];
|
||||||
char sched[VAR_NAME_LEN+1];
|
char sched[VAR_NAME_LEN+1];
|
||||||
DynamicBuffer tags;
|
DynamicBuffer tags;
|
||||||
|
Trigger t;
|
||||||
TimeTrig tt;
|
TimeTrig tt;
|
||||||
} QueuedRem;
|
} QueuedRem;
|
||||||
|
|
||||||
@@ -91,6 +92,8 @@ int QueueReminder(ParsePtr p, Trigger *trig,
|
|||||||
qelem->typ = trig->typ;
|
qelem->typ = trig->typ;
|
||||||
strcpy(qelem->passthru, trig->passthru);
|
strcpy(qelem->passthru, trig->passthru);
|
||||||
qelem->tt = *tim;
|
qelem->tt = *tim;
|
||||||
|
qelem->t = *trig;
|
||||||
|
DBufInit(&(qelem->t.tags));
|
||||||
qelem->next = QueueHead;
|
qelem->next = QueueHead;
|
||||||
qelem->RunDisabled = RunDisabled;
|
qelem->RunDisabled = RunDisabled;
|
||||||
qelem->ntrig = 0;
|
qelem->ntrig = 0;
|
||||||
@@ -179,7 +182,7 @@ void HandleQueuedReminders(void)
|
|||||||
while (TimeToSleep > 0L) {
|
while (TimeToSleep > 0L) {
|
||||||
SleepTime = TimeToSleep;
|
SleepTime = TimeToSleep;
|
||||||
|
|
||||||
if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
|
if (Daemon > 0 && SleepTime > (unsigned int) 60*Daemon) SleepTime = 60*Daemon;
|
||||||
|
|
||||||
/* Wake up once a minute to recalibrate sleep time in
|
/* Wake up once a minute to recalibrate sleep time in
|
||||||
case of laptop hibernation */
|
case of laptop hibernation */
|
||||||
@@ -243,9 +246,7 @@ void HandleQueuedReminders(void)
|
|||||||
|
|
||||||
/* Set up global variables so some functions like trigdate()
|
/* Set up global variables so some functions like trigdate()
|
||||||
and trigtime() work correctly */
|
and trigtime() work correctly */
|
||||||
LastTriggerDate = JulianToday;
|
SaveAllTriggerInfo(&(q->t), &(q->tt), JulianToday, q->tt.ttime, 1);
|
||||||
LastTriggerTime = q->tt.ttime;
|
|
||||||
LastTrigValid = 1;
|
|
||||||
(void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
|
(void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
|
||||||
if (Daemon < 0) {
|
if (Daemon < 0) {
|
||||||
printf("NOTE endreminder\n");
|
printf("NOTE endreminder\n");
|
||||||
@@ -447,6 +448,70 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dump the queue in JSON format */
|
||||||
|
static void
|
||||||
|
json_queue(QueuedRem const *q)
|
||||||
|
{
|
||||||
|
int done = 0;
|
||||||
|
printf("[");
|
||||||
|
while(q) {
|
||||||
|
if (q->tt.nexttime == NO_TIME) {
|
||||||
|
q = q->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (done) {
|
||||||
|
printf(",");
|
||||||
|
}
|
||||||
|
done = 1;
|
||||||
|
printf("{");
|
||||||
|
switch(q->typ) {
|
||||||
|
case NO_TYPE: PrintJSONKeyPairString("type", "NO_TYPE"); break;
|
||||||
|
case MSG_TYPE: PrintJSONKeyPairString("type", "MSG_TYPE"); break;
|
||||||
|
case RUN_TYPE: PrintJSONKeyPairString("type", "RUN_TYPE"); break;
|
||||||
|
case CAL_TYPE: PrintJSONKeyPairString("type", "CAL_TYPE"); break;
|
||||||
|
case SAT_TYPE: PrintJSONKeyPairString("type", "SAT_TYPE"); break;
|
||||||
|
case PS_TYPE: PrintJSONKeyPairString("type", "PS_TYPE"); break;
|
||||||
|
case PSF_TYPE: PrintJSONKeyPairString("type", "PSF_TYPE"); break;
|
||||||
|
case MSF_TYPE: PrintJSONKeyPairString("type", "MSF_TYPE"); break;
|
||||||
|
case PASSTHRU_TYPE: PrintJSONKeyPairString("type", "PASSTHRU_TYPE"); break;
|
||||||
|
default: PrintJSONKeyPairString("type", "?"); break;
|
||||||
|
}
|
||||||
|
PrintJSONKeyPairInt("rundisabled", q->RunDisabled);
|
||||||
|
PrintJSONKeyPairInt("ntrig", q->ntrig);
|
||||||
|
PrintJSONKeyPairTime("ttime", q->tt.ttime);
|
||||||
|
PrintJSONKeyPairTime("nextttime", q->tt.nexttime);
|
||||||
|
PrintJSONKeyPairInt("delta", q->tt.delta);
|
||||||
|
if (q->tt.rep != NO_TIME) {
|
||||||
|
PrintJSONKeyPairInt("rep", q->tt.rep);
|
||||||
|
}
|
||||||
|
if (q->tt.duration != NO_TIME) {
|
||||||
|
PrintJSONKeyPairInt("duration", q->tt.duration);
|
||||||
|
}
|
||||||
|
if (q->passthru[0]) {
|
||||||
|
PrintJSONKeyPairString("passthru", q->passthru);
|
||||||
|
}
|
||||||
|
if (q->sched[0]) {
|
||||||
|
PrintJSONKeyPairString("sched", q->sched);
|
||||||
|
}
|
||||||
|
if (DBufLen(&(q->tags))) {
|
||||||
|
PrintJSONKeyPairString("tags", DBufValue(&(q->tags)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Last one is a special case - no trailing comma */
|
||||||
|
printf("\"");
|
||||||
|
PrintJSONString("body");
|
||||||
|
printf("\":\"");
|
||||||
|
if (q->text) {
|
||||||
|
PrintJSONString(q->text);
|
||||||
|
} else {
|
||||||
|
PrintJSONString("");
|
||||||
|
}
|
||||||
|
printf("\"}");
|
||||||
|
q = q->next;
|
||||||
|
}
|
||||||
|
printf("]\n");
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* DaemonWait */
|
/* DaemonWait */
|
||||||
@@ -508,28 +573,34 @@ static void DaemonWait(unsigned int sleeptime)
|
|||||||
printf("NOTE queue\n");
|
printf("NOTE queue\n");
|
||||||
QueuedRem *q = QueueHead;
|
QueuedRem *q = QueueHead;
|
||||||
while (q) {
|
while (q) {
|
||||||
switch (q->typ) {
|
if (q->tt.nexttime != NO_TIME) {
|
||||||
case NO_TYPE: printf("NO_TYPE "); break;
|
switch (q->typ) {
|
||||||
case MSG_TYPE: printf("MSG_TYPE "); break;
|
case NO_TYPE: printf("NO_TYPE "); break;
|
||||||
case RUN_TYPE: printf("RUN_TYPE "); break;
|
case MSG_TYPE: printf("MSG_TYPE "); break;
|
||||||
case CAL_TYPE: printf("CAL_TYPE "); break;
|
case RUN_TYPE: printf("RUN_TYPE "); break;
|
||||||
case SAT_TYPE: printf("SAT_TYPE "); break;
|
case CAL_TYPE: printf("CAL_TYPE "); break;
|
||||||
case PS_TYPE: printf("PS_TYPE "); break;
|
case SAT_TYPE: printf("SAT_TYPE "); break;
|
||||||
case PSF_TYPE: printf("PSF_TYPE "); break;
|
case PS_TYPE: printf("PS_TYPE "); break;
|
||||||
case MSF_TYPE: printf("MSF_TYPE "); break;
|
case PSF_TYPE: printf("PSF_TYPE "); break;
|
||||||
case PASSTHRU_TYPE: printf("PASSTHRU_TYPE "); break;
|
case MSF_TYPE: printf("MSF_TYPE "); break;
|
||||||
default: printf("? "); break;
|
case PASSTHRU_TYPE: printf("PASSTHRU_TYPE "); break;
|
||||||
|
default: printf("? "); break;
|
||||||
|
}
|
||||||
|
printf("RunDisabled=%d ntrig=%d ttime=%02d:%02d nexttime=%02d:%02d delta=%d rep=%d duration=%d ", q->RunDisabled, q->ntrig, q->tt.ttime/60, q->tt.ttime % 60, q->tt.nexttime / 60, q->tt.nexttime % 60, q->tt.delta, (q->tt.rep != NO_TIME ? q->tt.rep : -1), (q->tt.duration != NO_TIME ? q->tt.duration : -1));
|
||||||
|
printf("%s %s %s\n",
|
||||||
|
(q->passthru[0] ? q->passthru : "*"),
|
||||||
|
(q->sched[0] ? q->sched : "*"),
|
||||||
|
q->text ? q->text : "NULL");
|
||||||
}
|
}
|
||||||
printf("RunDisabled=%d ntrig=%d ttime=%02d:%02d nexttime=%02d:%02d delta=%d rep=%d duration=%d ", q->RunDisabled, q->ntrig, q->tt.ttime/60, q->tt.ttime % 60, q->tt.nexttime / 60, q->tt.nexttime % 60, q->tt.delta, (q->tt.rep != NO_TIME ? q->tt.rep : -1), (q->tt.duration != NO_TIME ? q->tt.duration : -1));
|
|
||||||
printf("%s %s %s\n",
|
|
||||||
(q->passthru[0] ? q->passthru : "*"),
|
|
||||||
(q->sched[0] ? q->sched : "*"),
|
|
||||||
q->text ? q->text : "NULL");
|
|
||||||
|
|
||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
printf("NOTE endqueue\n");
|
printf("NOTE endqueue\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
} else if (!strcmp(cmdLine, "JSONQUEUE\n")) {
|
||||||
|
printf("NOTE JSONQUEUE\n");
|
||||||
|
json_queue(QueueHead);
|
||||||
|
printf("NOTE ENDJSONQUEUE\n");
|
||||||
|
fflush(stdout);
|
||||||
} else if (!strcmp(cmdLine, "REREAD\n")) {
|
} else if (!strcmp(cmdLine, "REREAD\n")) {
|
||||||
printf("NOTE reread\n");
|
printf("NOTE reread\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|||||||
301
src/rem2ps.c
@@ -5,7 +5,7 @@
|
|||||||
/* Print a PostScript calendar. */
|
/* Print a PostScript calendar. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "rem2ps.h"
|
#include "rem2ps.h"
|
||||||
|
#include "json.h"
|
||||||
|
|
||||||
#define NEW(type) (malloc(sizeof(type)))
|
#define NEW(type) (malloc(sizeof(type)))
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
#define SPECIAL_COLOR 4
|
#define SPECIAL_COLOR 4
|
||||||
#define SPECIAL_WEEK 5
|
#define SPECIAL_WEEK 5
|
||||||
#define SPECIAL_SHADE 6
|
#define SPECIAL_SHADE 6
|
||||||
|
#define SPECIAL_UNKNOWN 7
|
||||||
|
|
||||||
/* Array holding how specials sort */
|
/* Array holding how specials sort */
|
||||||
static int SpecialSortOrder[] = {
|
static int SpecialSortOrder[] = {
|
||||||
@@ -46,6 +48,7 @@ typedef struct calentry {
|
|||||||
struct calentry *next;
|
struct calentry *next;
|
||||||
int special;
|
int special;
|
||||||
char *entry;
|
char *entry;
|
||||||
|
int daynum;
|
||||||
} CalEntry;
|
} CalEntry;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -62,7 +65,7 @@ char const *SmallCalLoc[] = {
|
|||||||
"sbt",
|
"sbt",
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUMSMALL (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0]))
|
#define NUMSMALL ((int) (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0])))
|
||||||
char const *SmallLocation;
|
char const *SmallLocation;
|
||||||
int SmallCol1, SmallCol2;
|
int SmallCol1, SmallCol2;
|
||||||
|
|
||||||
@@ -137,6 +140,172 @@ void WriteOneEntry (CalEntry *c);
|
|||||||
void GetSmallLocations (void);
|
void GetSmallLocations (void);
|
||||||
char const *EatToken(char const *in, char *out, int maxlen);
|
char const *EatToken(char const *in, char *out, int maxlen);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* StrCmpi */
|
||||||
|
/* */
|
||||||
|
/* Compare strings, case insensitive. */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
int StrCmpi(char const *s1, char const *s2)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
while (*s1 && *s2) {
|
||||||
|
r = toupper(*s1) - toupper(*s2);
|
||||||
|
if (r) return r;
|
||||||
|
s1++;
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
return toupper(*s1) - toupper(*s2);
|
||||||
|
}
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Parse the new-style JSON intermediate format */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
static CalEntry *
|
||||||
|
JSONToCalEntry(DynamicBuffer *buf)
|
||||||
|
{
|
||||||
|
CalEntry *c;
|
||||||
|
json_value *val;
|
||||||
|
|
||||||
|
val = json_parse(DBufValue(buf), DBufLen(buf));
|
||||||
|
if (!val) {
|
||||||
|
fprintf(stderr, "Unable to parse JSON line `%s'\n", DBufValue(buf));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val->type != json_object) {
|
||||||
|
fprintf(stderr, "Expecting JSON object; found `%s'\n",
|
||||||
|
DBufValue(buf));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
c = NEW(CalEntry);
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "malloc failed - aborting.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
c->next = NULL;
|
||||||
|
c->special = SPECIAL_NORMAL;
|
||||||
|
|
||||||
|
int got_date = 0, got_body = 0;
|
||||||
|
size_t i;
|
||||||
|
for (i=0; i<val->u.object.length; i++) {
|
||||||
|
char const *nm = val->u.object.values[i].name;
|
||||||
|
json_value *v = val->u.object.values[i].value;
|
||||||
|
char const *s;
|
||||||
|
if (!strcmp(nm, "date")) {
|
||||||
|
if (v->type == json_string) {
|
||||||
|
s = v->u.string.ptr;
|
||||||
|
c->daynum = (s[8] - '0') * 10 + s[9] - '0';
|
||||||
|
got_date = 1;
|
||||||
|
}
|
||||||
|
} else if (!strcmp(nm, "body")) {
|
||||||
|
if (v->type == json_string) {
|
||||||
|
s = v->u.string.ptr;
|
||||||
|
c->entry = malloc(strlen(s)+1);
|
||||||
|
if (!c->entry) {
|
||||||
|
fprintf(stderr, "malloc failed - aborting.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
strcpy(c->entry, s);
|
||||||
|
got_body = 1;
|
||||||
|
}
|
||||||
|
} else if (!strcmp(nm, "passthru")) {
|
||||||
|
if (v->type == json_string) {
|
||||||
|
s = v->u.string.ptr;
|
||||||
|
if (!StrCmpi(s, "PostScript")) {
|
||||||
|
c->special = SPECIAL_POSTSCRIPT;
|
||||||
|
} else if (!StrCmpi(s, "SHADE")) {
|
||||||
|
c->special = SPECIAL_SHADE;
|
||||||
|
} else if (!StrCmpi(s, "MOON")) {
|
||||||
|
c->special = SPECIAL_MOON;
|
||||||
|
} else if (!StrCmpi(s, "WEEK")) {
|
||||||
|
c->special = SPECIAL_WEEK;
|
||||||
|
} else if (!StrCmpi(s, "PSFile")) {
|
||||||
|
c->special = SPECIAL_PSFILE;
|
||||||
|
} else if (!StrCmpi(s, "COLOUR") ||
|
||||||
|
!StrCmpi(s, "COLOR")) {
|
||||||
|
c->special = SPECIAL_COLOR;
|
||||||
|
} else {
|
||||||
|
c->special = SPECIAL_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
json_value_free(val);
|
||||||
|
|
||||||
|
if (!got_body || !got_date) {
|
||||||
|
fprintf(stderr, "Could not parse line `%s'\n", DBufValue(buf));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Parse the old-style REM2PS intermediate format */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
static CalEntry *
|
||||||
|
TextToCalEntry(DynamicBuffer *buf)
|
||||||
|
{
|
||||||
|
char const *startOfBody;
|
||||||
|
char passthru[PASSTHRU_LEN+1];
|
||||||
|
|
||||||
|
CalEntry *c = NEW(CalEntry);
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "malloc failed - aborting.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
c->next = NULL;
|
||||||
|
c->special = SPECIAL_NORMAL;
|
||||||
|
c->daynum = (DBufValue(buf)[8] - '0') * 10 + DBufValue(buf)[9] - '0';
|
||||||
|
|
||||||
|
/* Skip the tag, duration and time */
|
||||||
|
startOfBody = DBufValue(buf)+10;
|
||||||
|
|
||||||
|
/* Eat the passthru */
|
||||||
|
startOfBody = EatToken(startOfBody, passthru, PASSTHRU_LEN);
|
||||||
|
|
||||||
|
/* Eat the tag */
|
||||||
|
startOfBody = EatToken(startOfBody, NULL, 0);
|
||||||
|
|
||||||
|
/* Eat the duration */
|
||||||
|
startOfBody = EatToken(startOfBody, NULL, 0);
|
||||||
|
|
||||||
|
/* Eat the time */
|
||||||
|
startOfBody = EatToken(startOfBody, NULL, 0);
|
||||||
|
|
||||||
|
c->entry = malloc(strlen(startOfBody) + 1);
|
||||||
|
if (!c->entry) {
|
||||||
|
fprintf(stderr, "malloc failed - aborting.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
strcpy(c->entry, startOfBody);
|
||||||
|
|
||||||
|
/* Save the type of SPECIAL */
|
||||||
|
if (!StrCmpi(passthru, "PostScript")) {
|
||||||
|
c->special = SPECIAL_POSTSCRIPT;
|
||||||
|
} else if (!StrCmpi(passthru, "SHADE")) {
|
||||||
|
c->special = SPECIAL_SHADE;
|
||||||
|
} else if (!StrCmpi(passthru, "MOON")) {
|
||||||
|
c->special = SPECIAL_MOON;
|
||||||
|
} else if (!StrCmpi(passthru, "WEEK")) {
|
||||||
|
c->special = SPECIAL_WEEK;
|
||||||
|
} else if (!StrCmpi(passthru, "PSFile")) {
|
||||||
|
c->special = SPECIAL_PSFILE;
|
||||||
|
} else if (!StrCmpi(passthru, "COLOUR") ||
|
||||||
|
!StrCmpi(passthru, "COLOR")) {
|
||||||
|
c->special = SPECIAL_COLOR;
|
||||||
|
} else if (StrCmpi(passthru, "*")) {
|
||||||
|
c->special = SPECIAL_UNKNOWN;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* MAIN PROGRAM */
|
/* MAIN PROGRAM */
|
||||||
@@ -154,13 +323,20 @@ int main(int argc, char *argv[])
|
|||||||
Usage("Input should not come from a terminal");
|
Usage("Input should not come from a terminal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int first_line = 1;
|
||||||
/* Search for a valid input file */
|
/* Search for a valid input file */
|
||||||
while (!feof(stdin)) {
|
while (!feof(stdin)) {
|
||||||
DBufGets(&buf, stdin);
|
DBufGets(&buf, stdin);
|
||||||
if (!strcmp(DBufValue(&buf), PSBEGIN)) {
|
if (first_line && (!strcmp(DBufValue(&buf), "["))) {
|
||||||
|
fprintf(stderr, "Rem2PS: It appears that you have invoked Remind with the -ppp option.\n Please use either -p or -pp, but not -ppp.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
first_line = 0;
|
||||||
|
if (!strcmp(DBufValue(&buf), PSBEGIN) ||
|
||||||
|
!strcmp(DBufValue(&buf), PSBEGIN2)) {
|
||||||
if (!validfile) {
|
if (!validfile) {
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-1998 by Dianne Skoll\n\n", VERSION);
|
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2020 by Dianne Skoll\n\n", VERSION);
|
||||||
fprintf(stderr, "Generating PostScript calendar\n");
|
fprintf(stderr, "Generating PostScript calendar\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,10 +367,7 @@ void DoPsCal(void)
|
|||||||
int days, wkday, prevdays, nextdays;
|
int days, wkday, prevdays, nextdays;
|
||||||
int sfirst;
|
int sfirst;
|
||||||
int i;
|
int i;
|
||||||
int is_ps;
|
|
||||||
int firstcol;
|
int firstcol;
|
||||||
char const *startOfBody;
|
|
||||||
char passthru[PASSTHRU_LEN+1];
|
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
CalEntry *c, *d, *p;
|
CalEntry *c, *d, *p;
|
||||||
|
|
||||||
@@ -230,6 +403,7 @@ void DoPsCal(void)
|
|||||||
|
|
||||||
printf("%%%%Page: %c%c%c%c%c %d\n", month[0], month[1], month[2],
|
printf("%%%%Page: %c%c%c%c%c %d\n", month[0], month[1], month[2],
|
||||||
year[2], year[3], validfile);
|
year[2], year[3], validfile);
|
||||||
|
printf("%%%%PageBoundingBox: 0 0 %d %d\n", CurPage->xsize, CurPage->ysize);
|
||||||
|
|
||||||
/* Emit PostScript to do the heading */
|
/* Emit PostScript to do the heading */
|
||||||
if (!PortraitMode) printf("90 rotate 0 XSIZE neg translate\n");
|
if (!PortraitMode) printf("90 rotate 0 XSIZE neg translate\n");
|
||||||
@@ -272,80 +446,48 @@ void DoPsCal(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBufGets(&buf, stdin);
|
DBufGets(&buf, stdin);
|
||||||
if (!strcmp(DBufValue(&buf), PSEND)) {
|
if (!strcmp(DBufValue(&buf), PSEND) ||
|
||||||
|
!strcmp(DBufValue(&buf), PSEND2)) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore lines beginning with '#' */
|
/* Ignore lines beginning with '#' */
|
||||||
if (DBufValue(&buf)[0] == '#') {
|
if (DBufValue(&buf)[0] == '#') {
|
||||||
|
DBufFree(&buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Read the day number - a bit of a hack! */
|
|
||||||
DayNum = (DBufValue(&buf)[8] - '0') * 10 + DBufValue(&buf)[9] - '0';
|
if (DBufValue(&buf)[0] == '{') {
|
||||||
if (DayNum != CurDay) {
|
/* Starts with '{', so assume new-style JSON format */
|
||||||
for(; CurDay<DayNum; CurDay++) {
|
c = JSONToCalEntry(&buf);
|
||||||
|
} else {
|
||||||
|
/* Assume it's the old-style rem2ps intermediate format */
|
||||||
|
c = TextToCalEntry(&buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If it's an unknown special, ignore */
|
||||||
|
if (c->special == SPECIAL_UNKNOWN) {
|
||||||
|
DBufFree(&buf);
|
||||||
|
free(c);
|
||||||
|
c = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c->daynum != CurDay) {
|
||||||
|
for(; CurDay<c->daynum; CurDay++) {
|
||||||
WriteCalEntry();
|
WriteCalEntry();
|
||||||
WkDayNum = (WkDayNum + 1) % 7;
|
WkDayNum = (WkDayNum + 1) % 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Add the text */
|
if (c->special == SPECIAL_POSTSCRIPT ||
|
||||||
c = NEW(CalEntry);
|
c->special == SPECIAL_SHADE ||
|
||||||
if (!c) {
|
c->special == SPECIAL_MOON ||
|
||||||
fprintf(stderr, "malloc failed - aborting.\n");
|
c->special == SPECIAL_WEEK ||
|
||||||
exit(1);
|
c->special == SPECIAL_PSFILE) {
|
||||||
}
|
if (!PsEntries[c->daynum]) {
|
||||||
c->next = NULL;
|
PsEntries[c->daynum] = c;
|
||||||
c->special = SPECIAL_NORMAL;
|
|
||||||
|
|
||||||
/* Skip the tag, duration and time */
|
|
||||||
startOfBody = DBufValue(&buf)+10;
|
|
||||||
|
|
||||||
/* Eat the passthru */
|
|
||||||
startOfBody = EatToken(startOfBody, passthru, PASSTHRU_LEN);
|
|
||||||
|
|
||||||
/* Eat the tag */
|
|
||||||
startOfBody = EatToken(startOfBody, NULL, 0);
|
|
||||||
|
|
||||||
/* Eat the duration */
|
|
||||||
startOfBody = EatToken(startOfBody, NULL, 0);
|
|
||||||
|
|
||||||
/* Eat the time */
|
|
||||||
startOfBody = EatToken(startOfBody, NULL, 0);
|
|
||||||
|
|
||||||
is_ps = 0;
|
|
||||||
if (!strcmp(passthru, "PostScript") ||
|
|
||||||
!strcmp(passthru, "PSFile") ||
|
|
||||||
!strcmp(passthru, "MOON") ||
|
|
||||||
!strcmp(passthru, "WEEK") ||
|
|
||||||
!strcmp(passthru, "SHADE")) {
|
|
||||||
is_ps = 1;
|
|
||||||
}
|
|
||||||
c->entry = malloc(strlen(startOfBody) + 1);
|
|
||||||
if (!c->entry) {
|
|
||||||
fprintf(stderr, "malloc failed - aborting.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
strcpy(c->entry, startOfBody);
|
|
||||||
|
|
||||||
if (is_ps) {
|
|
||||||
/* Save the type of SPECIAL */
|
|
||||||
if (!strcmp(passthru, "PostScript")) {
|
|
||||||
c->special = SPECIAL_POSTSCRIPT;
|
|
||||||
} else if (!strcmp(passthru, "SHADE")) {
|
|
||||||
c->special = SPECIAL_SHADE;
|
|
||||||
} else if (!strcmp(passthru, "MOON")) {
|
|
||||||
c->special = SPECIAL_MOON;
|
|
||||||
} else if (!strcmp(passthru, "WEEK")) {
|
|
||||||
c->special = SPECIAL_WEEK;
|
|
||||||
} else {
|
} else {
|
||||||
c->special = SPECIAL_PSFILE;
|
d = PsEntries[c->daynum];
|
||||||
}
|
|
||||||
|
|
||||||
if (!PsEntries[DayNum]) {
|
|
||||||
PsEntries[DayNum] = c;
|
|
||||||
} else {
|
|
||||||
d = PsEntries[DayNum];
|
|
||||||
p = NULL;
|
p = NULL;
|
||||||
/* Slot it into the right place */
|
/* Slot it into the right place */
|
||||||
while (d->next && (SpecialSortOrder[c->special] <= SpecialSortOrder[d->special])) {
|
while (d->next && (SpecialSortOrder[c->special] <= SpecialSortOrder[d->special])) {
|
||||||
@@ -359,14 +501,12 @@ void DoPsCal(void)
|
|||||||
if (p) {
|
if (p) {
|
||||||
p->next = c;
|
p->next = c;
|
||||||
} else {
|
} else {
|
||||||
PsEntries[DayNum] = c;
|
PsEntries[c->daynum] = c;
|
||||||
}
|
}
|
||||||
c->next = d;
|
c->next = d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcmp(passthru, "*") ||
|
} else {
|
||||||
!strcmp(passthru, "COLOUR") ||
|
|
||||||
!strcmp(passthru, "COLOR")) {
|
|
||||||
/* Put on linked list */
|
/* Put on linked list */
|
||||||
if (!CurEntries) {
|
if (!CurEntries) {
|
||||||
CurEntries = c;
|
CurEntries = c;
|
||||||
@@ -375,10 +515,6 @@ void DoPsCal(void)
|
|||||||
while(d->next) d = d->next;
|
while(d->next) d = d->next;
|
||||||
d->next = c;
|
d->next = c;
|
||||||
}
|
}
|
||||||
if (!strcmp(passthru, "COLOR") ||
|
|
||||||
!strcmp(passthru, "COLOUR")) {
|
|
||||||
c->special = SPECIAL_COLOR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(; CurDay<=days; CurDay++) {
|
for(; CurDay<=days; CurDay++) {
|
||||||
@@ -669,7 +805,8 @@ void Init(int argc, char *argv[])
|
|||||||
char const *s;
|
char const *s;
|
||||||
char const *t;
|
char const *t;
|
||||||
int i=1;
|
int i=1;
|
||||||
int j;
|
size_t j;
|
||||||
|
int k;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
PortraitMode = 1;
|
PortraitMode = 1;
|
||||||
@@ -798,13 +935,13 @@ void Init(int argc, char *argv[])
|
|||||||
|
|
||||||
case 'i': UseISO = 1; break;
|
case 'i': UseISO = 1; break;
|
||||||
|
|
||||||
case 'c': j=(*s);
|
case 'c': k=(*s);
|
||||||
if (!j) {
|
if (!k) {
|
||||||
SmallLocation = SmallCalLoc[0];
|
SmallLocation = SmallCalLoc[0];
|
||||||
} else {
|
} else {
|
||||||
j -= '0';
|
k -= '0';
|
||||||
if (j>=0 && j<NUMSMALL) {
|
if (k>=0 && k<NUMSMALL) {
|
||||||
SmallLocation = SmallCalLoc[j];
|
SmallLocation = SmallCalLoc[k];
|
||||||
} else {
|
} else {
|
||||||
SmallLocation = SmallCalLoc[0];
|
SmallLocation = SmallCalLoc[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Define the PostScript prologue */
|
/* Define the PostScript prologue */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ char *PSProlog1[] =
|
|||||||
{
|
{
|
||||||
"% This file was produced by Remind and Rem2PS, written by",
|
"% This file was produced by Remind and Rem2PS, written by",
|
||||||
"% Dianne Skoll.",
|
"% Dianne Skoll.",
|
||||||
"% Remind and Rem2PS are Copyright 1992-1997 Dianne Skoll.",
|
"% Remind and Rem2PS are Copyright 1992-2020 Dianne Skoll.",
|
||||||
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
|
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
|
||||||
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
|
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
|
||||||
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
|
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Routines for sorting reminders by trigger date */
|
/* Routines for sorting reminders by trigger date */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ void IssueSortedReminders(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_TYPE:
|
case RUN_TYPE:
|
||||||
system(cur->text);
|
System(cur->text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
41
src/token.c
@@ -6,7 +6,7 @@
|
|||||||
/* classifying the tokens parsed. */
|
/* classifying the tokens parsed. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -228,11 +228,11 @@ void FindToken(char const *s, Token *tok)
|
|||||||
/* If language is other than English, search the DayNames[] and MonthNames[]
|
/* If language is other than English, search the DayNames[] and MonthNames[]
|
||||||
array. */
|
array. */
|
||||||
#if LANG != ENGLISH
|
#if LANG != ENGLISH
|
||||||
for (r=0; r<(sizeof(NonEnglishToks) / sizeof(Token)); r++) {
|
for (size_t x=0; x<(sizeof(NonEnglishToks) / sizeof(Token)); x++) {
|
||||||
if (l >= NonEnglishToks[r].MinLen &&
|
if (l >= NonEnglishToks[x].MinLen &&
|
||||||
!TokStrCmp(&NonEnglishToks[r], s)) {
|
!TokStrCmp(&NonEnglishToks[x], s)) {
|
||||||
tok->type = NonEnglishToks[r].type;
|
tok->type = NonEnglishToks[x].type;
|
||||||
tok->val = NonEnglishToks[r].val;
|
tok->val = NonEnglishToks[x].val;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,6 +257,7 @@ void FindNumericToken(char const *s, Token *t)
|
|||||||
{
|
{
|
||||||
int mult = 1, hour, min;
|
int mult = 1, hour, min;
|
||||||
char const *s_orig = s;
|
char const *s_orig = s;
|
||||||
|
int ampm = 0;
|
||||||
|
|
||||||
t->type = T_Illegal;
|
t->type = T_Illegal;
|
||||||
t->val = 0;
|
t->val = 0;
|
||||||
@@ -284,10 +285,6 @@ void FindNumericToken(char const *s, Token *t)
|
|||||||
like Jan 6, 1998 */
|
like Jan 6, 1998 */
|
||||||
if (*s == ',') {
|
if (*s == ',') {
|
||||||
s++;
|
s++;
|
||||||
/* Special hack - convert years between 90 and
|
|
||||||
99 to 1990 and 1999 */
|
|
||||||
if (t->val >= 90 && t->val <= 99) t->val += 1900;
|
|
||||||
|
|
||||||
/* Classify the number we've got */
|
/* Classify the number we've got */
|
||||||
if (t->val >= BASE && t->val <= BASE+YR_RANGE) t->type = T_Year;
|
if (t->val >= BASE && t->val <= BASE+YR_RANGE) t->type = T_Year;
|
||||||
else if (t->val >= 1 && t->val <= 31) t->type = T_Day;
|
else if (t->val >= 1 && t->val <= 31) t->type = T_Day;
|
||||||
@@ -299,7 +296,29 @@ void FindNumericToken(char const *s, Token *t)
|
|||||||
s++;
|
s++;
|
||||||
hour = t->val;
|
hour = t->val;
|
||||||
PARSENUM(min, s);
|
PARSENUM(min, s);
|
||||||
if (*s || min > 59) return; /* Illegal time */
|
if (min > 59) return; /* Illegal time */
|
||||||
|
/* Check for p[m] or a[m] */
|
||||||
|
if (*s == 'A' || *s == 'a' || *s == 'P' || *s == 'p') {
|
||||||
|
ampm = tolower(*s);
|
||||||
|
s++;
|
||||||
|
if (*s == 'm' || *s == 'M') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*s) return; /* Illegal time */
|
||||||
|
if (ampm) {
|
||||||
|
if (hour < 1 || hour > 12) return;
|
||||||
|
if (ampm == 'a') {
|
||||||
|
if (hour == 12) {
|
||||||
|
hour = 0;
|
||||||
|
}
|
||||||
|
} else if (ampm == 'p') {
|
||||||
|
if (hour < 12) {
|
||||||
|
hour += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
t->val = hour*60 + min; /* Convert to minutes past midnight */
|
t->val = hour*60 + min; /* Convert to minutes past midnight */
|
||||||
if (hour <= 23) {
|
if (hour <= 23) {
|
||||||
t->type = T_Time;
|
t->type = T_Time;
|
||||||
|
|||||||
170
src/trigger.c
@@ -5,7 +5,7 @@
|
|||||||
/* Routines for figuring out the trigger date of a reminder */
|
/* Routines for figuring out the trigger date of a reminder */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -408,6 +408,57 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
|
|||||||
return simple;
|
return simple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||||
|
{
|
||||||
|
int y, m, d;
|
||||||
|
/* If we have an AT, save the original event start */
|
||||||
|
if (tim->ttime != NO_TIME) {
|
||||||
|
trig->eventstart = MINUTES_PER_DAY * r + tim->ttime;
|
||||||
|
if (tim->duration != NO_TIME) {
|
||||||
|
trig->eventduration = tim->duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now potentially adjust */
|
||||||
|
if (r < today && r + trig->duration_days >= today) {
|
||||||
|
/* Adjust duration down */
|
||||||
|
tim->duration -= (today - r) * MINUTES_PER_DAY;
|
||||||
|
tim->duration += tim->ttime;
|
||||||
|
|
||||||
|
/* Start at midnight */
|
||||||
|
tim->ttime = 0;
|
||||||
|
|
||||||
|
/* Change trigger date to today */
|
||||||
|
r = today;
|
||||||
|
if (DebugFlag & DB_PRTTRIG) {
|
||||||
|
FromJulian(r, &y, &m, &d);
|
||||||
|
fprintf(ErrFp, "%s(%d): Trig(adj) = %s, %d %s, %d",
|
||||||
|
FileName, LineNo,
|
||||||
|
DayName[r % 7],
|
||||||
|
d,
|
||||||
|
MonthName[m],
|
||||||
|
y);
|
||||||
|
if (tim->ttime != NO_TIME) {
|
||||||
|
fprintf(ErrFp, " AT %02d:%02d",
|
||||||
|
(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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (save_in_globals) {
|
||||||
|
SaveAllTriggerInfo(trig, tim, r, tim->ttime, 1);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ComputeTrigger */
|
/* ComputeTrigger */
|
||||||
@@ -416,10 +467,49 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
|
|||||||
/* today's date. */
|
/* today's date. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
|
int ComputeTrigger(int today, Trigger *trig, TimeTrig *tim,
|
||||||
|
int *err, int save_in_globals)
|
||||||
|
{
|
||||||
|
int r = ComputeTriggerNoAdjustDuration(today, trig, tim, err, save_in_globals, 0);
|
||||||
|
if (*err != OK) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
if (r == today) {
|
||||||
|
if (tim->ttime != NO_TIME) {
|
||||||
|
trig->eventstart = MINUTES_PER_DAY * r + tim->ttime;
|
||||||
|
if (tim->duration != NO_TIME) {
|
||||||
|
trig->eventduration = tim->duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (save_in_globals) {
|
||||||
|
SaveAllTriggerInfo(trig, tim, r, tim->ttime, 1);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trig->duration_days) {
|
||||||
|
r = ComputeTriggerNoAdjustDuration(today, trig, tim, err, save_in_globals, trig->duration_days);
|
||||||
|
if (*err != OK) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r = AdjustTriggerForDuration(today, r, trig, tim, save_in_globals);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* ComputeTriggerNoAdjustDuration */
|
||||||
|
/* */
|
||||||
|
/* Compute a trigger, but do NOT adjust the time trigger */
|
||||||
|
/* duration. */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
|
||||||
|
int *err, int save_in_globals, int duration_days)
|
||||||
{
|
{
|
||||||
int nattempts = 0,
|
int nattempts = 0,
|
||||||
start = today,
|
start = today - duration_days,
|
||||||
nextstart = 0,
|
nextstart = 0,
|
||||||
y, m, d, omit,
|
y, m, d, omit,
|
||||||
result;
|
result;
|
||||||
@@ -429,15 +519,25 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
|
|||||||
LastTrigValid = 0;
|
LastTrigValid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assume everything works */
|
/* Assume everything works */
|
||||||
*err = OK;
|
*err = OK;
|
||||||
|
|
||||||
/* But check for obvious problems... */
|
/* But check for obvious problems... */
|
||||||
if (trig->localomit == 1 + 2 + 4 + 8 + 16 + 32 + 64) {
|
if (trig->localomit == 1 + 2 + 4 + 8 + 16 + 32 + 64) {
|
||||||
*err = E_2MANY_LOCALOMIT;
|
*err = E_2MANY_LOCALOMIT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (start < 0) {
|
||||||
|
*err = E_DATE_OVER;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tim->duration != NO_TIME && tim->ttime == NO_TIME) {
|
||||||
|
*err = E_DURATION_NO_AT;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (trig->rep != NO_REP &&
|
if (trig->rep != NO_REP &&
|
||||||
(trig->d == NO_DAY ||
|
(trig->d == NO_DAY ||
|
||||||
trig->m == NO_MON ||
|
trig->m == NO_MON ||
|
||||||
@@ -448,6 +548,11 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Save the trigger */
|
||||||
|
if (save_in_globals) {
|
||||||
|
SaveLastTrigger(trig);
|
||||||
|
}
|
||||||
|
|
||||||
while (nattempts++ < TRIG_ATTEMPTS) {
|
while (nattempts++ < TRIG_ATTEMPTS) {
|
||||||
result = GetNextTriggerDate(trig, start, err, &nextstart);
|
result = GetNextTriggerDate(trig, start, err, &nextstart);
|
||||||
|
|
||||||
@@ -469,7 +574,9 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
|
|||||||
} else {
|
} else {
|
||||||
omit = 0;
|
omit = 0;
|
||||||
}
|
}
|
||||||
if (result >= today &&
|
|
||||||
|
/** FIXME: Fix bad interaction with SATISFY... need to rethink!!! */
|
||||||
|
if (result+duration_days >= today &&
|
||||||
(trig->skip != SKIP_SKIP || !omit)) {
|
(trig->skip != SKIP_SKIP || !omit)) {
|
||||||
if (save_in_globals) {
|
if (save_in_globals) {
|
||||||
LastTriggerDate = result; /* Save in global var */
|
LastTriggerDate = result; /* Save in global var */
|
||||||
@@ -477,12 +584,23 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
|
|||||||
}
|
}
|
||||||
if (DebugFlag & DB_PRTTRIG) {
|
if (DebugFlag & DB_PRTTRIG) {
|
||||||
FromJulian(result, &y, &m, &d);
|
FromJulian(result, &y, &m, &d);
|
||||||
fprintf(ErrFp, "%s(%d): Trig = %s, %d %s, %d\n",
|
fprintf(ErrFp, "%s(%d): Trig = %s, %d %s, %d",
|
||||||
FileName, LineNo,
|
FileName, LineNo,
|
||||||
DayName[result % 7],
|
DayName[result % 7],
|
||||||
d,
|
d,
|
||||||
MonthName[m],
|
MonthName[m],
|
||||||
y);
|
y);
|
||||||
|
if (tim->ttime != NO_TIME) {
|
||||||
|
fprintf(ErrFp, " AT %02d:%02d",
|
||||||
|
(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 result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -535,3 +653,41 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
|
|||||||
*err = E_CANT_TRIG;
|
*err = E_CANT_TRIG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* ComputeScanStart */
|
||||||
|
/* */
|
||||||
|
/* Figure out where to start scan from by examining SCANFROM */
|
||||||
|
/* and DURATION */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
int
|
||||||
|
ComputeScanStart(int today, Trigger *trig, TimeTrig *tt)
|
||||||
|
{
|
||||||
|
int minutes, days;
|
||||||
|
|
||||||
|
/* If we don't have a time/duration, just use scanfrom */
|
||||||
|
if (tt->ttime == NO_TIME ||
|
||||||
|
tt->duration == NO_TIME) {
|
||||||
|
if (trig->scanfrom == NO_DATE) {
|
||||||
|
return today;
|
||||||
|
}
|
||||||
|
return trig->scanfrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calculate time-based SCANFROM */
|
||||||
|
minutes = tt->ttime + tt->duration - 1;
|
||||||
|
|
||||||
|
/* Figure out how many days to scan backwards from */
|
||||||
|
days = minutes / MINUTES_PER_DAY;
|
||||||
|
|
||||||
|
if (trig->scanfrom != NO_DATE) {
|
||||||
|
if (trig->scanfrom <= today - days) {
|
||||||
|
return trig->scanfrom;
|
||||||
|
} else {
|
||||||
|
return today - days;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return today - days;
|
||||||
|
}
|
||||||
|
|||||||
31
src/types.h
@@ -5,7 +5,7 @@
|
|||||||
/* Type definitions all dumped here. */
|
/* Type definitions all dumped here. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -68,7 +68,11 @@ typedef struct {
|
|||||||
int typ;
|
int typ;
|
||||||
int once;
|
int once;
|
||||||
int scanfrom;
|
int scanfrom;
|
||||||
|
int from;
|
||||||
int priority;
|
int priority;
|
||||||
|
int duration_days; /* Duration converted to days to search */
|
||||||
|
int eventstart; /* Original event start (datetime) */
|
||||||
|
int eventduration; /* Original event duration (minutes) */
|
||||||
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
|
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
|
||||||
char warn[VAR_NAME_LEN+1]; /* Warning function */
|
char warn[VAR_NAME_LEN+1]; /* Warning function */
|
||||||
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
|
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
|
||||||
@@ -87,16 +91,16 @@ typedef struct {
|
|||||||
|
|
||||||
/* The parse pointer */
|
/* The parse pointer */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char isnested; /* Is it a nested expression? */
|
DynamicBuffer pushedToken; /* Pushed-back token */
|
||||||
char allownested;
|
|
||||||
char const *text; /* Start of text */
|
char const *text; /* Start of text */
|
||||||
char const *pos; /* Current position */
|
char const *pos; /* Current position */
|
||||||
char const *etext; /* Substituted text */
|
char const *etext; /* Substituted text */
|
||||||
char const *epos; /* Position in substituted text */
|
char const *epos; /* Position in substituted text */
|
||||||
DynamicBuffer pushedToken; /* Pushed-back token */
|
|
||||||
char const *tokenPushed; /* NULL if no pushed-back token */
|
char const *tokenPushed; /* NULL if no pushed-back token */
|
||||||
char expr_happened; /* Did we encounter an [expression] ? */
|
unsigned char isnested; /* Is it a nested expression? */
|
||||||
char nonconst_expr; /* Did we encounter a non-constant [expression] ? */
|
unsigned char allownested;
|
||||||
|
unsigned char expr_happened; /* Did we encounter an [expression] ? */
|
||||||
|
unsigned char nonconst_expr; /* Did we encounter a non-constant [expression] ? */
|
||||||
} Parser;
|
} Parser;
|
||||||
|
|
||||||
typedef Parser *ParsePtr; /* Pointer to parser structure */
|
typedef Parser *ParsePtr; /* Pointer to parser structure */
|
||||||
@@ -212,3 +216,18 @@ typedef struct {
|
|||||||
/* Flags for FROM / SCANFROM */
|
/* Flags for FROM / SCANFROM */
|
||||||
#define SCANFROM_TYPE 0
|
#define SCANFROM_TYPE 0
|
||||||
#define FROM_TYPE 1
|
#define FROM_TYPE 1
|
||||||
|
|
||||||
|
/* PS Calendar levels */
|
||||||
|
|
||||||
|
/* Original interchange format */
|
||||||
|
#define PSCAL_LEVEL1 1
|
||||||
|
|
||||||
|
/* Line-by-line JSON */
|
||||||
|
#define PSCAL_LEVEL2 2
|
||||||
|
|
||||||
|
/* Pure JSON */
|
||||||
|
#define PSCAL_LEVEL3 3
|
||||||
|
|
||||||
|
#define TERMINAL_BACKGROUND_UNKNOWN 0
|
||||||
|
#define TERMINAL_BACKGROUND_DARK 1
|
||||||
|
#define TERMINAL_BACKGROUND_LIGHT 2
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* functions. */
|
/* functions. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -64,6 +64,7 @@ int DoFset(ParsePtr p)
|
|||||||
int c;
|
int c;
|
||||||
UserFunc *func;
|
UserFunc *func;
|
||||||
Var *v;
|
Var *v;
|
||||||
|
int orig_namelen;
|
||||||
|
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
@@ -74,6 +75,7 @@ int DoFset(ParsePtr p)
|
|||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
return E_BAD_ID;
|
return E_BAD_ID;
|
||||||
}
|
}
|
||||||
|
orig_namelen = buf.len;
|
||||||
|
|
||||||
/* Should be followed by '(' */
|
/* Should be followed by '(' */
|
||||||
c = ParseNonSpaceChar(p, &r, 0);
|
c = ParseNonSpaceChar(p, &r, 0);
|
||||||
@@ -94,9 +96,8 @@ int DoFset(ParsePtr p)
|
|||||||
StrnCpy(func->name, DBufValue(&buf), VAR_NAME_LEN);
|
StrnCpy(func->name, DBufValue(&buf), VAR_NAME_LEN);
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (!Hush) {
|
if (!Hush) {
|
||||||
if (FindFunc(DBufValue(&buf), Func, NumFuncs)) {
|
if (FindFunc(func->name, Func, NumFuncs)) {
|
||||||
Eprint("%s: `%s'", ErrMsg[E_REDEF_FUNC],
|
Eprint("%s: `%s'", ErrMsg[E_REDEF_FUNC], func->name);
|
||||||
DBufValue(&buf));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func->locals = NULL;
|
func->locals = NULL;
|
||||||
@@ -118,6 +119,7 @@ int DoFset(ParsePtr p)
|
|||||||
if ( (r=ParseIdentifier(p, &buf)) ) return r;
|
if ( (r=ParseIdentifier(p, &buf)) ) return r;
|
||||||
if (*DBufValue(&buf) == '$') {
|
if (*DBufValue(&buf) == '$') {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
|
DestroyUserFunc(func);
|
||||||
return E_BAD_ID;
|
return E_BAD_ID;
|
||||||
}
|
}
|
||||||
v = NEW(Var);
|
v = NEW(Var);
|
||||||
@@ -164,6 +166,10 @@ int DoFset(ParsePtr p)
|
|||||||
|
|
||||||
/* Add the function definition */
|
/* Add the function definition */
|
||||||
FSet(func);
|
FSet(func);
|
||||||
|
if (orig_namelen > VAR_NAME_LEN) {
|
||||||
|
Eprint("Warning: Function name `%s...' truncated to `%s'",
|
||||||
|
func->name, func->name);
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +279,7 @@ int CallUserFunc(char const *name, int nargs, ParsePtr p)
|
|||||||
}
|
}
|
||||||
return E_RECURSIVE;
|
return E_RECURSIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check number of args */
|
/* Check number of args */
|
||||||
if (nargs != f->nargs) {
|
if (nargs != f->nargs) {
|
||||||
if (DebugFlag &DB_PRTEXPR) {
|
if (DebugFlag &DB_PRTEXPR) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
/* Useful utility functions. */
|
/* Useful utility functions. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
|||||||
60
src/var.c
@@ -6,7 +6,7 @@
|
|||||||
/* user- and system-defined variables. */
|
/* user- and system-defined variables. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-2018 by Dianne Skoll */
|
/* Copyright (C) 1992-2020 by Dianne Skoll */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ typedef int (*SysVarFunc)(int, Value *);
|
|||||||
|
|
||||||
static int trig_date_func(int do_set, Value *val)
|
static int trig_date_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = DATE_TYPE;
|
val->type = DATE_TYPE;
|
||||||
if (!LastTrigValid) {
|
if (!LastTrigValid) {
|
||||||
val->v.val = 0;
|
val->v.val = 0;
|
||||||
@@ -48,6 +49,7 @@ static int trig_date_func(int do_set, Value *val)
|
|||||||
static int trig_day_func(int do_set, Value *val)
|
static int trig_day_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
if (!LastTrigValid) {
|
if (!LastTrigValid) {
|
||||||
val->v.val = -1;
|
val->v.val = -1;
|
||||||
@@ -62,6 +64,7 @@ static int trig_day_func(int do_set, Value *val)
|
|||||||
static int trig_mon_func(int do_set, Value *val)
|
static int trig_mon_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
if (!LastTrigValid) {
|
if (!LastTrigValid) {
|
||||||
val->v.val = -1;
|
val->v.val = -1;
|
||||||
@@ -76,6 +79,7 @@ static int trig_mon_func(int do_set, Value *val)
|
|||||||
static int trig_year_func(int do_set, Value *val)
|
static int trig_year_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
if (!LastTrigValid) {
|
if (!LastTrigValid) {
|
||||||
val->v.val = -1;
|
val->v.val = -1;
|
||||||
@@ -90,6 +94,7 @@ static int trig_year_func(int do_set, Value *val)
|
|||||||
static int trig_wday_func(int do_set, Value *val)
|
static int trig_wday_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
|
UNUSED(do_set);
|
||||||
if (!LastTrigValid) {
|
if (!LastTrigValid) {
|
||||||
val->v.val = -1;
|
val->v.val = -1;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -101,6 +106,7 @@ static int trig_wday_func(int do_set, Value *val)
|
|||||||
|
|
||||||
static int today_date_func(int do_set, Value *val)
|
static int today_date_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = DATE_TYPE;
|
val->type = DATE_TYPE;
|
||||||
val->v.val = JulianToday;
|
val->v.val = JulianToday;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -108,6 +114,7 @@ static int today_date_func(int do_set, Value *val)
|
|||||||
static int today_day_func(int do_set, Value *val)
|
static int today_day_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
FromJulian(JulianToday, &y, &m, &d);
|
FromJulian(JulianToday, &y, &m, &d);
|
||||||
val->v.val = d;
|
val->v.val = d;
|
||||||
@@ -117,6 +124,7 @@ static int today_day_func(int do_set, Value *val)
|
|||||||
static int today_mon_func(int do_set, Value *val)
|
static int today_mon_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
FromJulian(JulianToday, &y, &m, &d);
|
FromJulian(JulianToday, &y, &m, &d);
|
||||||
val->v.val = m+1;
|
val->v.val = m+1;
|
||||||
@@ -126,6 +134,7 @@ static int today_mon_func(int do_set, Value *val)
|
|||||||
static int today_year_func(int do_set, Value *val)
|
static int today_year_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
FromJulian(JulianToday, &y, &m, &d);
|
FromJulian(JulianToday, &y, &m, &d);
|
||||||
val->v.val = y;
|
val->v.val = y;
|
||||||
@@ -134,6 +143,7 @@ static int today_year_func(int do_set, Value *val)
|
|||||||
|
|
||||||
static int today_wday_func(int do_set, Value *val)
|
static int today_wday_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
|
UNUSED(do_set);
|
||||||
val->type = INT_TYPE;
|
val->type = INT_TYPE;
|
||||||
val->v.val = (JulianToday + 1) % 7;
|
val->v.val = (JulianToday + 1) % 7;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -158,6 +168,45 @@ static int datetime_sep_func(int do_set, Value *val)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int default_color_func(int do_set, Value *val)
|
||||||
|
{
|
||||||
|
int col_r, col_g, col_b;
|
||||||
|
if (!do_set) {
|
||||||
|
/* 12 = strlen("255 255 255\0") */
|
||||||
|
val->v.str = malloc(12);
|
||||||
|
if (!val->v.str) return E_NO_MEM;
|
||||||
|
snprintf(val->v.str, 12, "%d %d %d",
|
||||||
|
DefaultColorR,
|
||||||
|
DefaultColorG,
|
||||||
|
DefaultColorB
|
||||||
|
);
|
||||||
|
val->type = STR_TYPE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||||
|
if (sscanf(val->v.str, "%d %d %d", &col_r, &col_g, &col_b) != 3) {
|
||||||
|
return E_BAD_TYPE;
|
||||||
|
}
|
||||||
|
/* They either all have to be -1, or all between 0 and 255 */
|
||||||
|
if (col_r == -1 && col_g == -1 && col_b == -1) {
|
||||||
|
DefaultColorR = -1;
|
||||||
|
DefaultColorG = -1;
|
||||||
|
DefaultColorB = -1;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
if (col_r < 0) return E_2LOW;
|
||||||
|
if (col_r > 255) return E_2HIGH;
|
||||||
|
if (col_g < 0) return E_2LOW;
|
||||||
|
if (col_g > 255) return E_2HIGH;
|
||||||
|
if (col_b < 0) return E_2LOW;
|
||||||
|
if (col_b > 255) return E_2HIGH;
|
||||||
|
|
||||||
|
DefaultColorR = col_r;
|
||||||
|
DefaultColorG = col_g;
|
||||||
|
DefaultColorB = col_b;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int date_sep_func(int do_set, Value *val)
|
static int date_sep_func(int do_set, Value *val)
|
||||||
{
|
{
|
||||||
if (!do_set) {
|
if (!do_set) {
|
||||||
@@ -360,6 +409,10 @@ int DoSet (Parser *p)
|
|||||||
|
|
||||||
if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v);
|
if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v);
|
||||||
else r = SetVar(DBufValue(&buf), &v);
|
else r = SetVar(DBufValue(&buf), &v);
|
||||||
|
if (buf.len > VAR_NAME_LEN) {
|
||||||
|
Eprint("Warning: Variable name `%.*s...' truncated to `%.*s'",
|
||||||
|
VAR_NAME_LEN, DBufValue(&buf), VAR_NAME_LEN, DBufValue(&buf));
|
||||||
|
}
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -594,6 +647,7 @@ static SysVar SysVarArr[] = {
|
|||||||
{"Daemon", 0, INT_TYPE, &Daemon, 0, 0 },
|
{"Daemon", 0, INT_TYPE, &Daemon, 0, 0 },
|
||||||
{"DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0 },
|
{"DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0 },
|
||||||
{"DateTimeSep", 1, SPECIAL_TYPE, datetime_sep_func, 0, 0 },
|
{"DateTimeSep", 1, SPECIAL_TYPE, datetime_sep_func, 0, 0 },
|
||||||
|
{"DefaultColor", 1, SPECIAL_TYPE, default_color_func, 0, 0 },
|
||||||
{"DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999},
|
{"DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999},
|
||||||
{"DeltaOffset", 0, INT_TYPE, &DeltaOffset, 0, 0 },
|
{"DeltaOffset", 0, INT_TYPE, &DeltaOffset, 0, 0 },
|
||||||
{"DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
|
{"DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
|
||||||
@@ -603,7 +657,7 @@ static SysVar SysVarArr[] = {
|
|||||||
{"EndSentIg", 1, STR_TYPE, &EndSentIg, 0, 0 },
|
{"EndSentIg", 1, STR_TYPE, &EndSentIg, 0, 0 },
|
||||||
{"FirstIndent", 1, INT_TYPE, &FirstIndent, 0, 132 },
|
{"FirstIndent", 1, INT_TYPE, &FirstIndent, 0, 132 },
|
||||||
{"FoldYear", 1, INT_TYPE, &FoldYear, 0, 1 },
|
{"FoldYear", 1, INT_TYPE, &FoldYear, 0, 1 },
|
||||||
{"FormWidth", 1, INT_TYPE, &FormWidth, 20, 132 },
|
{"FormWidth", 1, INT_TYPE, &FormWidth, 20, 500 },
|
||||||
{"HushMode", 0, INT_TYPE, &Hush, 0, 0 },
|
{"HushMode", 0, INT_TYPE, &Hush, 0, 0 },
|
||||||
{"IgnoreOnce", 0, INT_TYPE, &IgnoreOnce, 0, 0 },
|
{"IgnoreOnce", 0, INT_TYPE, &IgnoreOnce, 0, 0 },
|
||||||
{"InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0 },
|
{"InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0 },
|
||||||
@@ -748,7 +802,7 @@ static SysVar *FindSysVar(char const *name)
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void DumpSysVarByName(char const *name)
|
void DumpSysVarByName(char const *name)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
SysVar *v;
|
SysVar *v;
|
||||||
|
|
||||||
if (!name || !*name) {
|
if (!name || !*name) {
|
||||||
|
|||||||
8
sync-to-dianne-git
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd /home/dfs/Software/Remind.git || exit 1
|
||||||
|
|
||||||
|
rm -f .git/COMMIT_EDITMSG .git/*~
|
||||||
|
|
||||||
|
git update-server-info && cd .git && rsync --archive --verbose --progress --delete ./ dianne.skoll.ca:web/projects/remind/git/Remind.git/
|
||||||
|
exit $?
|
||||||
|
|
||||||
@@ -28,3 +28,5 @@ REM Fri SPECIAL SHADE 255 204 204
|
|||||||
REM Sat SPECIAL SHADE 204 255 204
|
REM Sat SPECIAL SHADE 204 255 204
|
||||||
REM Sun SPECIAL SHADE 204 204 255
|
REM Sun SPECIAL SHADE 204 204 255
|
||||||
|
|
||||||
|
# This should be ignored by rem2ps
|
||||||
|
REM SPECIAL HTML <b>FOO</b>
|
||||||
|
|||||||
189
tests/test-rem
@@ -79,6 +79,7 @@ rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
|
|||||||
../src/remind ../tests/runtest.rem >> ../tests/test.out 2>&1
|
../src/remind ../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 -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
|
||||||
|
|
||||||
# The sun tests can fail due to math roundoff error changing the times
|
# The sun tests can fail due to math roundoff error changing the times
|
||||||
# by a minute...
|
# by a minute...
|
||||||
@@ -99,6 +100,194 @@ REM 1 Jan 2012 AT 10:00 MSG 10am: Should show up
|
|||||||
MSG [$DontTrigAts]
|
MSG [$DontTrigAts]
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# An OMITFUNC should indicate nonconst_expr
|
||||||
|
../src/remind -pp - 1 jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
REM Mon OMITFUNC foo MSG bar
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Test default color
|
||||||
|
../src/remind -ppp - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
REM 2 MSG Normal
|
||||||
|
SET $DefaultColor "255 0 0"
|
||||||
|
REM 3 MSG Red
|
||||||
|
SET $DefaultColor "-1 -1 -1"
|
||||||
|
REM 4 MSG Normal
|
||||||
|
# Should give an error
|
||||||
|
SET $DefaultColor "256 0 0"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Test -@ option
|
||||||
|
../src/remind -w,0,0 -@0 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@0
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@0,0
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@0,1
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@1
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@1,0
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@1,1
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@2
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@2,0
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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
|
||||||
|
rem 1 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 2 SPECIAL COLOR 0 0 65 BLUE
|
||||||
|
rem 3 SPECIAL COLOR 0 65 0 GREEN
|
||||||
|
rem 4 SPECIAL COLOR 0 65 65 CYAN
|
||||||
|
rem 5 msg -@2,1
|
||||||
|
rem 15 SPECIAL COLOR 65 0 0 RED
|
||||||
|
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
|
||||||
|
rem 17 SPECIAL COLOR 65 65 0 YELLOW
|
||||||
|
rem 18 SPECIAL COLOR 65 65 65 WHITE
|
||||||
|
rem 8 SPECIAL COLOR 0 0 0 BLACK
|
||||||
|
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
|
||||||
|
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
|
||||||
|
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
|
||||||
|
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
|
||||||
|
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
|
||||||
|
|
||||||
cmp -s ../tests/test.out ../tests/test.cmp
|
cmp -s ../tests/test.out ../tests/test.cmp
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
|
|||||||
2411
tests/test.cmp
216
tests/test.rem
@@ -5,6 +5,9 @@
|
|||||||
#
|
#
|
||||||
# ./test-rem # From WITHIN Remind source directory!
|
# ./test-rem # From WITHIN Remind source directory!
|
||||||
|
|
||||||
|
# Should issue a warning
|
||||||
|
fset year(x) 1
|
||||||
|
|
||||||
# Don't evaluate SATISFY expressions if reminder has expired
|
# Don't evaluate SATISFY expressions if reminder has expired
|
||||||
|
|
||||||
REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie
|
REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie
|
||||||
@@ -169,6 +172,10 @@ REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
|
|||||||
OMIT [trigger(trigdate())]
|
OMIT [trigger(trigdate())]
|
||||||
REM Fri after MSG 16 Feb 1991
|
REM Fri after MSG 16 Feb 1991
|
||||||
CLEAR-OMIT-CONTEXT
|
CLEAR-OMIT-CONTEXT
|
||||||
|
REM Fri SCANFROM -7 SATISFY 1
|
||||||
|
OMIT [trigger(trigdate())]
|
||||||
|
REM Fri after MSG 16 Feb 1991
|
||||||
|
CLEAR-OMIT-CONTEXT
|
||||||
|
|
||||||
# Test omitfunc
|
# Test omitfunc
|
||||||
fset _ofunc(x) (day(x) < 7 || day(x) % 2)
|
fset _ofunc(x) (day(x) < 7 || day(x) % 2)
|
||||||
@@ -306,6 +313,69 @@ set a082 slide('1991-03-01', 7, "Sat", "Sun")
|
|||||||
set a083 slide('1991-04-01', -7, "Sat")
|
set a083 slide('1991-04-01', -7, "Sat")
|
||||||
set a084 nonomitted('1991-03-01', '1991-03-13', "Sat", "Sun")
|
set a084 nonomitted('1991-03-01', '1991-03-13', "Sat", "Sun")
|
||||||
set a085 nonomitted('1991-03-24', '1991-04-01', "Sat")
|
set a085 nonomitted('1991-03-24', '1991-04-01', "Sat")
|
||||||
|
REM 2010-09-03 +3 -4 UNTIL 2012-01-01 PRIORITY 7 *14 MSG foo
|
||||||
|
set a086 trigback()
|
||||||
|
set a087 trigdelta()
|
||||||
|
set a088 trigrep()
|
||||||
|
set a089 triguntil()
|
||||||
|
set a090 trigscanfrom()
|
||||||
|
set a091 trigfrom()
|
||||||
|
set a092 trigpriority()
|
||||||
|
set a093 trigtimedelta()
|
||||||
|
set a094 trigtimerep()
|
||||||
|
set a095 trigduration()
|
||||||
|
|
||||||
|
REM Mon Wed FROM 2010-09-03 ++3 --4 MSG foo
|
||||||
|
set a096 trigback()
|
||||||
|
set a097 trigdelta()
|
||||||
|
set a098 trigrep()
|
||||||
|
set a099 triguntil()
|
||||||
|
set a100 trigscanfrom()
|
||||||
|
set a101 trigfrom()
|
||||||
|
set a102 trigpriority()
|
||||||
|
set a103 trigtimedelta()
|
||||||
|
set a104 trigtimerep()
|
||||||
|
set a105 trigduration()
|
||||||
|
|
||||||
|
REM 2010-09-03 +3 -4 UNTIL 2012-01-01 PRIORITY 7 *14 AT 14:41 +15 *2 DURATION 213 MSG foo
|
||||||
|
set a106 trigback()
|
||||||
|
set a107 trigdelta()
|
||||||
|
set a108 trigrep()
|
||||||
|
set a109 triguntil()
|
||||||
|
set a110 trigscanfrom()
|
||||||
|
set a111 trigfrom()
|
||||||
|
set a112 trigpriority()
|
||||||
|
set a113 trigtimedelta()
|
||||||
|
set a114 trigtimerep()
|
||||||
|
set a115 trigduration()
|
||||||
|
|
||||||
|
REM Mon Wed FROM 2010-09-03 ++3 --4 AT 14:44 MSG foo
|
||||||
|
set a116 trigback()
|
||||||
|
set a117 trigdelta()
|
||||||
|
set a118 trigrep()
|
||||||
|
set a119 triguntil()
|
||||||
|
set a120 trigscanfrom()
|
||||||
|
set a121 trigfrom()
|
||||||
|
set a122 trigpriority()
|
||||||
|
set a123 trigtimedelta()
|
||||||
|
set a124 trigtimerep()
|
||||||
|
set a125 trigduration()
|
||||||
|
|
||||||
|
# Test adding TIME+TIME and DATETIME+TIME
|
||||||
|
set a126 11:00 + 3:00
|
||||||
|
set a127 23:00 + 5:30
|
||||||
|
set a128 '2018-02-03@10:00' + 6:45
|
||||||
|
set a129 23:30 + '2019-02-02@16:44'
|
||||||
|
|
||||||
|
# Multi-day reminder
|
||||||
|
REM 13 AT 16:00 DURATION 72:00 MSG 72-hour event
|
||||||
|
set a130 trigdate()
|
||||||
|
set a131 trigtime()
|
||||||
|
set a132 trigdatetime()
|
||||||
|
set a133 trigduration()
|
||||||
|
set a134 trigeventstart()
|
||||||
|
set a135 trigeventduration()
|
||||||
|
|
||||||
dump
|
dump
|
||||||
dump $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
dump $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
OMIT 2010-09-03 THROUGH 2010-09-15
|
OMIT 2010-09-03 THROUGH 2010-09-15
|
||||||
@@ -313,7 +383,153 @@ OMIT December 25 MSG X
|
|||||||
# Next should give a parse error
|
# Next should give a parse error
|
||||||
OMIT 26 Dec 2010 THROUGH 27 Dec 2010 MSG This is not legal
|
OMIT 26 Dec 2010 THROUGH 27 Dec 2010 MSG This is not legal
|
||||||
OMIT DUMP
|
OMIT DUMP
|
||||||
|
# Regression test for bugfix in Hebrew calendar Adar jahrzeit
|
||||||
|
[_i(14, "Adar", today(), 5761)] MSG Purim
|
||||||
|
|
||||||
|
# Regression test for bug found by Larry Hynes
|
||||||
|
REM SATISFY [day(trigdate()-25) == 14] MSG Foo
|
||||||
|
|
||||||
|
# Check combo of SATISFY and long-duration events
|
||||||
|
REM 14 SATISFY [$Tw == 4] MSG Thursday, the 14th
|
||||||
|
REM 14 AT 16:00 DURATION 8:00 SATISFY [$Tw == 4] MSG Thursday, the 14th
|
||||||
|
REM 14 AT 16:00 DURATION 8:01 SATISFY [$Tw == 4] MSG Thursday, the 14th
|
||||||
|
REM 14 AT 16:00 DURATION 32:00 SATISFY [$Tw == 4] MSG Thursday, the 14th
|
||||||
|
REM 14 AT 16:00 DURATION 32:01 SATISFY [$Tw == 4] MSG Thursday, the 14th
|
||||||
|
REM 14 AT 16:00 DURATION 40:00 SATISFY [$Tw == 4] MSG Thursday, the 14th
|
||||||
|
|
||||||
|
# This is now an error
|
||||||
|
REM DURATION 15:00 MSG Should fail... need AT if you have DURATION.
|
||||||
|
|
||||||
|
# Parsing of AM/PM times
|
||||||
|
REM AT 0:00am MSG foo 0a
|
||||||
|
REM AT 1:00AM MSG foo 1a
|
||||||
|
REM AT 2:00am MSG foo 2a
|
||||||
|
REM AT 3:00AM MSG foo 3a
|
||||||
|
REM AT 4:00am MSG foo 4a
|
||||||
|
REM AT 5:00AM MSG foo 5a
|
||||||
|
REM AT 6:00am MSG foo 6a
|
||||||
|
REM AT 7:00AM MSG foo 7a
|
||||||
|
REM AT 8:00am MSG foo 8a
|
||||||
|
REM AT 9:00AM MSG foo 9a
|
||||||
|
REM AT 10:00am MSG foo 10a
|
||||||
|
REM AT 11:00AM MSG foo 11a
|
||||||
|
REM AT 12:00am MSG foo 12a
|
||||||
|
REM AT 13:00AM MSG foo 13a
|
||||||
|
REM AT 0:00pm MSG foo 0p
|
||||||
|
REM AT 1:00PM MSG foo 1p
|
||||||
|
REM AT 2:00pm MSG foo 2p
|
||||||
|
REM AT 3:00PM MSG foo 3p
|
||||||
|
REM AT 4:00pm MSG foo 4p
|
||||||
|
REM AT 5:00PM MSG foo 5p
|
||||||
|
REM AT 6:00pm MSG foo 6p
|
||||||
|
REM AT 7:00PM MSG foo 7p
|
||||||
|
REM AT 8:00pm MSG foo 8p
|
||||||
|
REM AT 9:00PM MSG foo 9p
|
||||||
|
REM AT 10:00pm MSG foo 10p
|
||||||
|
REM AT 11:00PM MSG foo 11p
|
||||||
|
REM AT 12:00pm MSG foo 12p
|
||||||
|
REM AT 13:00PM MSG foo 13p
|
||||||
|
|
||||||
|
DEBUG +x
|
||||||
|
SET x 0:00am + 0
|
||||||
|
SET x 1:00AM + 0
|
||||||
|
SET x 2:00am + 0
|
||||||
|
SET x 3:00AM + 0
|
||||||
|
SET x 4:00am + 0
|
||||||
|
SET x 5:00AM + 0
|
||||||
|
SET x 6:00am + 0
|
||||||
|
SET x 7:00AM + 0
|
||||||
|
SET x 8:00am + 0
|
||||||
|
SET x 9:00AM + 0
|
||||||
|
SET x 10:00am + 0
|
||||||
|
SET x 11:00AM + 0
|
||||||
|
SET x 12:00am + 0
|
||||||
|
SET x 13:00AM + 0
|
||||||
|
|
||||||
|
SET x 0:00pm + 0
|
||||||
|
SET x 1:00PM + 0
|
||||||
|
SET x 2:00pm + 0
|
||||||
|
SET x 3:00PM + 0
|
||||||
|
SET x 4:00pm + 0
|
||||||
|
SET x 5:00PM + 0
|
||||||
|
SET x 6:00pm + 0
|
||||||
|
SET x 7:00PM + 0
|
||||||
|
SET x 8:00pm + 0
|
||||||
|
SET x 9:00PM + 0
|
||||||
|
SET x 10:00pm + 0
|
||||||
|
SET x 11:00PM + 0
|
||||||
|
SET x 12:00pm + 0
|
||||||
|
SET x 13:00PM + 0
|
||||||
|
|
||||||
|
SET x '2015-02-03@0:00am' + 0
|
||||||
|
SET x '2015-02-03@1:00AM' + 0
|
||||||
|
SET x '2015-02-03@2:00am' + 0
|
||||||
|
SET x '2015-02-03@3:00AM' + 0
|
||||||
|
SET x '2015-02-03@4:00am' + 0
|
||||||
|
SET x '2015-02-03@5:00AM' + 0
|
||||||
|
SET x '2015-02-03@6:00am' + 0
|
||||||
|
SET x '2015-02-03@7:00AM' + 0
|
||||||
|
SET x '2015-02-03@8:00am' + 0
|
||||||
|
SET x '2015-02-03@9:00AM' + 0
|
||||||
|
SET x '2015-02-03@10:00am' + 0
|
||||||
|
SET x '2015-02-03@11:00AM' + 0
|
||||||
|
SET x '2015-02-03@12:00am' + 0
|
||||||
|
SET x '2015-02-03@13:00AM' + 0
|
||||||
|
|
||||||
|
SET x '2015-02-03@0:00pm' + 0
|
||||||
|
SET x '2015-02-03@1:00PM' + 0
|
||||||
|
SET x '2015-02-03@2:00pm' + 0
|
||||||
|
SET x '2015-02-03@3:00PM' + 0
|
||||||
|
SET x '2015-02-03@4:00pm' + 0
|
||||||
|
SET x '2015-02-03@5:00PM' + 0
|
||||||
|
SET x '2015-02-03@6:00pm' + 0
|
||||||
|
SET x '2015-02-03@7:00PM' + 0
|
||||||
|
SET x '2015-02-03@8:00pm' + 0
|
||||||
|
SET x '2015-02-03@9:00PM' + 0
|
||||||
|
SET x '2015-02-03@10:00pm' + 0
|
||||||
|
SET x '2015-02-03@11:00PM' + 0
|
||||||
|
SET x '2015-02-03@12:00pm' + 0
|
||||||
|
SET x '2015-02-03@13:00PM' + 0
|
||||||
|
|
||||||
|
# Test the ampm function
|
||||||
|
set x ampm(0:12) + ""
|
||||||
|
set x ampm(1:12) + ""
|
||||||
|
set x ampm(2:12) + ""
|
||||||
|
set x ampm(3:12) + ""
|
||||||
|
set x ampm(4:12) + ""
|
||||||
|
set x ampm(5:12) + ""
|
||||||
|
set x ampm(6:12) + ""
|
||||||
|
set x ampm(7:12) + ""
|
||||||
|
set x ampm(8:12) + ""
|
||||||
|
set x ampm(9:12) + ""
|
||||||
|
set x ampm(10:12) + ""
|
||||||
|
set x ampm(11:12) + ""
|
||||||
|
set x ampm(12:12) + ""
|
||||||
|
set x ampm(13:12) + ""
|
||||||
|
set x ampm(14:12) + ""
|
||||||
|
set x ampm(15:12) + ""
|
||||||
|
set x ampm(16:12) + ""
|
||||||
|
set x ampm(17:12) + ""
|
||||||
|
set x ampm(18:12) + ""
|
||||||
|
set x ampm(19:12) + ""
|
||||||
|
set x ampm(20:12) + ""
|
||||||
|
set x ampm(21:12) + ""
|
||||||
|
set x ampm(22:12) + ""
|
||||||
|
set x ampm(23:12) + ""
|
||||||
|
|
||||||
|
# Coerce with am/pm
|
||||||
|
set x coerce("TIME", "12:45am")
|
||||||
|
set x coerce("TIME", "12:45")
|
||||||
|
set x coerce("TIME", "1:45pm")
|
||||||
|
set x coerce("DATETIME", "2020-05-05@12:45am")
|
||||||
|
set x coerce("DATETIME", "2020-05-05@12:45")
|
||||||
|
set x coerce("DATETIME", "2020-05-05@1:45pm")
|
||||||
|
|
||||||
|
# Don't want Remind to queue reminders
|
||||||
|
EXIT
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
REM This line should not even be seen
|
REM This line should not even be seen
|
||||||
And you can put whatever you like here.
|
And you can put whatever you like here.
|
||||||
[+f=asdfasdasde3ir0a]
|
[+f=asdfasdasde3ir0a]
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ install:
|
|||||||
sed $(SEDSCRIPT) < moon.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/moon.rem
|
sed $(SEDSCRIPT) < moon.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/moon.rem
|
||||||
sed $(SEDSCRIPT) < sunrise.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunrise.rem
|
sed $(SEDSCRIPT) < sunrise.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunrise.rem
|
||||||
sed $(SEDSCRIPT) < sunset.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunset.rem
|
sed $(SEDSCRIPT) < sunset.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunset.rem
|
||||||
|
cp blank.rem $(DESTDIR)$(SCRIPTDIR)/blank.rem
|
||||||
sed $(SEDSCRIPT) < calendar.html-DIST > $(DESTDIR)$(HTMLDIR)/calendar.html
|
sed $(SEDSCRIPT) < calendar.html-DIST > $(DESTDIR)$(HTMLDIR)/calendar.html
|
||||||
sed $(SEDSCRIPT) < hebhtml > $(DESTDIR)$(SCRIPTDIR)/hebhtml
|
sed $(SEDSCRIPT) < hebhtml > $(DESTDIR)$(SCRIPTDIR)/hebhtml
|
||||||
sed $(SEDSCRIPT2) < rem2html > $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
|
sed $(SEDSCRIPT2) < rem2html > $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
|
||||||
@@ -76,6 +77,7 @@ install:
|
|||||||
chmod 644 $(DESTDIR)$(SCRIPTDIR)/moon.rem
|
chmod 644 $(DESTDIR)$(SCRIPTDIR)/moon.rem
|
||||||
chmod 644 $(DESTDIR)$(SCRIPTDIR)/hebdate.rem
|
chmod 644 $(DESTDIR)$(SCRIPTDIR)/hebdate.rem
|
||||||
chmod 644 $(DESTDIR)$(SCRIPTDIR)/sunset.rem
|
chmod 644 $(DESTDIR)$(SCRIPTDIR)/sunset.rem
|
||||||
|
chmod 644 $(DESTDIR)$(SCRIPTDIR)/blank.rem
|
||||||
chmod 644 $(DESTDIR)$(HTMLDIR)/calendar.html
|
chmod 644 $(DESTDIR)$(HTMLDIR)/calendar.html
|
||||||
chmod 755 $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
|
chmod 755 $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
|
||||||
chmod 755 $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
|
chmod 755 $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ only tested it with Linux running NCSA's httpd and Apache's httpd, but
|
|||||||
it should work on any UNIX web server.
|
it should work on any UNIX web server.
|
||||||
|
|
||||||
To install it, you need the Remind package, available via ftp from
|
To install it, you need the Remind package, available via ftp from
|
||||||
ftp://ftp.doe.carleton.ca/pub/remind-3.0. You should install Remind,
|
https://dianne.skoll.ca/projects/remind/ You should install Remind,
|
||||||
setting the lattitude, longitude, location and time zone as appropriate
|
setting the lattitude, longitude, location and time zone as appropriate
|
||||||
for your machine.
|
for your machine.
|
||||||
|
|
||||||
@@ -38,12 +38,8 @@ where "what" is one of:
|
|||||||
hebps -- get a PostScript calendar with Jewish holidays.
|
hebps -- get a PostScript calendar with Jewish holidays.
|
||||||
hebhtml -- get an HTML version of the above (requires Perl.)
|
hebhtml -- get an HTML version of the above (requires Perl.)
|
||||||
|
|
||||||
(Visit http://www.doe.carleton.ca/~dfs/ for previews.)
|
|
||||||
|
|
||||||
All of these links will be set up in a sample HTML document
|
All of these links will be set up in a sample HTML document
|
||||||
called "calendar.html" and installed in the HTMLDIR you specified
|
called "calendar.html" and installed in the HTMLDIR you specified
|
||||||
in the Makefile.
|
in the Makefile.
|
||||||
|
|
||||||
4) Enjoy!
|
4) Enjoy!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
5
www/blank.rem
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[moondate(0)] SPECIAL MOON 0
|
||||||
|
[moondate(1)] SPECIAL MOON 1
|
||||||
|
[moondate(2)] SPECIAL MOON 2
|
||||||
|
[moondate(3)] SPECIAL MOON 3
|
||||||
|
REM Monday SPECIAL WEEK (W[weekno()])
|
||||||
@@ -7,5 +7,5 @@
|
|||||||
echo "Content-type: application/postscript"
|
echo "Content-type: application/postscript"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
$REMIND -p /dev/null | $REM2PS -e -c3 -l
|
$REMIND -p $DIR/blank.rem | $REM2PS -e -c3 -l
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 354 B |
BIN
www/fullmoon.png
|
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 360 B |
@@ -29,6 +29,8 @@ ENDIF
|
|||||||
# #
|
# #
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
SET n $NumTrig
|
||||||
|
|
||||||
# --- HERE ARE THE JEWISH HOLIDAYS ---
|
# --- HERE ARE THE JEWISH HOLIDAYS ---
|
||||||
# Set the variable InIsrael to 1 if you live in Israel. Otherwise,
|
# Set the variable InIsrael to 1 if you live in Israel. Otherwise,
|
||||||
# you get the Diaspora versions of Jewish holidays
|
# you get the Diaspora versions of Jewish holidays
|
||||||
@@ -138,6 +140,10 @@ ENDIF
|
|||||||
|
|
||||||
fset msgprefix(x) ""
|
fset msgprefix(x) ""
|
||||||
|
|
||||||
|
IF $NumTrig > n
|
||||||
|
REM SPECIAL SHADE 224 224 255
|
||||||
|
ENDIF
|
||||||
|
|
||||||
# Counting the omer - do the whole spiel, i.e:
|
# Counting the omer - do the whole spiel, i.e:
|
||||||
# "This is the xth day of the omer, being y weeks and z days of the omer."
|
# "This is the xth day of the omer, being y weeks and z days of the omer."
|
||||||
# Nice Remind programming example here!
|
# Nice Remind programming example here!
|
||||||
@@ -165,7 +171,7 @@ ELSE
|
|||||||
[trigger(moondate(2))] SPECIAL MOON 2
|
[trigger(moondate(2))] SPECIAL MOON 2
|
||||||
[trigger(moondate(3))] SPECIAL MOON 3
|
[trigger(moondate(3))] SPECIAL MOON 3
|
||||||
REM PS Border Border moveto /DayFont findfont 10 scalefont setfont ([hebday(today())] [hebmon(today())]) show
|
REM PS Border Border moveto /DayFont findfont 10 scalefont setfont ([hebday(today())] [hebmon(today())]) show
|
||||||
REM SPECIAL HTML <P><FONT SIZE=-1>[hebday(today())] [hebmon(today())]</FONT></P>
|
REM SPECIAL HTML <P>[hebday(today())] [hebmon(today())]</P>
|
||||||
|
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 361 B |
BIN
www/newmoon.png
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 317 B |
29
www/rem2html
@@ -4,10 +4,11 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use JSON::Any;
|
||||||
|
|
||||||
my %Options;
|
my %Options;
|
||||||
|
|
||||||
my $rem2html_version = '2.0';
|
my $rem2html_version = '2.1';
|
||||||
|
|
||||||
my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mondayfirst, $weeks,
|
my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mondayfirst, $weeks,
|
||||||
@Daynames, $Nextmon, $Nextlen, $Prevmon, $Prevlen);
|
@Daynames, $Nextmon, $Nextlen, $Prevmon, $Prevlen);
|
||||||
@@ -191,7 +192,7 @@ sub parse_input
|
|||||||
my $found_data = 0;
|
my $found_data = 0;
|
||||||
while(<STDIN>) {
|
while(<STDIN>) {
|
||||||
chomp;
|
chomp;
|
||||||
last if /^\# rem2ps begin$/;
|
last if /^\# rem2ps2? begin$/;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $line;
|
my $line;
|
||||||
@@ -228,13 +229,29 @@ sub parse_input
|
|||||||
}
|
}
|
||||||
while(<STDIN>) {
|
while(<STDIN>) {
|
||||||
chomp;
|
chomp;
|
||||||
last if /^\# rem2ps end$/;
|
last if /^\# rem2ps2? end$/;
|
||||||
next if /^\#/;
|
next if /^\#/;
|
||||||
next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/;
|
my ($y, $m, $d, $special, $tag, $duration, $time, $body);
|
||||||
my ($y, $m, $d, $special, $tag, $duration, $time, $body) =
|
if (m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/) {
|
||||||
($1, $2, $3, $4, $5, $6, $7, $8);
|
($y, $m, $d, $special, $tag, $duration, $time, $body) =
|
||||||
|
($1, $2, $3, $4, $5, $6, $7, $8);
|
||||||
|
} elsif (/\{/) {
|
||||||
|
my $obj = JSON::Any->jsonToObj($_);
|
||||||
|
next unless ($obj->{date} =~ /^(\d+)-(\d+)-(\d+)$/);
|
||||||
|
$y = $1;
|
||||||
|
$m = $2;
|
||||||
|
$d = $3;
|
||||||
|
$special = $obj->{passthru} || '*';
|
||||||
|
$tag = $obj->{tags} || '*';
|
||||||
|
$duration = $obj->{duration} || '*';
|
||||||
|
$time = $obj->{time} || '*';
|
||||||
|
$body = $obj->{body};
|
||||||
|
} else {
|
||||||
|
next;
|
||||||
|
}
|
||||||
my $d1 = $d;
|
my $d1 = $d;
|
||||||
$d1 =~ s/^0+//;
|
$d1 =~ s/^0+//;
|
||||||
|
$special = uc($special);
|
||||||
if ($special eq 'HTML') {
|
if ($special eq 'HTML') {
|
||||||
push(@{$days->[$d]}, $body);
|
push(@{$days->[$d]}, $body);
|
||||||
} elsif ($special eq 'HTMLCLASS') {
|
} elsif ($special eq 'HTMLCLASS') {
|
||||||
|
|||||||