Compare commits

..

296 Commits

Author SHA1 Message Date
Dianne Skoll
8b5fe4f2a0 Update WHATSNEW for 04.02.01 release. 2022-12-15 09:34:02 -05:00
Dianne Skoll
98fc4a917f Bump version to 04.02.01 2022-12-15 09:24:30 -05:00
Dianne Skoll
e633530a36 Fix stray %" 2022-11-15 08:24:52 -05:00
Dianne Skoll
bfea9915b9 Remove unnecessary %"...%" markers. 2022-11-14 12:37:17 -05:00
Clément Bœsch
d68ed6e75d Add French holidays courtesy of Clément Bœsch 2022-11-14 12:20:43 -05:00
Dianne Skoll
a22631d768 Document need for Noto Fonts in TkRemind. 2022-11-01 13:40:44 -04:00
Dianne Skoll
552bf84e33 Make test *not* depend on the current date... *sigh*. 2022-10-24 09:41:40 -04:00
Dianne Skoll
28d0251093 If we use "-m" in ExtraRemindArgs, set $MondayFirst in tkremind
Patch courtesy of Luís Henriques
2022-10-24 09:35:27 -04:00
Dianne Skoll
f3d969f658 Make sure we print the banner on each iteration of a command-line '*rep' 2022-10-20 18:21:57 -04:00
Dianne Skoll
2afe95d090 Fix typo in comment. 2022-10-18 17:25:59 -04:00
Dianne Skoll
3692a6b265 Avoid ambiguous local<->UTC conversions right around when the clocks change. 2022-10-17 09:58:32 -04:00
Dianne Skoll
8fc19358bb Double-up on "%" in a printf formatting string. 2022-10-17 08:29:38 -04:00
Dianne Skoll
c8f9773d83 Speed up FindFunc. 2022-10-14 13:53:50 -04:00
Dianne Skoll
e1091db82f Don't try to use -ffat-lto-objects with clang 2022-10-14 13:31:57 -04:00
Dianne Skoll
9f8ed13434 Remove a whole lot of unused / dead code. 2022-10-14 13:26:56 -04:00
Dianne Skoll
914f03d5eb Fix bad comment. 2022-10-14 11:45:04 -04:00
Dianne Skoll
a801f6d4ce Token names are already lower-case. 2022-10-14 11:43:36 -04:00
Dianne Skoll
fde5a7b4ca Can use strcmp rather than StrCmpI in FindOperator since they are not alphabetic 2022-10-14 11:41:11 -04:00
Dianne Skoll
0e1fff6339 Update WHATSNEW for release. 2022-10-14 11:06:27 -04:00
Dianne Skoll
60fdeac2e9 Add RPM dependencies. 2022-10-14 11:02:51 -04:00
Dianne Skoll
3b3f10d448 Document prereqs on Gentoo and Arch Linux. 2022-10-14 10:53:35 -04:00
Dianne Skoll
48a4314dd2 Remove "validate" field from system variables. It was never used. 2022-10-14 10:42:05 -04:00
Dianne Skoll
9beff3a24a Tweak demo 2022-10-13 15:36:26 -04:00
Dianne Skoll
1ef90c7a61 Fix comments. 2022-10-13 13:55:09 -04:00
Dianne Skoll
5c886d181e Make overline clearer. 2022-10-13 13:54:06 -04:00
Dianne Skoll
da4d830163 More effects. 2022-10-13 13:53:10 -04:00
Dianne Skoll
c7abb7986c Add ansitext demo 2022-10-13 13:51:51 -04:00
Dianne Skoll
5a3b3d8a06 Add standard include file with various ANSI text attribute-changing sequences. 2022-10-13 10:42:28 -04:00
Dianne Skoll
127cee03df Add gmon.out to gitignore 2022-10-13 10:42:12 -04:00
Dianne Skoll
7455748d54 Eliminate compiler warning. 2022-10-13 08:28:09 -04:00
Dianne Skoll
e278d0e768 Fix typo 2022-10-12 20:13:47 -04:00
Dianne Skoll
a5acc12239 Try a ridiculously long line to excercise dynamic-buffer resizing 2022-10-12 20:11:23 -04:00
Dianne Skoll
a25afb9771 Fix ancient logic error in dynamic buffer code. 2022-10-12 19:38:18 -04:00
Dianne Skoll
6252a472b5 Get rid of useless macro. 2022-10-12 19:21:35 -04:00
Dianne Skoll
dbe4c662c1 Add the "FUNSET" command to delete user-defined functions. 2022-10-12 14:12:13 -04:00
Dianne Skoll
b77a261c87 Add Jewish holidays to the list of standard holiday files. 2022-10-12 14:05:55 -04:00
Dianne Skoll
351c54cc50 Print today. 2022-10-12 13:48:15 -04:00
Dianne Skoll
72d0b13ad5 Make the CI setup run "make all" to catch possible errors compiling the Perl modules. 2022-10-12 11:32:37 -04:00
Dianne Skoll
bea2a6541c Fix docs. 2022-10-12 10:20:20 -04:00
Dianne Skoll
5258e98f54 Add translations for various astronomical events in German localization, courtesy of Gunther Reißig. 2022-10-12 08:39:02 -04:00
Dianne Skoll
af9d42721c Separate Sun from Moon output. 2022-10-11 15:44:19 -04:00
Dianne Skoll
8ed43f5c3e Update WHATSNEW 2022-10-11 14:19:32 -04:00
Dianne Skoll
ec02a87c2b Fix some bugs in US holidays. 2022-10-11 14:19:00 -04:00
Dianne Skoll
6c2ec04d40 Visual tweaks. 2022-10-11 13:57:00 -04:00
Dianne Skoll
9f91cdf0b9 Update WHATSNEW. 2022-10-11 13:23:55 -04:00
Dianne Skoll
8ada68ce54 Add the "columns(str)" variant. 2022-10-11 13:18:44 -04:00
Dianne Skoll
d7975634af Update WHATSNEW 2022-10-11 11:56:41 -04:00
Dianne Skoll
87be68fecf Document rows() and columns() 2022-10-11 11:54:52 -04:00
Dianne Skoll
b42d5fd412 Add rows() and columns() built-in function. 2022-10-11 11:52:35 -04:00
Dianne Skoll
603228b944 Update prerequisite list. 2022-10-11 10:41:57 -04:00
Dianne Skoll
c62f676813 Diagnose unterminated %{...} sequence 2022-10-11 10:35:31 -04:00
Dianne Skoll
c7654c27a6 Update WHATSNEW. 2022-10-11 09:16:04 -04:00
Dianne Skoll
b00bf05fea Add test for %{custom} substitution. 2022-10-11 09:14:47 -04:00
Dianne Skoll
29bd07d4ef Document %{name} substitution sequences. 2022-10-11 09:11:12 -04:00
Dianne Skoll
b7047da89e Allow user-defined substitutions of the form: %{name} or %*{name} that call subst_name. 2022-10-11 09:07:08 -04:00
Dianne Skoll
f26334e25f Add doc about %_ to insert a blank line if $AddBlankLines is 0. 2022-10-11 08:31:13 -04:00
Dianne Skoll
b80bc5f788 Test that ending a reminder with %_ does add a blank line. 2022-10-11 08:30:17 -04:00
Dianne Skoll
91549e18ce Make use of $AddBlankLines 2022-10-10 22:52:48 -04:00
Dianne Skoll
07fd975935 Add the $AddBlankLines system variable. 2022-10-10 22:49:28 -04:00
Dianne Skoll
f9d968cf68 Fix CI script. 2022-10-10 17:31:14 -04:00
Dianne Skoll
6a7e696a60 Minor doc tweak 2022-10-10 17:17:31 -04:00
Dianne Skoll
6734fae1db Update docs/WHATSNEW 2022-10-10 17:15:21 -04:00
Dianne Skoll
481fbc20a1 Bump version to 04.02.00 2022-10-10 17:05:00 -04:00
Dianne Skoll
3c120bf561 Avoid compiler warning. 2022-10-10 17:04:51 -04:00
Dianne Skoll
ee65e04974 Top-level test does not depend on top-level all. 2022-10-10 17:04:35 -04:00
Dianne Skoll
4ee6bb0eca Add test for embedded %_ in MSF reminders. 2022-10-10 11:12:47 -04:00
Dianne Skoll
b9839421f2 make "MSF" correctly wrap UTF-8 text. 2022-10-10 11:05:38 -04:00
Dianne Skoll
67601507fa More robust handling of ANSI color escape sequences. 2022-10-09 22:00:06 -04:00
Dianne Skoll
c2e5534462 Make "REM ... MSF ..." handle ANSI color escape sequences correctly. 2022-10-09 21:55:09 -04:00
Dianne Skoll
f4ea3af6fc Update test output. 2022-10-09 21:32:04 -04:00
Dianne Skoll
e0998a3991 Implement trigtags() 2022-10-09 21:31:24 -04:00
Dianne Skoll
d67e580d0a More tweaks 2022-10-09 18:24:49 -04:00
Dianne Skoll
d6ce54eea4 Tweak astro example script. 2022-10-09 18:22:56 -04:00
Dianne Skoll
8b9ec43029 Add "astro" example script. 2022-10-09 18:21:03 -04:00
Dianne Skoll
9d68134f0f Make PrintValue escape only byte values < 32 2022-10-09 17:53:40 -04:00
Dianne Skoll
3d91371870 Correct and clarify man page. 2022-10-09 17:53:21 -04:00
Dianne Skoll
d1c0ef63b0 Fix inconsistency in man page. 2022-10-09 17:34:09 -04:00
Dianne Skoll
2a59da61e1 Update man page. 2022-10-09 13:40:21 -04:00
Dianne Skoll
2bc5e21627 Document ansicolor and the new color-related special variables. 2022-10-09 13:36:41 -04:00
Dianne Skoll
7d77bfd12a Add tests for invalid ansicolor() calls. 2022-10-09 13:10:28 -04:00
Dianne Skoll
0ff589c288 Merge branch 'utf8' into 'master'
Convert files to UTF-8
2022-10-09 17:02:45 +00:00
Dianne Skoll
f3cca092be Add tests for ansicolors function and new $Use...Colors variables. 2022-10-09 12:59:52 -04:00
Dianne Skoll
7218d55f08 Add $TerminalBackground special variable. 2022-10-09 12:40:48 -04:00
Dianne Skoll
ec72c74016 Add $Use256Colors, $UseBGVTColors, $UseTrueColors and $UseVTColors special variables. 2022-10-09 12:16:33 -04:00
Dianne Skoll
c946f08235 Fix spelling error. 2022-10-07 18:55:07 -04:00
Dianne Skoll
a8543ac349 Fix regression test. 2022-10-06 17:53:01 -04:00
Dianne Skoll
dd3c0e14ed Make wording more consistent. 2022-10-06 17:52:19 -04:00
Dianne Skoll
a2bc0acd3c Use English day names in "OMIT DUMP" 2022-10-06 15:20:37 -04:00
Dianne Skoll
a34266741a Clarify that we use the union of globally- and locally-omitted weekdays. 2022-10-06 08:40:05 -04:00
Dianne Skoll
dedb9766c9 Make a SATISFY-type reminder with ADDOMIT but no MSG actually add to the omits.
Previously, something like: REM 1 May ADDOMIT SATISFY 1
would not add to the global OMIT list.
2022-10-06 08:35:50 -04:00
Dianne Skoll
aedd759f50 Tweak wording. 2022-10-05 16:39:18 -04:00
Dianne Skoll
a24c2f6905 Refactor code. 2022-10-05 16:36:08 -04:00
Dianne Skoll
fac31a10b8 Add the timezone() built-in function. 2022-10-05 16:28:38 -04:00
Dianne Skoll
fba9f139ed Add global OMIT of the form:
OMIT wkday [wkday...]

For example:  OMIT Saturday Sunday
2022-10-05 14:12:53 -04:00
Dianne Skoll
588d9debe8 Simplify American Independence Day example. 2022-10-05 11:12:21 -04:00
Dianne Skoll
805c2e0c69 Implement the utctolocal and localtoutc functions. 2022-10-04 16:23:45 -04:00
Dianne Skoll
2c2b1440b3 Make tests work in non-utf-8 locale. 2022-09-27 21:49:33 -04:00
Jochen Sprickerhof
6973f62d74 Convert files to UTF-8 2022-09-26 20:03:05 +02:00
Dianne Skoll
f547c1e714 Update release notes. 2022-09-26 12:08:49 -04:00
Dianne Skoll
f8ea124b1f Add OS error message if we can't open file. 2022-09-24 10:57:32 -04:00
Dianne Skoll
820e2aec4d Document that "-wcol" also sets $FormWidth 2022-09-24 10:48:43 -04:00
Dianne Skoll
01ce6b2d8f Clamp min CalWidth at 71. 2022-09-24 10:40:04 -04:00
Dianne Skoll
b39e0eab7e Get rid of ComputeCalWidth - it's obsolete 2022-09-24 10:39:05 -04:00
Dianne Skoll
d6fc451d74 Refactor code. 2022-09-24 10:34:05 -04:00
Dianne Skoll
ac91556fc2 Make '-wn' initialize FormWidth as well. 2022-09-24 10:29:23 -04:00
Dianne Skoll
ccf639efe6 Make '-wt' accept FormWidth as well as CalWidth 2022-09-24 10:27:19 -04:00
Dianne Skoll
a8aa3b328b Add "-wt" option to size calendar according to terminal window. 2022-09-24 10:26:06 -04:00
Dianne Skoll
74a3b3e73d Yet more doc fixes. 2022-09-24 09:56:16 -04:00
Dianne Skoll
c0e68b57ea Fix pod 2022-09-24 09:53:11 -04:00
Dianne Skoll
0ad4ea26eb Properly set version and release date in man pages for rem2html and rem2pdf 2022-09-24 09:50:15 -04:00
Dianne Skoll
ea7aafaf5e Refactor code to reduce copy-paste coding. 2022-09-24 09:16:50 -04:00
Dianne Skoll
18043080ba Properly detect missing quote after escape sequence. 2022-09-23 20:42:57 -04:00
Dianne Skoll
7cd8cf3a77 Dump strings more sensibly in PrintValue. 2022-09-23 19:10:36 -04:00
Dianne Skoll
21da52ec36 Update unit tests. 2022-09-23 19:05:51 -04:00
Dianne Skoll
7a0c164843 Dump strings more sensibly. 2022-09-23 19:05:26 -04:00
Dianne Skoll
5cf4961f19 More clarification. 2022-09-23 08:38:00 -04:00
Dianne Skoll
68926d145b Fix innacuracy in how string constants are described. 2022-09-23 08:32:12 -04:00
Dianne Skoll
fdc3e4d23d Update WHATSNEW 2022-09-22 15:00:30 -04:00
Dianne Skoll
f179c837e1 Update regression tests. 2022-09-22 08:56:58 -04:00
Dianne Skoll
740bb44956 Don't consider IFTRIG true if we could not compute a trigger date.
Bug noted by Gunther Reißig
2022-09-22 08:48:19 -04:00
Dianne Skoll
5b953769fe Obey $DefaultColor in a SATISFY-type reminder.
Bug found by Gunther Reißig.
2022-09-22 08:37:37 -04:00
Dianne Skoll
1ae00ce778 No need to reset NumTriggered. 2022-09-21 19:11:30 -04:00
Dianne Skoll
a01e05c1db Fix bug introduced in commit 98c5bf511e:
Don't print a banner when issuing a queued reminder.
2022-09-21 18:17:25 -04:00
Dianne Skoll
63fb3e99f3 Make "test" depend on "all" rather than just "remind" 2022-09-19 13:56:11 -04:00
Dianne Skoll
6cf7f5d2d8 Merge branch 'add_ci' into 'master'
Add ci

See merge request dskoll/remind!2
2022-09-19 17:54:45 +00:00
Jochen Sprickerhof
316eb43303 Add Gitlab CI 2022-09-19 19:51:15 +02:00
Dianne Skoll
576112a39a Merge branch 'drop_fgrep' into 'master'
Replace deprecated fgrep by grep

See merge request dskoll/remind!1
2022-09-19 17:50:03 +00:00
Jochen Sprickerhof
6607223abb Replace deprecated fgrep by grep -F 2022-09-19 19:49:20 +02:00
Dianne Skoll
9e85b1932d Mark today in bold iff "remind -c" color output is enabled. 2022-09-19 11:32:10 -04:00
Dianne Skoll
4ba7f5b1f2 Only embolden today if stdout is a tty 2022-09-19 10:44:21 -04:00
Dianne Skoll
fc93ae890a Allow NULL pointers to be supplied to FromJulian if we are not interested in specific values 2022-09-17 23:04:34 -04:00
Dianne Skoll
8051d01945 Document change in Makefile install/install-stripped targets. 2022-09-17 09:07:27 -04:00
Dianne Skoll
63430c59f7 Make "make install" *not* strip debugging symbols; add "make install-stripped" target to strip them. 2022-09-17 09:04:45 -04:00
Dianne Skoll
c646bfc63f Make today's date bold in -c mode. 2022-09-16 21:01:10 -04:00
Dianne Skoll
58dea8f69b Support greyscale version of SHADE. 2022-09-16 20:44:59 -04:00
Dianne Skoll
f1c82dcb37 Update docs; bump version to 04.01.00. 2022-09-16 19:54:04 -04:00
Dianne Skoll
b984b66819 Put a space before the "***" representing today in -c mode. 2022-09-16 16:15:01 -04:00
Dianne Skoll
44bdae302b Allow 2 (=TERMINAL_BACKGROUND_UNKNOWN) for m in -@n,m,b 2022-09-16 15:58:51 -04:00
Dianne Skoll
8eb6b250fb Add support for the WEEK speical. 2022-09-16 15:08:53 -04:00
Dianne Skoll
d838c41bf2 Add tests for stdout() function. 2022-09-16 14:14:06 -04:00
Dianne Skoll
f9dbf36496 Don't backgroundize the row with day numbers. 2022-09-16 13:53:33 -04:00
Dianne Skoll
fe1427db28 Finalize support for SPECIAL SHADE in "remind -c" 2022-09-16 13:50:23 -04:00
Dianne Skoll
2621ad5604 Tweak calendar column-to-day handling. 2022-09-16 13:43:20 -04:00
Dianne Skoll
efecf2e1ea Make "remind -c" optionally support the SPECIAL SHADE 2022-09-16 11:41:18 -04:00
Dianne Skoll
8666e6357e Start working on support for SHADE in remind -c output. 2022-09-16 08:42:20 -04:00
Dianne Skoll
ae7069c9cb Gotta use the right sscanf format. :( 2022-09-15 18:43:58 -04:00
Dianne Skoll
0c6ab3e607 Properly parse args to MOON special 2022-09-15 18:37:46 -04:00
Dianne Skoll
17d6a60c0a Fix moon-phase-in-terminal printing and add tests. 2022-09-15 18:23:03 -04:00
Dianne Skoll
e3e0a541dc Print moon phases in terminal if terminal supports UTF-8 2022-09-15 18:18:05 -04:00
Jochen Sprickerhof
712aa08fbc make test depend on all 2022-09-08 16:32:04 +02:00
Dianne Skoll
98c5bf511e Print banner prior to first MSG-type reminder. 2022-09-06 09:14:55 -04:00
Dianne Skoll
1f9281628f Add home page to rem2pdf.1 and rem2html.1 2022-08-27 11:21:24 -04:00
Dianne Skoll
8fb15aed17 Do a sanity-check to make sure we pick up a release date. 2022-08-27 10:26:51 -04:00
Dianne Skoll
a24c3a8542 Remove generated man pages when running "make clean" 2022-08-27 10:24:29 -04:00
Dianne Skoll
8f8059e3f3 Generate man files from *.in versions to include release date and version number. 2022-08-27 10:22:31 -04:00
Dianne Skoll
24bb462199 Rename *.1 to *.1.in 2022-08-27 10:14:16 -04:00
Dianne Skoll
38e914f171 Get release date. 2022-08-27 10:06:02 -04:00
Dianne Skoll
4a02c54e8d Add home page to man pages. 2022-08-26 16:33:39 -04:00
Dianne Skoll
5fe169438a Document behavior of DO and filedir() with respect to symbolic links. 2022-08-22 09:19:30 -04:00
Dianne Skoll
a7ef6e851a Fix error in Makefile - remove duplicate clean: definition 2022-08-21 10:24:30 -04:00
Dianne Skoll
4d57b9d0aa Pass CFLAGS at link-time
Thanks to Zoltan Puskas for suggestion.
2022-08-21 10:23:16 -04:00
Dianne Skoll
5a7452d9f6 Add install-nostripped top-level target.
Thanks to Zoltan Puskas for suggestion.
2022-08-21 10:22:58 -04:00
Dianne Skoll
3916887aff Update change log. 2022-08-16 09:24:51 -04:00
Dianne Skoll
f84f59fa91 Bump version to 04.00.03. 2022-08-15 14:48:59 -04:00
Dianne Skoll
1032f8908e Don't create mysterious files named '&1' when creating new reminders. Sigh. 2022-08-11 11:32:59 -04:00
Dianne Skoll
6c2e8fc608 Document calendar_body and plain_body. 2022-08-08 11:49:06 -04:00
Dianne Skoll
012e527fb5 Fix parsing of old-style output. 2022-08-06 12:06:09 -04:00
Dianne Skoll
62198c9807 Use the new calendar_body/plain_body fields. 2022-08-06 11:54:32 -04:00
Dianne Skoll
de95224d62 Use new calendar_body / plain_body elements. 2022-08-06 11:49:35 -04:00
Dianne Skoll
be374a0464 Update test suite for new JSON output. 2022-08-06 09:09:06 -04:00
Dianne Skoll
fe9b3186d7 Add plain_body and calendar_body keys to JSON output. 2022-08-06 09:06:54 -04:00
Dianne Skoll
8405ea6c53 Add note about how to kill remind in queue mode. 2022-08-06 08:34:16 -04:00
Dianne Skoll
4274d05e10 Fix man page typo 2022-08-05 22:09:36 -04:00
Dianne Skoll
4e80ce1159 Don't make SIGINT kill a background process; don't call printf from a signal-handler; use sigaction instead of signal 2022-08-05 22:04:44 -04:00
Dianne Skoll
52f473f2af Update .gitignore 2022-08-04 10:34:45 -04:00
Dianne Skoll
1d6ca51bf9 Update docs. 2022-08-02 14:58:15 -04:00
Dianne Skoll
e662d0b3dd Bump version to 04.00.02 2022-08-02 14:51:00 -04:00
Dianne Skoll
b910d557d1 Document new form of OMIT command. 2022-07-27 15:16:23 -04:00
Dianne Skoll
a4ad0a9e97 Rename error constant. 2022-07-27 15:06:04 -04:00
Dianne Skoll
07f67e7dd7 Better error messages 2022-07-27 15:03:48 -04:00
Dianne Skoll
d6575773fb Don't let THROUGH date be before START date in OMIT. 2022-07-27 14:55:34 -04:00
Dianne Skoll
ac1303886e Add another test. 2022-07-27 14:47:11 -04:00
Dianne Skoll
1569992184 Add test for more flexible OMIT 2022-07-27 14:43:54 -04:00
Dianne Skoll
55a1f1d746 Implement more flexible OMIT. We can do things like:
OMIT May       - equivalent to "OMIT May 1" ... "OMIT May 31"
    OMIT Nov 20 THROUGH Dec 4
    OMIT Apr THROUGH May
    OMIT 2023-12-25 THROUGH 2024-01-06
2022-07-27 14:39:43 -04:00
Dianne Skoll
ef7742a3cc Add GitHub README 2022-07-19 10:12:46 -04:00
Dianne Skoll
ef48c2020b Fix typo 2022-07-12 20:44:57 -04:00
Dianne Skoll
6dcb25073b Make $T behave as documented: If trigger date is not valid, should return 0. 2022-07-04 14:23:39 -04:00
Dianne Skoll
4824b07ec8 Document inotifywait 2022-07-03 19:47:06 -04:00
Dianne Skoll
a8f1228fb7 Update TkRemind man page. 2022-07-03 19:13:05 -04:00
Dianne Skoll
80e51d1d0f Make calendar with 6 rows in a month handle resizing properly.
Fixes https://github.com/dfskoll/remind/issues/1
2022-07-01 16:45:25 -04:00
Dianne Skoll
80e30638a5 Update changelog 2022-06-03 16:22:19 -04:00
Dianne Skoll
dd2fc30364 Add test for $SuppressLRM 2022-05-29 17:28:45 -04:00
Dianne Skoll
a5865fb5fe Add $SuppressLRM system variable; bump version to 04.00.01. 2022-05-27 12:22:26 -04:00
Dianne Skoll
aca2f28341 Add liberapay button. 2022-05-19 13:58:03 -04:00
Dianne Skoll
7a3f5f7ac9 Add github action to run tests. 2022-05-19 09:46:32 -04:00
Dianne Skoll
1731710ef2 Minor reformatting of source. 2022-05-19 09:01:11 -04:00
Dianne Skoll
dc2a8f48bf Update man page. 2022-04-07 11:53:20 -04:00
Dianne Skoll
5e16179bfa Update docs for 04.04.00 release. 2022-04-04 09:36:08 -04:00
Dianne Skoll
a7c1bc81b2 Remove a bug from man page. 2022-04-03 12:59:25 -04:00
Dianne Skoll
5f5ec8ef19 More intelligent handling of --prefix wrt ExtUtils::MakeMaker. 2022-04-03 12:23:28 -04:00
Dianne Skoll
712ff56792 Update docs 2022-04-01 12:11:04 -04:00
Dianne Skoll
99af1f964c Fix bug that broke "-m" option to tkreminder. 2022-04-01 12:08:25 -04:00
Dianne Skoll
de5d1347e5 Make the operator stack static 2022-03-26 19:05:18 -04:00
Dianne Skoll
5e07fbde6d Fix formatting. 2022-03-26 18:03:31 -04:00
Dianne Skoll
c523c7f3b3 Allow a subst_N or subst_Nx function to return 0 to indicate "use the normal substitution" 2022-03-26 18:02:39 -04:00
Dianne Skoll
6b3c6b0ec7 Fix a couple of typos. 2022-03-26 10:11:17 -04:00
Dianne Skoll
62b94ab065 Update WHATSNEW. 2022-03-25 16:08:33 -04:00
Dianne Skoll
49c7399599 Add "pad" function 2022-03-25 16:07:17 -04:00
Dianne Skoll
5fa9297aba Bump version to 04.00.00 2022-03-25 15:52:07 -04:00
Dianne Skoll
4ada31798b Document language packs. 2022-03-25 15:14:59 -04:00
Dianne Skoll
e78f953e90 Document "pad" function. 2022-03-25 14:47:42 -04:00
Dianne Skoll
af7a9ad8b5 Use Eprint instead of Wprint 2022-03-25 14:20:40 -04:00
Dianne Skoll
35eae045a6 Fix up test file. 2022-03-25 14:18:12 -04:00
Dianne Skoll
98a20ae058 Better call-stack printing. 2022-03-25 14:17:43 -04:00
Dianne Skoll
df9ef6e13a Print call stack if an error occurs in a user-defined function. 2022-03-25 14:03:06 -04:00
Dianne Skoll
10f5802069 Add callstack-management functions. 2022-03-25 13:56:00 -04:00
Dianne Skoll
780044219f Store the filename / lineno at which a user-defined function is defined. 2022-03-25 13:40:07 -04:00
Dianne Skoll
d015c061e7 Add site/ subdir and README. 2022-03-25 11:26:42 -04:00
Dianne Skoll
6f6326d433 Add another pad() test. 2022-03-25 11:13:51 -04:00
Dianne Skoll
9488e7ca13 Don't let pad function make over-long strings. 2022-03-25 11:08:43 -04:00
Dianne Skoll
71c11672c2 Add null "en.rem" 2022-03-25 10:59:51 -04:00
Dianne Skoll
0acefa800e Add Spanish language pack. 2022-03-25 10:58:57 -04:00
Dianne Skoll
d45cee4712 Add Romanian language pack. 2022-03-25 10:53:20 -04:00
Dianne Skoll
c026aa05e2 Warn if a substitution expression evaluates incorrectly. 2022-03-25 10:53:08 -04:00
Dianne Skoll
50076c74fa Implement Portuguese language pack. 2022-03-25 08:54:13 -04:00
Dianne Skoll
1563d77c06 More extensive tests. 2022-03-24 18:53:55 -04:00
Dianne Skoll
ed72ef8629 Use built-in "pad" function 2022-03-24 17:34:08 -04:00
Dianne Skoll
06c5996086 Add tests for pad function 2022-03-24 17:33:16 -04:00
Dianne Skoll
570ca857a0 Add "pad" function; make compare-language-mods.pl quiet. 2022-03-24 17:31:37 -04:00
Dianne Skoll
f8f20b7afc Add Polish language pack 2022-03-24 16:33:48 -04:00
Dianne Skoll
f55ef7ff20 Add Norwegian language pack. 2022-03-24 16:04:54 -04:00
Dianne Skoll
79220a74cf Add Italian language pack. 2022-03-24 15:49:25 -04:00
Dianne Skoll
77111ef628 Convert to utf-8 2022-03-24 15:01:37 -04:00
Dianne Skoll
bf96063311 Convert is.rem to utf-8 2022-03-24 14:45:57 -04:00
Dianne Skoll
58a201fceb Fix typo 2022-03-24 14:42:01 -04:00
Dianne Skoll
47cecb210b Add an auto.rem file to pick language file based on locale. 2022-03-24 14:39:18 -04:00
Dianne Skoll
bfbf744b0a Implement Icelandic language pack. 2022-03-24 14:14:42 -04:00
Dianne Skoll
0cf56ac1de Error-check -@ values. 2022-03-24 14:07:07 -04:00
Dianne Skoll
2880a718f4 Fix bug in compiled Dutch language support. 2022-03-24 12:34:58 -04:00
Dianne Skoll
da0dd0f7c6 Tweak nl language pack. 2022-03-24 12:32:43 -04:00
Dianne Skoll
c456d3e0ff More extensive testing. 2022-03-24 12:30:04 -04:00
Dianne Skoll
59059736e6 Add remembrance day 2022-03-24 11:42:45 -04:00
Dianne Skoll
f5cf2ab832 Working version of Finnish language pack! 2022-03-24 11:22:15 -04:00
Dianne Skoll
cc4ff2582d More work on getting Finnish language pack working properly. 2022-03-24 11:05:58 -04:00
Dianne Skoll
90f5fde3bb Progress on Finnish language pack. 2022-03-24 10:38:03 -04:00
Dianne Skoll
9fbe9f5132 Add more tests. 2022-03-23 17:30:28 -04:00
Dianne Skoll
f05661fa6c Fix typo 2022-03-23 17:22:47 -04:00
Dianne Skoll
d6882c3378 Add more tests. 2022-03-23 17:20:13 -04:00
Dianne Skoll
e32cab937e Install everything under include/ in $SysInclude 2022-03-23 16:43:15 -04:00
Dianne Skoll
14bb939977 Add US holidays. 2022-03-23 15:44:23 -04:00
Dianne Skoll
13e830782d Port over NL 2022-03-23 15:37:49 -04:00
Dianne Skoll
f39bb5e2d9 Tweaks 2022-03-23 14:53:28 -04:00
Dianne Skoll
8b795e81b7 Port Danish to da.rem 2022-03-23 14:47:22 -04:00
Dianne Skoll
aef7eeda5a Make "de" runtime localization match compiled version. 2022-03-23 12:04:54 -04:00
Dianne Skoll
0641a6f8f1 Add support for the "subst_#x" functions to simplify language customization. 2022-03-23 11:52:51 -04:00
Dianne Skoll
4fdf7b706b More work on making run-time language module match compile-time module. 2022-03-23 11:47:00 -04:00
Dianne Skoll
0653b9420a Add "q" suboption to "-p" to not suppress quote markers. 2022-03-23 11:02:16 -04:00
Dianne Skoll
27ede1ce37 Start working on runtime language files; make sure they give
the same tstlang.rem output as compiled language files.
2022-03-23 10:16:59 -04:00
Dianne Skoll
a303fb9cba Tweak configure script to use autoconf macros 2022-03-22 10:40:41 -04:00
Dianne Skoll
92af4e9c3e Only use -flto=auto and -ffat-lto-objects if C compiler supports them. 2022-03-22 10:33:36 -04:00
Dianne Skoll
abc4f45fed Compile with link-time optimization enabled if we're using gcc 2022-03-22 09:18:28 -04:00
Dianne Skoll
e651f92bd9 Make tests pass even if we use LTO. 2022-03-22 09:17:31 -04:00
Dianne Skoll
b2d3d98d72 Update de.rem 2022-03-20 14:22:15 -04:00
Dianne Skoll
cb8b7f85af Language tweaks 2022-03-20 14:20:01 -04:00
Dianne Skoll
d30f347a0b More language work. 2022-03-20 13:05:24 -04:00
Dianne Skoll
5e9b1e7464 Fix compilation errors for non-English languages. 2022-03-20 10:49:37 -04:00
Dianne Skoll
58085470c5 Install fr.rem 2022-03-20 10:31:53 -04:00
Dianne Skoll
8f0de805d5 More work on fr.rem 2022-03-20 10:27:04 -04:00
Dianne Skoll
3f879a1b97 Add subst_ampm and subst_ordinal 2022-03-20 10:20:50 -04:00
Dianne Skoll
94270c3d98 Add sys vars 2022-03-20 10:01:31 -04:00
Dianne Skoll
bb8a689186 Add a whole slew of system variables to customize language. 2022-03-20 09:53:31 -04:00
Dianne Skoll
a7e73cdac8 Remove IN_DOSUBST guards. 2022-03-20 09:44:42 -04:00
Dianne Skoll
d38c324340 Start making language stuff dynamic. 2022-03-20 09:42:24 -04:00
Dianne Skoll
fade38d522 Add $SysInclude system variable. 2022-03-20 08:56:01 -04:00
Dianne Skoll
858a7601aa Add support for "subst_X" functions to modify dosubst. 2022-03-19 15:53:21 -04:00
Dianne Skoll
37e3d3d1d1 Add $Today and $Tomorrow system variables. 2022-03-19 15:17:18 -04:00
Dianne Skoll
ff67ab3c86 We only need 6 digits of precision. 2022-03-17 17:37:40 -04:00
Dianne Skoll
ad7faa8ad9 Don't check errno 2022-03-17 17:33:50 -04:00
Dianne Skoll
c927166a8a Accept but warn if $Latitude/$Longituded uses locale decimal separator instead of "." 2022-03-17 11:29:27 -04:00
Dianne Skoll
9d22fba842 Document that decimal separator for $Latitude and $Longitude is always "." 2022-03-17 11:23:16 -04:00
Dianne Skoll
3d5adf6c42 Always interpret $Latitude and $Longitude values in the C locale. 2022-03-17 11:21:27 -04:00
Dianne Skoll
5ba862cbd7 Don't define RET as 'remind-indent-line 2022-03-17 10:22:13 -04:00
Dianne Skoll
6f20e056c9 Allow day numbers to be anchored to left, center or right.
Based on a patch from Paulo <qsmodo *AT* tutanota.com>
2022-03-16 17:30:06 -04:00
Dianne Skoll
878ab1a8bc Fix a bunch of spelling mistakes found by Jens Schleusener 2022-03-15 14:40:46 -04:00
Dianne Skoll
4d17494371 Bump copyright date. 2022-03-14 21:12:20 -04:00
Dianne Skoll
65763b9522 Document release date. 2022-03-14 17:37:03 -04:00
Dianne Skoll
52840d40de Update docs. 2022-03-14 17:07:04 -04:00
Dianne Skoll
6892e7a805 Better mode name. 2022-03-13 16:59:27 -04:00
Dianne Skoll
24d0264f92 Improve remind-conf-mode syntax highlighting to make it case-insensitive. 2022-03-13 16:56:47 -04:00
Dianne Skoll
56c37e4e05 Bump version. 2022-03-13 16:26:44 -04:00
Dianne Skoll
86c99102b5 Update remind-conf-mode.el with new keywords, built-in variables and functions 2022-03-13 16:25:58 -04:00
Dianne Skoll
de4a23ee1e Add DO keyword to remind.vim 2022-03-13 16:09:06 -04:00
Dianne Skoll
6a9f7c186a Refactor code to reduce cut-n-paste. 2022-03-13 09:15:48 -04:00
Dianne Skoll
eaed22a42b Fix typo 2022-03-13 09:11:03 -04:00
Dianne Skoll
f47cf2320e Catch expression-pasting errors on all REM commands. 2022-03-12 15:51:30 -05:00
Dianne Skoll
eb100e57e2 Parse untriggered reminder lines to catch expression-pasting errors. 2022-03-12 15:48:31 -05:00
110 changed files with 8812 additions and 1779 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
liberapay: dskoll

7
.github/README.md vendored Normal file
View File

@@ -0,0 +1,7 @@
# Remind has moved
For various reasons, I have decided to move Remind off GitHub. This repo
will be archived. To create merge requests or issues, please visit
Remind's new home at https://salsa.debian.org/dskoll/remind
-- Dianne Skoll

29
.github/workflows/github-action.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
# language: bash
---
name: Remind unit tests
on:
push
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Remind
uses: actions/checkout@v2
- name: Add test user
run: |
sudo adduser --home /home/testuser --gecos 'Test User' --disabled-password testuser
- name: Fix ownership
run: |
sudo chown -R testuser .
- name: Build
run: |
sudo su -c './configure && make' testuser
- name: Run Tests
run: |
sudo su -c 'make test' testuser
- name: Fix up permissions so GitHub does not complain
run: |
sudo chmod -R a+rwX .

27
.gitignore vendored
View File

@@ -1,27 +1,34 @@
rem2pdf/Makefile.old
*.bak
*.o
*~
.gitignore
MYMETA.json
MYMETA.yml
Makefile
TAGS
autom4te.cache
blib/
config.log
config.status
man/rem.1
man/rem2ps.1
man/remind.1
man/tkremind.1
pm_to_blib
rem2html/Makefile
rem2html/rem2html.1
rem2pdf/Makefile.PL
rem2pdf/Makefile.old
rem2pdf/Makefile.top
rem2pdf/bin/rem2pdf
set-irc-topic
src/*.tar.gz*
src/Makefile
src/config.h
src/rem2ps
src/remind
src/test-*.out
src/version.h
tests/test.out
www/Makefile
rem2pdf/Makefile.PL
MYMETA.json
MYMETA.yml
Makefile
blib/
pm_to_blib
rem2pdf/Makefile.top
rem2pdf/bin/rem2pdf
rem2html/rem2html.1
gmon.out

13
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,13 @@
tests:
image: 'debian:stable-slim'
before_script:
- apt update && apt-get -y install gcc make
- useradd --create-home testuser
- chown -R testuser .
- chmod -R go-w .
script:
- LANG=C.UTF-8 su testuser -c './configure && make all && make test'
artifacts:
when: always
paths:
- tests/test.out

View File

@@ -3,7 +3,7 @@ THE REMIND COPYRIGHT
1. REMIND refers to the entire set of files and documentation in the
REMIND package.
2. REMIND is Copyright 1992-2021 Dianne Skoll, except where noted in
2. REMIND is Copyright 1992-2022 Dianne Skoll, except where noted in
individual files.
3. DISTRIBUTION AND USE

View File

@@ -12,20 +12,33 @@ all: src/Makefile
@$(MAKE) -C rem2pdf -f Makefile.top
install:
@echo ""
@echo "*********************"
@echo "* *"
@echo "* Installing REMIND *"
@echo "* *"
@echo "*********************"
@echo "**********************************"
@echo "* *"
@echo "* Installing REMIND (unstripped) *"
@echo "* *"
@echo "**********************************"
@echo ""
@$(MAKE) -C src install
@$(MAKE) -C rem2html install
@$(MAKE) -C rem2pdf -f Makefile.top install INSTALL_BASE=$(INSTALL_BASE)
clean:
find . -name '*~' -exec rm {} \;
-rm man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1
-$(MAKE) -C src clean
-$(MAKE) -C rem2pdf clean
install-stripped:
@echo ""
@echo "********************************"
@echo "* *"
@echo "* Installing REMIND (stripped) *"
@echo "* *"
@echo "**********************************"
@echo ""
@$(MAKE) -C src install-stripped
@$(MAKE) -C rem2html install
@$(MAKE) -C rem2pdf -f Makefile.top install INSTALL_BASE=$(INSTALL_BASE)
test:
@$(MAKE) -C src -s test

40
README
View File

@@ -34,5 +34,45 @@ If you do NOT have Tcl/Tk or are NOT running X Windows:
5) Type: "make install" -- you may need to be root to do this.
PREREQUISITES:
--------------
Remind and rem2ps have no prerequisites beyond the standard C library and
the standard math library.
Rem2HTML requires the JSON::MaybeXS Perl module.
Rem2PDF requires the JSON::MaybeXS, Pango and Cairo Perl modules.
- On Debian-like systems, these prerequisites may be installed with:
apt install libjson-maybexs-perl libpango-perl libcairo-perl
- On RPM-based systems, you need perl-Pango, perl-Cairo and perl-JSON-MaybeXS
- On Gentoo, you need dev-perl/Pango, dev-perl/Cairo and dev-perl/JSON-MaybeXS.
- On Arch linux, you need pango-perl, cairo-perl and perl-json-maybexs
TkRemind requires Tcl/Tk and the tcllib library.
- On Debian-like systems, install with:
apt install tcl tk tcllib
- On RPM-based systems, you need tcl, tk and tcllib
- On Arch Linux, you need tk and tcllib. The latter is available at
https://aur.archlinux.org/packages/tcllib
If the little arrows for "Previous Month" and "Next Month" do not display
correctly in TkRemind, you may need to install the Noto Fonts. Install
all of your distribution's Nonto Font-related packages.
- On Debian-like systems, install with:
apt install fonts-noto-core fonts-noto-color-emoji \
fonts-noto-extra fonts-noto-ui-core fonts-noto-ui-extra
==========================================================================
Contact info: mailto:dianne@skoll.ca
Home page: https://dianne.skoll.ca/projects/remind/

View File

@@ -355,7 +355,7 @@ proc RunCommand { cmd } {
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Reads characters from command pipelin and appends them to .msg.
# Reads characters from command pipeline and appends them to .msg.
#***********************************************************************
proc CommandReadable { f } {
global CmdDone

42
configure vendored
View File

@@ -622,6 +622,7 @@ ac_includes_default="\
ac_header_list=
ac_subst_vars='LTLIBOBJS
LIBOBJS
RELEASE_DATE
PERLARTIFACTS
VERSION
EGREP
@@ -3306,7 +3307,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
$as_echo_n "checking for sqrt in -lm... " >&6; }
if ${ac_cv_lib_m_sqrt+:} false; then :
@@ -3974,6 +3974,29 @@ fi
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
# Check for link-time optimization support
f=-flto=auto
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $f" >&5
$as_echo_n "checking whether $CC supports $f... " >&6; }
if $CC -E $f /dev/null > /dev/null 2>&1 ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$CFLAGS $f"
f=-ffat-lto-objects
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $f" >&5
$as_echo_n "checking whether $CC supports $f... " >&6; }
if $CC -E $f /dev/null > /dev/null 2>&1 ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$CFLAGS $f"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test "$ac_cv_perlartifacts" = "yes" ; then
@@ -3982,6 +4005,14 @@ else
PERLARTIFACTS='NO_PACKLIST=1 NO_PERLLOCAL=1'
fi
RELEASE_DATE=`grep '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' docs/WHATSNEW | head -n 1 | awk '{print $NF}'`
# Sanity-check release date
echo "$RELEASE_DATE" | grep '^....-..-..$' > /dev/null 2>&1
if test "$?" != 0 ; then
echo "*** COULD NOT DETERMINE RELEASE DATE: docs/WHATSNEW is incorrect!"
exit 1
fi
for ac_func in setenv unsetenv glob mbstowcs setlocale initgroups
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -3994,11 +4025,12 @@ _ACEOF
fi
done
VERSION=03.04.02
VERSION=04.02.01
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf"
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4698,6 +4730,10 @@ do
"rem2pdf/Makefile.PL") CONFIG_FILES="$CONFIG_FILES rem2pdf/Makefile.PL" ;;
"rem2pdf/Makefile.top") CONFIG_FILES="$CONFIG_FILES rem2pdf/Makefile.top" ;;
"rem2pdf/bin/rem2pdf") CONFIG_FILES="$CONFIG_FILES rem2pdf/bin/rem2pdf" ;;
"man/rem.1") CONFIG_FILES="$CONFIG_FILES man/rem.1" ;;
"man/rem2ps.1") CONFIG_FILES="$CONFIG_FILES man/rem2ps.1" ;;
"man/remind.1") CONFIG_FILES="$CONFIG_FILES man/remind.1" ;;
"man/tkremind.1") CONFIG_FILES="$CONFIG_FILES man/tkremind.1" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@@ -28,8 +28,6 @@ AC_PROG_MAKE_SET
AC_PATH_PROG([PERL], [perl])
dnl Checks for libraries.
dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, sqrt)
dnl Integer sizes
@@ -48,6 +46,23 @@ AC_HEADER_TIME
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
# Check for link-time optimization support
f=-flto=auto
AC_MSG_CHECKING([whether $CC supports $f])
if $CC -E $f /dev/null > /dev/null 2>&1 ; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS $f"
f=-ffat-lto-objects
AC_MSG_CHECKING([whether $CC supports $f])
if $CC -E $f /dev/null > /dev/null 2>&1 ; then
AC_MSG_RESULT([yes])
CFLAGS="$CFLAGS $f"
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
fi
if test "$ac_cv_perlartifacts" = "yes" ; then
@@ -56,10 +71,19 @@ else
PERLARTIFACTS='NO_PACKLIST=1 NO_PERLLOCAL=1'
fi
RELEASE_DATE=`grep '[[0-9]][[0-9]][[0-9]][[0-9]]-[[0-9]][[0-9]]-[[0-9]][[0-9]]' docs/WHATSNEW | head -n 1 | awk '{print $NF}'`
# Sanity-check release date
echo "$RELEASE_DATE" | grep '^....-..-..$' > /dev/null 2>&1
if test "$?" != 0 ; then
echo "*** COULD NOT DETERMINE RELEASE DATE: docs/WHATSNEW is incorrect!"
exit 1
fi
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
VERSION=03.04.02
VERSION=04.02.01
AC_SUBST(VERSION)
AC_SUBST(PERL)
AC_SUBST(PERLARTIFACTS)
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf)
AC_SUBST(RELEASE_DATE)
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1)
chmod a+x rem2pdf/bin/rem2pdf

View File

@@ -32,7 +32,7 @@
# version 0.5 2007-03-21
# - Add more help options
# - --project-lead-time option
# - Supress printing of heading if there are no todos to print
# - Suppress printing of heading if there are no todos to print
# version 0.4
# - Version 0.4 changes all written or inspired by, and thanks to Mark Stosberg
# - Change to GetOptions
@@ -84,7 +84,7 @@ How may days in advance to start getting reminders about the events. Defaults to
ical2rem.pl --no-todos
If you don't care about the ToDos the calendar, this will surpress
If you don't care about the ToDos the calendar, this will suppress
printing of the ToDo heading, as well as skipping ToDo processing.
=head2 --heading

View File

@@ -141,7 +141,7 @@ appear with exactly the text and exactly the same duration (including
one VEVENT object, that will have a RFC2445 C<RDATE> property.
B<rem2ics> is not yet smart enough to derive an C<RRULE> based
recurrance. If you really want that feature, either implement it and
recurrence. If you really want that feature, either implement it and
send in a patch, or contact the author and convince him to do it.
=head2 Other iCalendar Properties
@@ -164,7 +164,7 @@ runs.
=head2 Other iCalendar Perl objects
Why does't B<rem2ics> use any of the iCalendar Perl stuff in CPAN?
Why doesn't B<rem2ics> use any of the iCalendar Perl stuff in CPAN?
Because I don't trust them, and they are too big for this app. One
links to a binary library. Another hasn't been maintained since 1991,
and is full of notes as to how buggy and incomplete it is. And so
@@ -218,7 +218,7 @@ Bug fix, error message for non-recurring events
Bug fix,
rem2ics 0.91 chokes on timed reminders with
duration using `remind -s` as it functions in remind-03.01.03.
Remind 3.01 changed how the -s data is formated for events that have a duration
Remind 3.01 changed how the -s data is formatted for events that have a duration
Patch by Paul Hinze E<lt>paul dot t dot hinze at gmail dot comE<gt>
and Michael Schultz E<lt>mjschultz at gmail dot comE<gt>
@@ -376,7 +376,7 @@ foreach $v (@events) {
my(%grovel);
# if the user doesnt want recurrance detection
# if the user doesn't want recurrence detection
unless ($options{norecurr}) {
# then dont put events in the grovel hash
@@ -393,7 +393,7 @@ unless ($options{norecurr}) {
$v = ${$grovel{$k}}[0];
$v->{recurlist} = \@{$grovel{$k}};
foreach my $v0 (@{$grovel{$k}}) {
$v0->{is_recurrance} = $v;
$v0->{is_recurrence} = $v;
}
}
}
@@ -409,12 +409,12 @@ unless ($options{norecurr}) {
# might have a problem if a recurring event has two instances both on
# the first day.
# Every event that is recurring has a "is_recurrance" property.
# Every event that is recurring has a "is_recurrence" property.
# Additionally, (hopefully) the first/earliest event in a set of
# recurrances has a "recurlist" property. The "recurlist" is a
# recurrences has a "recurlist" property. The "recurlist" is a
# reference to a list of references to each of the events. The first
# one on that list will be the same event that has the "recurlist"
# property. The "is_recurrance" property is a reference back to the
# property. The "is_recurrence" property is a reference back to the
# event that has the "recurlist" property.
foreach my $k (keys %grovel) {
@@ -466,8 +466,8 @@ foreach my $k (keys %grovel) {
}
foreach $v (@events) {
# for recurrant events, skip those that arnt the "head"
next if ($v->{is_recurrance} and (not $v->{recurlist}));
# for recurrent events, skip those that arnt the "head"
next if ($v->{is_recurrence} and (not $v->{recurlist}));
if (${$v->{sf}}[4] eq "*") { # no time was given
$v->{i_dtstart} = sprintf("DTSTART:%s", $v->{dts});
@@ -485,7 +485,7 @@ foreach $v (@events) {
}
if (${$v->{sf}}[3] ne "*") { # a duration was given
# It's convienient that RFC2445 defines DURATION, thus we
# It's convenient that RFC2445 defines DURATION, thus we
# don't need to calculate DTEND, with awkward figuring out
# crossing hours, days, months, year, etc. Instead we
# will let the iCalendar consuming application worry about it.
@@ -501,8 +501,8 @@ print "BEGIN:VCALENDAR\015\012"
# output each vevent
foreach $v (@events) {
# for recurrant events, only output the "head", skip the others
next if ($v->{is_recurrance} and (not $v->{recurlist}));
# for recurrent events, only output the "head", skip the others
next if ($v->{is_recurrence} and (not $v->{recurlist}));
print "BEGIN:VEVENT\015\012";
my $tag = ${$v->{sf}}[2];

View File

@@ -5,7 +5,7 @@
;; Author: Shelagh Manton <shelagh.manton@gmail.com> with help from
;; Dianne Skoll
;; Keywords: remind configure convenience
;; Version: 0.14
;; Version: 0.15-dfs2
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
@@ -91,7 +91,6 @@
(define-key remind-conf-mode-map "\C-c\C-x" 'rem-tomorrow)
(define-key remind-conf-mode-map "\C-c\C-a" 'rem-days-away)
(define-key remind-conf-mode-map "\M-j" 'remind-indent-line)
(define-key remind-conf-mode-map (kbd "RET") 'remind-indent-line)
(define-key remind-conf-mode-map "\C-c\C-c" 'rem-save-file)
;; syntax-table
@@ -111,12 +110,18 @@
(defconst remind-keywords
(sort
(list "RUN" "REM" "ONCE" "SATISFY" "BEFORE" "UNSET" "OMIT" "FIRST" "SATISFY"
"OMIT" "DATE" "SKIP" "ONCE" "AFTER" "WARN" "PRIORITY" "AT" "SCHED" "IF" "ELSE" "ENDIF"
"WARN" "UNTIL" "THROUGH" "SCANFROM" "DURATION" "TAG" "MSG" "MSF" "CAL" "SPECIAL" "IFTRIG"
"PS" "PSFILE" "BANNER" "INCLUDE" "PUSH-OMIT-CONTEXT" "DEBUG" "DUMPVARS" "PUSH" "CLEAR" "POP"
"CLEAR-OMIT-CONTEXT" "POP-OMIT-CONTEXT" "SET" "ERRMSG" "FSET" "DUMP" "BAN" "INC" "SCAN"
"EXIT" "FLUSH" "PRESERVE" "MOON" "COLOR" "UNSET")
(list "ADDOMIT" "AFTER" "AT" "BANNER" "BEFORE"
"CAL" "CLEAR-OMIT-CONTEXT" "DEBUG" "DO" "DUMPVARS"
"DURATION" "ELSE" "ENDIF" "ERRMSG" "EXIT" "FIRST"
"FLUSH" "FOURTH" "FROM" "FSET" "IF" "IFTRIG" "IN"
"INCLUDE" "INCLUDECMD" "LAST" "LASTDAY"
"LASTWORKDAY" "MAYBE-UNCOMPUTABLE" "MSF"
"MSG" "OMIT" "OMITFUNC" "ONCE"
"POP-OMIT-CONTEXT" "PRESERVE" "PRIORITY" "PS" "PSFILE"
"PUSH-OMIT-CONTEXT" "REM" "RUN" "SATISFY" "SCANFROM"
"SCHED" "SECOND" "SET" "SKIP" "SPECIAL"
"TAG" "THIRD" "THROUGH" "UNSET" "UNTIL"
"WARN")
#'(lambda (a b) (> (length a) (length b)))))
@@ -127,12 +132,20 @@
(defconst remind-builtin-variables
(sort
(list "$CalcUTC" "$CalMode" "$Daemon" "$DateSep" "$DefaultPrio" "$DontFork" "$DontTrigAts" "$DontQueue"
"$EndSent" "$EndSentIg" "$NumTrig" "$FirstIndent" "$FoldYear" "$FormWidth" "$HushMode"
"$IgnoreOnce" "$InfDelta" "$NextMode" "$NumQueued" "$NumTrig" "$PrefixLineNo" "$PSCal" "$RunOff"
"$SimpleCal" "$SortByDate" "$SortByPrio" "$MinsFromUTC" "$LatDeg" "$LatMin" "$LatSec" "$EndSent"
"$EndSentIg" "$Location" "$LongDeg" "$LongMin" "$LongSec" "$MaxSatIter" "$SubsIndent" "$T" "$Td"
"$Tm" "$Tw" "$Ty" "$TimeSep" "$UntimedFirst" "$U" "$Ud" "$Um" "$Uw" "$Uy")
(list "$Ago" "$Am" "$And" "$April" "$At" "$August" "$CalcUTC" "$CalMode" "$Daemon" "$DateSep"
"$DateTimeSep" "$December" "$DefaultColor" "$DefaultPrio"
"$DefaultTDelta" "$DeltaOffset" "$DontFork" "$DontQueue"
"$DontTrigAts" "$EndSent" "$EndSentIg" "$February" "$FirstIndent"
"$FoldYear" "$FormWidth" "$Friday" "$Fromnow" "$Hour" "$Hplu" "$HushMode" "$IgnoreOnce"
"$InfDelta" "$IntMax" "$IntMin" "$Is" "$January" "$July" "$June" "$LatDeg"
"$Latitude" "$LatMin" "$LatSec" "$Location" "$LongDeg" "$Longitude"
"$LongMin" "$LongSec" "$March" "$MaxSatIter" "$MaxStringLen" "$May"
"$MinsFromUTC" "$Minute" "$Monday" "$Mplu" "$NextMode" "$November" "$Now" "$NumQueued"
"$NumTrig" "$October" "$On" "$Pm" "$PrefixLineNo" "$PSCal" "$RunOff" "$Saturday"
"$September" "$SimpleCal" "$SortByDate" "$SortByPrio" "$SortByTime"
"$SubsIndent" "$Sunday" "$SysInclude" "$T" "$Td" "$Thursday" "$TimeSep" "$Tm"
"$Today" "$Tomorrow" "$Tuesday" "$Tw" "$Ty" "$U" "$Ud" "$Um" "$UntimedFirst" "$Uw" "$Uy"
"$Was" "$Wednesday")
#'(lambda (a b) (> (length a) (length b)))))
@@ -147,15 +160,22 @@
(defconst remind-builtin-functions
(sort
(list "abs" "access" "args" "asc" "baseyr" "char" "choose" "coerce" "current" "date" "datetime" "datepart"
"dawn" "day" "daysinmon" "defined" "dosubst" "dusk" "easter" "easterdate" "evaltrig" "filedate"
"filedatetime" "filedir" "filename" "getenv" "hebdate" "hebday" "hebmon" "hebyear" "hour" "iif" "index" "isdst"
"isleap" "isomitted" "language" "lower" "max" "min" "minute" "minsfromutc" "mon" "monnum" "moondate" "moondatetime"
"moonphase" "moontime" "msgprefix" "msgsuffix" "nonomitted" "now" "ord" "ostype" "plural"
"psmoon" "psshade" "realcurrent" "realnow" "realtoday" "sgn" "shell" "slide" "strlen" "substr" "sunrise" "sunset" "time" "timepart"
"thisyear" "today" "trigdate" "trigdatetime" "trigger" "trigger" "trigtime" "trigvalid" "typeof" "tzconvert" "upper" "value"
"version" "weekno" "wkday" "wkdaynum" "year"
)
(list "abs" "access" "adawn" "adusk" "ampm" "args" "asc" "baseyr" "char"
"choose" "coerce" "current" "date" "datepart" "datetime" "dawn" "day"
"daysinmon" "defined" "dosubst" "dusk" "easterdate" "evaltrig"
"filedate" "filedatetime" "filedir" "filename" "getenv" "hebdate"
"hebday" "hebmon" "hebyear" "hour" "iif" "index" "isany" "isdst"
"isleap" "isomitted" "language" "lower" "max" "min" "minsfromutc"
"minute" "mon" "monnum" "moondate" "moondatetime" "moonphase"
"moontime" "ndawn" "ndusk" "nonomitted" "now" "ord" "ostype" "pad" "plural"
"psmoon" "psshade" "realcurrent" "realnow" "realtoday" "sgn" "shell"
"shellescape" "slide" "strlen" "substr" "sunrise" "sunset" "time"
"timepart" "today" "trig" "trigback" "trigdate" "trigdatetime"
"trigdelta" "trigduration" "trigeventduration" "trigeventstart"
"trigfrom" "trigger" "trigpriority" "trigrep" "trigscanfrom"
"trigtime" "trigtimedelta" "trigtimerep" "triguntil" "trigvalid"
"typeof" "tzconvert" "upper" "value" "version" "weekno" "wkday"
"wkdaynum" "year")
#'(lambda (a b) (> (length a) (length b)))))
;;; faces
@@ -244,12 +264,35 @@
:group 'remind-conf
)
(defconst remind-keywords-regex (regexp-opt remind-keywords 'words))
(defconst remind-type-keywords-regex (regexp-opt remind-type-keywords 'words))
(defconst remind-builtin-variables-regex (regexp-opt remind-builtin-variables 'words))
(defconst remind-builtin-functions-regex (regexp-opt remind-builtin-functions 'words))
(defconst remind-time-words-regex (regexp-opt remind-time-words 'words))
;; Case-insensitive matching functions
(defun remind-keywords-matcher (limit)
(let ((case-fold-search t))
(re-search-forward remind-keywords-regex limit 'no-error)))
(defun remind-type-keywords-matcher (limit)
(let ((case-fold-search t))
(re-search-forward remind-type-keywords-regex limit 'no-error)))
(defun remind-builtin-variables-matcher (limit)
(let ((case-fold-search t))
(re-search-forward remind-builtin-variables-regex limit 'no-error)))
(defun remind-builtin-functions-matcher (limit)
(let ((case-fold-search t))
(re-search-forward remind-builtin-functions-regex limit 'no-error)))
(defun remind-time-words-matcher (limit)
(let ((case-fold-search t))
(re-search-forward remind-time-words-regex limit 'no-error)))
;; keywords
(defconst remind-conf-font-lock-keywords-1
(list
'("^[\;\#]\\s-+.*$" . remind-comment-face)
(cons (regexp-opt remind-keywords 'words) remind-conf-keyword-face)
'(remind-keywords-matcher . remind-conf-keyword-face)
'("%[\"_]" . font-lock-warning-face)
'("\\(%[a-mops-w]\\)" . remind-conf-substitutes-face)
'("\"[^\"]*\"" . remind-string-face))
@@ -258,15 +301,15 @@
(defconst remind-conf-font-lock-keywords-2
(append remind-conf-font-lock-keywords-1
(list
(cons (regexp-opt remind-time-words 'words) remind-time-face)
(cons (regexp-opt remind-builtin-functions 'words) remind-conf-command-face)
'(remind-time-words-matcher . remind-time-face)
'(remind-builtin-functions-matcher . remind-conf-command-face)
'("%$" . remind-conf-endline-face)))
"Additional commands to highlight in `remind-conf-mode'.")
(defconst remind-conf-font-lock-keywords-3
(append remind-conf-font-lock-keywords-2
(list
(cons (regexp-opt remind-type-keywords 'words) remind-conf-type-face)
'(remind-type-keywords-matcher . remind-conf-type-face)
'("\[[a-zA-Z]\\{3,6\\}\]" . remind-conf-color-face)
'("\\s-+\\([12][0-9]\\|3[01]\\|0?[0-9]\\)\\s-+" . remind-conf-substitutes-face);better date regexp
'("\\s-+\\([12][09][0-9][0-9][-/]\\(0[1-9]\\|1[0-2]\\)[-/]\\([12][0-9]\\|0[1-9]\\|3[01]\\)\\)\\s-+" . remind-time-face) ;; pseudo ISO 8601 date format.
@@ -274,7 +317,7 @@
'("\\s-+\\(\\(?:20\\|19\\)[0-9][0-9]\\)\\s-+" . remind-conf-substitutes-face);years
'("\\s-+\\(2[0-4]\\|[01]?[0-9][.:][0-5][0-9]\\)\\s-+" . remind-conf-substitutes-face);24hour clock, more precise
'("\\s-+\\([+-][+-]?[1-9][0-9]*\\)\\s-+" 1 remind-conf-delta-face prepend)
(cons (regexp-opt remind-builtin-variables 'words) remind-conf-variable-face)))
'(remind-builtin-variables-matcher . remind-conf-variable-face)))
"The ultimate in highlighting experiences for `remind-conf-mode'.")
;;YYYY-MM-DD@hh:mm, YYYY-MM-DD@hh.mm, YYYY/MM/DD@hh:mm and YYYY/MM/DD@hh.mm
@@ -462,12 +505,11 @@ Acts on the region or places point where it needs to be."
;; finally the derived mode.
;;;###autoload
(define-derived-mode remind-conf-mode text-mode "REM"
(define-derived-mode remind-conf-mode text-mode "Remind Conf Mode"
"Major mode for editing remind calendar configuration files.
\\{remind-conf-mode-map}"
:syntax-table remind-conf-syntax-table
(set (make-local-variable 'font-lock-keywords-case-fold-search) t) ;this is not working atm 2009-04-13
(set (make-local-variable 'font-lock-defaults) '(remind-conf-font-lock-keywords))
(set (make-local-variable 'comment-start) ";")
(set (make-local-variable 'comment-start) "#")

View File

@@ -1,6 +1,233 @@
CHANGES TO REMIND
* VERSION 3.4 Patch 2 - 2022-??-??
* VERSION 4.2 Patch 1 - 2022-12-15
- MINOR IMPROVEMENT: TkRemind: If "Extra Remind Options" contains -m, make
TkRemind start the calendar with Monday instead of Sunday.
- MINOR IMPROVEMENT: Sample files: Add French holidays courtesy of
Clément Bœsch.
- MINOR IMPROVEMENT: A few performance fixes, likely not even noticeable in
most cases.
- MINOR FIXES: Fix misleading comments in the source code.
- MINOR FIX: Remove a bunch of dead code in the moon-phase routines.
- MINOR FIX: Remove unnecessary %"...%" markers in holidays/us.rem
- MINOR FIX: Don't use the -ffat-lto-objects if we're compiling with Clang.
- MINOR FIX: Remind: Fix a broken printf-format string (need to double up on %
to get a literal % in the output.)
- BUG FIX: Make test suite pass regardless of the date on which it is run.
D'oh!!!
- BUG FIX: Make sure the banner gets printed each time through a "*N"
command-line option loop.
* VERSION 4.2 Patch 0 - 2022-10-14
- NEW FEATURE: remind: Allow weekdays to be globally-omitted. For example:
OMIT Saturday Sunday
globally-omits all Saturdays and Sundays.
- NEW FEATURE: remind: Add ansicolor() built-in function to make it easier
to colorize reminders on the terminal. Suggested by Tim Chase.
- NEW FEATURE: remind: Add several special variables related to the color
mode: $UseVTColors, $UseBGVTColors, $Use256Colors, $UseTrueColors and
$TerminalBackground. Based on a suggestion by Tim Chase.
- NEW FEATURE: remind: Add utctolocal() and localtoutc() built-in functions.
- NEW FEATURE: remind: Add timezone() built-in function.
- NEW FEATURE: remind: Add trigtags() function per suggestion from Tim Chase.
- NEW FEATURE: remind: The $AddBlankLines system variable controls whether or
not a blank line is added after each reminder.
- NEW FEATURE: remind: The built-in functions columns() and rows() return the
width and height of the terminal (in character positions) respectively.
- NEW FEATURE: remind: The built-in function columns("string") returns the
number of columns occupied by "string" on the terminal, taking into account
double-width Unicode characters and zero-width ANSI escape sequences.
- NEW FEATURE: remind: You can add custom substitution sequences of the form
%{name} or %*{name} that end up calling the function subst_name and using
its return value as the replacement for the substitution sequence.
- NEW FEATURE: remind: Add the FUNSET command to undefine a user-defined
function.
- NEW FILES: Add standard include files holidays/jewish.rem and
ansitext.rem (the latter defines standard ANSI escape codes for
changing text attributes such as bold, underline, etc.)
- NEW EXAMPLES: add examples/alignmemt.rem, examples/ansitext and
examples/astro
- BUG FIX: remind: Make MSF correctly format UTF-8 text and text with
embedded ANSI color-changing codes.
- BUG FIX: remind: Make ADDOMIT actually work correctly in a SATISFY-type
REM command. Bug found by Gunther Reißig
- BUG FIX: Convert documentation files and src/lang.h to UTF-8. Patch
from Jochen Sprickerhof.
- BUG FIX: Fix tests in non-UTF-8 locales.
- BUG FIX: Fix a few problems with the include/holidays/us.rem file.
- BUG FIX: remind: Fix an ancient logic error in DBufPutc that hurt
performance.
- MINOR IMPROVEMENT: Clean up code and remove some dead code.
* VERSION 4.1 Patch 0 - 2022-09-25
- NEW FEATURE: remind: "remind -c" now supports the MOON special, printing
the moon phases in the calendar if the locale supports UTF-8 encoding.
- NEW FEATURE: remind: "remind -c" now supports the SHADE special. Works
best with the 256-color extended XTerm palette or 24-bit true-color
terminal escape sequences.
- NEW FEATURE: remind: "remind -c" now supports the WEEK special.
- NEW FEATURE: remind: The new "stdout()" function returns a string describing
where stdout is going. Examples of return values are "TTY" if remind's
output is going to terminal, "FILE" if it's redirected to a plain file,
or "PIPE" if it's going to a pipe. See the man page for all the details.
- NEW FEATURE: Add the "-wt" option to set the calendar width to the terminal
width even if standard output is a pipe. Useful for situations like this:
remind -wt -c .reminders | less -R
- CHANGE: "make install" now no longer strips debugging symbols from the
remind and rem2ps executables. Use "make install-stripped" if you want
them stripped.
- CHANGE: remind: "remind -c" highlights today's date in bold, if
colors are enabled.
- CHANGE: Dump string values with control characters escaped.
- DOCUMENTATION FIX: Document behavior of DO and filedir() with respect
to symbolic links.
- DOCUMENTATION FIX: Add home page link to man pages. Suggested by Ian! D.
Allen.
- DOCUMENTATION FIX: Make date in man pages actually be the release date.
Include Remind version in man pages. Also suggested by Ian! D. Allen.
- DOCUMENTATION FIX: Fix inaccuracy in how string constants were documented.
- BUG FIX: Makefiles: Pass CFLAGS at link-time so link-time optimization
actually happens. Pointed out by Zoltan Puskas.
- BUG FIX: If the first REM command to trigger was a RUN command, the banner
would not print. This has been fixed.
- BUG FIX: replace deprecated 'fgrep' with 'grep -F' (Jochen Sprickerhof)
- BUG FIX: make "make test" depend on "make all" (Jochen Sprickerhof)
- BUG FIX: make "REM ... SATISFY ... MSG foo" respect $DefaultColor. Bug
reported by Gunther Reißig.
- BUG FIX: Don't consider IFTRIG true if we could not compute a trigger date.
Bug noted by Gunther Reißig.
* VERSION 4.0 Patch 3 - 2022-08-16
- IMPROVEMENT: remind: add plain_body and calendar_body JSON keys in -pp...
output.
- BUG FIX: tkremind: Don't create empty files called '&1' when creating
a new reminder.
- BUG FIX: remind: Don't call signal-unsafe functions from signal handler
* VERSION 4.0 Patch 2 - 2022-08-02
- IMPROVEMENT: remind: Allow more forms of OMIT as per Ian! D. Allen's request:
OMIT Month [THROUGH Month]
OMIT Day Month [THROUGH Day Month]
OMIT Day Month Year [THROUGH Day Month Year]
- BUG FIX: Make $T behave as documented, exactly like trigdate(). $T would
return '1989-12-31' rather than 0 if the trigger date was not valid.
- BUG FIX: TkRemind: Fix resizing bug for a calendar with 6 rows.
- DOCUMENTATION IMPROVEMENT: Improve TkRemind documentation; document use
of inotifywait if available.
* VERSION 4.0 Patch 1 - 2022-06-03
- IMPROVEMENT: Add $SuppressLRM system variable to suppress the UTF-8
Left-to-Right mark in "remind -c" output.
- DOCUMENTATION FIX: Document the "q" sub-option to the "-p" option.
* VERSION 4.0 Patch 0 - 2022-04-04
- MAJOR NEW FEATURE: remind: Remind output can effectively be
translated into other languages at run-time. A number of system
variables let you translate English words to another language, and a
mechanism for altering the substitution filter at run-time lets you
translate its output so the results are idiomatic. See the man page
sections "RUN-TIME SUPPORT FOR OTHER LANGUAGES", "RUN-TIME
MODIFICATION OF THE SUBSTITUTION FILTER" and "LANGUAGE PACKS".
- NEW FEATURE: remind: Add the pad() built-in function
- NEW FEATURE: tkremind: Day numbers can be displayed left-aligned,
centered or right-aligned.
- IMPROVEMENT: contrib/remind-conf-mode: The Emacs syntax-highlighter
has been updated with the latest system variables and functions
and has been made case-insensitive.
- IMPROVEMENT: remind, rem2ps: Use link-time optimization with gcc if
possible.
- IMPROVEMENT: remind: Print better diagnostics when errors occur inside
a user-defined function. We now show the stack trace to make it easier
to figure out where the error actually is.
- CHANGE: Add a "q" sub-option to the "-p", "-pp", and "-ppp" options.
This causes Remind *not* to remove the %"...%" marker sequence from
remind bodies.
- BUG FIX: rem2pdf: Make rem2pdf respect the --prefix ./configure flag.
Loosely based on patch by Jonathan Kamens.
- BUG FIX: tkremind: Fix the "-m" flag, which was broken in 03.04.00.
- BUG FIX: Fix the overflow-detection functions so they work with link-time
optimization. The previous versions would be optimized away.
- BUG FIX: Warn if the arguments to the "-@" option are out of range.
Problem noted by Ian! D. Allen.
- BUG FIX: Always interpret $Latitude and $Longitude input values in the
"C" locale. (We do accept localized input, but warn.)
- BUG FIX: Fix many spelling mistakes caught by Jens Schleusener
* VERSION 3.4 Patch 2 - 2022-03-14
- NEW FEATURE: remind: Add syntactic sugar to simplify some common
types of reminders. See "SYNTACTIC SUGAR FOR REM" in the remind
@@ -9,6 +236,16 @@ CHANGES TO REMIND
- CHANGE: examples/defs.rem: The examples file has been updated to use
the newer syntactic sugar.
- CHANGE: remind: Always parse the body of REM statements to catch
expression errors. In the past, something like:
REM 2025-01-02 MSG [1/0]
would not cause a division-by-zero error except on 2025-01-02. Now,
the error is always caught. NOTE POTENTIAL INCOMPATIBILITY: There may
be edge-cases when formerly-valid remind scripts now trigger errors.
However, this is pretty unlikely.
- NEW FEATURE: remind: Add the "trig" function to allow more
expressiveness when creating triggers. See man page for details.
@@ -22,6 +259,13 @@ CHANGES TO REMIND
errors with a button that lets you view the specific error messages
in a more readable format.
- IMPROVEMENT: examples/remind.vim: Update list of keywords in vim syntax
highlighting file.
- IMPROVEMENT: contrib/remind-conf-mode: Update the list of keywords,
functions and variables in the Emacs syntax-highlighting file. Also make
it match them case-insensitively.
- CHANGE: remind: Increase $MaxSatIter default to 1000 instead of 150.
Computers are much faster than when I first wrote remind and they
can handle this higher limit easily. The higher limit also enables
@@ -55,6 +299,8 @@ CHANGES TO REMIND
TkRemind would not display the first occurrence correctly. This has
been fixed.
- BUG FIX: rem2pdf: Fix typos in the man page.
- BUG FIX: remind: The IF command documentation didn't reflect how it
actually worked; now it does.
@@ -969,7 +1215,7 @@ CHANGES TO REMIND
- Fixed dates for Yom Hazikaron and Yom Ha'atzmaut if 5 Iyar falls on a
Saturday. (Hebrew calendar fix.)
- Added support for the Icelandic language, courtesy of Björn Davíðsson.
- Added support for the Icelandic language, courtesy of Björn Davíðsson.
+ BUG FIXES
@@ -1116,7 +1362,7 @@ CHANGES TO REMIND
- Made parser _very_ forgiving -- the type of reminder now defaults
to MSG. This lets you have lines in the reminder file like this:
Feb 9, 1998 Meeting with Joe.
Feb 9, 1998 Meeting with Joe.
But I don't recommend abusing it. It's mostly to ease migration from
UNIX calendar(1) files.
@@ -1707,7 +1953,7 @@ CHANGES TO REMIND
- Removed identifiers in the C source beginning with "_" to conform
to ANSI practice.
- Fixed a bug in the -u option which resulted in environment variables
SHELL and USER not being set correctly. Also made -u set the LOGNAME
environment variable.
@@ -1780,7 +2026,7 @@ CHANGES TO REMIND
- Fixed all the source files to include "config.h" first.
- Changed the way triggers are calculated so that trigger dates are
- Changed the way triggers are calculated so that trigger dates are
always valid if year, month and day are specified, and there is no
UNTIL clause. See MAN page section "DETAILS ABOUT TRIGVALID()."
@@ -1922,6 +2168,3 @@ CHANGES TO REMIND
* Version 1.0
- never publicly released.

18
examples/alignment.rem Normal file
View File

@@ -0,0 +1,18 @@
# Demo the columns() function
#
# Run as: remind -@2 alignment.rem
SET $AddBlankLines 0
BANNER %
FSET center(x) pad("", " ", (columns() - columns(x))/2) + x
FSET right(x) pad("", " ", columns() - columns(x)) + x
MSG This is left-aligned.
MSG [ansicolor(0,255,0)]This is also left-aligned.[ansicolor("")]
MSG [center("This is centered.")]
MSG [ansicolor(255,255,0) + center("🌕 🌕 🌕 🌕 This is also centered. ") + ansicolor("")]
msg [right("This is right-aligned.")]
msg [ansicolor(255,0,0) + right("This is also right-aligned. 🌕 🌕 🌕") + ansicolor("")]

35
examples/ansitext Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
#
# A little demo script that displays ANSI text attributes
# Not all attributes work on all terminals... your mileage may vary.
remind -@2 - <<'EOF'
SET $AddBlankLines 0
BANNER %
INCLUDE [$SysInclude]/ansitext.rem
MSG This file shows off some ANSI text attributes and colors.
MSG Not all attributes work on all terminals.%_
MSG This is [ansi_bold]bold.[ansi_normal]
MSG This is [ansi_faint]faint.[ansi_normal]
MSG This is [ansi_italic]italic.[ansi_normal]
MSG This is [ansi_underline]underline.[ansi_normal]
MSG This is [ansi_underline2]underline2.[ansi_normal]%_
MSG This is [ansi_reverse]reverse.[ansi_normal]%_
MSG This is [ansi_strikeout]strikeout.[ansi_normal]%_
MSG This is [ansi_overline]overline.[ansi_normal]%_
MSG This is [ansicolor(255,0,0)]red.[ansicolor("")]
MSG This is [ansicolor(0,255,0)]green.[ansicolor("")]
MSG This is [ansicolor(0,0,255)]blue.[ansicolor("")]
MSG This is [ansicolor(255,255,0)]yellow.[ansicolor("")]
MSG This is [ansicolor(255,0,255)]magenta.[ansicolor("")]
MSG This is [ansicolor(0,255,255)]cyan.[ansicolor("")]%_
# You can combine attributes
MSG This is [ansicolor(0,255,0)][ansicolor(0,0,96,1)][ansi_italic][ansi_bold]Green-Bold-Italic-on-Blue[ansi_normal][ansicolor("")]
EOF
exit 0

36
examples/astro Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
#
# A little demo script that displays astronomical events
#
# Best used in a UTF-8 environment.
remind -g -@2 - <<'EOF'
# Set this variable to 1 if your terminal has a dark background or 0 if
# it is light.
SET bg_dark 1
SET $AddBlankLines 0
BANNER %
MSG Today is [today()].%_
IF bg_dark
SPECIAL COLOR 255 255 0 Sunrise: 🌅 [sunrise()] today and [sunrise(today()+1)] tomorrow
SPECIAL COLOR 255 128 0 Sunset: 🌇 [sunset()] today and [sunset(today()+1)] tomorrow%_
REM [moondate(0)] +60 SPECIAL COLOR 255 255 0 New moon: 🌑 [moondate(0)] (%b)
REM [moondate(1)] +60 SPECIAL COLOR 255 255 128 First Quarter: 🌓 [moondate(1)] (%b)
REM [moondate(2)] +60 SPECIAL COLOR 255 255 255 Full moon: 🌕 [moondate(2)] (%b)
REM [moondate(3)] +60 SPECIAL COLOR 255 255 128 Last Quarter: 🌗 [moondate(3)] (%b)
ELSE
SPECIAL COLOR 128 128 0 Sunrise: 🌅 [sunrise()] today and [sunrise(today()+1)] tomorrow
SPECIAL COLOR 128 32 0 Sunset: 🌇 [sunset()] today and [sunset(today()+1)] tomorrow%_
REM [moondate(0)] +60 SPECIAL COLOR 128 128 0 New moon: 🌑 [moondate(0)] (%b)
REM [moondate(1)] +60 SPECIAL COLOR 128 128 64 First Quarter: 🌓 [moondate(1)] (%b)
REM [moondate(2)] +60 SPECIAL COLOR 0 0 0 Full moon: 🌕 [moondate(2)] (%b)
REM [moondate(3)] +60 SPECIAL COLOR 128 128 64 Last Quarter: 🌗 [moondate(3)] (%b)
ENDIF
EOF

View File

@@ -36,7 +36,7 @@ ENDIF
###########################################################
SET Quote CHAR(34)
# Handy constants/function for specifing week of month...
# Handy constants/function for specifying week of month...
SET Week_1 1
SET Week_2 8
SET Week_3 15
@@ -77,16 +77,16 @@ REM 1 MSG John's [_mo_num(11, 1984)] 'monthly' anniversary
############################################################################
# If it falls on a Saturday, bump to previous Friday
REM 4 July OMIT SAT SCANFROM -1 BEFORE ADDOMIT SATISFY [$Td != 4] MSG Independence day (observed)
REM 3 JULY SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Independence day (observed)
# If it falls on a Sunday, bump to following Monday
REM 4 July OMIT SUN SCANFROM -7 AFTER ADDOMIT SATISFY [$Td != 4] MSG Independence day (observed)
REM 5 July SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Independence day (observed)
# If it falls on Sat or Sun, note the actual day
REM 4 July SATISFY [$Tw == 0 || $Tw == 6] MSG Independence day (actual)
REM 4 July SCANFROM -7 ADDOMIT SATISFY [$Tw == 0 || $Tw == 6] MSG Independence day (actual)
# Otherwise observed and actual is on the 4th
REM 4 July OMIT SAT SUN SKIP SCANFROM -7 ADDOMIT MSG Independence Day
REM 4 July SCANFROM -7 ADDOMIT SATISFY [$Tw >= 1 && $Tw <= 5] MSG Independence Day
##########################################################################
# #

View File

@@ -1,9 +1,9 @@
" Vim syntax file
" Language: Remind
" Maintainer: Davide Alberani <alberanid@libero.it>
" Last Change: 18 Sep 2009
" Version: 0.5
" URL: http://erlug.linux.it/~da/vim/syntax/remind.vim
" Maintainer: Davide Alberani <da@erlug.linux.it>
" Last Change: 02 Nov 2015 + 13 Mar 2022 by Dianne Skoll <dianne@skoll.ca>
" Version: 0.7+dianne1
" URL: http://ismito.it/vim/syntax/remind.vim
"
" remind is a sophisticated reminder service
" you can download remind from:
@@ -23,7 +23,7 @@ syn keyword remindExpiry UNTIL FROM SCANFROM SCAN WARN SCHED THROUGH
syn keyword remindTag PRIORITY TAG
syn keyword remindTimed AT DURATION
syn keyword remindMove ONCE SKIP BEFORE AFTER
syn keyword remindSpecial INCLUDE INC BANNER PUSH-OMIT-CONTEXT PUSH CLEAR-OMIT-CONTEXT CLEAR POP-OMIT-CONTEXT POP COLOR COLOUR
syn keyword remindSpecial INCLUDE INC BANNER PUSH-OMIT-CONTEXT PUSH CLEAR-OMIT-CONTEXT CLEAR POP-OMIT-CONTEXT POP COLOR COLOUR DO
syn keyword remindRun MSG MSF RUN CAL SATISFY SPECIAL PS PSFILE SHADE MOON
syn keyword remindConditional IF ELSE ENDIF IFTRIG
syn keyword remindDebug DEBUG DUMPVARS DUMP ERRMSG FLUSH PRESERVE

34
include/ansitext.rem Normal file
View File

@@ -0,0 +1,34 @@
# Global variables for various ANSI escape-code sequences
# Not all sequences are supported by all terminals.
# This file is part of REMIND
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
if !defined("ansi_bold")
# Disable ANSI attributes in calandar mode
if $CalMode
set ansi_normal ""
set ansi_bold ""
set ansi_faint ""
set ansi_italic ""
set ansi_underline ""
set ansi_reverse ""
set ansi_strikeout ""
set ansi_underline2 ""
set ansi_overline ""
else
set ansi_normal char(27) + "[0m"
set ansi_bold char(27) + "[1m"
set ansi_faint char(27) + "[2m"
set ansi_italic char(27) + "[3m"
set ansi_underline char(27) + "[4m"
set ansi_reverse char(27) + "[7m"
set ansi_strikeout char(27) + "[9m"
set ansi_underline2 char(27) + "[21m"
set ansi_overline char(27) + "[53m"
endif
preserve ansi_normal ansi_bold ansi_faint ansi_italic ansi_underline2 ansi_reverse ansi_strikeout ansi_underline2 ansi_overline
endif
# Example: REM MSG I must [ansi_bold]emphasize[ansi_normal] \
# the [ansi_italic]severity[ansi_normal] of the situation!

29
include/holidays/ca.rem Normal file
View File

@@ -0,0 +1,29 @@
# Canadian holidays
OMIT 1 Jan MSG New Year's Day
# This varies by province
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Family Day
# This varies by province
OMIT [easterdate($Uy) - 2] MSG Good Friday
# This varies by province
OMIT [easterdate($Uy) + 1] MSG Easter Monday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
OMIT 1 July MSG Canada Day
# This varies by province
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
REM First Monday in Sep SCANFROM -7 ADDOMIT MSG Labour Day
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
REM 11 November MSG Remembrance Day
OMIT 25 Dec MSG Christmas
OMIT 26 Dec MSG Boxing Day

20
include/holidays/fr.rem Normal file
View File

@@ -0,0 +1,20 @@
#
# France Holidays
#
# Source: Article L3133-1
# https://www.legifrance.gouv.fr/codes/section_lc/LEGITEXT000006072050/LEGISCTA000006178007/2016-08-10/
#
SET easter EASTERDATE($Uy)
REM Jan 1 MSG %"Jour de l'an%"
REM [easter+1] MSG %"Lundi de Pâques%"
REM May 1 MSG %"Fête du Travail%"
REM May 8 MSG %"Victoire des alliés%"
REM [easter+39] MSG %"Jeudi de l'Ascension%"
REM [easter+50] MSG %"Lundi de Pentecôte%"
REM Jul 14 MSG %"Fête nationale%"
REM Aug 15 MSG %"Assomption%"
REM Nov 1 MSG %"La Toussaint%"
REM Nov 11 MSG %"Armistice%"
REM Dec 25 MSG %"Noël%"

111
include/holidays/jewish.rem Normal file
View File

@@ -0,0 +1,111 @@
# Major Jewish Holidays
# Set the variable InIsrael to 1 if you live in Israel. Otherwise,
# you get the Diaspora versions of Jewish holidays
SET InIsrael value("InIsrael", 0)
# Set the variable Reform to 1 if you want the Reform version of the
# Jewish calendar. Otherwise, you get the traditional version
SET Reform value("Reform", 0)
# Convenient function definition to save typing
FSET _h(x, y) HEBDATE(x,y)
FSET _h2(x, y) HEBDATE(x, y, $U-7)
FSET _PastSat(x, y) IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1)
FSET _BackTwoFri(x, y) IIF(WKDAYNUM(_h2(x,y))!=5, _h2(x,y), _h2(x,y)-2)
FSET _BackTwoSat(x, y) IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)-2)
# Default values in case InIsrael and Reform are not set
SET InIsrael VALUE("InIsrael", 0)
SET Reform VALUE("Reform", 0)
[_h(1, "Tishrey")] ++4 MSG %"Rosh Hashana 1%" is %b.
# No RH-2 or Tzom Gedalia in Reform
IF !Reform
[_h(2, "Tishrey")] ++4 MSG %"Rosh Hashana 2%" is %b.
[_PastSat(3, "Tishrey")] ++4 MSG %"Tzom Gedalia%" is %b.
ENDIF
[_h(10, "Tishrey")] ++4 MSG %"Yom Kippur%" is %b.
[_h(15, "Tishrey")] ++4 MSG %"Sukkot 1%" is %b.
IF !InIsrael
[_h(16, "Tishrey")] MSG %"Sukkot 2%"
ENDIF
[_h(21, "Tishrey")] ++4 MSG %"Hoshana Rabba%" is %b.
[_h(22, "Tishrey")] ++4 MSG %"Shemini Atzeret%" is %b.
IF InIsrael
[_h(22, "Tishrey")] ++4 MSG %"Simchat Torah%" is %b.
ELSE
[_h(23, "Tishrey")] ++4 MSG %"Simchat Torah%" is %b.
ENDIF
# Because Kislev can change length, we must be more careful about Chanukah
FSET _chan(x) HEBDATE(24, "Kislev", $U-9)+x
[_chan(1)] ++4 MSG %"Chanukah 1%" is %b.
[_chan(2)] MSG %"Chanukah 2%"
[_chan(3)] MSG %"Chanukah 3%"
[_chan(4)] MSG %"Chanukah 4%"
[_chan(5)] MSG %"Chanukah 5%"
[_chan(6)] MSG %"Chanukah 6%"
[_chan(7)] MSG %"Chanukah 7%"
[_chan(8)] MSG %"Chanukah 8%"
# Not sure about Reform's position on the next one.
IF !Reform
# 10 Tevet will never be a Saturday, so whether or not to
# move it is moot. (Thanks to Art Werschulz.)
[_h(10, "Tevet")] MSG %"Tzom Tevet%" is %b.
ENDIF
[_h(15, "Shvat")] ++4 MSG %"Tu B'Shvat%" is %b.
[_h(14, "Adar A")] ++4 MSG %"Purim Katan%" is %b.
# If Purim is on Sunday, then Fast of Esther is 11 Adar.
IF WKDAYNUM(_h2(13, "Adar")) != 6
REM [_h2(13, "Adar")] ++4 MSG %"Fast of Esther%" is %b.
ELSE
REM [_h2(11, "Adar")] ++4 MSG %"Fast of Esther%" is %b.
ENDIF
[_h(14, "Adar")] ++4 MSG %"Purim%" is %b.
[_h(15, "Nisan")] ++4 MSG %"Pesach%" is %b.
IF !InIsrael
[_h(16, "Nisan")] MSG %"Pesach 2%"
ENDIF
[_h(21, "Nisan")] MSG %"Pesach 7%"
IF !InIsrael && !Reform
[_h(22, "Nisan")] MSG %"Pesach 8%"
ENDIF
[_h(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
[_BackTwoFri(4, "Iyar")] ++4 MSG %"Yom HaZikaron%" is %b.
[_BackTwoSat(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
# Not sure about Reform's position on Lag B'Omer
IF !Reform
[_h(18, "Iyar")] ++4 MSG %"Lag B'Omer%" is %b.
ENDIF
[_h(28, "Iyar")] ++4 MSG %"Yom Yerushalayim%" is %b.
[_h(6, "Sivan")] ++4 MSG %"Shavuot%" is %b.
IF !InIsrael && !Reform
[_h(7, "Sivan")] MSG %"Shavuot 2%"
ENDIF
# Fairly sure Reform Jews don't observe the next two
IF !Reform
# Tzom Tamuz and Tish'a B'Av are moved to Sunday if they normally
# fall on a Saturday
[_PastSat(17, "Tamuz")] ++4 MSG %"Tzom Tammuz%" is %b.
[_PastSat(9, "Av")] ++4 MSG %"Tish'a B'Av%" is %b.
ENDIF
# Clean up
FUNSET _h _h2 _PastSat _BackTwoFri _BackTwoSat _chan

54
include/holidays/us.rem Normal file
View File

@@ -0,0 +1,54 @@
# US holidays
# This file is part of REMIND.
# Copyright (C) 1992-2022 Dianne Skoll
REM [easterdate($Uy)-46] MSG Ash Wednesday
REM [easterdate($Uy)-7] MSG Palm Sunday
OMIT [easterdate($Uy)-2] MSG Good Friday
OMIT [easterdate($Uy)] MSG %"Easter%" Sunday
REM [easterdate($Uy)+39] MSG Ascension Day
REM [easterdate($Uy)+49] MSG Pentecost
# Some holidays are omitted, some are not. You may want to change
# which ones are omitted.
OMIT Jan 1 MSG New Year's Day
REM Third Monday in Jan MSG Martin Luther King - %"MLK Day%"
REM Feb 2 MSG Ground Hog Day
REM Feb 14 MSG Valentine's Day
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG President's Day
REM Mar 17 MSG St. Patrick's Day
# These are accurate for most places in North America
REM MAYBE-UNCOMPUTABLE Sun November SATISFY [isdst($T) != isdst($T+1)] MSG Daylight Saving Time Ends
REM MAYBE-UNCOMPUTABLE Sun March SATISFY [isdst($T) != isdst($T+1)] MSG Daylight Saving Time Starts
REM Apr 1 MSG %"April Fool's%" Day
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
REM May 5 MSG Cinco de Mayo
REM First Sat in May MSG Kentucky Derby
REM Second Sun in May MSG Mother's Day
REM Third Sat in May MSG Armed Forces Day
REM Last Monday in May SCANFROM -7 ADDOMIT MSG Memorial Day
REM Jun 14 MSG Flag Day
REM July 4 SCANFROM -7 ADDOMIT MSG Independence Day
REM July 3 SCANFROM -7 ADDOMIT SATISFY [$Tw == 5] MSG Independence Day (observed)
REM July 5 SCANFROM -7 ADDOMIT SATISFY [$Tw == 1] MSG Independence Day (observed)
REM Third Sun in June MSG Father's Day
REM First Mon in Sep SCANFROM -7 ADDOMIT MSG Labor Day
REM Second Mon in Oct MSG Columbus Day / Indigenous Peoples' Day
REM Nov 11 MSG Veterans Day
REM Oct 30 MSG Mischief Night
REM Oct 31 MSG Halloween
REM Tue Nov 2 SCANFROM -7 SATISFY [($Ty % 4) == 0] MSG Election Day
REM Thu 22 Nov SCANFROM -7 ADDOMIT MSG Thanksgiving Day
REM Fri 23 Nov SCANFROM -7 ADDOMIT MSG Thanksgiving (cont.)
REM Dec 24 MSG Christmas Eve
OMIT Dec 25 MSG %"Christmas%" Day

19
include/lang/auto.rem Normal file
View File

@@ -0,0 +1,19 @@
SET autolang getenv("LC_ALL")
IF autolang == ""
SET autolang getenv("LANGUAGE")
ENDIF
IF autolang == ""
SET autolang getenv("LANG")
ENDIF
IF autolang != ""
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 5)) + ".rem", "r") == 0
INCLUDE [$SysInclude]/lang/[lower(substr(autolang, 1, 5))].rem
ELSE
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 2)) + ".rem", "r") == 0
INCLUDE [$SysInclude]/lang/[lower(substr(autolang, 1, 2))].rem
ENDIF
ENDIF
ENDIF
UNSET autolang

69
include/lang/da.rem Normal file
View File

@@ -0,0 +1,69 @@
# Support for the Danish language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Mogens Lynnerup.
SET $Sunday "Søndag"
SET $Monday "Mandag"
SET $Tuesday "Tirsdag"
SET $Wednesday "Onsdag"
SET $Thursday "Torsdag"
SET $Friday "Fredag"
SET $Saturday "Lørdag"
SET $January "Januar"
SET $February "Februar"
SET $March "Marts"
SET $April "April"
SET $May "Maj"
SET $June "Juni"
SET $July "Juli"
SET $August "August"
SET $September "September"
SET $October "Oktober"
SET $November "November"
SET $December "December"
SET $Today "i dag"
SET $Tomorrow "i morgen"
BANNER Påmindelse for %w, %d. %m, %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "siden"
SET $Fromnow "fra nu"
SET $On "på"
SET $Now "nu"
SET $At "kl."
SET $Minute "minut"
SET $Hour "time"
SET $Is "er"
SET $Was "var"
SET $And "og"
SET $Hplu "r"
SET $Mplu "ter"
FSET subst_ampm(h) iif(h<5, " om natten", h < 12, " om formiddagen", h < 18, " om eftermiddagen", " om aftenen")
FSET subst_ordinal(d) "."
FSET subst_p(alt, d, t) iif(d==today()+1, "", "e")
FSET zeropad(s, len) pad(s, "0", len)
FSET subst_a_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d) + " " + year(d)
FSET subst_ax(alt, d, t) iif(alt, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET subst_bx(a, d, t) "om " + (d-today()) + " dage"
FSET subst_ex(alt, d, t) "den " + zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(year(d), 4)
FSET subst_fx(alt, d, t) "den " + zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2) + $DateSep + zeropad(year(d), 4)
FSET subst_g_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d)
FSET subst_gx(alt, d, t) iif(alt, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET subst_hx(alt, d, t) "den " + zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2)
FSET subst_ix(alt, d, t) "den " + zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2)
FSET subst_ux(alt, d, t) subst_ax(alt, d, t)
FSET subst_vx(alt, d, t) subst_gx(alt, d, t)

89
include/lang/de.rem Normal file
View File

@@ -0,0 +1,89 @@
# Support for the German language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Wolfgang Thronicke
# Day names
SET $Sunday "Sonntag"
SET $Monday "Montag"
SET $Tuesday "Dienstag"
SET $Wednesday "Mittwoch"
SET $Thursday "Donnerstag"
SET $Friday "Freitag"
SET $Saturday "Samstag"
# Month names
SET $January "Januar"
SET $February "Februar"
SET $March "März"
SET $April "April"
SET $May "Mai"
SET $June "Juni"
SET $July "Juli"
SET $August "August"
SET $September "September"
SET $October "Oktober"
SET $November "November"
SET $December "Dezember"
SET $Today "heute"
SET $Tomorrow "morgen"
# Banner
BANNER Termine für %w, den %d. %m %y%o:
SET $Am "am"
SET $Pm "pm"
SET $On "am"
SET $Hplu "n"
SET $Mplu "n"
SET $Now "jetzt"
SET $At "um"
SET $Minute "Minute"
SET $Hour "Stunde"
SET $Is "ist"
SET $Was "war"
SET $And "und"
SET $Ago "vorher"
SET $Fromnow "von heute"
FSET subst_ampm(h) iif(h<5, " nachts", h<12, " vormittags", h<=17, " nachmittags", " abends")
FSET subst_ordinal(d) "."
FSET subst_a_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d) + " " + year(d)
FSET subst_ax(alt, d, t) iif(alt, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET subst_bx(a, d, t) "in " + (d-today()) + " Tagen"
FSET subst_g_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d)
FSET subst_gx(alt, d, t) iif(alt, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET subst_ux(alt, d, t) subst_ax(alt, d, t)
FSET subst_vx(alt, d, t) subst_gx(alt, d, t)
FSET subst_p(alt, d, t) iif(d == today()+1, "", "en")
# Localization of various astronomical events
# Perihelion
SET earthseasons_Perihelion_str "Perihel"
# Vernal equinox
SET earthseasons_EquinoxMar_str "Frühlingsanfang"
# Summer solstice
SET earthseasons_SolsticeJun_str "Sommeranfang"
# Aphelion
SET earthseasons_Aphelion_str "Aphel"
# Autumnal Equinox
SET earthseasons_EquinoxSep_str "Herbstanfang"
# Winter Solstice
SET earthseasons_SolsticeDec_str "Winteranfang"
# Daylight saving time starts
SET daylightST_starts_str "Beginn Sommerzeit"
# Daylight saving time ends
SET daylightST_ends_str "Ende Sommerzeit"

4
include/lang/en.rem Normal file
View File

@@ -0,0 +1,4 @@
# Support for the English language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# Nothing to do for English since it is the default.

48
include/lang/es.rem Normal file
View File

@@ -0,0 +1,48 @@
# Support for the Spanish language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Rafa Couto <rafacouto@biogate.com>
SET $Sunday "Domingo"
SET $Monday "Lunes"
SET $Tuesday "Martes"
SET $Wednesday "Miércoles"
SET $Thursday "Jueves"
SET $Friday "Viernes"
SET $Saturday "Sábado"
SET $January "Enero"
SET $February "Febrero"
SET $March "Marzo"
SET $April "Abril"
SET $May "Mayo"
SET $June "Junio"
SET $July "Julio"
SET $August "Agosto"
SET $September "Septiembre"
SET $October "Octubre"
SET $November "Noviembre"
SET $December "Diciembre"
SET $Today "hoy"
SET $Tomorrow "mañana"
BANNER Agenda para el %w, %d%s %m, %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "hace"
SET $Fromnow "desde hoy"
SET $On "el día"
SET $Now "ahora"
SET $At "a las"
SET $Minute "minuto"
SET $Hour "hora"
SET $Is "es"
SET $Was "fue"
SET $And "y"
SET $Hplu "s"
SET $Mplu "s"
FSET subst_bx(a, d, t) "dentro de " + (d-today()) + " días"

94
include/lang/fi.rem Normal file
View File

@@ -0,0 +1,94 @@
# Support for the Finnish language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Mikko Silvonen
SET $Sunday "sunnuntai"
SET $Monday "maanantai"
SET $Tuesday "tiistai"
SET $Wednesday "keskiviikko"
SET $Thursday "torstai"
SET $Friday "perjantai"
SET $Saturday "lauantai"
SET $January "tammikuu"
SET $February "helmikuu"
SET $March "maaliskuu"
SET $April "huhtikuu"
SET $May "toukokuu"
SET $June "kesäkuu"
SET $July "heinäkuu"
SET $August "elokuu"
SET $September "syyskuu"
SET $October "lokakuu"
SET $November "marraskuu"
SET $December "joulukuu"
SET $Today "tänään"
SET $Tomorrow "huomenna"
BANNER Viestit %wna %d. %mta %y%o:
SET $Am " ap."
SET $Pm " ip."
SET $ago "sitten"
SET $Fromnow "kuluttua"
SET $On "na"
SET $Now "nyt"
SET $At "klo"
SET $Minute "minuutti"
SET $Hour "tunti"
SET $Is "on"
SET $Was "oli"
SET $And "ja"
SET $Hplu "a"
SET $Mplu "a"
FSET zeropad(s, len) pad(s, "0", len)
FSET subst_ordinal(d) iif(d==1, ":senä", d==2, ":sena", (d%10)==2||(d%10)==3||(d%10)==6||(d%10)==8, ":ntena", ":ntenä")
FSET subst_a_alt(d, o, p) wkday(d) + o + " " + day(d) + ". " + mon(d) + p + " " + year(d)
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d, "", ""), subst_a_alt(d, $On, "ta"))
FSET subst_bx(a, d, t) (d-today()) + " päivän kuluttua"
FSET subst_cx(a, d, t) iif(a, wkday(d), wkday(d) + $On)
FSET subst_ex(a, d, t) zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(year(d), 4)
FSET subst_fx(a, d, t) zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2) + $DateSep + zeropad(year(d), 4)
FSET subst_g_alt(d, o, p) wkday(d) + o + " " + day(d) + ". " + mon(d) + p
FSET subst_gx(a, d, t) iif(a, subst_g_alt(d, "", ""), subst_g_alt(d, $On, "ta"))
FSET subst_hx(a, d, t) zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2)
FSET subst_ix(a, d, t) zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2)
FSET subst_j_alt(d, o) wkday(d) + o + " " + mon(d) + "n " + day(d) + subst_ordinal(day(d)) + " " + year(d)
FSET subst_jx(a, d, t) iif(a, subst_j_alt(d, ""), subst_j_alt(d, $On))
FSET subst_k_alt(d, o) wkday(d) + o + " " + mon(d) + "n " + day(d) + subst_ordinal(day(d))
FSET subst_kx(a, d, t) iif(a, subst_k_alt(d, ""), subst_k_alt(d, $On))
FSET subst_lx(a, d, t) zeropad(year(d), 4) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2)
FSET subst_p(a, d, t) iif(d==today()+1, "", "ä")
FSET subst_qx(a, d, t) "n"
FSET subst_u_alt(d, o, p) wkday(d) + o + " " + day(d) + subst_ordinal(day(d)) + " " + mon(d) + p + " " + year(d)
FSET subst_ux(a, d, t) iif(a, subst_u_alt(d, "", ""), subst_u_alt(d, $On, "ta"))
FSET subst_v_alt(d, o, p) wkday(d) + o + " " + day(d) + subst_ordinal(day(d)) + " " + mon(d) + p
FSET subst_vx(a, d, t) iif(a, subst_v_alt(d, "", ""), subst_v_alt(d, $On, "ta"))
FSET subst_1(a, d, t) iif(t==now(), $Now, t<now(), subst1_past(now()-t), subst1_future(t-now()))
FSET subst1_past(mins) subst_hour_past(mins/60) + subst_min_past(mins%60) + $Ago
FSET subst1_future(mins) subst_hour_future(mins/60) + subst_min_future(mins%60) + $Fromnow
FSET subst_hour_past(h) iif(h==0, "", h + " " + $Hour + iif(h==1, " ", $Hplu + " "))
FSET subst_min_past(m) iif(m==0, "", m + " " + $Minute + iif(m==1, " ", $Mplu + " "))
FSET subst_hour_future(h) iif(h==0, "", h + " tunnin ")
FSET subst_min_future(m) iif(m==0, "", m + " minuutin ")

62
include/lang/fr.rem Normal file
View File

@@ -0,0 +1,62 @@
# Support for the French language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Laurent Duperval
SET $Sunday "dimanche"
SET $Monday "lundi"
SET $Tuesday "mardi"
SET $Wednesday "mercredi"
SET $Thursday "jeudi"
SET $Friday "vendredi"
SET $Saturday "samedi"
SET $January "janvier"
SET $February "février"
SET $March "mars"
SET $April "avril"
SET $May "mai"
SET $June "juin"
SET $July "juillet"
SET $August "août"
SET $September "septembre"
SET $October "octobre"
SET $November "novembre"
SET $December "décembre"
SET $Today "aujourd'hui"
SET $Tomorrow "demain"
SET $On "le"
SET $At "à"
SET $Now "maintenant"
SET $Minute "minute"
SET $Hour "heure"
SET $Is "est"
SET $Was "était"
SET $And "et"
SET $Hplu "s"
SET $Mplu "s"
SET $Ago "il y a"
SET $Fromnow "dans"
# Banner
BANNER Rappels pour %w, %d%s %m, %y%o:
# Ordinal for a day (English would be "st", "nd", "rd", "th")
FSET subst_ordinal(d) iif(d == 1, "er", "")
# "%d hours", "%d minutes", or "%d hours and %d minutes"
FSET subst_tdiff(hdiff, mdiff) iif(hdiff==0&&mdiff==0, $Now, \
hdiff==0, mdiff + plural(mdiff, " minute"), \
mdiff==0, hdiff + plural(hdiff, " heure"), \
hdiff + plural(hdiff, " heure") + " et " + mdiff + plural(mdiff, " minute"))
FSET subst_1(alt, date, time) iif(time == now(), "maintenant", \
time > now(), "dans " + subst_tdiff((time-now())/60, (time-now())%60), \
"il y a " + subst_tdiff ((now()-time)/60, (now()-time)%60))
FSET subst_bx(alt, date, time) "dans " + (date-today()) + " jours"
FSET subst_j_alt(date) wkday(date) + ", " + day(date) + subst_ordinal(day(date)) + " " + mon(date) + ", " + year(date)
FSET subst_jx(alt, date, time) iif(alt, subst_j_alt(date), $On + " " + subst_j_alt(date))
FSET subst_k_alt(date) wkday(date) + ", " + day(date) + subst_ordinal(day(date)) + " " + mon(date)
FSET subst_kx(alt, date, time) iif(alt, subst_k_alt(date), $On + " " + subst_k_alt(date))

51
include/lang/is.rem Normal file
View File

@@ -0,0 +1,51 @@
# Support for the Icelanding language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Björn Davíðsson (bjossi@snerpa.is)
SET $Sunday "sunnudagur"
SET $Monday "mánudagur"
SET $Tuesday "þriðjudagur"
SET $Wednesday "miðvikudagur"
SET $Thursday "fimmtudagur"
SET $Friday "föstudagur"
SET $Saturday "laugardagur"
SET $January "janúar"
SET $February "febrúar"
SET $March "mars"
SET $April "apríl"
SET $May "maí"
SET $June "júní"
SET $July "júlí"
SET $August "ágúst"
SET $September "september"
SET $October "október"
SET $November "nóvember"
SET $December "desember"
SET $Today "í dag"
SET $Tomorrow "á morgun"
BANNER Minnisatriði: %w, %d%s %m, %y%o:
SET $Am "fh"
SET $Pm "eh"
SET $Ago "síðan"
SET $Fromnow "frá því nú"
SET $On "þann"
SET $Now "núna"
SET $At "kl."
SET $Minute "mínútu"
SET $Hour "klukkustund"
SET $Is "er"
SET $Was "var"
SET $And "og"
SET $Hplu "ir"
SET $Mplu "r"
FSET subst_bx(a, d, t) "eftir " + (d - today()) + " daga"
fset subst_p(a, d, t) iif(d == today()+1, "", "a")

67
include/lang/it.rem Normal file
View File

@@ -0,0 +1,67 @@
# Support for the Italian language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Valerio Aimale
SET $Sunday "Domenica"
SET $Monday "Lunedí"
SET $Tuesday "Martedí"
SET $Wednesday "Mercoledí"
SET $Thursday "Giovedí"
SET $Friday "Venerdí"
SET $Saturday "Sabato"
SET $January "Gennaio"
SET $February "Febbraio"
SET $March "Marzo"
SET $April "Aprile"
SET $May "Maggio"
SET $June "Giugno"
SET $July "Luglio"
SET $August "Agosto"
SET $September "Settembre"
SET $October "Ottobre"
SET $November "Novembre"
SET $December "Dicembre"
SET $Today "oggi"
SET $Tomorrow "domani"
BANNER Promemoria per %w, %d %m %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "fa"
SET $Fromnow "da oggi"
SET $On ""
SET $Now "ora"
SET $At "alle"
SET $Minute "minuto"
SET $Hour "ora"
SET $Is "é"
SET $Was "era"
SET $And "e"
SET $Hplu "a"
SET $Mplu "i"
FSET subst_bx(a, d, t) "fra " + (d-today()) + " giorni"
FSET subst_p(a, d, t) iif(d==today()+1, "o", "i")
FSET subst_q(a, d, t) iif(d==today()+1, "a", "e")
FSET subst_ax(a, d, t) wkday(d) + ", " + day(d) + " " + mon(d) + " " + year(d)
FSET subst_jx(a, d, t) subst_ax(a, d, t)
FSET subst_kx(a, d, t) wkday(d) + ", " + day(d) + " " + mon(d)
FSET subst_ux(a, d, t) subst_ax(a, d, t)
FSET subst_vx(a, d, t) subst_kx(a, d, t)
FSET subst_1(a, d, t) iif(t==now(), $Now, t<now(), subst_1a(now()-t, $Ago), subst_1a(t-now(), $Fromnow))
FSET subst_1a(diff, when) subst_1b(diff/60, diff%60) + " " + when
FSET subst_1b(hdiff, mdiff) iif(hdiff==0, subst_minutes(mdiff), mdiff==0, subst_hours(hdiff), subst_hours(hdiff) + " " + $And + " " + subst_minutes(mdiff))
FSET subst_minutes(m) iif(m==1, "1 minuto", m + " minuti")
FSET subst_hours(h) iif(h==1, "1 ora", h + " ore")
FSET subst_0(a, d, t) iif(abs(now()-t)/60==1, "a", "e")
FSET subst_9(a, d, t) iif(abs(now()-t)%60==1, "o", "i")

56
include/lang/nl.rem Normal file
View File

@@ -0,0 +1,56 @@
# Support for the Dutch language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Willem Kasdorp and Erik-Jan Vens
SET $Sunday "zondag"
SET $Monday "maandag"
SET $Tuesday "dinsdag"
SET $Wednesday "woensdag"
SET $Thursday "donderdag"
SET $Friday "vrijdag"
SET $Saturday "zaterdag"
SET $January "januari"
SET $February "februari"
SET $March "maart"
SET $April "april"
SET $May "mei"
SET $June "juni"
SET $July "juli"
SET $August "augustus"
SET $September "september"
SET $October "oktober"
SET $November "november"
SET $December "december"
SET $Today "vandaag"
SET $Tomorrow "morgen"
BANNER Herinneringen voor %w, %d%s %m, %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "geleden"
SET $Fromnow "vanaf nu"
SET $On "op"
SET $Now "nu"
SET $At "op"
SET $Minute "minuut"
SET $Hour "uur"
SET $Is "is"
SET $Was "was"
SET $And "en"
SET $Hplu "en"
SET $Mplu "en"
FSET subst_1(a, d, t) iif(t==now(), $Now, t<now(), subst_1a(now()-t, $Ago), subst_1a(t-now(), $Fromnow))
FSET subst_1a(diff, when) subst_1b(diff/60, diff%60) + " " + when
FSET subst_1b(hdiff, mdiff) iif(hdiff==0, subst_minutes(mdiff), mdiff==0, subst_hours(hdiff), subst_hours(hdiff) + " " + $And + " " + subst_minutes(mdiff))
FSET subst_minutes(m) iif(m==1, "1 minuut", m + " minuten")
FSET subst_hours(h) iif(h==1, "1 uur", h + " uren")
FSET subst_bx(a, d, t) "over " + (d-today()) + " dagen"

58
include/lang/no.rem Normal file
View File

@@ -0,0 +1,58 @@
# Support for the Norwegian language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Trygve Randen
SET $Sunday "Søndag"
SET $Monday "Mandag"
SET $Tuesday "Tirsdag"
SET $Wednesday "Onsdag"
SET $Thursday "Torsdag"
SET $Friday "Fredag"
SET $Saturday "Lørdag"
SET $January "Januar"
SET $February "Februar"
SET $March "Mars"
SET $April "April"
SET $May "Mai"
SET $June "Juni"
SET $July "Juli"
SET $August "August"
SET $September "September"
SET $October "Oktober"
SET $November "November"
SET $December "Desember"
SET $Today "i dag"
SET $Tomorrow "i morgen"
BANNER Påminnelse for %w, %d. %m, %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "siden"
SET $Fromnow "fra nå"
SET $On "den"
SET $Now "nå"
SET $At "kl."
SET $Minute "minutt"
SET $Hour "time"
SET $Is "er"
SET $Was "var"
SET $And "og"
SET $Hplu "r"
SET $Mplu "er"
FSET subst_bx(a, d, t) "om " + (d-today()) + " dager"
FSET subst_ordinal(d) "."
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET subst_a_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d) + " " + year(d)
FSET subst_gx(a, d, t) iif(a, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET subst_g_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d)
FSET subst_ux(a, d, t) subst_ax(a, d, t)
FSET subst_vx(a, d, t) subst_gx(a, d, t)
FSET subst_p(a, d, t) iif(d==today()+1, "", "er")

69
include/lang/pl.rem Normal file
View File

@@ -0,0 +1,69 @@
# Support for the Polish language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Jerzy Sobczyk
SET $Sunday "Niedziela"
SET $Monday "Poniedziałek"
SET $Tuesday "Wtorek"
SET $Wednesday "Środa"
SET $Thursday "Czwartek"
SET $Friday "Piątek"
SET $Saturday "Sobota"
SET $January "Styczeń"
SET $February "Luty"
SET $March "Marzec"
SET $April "Kwiecień"
SET $May "Maj"
SET $June "Czerwiec"
SET $July "Lipiec"
SET $August "Sierpień"
SET $September "Wrzesień"
SET $October "Październik"
SET $November "Listopad"
SET $December "Grudzień"
SET $Today "dzisiaj"
SET $Tomorrow "jutro"
BANNER Terminarz na %w, %d. %m %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "temu"
SET $Fromnow "od teraz"
SET $On "-"
SET $Now "teraz"
SET $At "o"
SET $Minute "minut"
SET $Hour "godzin"
SET $Is "będzie"
SET $Was "było"
SET $And "i"
SET $Hplu ""
SET $Mplu ""
FSET subst_pl_plu(n) iif(n==1, "ę", (n==12||n==13||n==14), "", (n%10==2||n%10==3||n%10==4), "y", "")
FSET subst_ampm(h) iif(h<5, " w nocy", h<10, " rano", h<12, " przed południem", h<18, " po południu", h<22, " wieczorem", " w nocy")
FSET subst_ordinal(d) ""
FSET subst_a_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d) + " " + year(d)
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET subst_bx(a, d, t) "za " + (d-today()) + " dni"
FSET subst_g_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d)
FSET subst_gx(a, d, t) iif(a, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET subst_ux(a, d, t) subst_ax(a, d, t)
FSET subst_vx(a, d, t) subst_gx(a, d, t)
FSET subst_p(a, d, t) ""
FSET subst_0(a, d, t) subst_pl_plu(abs(t-now())/60)
FSET subst_9(a, d, t) subst_pl_plu(abs(t-now())%60)
FSET subst_1(a, d, t) iif(t==now(), $Now, t<now(), subst_1past(now()-t), subst_1future(t-now()))
FSET subst_1future(diff) "za " + iif(diff/60==0, subst_1min(diff%60), diff%60==0, subst_1h(diff/60), subst_1h(diff/60) + " " + $And + " " + subst_1min(diff%60))
FSET subst_1past(diff) iif(diff/60==0, subst_1min(diff%60), diff%60==0, subst_1h(diff/60), subst_1h(diff/60) + " " + $And + " " + subst_1min(diff%60)) + " temu"
FSET subst_1min(m) m + " " + $Minute + subst_pl_plu(m)
FSET subst_1h(h) h + " " + $Hour + subst_pl_plu(h)

69
include/lang/pt.rem Normal file
View File

@@ -0,0 +1,69 @@
# Support for the (Brazilian) Portuguese language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Marco Paganini
SET $Sunday "domingo"
SET $Monday "segunda"
SET $Tuesday "terça"
SET $Wednesday "quarta"
SET $Thursday "quinta"
SET $Friday "sexta"
SET $Saturday "sábado"
SET $January "janeiro"
SET $February "fevereiro"
SET $March "março"
SET $April "abril"
SET $May "maio"
SET $June "junho"
SET $July "julho"
SET $August "agosto"
SET $September "setembro"
SET $October "outubro"
SET $November "novembro"
SET $December "dezembro"
SET $Today "hoje"
SET $Tomorrow "amanhã"
BANNER Avisos para %w, %d de %m de %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "atrás"
SET $Fromnow "adiante"
SET $On "em"
SET $Now "agora"
SET $At "as"
SET $Minute "minuto"
SET $Hour "hora"
SET $Is "é"
SET $Was "foi"
SET $And "e"
SET $Hplu "s"
SET $Mplu "s"
FSET subst_ordinal(d) ""
FSET subst_on_wd(d) iif(wkdaynum(d) == 1 || wkdaynum(d) == 2, "no", "na")
FSET subst_a_alt(d) wkday(d) + ", " + day(d) + " de " + mon(d) + " de " + year(d)
FSET subst_bx(a, d, t) "em " + (d-today()) + " dias"
FSET subst_c_alt(d) wkday(d)
FSET subst_g_alt(d) wkday(d) + ", " + day(d) + " " + mon(d)
FSET subst_ax(a, d, t) iif(a, subst_a_alt(d), subst_on_wd(d) + " " + subst_a_alt(d))
FSET subst_cx(a, d, t) iif(a, subst_c_alt(d), subst_on_wd(d) + " " + subst_c_alt(d))
FSET subst_gx(a, d, t) iif(a, subst_g_alt(d), subst_on_wd(d) + " " + subst_g_alt(d))
FSET subst_jx(a, d, t) subst_ax(a, d, t)
FSET subst_k_alt(d) wkday(d) + ", " + day(d) + " de " + mon(d)
FSET subst_kx(a, d, t) iif(a, subst_k_alt(d), subst_on_wd(d) + " " + subst_k_alt(d))
FSET subst_ux(a, d, t) subst_ax(a, d, t)
FSET subst_vx(a, d, t) subst_kx(a, d, t)
FSET subst_1(a, d, t) iif(t==now(), $Now, t>now(), "em " + subst_1help(t-now()), subst_1help(now()-t) + " " + $Ago)
FSET subst_1help(diff) iif(diff/60==0, subst_mplu(diff%60), diff%60==0, subst_hplu(diff/60), subst_hplu(diff/60) + " " + $And + " " + subst_mplu(diff%60))
FSET subst_mplu(m) iif(m==1, "1 " + $Minute, m + " " + $Minute + $Mplu)
FSET subst_hplu(h) iif(h==1, "1 " + $Hour, h + " " + $Hour + $Hplu)

68
include/lang/ro.rem Normal file
View File

@@ -0,0 +1,68 @@
# Support for the Romanian language.
# This file is part of REMIND.
# REMIND is Copyright (C) 1992-2022 by Dianne Skoll
# This file is derived from a translation by Liviu Daia
SET $Sunday "Duminică"
SET $Monday "Luni"
SET $Tuesday "Marți"
SET $Wednesday "Miercuri"
SET $Thursday "Joi"
SET $Friday "Vineri"
SET $Saturday "Sâmbătă"
SET $January "Ianuarie"
SET $February "Februarie"
SET $March "Martie"
SET $April "Aprilie"
SET $May "Mai"
SET $June "Iunie"
SET $July "Iulie"
SET $August "August"
SET $September "Septembrie"
SET $October "Octombrie"
SET $November "Noiembrie"
SET $December "Decembrie"
SET $Today "astăzi"
SET $Tomorrow "mâine"
BANNER Reamintiri pentru %w, %d %m %y%o:
SET $Am "am"
SET $Pm "pm"
SET $Ago "acum"
SET $Fromnow "peste"
SET $On "pe"
SET $Now "acum"
SET $At "la ora"
SET $Minute "minut"
SET $Hour "or"
SET $Is "este"
SET $Was "a fost"
SET $Mplu "e"
SET $Hplu "e"
SET $And "şi"
FSET subst_bx(a, d, t) "peste " + (d-today()) + " zile"
FSET subst_ampm(h) iif(h<4, " noaptea", h<12, " dimineaţa", h<18, " după-amiaza", " seara")
FSET subst_ordinal(d) ""
FSET subst_ax(a, d, t) wkday(d) + ", " + day(d) + " " + mon(d) + " " + year(d)
FSET subst_cx(a, d, t) wkday(d)
FSET subst_gx(a, d, t) wkday(d) + ", " + day(d) + " " + mon(d)
FSET subst_jx(a, d, t) wkday(d) + ", " + mon(d) + " " + day(d) + ", " + year(d)
FSET subst_kx(a, d, t) wkday(d) + ", " + mon(d) + " " + day(d)
FSET subst_ux(a, d, t) subst_ax(a, d, t)
FSET subst_vx(a, d, t) subst_gx(a, d, t)
FSET subst_p(a, d, t) iif(d==today()+1, "", "le")
FSET subst_1(a, d, t) iif(t==now(), $Now, t<now(), subst_1helper(now()-t, "acum "), subst_1helper(t-now(), "peste "))
FSET subst_1helper(diff, when) when + iif(diff%60==0, subst_1h(diff/60), diff/60==0, subst_1m(diff%60), subst_1h(diff/60) + " " + $And + " " + subst_1m(diff%60))
FSET subst_1h(h) iif(h==1, "1 oră", h + " ore")
FSET subst_1m(m) iif(m==1, "1 minut", m + " minute")
FSET subst_0(a, d, t) iif(abs(t-now())/60==1, "ă", "e")

2
include/site/README Normal file
View File

@@ -0,0 +1,2 @@
This directory is for system administrators to install site-wide
Remind scripts that are useful to their user-base.

View File

@@ -1,4 +1,4 @@
.TH REM 1 "1 January 2021"
.TH REM 1 "@RELEASE_DATE@" "User Commands" "VERSION @VERSION@"
.UC 4
.SH NAME
rem \- Invoke Remind with a default filename
@@ -16,5 +16,7 @@ the filename $HOME/.reminders
.PP
.SH AUTHOR
Remind was written by Dianne Skoll <dianne@skoll.ca>
.SH HOME PAGE
https://dianne.skoll.ca/projects/remind/
.SH SEE ALSO
\fBremind\fR

View File

@@ -1,4 +1,4 @@
.TH REM2PS 1 "5 January 2021"
.TH REM2PS 1 "@RELEASE_DATE@" "User Commands" "VERSION @VERSION@"
.UC 4
.SH NAME
rem2ps \- draw a PostScript calendar from Remind output
@@ -586,6 +586,18 @@ For a SHADE or COLOR special, the blue color component.
.B body \fIbody\fR
The body of the reminder to issue. Always present.
.TP
.B calendar_body \fIbody\fR
The text appropriate to include in a calendar. Only present if the
original body contains %"...%" sequences and the "q" modifier was used
with Remind's "-pp..." flag.
.TP
.B plain_body \fIbody\fR
The "plain" body of the reminder with any %"...%" sequences removed.
If your back-end is designed to draw a calendar, then it should
use the \fBcalendar_body\fR if present. If not, then it
should use the \fBplain_body\fR if present, and if not, then it
should fall back on the \fBbody\fR.
.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
@@ -674,6 +686,8 @@ resulting PostScript output will probably not work.
You should ensure that the values you supply for margin widths are sensible.
If they are too big for the media size, \fBRem2ps\fR will not complain,
but again, the PostScript output will probably not work.
.SH HOME PAGE
https://dianne.skoll.ca/projects/remind/
.SH SEE ALSO
\fBremind\fR, \fBrem2pdf\fR, \fBrem2html\fR, \fBtkremind\fR.

View File

@@ -1,4 +1,4 @@
.TH REMIND 1 "1 January 2021"
.TH REMIND 1 "@RELEASE_DATE@" "User Commands" "VERSION @VERSION@"
.UC 4
.SH NAME
remind \- a sophisticated reminder service
@@ -78,18 +78,18 @@ display.
.B 'c'
causes \fBRemind\fR to use VT100 escape sequences to approximate
SPECIAL COLOR reminders. Note that this flag is kept for
backwards-compatibility; you should use the \fB\-@\fI[n][,m]\fR
backwards-compatibility; you should use the \fB\-@\fI[n][,m][,b]\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,
each with one of two brightnesses. A color component greater than
64 is considered "on", and if any of the three color components is
greater than 128, the color is considered "bright".
.B \-@\fR[\fIn\fR][,\fIm\fR][,\fIb\fR]
Tells \fBRemind\fR to approximate SPECIAL COLOR and SHADE reminders
using VT100 escape sequences. The approximation is (of necessity)
very coarse, because the VT100 only has eight different color
sequences, each with one of two brightnesses. A color component
greater than 64 is considered "on", and if any of the three color
components is greater than 128, the color is considered "bright".
.RS
.PP
If you supply the optional numeric parameters, the have the following
@@ -99,23 +99,53 @@ 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
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.
is supplied, or it is supplied as \fIm\fR=2, 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.
.PP
If the optional \fIb\fR parameter is supplied following a comma, then
\fIb=0\fR tells \fBRemind\fR to ignore SPECIAL SHADE reminders (the
default) and \fIb=1\fR tells \fBRemind\fR to respect SPECIAL SHADE
reminders by emitting VT100 escape codes to color the background of the
calendar cell. Note that SHADE does not work well unless you are
using the extended 256-color palette (\fIn\fR=1) or the true
24-bit colors (\fIn\fR=2). Note that for calendar cells that are
shaded, the clamping mechanism described earlier for \fIm=0\fR or
\fIm=1\fR is skipped; it is assumed that if you set \fIboth\fR the
foreground color of a reminder and the background color of a cell,
then you know what you are doing.
.RE
.TP
.B \-w\fR\fIcol\fR[,\fIpad\fR[,\fIspc\fR]]]
The \fB\-w\fR option specifies the output width, padding and spacing
of the formatted calendar output. \fICol\fR specifies the number of
columns in the output device. If not specified, or specified as 0,
it defaults to the larger of 71 or the actual width of your terminal,
or to 80 if standard output is not a terminal.
columns in the output device. If \fIcol\fR is not specified, or is
specified as 0, it defaults to the larger of 71 or the actual width of
your terminal, or to 80 if standard output is not a terminal. If
\fIcol\fR is specified as the letter \fBt\fR, then \fBRemind\fR
attempts to get the width of the \fB/dev/tty\fR terminal device. This
is useful, for example, if you pipe calendar output into \fBless\fR;
even though standard output is a pipe, you want the calendar to be
sized correctly for your terminal window:
.RS
.PP
.nf
remind -c -wt .reminders | less
.fi
.RE
.RS
.PP
Note that the value of \fIcol\fR is also used to set the system variable
$FormWidth, which is initialized to \fIcol\fR - 8. See "SYSTEM VARIABLES"
for details.
.PP
\fIPad\fR specifies how many lines
to use to "pad" empty calendar boxes. This defaults to 5. If you
@@ -141,7 +171,7 @@ If you immediately follow the \fBs\fR with the letter
day they actually occur \fIas well as\fR on any preceding days specified
by the reminder's \fIdelta\fR.
.TP
.B \-p\fR[\fBa\fR][\fBp\fR][\fBp\fR]\fIn\fR
.B \-p\fR[\fBa\fR][\fBp\fR][\fBp\fR][\fBq\fR]\fIn\fR
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
\fBRem2PS\fR program, which creates a PostScript calendar, and various
@@ -156,7 +186,9 @@ by the reminder's \fIdelta\fR. If you follow the \fBp\fR with another
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.
format, again documented in \fBrem2ps(1)\fR. If you include a \fBq\fR
letter with this option, then the normal calendar-mode substitution filter
is disabled and the %"...%" sequences are preserved in the output.
.RS
.PP
Note that the \fB\-pp\fR or \fB\-ppp\fR options also enable the \fB\-l\fR
@@ -378,7 +410,7 @@ information.
.SH REMINDER FILES
.PP
\fBRemind\fR uses scripts to control its operation. You can use any
text editor capable of creating plain ASCII files to create a
text editor capable of creating plain-text files to create a
\fBRemind\fR script. The commands inside a script can range from the
very simple and almost immediately understandable:
.PP
@@ -563,6 +595,7 @@ The trigger date for a specific run is simply the current system date.
present. The reminder is triggered on the specified day of each month.
The trigger date for a particular run is the closest such day to the
current system date. For example:
.PP
.nf
REM 1 MSG First of every month.
REM 31 MSG 31st of every month that has 31 days.
@@ -572,6 +605,7 @@ current system date. For example:
.I month
present. The reminder is triggered every day of the specified month.
Example:
.PP
.nf
REM Feb MSG Every day in February
.fi
@@ -581,6 +615,7 @@ Example:
and
.I month
present. Examples:
.PP
.nf
REM 6 Jan MSG Every 6th of January
REM Feb 29 MSG Every 29th of February
@@ -589,6 +624,7 @@ present. Examples:
5. Only
.I year
present. Example:
.PP
.nf
REM 1991 MSG Every day in 1991
.fi
@@ -598,6 +634,7 @@ present. Example:
and
.I day
present. Examples:
.PP
.nf
REM 1 1990 MSG 1st of every month in 1990
REM 1992 23 MSG 23rd of every month in 1992
@@ -608,6 +645,7 @@ present. Examples:
and
.I month
present. Examples:
.PP
.nf
REM Feb 1991 MSG Every day in Feb 1991
REM 1992 September MSG Every day in Sept 1992
@@ -618,6 +656,7 @@ present. Examples:
and
.I day
present. Examples:
.PP
.nf
REM 8 Jan 1991 MSG 8th January 1991.
REM 1992 March 9 MSG 9th March 1992.
@@ -626,6 +665,7 @@ present. Examples:
9.
.I weekday
only. Examples:
.PP
.nf
REM Sat MSG Every Saturday
REM Mon Tue Wed Thu Fri MSG Every working day
@@ -637,6 +677,7 @@ only. Examples:
and
.I day
present. Examples:
.PP
.nf
REM Sat 1 MSG First Saturday of every month
REM Mon Tue Wed Thu Fri 15 \\
@@ -648,6 +689,7 @@ present. Examples:
and
.I month
present. Examples:
.PP
.nf
REM Mon March MSG Every Monday in March
REM Mon Tue Wed Thu Fri Feb MSG Every working day in February
@@ -658,6 +700,7 @@ present. Examples:
and
.I day
present. Examples:
.PP
.nf
REM Mon 1 March MSG First Monday in March
REM Sat Sun 15 July MSG First Sat or Sun on or after 15 July
@@ -668,6 +711,7 @@ present. Examples:
and
.I year
present. Example:
.PP
.nf
REM Sat Sun 1991 MSG Every Saturday and Sunday in 1991
.fi
@@ -677,6 +721,7 @@ present. Example:
and
.I year
present. Examples:
.PP
.nf
REM Mon 15 1990 MSG 1st Mon after 15th of every month in 1990
REM Mon Tue Wed Thu Fri 1 1990 \\
@@ -688,6 +733,7 @@ present. Examples:
and
.I year
present. Example:
.PP
.nf
REM Mon Wed 1991 Feb MSG Every Mon and Wed in Feb 1991.
.fi
@@ -697,6 +743,7 @@ present. Example:
and
.I year
present. Example:
.PP
.nf
REM Mon Tue Wed Thu Fri 28 Oct 1990 \\
MSG 1st working day on or after 28 October 1990.
@@ -957,6 +1004,18 @@ also. See "The OMIT command" for more details.)
By comparison, if we had used "\-\-1", the reminder would be triggered on
the last day of the month, regardless of the \fBOMIT\fR.
.PP
If you locally omit weekdays but also have globally-omitted weekdays, then
the list of ommitted weekdays is the union of the two. Consider this
example:
.PP
.nf
OMIT Sat Sun
REM 15 OMIT Fri Sat MSG Whatever
.fi
.PP
In the REM command, the effective list of omitted weekdays will
be Friday, Saturday and Sunday.
.PP
.B COMPUTED LOCAL OMITS
.PP
The \fBOMITFUNC\fR phrase of the \fBREM\fR command allows you to
@@ -1130,7 +1189,8 @@ tags; see their documentation for details.
.PP
The \fBTAG\fR keyword is followed by a tag consisting of up to
48 characters. You can have as many TAG clauses as you like in
a given REM statement.
a given REM statement. A tag can contain any character except for
whitespace and a comma.
.PP
If you supply the \fB\-y\fR option to \fBRemind\fR, then any
reminder that lacks a \fBTAG\fR will have one synthesized. The
@@ -1466,7 +1526,8 @@ Notes:
o
.B Remind
normally prints a blank line after each reminder; if the last character
of the body is "%", the blank line will not be printed.
of the body is "%", the blank line will not be printed. You can globally
suppress the extra blank lines by setting \fB$AddBlankLines\fR to 0.
.TP
o
Substitutions a, b, c, e, f, g, h, i, j, k, l, u and v all are replaced
@@ -1515,11 +1576,15 @@ In addition to being a keyword in the \fBREM\fR command,
\fBOMIT\fR is a command in its own right. Its syntax is:
.PP
.RS
\fBOMIT\fR \fIday\fR \fImonth\fR [\fIyear\fR]
\fBOMIT\fR \fIweekday\fR [\fIweekday\fR...]
.PP
or:
.PP
\fBOMIT\fR \fIday1\fR \fImonth1\fR \fIyear1\fR \fBTHROUGH\fR \fIday2\fR \fImonth2\fR \fIyear2\fR
\fBOMIT\fR [\fIday\fR] \fImonth\fR [\fIyear\fR]
.PP
or:
.PP
\fBOMIT\fR [\fIday1\fR] \fImonth1\fR [\fIyear1\fR] \fBTHROUGH\fR [\fIday2\fR] \fImonth2\fR [\fIyear2\fR]
.RE
.PP
The \fBOMIT\fR command is used to "globally" omit certain days
@@ -1528,12 +1593,23 @@ The \fBOMIT\fR command is used to "globally" omit certain days
"\-\-" and "\+\+" forms. Some examples:
.PP
.nf
OMIT 1 Jan
OMIT 7 Sep 1992
OMIT Saturday Sunday
OMIT 1 Jan
OMIT 7 Sep 1992
OMIT 15 Jan THROUGH 14 Feb
OMIT May # Equivalent to OMIT May 1 THROUGH May 31
OMIT 25 Dec THROUGH 4 Jan
OMIT 2023-05-03 THROUGH 2023-05-12
OMIT Jun THROUGH July # Equivalent to OMIT Jun 1 THROUGH July 31
.fi
.PP
The first example specifies a holiday that occurs on the same date each
year - New Year's Day. The second example specifies a holiday that
The first example omits every Saturday and Sunday. This is useful for
reminders that shouldn't trigger on weekends.
.PP
The second example specifies a holiday that occurs on the same date each
year - New Year's Day.
.PP
The third example specifies a holiday that
changes each year - Labour Day. For these types of holidays, you
must create an \fBOMIT\fR command for each year. (Later, in the
description of expressions and some of the more advanced features of
@@ -1561,9 +1637,7 @@ equivalent:
.fi
.PP
The \fBTHROUGH\fR keyword lets you conveniently OMIT a range of days.
The starting and ending points must be fully-specified (ie, they must
include day, month and year.). For example, the following sequences
are equivalent:
For example, the following sequences are equivalent:
.PP
.nf
OMIT 3 Jan 2011
@@ -1575,12 +1649,28 @@ are equivalent:
OMIT 3 Jan 2011 THROUGH 5 Jan 2011
.fi
.PP
You can make a THROUGH \fBOMIT\fR do double-duty as a \fBREM\fR command:
You can make a THROUGH \fBOMIT\fR do double-duty as a \fBREM\fR command as
long as both dates are fully specified
.PP
.nf
OMIT 6 Sep 2010 THROUGH 10 Sep 2010 MSG Vacation
.fi
.PP
If you use a THROUGH clause, then either the year must be supplied before
and after the THROUGH, or it must be missing before and after the THROUGH.
The following are legal:
.PP
.nf
OMIT 25 Dec THROUGH 6 Jan
OMIT 25 Dec 2024 THROUGH 6 Jan 2025
.fi
.PP
But the following are not:
.PP
.nf
OMIT 25 Dec THROUGH 6 Jan 2025
OMIT 25 Dec 2024 THROUGH 6 Jan
.nf
.PP
You can debug your global OMITs with the following command:
.PP
@@ -1689,6 +1779,12 @@ Arguably, the \fBINCLUDE\fR command should have worked the way \fBDO\fR
does right from the start, but changing it would have broken
backward-compatibility, hence the introduction of \fBDO\fR.
.PP
Note that if the currently-processing reminders file was specified as
a symbolic link to a file that is not in the same directory as the
symbolic link itself, \fBDO\fR will fail. \fBRemind\fR does \fInot\fR
resolve the real path of symbolic links, so you should avoid using
symbolic links to files.
.PP
.SH THE RUN COMMAND
.PP
If you include other files in your reminder script, you may not always
@@ -1883,12 +1979,16 @@ The following examples illustrate constants in \fBRemind\fR expressions:
12, 36, \-10, 0, 1209
.TP
.B STRING constants
"Hello there", "This is a test", "\\n\\gosd\\w", ""
"Hello there", "This is a test", "\\nHello\\tThere", ""
.PP
.RS
Note that the empty string is represented by "", and that
backslashes in a string are \fInot\fR interpreted specially, as in they are
in C.
Note that the empty string is represented by "". Remind supports
the escape sequences "\\a", "\\b", "\\f", "\\n", "\\r", "\\t"
and "\\v" which have the same meanings as their counterparts in C.
To include a quote in a string, use "\\"". Any other character
preceded by a backslash is inserted into the string as-is, but the
backslash itself is removed. To include a backslash in a string,
use "\\\\".
.RE
.TP
.B TIME constants
@@ -2175,6 +2275,16 @@ The following system variables are defined. Those marked
"read-only" cannot be changed with the \fBSET\fR command.
All system variables hold values of type \fBINT\fR, unless otherwise
specified.
.TP
.B $AddBlankLines
If set to 1 (the default), then \fBRemind\fR normally prints a blank
line after the banner and each reminder. (This can be suppressed by
ending the reminder or banner with a single percent sign.) If
$AddBlankLines is set to 0, then Remind does not print the blank line.
In this case, ending a reminder with % has no effect. If you \fIdo\fR
want a blank line after a reminder, end it with \fB%_\fR to insert a
newline.
.TP
.B $CalcUTC
If 1 (the default), then \fBRemind\fR uses C library functions
@@ -2307,21 +2417,26 @@ The latitude of your location, expressed as a string that is a floating-point
number. Because \fBRemind\fR does not have a native floating-point type,
we need to express it as a string. $Latitude can range from "-90.0" to
"90.0", with positive numbers representing points north of the equator
and negative numbers representing south.
and negative numbers representing south. Note that regardless of your
locale, $Latitude is always interpreted in the "C" locale and as such,
the decimal point must be a period (".").
.TP
.B $Longitude (STRING type)
The longitude of your location, expressed as a string that is a floating-point
number. Because \fBRemind\fR does not have a native floating-point type,
we need to express it as a string. $Longitude can range from "-180.0" to
"180.0", with positive numbers representing points east of the Greenwich
Meridian and negative numbers representing west.
Meridian and negative numbers representing west. Note that regardless of your
locale, $Longitude is always interpreted in the "C" locale and as such,
the decimal point must be a period (".").
.RS
.PP
For example, the coordinates of the Statue of Liberty in New York City
are approximately set by:
.PP
.nf
SET $Latitude "40.68933"
SET $Longitude "-74.04454"
SET $Latitude "40.68933"
SET $Longitude "-74.04454"
.fi
.RE
.TP
@@ -2437,6 +2552,26 @@ order, or 2 if sorting by time in descending order.
The number of spaces by which all lines (except the first) of an
\fBMSF\fR-type reminder should be indented. The default is 0.
.TP
.B $SuppressLRM
Normally, when Remind is run with the \fB\-c\fR option in a UTF-8 locale,
it emits a left-to-right mark sequence after printing day names or
reminders. Some terminals render this incorrectly, so you can use:
.RS
.PP
.nf
SET $SuppressLRM 1
.fi
.PP
at the top of your reminder file to suppress the LRM sequences, or you
can invoke Remind with the option \fB'\-i$SuppressLRM=1'\fR.
.RE
.TP
.B $SysInclude (read-only, STRING type)
A directory path containing standard reminder scripts. Currently,
Remind ships with some standard holiday files and language packs.
The value of \fB$SysInclude\fR is likely to be something like
"/usr/share/remind" or "/usr/local/share/remind"
.TP
.B $T (read-only, DATE type)
Exactly equivalent to \fBtrigdate()\fR. (See BUILT-IN FUNCTIONS.)
.TP
@@ -2475,6 +2610,23 @@ Equivalent to \fBwkdaynum(today())\fR.
.TP
.B $Uy (read-only)
Equivalent to \fByear(today())\fR.
.TP
.B $UseVTColors (read-only)
Set to 1 if the \fB\-@\fR or \fB\-cc\fR options were used; 0 otherwise.
.TP
.B $UseBGVTColors (read-only)
Set to 1 if the \fB\-@,,1\fR option was used; 0 otherwise.
.TP
.B $Use256Colors (read-only)
Set to 1 if the \fB\-@1\fR option was used; 0 otherwise.
.TP
.B $UseTrueColors (read-only)
Set to 1 if the \fB\-@2\fR option was used; 0 otherwise.
.TP
.B $TerminalBackground (read-only)
Returns -1 if the terminal background color was not specified,
0 if it was specified as dark with the \fB\-@,0\fR option or
1 if it was specified as light with the \fB\-@,1\fR option.
.PP
Note: If any of the calendar modes are in effect, then the
values of $Daemon, $DontFork, $DontTrigAts, $DontQueue, $HushMode,
@@ -2537,6 +2689,60 @@ $TimeSep and $DateTimeSep when formatting its output. For example:
.PP
.RE
.TP
.B ansicolor(i_red, i_green, i_blue [,i_bg [,i_clamp]])
Returns a \fBSTRING\fR that contains an ANSI escape sequence for changing
the terminal text color. The parameters \fIred\fR, \fIgreen\fR and \fIblue\fR
are integers from 0 to 255 specifying the value of the respective color
component. As a special case, all three values can be -1, in which case
the ANSI sequence "ESC[0m" is returned, which resets all text attributes
to normal.
.RS
.PP
The string returned by \fBansicolor\fR depends on the color mode that
\fBRemind\fR is running in, as specified by the \fB\-@\fR option. If color
mode is not enabled, then \fBansicolor\fR always returns the empty string.
Otherwise, it returns the escape sequence that best approximates the color
according to the \fB\-@\fR color mode.
.PP
The optional \fIbg\fR argument is either 0 or 1. If 0 (the default), then
the foreground color is set. If 1, then the background color is set. Note
that setting the background color only works in 256-color or true-color
mode.
.PP
The optional \fIclamp\fR argument is either 0 or 1. If 0 (the default),
then colors are not adjusted based on the terminal background color. If
1, then \fBRemind\fR attempts to adjust dark or bright colors so they have
enough contrast to be visible in the terminal.
.PP
The first three arguments may alternatively be specified as a string
consisting of three space-separated numbers, as in this example: "128 128 0"
.PP
As a special case, \fBansicolor("")\fR is equivalent to
\fBansicolor(-1,-1,-1)\fR and returns the ANSI sequence to reset all text
attributes to normal.
.PP
Note that inserting ANSI color sequences in calendar mode \fIwill
produce garbled results\fR. Therefore, we recommend defining
functions such as the ones below that return the empty string in
calendar mode:
.PP
.nf
IF $CalMode
FSET fg(r,g,b) ""
FSET bg(r,g,b) ""
ELSE
FSET fg(r,g,b) ansicolor(r,g,b)
FSET bg(r,g,b) ansicolor(r,g,b,1)
ENDIF
REM [fg(255,0,0)][bg(64,64,64)]Red on Gray[fg(-1,-1,-1)] in normal mode
REM SPECIAL COLOR 0 255 0 Green in normal and calendar mode
.fi
.PP
If you use the \fBansicolor\fR function, don't forget to reset the color
back to normal with \fBansicolor(-1,-1,-1)\fR or subsequent reminders
will continue to be colored.
.RE
.TP
.B args(s_fname)
Returns the number of arguments expected by the user-defined function
\fIfname\fR, or \-1 if no such user-defined function exists. Note that
@@ -2547,7 +2753,10 @@ available only in versions of \fBRemind\fR from 03.00.04 and up.
.TP
.B asc(s_string)
Returns an \fBINT\fR that is the ASCII code of the first character
in \fIstring\fR. As a special case, \fBasc("")\fR returns 0.
in \fIstring\fR. As a special case, \fBasc("")\fR returns 0. For UTF-8
strings, this will return the UTF-8 byte with which the string
begins, which is not likely to be very useful (and may indeed be negative
on machines where \fBchar\fR is a signed type.)
.TP
.B baseyr()
Returns the "base year" that was compiled into \fBRemind\fR (normally
@@ -2556,14 +2765,10 @@ Returns the "base year" that was compiled into \fBRemind\fR (normally
.TP
.B char(i_i1 [,i_i2...])
This function can take any number of \fBINT\fR arguments. It returns
a \fBSTRING\fR consisting of the characters specified by the arguments.
Note that none of the arguments can be 0, unless there is only one
a \fBSTRING\fR consisting of the bytes specified by the arguments.
It is easy to create invalid UTF-8 sequences; \fBchar\fR does not check
for this. Note that none of the arguments can be 0, unless there is only one
argument. As a special case, \fBchar(0)\fR returns "".
.PP
.RS
Note that because \fBRemind\fR does not support escaping of characters
in strings, the only way to get a double-quote in a string is to use
\fBchar(34)\fR.
.RE
.TP
.B choose(i_index, x_arg1 [,x_arg2...])
@@ -2622,6 +2827,22 @@ arguments are converted using the reverse of procedures described
above. A \fBSTRING\fR \fIarg\fR is converted by parsing it as an
integer.
.RE
.TP
.B columns([s_arg])
If called with no arguments, \fBcolumns()\fR behaves as follows:
If standard output is a TTY, returns the width of the terminal in columns.
If standard output is not a TTY, attempts to open "/dev/tty" to obtain
the terminal size. If this fails, returns -1.
.RS
.PP
If called with a single string argument, \fBcolumns(str)\fR returns
the number of columns \fBstr\fR will occupy if printed to a terminal.
ANSI color-changing sequences occupy zero columns whereas some Unicode
characters occupy two columns. \fBcolumns(str)\fR takes all of that
into account. Note that if Remind was compiled without Unicode support,
\fBcolumns(str)\fR returns a type mismatch error.
.RE
.TP
.B current()
Returns the current date and time as a DATETIME object. This may be the
@@ -2770,6 +2991,13 @@ This includes the file "stuff" in the same directory as the
current file being processed. Note that this workaround is
no longer necessary because \fBDO stuff\fR will achieve the
same goal.
.PP
Note that if the currently-processing reminders file was specified as
a symbolic link, then \fBfiledir()\fR returns the directory containing
the symbolic link and \fInot\fR the directory containing the target
of the symbolic link. You should avoid using
symbolic links to files unless both the symbolic link and its target
happen to be in the same directory.
.RE
.TP
.B filename()
@@ -2862,6 +3090,10 @@ other languages, this function will return the English name of the
language (e.g. "German") Note that \fBlanguage()\fR is not available
in versions of \fBRemind\fR prior to 03.00.02.
.TP
.B localtoutc(q_datetime)
Given a \fBDATETIME\fR object interpreted in the local time zone, return
a \fBDATETIME\fR object that expresses the same time in UTC.
.TP
.B lower(s_string)
Returns a \fBSTRING\fR with all upper-case characters in \fIstring\fR
converted to lower-case.
@@ -3027,6 +3259,27 @@ Returns a string that is the ordinal number \fInum\fR. For example,
.B ostype()
Returns "UNIX". Remind used to run on OS/2 and MS-DOS, but does not
any longer.
.TP
.B pad(x_arg, s_padstr, i_len [, i_right])
Converts the first argument \fIarg\fR to a string if necessary, and
then if it is shorter than \fIlen\fR characters, pads to to
\fIlen\fR characters using as many copies (including partial copies)
of \fIpadstr\fR as necessary. By default, the string is left-padded,
but if \fIright\fR is supplied and non-zero, the string will
be right-padded.
.RS
.PP
Here are some examples:
.PP
.nf
pad(3, "0", 2) --> "03"
pad(465, "0", 2) --> "465"
pad("foo", " ", 5) --> " foo"
pad("foo", " ", 5, 1) --> "foo "
pad("foo", "bar", 11) --> "barbarbafoo"
.fi
.RE
.TP
.B plural(i_num [,s_str1 [,s_str2]])
Can take from one to three arguments. If one argument is supplied, returns
@@ -3112,6 +3365,11 @@ Returns the date as provided by the operating system. This is in contrast to
\fBRemind\fR's concept of "today", which may be changed if it is running
in calendar mode, or if a date has been supplied on the command line.
.TP
.B rows()
If standard output is a TTY, returns the height of the terminal in rows.
If standard output is not a TTY, attempts to open "/dev/tty" to obtain
the terminal size. If this fails, returns -1.
.TP
.B sgn(i_num)
Returns \-1 if \fInum\fR is negative, 1 if \fInum\fR is positive,
and 0 if \fInum\fR is zero.
@@ -3173,9 +3431,24 @@ May 16 and 17. You can go backwards, too, so:
takes \fIa\fR back to 2009-05-13.
.RE
.TP
.B stdout()
Returns a string representing where Remind's standard output is going.
The return values are one of the following: "TTY" if standard-output
is a terminal, "BLOCKDEV" if it is a block device (very unlikely),
"CHARDEV" if it is a character device (eg, /dev/null), "DIR" if it
is a directory (very unlikely), "PIPE" if it is a pipe or FIFO,
"SYMLINK" if it is a symlink (very unlikely), "SOCKET" if it is a
socket, or "UNKNOWN" if it could not be determined.
.RS
.PP
The purpose of \fBstdout()\fR is mostly to distinguish between TTY
and non-TTY output; you may wish to change or disable colors if the
output is not going to a TTY.
.RE
.TP
.B strlen(s_str)
Returns the length of \fIstr\fR. If the length of \fIstr\fR is too large
to represent as an integers, emits a "Number too high" error.
to represent as an integer, emits a "Number too high" error.
.TP
.B substr(s_str, i_start [,i_end])
Returns a \fBSTRING\fR consisting of all characters in \fIstr\fR from
@@ -3215,6 +3488,12 @@ Creates a \fBTIME\fR with the hour and minute components specified by
Returns a \fBTIME\fR object representing the time portion of
\fIdatetime\fR.
.TP
.B timezone([dq_datetime])
Returns a string representing the local time zone name of the given
\fBDATETIME\fR. If no argument is supplied, \fBRemind\fR uses the
value of \fBcurrent()\fR. If a \fBDATE\fR rather than \fBDATETIME\fR
is supplied, \fBRemind\fR uses a time part of 00:00.
.TP
.B today()
Returns \fBRemind\fR's notion of "today." This may be the actual system
date, or a date supplied on the command line, or the date of the
@@ -3236,6 +3515,7 @@ non-zero trigger date.
\fBIFTRIG\fR. For example, if you have meetings every Monday in
June and July, and you want warnings 3 days in advance, you
could use:
.PP
.nf
REM [trig("Mon Jun +3", "Mon July +3")] +3 MSG Meeting %b
.fi
@@ -3440,6 +3720,12 @@ returns "30 November 1994 AT 22:00" for EST, which is 5 hours behind UTC.
The value for your time zone may differ.
.RE
.TP
.B trigtags()
Returns a comma-separated list of the TAGs associated with the most recent
\fBREM\fR command that was triggered. Returns the empty string if there
were no TAGs. If there are multiple tags, they are each separated by
a single comma, not a comma and a space.
.TP
.B trigtime()
Returns the time of the last \fBREM\fR command with an \fBAT\fR
clause. If the last \fBREM\fR did not have an \fBAT\fR clause,
@@ -3481,6 +3767,11 @@ values. Here is an example:
Returns a \fBSTRING\fR with all lower-case characters in \fIstring\fR
converted to upper-case.
.TP
.B utctolocal(q_datetime)
Given a \fBDATETIME\fR object interpreted in UTC, return a
\fBDATETIME\fR object that expresses the same time in the local time
zone.
.TP
.B value(s_varname [,x_default])
Returns the value of the specified variable. For example, value("X"+"Y")
returns the value of variable XY, if it is defined. If XY is not defined,
@@ -3494,7 +3785,7 @@ defined, and the value of XY if it is defined.
.TP
.B version()
Returns a string specifying the version of \fBRemind\fR. For version
03.00.04, returns "03.00.04". It is guaranteed that as new versions of
@VERSION@, returns "@VERSION@". It is guaranteed that as new versions of
\fBRemind\fR are released, the value returned by \fBversion()\fR will
strictly increase, according to the rules for string ordering.
.TP
@@ -3827,13 +4118,13 @@ Notes:
.TP
o
If you access a variable in \fIexpr\fR that is not in the list of arguments,
the "global" value (if any) is used.
the global value (if any) is used.
.TP
o
Function and parameter names are significant only to 12 characters.
Function and parameter names are significant to 64 characters.
.TP
o
The \fBvalue()\fR function \fIalways\fR accesses the "global" value of a
The \fBvalue()\fR function \fIalways\fR accesses the global value of a
variable, even if it has the same name as an argument. For example:
.RS
.PP
@@ -3861,6 +4152,19 @@ with future versions of \fBRemind\fR (which may define more built-in
functions), you may wish to name all user-defined functions beginning
with an underscore.
.PP
To delete a user-defined function, use \fBFUNSET\fR. This takes a
space-separated list of user-defined functions to delete. For
example, after the command:
.PP
.nf
FUNSET myfunc1 otherfunc thirdfunc
.fi
.PP
it is guaranteed that no user-defined functions named myfunc1, otherfunc
or thirdfunc will exist. \fBRemind\fR does not issue an error if you
try to \fBFUNSET\fR a nonexistent user-defined function; it simply
does nothing in that case.
.PP
.SH PRECISE SCHEDULING
.PP
The \fBWARN\fR keyword allows precise control over advance warning in
@@ -4668,7 +4972,7 @@ error messages. For an example of this, define the following:
fset msgprefix(x) x/0
.fi
.PP
.SH SUPPORT FOR OTHER LANGUAGES
.SH COMPILE-TIME SUPPORT FOR OTHER LANGUAGES
.PP
Your version of \fBRemind\fR may have been compiled to support a
language other than English. This support may or may not be complete -
@@ -4681,10 +4985,14 @@ selected language rather than for English.
Note that a non-English version of \fBRemind\fR will accept \fIonly\fR
English names of weekdays and months in a reminder script.
.PP
If there is no support for your particular language, you can set
\fBRemind\fR system variables so that calendars are printed using
your language's day and month names. The system variables that you
can set are:
.SH RUN-TIME SUPPORT FOR OTHER LANGUAGES
.PP
\fBRemind\fR has run-time support for other languages, and it is
expected that compile-time support will be deprecated in favour of
run-time support.
.PP
A number of system variables let you translate various phrases
to other languages. These system variables are:
.PP
.TP
.B $Monday, $Tuesday, $Wednesday, $Thursday, $Friday, $Saturday
@@ -4694,16 +5002,137 @@ day's name in your language. Strings must be valid UTF-8 strings.
.B $January, $February, $March, $April, $May, $June, $July, $August, $September, $October, $November, $December
Set each of these system variables to a string representing the corresponding
month's name in your language. Strings must be valid UTF-8 strings.
.TP
.B $Ago, $Am, $And, $At, $Hour, $Is, $Minute, $Now, $On, $Pm, $Was
Set each of these system variables to the translation of the corresponding
English word into your language. Note that \fB$Am\fR and \fB$Pm\fR should
be the translations of "AM" and "PM" (morning and afternoon time indicators)
respectively.
.TP
.B $Hplu, $Mplu
Set these to the suffix to add to the word for "hour" and "minute" to
make them plural. In English, both would be set to "s".
.TP
.B $Fromnow
Set this to the translation of the English phrase "from now"
.PP
Note that if you set the day- or month-name system variables, they
should be set in a section of your script that always is evaluated.
If you set them inside an \fBIF\fR statement, for example, results
are unpredictable.
Note that if you set any of the language-related system variables,
they should be set in a section of your script that always is
evaluated. If you set them inside an \fBIF\fR statement, for example,
results are unpredictable.
.PP
Note also that the \fBRem2PS\fR back-end does not support the full
range of UTF-8 characters. The \fBTkRemind\fR, \fBrem2html\fR and
\fBrem2pdf\fR back-ends all do support the full UTF-8 range.
.PP
.SH RUN-TIME MODIFICATION OF THE SUBSTITUTION FILTER
.PP
The system variables mentioned in the previous section are not typically
sufficient to properly translate Remind's output to another language.
Some languages have complicated rules for AM vs PM times and others have
complex rules for making words plural. \fBRemind\fR therefore allows
you to define a number of functions that modify the behavior of
the substitution filter at run-time. The functions are:
.PP
.TP
.B subst_ampm(h)
This function is passed a single integer, namely an hour from 0 to 23.
It should return a string that indicates "AM" or "PM" or even finer
gradations in some languages.
.TP
.B subst_ordinal(d)
This function is passed a single integer, namely a day of the month from
1 to 31. It should return a string that is suffixed to the day number to
turn it into an ordinal number. In English, for example, the function
might return "st", "nd", "rd" or "th", depending on \fId\fR.
.TP
.B subst_\fIN\fR\fB(alt, date, time)\fR
This is actually a \fIfamily\fR of functions, where \fIN\fR is a letter
or number. This function \fIcompletely overrides\fR the substitution
sequence "%N". The three arguments are an integer \fIalt\fR which,
if non-zero, indicates that the alternate-mode substitution sequence
"%*N" was encountered; \fIdate\fR which is the trigger date of the
reminder and \fItime\fR which is the trigger time.
.TP
.B subst_\fIN\fR\fBx(alt, date, time)\fR
Again, this is a \fIfamily\fR of functions. It is similar to the
\fBsubst_\fIN\fR family except it is only called if \fIdate\fR is two or
more days away from \fItoday()\fR. This is useful if you don't want to
override the "today" or "tomorrow" output for most substitution sequences.
.PP
Here's an example of how you might customize your substitution filter.
Suppose you want to change the "%b" sequence to substitute "the day
after tomorrow" for an event two days from now. You could do this:
.PP
.nf
FSET subst_bx(a,d,t) iif(d==today()+2, "the day after tomorrow", \\
"in " + (d-today()) + " days' time")
REM [today()+3] ++3 MSG Event 1 is %b%
REM [today()+2] ++3 MSG Event 2 is %b%
REM [today()+1] ++3 MSG Event 3 is %b%
REM [today()] ++3 MSG Event 4 is %b%
.fi
.PP
The output of this script is:
.PP
.nf
Event 1 is in 3 days' time
Event 2 is the day after tomorrow
Event 3 is tomorrow
Event 4 is today
.fi
.PP
Note how Event 2's wording was changed from the normal "in 2 days'
time", and note also that the "tomorrow" and "today" events used the
normal substitution---\fBsubst_bx\fR is not called for trigger days of
today or tomorrow.
.PP
As a special case, if a \fBsubst_Nx\fB or \fBsubst_N\fR function
returns the integer zero, then the normal substitution mechanism is
used. Therefore, the previous example could have been written more simply
as:
.PP
.nf
FSET subst_bx(a,d,t) iif(d==today()+2, "the day after tomorrow", 0)
.fi
.PP
You can define your own substitution sequences in addition to the built-in
ones as follows: If you define a function named \fBsubst_\fIname\fB(alt, date, time)\fR, then the sequence \fB%{name}\fR calls the function with \fBalt\fR
set to 0 and \fBdate\fR and \fRtime\fR to the trigger date and time,
respectively. The \fB%{name}\fR sequence is replaced with whatever the
function returns. The sequence \fB%*{name}\fR is similar, but calls
the function with \fBalt\fR set to 1.
.PP
If you use a \fB%{name}\fR sequence and the function \fBsubst_\fIname\fR is
not defined or returns an error, then \fB%{name}\fR is replaced with the
empty string.
.PP
.SH LANGUAGE PACKS
.PP
\fBRemind\fR ships with a number of language packs, which are simply reminder
scripts located in \fB[$SysInclude]/lang\fR. The currently-shipping
language packs are:
.PP
da.rem (Danish), de.rem (German), es.rem (Spanish), fr.rem (French),
is.rem (Icelandic), it.rem (Italian), nl.rem (Dutch), no.rem (Norwegian),
pl.rem (Polish), pt.rem (Portuguese) and ro.rem (Romanian).
.PP
To use a language pack (in this example, de.rem), simply place this at
the top of your reminders file:
.PP
.nf
INCLUDE [$SysInclude]/lang/de.rem
.fi
.PP
If you want \fBRemind\fR to try to find the language pack appropriate
for your locale settings, use:
.PP
.nf
INCLUDE [$SysInclude]/lang/auto.rem
.fi
.PP
You are encouraged to study the language packs to see how to translate
Remind into additional languages.
.PP
.SH THE HEBREW CALENDAR
.PP
@@ -4912,10 +5341,12 @@ should attempt to support. They are currently supported by
.PP
The \fBSHADE\fR special replaces the \fBpsshade()\fR function.
Use it like this:
.PP
.nf
REM Sat Sun SPECIAL SHADE 128
REM Mon SPECIAL SHADE 255 0 0
.fi
.PP
The \fBSHADE\fR keyword is followed by either one or three numbers,
from 0 to 255. If one number is supplied, it is interpreted as
a grey-scale value from black (0) to white (255). If three numbers
@@ -4926,14 +5357,17 @@ in calendars produced by \fBRem2PS\fR, \fBtkremind\fR and \fBrem2html\fR.)
.PP
The \fBMOON\fR special replaces the \fBpsmoon()\fR function. Use it
like this:
.PP
.nf
REM [moondate(0)] SPECIAL MOON 0
REM [moondate(1)] SPECIAL MOON 1
REM [moondate(2)] SPECIAL MOON 2
REM [moondate(3)] SPECIAL MOON 3
.fi
.PP
These draw little moons on the various calendars. The complete syntax
of the \fBMOON\fR special is as follows:
.PP
.nf
... SPECIAL MOON phase moonsize fontsize msg
.fi
@@ -4954,12 +5388,12 @@ and \fIfontsize\fR; the other backends use fixed sizes.
.PP
The \fBCOLOR\fR special lets you place colored reminders in the
calendar. Use it like this:
.PP
.nf
REM ... SPECIAL COLOR 255 0 0 This is a bright red reminder
REM ... SPECIAL COLOR 0 128 0 This is a dark green reminder
.fi
.PP
You can spell COLOR either the American way ("COLOR") or the British
way ("COLOUR"). This manual will use the American way.
@@ -4980,11 +5414,11 @@ number in the calendar. For example, this would number each Monday
with the ISO 8601 week number. The week number is shown like this:
"(W\fIn\fR)" in this example, but you can put whatever text you like
after the WEEK keyword.
.PP
.nf
REM Monday SPECIAL WEEK (W[weekno()])
.fi
.PP
.SH MISCELLANEOUS
.PP
.B COMMAND ABBREVIATIONS
@@ -5242,9 +5676,6 @@ are not implemented as read-only system variables.
.PP
Hebrew dates in \fBRemind\fR change at midnight instead of sunset.
.PP
Language should be selectable at run-time, not compile-time. Don't
expect this to happen soon!
.PP
\fBRemind\fR has some built-in limits (for example, number of global
\fBOMIT\fRs.)
.PP
@@ -5259,7 +5690,8 @@ Almanac Office, USNO.
.PP
Richard Siegel and Michael and Sharon Strassfeld, \fIThe First Jewish
Catalog\fR, Jewish Publication Society of America.
.PP
.SH HOME PAGE
https://dianne.skoll.ca/projects/remind/
.SH SEE ALSO
.PP
\fBrem\fR(1), \fBrem2ps\fR(1), \fBrem2pdf\fR(1), \fBtkremind\fR(1), \fBrem2html\fR(1)

View File

@@ -1,4 +1,4 @@
.TH TKREMIND 1 "15 January 2021"
.TH TKREMIND 1 "@RELEASE_DATE@" "User Commands" "VERSION @VERSION@"
.UC 4
.SH NAME
tkremind \- graphical front-end to Remind calendar program
@@ -18,13 +18,13 @@ as well as the tcllib extension. It also requires a \fBwish\fR
binary. If you are using Tcl/Tk 8.5, you may also need either the Img
or the tkpng extension to handle PNG images.
.SH OPTIONS
\fBTkRemind\fR itself has no options. However, it passes certain options
on to \fBRemind\fR. The options it passes are
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR.
See the \fBRemind\fR man page for details about the options.
Note that \fBTkRemind\fR will respect the \fB\-m\fR and
\fB\-b1\fR options and adjust its appearance accordingly.
.SH COMMAND-LINE OPTIONS
\fBTkRemind\fR itself has no command-line options. However, it passes
certain options on to \fBRemind\fR. The options it passes are
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR. See the
\fBRemind\fR man page for details about the options. Note that
\fBTkRemind\fR will respect the \fB\-m\fR and \fB\-b1\fR options and
adjust its appearance accordingly.
\fIRead_file\fR is the file from which \fBTkRemind\fR reads reminders.
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
@@ -44,8 +44,14 @@ include the line:
.PP
\fIConfig_file\fR is the file in which \fBTkRemind\fR stores
its options. If it is omitted, it defaults to \fI$HOME/.tkremindrt\fR.
its options. If it is omitted, it defaults to \fI$HOME/.config/tkremindrc\fR.
.PP
If \fB$HOME/.reminders\fR is a \fIdirectory\fR, then \fBTkRemind\fR defaults to
reading \fB$HOME/.reminders\fR and writing new reminders to
\fB$HOME/.reminders/100-tkremind.rem\fR. If you want to keep your
reminders in a directory \fB$HOME/.reminders\fR, you should create that
directory before starting \fBTkRemind\fR.
.SH THE CALENDAR WINDOW
When you start \fBTkRemind\fR, it displays a calendar for the current
month, with today's date highlighted. Reminders are filled into each
@@ -274,7 +280,7 @@ Similar to Change entry font, but applies to calendar heading
.PP
Once you've configured the options the way you like them,
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
to put them into effect and save them in $HOME/.tkremindrc, or
to put them into effect and save them in $HOME/.config/tkremindrc, or
\fBCancel\fR to cancel any changes you made.
.SH KEYBOARD SHORTCUTS
@@ -293,6 +299,19 @@ Next Month
.B Home
Today
.SH IMMEDIATE UPDATES
If you are running \fBTkRemind\fR on Linux and have the
\fBinotifywait\fR program installed (part of the \fBinotify-tools\fR
or similar package), then \fBTkRemind\fR redraws the calendar window
\fIimmediately\fR if \fB$HOME/.reminders\fR changes (or, if it is a
directory, any files in that directory change.)
.PP
This lets \fBTkRemind\fR react immediately to hand-edited reminders or
to reminder files that are imported from another calendar system (for example,
you may have a cron job that periodically imports your Google Calendar
entries into Remind format.)
.SH ODDS AND ENDS
\fBTkRemind\fR performs some basic consistency checks when you add or
preview a reminder. However, if you edit a reminder in the previewer,
@@ -323,8 +342,7 @@ You can use this to activate certain reminders in different ways
for \fBTkRemind\fR (for example).
.PP
\fBTkRemind\fR uses tags to keep track of reminders in the
script file. It also places special comments in the reminder
file to store additional state. You can certainly mix
script file. You can certainly mix
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
if you are aware of the following rules and limitations:
.TP
@@ -334,15 +352,16 @@ where \fInnn\fR is a number. You should not use such \fBTAG\fRs
in hand-crafted reminders.
.TP
o
Do not edit lines starting with "# TKTAGnnn", "# TKEND", or any
lines in between. You can move such lines, but be careful to move
them as a single block.
.TP
o
Hand-crafted reminders cannot be edited with \fBTkRemind\fR, and
for hand-crafted timed reminders, you will not be presented with
the "Don't remind me again" option when they pop up.
.PP
However, rather than mixing hand-edited files with \fBTkRemind\fR-generated
ones, it is better to make \fB$HOME/.reminders\fR a directory and keep
your hand-edited files in a separate \fB*.rem\fR file than \fBTkRemind\fR's
\fB100-tkremind.rem\fR file.
.SH SERVER MODE
\fBRemind\fR has a special mode for interacting with programs like
@@ -400,14 +419,16 @@ This line is emitted in response to a \fBSTATUS\fR command. The number
.SH AUTHOR
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
\fBTkRemind\fR is Copyright 1996-2020 by Dianne Skoll.
\fBTkRemind\fR is Copyright 1996-2022 by Dianne Skoll.
.SH FILES
$HOME/.reminders -- default reminder file.
$HOME/.reminders -- default reminder file or directory.
$HOME/.tkremindrc -- \fBTkRemind\fR saved options.
$HOME/.config/tkremindrc -- \fBTkRemind\fR saved options.
.SH HOME PAGE
https://dianne.skoll.ca/projects/remind/
.SH SEE ALSO
\fBremind\fR, \fBrem2ps\fR, \fBrem2pdf\fR, \fBrem2html\fR

View File

@@ -19,7 +19,7 @@ install:
$(PERL) -M$$m -e 1 > /dev/null 2>&1; \
if test $$? != 0 ; then echo "Not installing rem2html; missing $$m"; exit 0; fi; \
done; \
pod2man rem2html > rem2html.1 && mkdir -p $(DESTDIR)$(mandir)/man1 && cp rem2html.1 $(DESTDIR)$(mandir)/man1/rem2html.1 || true; \
pod2man --center "VERSION @VERSION@" --date "@RELEASE_DATE@" rem2html > rem2html.1 && mkdir -p $(DESTDIR)$(mandir)/man1 && cp rem2html.1 $(DESTDIR)$(mandir)/man1/rem2html.1 || true; \
echo "Installing rem2html in $(DESTDIR)$(bindir)"; \
mkdir -p $(DESTDIR)$(bindir) && sed -e 's|^#!perl|#!$(PERL)|' < rem2html > $(DESTDIR)$(bindir)/rem2html && chmod 755 $(DESTDIR)$(bindir)/rem2html && exit 0; \
exit 1;

View File

@@ -130,6 +130,10 @@ today's date, add the following reminder to your reminders file:
rem2html was written by Dianne Skoll with much inspiration from an
earlier version by Don Schwarz.
=head1 HOME PAGE
L<https://dianne.skoll.ca/projects/remind/>
=head1 SEE ALSO
B<remind>, B<rem2ps>, B<rem2pdf>, B<tkremind>

View File

@@ -1,4 +1,15 @@
use ExtUtils::MakeMaker;
{
# Override pod2man options
package MY;
sub manifypods {
my ($self,%attribs) = @_;
my $result = $self->SUPER::manifypods(%attribs);
$result =~ s/^(POD2MAN_EXE\s*=\s*)(.+)$/$1$2 --center 'VERSION @VERSION@' --date '@RELEASE_DATE@'/m;
return $result;
}
}
WriteMakefile(
NAME => 'Remind::PDF',
AUTHOR => q{Dianne Skoll <dianne@skoll.ca>},

View File

@@ -33,10 +33,16 @@ install:
$(MAKE) install DESTDIR=$(DESTDIR) "INSTALL_BASE=$(INSTALL_BASE)" && exit 0; \
elif test "$(prefix)" = "/usr" ; then \
$(MAKE) install DESTDIR=$(DESTDIR) INSTALLDIRS=vendor && exit 0; \
else \
elif test "$(prefix)" = "/usr/local" ; then \
$(MAKE) install DESTDIR=$(DESTDIR) && exit 0; \
else \
$(MAKE) install DESTDIR=$(DESTDIR) "INSTALL_BASE=$(prefix)" && exit 0; \
fi; \
exit 1;
Makefile: Makefile.PL
$(PERL) Makefile.PL @PERLARTIFACTS@ INSTALL_BASE=$(INSTALL_BASE) || true
if test "$(prefix)" != "/usr" -a "$(prefix)" != "/usr/local" -a "$(INSTALL_BASE)" = "" ; then \
$(PERL) Makefile.PL @PERLARTIFACTS@ INSTALL_BASE=$(prefix) || true;\
else \
$(PERL) Makefile.PL @PERLARTIFACTS@ INSTALL_BASE=$(INSTALL_BASE) || true;\
fi

View File

@@ -1,6 +1,7 @@
#!@PERL@
use strict;
use warnings;
use lib '@prefix@/lib/perl5';
use Encode;
use Cairo;
@@ -442,14 +443,14 @@ B<-p>, B<-pp> or B<-ppp> options into B<rem2pdf>. The PDF output
will be sent to standard output. So for example, to print a 12-month
calendar for the year 2030, use:
remind -pp12 /dev/null Jan 2030 | rem2pdf -e -l -c=3 | lpr
remind -pp12 /dev/null Jan 2030 | rem2pdf -e -l -c3 | lpr
You can concatenate multiple B<remind> runs. For example, the following
will produce a PDF calendar for January through March of 2023, and
June of 2023 (for a total of four pages);
(remind -pp3 Jan 2023 /dev/null ; \
remind -p June 2023 /dev/null) | rem2pdf -e -l -c=3 > cal.pdf
(remind -pp3 /dev/null Jan 2023 ; \
remind -pp /dev/null June 2023) | rem2pdf -e -l -c3 > cal.pdf
=head1 FORMATTED TEXT
@@ -478,14 +479,14 @@ positioned absolutely with respect to the day's box (and is not
counted when calculating the box's height.)
A positive I<x> value positions the left edge of the text I<x> points
to the right of the left side of the calender box, while a negative
to the right of the left side of the calendar box, while a negative
I<x> value positions the right edge of the text I<x> points to the left
of the right side of the calender box.
of the right side of the calendar box.
A positive I<y> value positions the top edge of the text I<y> points
below the top of the calender box, while a negative I<y> value
below the top of the calendar box, while a negative I<y> value
positions the bottom edge of the text I<y> points above the bottom of
the calender box.
the calendar box.
If you use absolutely-positioned text, it's up to you to make sure it
doesn't overlap other text; B<rem2pdf> takes no special precautions to
@@ -503,6 +504,10 @@ of each calendar box:
B<Rem2PDF> was written by Dianne Skoll <dianne@skoll.ca>
=head1 HOME PAGE
L<https://dianne.skoll.ca/projects/remind/>
=head1 SEE ALSO
B<remind>, B<rem2ps>, B<rem2html>, B<tkremind>

View File

@@ -227,14 +227,16 @@ sub parse_oldstyle_line
if ($hash->{passthru}) {
if ($hash->{passthru} =~ /^(shade|color|colour)$/i) {
if ($hash->{body} =~ /^\s*(\d+)\s+(\d+)\s+(\d+)/) {
if ($hash->{body} =~ /^\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)/) {
$hash->{r} = $1;
$hash->{g} = $2;
$hash->{b} = $3;
} elsif ($hash->{body} =~ /^\s*(\d+)/) {
$hash->{body} = $4;
} elsif ($hash->{body} =~ /^\s*(\d+)\s*(.*)/) {
$hash->{r} = $1;
$hash->{g} = $1;
$hash->{b} = $1;
$hash->{body} = $2;
}
}
}
@@ -285,7 +287,7 @@ sub read_one_month_pp
Given a hashref C<$hash> consisting of one entry parsed
from the "remind -p" stream and a C<$specials_accepted> hash,
return 1 if we should include this entry in the calendar or
0 if mot.
0 if not.
=cut
sub accept_special

View File

@@ -76,7 +76,15 @@ sub render
$layout->set_width(1024 * ($x2 - $x1 - 2 * $settings->{border_size}));
$layout->set_wrap('word-char');
$layout->set_text(Encode::decode('UTF-8', $self->{body}));
my $body;
if (exists($self->{calendar_body})) {
$body = $self->{calendar_body};
} elsif (exists($self->{plain_body})) {
$body = $self->{plain_body};
} else {
$body = $self->{body};
}
$layout->set_text(Encode::decode('UTF-8', $body));
my $desc = Pango::FontDescription->from_string($settings->{entry_font} . ' ' . $settings->{entry_size} . 'px');
$layout->set_font_description($desc);
my ($wid, $h) = $layout->get_pixel_size();
@@ -233,11 +241,9 @@ sub _adjust
package Remind::PDF::Entry::color;
use base 'Remind::PDF::Entry';
# Strip the RGB prefix from body
# Nothing to do for COLOR-type reminder
sub _adjust
{
my ($self) = @_;
$self->{body} =~ s/^\d+\s+\d+\s+\d+\s+//;
}
package Remind::PDF::Entry::postscript;

View File

@@ -7,7 +7,7 @@
# A cheesy graphical front/back end for Remind using Tcl/Tk
#
# This file is part of REMIND.
# Copyright (C) 1992-2021 Dianne Skoll
# Copyright (C) 1992-2022 Dianne Skoll
#
#--------------------------------------------------------------
@@ -103,6 +103,9 @@ set OptDescr(RunCmd) "(String) If non-blank, run specified command when a pop-up
set Option(FeedReminder) 0
set OptDescr(FeedReminder) "(0/1) If 1, feed the reminder to RunCmd on standard input (see RunCmd option)"
set Option(DayAnchor) "center"
set OptDescr(DayAnchor) "(w/center/e) Anchor the day number to the left (w), center or right (e) of its container"
set Option(Editor) "emacs +%d %s"
set OptDescr(Editor) "(String) Specify command to edit a file. %d is replaced with line number and %s with filename"
@@ -454,6 +457,7 @@ proc CreateCalFrame { w dayNames } {
# Figure out reasonable height for text frames
global SetFontsWorked
global Option
global MondayFirst
set h [winfo screenheight .]
if {$h <= 480} {
if {$SetFontsWorked} {
@@ -467,7 +471,6 @@ proc CreateCalFrame { w dayNames } {
set h 5
}
global MondayFirst
frame $w -background $Option(LineColor)
for {set i 0} {$i < 7} {incr i} {
if {$MondayFirst} {
@@ -483,7 +486,7 @@ proc CreateCalFrame { w dayNames } {
set n [expr $i*7]
for {set j 0} {$j < 7} {incr j} {
set f [expr $n+$j]
button $w.l$f -text "" -justify center -command "" \
button $w.l$f -text "" -justify center -command "" -anchor $Option(DayAnchor) \
-state disabled -relief flat -bd 0 -padx 0 -pady 0 -font HeadingFont -highlightthickness 1
text $w.t$f -width 12 -height $h -bd 0 -spacing3 3 -wrap word -relief flat \
-state disabled -takefocus 0 -cursor {} -font CalboxFont -foreground $Option(TextColor) -background $Option(BackgroundColor) \
@@ -544,7 +547,9 @@ proc ConfigureCalFrame { w firstDay numDays } {
$w.t$i configure -state disabled -takefocus 0
}
for {set i $first} {$i <= $last} {incr i} {
set row [expr ($i/7)+1]
grid $w.f$i
grid rowconfigure $w $row -weight 1
pack $w.l$i -in $w.f$i -side top -expand 0 -fill x
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
raise $w.l$i
@@ -578,7 +583,7 @@ proc ConfigureCalFrame { w firstDay numDays } {
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
raise $w.l$i
raise $w.t$i
grid rowconfigure $w [expr $row+1] -weight 1
grid rowconfigure $w $row -weight 1
}
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
$w.l$i configure -state disabled
@@ -793,12 +798,26 @@ proc EditOptions {} {
-text "Feed popped-up reminder to command's standard input" \
-variable tmpOpt(FeedReminder) -anchor w -justify left
frame $w.ancFrame
label $w.ancLabel -text "Anchor day numbers to:"
radiobutton $w.ancLeft \
-text "Left" \
-variable tmpOpt(DayAnchor) -value "w" -anchor w -justify left
radiobutton $w.ancCenter \
-text "Center" \
-variable tmpOpt(DayAnchor) -value "center" -anchor w -justify left
radiobutton $w.ancRight \
-text "Right" \
-variable tmpOpt(DayAnchor) -value "e" -anchor w -justify left
pack $w.ancLabel $w.ancLeft $w.ancCenter $w.ancRight -in $w.ancFrame -side left
pack $w.startIconified -in $w.f -side top -expand 0 -fill x
pack $w.showTodays -in $w.f -side top -expand 0 -fill x
pack $w.confirmQuit -in $w.f -side top -expand 0 -fill x
pack $w.bringDown -in $w.f -side top -expand 0 -fill x
pack $w.ring -in $w.f -side top -expand 0 -fill x
pack $w.deic -in $w.f -side top -expand 0 -fill x
pack $w.ancFrame -in $w.f -side top -expand 0 -fill x
pack $w.sep1 -in $w.f -side top -expand 0 -fill x -ipady 1
pack $w.rf -in $w.f -side top -expand 0 -fill x
pack $w.feed -in $w.f -side top -expand 0 -fill x
@@ -877,6 +896,13 @@ proc SaveOptions { w } {
for {set i 0} {$i < 7} {incr i} {
.cal.day$i configure -foreground $Option(LabelColor) -background $Option(WinBackground)
}
for {set i 0} {$i < 6} {incr i} {
set n [expr $i*7]
for {set j 0} {$j < 7} {incr j} {
set f [expr $n+$j]
.cal.l$f configure -anchor $Option(DayAnchor);
}
}
.b.status configure -foreground $Option(LabelColor) -background $Option(WinBackground)
.b.nqueued configure -foreground $Option(LabelColor) -background $Option(WinBackground)
.b configure -background $Option(WinBackground)
@@ -929,6 +955,7 @@ proc WriteOptionsToFile {} {
#***********************************************************************
proc LoadOptions {} {
global Option ConfigFile
global MondayFirst
set problem [catch {set f [open "$ConfigFile" "r"]}]
if {$problem} {
return
@@ -948,6 +975,9 @@ proc LoadOptions {} {
set Option($key) $val
}
close $f
if {[regexp -- {-m.*} $Option(ExtraRemindArgs)]} {
set MondayFirst 1
}
font configure CalboxFont {*}$Option(CalboxFont)
font configure HeadingFont {*}$Option(HeadingFont)
}
@@ -986,7 +1016,7 @@ proc ConfigureCalWindow { month year firstDay numDays } {
proc FillCalWindow {} {
set FileName ""
set LineNo 0
global DayNames CurYear CurMonth MonthNames CommandLine Option TagToObj RemindErrors
global DayNames CurYear CurMonth MonthNames CommandLine Option TagToObj RemindErrors MondayFirst
array unset TagToObj
@@ -1025,7 +1055,12 @@ proc FillCalWindow {} {
# Update the day names in the calendar window
for {set i 0} {$i < 7} {incr i} {
.cal.day$i configure -text [lindex $DayNames $i]
if {$MondayFirst} {
set index [expr ($i+1)%7]
} else {
set index $i
}
.cal.day$i configure -text [lindex $DayNames $index]
}
set offset [CalEntryOffset $firstWkday]
@@ -1060,8 +1095,13 @@ proc FillCalWindow {} {
} else {
set tag "*"
}
set stuff [dict get $obj body]
if {[dict exists $obj calendar_body]} {
set stuff [dict get $obj calendar_body]
} elseif {[dict exists $obj plain_body]} {
set stuff [dict get $obj plain_body]
} else {
set stuff [dict get $obj body]
}
set day [string trimleft $day 0]
set n [expr $day+$offset]
set month [string trimleft $month 0]
@@ -1085,30 +1125,31 @@ proc FillCalWindow {} {
}
"COLOUR" -
"COLOR" {
if {[regexp {^ *([0-9]+) +([0-9]+) +([0-9]+) +(.*)$} $stuff all r g b rest]} {
if {$r > 255} {
set r 255
} elseif {$r < 0} {
set r 0
}
if {$g > 255} {
set g 255
} elseif {$g < 0} {
set g 0
}
if {$b > 255} {
set b 255
} elseif {$b < 0} {
set b 0
}
set color [format "%02X%02X%02X" $r $g $b]
set extratags "clr$color"
.cal.t$n configure -state normal
.cal.t$n tag configure $extratags -foreground "#$color"
.cal.t$n configure -state disabled -takefocus 0
set stuff $rest
set type "COLOR"
}
set r [dict get $obj r]
set g [dict get $obj g]
set b [dict get $obj b]
if {$r > 255} {
set r 255
} elseif {$r < 0} {
set r 0
}
if {$g > 255} {
set g 255
} elseif {$g < 0} {
set g 0
}
if {$b > 255} {
set b 255
} elseif {$b < 0} {
set b 0
}
set color [format "%02X%02X%02X" $r $g $b]
set extratags "clr$color"
.cal.t$n configure -state normal
.cal.t$n tag configure $extratags -foreground "#$color"
.cal.t$n configure -state disabled -takefocus 0
set stuff $stuff
set type "COLOR"
}
}
if { $type != "*" && $type != "COLOR" && $type != "COLOUR"} {
@@ -2075,7 +2116,7 @@ proc CreateReminder {w} {
# Check it out!
global Remind
set f [open "|$Remind -arq -e - 2>&1" r+]
set f [open "|$Remind -arq -e - 2>@1" r+]
puts $f "BANNER %"
puts $f "$rem MSG %"
puts $f "MSG %_%_%_%_"
@@ -3599,27 +3640,23 @@ proc DoMoonSpecial { n stuff fntag day } {
return
}
switch -exact -- $phase {
0 { set win .moon_new }
1 { set win .moon_first }
2 { set win .moon_full }
3 { set win .moon_last }
}
# We need two sets of moon phase windows. There can be
# two of a given phase in the same month, but Tk does
# not allow the same embedded window in two separate
# text boxes. So we use this hack to make sure
# we use a different window if the same moon phase
# happens twice in a month.
if { $day < 16 } {
switch -exact -- $phase {
0 { set win .moon_new }
1 { set win .moon_first }
2 { set win .moon_full }
3 { set win .moon_last }
}
} else {
switch -exact -- $phase {
0 { set win .moon_new2 }
1 { set win .moon_first2 }
2 { set win .moon_full2 }
3 { set win .moon_last2 }
}
if {$day > 16} {
append win "2"
}
.cal.t$n configure -state normal
.cal.t$n window create 1.0 -window $win
@@ -3688,7 +3725,6 @@ proc CreateMoonWindows {} {
catch { destroy .moon_last2 }
set extra 1
#set wid [font measure CalboxFont 0]
set wid [font metrics CalboxFont -ascent]
set orig_wid $wid
incr wid $extra
@@ -3699,43 +3735,32 @@ proc CreateMoonWindows {} {
incr orig_wid $extra
set w [expr $extra+$orig_wid]
canvas .moon_new -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_new create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
canvas .moon_first -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_first create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
.moon_first create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 90 -extent 180 -outline {}
foreach win {.moon_new .moon_new2 } {
canvas $win -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
$win create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
balloon_add_help $win "New Moon"
}
canvas .moon_full -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_full create oval $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -width 1
foreach win {.moon_first .moon_first2 } {
canvas $win -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
$win create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
$win create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 90 -extent 180 -outline {}
balloon_add_help $win "First Quarter"
}
canvas .moon_last -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_last create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
.moon_last create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 270 -extent 180 -outline {}
foreach win {.moon_full .moon_full2 } {
canvas $win -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
$win create oval $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -width 1
balloon_add_help $win "Full Moon"
}
canvas .moon_new2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_new2 create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
canvas .moon_first2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_first2 create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
.moon_first2 create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 90 -extent 180 -outline {}
canvas .moon_full2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_full2 create oval $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -width 1
canvas .moon_last2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
.moon_last2 create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
.moon_last2 create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 270 -extent 180 -outline {}
balloon_add_help .moon_new "New Moon"
balloon_add_help .moon_first "First Quarter"
balloon_add_help .moon_full "Full Moon"
balloon_add_help .moon_last "Last Quarter"
balloon_add_help .moon_new2 "New Moon"
balloon_add_help .moon_first2 "First Quarter"
balloon_add_help .moon_full2 "Full Moon"
balloon_add_help .moon_last2 "Last Quarter"
foreach win {.moon_last .moon_last2 } {
canvas $win -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
$win create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
$win create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 270 -extent 180 -outline {}
balloon_add_help $win "Last Quarter"
}
}
#***********************************************************************

View File

@@ -36,21 +36,21 @@ REMINDOBJS= $(REMINDSRCS:.c=.o)
all: remind rem2ps
test: remind
test: all
@sh ../tests/test-rem
.c.o:
@CC@ -c @CPPFLAGS@ @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
@CC@ -c @CPPFLAGS@ @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -DSYSDIR=$(datarootdir)/remind -I. -I$(srcdir) $<
$(REMINDOBJS): $(REMINDHDRS)
rem2ps: rem2ps.o dynbuf.o json.o
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o json.o -lm
@CC@ @CFLAGS@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o json.o -lm
remind: $(REMINDOBJS)
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
@CC@ @CFLAGS@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
install-nostripped: all
install: all
-mkdir -p $(DESTDIR)$(bindir) || true
for prog in $(PROGS) $(SCRIPTS) ; do \
$(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir) || exit 1; \
@@ -61,8 +61,10 @@ install-nostripped: all
for man in $(MANS) ; do \
$(INSTALL_DATA) $$man $(DESTDIR)$(mandir)/man1 || exit 1; \
done
-mkdir -p $(DESTDIR)$(datarootdir)/remind || true
cp -R ../include/* $(DESTDIR)$(datarootdir)/remind
install: install-nostripped
install-stripped: install
strip $(DESTDIR)$(bindir)/remind || true
strip $(DESTDIR)$(bindir)/rem2ps || true

View File

@@ -5,11 +5,11 @@
/* The code for generating a calendar. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#include "config.h"
#include "custom.h"
@@ -31,6 +31,7 @@
#include <langinfo.h>
#endif
#include "lang.h"
#include "types.h"
#include "protos.h"
#include "expr.h"
@@ -146,6 +147,47 @@ static char *VT100Colors[2][2][2][2] /* [Br][R][G][B] */ = {
}
};
static char *VT100BGColors[2][2][2] /* [R][G][B] */ = {
{
{
/* 0, 0, 0 = Black */ "\x1B[0;40m",
/* 0, 0, 1 = Blue */ "\x1B[0;44m"
},
{
/* 0, 1, 0 = Green */ "\x1B[0;42m",
/* 0, 1, 1 = Cyan */ "\x1B[0;46m"
}
},
{
{
/* 1, 0, 0 = Red */ "\x1B[0;41m",
/* 1, 0, 1 = Magenta */ "\x1B[0;45m"
},
{
/* 1, 1, 0 = Yellow */ "\x1B[0;43m",
/* 1, 1, 1 = White */ "\x1B[0;47m"
}
}
};
/* Moon phase icons in UTF-8 */
static char const *moonphase_emojis[] = {
"\xF0\x9F\x8C\x91",
"\xF0\x9F\x8C\x93",
"\xF0\x9F\x8C\x95",
"\xF0\x9F\x8C\x97"
};
/* Moon phases for each day 1-31, up to 32 chars per moon-phase string
including termination \0 */
static char moons[32][32];
/* Week indicators */
static char weeks[32][32];
/* Background colors of each day 1-31, rgb */
static int bgcolor[32][3];
static struct line_drawing *linestruct;
#define DRAW(x) fputs(linestruct->x, stdout)
@@ -228,13 +270,14 @@ static struct xterm256_colors XTerm256Colors[] =
/* Global variables */
static CalEntry *CalColumn[7];
static int ColToDay[7];
static int ColSpaces;
static int DidAMonth;
static int DidADay;
static void ColorizeEntry(CalEntry const *e);
static void ColorizeEntry(CalEntry const *e, int clamp);
static void SortCol (CalEntry **col);
static void DoCalendarOneWeek (int nleft);
static void DoCalendarOneMonth (void);
@@ -243,7 +286,7 @@ static void WriteWeekHeaderLine (void);
static void WritePostHeaderLine (void);
static void PrintLeft (char const *s, int width, char pad);
static void PrintCentered (char const *s, int width, char *pad);
static int WriteOneCalLine (void);
static int WriteOneCalLine (int jul, int wd);
static int WriteOneColLine (int col);
static void GenerateCalEntries (int col);
static void WriteCalHeader (void);
@@ -255,9 +298,53 @@ static void WriteBottomCalLine (void);
static void WriteIntermediateCalLine (void);
static void WriteCalDays (void);
static int
DayOf(int jul)
{
int d;
FromJulian(jul, NULL, NULL, &d);
return d;
}
static void
Backgroundize(int d)
{
if (d < 1 || d > 31) {
return;
}
if (!UseBGVTColors) {
return;
}
if (bgcolor[d][0] < 0) {
return;
}
printf("%s", Colorize(bgcolor[d][0], bgcolor[d][1], bgcolor[d][2], 1, 0));
}
static void
UnBackgroundize(int d)
{
if (d < 1 || d > 31) {
return;
}
if (!UseBGVTColors) {
return;
}
if (bgcolor[d][0] < 0) {
return;
}
printf("%s", Decolorize());
}
static void
send_lrm(void)
{
/* Don't send LRM if SuppressLRM is set */
if (SuppressLRM) {
return;
}
/* Send a lrm control sequence if UseUTF8Chars is enabled
or char encoding is UTF-8
*/
@@ -288,6 +375,19 @@ despace(char const *s)
return buf;
}
void PrintJSONChar(char c) {
switch(c) {
case '\b': printf("\\b"); break;
case '\f': printf("\\f"); break;
case '\n': printf("\\n"); break;
case '\r': printf("\\r"); break;
case '\t': printf("\\t"); break;
case '"': printf("\\\""); break;
case '\\': printf("\\\\"); break;
default: printf("%c", c);
}
}
void PrintJSONString(char const *s)
{
while (*s) {
@@ -374,7 +474,7 @@ void PrintJSONKeyPairTime(char const *name, int t)
}
#ifdef REM_USE_WCHAR
static void PutWideChar(wchar_t const wc)
void PutWideChar(wchar_t const wc)
{
char buf[MB_CUR_MAX+1];
int len;
@@ -492,16 +592,13 @@ ClampColor(int *r, int *g, int *b)
}
char const *
Decolorize(int r, int g, int b)
Decolorize(void)
{
if (!strcmp(Colorize(r, g, b), "")) {
return "";
}
return "\x1B[0m";
}
static char const *
Colorize256(int r, int g, int b)
Colorize256(int r, int g, int b, int bg, int clamp)
{
static char buf[40];
int best = -1;
@@ -510,7 +607,9 @@ Colorize256(int r, int g, int b)
struct xterm256_colors *cur;
size_t i;
ClampColor(&r, &g, &b);
if (clamp) {
ClampColor(&r, &g, &b);
}
for (i=0; i<(sizeof(XTerm256Colors) / sizeof(XTerm256Colors[0])); i++) {
cur = &XTerm256Colors[i];
dist = ((r - cur->r) * (r - cur->r)) +
@@ -522,31 +621,42 @@ Colorize256(int r, int g, int b)
}
}
cur = &XTerm256Colors[best];
sprintf(buf, "\x1B[38;5;%dm", best);
if (bg) {
sprintf(buf, "\x1B[48;5;%dm", best);
} else {
sprintf(buf, "\x1B[38;5;%dm", best);
}
return buf;
}
static char const *
ColorizeTrue(int r, int g, int b)
ColorizeTrue(int r, int g, int b, int bg, int clamp)
{
static char buf[40];
ClampColor(&r, &g, &b);
sprintf(buf, "\x1B[38;2;%d;%d;%dm", r, g, b);
if (clamp) {
ClampColor(&r, &g, &b);
}
if (bg) {
sprintf(buf, "\x1B[48;2;%d;%d;%dm", r, g, b);
} else {
sprintf(buf, "\x1B[38;2;%d;%d;%dm", r, g, b);
}
return buf;
}
char const *
Colorize(int r, int g, int b)
Colorize(int r, int g, int b, int bg, int clamp)
{
int bright = 0;
if (UseTrueColors) {
return ColorizeTrue(r, g, b);
return ColorizeTrue(r, g, b, bg, clamp);
}
if (Use256Colors) {
return Colorize256(r, g, b);
return Colorize256(r, g, b, bg, clamp);
}
if (r > 128 || g > 128 || b > 128) {
bright = 1;
}
@@ -557,43 +667,112 @@ Colorize(int r, int g, int b)
if (b > 64) b = 1;
else b = 0;
if (TerminalBackground == TERMINAL_BACKGROUND_DARK) {
if (clamp && TerminalBackground == TERMINAL_BACKGROUND_DARK && !bg) {
/* Convert black-on-black to grey */
if (!r && !g && !b) return VT100Colors[1][0][0][0];
}
if (TerminalBackground == TERMINAL_BACKGROUND_LIGHT) {
if (clamp && TerminalBackground == TERMINAL_BACKGROUND_LIGHT && !bg) {
/* Convert white-on-white to grey */
if (r && g && b) return VT100Colors[1][0][0][0];
}
return VT100Colors[bright][r][g][b];
if (bg) {
return VT100BGColors[r][g][b];
} else {
return VT100Colors[bright][r][g][b];
}
}
static void ColorizeEntry(CalEntry const *e)
static void ColorizeEntry(CalEntry const *e, int clamp)
{
printf("%s", Colorize(e->r, e->g, e->b));
printf("%s", Colorize(e->r, e->g, e->b, 0, clamp));
}
static int
ComputeCalWidth(int x)
static void
InitMoonsAndShades(void)
{
struct winsize w;
if (x >= 71) {
/* Has been set with -w option */
return x;
int i;
/* Initialize the moon array */
if (encoding_is_utf8) {
for (i=0; i<=31; i++) {
moons[i][0] = 0;
}
}
if (!isatty(STDOUT_FILENO)) {
/* Output is not a TTY... assume 80 */
return 80;
/* Clear SHADEs */
if (UseBGVTColors) {
for (i=0; i<=31; i++) {
bgcolor[i][0] = -1;
bgcolor[i][1] = -1;
bgcolor[i][2] = -1;
}
}
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) < 0) {
return 80;
/* Clear weeks */
for(i=0; i<=31; i++) {
weeks[i][0] = 0;
}
if (w.ws_col < 71) {
return 71;
}
return w.ws_col;
}
static void
SetShadeEntry(int jul, char const *shade)
{
int y, m, d;
int r, g, b;
/* Don't bother if we're not doing SHADE specials */
if (!UseBGVTColors) {
return;
}
if (sscanf(shade, "%d %d %d", &r, &g, &b) != 3) {
if (sscanf(shade, "%d", &r) != 1) {
return;
}
g = r;
b = r;
}
if (r < 0 || g < 0 || b < 0 || r > 255 || g > 255 || b > 255) {
return;
}
FromJulian(jul, &y, &m, &d);
bgcolor[d][0] = r;
bgcolor[d][1] = g;
bgcolor[d][2] = b;
}
static void
SetMoonEntry(int jul, char const *moon)
{
int phase;
int y, m, d;
char msg[28];
/* Don't bother unless it's utf-8 */
if (!encoding_is_utf8) {
return;
}
msg[0] = 0;
if (sscanf(moon, "%d %*d %*d %27[^\x01]", &phase, msg) < 4) {
if (sscanf(moon, "%d", &phase) != 1) {
/* Malformed MOON special; ignore */
fprintf(stderr, "Oops 1\n");
return;
}
}
if (phase < 0 || phase > 3) {
/* Bad phase */
fprintf(stderr, "Oops 2\n");
return;
}
FromJulian(jul, &y, &m, &d);
if (msg[0]) {
snprintf(moons[d], sizeof(moons[d]), "%s %s", moonphase_emojis[phase], msg);
} else {
snprintf(moons[d], sizeof(moons[d]), "%s", moonphase_emojis[phase]);
}
}
/***************************************************************/
/* */
/* ProduceCalendar */
@@ -622,8 +801,6 @@ void ProduceCalendar(void)
}
ShouldCache = 1;
CalWidth = ComputeCalWidth(CalWidth);
ColSpaces = (CalWidth - 9) / 7;
CalWidth = 7*ColSpaces + 8;
@@ -676,18 +853,22 @@ static void DoCalendarOneWeek(int nleft)
int LinesWritten = 0;
int OrigJul = JulianToday;
InitMoonsAndShades();
/* Fill in the column entries */
for (i=0; i<7; i++) {
ColToDay[i] = DayOf(JulianToday);
GenerateCalEntries(i);
JulianToday++;
}
/* Output the entries */
/* Figure out weekday of first column */
if (MondayFirst) wd = JulianToday % 7;
else wd = (JulianToday + 1) % 7;
/* Output the entries */
/* If it's "Simple Calendar" format, do it simply... */
if (DoSimpleCalendar) {
if (MondayFirst) wd = JulianToday % 7;
else wd = (JulianToday + 1) % 7;
for (i=0; i<7; i++) {
WriteSimpleEntries(i, OrigJul+i-wd);
}
@@ -699,13 +880,33 @@ static void DoCalendarOneWeek(int nleft)
DRAW(tb);
goff();
for (i=0; i<7; i++) {
FromJulian(OrigJul+i, &y, &m, &d);
FromJulian(OrigJul+i, &y, &m, &d);
char const *mon = get_month_name(m);
snprintf(buf, sizeof(buf), "%d %s ", d, get_month_abbrev(mon));
if (OrigJul+i == RealToday)
PrintLeft(buf, ColSpaces, '*');
else
if (moons[d][0]) {
if (weeks[d][0]) {
snprintf(buf, sizeof(buf), "%d %s %s %s ", d, get_month_abbrev(mon), weeks[d], moons[d]);
} else {
snprintf(buf, sizeof(buf), "%d %s %s ", d, get_month_abbrev(mon), moons[d]);
}
} else {
if (weeks[d][0]) {
snprintf(buf, sizeof(buf), "%d %s %s ", d, get_month_abbrev(mon), weeks[d]);
} else {
snprintf(buf, sizeof(buf), "%d %s ", d, get_month_abbrev(mon));
}
}
if (OrigJul+i == RealToday) {
if (UseVTColors) {
printf("\x1B[1m"); /* Bold */
}
PrintLeft(buf, ColSpaces-1, '*');
if (UseVTColors) {
printf("\x1B[0m"); /* Normal */
}
putchar(' ');
} else {
PrintLeft(buf, ColSpaces, ' ');
}
gon();
DRAW(tb);
goff();
@@ -716,7 +917,10 @@ static void DoCalendarOneWeek(int nleft)
DRAW(tb);
goff();
for (i=0; i<7; i++) {
d = ColToDay[i];
Backgroundize(d);
PrintLeft("", ColSpaces, ' ');
UnBackgroundize(d);
gon();
DRAW(tb);
goff();
@@ -727,7 +931,7 @@ static void DoCalendarOneWeek(int nleft)
/* Write the body lines */
done = 0;
while (!done) {
done = WriteOneCalLine();
done = WriteOneCalLine(OrigJul, wd);
LinesWritten++;
}
@@ -737,7 +941,10 @@ static void DoCalendarOneWeek(int nleft)
DRAW(tb);
goff();
for (i=0; i<7; i++) {
d = ColToDay[i];
Backgroundize(d);
PrintLeft("", ColSpaces, ' ');
UnBackgroundize(d);
gon();
DRAW(tb);
goff();
@@ -764,6 +971,8 @@ static void DoCalendarOneMonth(void)
{
int y, m, d, mm, yy, i, j;
InitMoonsAndShades();
if (!DoSimpleCalendar) WriteCalHeader();
DidADay = 0;
@@ -864,10 +1073,15 @@ static int WriteCalendarRow(void)
if (!MondayFirst) wd = (JulianToday + 1) % 7;
else wd = JulianToday % 7;
for (i=0; i<7; i++) {
ColToDay[i] = 0;
}
/* Fill in the column entries */
for (i=wd; i<7; i++) {
if (d+i-wd > DaysInMonth(m, y)) break;
GenerateCalEntries(i);
ColToDay[i] = DayOf(JulianToday);
JulianToday++;
}
@@ -890,9 +1104,27 @@ static int WriteCalendarRow(void)
if (i < wd || d+i-wd>DaysInMonth(m, y))
PrintLeft("", ColSpaces, ' ');
else {
sprintf(buf, "%d ", d+i-wd);
if (moons[d+i-wd][0]) {
if (weeks[d+i-wd][0]) {
snprintf(buf, sizeof(buf), "%d %s %s ", d+i-wd, weeks[d+i-wd], moons[d+i-wd]);
} else {
snprintf(buf, sizeof(buf), "%d %s ", d+i-wd, moons[d+i-wd]);
}
} else {
if (weeks[d+i-wd][0]) {
snprintf(buf, sizeof(buf), "%d %s ", d+i-wd, weeks[d+i-wd]);
} else {
snprintf(buf, sizeof(buf), "%d ", d+i-wd);
}
}
if (Julian(y, m, d+i-wd) == RealToday) {
if (UseVTColors) {
printf("\x1B[1m"); /* Bold */
}
PrintLeft(buf, ColSpaces-1, '*');
if (UseVTColors) {
printf("\x1B[0m"); /* Normal */
}
putchar(' ');
} else {
PrintLeft(buf, ColSpaces, ' ');
@@ -908,7 +1140,9 @@ static int WriteCalendarRow(void)
DRAW(tb);
goff();
for (i=0; i<7; i++) {
Backgroundize(ColToDay[i]);
PrintLeft("", ColSpaces, ' ');
UnBackgroundize(ColToDay[i]);
gon();
DRAW(tb);
goff();
@@ -919,7 +1153,7 @@ static int WriteCalendarRow(void)
/* Write the body lines */
done = 0;
while (!done) {
done = WriteOneCalLine();
done = WriteOneCalLine(OrigJul, wd);
LinesWritten++;
}
@@ -929,7 +1163,9 @@ static int WriteCalendarRow(void)
DRAW(tb);
goff();
for (i=0; i<7; i++) {
Backgroundize(ColToDay[i]);
PrintLeft("", ColSpaces, ' ');
UnBackgroundize(ColToDay[i]);
gon();
DRAW(tb);
goff();
@@ -1100,19 +1336,25 @@ static void PrintCentered(char const *s, int width, char *pad)
/* Write a single line. */
/* */
/***************************************************************/
static int WriteOneCalLine(void)
static int WriteOneCalLine(int start_jul, int wd)
{
int done = 1, i;
int y, m, d;
gon();
DRAW(tb);
goff();
for (i=0; i<7; i++) {
FromJulian(start_jul+i, &y, &m, &d);
d -= wd;
if (CalColumn[i]) {
Backgroundize(ColToDay[i]);
if (WriteOneColLine(i)) done = 0;
} else {
Backgroundize(ColToDay[i]);
PrintCentered("", ColSpaces, " ");
}
UnBackgroundize(ColToDay[i]);
gon();
DRAW(tb);
goff();
@@ -1141,9 +1383,12 @@ static int WriteOneColLine(int col)
wchar_t const *wspace;
int width;
#endif
int clamp = 1;
int numwritten = 0;
int d = ColToDay[col];
if (d && UseBGVTColors && bgcolor[d][0] != -1) {
clamp = 0;
}
/* Print as many characters as possible within the column */
#ifdef REM_USE_WCHAR
if (e->wc_text) {
@@ -1186,7 +1431,7 @@ static int WriteOneColLine(int col)
/* Colorize reminder if necessary */
if (UseVTColors && e->is_color) {
ColorizeEntry(e);
ColorizeEntry(e, clamp);
}
/* If we couldn't find a space char, print what we have. */
@@ -1223,9 +1468,10 @@ static int WriteOneColLine(int col)
}
}
/* Decolorize reminder if necessary */
/* Decolorize reminder if necessary, but keep any SHADE */
if (UseVTColors && e->is_color) {
printf("%s", Decolorize(e->r, e->g, e->b));
printf("%s", Decolorize());
Backgroundize(d);
}
/* Possibly send lrm control sequence */
@@ -1278,7 +1524,7 @@ static int WriteOneColLine(int col)
/* Colorize reminder if necessary */
if (UseVTColors && e->is_color) {
ColorizeEntry(e);
ColorizeEntry(e, clamp);
}
/* If we couldn't find a space char, print what we have. */
@@ -1306,9 +1552,10 @@ static int WriteOneColLine(int col)
}
}
/* Decolorize reminder if necessary */
/* Decolorize reminder if necessary, but keep SHADE */
if (UseVTColors && e->is_color) {
printf("%s", Decolorize(e->r, e->g, e->b));
printf("%s", Decolorize());
Backgroundize(d);
}
/* Flesh out the rest of the column */
@@ -1402,6 +1649,7 @@ static void GenerateCalEntries(int col)
case T_Exit: DoExit(&p); break;
case T_Set: r=DoSet(&p); break;
case T_Fset: r=DoFset(&p); break;
case T_Funset: r=DoFunset(&p); break;
case T_UnSet: r=DoUnset(&p); break;
case T_Clr: r=DoClear(&p); break;
case T_Flush: r=DoFlush(&p); break;
@@ -1582,6 +1830,19 @@ static int DoCalRem(ParsePtr p, int col)
DBufFree(&buf);
}
trig.typ = tok.val;
if (trig.typ == MSG_TYPE ||
trig.typ == CAL_TYPE ||
trig.typ == MSF_TYPE) {
is_color = (
DefaultColorR != -1
&& DefaultColorG != -1
&& DefaultColorB != -1);
if (is_color) {
col_r = DefaultColorR;
col_g = DefaultColorG;
col_b = DefaultColorB;
}
}
jul = LastTriggerDate;
if (!LastTrigValid) {
FreeTrig(&trig);
@@ -1645,10 +1906,49 @@ static int DoCalRem(ParsePtr p, int col)
}
}
if (trig.typ == PASSTHRU_TYPE) {
if (!PsCal && StrCmpi(trig.passthru, "COLOR") && StrCmpi(trig.passthru, "COLOUR")) {
if (!PsCal && !StrCmpi(trig.passthru, "SHADE")) {
if (jul == JulianToday) {
DBufInit(&obuf);
r = DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE);
if (r) {
DBufFree(&obuf);
FreeTrig(&trig);
return r;
}
SetShadeEntry(jul, DBufValue(&obuf));
DBufFree(&obuf);
}
}
if (!PsCal && !StrCmpi(trig.passthru, "WEEK")) {
if (jul == JulianToday) {
DBufInit(&obuf);
r = DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE);
if (r) {
DBufFree(&obuf);
FreeTrig(&trig);
return r;
}
sscanf(DBufValue(&obuf), "%31[^\x01]", weeks[DayOf(jul)]);
DBufFree(&obuf);
}
}
if (!PsCal && StrCmpi(trig.passthru, "COLOR") && StrCmpi(trig.passthru, "COLOUR") && StrCmpi(trig.passthru, "MOON")) {
FreeTrig(&trig);
return OK;
}
if (!PsCal && !StrCmpi(trig.passthru, "MOON")) {
if (jul == JulianToday) {
DBufInit(&obuf);
r = DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE);
if (r) {
DBufFree(&obuf);
FreeTrig(&trig);
return r;
}
SetMoonEntry(jul, DBufValue(&obuf));
DBufFree(&obuf);
}
}
if (!StrCmpi(trig.passthru, "COLOR") ||
!StrCmpi(trig.passthru, "COLOUR")) {
is_color = 1;
@@ -1867,6 +2167,13 @@ static int DoCalRem(ParsePtr p, int col)
e->next = CurCol;
CalColumn[col] = e;
SortCol(&CalColumn[col]);
} else {
/* Parse the rest of the line to catch expression-pasting errors */
while (ParseChar(p, &r, 0)) {
if (r != 0) {
return r;
}
}
}
return OK;
}
@@ -1900,6 +2207,7 @@ static void WriteSimpleEntryProtocol1(CalEntry *e)
static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
{
int done = 0;
char const *s;
if (DoPrefixLineNo) {
PrintJSONKeyPairString("filename", e->filename);
PrintJSONKeyPairInt("lineno", e->lineno);
@@ -2026,6 +2334,45 @@ static void WriteSimpleEntryProtocol2(CalEntry *e, int today)
if (strcmp(e->raw_text, e->text)) {
PrintJSONKeyPairString("rawbody", e->raw_text);
}
/* Figure out calendar_body and plain_body */
if (DontSuppressQuoteMarkers) {
s = strstr(e->text, "%\"");
if (s) {
s += 2;
printf("\"calendar_body\":\"");
while (*s) {
if (*s == '%' && *(s+1) == '"') {
break;
}
PrintJSONChar(*s);
s++;
}
printf("\",");
}
}
s = strstr(e->text, "%\"");
if (s || e->is_color) {
printf("\"plain_body\":\"");
s = e->text;
if (e->is_color) {
while(*s && !isspace(*s)) s++;
while(*s && isspace(*s)) s++;
while(*s && !isspace(*s)) s++;
while(*s && isspace(*s)) s++;
while(*s && !isspace(*s)) s++;
while(*s && isspace(*s)) s++;
}
while(*s) {
if (*s == '%' && *(s+1) == '"') {
s += 2;
continue;
}
PrintJSONChar(*s);
s++;
}
printf("\",");
}
printf("\"body\":\"");
PrintJSONString(e->text);
printf("\"");
@@ -2238,14 +2585,14 @@ CalendarTime(int tim, int duration)
}
if (h >= 12) {
ampm1 = L_PM;
ampm1 = DynamicPm;
} else {
ampm1 = L_AM;
ampm1 = DynamicAm;
}
if (h2 >= 12) {
ampm2 = L_PM;
ampm2 = DynamicPm;
} else {
ampm2 = L_AM;
ampm2 = DynamicAm;
}
if (!days) {
if (!strcmp(ampm1, ampm2)) {
@@ -2292,7 +2639,7 @@ char const *SimpleTime(int tim)
if (h == 0) hh=12;
else if (h > 12) hh=h-12;
else hh=h;
sprintf(buf, "%d%c%02d%s ", hh, TimeSep, min, (h>=12) ? L_PM : L_AM);
sprintf(buf, "%d%c%02d%s ", hh, TimeSep, min, (h>=12) ? DynamicPm : DynamicAm);
}
break;

54
src/compare-language-mods.pl Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/perl
use strict;
use warnings;
my $language_map = {
en => 'ENGLISH',
de => 'GERMAN',
nl => 'DUTCH',
fi => 'FINNISH',
fr => 'FRENCH',
'no' => 'NORWEGIAN',
da => 'DANISH',
pl => 'POLISH',
is => 'ICELANDIC',
pt => 'BRAZPORT',
it => 'ITALIAN',
ro => 'ROMANIAN',
es => 'SPANISH',
};
if (!$ARGV[0]) {
print STDERR "Usage: $0 lang_code\n";
exit(1);
}
my $lang = $ARGV[0];
if (!exists($language_map->{$lang})) {
print STDERR "$lang is not a valid language.\n";
exit(1);
}
my $flag = $language_map->{$lang};
print STDERR "Testing for: $lang - $flag.\n";
my_sys("make clean > /dev/null 2>&1") && die("make clean failed");
my_sys("make -j6 all LANGDEF=-DLANG=$flag > /dev/null 2>&1") && die("make all failed");
my_sys("./remind -q -r ../tests/tstlang.rem 2022-03-23 11:44 > test-$lang-compiled.out 2>&1");
my_sys("make clean > /dev/null 2>&1") && die("make clean failed");
my_sys("make -j6 all > /dev/null 2>&1") && die("make all failed");
my_sys("./remind -q -r -ii=\\\"../include/lang/$lang.rem\\\" ../tests/tstlang.rem 2022-03-23 11:44 > test-$lang-runtime.out 2>&1");
my $rc = my_sys("cmp test-$lang-compiled.out test-$lang-runtime.out > /dev/null 2>&1");
if ($rc == 0) {
print STDERR "Congrats! Compiled and runtime language output matches for $lang.\n";
} else {
print STDERR "Whoops. Compiled and runtime language output differs for $lang.\n"
}
exit(0);
sub my_sys
{
#print STDERR "Running: " . join(' ', @_) . "\n";
return system(@_);
}

View File

@@ -6,7 +6,7 @@
/* which you can customize. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -21,8 +21,8 @@
/* The default values are initially set to the city hall in Ottawa, */
/* Ontario, Canada. */
/*---------------------------------------------------------------------*/
#define DEFAULT_LATITUDE 45.42055555555555
#define DEFAULT_LONGITUDE -75.68972222222223
#define DEFAULT_LATITUDE 45.420556
#define DEFAULT_LONGITUDE -75.689722
#define LOCATION "Ottawa"
/*---------------------------------------------------------------------*/

View File

@@ -6,7 +6,7 @@
/* which you can customize. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -21,8 +21,8 @@
/* The default values are initially set to the city hall in Ottawa, */
/* Ontario, Canada. */
/*---------------------------------------------------------------------*/
#define DEFAULT_LATITUDE 45.42055555555555
#define DEFAULT_LONGITUDE -75.68972222222223
#define DEFAULT_LATITUDE 45.420556
#define DEFAULT_LONGITUDE -75.689722
#define LOCATION "Ottawa"
/*---------------------------------------------------------------------*/

View File

@@ -7,7 +7,7 @@
/* commands. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -96,9 +96,13 @@ int DoRem(ParsePtr p)
FindToken(DBufValue(&buf), &tok);
DBufFree(&buf);
if (tok.type == T_Empty || tok.type == T_Comment) {
r = OK;
if (trig.addomit) {
r = AddGlobalOmit(LastTriggerDate);
}
DBufFree(&buf);
FreeTrig(&trig);
return OK;
return r;
}
if (tok.type != T_RemType || tok.val == SAT_TYPE) {
DBufFree(&buf);
@@ -168,27 +172,37 @@ int DoRem(ParsePtr p)
FreeTrig(&trig);
return OK;
}
/* Queue the reminder, if necessary */
/* Queue the reminder, if necessary */
if (jul == JulianToday &&
!(!IgnoreOnce &&
trig.once != NO_ONCE &&
FileAccessDate == JulianToday))
QueueReminder(p, &trig, &tim, trig.sched);
/* If we're in daemon mode, do nothing over here */
/* If we're in daemon mode, do nothing over here */
if (Daemon) {
FreeTrig(&trig);
return OK;
}
r = OK;
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
if ( (r=TriggerReminder(p, &trig, &tim, jul)) ) {
FreeTrig(&trig);
return r;
}
} else {
/* Parse the rest of the line to catch any potential
expression-pasting errors */
while (ParseChar(p, &r, 0)) {
if (r != 0) {
break;
}
}
}
FreeTrig(&trig);
return OK;
return r;
}
/***************************************************************/
@@ -460,7 +474,12 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
case T_Tag:
r = ParseToken(s, &buf);
if (r) return r;
if (strchr(DBufValue(&buf), ',')) {
DBufFree(&buf);
return E_PARSE_ERR;
}
AppendTag(&(trig->tags), DBufValue(&buf));
DBufFree(&buf);
break;
case T_Duration:
@@ -858,6 +877,8 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
}
}
}
/***************************************************************/
/* */
/* TriggerReminder */
@@ -919,12 +940,13 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
}
/* If it's a MSG-type reminder, and no -k option was used, issue the banner. */
if ((t->typ == MSG_TYPE || t->typ == MSF_TYPE)
&& !NumTriggered && !NextMode && !MsgCommand) {
&& !DidMsgReminder && !NextMode && !MsgCommand) {
DidMsgReminder = 1;
if (!DoSubstFromString(DBufValue(&Banner), &buf,
JulianToday, NO_TIME) &&
DBufLen(&buf)) {
printf("%s\n", DBufValue(&buf));
}
printf("%s\n", DBufValue(&buf));
}
DBufFree(&buf);
}
@@ -1020,7 +1042,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
if (!r) {
if (!DoCoerce(STR_TYPE, &v)) {
if (is_color) {
DBufPuts(&buf, Colorize(red, green, blue));
DBufPuts(&buf, Colorize(red, green, blue, 0, 1));
}
if (DBufPuts(&buf, v.v.str) != OK) {
DBufFree(&buf);
@@ -1034,7 +1056,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
}
if (is_color) {
DBufPuts(&buf, Colorize(red, green, blue));
DBufPuts(&buf, Colorize(red, green, blue, 0, 1));
}
if ( (r=DoSubst(p, &buf, t, tim, jul, NORMAL_MODE)) ) return r;
if (t->typ != RUN_TYPE) {
@@ -1045,7 +1067,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
if (!r) {
if (!DoCoerce(STR_TYPE, &v)) {
if (is_color) {
DBufPuts(&buf, Colorize(red, green, blue));
DBufPuts(&buf, Colorize(red, green, blue, 0, 1));
}
if (DBufPuts(&buf, v.v.str) != OK) {
DBufFree(&buf);
@@ -1059,7 +1081,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
}
if (is_color) {
DBufPuts(&buf, Decolorize(red, green, blue));
DBufPuts(&buf, Decolorize());
}
if ((!MsgCommand && t->typ == MSG_TYPE) || t->typ == MSF_TYPE) {

View File

@@ -6,11 +6,12 @@
/* reminders are triggered. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
#include "config.h"
#include "expr.h"
#define L_IN_DOSUBST
#include <stdio.h>
#include <string.h>
@@ -29,9 +30,6 @@
#define NL "\n"
#endif
static char TODAY[] = L_TODAY;
static char TOMORROW[] = L_TOMORROW;
#define SHIP_OUT(s) if(DBufPuts(dbuf, s) != OK) return E_NO_MEM
/***************************************************************/
@@ -53,15 +51,23 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
int d, m, y;
int tim = tt->ttime;
int h, min, hh, ch, cmin, chh;
int i;
char const *pm, *cpm;
int tdiff, adiff, mdiff, hdiff;
char const *mplu, *hplu, *when, *plu;
int has_quote = 0;
char *ss;
char const *expr;
char *os;
char s[256];
char uf[32];
char mypm[64];
char mycpm[64];
char myplu[64];
int origLen = DBufLen(dbuf);
int altmode;
int r;
Value v;
FromJulian(jul, &y, &m, &d);
@@ -74,16 +80,16 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_MPLU_OVER
L_MPLU_OVER
#else /* L_MPLU_OVER */
mplu = (mdiff == 1 ? "" : L_MPLU);
mplu = (mdiff == 1 ? "" : DynamicMplu);
#endif /* L_MPLU_OVER */
#ifdef L_HPLU_OVER
L_HPLU_OVER
#else /* L_HPLU_OVER */
hplu = (hdiff == 1 ? "" : L_HPLU);
hplu = (hdiff == 1 ? "" : DynamicHplu);
#endif /* L_HPLU_OVER */
when = (tdiff < 0 ? L_AGO : L_FROMNOW);
when = (tdiff < 0) ? DynamicAgo : DynamicFromnow;
h = tim / 60;
min = tim % 60;
@@ -91,7 +97,26 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_AMPM_OVERRIDE
L_AMPM_OVERRIDE (pm, h)
#else
pm = (h < 12) ? L_AM : L_PM;
r = -1;
if (UserFuncExists("subst_ampm") == 1) {
snprintf(s, sizeof(s), "subst_ampm(%d)", h);
expr = (char const *) s;
r = EvalExpr(&expr, &v, NULL);
if (r == OK) {
if (!DoCoerce(STR_TYPE, &v)) {
snprintf(mypm, sizeof(mypm), "%s", v.v.str);
pm = mypm;
} else {
r = -1;
}
DestroyValue(v);
} else {
Eprint("%s", ErrMsg[r]);
}
}
if (r != OK) {
pm = (h < 12) ? DynamicAm : DynamicPm;
}
#endif
hh = (h == 12) ? 12 : h % 12;
@@ -101,25 +126,60 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_AMPM_OVERRIDE
L_AMPM_OVERRIDE (cpm, ch)
#else
cpm = (ch < 12) ? L_AM : L_PM;
r = -1;
if (UserFuncExists("subst_ampm") == 1) {
snprintf(s, sizeof(s), "subst_ampm(%d)", ch);
expr = (char const *) s;
r = EvalExpr(&expr, &v, NULL);
if (r == OK) {
if (!DoCoerce(STR_TYPE, &v)) {
snprintf(mycpm, sizeof(mycpm), "%s", v.v.str);
cpm = mycpm;
} else {
r = -1;
}
} else {
Eprint("%s", ErrMsg[r]);
}
}
if (r != OK) {
cpm = (h < 12) ? DynamicAm : DynamicPm;
}
#endif
chh = (ch == 12) ? 12 : ch % 12;
#ifdef L_ORDINAL_OVERRIDE
L_ORDINAL_OVERRIDE
L_ORDINAL_OVERRIDE;
#else
switch(d) {
case 1:
case 21:
case 31: plu = "st"; break;
if (UserFuncExists("subst_ordinal") == 1) {
snprintf(s, sizeof(s), "subst_ordinal(%d)", d);
expr = (char const *) s;
r = EvalExpr(&expr, &v, NULL);
if (r == OK) {
if (!DoCoerce(STR_TYPE, &v)) {
snprintf(myplu, sizeof(myplu), "%s", v.v.str);
plu = myplu;
} else {
r = -1;
}
} else {
Eprint("%s", ErrMsg[r]);
}
}
if (r != OK) {
switch(d) {
case 1:
case 21:
case 31: plu = "st"; break;
case 2:
case 22: plu = "nd"; break;
case 2:
case 22: plu = "nd"; break;
case 3:
case 23: plu = "rd"; break;
case 3:
case 23: plu = "rd"; break;
default: plu = "th"; break;
default: plu = "th"; break;
}
}
#endif
@@ -131,8 +191,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
}
if (c == '\n') continue;
if (!c) {
if (mode != CAL_MODE && mode != ADVANCE_MODE &&
t->typ != RUN_TYPE && !MsgCommand) {
if (AddBlankLines &&
mode != CAL_MODE &&
mode != ADVANCE_MODE &&
t->typ != RUN_TYPE &&
!MsgCommand) {
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
}
break;
@@ -162,7 +225,69 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
break;
}
}
if (c == '{') {
i = 0;
ss = s + snprintf(s, sizeof(s), "subst_");
while (1) {
c = ParseChar(p, &err, 0);
if (err) {
DBufFree(dbuf);
return err;
}
if (c == '}' || !c) {
break;
}
if (i < 64) {
*ss++ = c;
*ss = 0;
i++;
}
}
if (!c) {
Wprint("Warning: Unterminated %%{...} substitution sequence");
}
if (UserFuncExists(s) != 3) {
continue;
}
snprintf(ss, sizeof(s) - (ss-s), "(%d,'%04d-%02d-%02d',%02d:%02d)",
altmode ? 1 : 0, y, m+1, d, h, min);
expr = (char const *) s;
r = EvalExpr(&expr, &v, NULL);
if (r == OK) {
if (!DoCoerce(STR_TYPE, &v)) {
if (DBufPuts(dbuf, v.v.str) != OK) {
DestroyValue(v);
return E_NO_MEM;
}
}
DestroyValue(v);
}
continue;
}
done = 0;
snprintf(uf, sizeof(uf), "subst_%c", c);
if (UserFuncExists(uf) == 3) {
snprintf(s, sizeof(s), "subst_%c(%d,'%04d-%02d-%02d',%02d:%02d)",
c, altmode ? 1 : 0, y, m+1, d, h, min);
expr = (char const *) s;
r = EvalExpr(&expr, &v, NULL);
if (r == OK) {
if (v.type != INT_TYPE || v.v.val != 0) {
if (!DoCoerce(STR_TYPE, &v)) {
if (DBufPuts(dbuf, v.v.str) != OK) {
DestroyValue(v);
return E_NO_MEM;
}
}
DestroyValue(v);
continue;
}
DestroyValue(v);
} else {
Eprint("%s", ErrMsg[r]);
}
}
if (diff <= 1) {
switch(UPPER(c)) {
#ifndef L_NOTOMORROW_A
@@ -204,7 +329,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifndef L_NOTOMORROW_V
case 'V':
#endif
sprintf(s, "%s", (diff ? TOMORROW : TODAY));
snprintf(s, sizeof(s), "%s", (diff ? DynamicTomorrow: DynamicToday));
SHIP_OUT(s);
done = 1;
break;
@@ -213,16 +338,42 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
}
}
if (!done) {
snprintf(uf, sizeof(uf), "subst_%cx", c);
if (UserFuncExists(uf) == 3) {
snprintf(s, sizeof(s), "subst_%cx(%d,'%04d-%02d-%02d',%02d:%02d)",
c, altmode ? 1 : 0, y, m+1, d, h, min);
expr = (char const *) s;
r = EvalExpr(&expr, &v, NULL);
if (r == OK) {
if (v.type != INT_TYPE || v.v.val != 0) {
if (!DoCoerce(STR_TYPE, &v)) {
if (DBufPuts(dbuf, v.v.str) != OK) {
DestroyValue(v);
return E_NO_MEM;
}
}
DestroyValue(v);
continue;
}
DestroyValue(v);
} else {
Eprint("%s", ErrMsg[r]);
}
}
}
if (!done) switch(UPPER(c)) {
case 'A':
#ifdef L_A_OVER
L_A_OVER
#else
if (altmode == '*') {
sprintf(s, "%s, %d %s, %d", get_day_name(jul%7), d,
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s, %d %s, %d", get_day_name(jul%7), d,
get_month_name(m), y);
} else {
sprintf(s, "%s %s, %d %s, %d", L_ON, get_day_name(jul%7), d,
snprintf(s, sizeof(s), "%s %s, %d %s, %d", DynamicOn, get_day_name(jul%7), d,
get_month_name(m), y);
}
#endif
@@ -233,7 +384,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_B_OVER
L_B_OVER
#else
sprintf(s, L_INXDAYS, diff);
snprintf(s, sizeof(s), L_INXDAYS, diff);
#endif
SHIP_OUT(s);
break;
@@ -242,10 +393,10 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_C_OVER
L_C_OVER
#else
if (altmode == '*') {
sprintf(s, "%s", get_day_name(jul%7));
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s", get_day_name(jul%7));
} else {
sprintf(s, "%s %s", L_ON, get_day_name(jul%7));
snprintf(s, sizeof(s), "%s %s", DynamicOn, get_day_name(jul%7));
}
#endif
SHIP_OUT(s);
@@ -255,7 +406,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_D_OVER
L_D_OVER
#else
sprintf(s, "%d", d);
snprintf(s, sizeof(s), "%d", d);
#endif
SHIP_OUT(s);
break;
@@ -264,11 +415,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_E_OVER
L_E_OVER
#else
if (altmode == '*') {
sprintf(s, "%02d%c%02d%c%04d", d, DateSep,
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%02d%c%02d%c%04d", d, DateSep,
m+1, DateSep, y);
} else {
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
snprintf(s, sizeof(s), "%s %02d%c%02d%c%04d", DynamicOn, d, DateSep,
m+1, DateSep, y);
}
#endif
@@ -279,10 +430,10 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_F_OVER
L_F_OVER
#else
if (altmode == '*') {
sprintf(s, "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
} else {
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
snprintf(s, sizeof(s), "%s %02d%c%02d%c%04d", DynamicOn, m+1, DateSep, d, DateSep, y);
}
#endif
SHIP_OUT(s);
@@ -292,10 +443,10 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_G_OVER
L_G_OVER
#else
if (altmode == '*') {
sprintf(s, "%s, %d %s", get_day_name(jul%7), d, get_month_name(m));
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s, %d %s", get_day_name(jul%7), d, get_month_name(m));
} else {
sprintf(s, "%s %s, %d %s", L_ON, get_day_name(jul%7), d, get_month_name(m));
snprintf(s, sizeof(s), "%s %s, %d %s", DynamicOn, get_day_name(jul%7), d, get_month_name(m));
}
#endif
SHIP_OUT(s);
@@ -305,10 +456,10 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_H_OVER
L_H_OVER
#else
if (altmode == '*') {
sprintf(s, "%02d%c%02d", d, DateSep, m+1);
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%02d%c%02d", d, DateSep, m+1);
} else {
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicOn, d, DateSep, m+1);
}
#endif
SHIP_OUT(s);
@@ -318,10 +469,10 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_I_OVER
L_I_OVER
#else
if (altmode == '*') {
sprintf(s, "%02d%c%02d", m+1, DateSep, d);
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%02d%c%02d", m+1, DateSep, d);
} else {
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicOn, m+1, DateSep, d);
}
#endif
SHIP_OUT(s);
@@ -331,11 +482,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_J_OVER
L_J_OVER
#else
if (altmode == '*') {
sprintf(s, "%s, %s %d%s, %d", get_day_name(jul%7),
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s, %s %d%s, %d", get_day_name(jul%7),
get_month_name(m), d, plu, y);
} else {
sprintf(s, "%s %s, %s %d%s, %d", L_ON, get_day_name(jul%7),
snprintf(s, sizeof(s), "%s %s, %s %d%s, %d", DynamicOn, get_day_name(jul%7),
get_month_name(m), d, plu, y);
}
#endif
@@ -346,11 +497,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_K_OVER
L_K_OVER
#else
if (altmode == '*') {
sprintf(s, "%s, %s %d%s", get_day_name(jul%7),
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s, %s %d%s", get_day_name(jul%7),
get_month_name(m), d, plu);
} else {
sprintf(s, "%s %s, %s %d%s", L_ON, get_day_name(jul%7),
snprintf(s, sizeof(s), "%s %s, %s %d%s", DynamicOn, get_day_name(jul%7),
get_month_name(m), d, plu);
}
#endif
@@ -361,10 +512,10 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_L_OVER
L_L_OVER
#else
if (altmode == '*') {
sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
} else {
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
snprintf(s, sizeof(s), "%s %04d%c%02d%c%02d", DynamicOn, y, DateSep, m+1, DateSep, d);
}
#endif
SHIP_OUT(s);
@@ -374,7 +525,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_M_OVER
L_M_OVER
#else
sprintf(s, "%s", get_month_name(m));
snprintf(s, sizeof(s), "%s", get_month_name(m));
#endif
SHIP_OUT(s);
break;
@@ -383,7 +534,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_N_OVER
L_N_OVER
#else
sprintf(s, "%d", m+1);
snprintf(s, sizeof(s), "%d", m+1);
#endif
SHIP_OUT(s);
break;
@@ -392,7 +543,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_O_OVER
L_O_OVER
#else
if (RealToday == JulianToday) sprintf(s, " (%s)", L_TODAY);
if (RealToday == JulianToday) snprintf(s, sizeof(s), " (%s)", DynamicToday);
else *s = 0;
#endif
SHIP_OUT(s);
@@ -402,7 +553,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_P_OVER
L_P_OVER
#else
sprintf(s, "%s", (diff == 1 ? "" : L_PLURAL));
snprintf(s, sizeof(s), "%s", (diff == 1 ? "" : L_PLURAL));
#endif
SHIP_OUT(s);
break;
@@ -411,7 +562,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_Q_OVER
L_Q_OVER
#else
sprintf(s, "%s", (diff == 1 ? "'s" : "s'"));
snprintf(s, sizeof(s), "%s", (diff == 1 ? "'s" : "s'"));
#endif
SHIP_OUT(s);
break;
@@ -420,7 +571,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_R_OVER
L_R_OVER
#else
sprintf(s, "%02d", d);
snprintf(s, sizeof(s), "%02d", d);
#endif
SHIP_OUT(s);
break;
@@ -429,7 +580,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_S_OVER
L_S_OVER
#else
sprintf(s, "%s", plu);
snprintf(s, sizeof(s), "%s", plu);
#endif
SHIP_OUT(s);
break;
@@ -438,7 +589,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_T_OVER
L_T_OVER
#else
sprintf(s, "%02d", m+1);
snprintf(s, sizeof(s), "%02d", m+1);
#endif
SHIP_OUT(s);
break;
@@ -447,11 +598,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_U_OVER
L_U_OVER
#else
if (altmode == '*') {
sprintf(s, "%s, %d%s %s, %d", get_day_name(jul%7), d,
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s, %d%s %s, %d", get_day_name(jul%7), d,
plu, get_month_name(m), y);
} else {
sprintf(s, "%s %s, %d%s %s, %d", L_ON, get_day_name(jul%7), d,
snprintf(s, sizeof(s), "%s %s, %d%s %s, %d", DynamicOn, get_day_name(jul%7), d,
plu, get_month_name(m), y);
}
#endif
@@ -462,11 +613,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_V_OVER
L_V_OVER
#else
if (altmode == '*') {
sprintf(s, "%s, %d%s %s", get_day_name(jul%7), d, plu,
if (altmode == '*' || !strcmp(DynamicOn, "")) {
snprintf(s, sizeof(s), "%s, %d%s %s", get_day_name(jul%7), d, plu,
get_month_name(m));
} else {
sprintf(s, "%s %s, %d%s %s", L_ON, get_day_name(jul%7), d, plu,
snprintf(s, sizeof(s), "%s %s, %d%s %s", DynamicOn, get_day_name(jul%7), d, plu,
get_month_name(m));
}
#endif
@@ -477,7 +628,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_W_OVER
L_W_OVER
#else
sprintf(s, "%s", get_day_name(jul%7));
snprintf(s, sizeof(s), "%s", get_day_name(jul%7));
#endif
SHIP_OUT(s);
break;
@@ -486,7 +637,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_X_OVER
L_X_OVER
#else
sprintf(s, "%d", diff);
snprintf(s, sizeof(s), "%d", diff);
#endif
SHIP_OUT(s);
break;
@@ -495,7 +646,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_Y_OVER
L_Y_OVER
#else
sprintf(s, "%d", y);
snprintf(s, sizeof(s), "%d", y);
#endif
SHIP_OUT(s);
break;
@@ -504,7 +655,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_Z_OVER
L_Z_OVER
#else
sprintf(s, "%d", y % 100);
snprintf(s, sizeof(s), "%d", y % 100);
#endif
SHIP_OUT(s);
break;
@@ -514,14 +665,14 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
L_1_OVER
#else
if (tdiff == 0)
sprintf(s, "%s", L_NOW);
snprintf(s, sizeof(s), "%s", DynamicNow);
else if (hdiff == 0)
sprintf(s, "%d %s%s %s", mdiff, L_MINUTE, mplu, when);
snprintf(s, sizeof(s), "%d %s%s %s", mdiff, DynamicMinute, mplu, when);
else if (mdiff == 0)
sprintf(s, "%d %s%s %s", hdiff, L_HOUR, hplu, when);
snprintf(s, sizeof(s), "%d %s%s %s", hdiff, DynamicHour, hplu, when);
else
sprintf(s, "%d %s%s %s %d %s%s %s", hdiff, L_HOUR, hplu,
L_AND, mdiff, L_MINUTE, mplu, when);
snprintf(s, sizeof(s), "%d %s%s %s %d %s%s %s", hdiff, DynamicHour, hplu,
DynamicAnd, mdiff, DynamicMinute, mplu, when);
#endif
SHIP_OUT(s);
break;
@@ -531,9 +682,9 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
L_2_OVER
#else
if (altmode == '*') {
sprintf(s, "%d%c%02d%s", hh, TimeSep, min, pm);
snprintf(s, sizeof(s), "%d%c%02d%s", hh, TimeSep, min, pm);
} else {
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
snprintf(s, sizeof(s), "%s %d%c%02d%s", DynamicAt, hh, TimeSep, min, pm);
}
#endif
SHIP_OUT(s);
@@ -545,9 +696,9 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#else
if (altmode == '*') {
sprintf(s, "%02d%c%02d", h, TimeSep, min);
snprintf(s, sizeof(s), "%02d%c%02d", h, TimeSep, min);
} else {
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
snprintf(s, sizeof(s), "%s %02d%c%02d", DynamicAt, h, TimeSep, min);
}
#endif
SHIP_OUT(s);
@@ -557,7 +708,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_4_OVER
L_4_OVER
#else
sprintf(s, "%d", tdiff);
snprintf(s, sizeof(s), "%d", tdiff);
#endif
SHIP_OUT(s);
break;
@@ -566,7 +717,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_5_OVER
L_5_OVER
#else
sprintf(s, "%d", adiff);
snprintf(s, sizeof(s), "%d", adiff);
#endif
SHIP_OUT(s);
break;
@@ -575,7 +726,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_6_OVER
L_6_OVER
#else
sprintf(s, "%s", when);
snprintf(s, sizeof(s), "%s", when);
#endif
SHIP_OUT(s);
break;
@@ -584,7 +735,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_7_OVER
L_7_OVER
#else
sprintf(s, "%d", hdiff);
snprintf(s, sizeof(s), "%d", hdiff);
#endif
SHIP_OUT(s);
break;
@@ -593,7 +744,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_8_OVER
L_8_OVER
#else
sprintf(s, "%d", mdiff);
snprintf(s, sizeof(s), "%d", mdiff);
#endif
SHIP_OUT(s);
break;
@@ -602,7 +753,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_9_OVER
L_9_OVER
#else
sprintf(s, "%s", mplu);
snprintf(s, sizeof(s), "%s", mplu);
#endif
SHIP_OUT(s);
break;
@@ -611,7 +762,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_0_OVER
L_0_OVER
#else
sprintf(s, "%s", hplu);
snprintf(s, sizeof(s), "%s", hplu);
#endif
SHIP_OUT(s);
break;
@@ -620,7 +771,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_BANG_OVER
L_BANG_OVER
#else
sprintf(s, "%s", (tdiff >= 0 ? L_IS : L_WAS));
snprintf(s, sizeof(s), "%s", (tdiff >= 0 ? DynamicIs : DynamicWas));
#endif
SHIP_OUT(s);
break;
@@ -629,7 +780,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_AT_OVER
L_AT_OVER
#else
sprintf(s, "%d%c%02d%s", chh, TimeSep, cmin, cpm);
snprintf(s, sizeof(s), "%d%c%02d%s", chh, TimeSep, cmin, cpm);
#endif
SHIP_OUT(s);
break;
@@ -638,16 +789,16 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_HASH_OVER
L_HASH_OVER
#else
sprintf(s, "%02d%c%02d", ch, TimeSep, cmin);
snprintf(s, sizeof(s), "%02d%c%02d", ch, TimeSep, cmin);
#endif
SHIP_OUT(s);
break;
case '_':
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)) {
sprintf(s, "%s", NL);
snprintf(s, sizeof(s), "%s", NL);
} else {
sprintf(s, " ");
snprintf(s, sizeof(s), " ");
}
SHIP_OUT(s);
break;
@@ -657,8 +808,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
break;
case '"':
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
has_quote = 1;
if (DontSuppressQuoteMarkers) {
if (DBufPutc(dbuf, '%') != OK) return E_NO_MEM;
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
} else {
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
has_quote = 1;
}
break;
default:

View File

@@ -6,7 +6,7 @@
/* buffers. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -5,7 +5,7 @@
/* Declaration of functions for manipulating dynamic buffers */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -31,6 +31,8 @@ int DBufGets(DynamicBuffer *dbuf, FILE *fp);
#define DBufValue(bufPtr) ((bufPtr)->buffer)
#define DBufLen(bufPtr) ((bufPtr)->len)
#define DBufPutc(dbuf, c) ( (dbuf)->allocatedLen < (dbuf)->len+1 ) ? (dbuf)->buffer[(dbuf)->len++] = c, (dbuf)->buffer[(dbuf)->len] = 0, OK : DBufPutcFN((dbuf), c)
#define DBufPutc(dbuf, c) ( ( (dbuf)->allocatedLen <= (dbuf)->len+1 ) ? \
DBufPutcFN( (dbuf), c) : \
( (dbuf)->buffer[(dbuf)->len++] = c, (dbuf)->buffer[(dbuf)->len] = 0, OK) )
#endif /* DYNBUF_H */

View File

@@ -5,7 +5,7 @@
/* Error definitions. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -70,7 +70,7 @@
#define E_MON_TWICE 51
#define E_DAY_TWICE 52
#define E_UNKNOWN_TOKEN 53
#define E_SPEC_MON_DAY 54
#define E_SPEC_MON 54
#define E_2MANY_PART 55
#define E_2MANY_FULL 56
#define E_PUSH_NOPOP 57
@@ -187,7 +187,7 @@ EXTERN char *ErrMsg[]
"Month specified twice",
"Day specified twice",
"Unknown token",
"Must specify month and day in OMIT command",
"Must specify month in OMIT command",
"Too many partial OMITs",
"Too many full OMITs",
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",

View File

@@ -5,7 +5,7 @@
/* This file contains routines to parse and evaluate */
/* expressions. */
/* */
/* Copyright 1992-2021 by Dianne Skoll */
/* Copyright 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -84,10 +84,12 @@ Operator UnOp[] = {
extern BuiltinFunc Func[];
Operator OpStack[OP_STACK_SIZE];
Value ValStack[VAL_STACK_SIZE];
int OpStackPtr = 0;
int ValStackPtr = 0;
static Operator OpStack[OP_STACK_SIZE];
static int OpStackPtr = 0;
/* ValStack can't be static - needed by funcs.c */
Value ValStack[VAL_STACK_SIZE];
int ValStackPtr = 0;
/***************************************************************/
/* */
@@ -251,6 +253,10 @@ static int ParseExprToken(DynamicBuffer *buf, char const **in)
DBufFree(buf);
return E_NO_MEM;
}
if (!**in) {
DBufFree(buf);
return E_MISS_QUOTE;
}
continue;
}
c = *(*in)++;
@@ -783,12 +789,11 @@ static int Add(void)
/* If both are ints, just add 'em */
if (v2.type == INT_TYPE && v1.type == INT_TYPE) {
int old = v1.v.val;
v1.v.val += v2.v.val;
/* Check for overflow */
if (_private_add_overflow(v1.v.val, v2.v.val, old)) {
if (_private_add_overflow(v1.v.val, v2.v.val)) {
return E_2HIGH;
}
v1.v.val += v2.v.val;
PushValStack(v1);
return OK;
}
@@ -796,9 +801,8 @@ static int Add(void)
/* If it's a date plus an int, add 'em */
if ((v1.type == DATE_TYPE && v2.type == INT_TYPE) ||
(v1.type == INT_TYPE && v2.type == DATE_TYPE)) {
int old = v1.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val)) return E_DATE_OVER;
v1.v.val += v2.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
v1.type = DATE_TYPE;
PushValStack(v1);
@@ -808,9 +812,8 @@ static int Add(void)
/* If it's a datetime plus an int or a time, add 'em */
if ((v1.type == DATETIME_TYPE && (v2.type == INT_TYPE || v2.type == TIME_TYPE)) ||
((v1.type == INT_TYPE || v1.type == TIME_TYPE) && v2.type == DATETIME_TYPE)) {
int old = v1.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val)) return E_DATE_OVER;
v1.v.val += v2.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
v1.type = DATETIME_TYPE;
PushValStack(v1);
@@ -822,9 +825,8 @@ static int Add(void)
if ((v1.type == TIME_TYPE && v2.type == INT_TYPE) ||
(v1.type == INT_TYPE && v2.type == TIME_TYPE) ||
(v1.type == TIME_TYPE && v2.type == TIME_TYPE)) {
int old = v1.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val)) return E_DATE_OVER;
v1.v.val += v2.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
v1.v.val = v1.v.val % MINUTES_PER_DAY;
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
v1.type = TIME_TYPE;
@@ -885,18 +887,16 @@ static int Subtract(void)
/* If they're both INTs, do subtraction */
if (v1.type == INT_TYPE && v2.type == INT_TYPE) {
int old = v1.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val)) return E_2HIGH;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_2HIGH;
PushValStack(v1);
return OK;
}
/* If it's a date minus an int, do subtraction, checking for underflow */
if (v1.type == DATE_TYPE && v2.type == INT_TYPE) {
int old = v1.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val)) return E_DATE_OVER;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
PushValStack(v1);
return OK;
@@ -905,9 +905,8 @@ static int Subtract(void)
/* If it's a datetime minus an int or a time, do subtraction,
* checking for underflow */
if (v1.type == DATETIME_TYPE && (v2.type == INT_TYPE || v2.type == TIME_TYPE)) {
int old = v1.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val)) return E_DATE_OVER;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
PushValStack(v1);
return OK;
@@ -925,9 +924,8 @@ static int Subtract(void)
if ((v1.type == TIME_TYPE && v2.type == TIME_TYPE) ||
(v1.type == DATETIME_TYPE && v2.type == DATETIME_TYPE) ||
(v1.type == DATE_TYPE && v2.type == DATE_TYPE)) {
int old = v1.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val)) return E_DATE_OVER;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
v1.type = INT_TYPE;
PushValStack(v1);
return OK;
@@ -962,11 +960,8 @@ static int Multiply(void)
(v1.v.val == -1 && v2.v.val == INT_MIN)) {
return E_2HIGH;
}
int old = v1.v.val;
if (_private_mul_overflow(v1.v.val, v2.v.val)) return E_2HIGH;
v1.v.val *= v2.v.val;
if (v2.v.val != 0) {
if (_private_div(v1.v.val, v2.v.val) != old) return E_2HIGH;
}
PushValStack(v1);
return OK;
}
@@ -1177,9 +1172,8 @@ static int UnMinus(void)
{
Value *v = &ValStack[ValStackPtr-1];
if (v->type != INT_TYPE) return E_BAD_TYPE;
int old = v->v.val;
if (v->v.val == INT_MIN) return E_2HIGH;
v->v.val = -v->v.val;
if (_private_unminus_overflow(old, v->v.val)) return E_2HIGH;
return OK;
}
@@ -1200,9 +1194,9 @@ static int LogNot(void)
/***************************************************************/
/* */
/* FindFunc */
/* FindOperator */
/* */
/* Find a function. */
/* Find an operator. */
/* */
/***************************************************************/
Operator *FindOperator(char const *name, Operator where[], int num)
@@ -1211,7 +1205,7 @@ Operator *FindOperator(char const *name, Operator where[], int num)
int mid, r;
while (top >= bot) {
mid = (top + bot) / 2;
r = StrCmpi(name, where[mid].name);
r = strcmp(name, where[mid].name);
if (!r) return &where[mid];
else if (r > 0) bot = mid+1;
else top = mid-1;
@@ -1219,6 +1213,20 @@ Operator *FindOperator(char const *name, Operator where[], int num)
return NULL;
}
/* Compare two strings case-insensitively, where we KNOW
that the second string is definitely lower-case */
static int strcmp_lcfirst(char const *s1, char const *s2)
{
int r;
while (*s1 && *s2) {
r = tolower(*s1) - *s2;
if (r) return r;
s1++;
s2++;
}
return tolower(*s1) - *s2;
}
/***************************************************************/
/* */
/* FindFunc */
@@ -1232,7 +1240,7 @@ BuiltinFunc *FindFunc(char const *name, BuiltinFunc where[], int num)
int mid, r;
while (top >= bot) {
mid = (top + bot) / 2;
r = StrCmpi(name, where[mid].name);
r = strcmp_lcfirst(name, where[mid].name);
if (!r) return &where[mid];
else if (r > 0) bot = mid+1;
else top = mid-1;
@@ -1250,12 +1258,31 @@ BuiltinFunc *FindFunc(char const *name, BuiltinFunc where[], int num)
void PrintValue (Value *v, FILE *fp)
{
int y, m, d;
char const *s;
unsigned char const *s;
if (v->type == STR_TYPE) {
s=v->v.str;
s = (unsigned char const *) v->v.str;
putc('"', fp);
for (y=0; y<MAX_PRT_LEN && *s; y++) putc(*s++, fp);
for (y=0; y<MAX_PRT_LEN && *s; y++) {
switch(*s) {
case '\a': fprintf(ErrFp, "\\a"); break;
case '\b': fprintf(ErrFp, "\\b"); break;
case '\f': fprintf(ErrFp, "\\f"); break;
case '\n': fprintf(ErrFp, "\\n"); break;
case '\r': fprintf(ErrFp, "\\r"); break;
case '\t': fprintf(ErrFp, "\\t"); break;
case '\v': fprintf(ErrFp, "\\v"); break;
case '"': fprintf(ErrFp, "\\\""); break;
case '\\': fprintf(ErrFp, "\\\\"); break;
default:
if (*s < 32) {
fprintf(ErrFp, "\\x%02x", (unsigned int) *s);
} else {
putc(*s, ErrFp); break;
}
}
s++;
}
putc('"',fp);
if (*s) fprintf(fp, "...");
}

View File

@@ -5,7 +5,7 @@
/* Contains a few definitions used by expression evaluator. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -58,7 +58,7 @@ else \
in various arithmetic operators. They have to be in separate
functions with extern linkage to defeat compiler optimizations
that would otherwise break the overflow checks. */
extern int _private_div(int a, int b);
extern int _private_add_overflow(int result, int b, int old);
extern int _private_sub_overflow(int result, int b, int old);
extern int _private_unminus_overflow(int a, int b);
extern int _private_mul_overflow(int a, int b);
extern int _private_add_overflow(int a, int b);
extern int _private_sub_overflow(int a, int b);

View File

@@ -7,7 +7,7 @@
/* files. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -163,6 +163,7 @@ int ReadLine(void)
LineNo = CLine->LineNo;
CLine = CLine->next;
FreshLine = 1;
clear_callstack();
if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
return OK;
}
@@ -263,6 +264,7 @@ static int ReadLineFromFile(int use_pclose)
}
FreshLine = 1;
clear_callstack();
if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
return OK;
}
@@ -818,6 +820,7 @@ static int IncludeCmd(char const *cmd)
int old_flag;
FreshLine = 1;
clear_callstack();
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
i = &IStack[IStackPtr];
@@ -935,6 +938,7 @@ int IncludeFile(char const *fname)
struct stat statbuf;
FreshLine = 1;
clear_callstack();
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
i = &IStack[IStackPtr];

View File

@@ -6,19 +6,26 @@
/* expressions. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
#include "version.h"
#include "config.h"
#ifdef REM_USE_WCHAR
#define _XOPEN_SOURCE 600
#include <wctype.h>
#include <wchar.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -58,6 +65,7 @@ static int FADusk (func_info *);
static int FAbs (func_info *);
static int FAccess (func_info *);
static int FAmpm (func_info *);
static int FAnsicolor (func_info *);
static int FTrig (func_info *);
static int FIsAny (func_info *);
static int FArgs (func_info *);
@@ -66,6 +74,7 @@ static int FBaseyr (func_info *);
static int FChar (func_info *);
static int FChoose (func_info *);
static int FCoerce (func_info *);
static int FColumns (func_info *);
static int FCurrent (func_info *);
static int FDate (func_info *);
static int FDateTime (func_info *);
@@ -94,6 +103,7 @@ static int FIsdst (func_info *);
static int FIsleap (func_info *);
static int FIsomitted (func_info *);
static int FLanguage (func_info *);
static int FLocalToUTC (func_info *);
static int FLower (func_info *);
static int FMax (func_info *);
static int FMin (func_info *);
@@ -111,21 +121,25 @@ static int FNonomitted (func_info *);
static int FNow (func_info *);
static int FOrd (func_info *);
static int FOstype (func_info *);
static int FPad (func_info *);
static int FPlural (func_info *);
static int FPsmoon (func_info *);
static int FPsshade (func_info *);
static int FRealCurrent (func_info *);
static int FRealnow (func_info *);
static int FRealtoday (func_info *);
static int FRows (func_info *);
static int FSgn (func_info *);
static int FShell (func_info *);
static int FSlide (func_info *);
static int FStdout (func_info *);
static int FStrlen (func_info *);
static int FSubstr (func_info *);
static int FSunrise (func_info *);
static int FSunset (func_info *);
static int FTime (func_info *);
static int FTimepart (func_info *);
static int FTimezone (func_info *);
static int FToday (func_info *);
static int FTrig (func_info *);
static int FTrigback (func_info *);
@@ -138,6 +152,7 @@ static int FTrigeventstart (func_info *);
static int FTrigfrom (func_info *);
static int FTrigger (func_info *);
static int FTrigpriority (func_info *);
static int FTrigtags (func_info *);
static int FTrigrep (func_info *);
static int FTrigscanfrom (func_info *);
static int FTrigtime (func_info *);
@@ -148,6 +163,7 @@ static int FTrigvalid (func_info *);
static int FTypeof (func_info *);
static int FTzconvert (func_info *);
static int FUpper (func_info *);
static int FUTCToLocal (func_info *);
static int FValue (func_info *);
static int FVersion (func_info *);
static int FWeekno (func_info *);
@@ -159,6 +175,7 @@ static int FShellescape (func_info *);
static int CleanUpAfterFunc (func_info *);
static int CheckArgs (BuiltinFunc *f, int nargs);
static int SunStuff (int rise, double cosz, int jul);
static int tz_set_tz (char const *tz);
/* "Overload" the struct Operator definition */
#define NO_MAX 127
@@ -212,12 +229,14 @@ BuiltinFunc Func[] = {
{ "adawn", 0, 1, 0, FADawn},
{ "adusk", 0, 1, 0, FADusk},
{ "ampm", 1, 3, 1, FAmpm },
{ "ansicolor", 1, 5, 1, FAnsicolor },
{ "args", 1, 1, 0, FArgs },
{ "asc", 1, 1, 1, FAsc },
{ "baseyr", 0, 0, 1, FBaseyr },
{ "char", 1, NO_MAX, 1, FChar },
{ "choose", 2, NO_MAX, 1, FChoose },
{ "coerce", 2, 2, 1, FCoerce },
{ "columns", 0, 1, 0, FColumns },
{ "current", 0, 0, 0, FCurrent },
{ "date", 3, 3, 1, FDate },
{ "datepart", 1, 1, 1, FDatepart },
@@ -247,6 +266,7 @@ BuiltinFunc Func[] = {
{ "isleap", 1, 1, 1, FIsleap },
{ "isomitted", 1, 1, 0, FIsomitted },
{ "language", 0, 0, 1, FLanguage },
{ "localtoutc", 1, 1, 1, FLocalToUTC },
{ "lower", 1, 1, 1, FLower },
{ "max", 1, NO_MAX, 1, FMax },
{ "min", 1, NO_MAX, 1, FMin },
@@ -264,22 +284,26 @@ BuiltinFunc Func[] = {
{ "now", 0, 0, 0, FNow },
{ "ord", 1, 1, 1, FOrd },
{ "ostype", 0, 0, 1, FOstype },
{ "pad", 3, 4, 1, FPad },
{ "plural", 1, 3, 1, FPlural },
{ "psmoon", 1, 4, 1, FPsmoon},
{ "psshade", 1, 3, 1, FPsshade},
{ "realcurrent", 0, 0, 0, FRealCurrent},
{ "realnow", 0, 0, 0, FRealnow},
{ "realtoday", 0, 0, 0, FRealtoday },
{ "rows", 0, 0, 0, FRows },
{ "sgn", 1, 1, 1, FSgn },
{ "shell", 1, 2, 0, FShell },
{ "shellescape", 1, 1, 1, FShellescape },
{ "slide", 2, NO_MAX, 0, FSlide },
{ "stdout", 0, 0, 1, FStdout },
{ "strlen", 1, 1, 1, FStrlen },
{ "substr", 2, 3, 1, FSubstr },
{ "sunrise", 0, 1, 0, FSunrise},
{ "sunset", 0, 1, 0, FSunset },
{ "time", 2, 2, 1, FTime },
{ "timepart", 1, 1, 1, FTimepart },
{ "timezone", 0, 1, 1, FTimezone },
{ "today", 0, 0, 0, FToday },
{ "trig", 0, NO_MAX, 0, FTrig },
{ "trigback", 0, 0, 0, FTrigback },
@@ -294,6 +318,7 @@ BuiltinFunc Func[] = {
{ "trigpriority", 0, 0, 0, FTrigpriority },
{ "trigrep", 0, 0, 0, FTrigrep },
{ "trigscanfrom", 0, 0, 0, FTrigscanfrom },
{ "trigtags", 0, 0, 0, FTrigtags },
{ "trigtime", 0, 0, 0, FTrigtime },
{ "trigtimedelta",0, 0, 0, FTrigtimedelta },
{ "trigtimerep", 0, 0, 0, FTrigtimerep },
@@ -302,6 +327,7 @@ BuiltinFunc Func[] = {
{ "typeof", 1, 1, 1, FTypeof },
{ "tzconvert", 2, 3, 0, FTzconvert },
{ "upper", 1, 1, 1, FUpper },
{ "utctolocal", 1, 1, 1, FUTCToLocal },
{ "value", 1, 2, 0, FValue },
{ "version", 0, 0, 1, FVersion },
{ "weekno", 0, 3, 1, FWeekno },
@@ -900,6 +926,87 @@ static int FSgn(func_info *info)
return OK;
}
static int parse_color_helper(char const *str, int *r, int *g, int *b)
{
if (!*str) {
/* Empty string means "reset to normal" */
*r = -1;
*g = -1;
*b = -1;
return OK;
}
if (sscanf(str, "%d %d %d", r, g, b) != 3) {
return E_BAD_TYPE;
}
return OK;
}
/***************************************************************/
/* */
/* FAnsicolor - return an ANSI terminal color sequence */
/* */
/***************************************************************/
static int FAnsicolor(func_info *info)
{
int r=0, g=0, b=0, bg=0, clamp=1;
int status = 0;
int index = 0;
bg = 0;
clamp = 1;
/* If first arg is a string: Parse out the colors */
if (ARG(0).type == STR_TYPE) {
/* If first arg is a string: Parse out the colors */
status = parse_color_helper(ARGSTR(0), &r, &g, &b);
if (status != 0) {
return status;
}
index = 1;
} else if (ARG(0).type == INT_TYPE) {
/* Must be at least three arguments */
if (Nargs < 3) return E_2FEW_ARGS;
ASSERT_TYPE(1, INT_TYPE);
ASSERT_TYPE(2, INT_TYPE);
r = ARGV(0);
g = ARGV(1);
b = ARGV(2);
index = 3;
}
if (r < -1 || g < -1 || b < -1) return E_2LOW;
if (r > 255 || g > 255 || b > 255) return E_2HIGH;
/* If any is -1, then all must be -1 */
if (r == -1 || g == -1 || b == -1) {
if (r != -1 || g != -1 || b != -1) {
return E_2LOW;
}
}
if (Nargs > index) {
ASSERT_TYPE(index, INT_TYPE);
if (ARGV(index) < 0) return E_2LOW;
if (ARGV(index) > 1) return E_2HIGH;
bg = ARGV(index);
index++;
if (Nargs > index) {
ASSERT_TYPE(index, INT_TYPE);
if (ARGV(index) < 0) return E_2LOW;
if (ARGV(index) > 1) return E_2HIGH;
clamp = ARGV(index);
}
}
/* All righ! We have our parameters; now return the string */
if (!UseVTColors) {
/* Not using any colors: Empty strin */
return RetStrVal("", info);
}
if (r < 0) {
/* Return ANSI "reset to normal" string */
return RetStrVal(Decolorize(), info);
}
return RetStrVal(Colorize(r, g, b, bg, clamp), info);
}
/***************************************************************/
/* */
/* FAmpm - return a time as a string with "AM" or "PM" suffix */
@@ -998,6 +1105,73 @@ static int FOrd(func_info *info)
return RetStrVal(buf, info);
}
/***************************************************************/
/* */
/* FPad - Pad a string to min length */
/* */
/* pad("1", "0", 4) --> "0004" */
/* pad("1", "0", 4, 1) --> "4000" */
/* pad("foo", "bar", 7) -> "barbfoo" */
/* */
/***************************************************************/
static int FPad(func_info *info)
{
int r;
char *s;
DynamicBuffer dbuf;
size_t len;
size_t wantlen;
size_t i;
ASSERT_TYPE(1, STR_TYPE);
ASSERT_TYPE(2, INT_TYPE);
if (Nargs == 4) {
ASSERT_TYPE(3, INT_TYPE);
}
if (ARG(0).type != STR_TYPE) {
r = DoCoerce(STR_TYPE, &ARG(0));
if (r != OK) return r;
}
wantlen = ARGV(2);
len = strlen(ARGSTR(0));
if (len >= wantlen) {
DCOPYVAL(RetVal, ARG(0));
return OK;
}
if (strlen(ARGSTR(1)) == 0) {
return E_BAD_TYPE;
}
if (MaxStringLen > 0 && wantlen > (size_t) MaxStringLen) {
return E_STRING_TOO_LONG;
}
DBufInit(&dbuf);
s = ARGSTR(1);
if (Nargs < 4 || !ARGV(3)) {
/* Pad on the LEFT */
for (i=0; i<wantlen-len; i++) {
DBufPutc(&dbuf, *s++);
if (!*s) s = ARGSTR(1);
}
DBufPuts(&dbuf, ARGSTR(0));
} else {
/* Pad on the RIGHT */
DBufPuts(&dbuf, ARGSTR(0));
for (i=0; i<wantlen-len; i++) {
DBufPutc(&dbuf, *s++);
if (!*s) s = ARGSTR(1);
}
}
r = RetStrVal(DBufValue(&dbuf), info);
DBufFree(&dbuf);
return r;
}
/***************************************************************/
/* */
/* FPlural - pluralization function */
@@ -1168,6 +1342,35 @@ static int FLower(func_info *info)
return OK;
}
/***************************************************************/
/* */
/* FStdout - return the type of file descriptor for stdout */
/* */
/***************************************************************/
static int FStdout(func_info *info)
{
struct stat statbuf;
int r;
if (isatty(STDOUT_FILENO)) {
return RetStrVal("TTY", info);
}
if (fstat(STDOUT_FILENO, &statbuf) < 0) {
return RetStrVal("UNKNOWN", info);
}
switch(statbuf.st_mode & S_IFMT) {
case S_IFBLK: r = RetStrVal("BLOCKDEV", info); break;
case S_IFCHR: r = RetStrVal("CHARDEV", info); break;
case S_IFDIR: r = RetStrVal("DIR",info); break;
case S_IFIFO: r = RetStrVal("PIPE",info); break;
case S_IFLNK: r = RetStrVal("SYMLINK", info); break;
case S_IFREG: r = RetStrVal("FILE",info); break;
case S_IFSOCK: r = RetStrVal("SOCKET", info); break;
default: r = RetStrVal("UNKNOWN", info); break;
}
return r;
}
/***************************************************************/
/* */
/* FToday - return the system's notion of "today" */
@@ -1369,6 +1572,11 @@ static int FTrigrep(func_info *info)
return OK;
}
static int FTrigtags(func_info *info)
{
return RetStrVal(DBufValue(&(LastTrigger.tags)), info);
}
static int FTrigpriority(func_info *info)
{
RetVal.type = INT_TYPE;
@@ -2125,6 +2333,115 @@ static int FTimeStuff(int wantmins, func_info *info)
return OK;
}
static int FTimezone(func_info *info)
{
int yr, mon, day, hr, min, jul, now;
struct tm local, *withzone;
time_t t;
char buf[64];
if (Nargs == 0) {
jul = JulianToday;
now = (SystemTime(0) / 60);
} else {
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
jul = DATEPART(ARG(0));
if (HASTIME(ARG(0))) {
now = TIMEPART(ARG(0));
} else {
now = 0;
}
}
FromJulian(jul, &yr, &mon, &day);
hr = now / 60;
min = now % 60;
memset(&local, 0, sizeof(local));
local.tm_sec = 0;
local.tm_min = min;
local.tm_hour = hr;
local.tm_mday = day;
local.tm_mon = mon;
local.tm_year = yr-1900;
local.tm_isdst = -1;
t = mktime(&local);
withzone = localtime(&t);
buf[0] = 0;
strftime(buf, sizeof(buf), "%Z", withzone);
return RetStrVal(buf, info);
}
static int FLocalToUTC(func_info *info)
{
int yr, mon, day, hr, min, jul;
time_t loc_t;
struct tm local, *utc;
ASSERT_TYPE(0, DATETIME_TYPE);
FromJulian(DATEPART(ARG(0)), &yr, &mon, &day);
hr = TIMEPART(ARG(0))/60;
min = TIMEPART(ARG(0))%60;
memset(&local, 0, sizeof(local));
local.tm_sec = 0;
local.tm_min = min;
local.tm_hour = hr;
local.tm_mday = day;
local.tm_mon = mon;
local.tm_year = yr-1900;
local.tm_isdst = -1;
loc_t = mktime(&local);
if (loc_t == -1) {
return E_MKTIME_PROBLEM;
}
utc = gmtime(&loc_t);
jul = Julian(utc->tm_year+1900, utc->tm_mon, utc->tm_mday);
RetVal.type = DATETIME_TYPE;
RETVAL = MINUTES_PER_DAY * jul + utc->tm_hour*60 + utc->tm_min;
return OK;
}
static int FUTCToLocal(func_info *info)
{
int yr, mon, day, hr, min, jul;
time_t utc_t;
struct tm *local, utc;
char const *old_tz;
ASSERT_TYPE(0, DATETIME_TYPE);
FromJulian(DATEPART(ARG(0)), &yr, &mon, &day);
hr = TIMEPART(ARG(0))/60;
min = TIMEPART(ARG(0))%60;
old_tz = getenv("TZ");
tz_set_tz("UTC");
memset(&utc, 0, sizeof(utc));
utc.tm_sec = 0;
utc.tm_min = min;
utc.tm_hour = hr;
utc.tm_mday = day;
utc.tm_mon = mon;
utc.tm_year = yr-1900;
utc.tm_isdst = 0;
utc_t = mktime(&utc);
tz_set_tz(old_tz);
if (utc_t == -1) {
return E_MKTIME_PROBLEM;
}
local = localtime(&utc_t);
jul = Julian(local->tm_year+1900, local->tm_mon, local->tm_mday);
RetVal.type = DATETIME_TYPE;
RETVAL = MINUTES_PER_DAY * jul + local->tm_hour*60 + local->tm_min;
return OK;
}
/***************************************************************/
/* */
/* Sunrise and sunset functions. */
@@ -2237,10 +2554,10 @@ static int SunStuff(int rise, double cosz, int jul)
/* Sometimes, we get roundoff error. Check for "reasonableness" of
answer. */
if (rise) {
/* Sunrise so close to midnight it wrapped around -- permament light */
/* Sunrise so close to midnight it wrapped around -- permanent light */
if (hours >= 23) return NO_TIME;
} else {
/* Sunset so close to midnight it wrapped around -- permament light */
/* Sunset so close to midnight it wrapped around -- permanent light */
if (hours <= 1) return -NO_TIME;
}
return hours*60 + mins;
@@ -2826,11 +3143,11 @@ FSlide(func_info *info)
}
/* If ALL weekdays are omitted... barf! */
if (localomit == 127 && amt != 0) return E_2MANY_LOCALOMIT;
if ((WeekdayOmits | localomit) == 0x7F && amt != 0) return E_2MANY_LOCALOMIT;
if (amt > 0) {
while(amt) {
d++;
r = IsOmitted(d, localomit, NULL,&omit);
r = IsOmitted(d, localomit, NULL, &omit);
if (r) return r;
if (!omit) amt--;
}
@@ -2838,7 +3155,7 @@ FSlide(func_info *info)
while(amt) {
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 (!omit) amt++;
}
@@ -3065,3 +3382,77 @@ FTrig(func_info *info)
}
return OK;
}
static int
rows_or_cols(func_info *info, int want_rows)
{
struct winsize w;
int fd = STDOUT_FILENO;
RetVal.type = INT_TYPE;
if (!isatty(fd)) {
fd = open("/dev/tty", O_RDONLY);
if (fd < 0) {
RETVAL = -1;
return OK;
}
}
if (ioctl(fd, TIOCGWINSZ, &w) == 0) {
if (want_rows) RETVAL = w.ws_row;
else RETVAL = w.ws_col;
} else {
RETVAL = -1;
}
if (fd != STDOUT_FILENO) {
close(fd);
}
return OK;
}
static int FRows(func_info *info)
{
return rows_or_cols(info, 1);
}
static int FColumns(func_info *info)
{
#ifdef REM_USE_WCHAR
size_t len;
wchar_t *buf, *s;
int width;
#endif
if (Nargs == 0) {
return rows_or_cols(info, 0);
}
ASSERT_TYPE(0, STR_TYPE);
#ifdef REM_USE_WCHAR
len = mbstowcs(NULL, ARGSTR(0), 0);
if (len == (size_t) -1) return E_NO_MEM;
buf = calloc(len+1, sizeof(wchar_t));
if (!buf) return E_NO_MEM;
(void) mbstowcs(buf, ARGSTR(0), len+1);
s = buf;
width = 0;
while (*s) {
if (*s == 0x1B && *(s+1) == '[') {
/* Skip escape sequences */
s += 2;
while (*s && (*s < 0x40 || *s > 0x7E)) {
s++;
}
if (*s) {
s++;
}
continue;
}
width += wcwidth(*s);
s++;
}
free(buf);
RetVal.type = INT_TYPE;
RETVAL = width;
return OK;
#else
return E_BAD_TYPE;
#endif
}

View File

@@ -8,15 +8,16 @@
/* globals.h and err.h */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
#include "config.h"
#include <stdio.h> /* For defintion of FILE - sigh! */
#include <stdio.h> /* For definition of FILE - sigh! */
#include "types.h"
#include "custom.h"
#include "lang.h"
#define MK_GLOBALS 1
#include "globals.h"
#include "err.h"

View File

@@ -11,6 +11,7 @@
/* */
/***************************************************************/
#ifdef MK_GLOBALS
#undef EXTERN
#define EXTERN
@@ -24,6 +25,10 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
EXTERN FILE *ErrFp;
#include "dynbuf.h"
#include "lang.h"
#define MAX_TRUSTED_USERS 20
@@ -53,9 +58,10 @@ EXTERN INIT( int DoSimpleCalendar, 0);
EXTERN INIT( int DoSimpleCalDelta, 0);
EXTERN INIT( int DoPrefixLineNo, 0);
EXTERN INIT( int MondayFirst, 0);
EXTERN INIT( int AddBlankLines, 1);
EXTERN INIT( int Iterations, 1);
EXTERN INIT( int PsCal, 0);
EXTERN INIT( int CalWidth, -1);
EXTERN INIT( int CalWidth, 80);
EXTERN INIT( int CalWeeks, 0);
EXTERN INIT( int CalMonths, 0);
EXTERN INIT( int Hush, 0);
@@ -75,6 +81,8 @@ EXTERN INIT( long SysTime, -1L);
EXTERN char const *InitialFile;
EXTERN int FileAccessDate;
EXTERN INIT( int WeekdayOmits, 0);
EXTERN INIT( int DontSuppressQuoteMarkers, 0);
EXTERN INIT( int DontFork, 0);
EXTERN INIT( int DontQueue, 0);
EXTERN INIT( int NumQueued, 0);
@@ -94,7 +102,6 @@ EXTERN INIT( char *FileName, NULL);
EXTERN INIT( int UseStdin, 0);
EXTERN INIT( int PurgeMode, 0);
EXTERN INIT( int PurgeIncludeDepth, 0);
EXTERN FILE *ErrFp;
EXTERN INIT( FILE *PurgeFP, NULL);
EXTERN INIT( int NumIfs, 0);
EXTERN INIT( unsigned int IfFlags, 0);
@@ -106,11 +113,13 @@ EXTERN INIT( int LastTriggerTime, 0);
EXTERN INIT( int ShouldCache, 0);
EXTERN char const *CurLine;
EXTERN INIT( int NumTriggered, 0);
EXTERN INIT( int DidMsgReminder, 0);
EXTERN int ArgC;
EXTERN char const **ArgV;
EXTERN INIT( int CalLines, CAL_LINES);
EXTERN INIT( int CalPad, 1);
EXTERN INIT( int UseVTChars, 0);
EXTERN INIT( int UseBGVTColors, 0);
EXTERN INIT( int UseUTF8Chars, 0);
EXTERN INIT( int UseVTColors, 0);
EXTERN INIT( int Use256Colors, 0);
@@ -141,11 +150,6 @@ EXTERN INIT( int SubsIndent, 0);
EXTERN INIT( char *EndSent, ".?!");
EXTERN INIT( char *EndSentIg, "\"')]}>");
/* We need the language stuff here... */
#include "lang.h"
#include "dynbuf.h"
EXTERN DynamicBuffer Banner;
EXTERN DynamicBuffer LineBuffer;
EXTERN DynamicBuffer ExprBuf;
@@ -227,3 +231,98 @@ EXTERN int MonthIndex[2][12]
#endif
;
EXTERN char *DynamicAgo
#ifdef MK_GLOBALS
= L_AGO
#endif
;
EXTERN char *DynamicAm
#ifdef MK_GLOBALS
= L_AM
#endif
;
EXTERN char *DynamicAnd
#ifdef MK_GLOBALS
= L_AND
#endif
;
EXTERN char *DynamicAt
#ifdef MK_GLOBALS
= L_AT
#endif
;
EXTERN char *DynamicFromnow
#ifdef MK_GLOBALS
= L_FROMNOW
#endif
;
EXTERN char *DynamicHour
#ifdef MK_GLOBALS
= L_HOUR
#endif
;
EXTERN char *DynamicHplu
#ifdef MK_GLOBALS
= L_HPLU
#endif
;
EXTERN char *DynamicIs
#ifdef MK_GLOBALS
= L_IS
#endif
;
EXTERN char *DynamicMinute
#ifdef MK_GLOBALS
= L_MINUTE
#endif
;
EXTERN char *DynamicMplu
#ifdef MK_GLOBALS
= L_MPLU
#endif
;
EXTERN char *DynamicNow
#ifdef MK_GLOBALS
= L_NOW
#endif
;
EXTERN char *DynamicOn
#ifdef MK_GLOBALS
= L_ON
#endif
;
EXTERN char *DynamicPm
#ifdef MK_GLOBALS
= L_PM
#endif
;
EXTERN char *DynamicToday
#ifdef MK_GLOBALS
= L_TODAY
#endif
;
EXTERN char *DynamicTomorrow
#ifdef MK_GLOBALS
= L_TOMORROW
#endif
;
EXTERN char *DynamicWas
#ifdef MK_GLOBALS
= L_WAS
#endif
;
#define XSTR(x) #x
#define STRSYSDIR(x) XSTR(x)
EXTERN char *SysDir
#ifdef MK_GLOBALS
= STRSYSDIR(SYSDIR)
#endif
;
EXTERN int SuppressLRM
#ifdef MK_GLOBALS
= 0
#endif
;

View File

@@ -5,7 +5,7 @@
/* Support for the Hebrew calendar */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/* Derived from code written by Amos Shapir in 1978; revised */
/* 1985. */

View File

@@ -7,7 +7,7 @@
/* in normal mode. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -21,6 +21,10 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
#include <unistd.h>
#include <sys/ioctl.h>
@@ -30,10 +34,10 @@
#endif
#include "types.h"
#include "globals.h"
#include "protos.h"
#include "expr.h"
#include "err.h"
#include "globals.h"
/***************************************************************
*
@@ -43,7 +47,8 @@
* simple calendar format.
* -r = Disallow RUN mode
* -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
* -@[n,m,b]= Colorize n=0 VT100 n=1 85 n=2 True m=0 dark terminal m=1 light
* b=0 ignore SHADE b=1 respect SHADE
* -w[n,n,n] = Specify output device width, padding and spacing
* -s[n] = Produce calendar in "simple calendar" format
* -p[n] = Produce calendar in format compatible with rem2ps
@@ -94,6 +99,25 @@ static void AddTrustedUser(char const *username);
static DynamicBuffer default_filename_buf;
static void
InitCalWidthAndFormWidth(int fd)
{
struct winsize w;
if (!isatty(fd)) {
return;
}
if (ioctl(fd, TIOCGWINSZ, &w) == 0) {
CalWidth = w.ws_col;
if (CalWidth < 71) {
CalWidth = 71;
}
FormWidth = w.ws_col - 8;
if (FormWidth < 20) FormWidth = 20;
if (FormWidth > 500) FormWidth = 500;
}
}
/***************************************************************/
/* */
/* DefaultFilename */
@@ -141,20 +165,14 @@ void InitRemind(int argc, char const *argv[])
int weeks;
int x;
int jul;
int ttyfd;
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;
}
}
InitCalWidthAndFormWidth(STDOUT_FILENO);
/* Initialize global dynamic buffers */
DBufInit(&Banner);
DBufInit(&LineBuffer);
@@ -232,17 +250,37 @@ void InitRemind(int argc, char const *argv[])
Use256Colors = 1;
} else if (x == 2) {
UseTrueColors = 1;
}
} else if (x != 0) {
fprintf(ErrFp, "%s: -@n,m,b: n must be 0, 1 or 2 (assuming 0)\n",
argv[0]);
}
}
if (*arg == ',') {
arg++;
PARSENUM(x, arg);
if (x == 0) {
TerminalBackground = TERMINAL_BACKGROUND_DARK;
} else if (x == 1) {
TerminalBackground = TERMINAL_BACKGROUND_LIGHT;
}
if (*arg != ',') {
PARSENUM(x, arg);
if (x == 0) {
TerminalBackground = TERMINAL_BACKGROUND_DARK;
} else if (x == 1) {
TerminalBackground = TERMINAL_BACKGROUND_LIGHT;
} else if (x == 2) {
TerminalBackground = TERMINAL_BACKGROUND_UNKNOWN;
} else {
fprintf(ErrFp, "%s: -@n,m,b: m must be 0, 1 or 2 (assuming 2)\n",
argv[0]);
}
}
}
if (*arg == ',') {
arg++;
PARSENUM(x, arg);
if (x != 0 && x != 1) {
fprintf(ErrFp, "%s: -@n,m,b: b must be 0 or 1 (assuming 0)\n",
argv[0]);
x = 0;
}
UseBGVTColors = x;
}
break;
case 'j':
@@ -459,6 +497,7 @@ void InitRemind(int argc, char const *argv[])
DoSimpleCalendar = 1;
PsCal = PSCAL_LEVEL1;
while (*arg == 'a' || *arg == 'A' ||
*arg == 'q' || *arg == 'Q' ||
*arg == 'p' || *arg == 'P') {
if (*arg == 'a' || *arg == 'A') {
DoSimpleCalDelta = 1;
@@ -471,7 +510,9 @@ void InitRemind(int argc, char const *argv[])
} else {
PsCal = PSCAL_LEVEL3;
}
}
} else if (*arg == 'q' || *arg == 'Q') {
DontSuppressQuoteMarkers = 1;
}
arg++;
}
PARSENUM(CalMonths, arg);
@@ -486,11 +527,27 @@ void InitRemind(int argc, char const *argv[])
case 'w':
case 'W':
if (*arg != ',') {
PARSENUM(CalWidth, arg);
if (CalWidth != 0 && CalWidth < 71) CalWidth = 71;
if (CalWidth == 0) {
CalWidth = -1;
}
if (*arg == 't') {
arg++;
/* -wt means get width from /dev/tty */
ttyfd = open("/dev/tty", O_RDONLY);
if (!ttyfd) {
fprintf(stderr, "%s: `-wt': Cannot open /dev/tty: %s\n",
argv[0], strerror(errno));
} else {
InitCalWidthAndFormWidth(ttyfd);
close(ttyfd);
}
} else {
PARSENUM(CalWidth, arg);
if (CalWidth != 0 && CalWidth < 71) CalWidth = 71;
if (CalWidth == 0) {
CalWidth = -1;
}
FormWidth = CalWidth - 8;
if (FormWidth < 20) FormWidth = 20;
if (FormWidth > 500) FormWidth = 500;
}
}
if (*arg == ',') {
arg++;
@@ -672,7 +729,7 @@ void InitRemind(int argc, char const *argv[])
#ifndef L_USAGE_OVERRIDE
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2022 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif
@@ -680,7 +737,7 @@ void Usage(void)
fprintf(ErrFp, "Options:\n");
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
fprintf(ErrFp, " -r Disable RUN directives\n");
fprintf(ErrFp, " -@[n,m] Colorize COLOR reminders\n");
fprintf(ErrFp, " -@[n,m,b] Colorize COLOR/SHADE 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) weeks\n");
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");

View File

@@ -5,7 +5,7 @@
/* Header file for language support for various languages. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -23,7 +23,7 @@
#define ITALIAN 9 /* translated by Valerio Aimale */
#define ROMANIAN 10 /* translated by Liviu Daia */
#define SPANISH 11 /* translated by Rafa Couto */
#define ICELANDIC 12 /* translated by Björn Davíðsson */
#define ICELANDIC 12 /* translated by Björn Davíðsson */
/* Add more languages here - but please e-mail dianne@skoll.ca
to have your favorite language assigned a number. If you add a

View File

@@ -6,7 +6,7 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* REMIND is Copyright (C) 1992-2022 by Dianne Skoll */
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
/* */
/***************************************************************/
@@ -48,9 +48,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "siden"
#define L_FROMNOW "fra nu"
@@ -91,5 +88,3 @@
#define L_I_OVER sprintf(s, "den %02d%c%02d", m+1, DateSep, d);
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER
#endif /* L_IN_DOSUBST */

View File

@@ -11,7 +11,7 @@
/* Further corrections by Erik-Jan Vens */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -52,9 +52,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "geleden"
#define L_FROMNOW "vanaf nu"
@@ -91,15 +88,14 @@ if (tdiff == 0) \
sprintf(s, L_NOW); \
else if (hdiff == 0) \
sprintf(s, "%d %s %s", mdiff, \
(mdiff == 1 ? "minuut" : "minuten"), when); \
((mdiff == 1) ? "minuut" : "minuten"), when); \
else if (mdiff == 0) \
sprintf(s, "%d %s %s", hdiff, \
(mdiff == 1 ? "uur" : "uren"), when); \
else sprintf(s, "%d %s %s %d %s %s", hdiff, \
(hdiff == 1 ? "uur" : "uren"), \
L_AND, mdiff, \
(mdiff == 1 ? "minuut" : "minuten"), \
when);
((hdiff == 1) ? "uur" : "uren"), when); \
else sprintf(s, "%d %s %s %d %s %s", hdiff, \
(hdiff == 1 ? "uur" : "uren"), \
L_AND, mdiff, \
(mdiff == 1 ? "minuut" : "minuten"), \
when);
#endif /* L_IN_DOSUBST */

View File

@@ -5,7 +5,7 @@
/* Support for the English language. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -46,9 +46,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "ago"
#define L_FROMNOW "from now"
@@ -72,11 +69,9 @@
#define L_WAS "was"
#define L_AND "and"
/* What to add to make "hour" plural */
#define L_HPLU "s"
#define L_HPLU "s"
/* What to add to make "minute" plural */
#define L_MPLU "s"
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
See the file dosubst.c for more info. */
#endif /* L_IN_DOSUBST */

View File

@@ -11,7 +11,7 @@
/* */
/* This file is part of REMIND. */
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* REMIND is Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -52,9 +52,6 @@
#define L_AM " ap."
#define L_PM " ip."
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "sitten"
#define L_FROMNOW "kuluttua"
@@ -138,7 +135,6 @@ else { \
} \
sprintf(s + strlen(s), when); \
}
#endif /* L_IN_DOSUBST */
/* The next ones are used only when MK_GLOBALS is set */
#ifdef MK_GLOBALS
@@ -199,7 +195,7 @@ EXTERN char *ErrMsg[] =
"Kuukausi annettu kahdesti",
"Päivä annettu kahdesti",
"Tuntematon sana tai merkki",
"OMIT-komennossa on annettava kuukausi ja päivä",
"OMIT-komennossa on annettava kuukausi",
"Liian monta osittaista OMIT-komentoa",
"Liian monta täydellistä OMIT-komentoa",
"Varoitus: PUSH-OMIT-CONTEXT ilman POP-OMIT-CONTEXTia",
@@ -257,7 +253,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2022 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
#endif

View File

@@ -8,7 +8,7 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* REMIND is Copyright (C) 1992-2022 by Dianne Skoll */
/* This file is Copyright (C) 1993 by Laurent Duperval and */
/* Dianne Skoll. */
/* */
@@ -51,9 +51,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "il y a"
#define L_FROMNOW "dans"
@@ -113,8 +110,6 @@ else if (tdiff < 0) { \
#define L_K_OVER if (altmode == '*') { sprintf(s, "%s, %d%s %s", DayName[jul%7], d, plu, MonthName[m]); } else { sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu, MonthName[m]); }
#endif /* L_IN_DOSUBST */
/* The next ones are used only when MK_GLOBALS is set */
#ifdef MK_GLOBALS
#define L_ERR_OVERRIDE 1
@@ -232,7 +227,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2022 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif

View File

@@ -9,7 +9,7 @@
/* I don't speak German. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -50,9 +50,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "vorher"
#define L_FROMNOW "von heute"
@@ -88,5 +85,3 @@
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER
#endif /* L_IN_DOSUBST */

View File

@@ -5,8 +5,8 @@
/* Support for the Icelandic language. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
/* */
/***************************************************************/
@@ -15,59 +15,56 @@
/* Day names */
#define L_SUNDAY "sunnudagur"
#define L_MONDAY "mánudagur"
#define L_TUESDAY "þriðjudagur"
#define L_WEDNESDAY "miðvikudagur"
#define L_MONDAY "mánudagur"
#define L_TUESDAY "þriðjudagur"
#define L_WEDNESDAY "miðvikudagur"
#define L_THURSDAY "fimmtudagur"
#define L_FRIDAY "föstudagur"
#define L_FRIDAY "föstudagur"
#define L_SATURDAY "laugardagur"
/* Month names */
#define L_JAN "janúar"
#define L_FEB "febrúar"
#define L_JAN "janúar"
#define L_FEB "febrúar"
#define L_MAR "mars"
#define L_APR "apríl"
#define L_MAY "maí"
#define L_JUN "júní"
#define L_JUL "júlí"
#define L_AUG "ágúst"
#define L_APR "apríl"
#define L_MAY "maí"
#define L_JUN "júní"
#define L_JUL "júlí"
#define L_AUG "ágúst"
#define L_SEP "september"
#define L_OCT "október"
#define L_NOV "nóvember"
#define L_OCT "október"
#define L_NOV "nóvember"
#define L_DEC "desember"
/* Today and tomorrow */
#define L_TODAY "í dag"
#define L_TOMORROW "á morgun"
#define L_TODAY "í dag"
#define L_TOMORROW "á morgun"
/* The default banner */
#define L_BANNER "Minnisatriði: %w, %d%s %m, %y%o:"
#define L_BANNER "Minnisatriði: %w, %d%s %m, %y%o:"
/* "am" and "pm" */
#define L_AM "fh"
#define L_PM "eh"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "síðan"
#define L_FROMNOW "frá því nú"
#define L_AGO "síðan"
#define L_FROMNOW "frá því nú"
/* "in %d days' time" */
#define L_INXDAYS "eftir %d daga"
/* "on" as in "on date..." */
#define L_ON "þann"
#define L_ON "þann"
/* Pluralizing - this is a problem for many languages and may require
a more drastic fix */
#define L_PLURAL "a"
/* Minutes, hours, at, etc */
#define L_NOW "núna"
#define L_NOW "núna"
#define L_AT "kl."
#define L_MINUTE "mínútu"
#define L_MINUTE "mínútu"
#define L_HOUR "klukkustund"
#define L_IS "er"
#define L_WAS "var"
@@ -79,5 +76,3 @@
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
See the file dosubst.c for more info. */
#endif /* L_IN_DOSUBST */

View File

@@ -7,7 +7,7 @@
/* This file is part of REMIND. */
/* It is Copyright (C) 1996 by Valerio Aimale */
/* */
/* Remind is copyright (C) 1992-2021 by Dianne Skoll */
/* Remind is copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -49,9 +49,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "fa"
#define L_FROMNOW "da oggi"
@@ -114,6 +111,3 @@
#define L_V_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, \
MonthName[m]);
#endif /* L_IN_DOSUBST */

View File

@@ -6,7 +6,7 @@
/* */
/* This file is part of REMIND. */
/* This file is Copyright (C) 1993 by Trygve Randen. */
/* Remind is Copyright (C) 1992-2021 by Dianne Skoll */
/* Remind is Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -47,9 +47,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "siden"
#define L_FROMNOW "fra nå"
@@ -84,6 +81,3 @@
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER
#endif /* L_IN_DOSUBST */

View File

@@ -9,7 +9,7 @@
/* Polish. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -50,9 +50,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "temu"
#define L_FROMNOW "od teraz"
@@ -75,13 +72,17 @@
# define L_IS "będzie"
# define L_WAS "było"
#define L_AND "i"
#define L_HPLU ""
#define L_MPLU ""
/* What to add to make "hour" or "minute" plural */
#define L_NPLU( N ) ((N == 1) ? "ę" : ((N==12) || (N==13) || (N==14)) ? "" : \
((N%10==2) || (N%10==3) || (N%10==4)) ? "y" : "" )
/* What to add to make "hour" plural */
#define L_HPLU L_NPLU( hdiff )
#define L_HPLU_OVER hplu = L_NPLU( hdiff );
/* What to add to make "minute" plural */
#define L_MPLU L_NPLU( mdiff )
#define L_MPLU_OVER mplu = L_NPLU( mdiff );
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
See the file dosubst.c for more info. */
@@ -99,32 +100,30 @@ ampm = (hour<12) ? \
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER
#endif /* L_IN_DOSUBST */
#define L_0_OVER sprintf(s, L_HPLU);
#define L_9_OVER sprintf(s, L_MPLU);
#define L_0_OVER sprintf(s, L_NPLU(hdiff));
#define L_9_OVER sprintf(s, L_NPLU(mdiff));
#define L_1_OVER \
if (tdiff == 0) \
sprintf(s, L_NOW); \
else if (tdiff > 0) \
{ \
if (hdiff == 0) \
sprintf(s, "za %d %s%s", mdiff, L_MINUTE, L_MPLU); \
sprintf(s, "za %d %s%s", mdiff, L_MINUTE, L_NPLU(mdiff)); \
else if (mdiff == 0) \
sprintf(s, "za %d %s%s", hdiff, L_HOUR, L_HPLU); \
sprintf(s, "za %d %s%s", hdiff, L_HOUR, L_NPLU(hdiff)); \
else \
sprintf(s, "za %d %s%s %s %d %s%s", hdiff, L_HOUR, L_HPLU, \
L_AND, mdiff, L_MINUTE, L_MPLU); \
sprintf(s, "za %d %s%s %s %d %s%s", hdiff, L_HOUR, L_NPLU(hdiff), \
L_AND, mdiff, L_MINUTE, L_NPLU(mdiff)); \
} \
else \
{ \
if (hdiff == 0) \
sprintf(s, "%d %s%s temu", mdiff, L_MINUTE, L_MPLU); \
sprintf(s, "%d %s%s temu", mdiff, L_MINUTE, L_NPLU(mdiff)); \
else if (mdiff == 0) \
sprintf(s, "%d %s%s temu", hdiff, L_HOUR, L_HPLU); \
sprintf(s, "%d %s%s temu", hdiff, L_HOUR, L_NPLU(hdiff)); \
else \
sprintf(s, "%d %s%s %s %d %s%s temu", hdiff, L_HOUR, L_HPLU, \
L_AND, mdiff, L_MINUTE, L_MPLU); \
sprintf(s, "%d %s%s %s %d %s%s temu", hdiff, L_HOUR, L_NPLU(hdiff), \
L_AND, mdiff, L_MINUTE, L_NPLU(mdiff)); \
}
/* The next ones are used only when MK_GLOBALS is set */
@@ -186,7 +185,7 @@ EXTERN char *ErrMsg[] =
"Miesiąc podany dwókrotnie",
"Dzień podany dwókrotnie",
"Nieznane słowo",
"W komendzie OMIT trzeba podać miesiąc i dzień",
"W komendzie OMIT trzeba podać miesiąc",
"Za dużo częściowych komend OMIT",
"Za dużo pełnych komend OMIT",
"Ostrzeżenie: PUSH-OMIT-CONTEXT bez POP-OMIT-CONTEXT",
@@ -244,7 +243,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2022 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif

View File

@@ -8,7 +8,7 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* REMIND is Copyright (C) 1992-2022 by Dianne Skoll */
/* This file is Copyright (C) 1996 by Marco Paganini and */
/* Dianne Skoll. */
/* */
@@ -51,9 +51,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Ago and from now */
#define L_AGO "atras"
#define L_FROMNOW "adiante"
@@ -138,8 +135,6 @@
} \
}
#endif /* L_IN_DOSUBST */
/* The next ones are used only when MK_GLOBALS is set */
#ifdef MK_GLOBALS
#define L_ERR_OVERRIDE 1
@@ -199,7 +194,7 @@ EXTERN char *ErrMsg[] =
"Mes especificado duas vezes",
"Dia especificado duas vezes",
"Token desconhecido",
"Mes e dia devem ser especificados no comando OMIT",
"O mes deve ser especificados no comando OMIT",
"Muitos OMITs parciais",
"Muitos OMITs full",
"Aviso: PUSH-OMIT-CONTEXT sem POP-OMIT-CONTEXT correspondente",
@@ -257,7 +252,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2022 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
#endif

View File

@@ -8,7 +8,7 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* REMIND is Copyright (C) 1992-2022 by Dianne Skoll */
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
/* */
/***************************************************************/
@@ -50,9 +50,6 @@
#define L_AM "am"
#define L_PM "pm"
#ifdef L_IN_DOSUBST
/*** The following are only used in dosubst.c ***/
/* Ago and from now */
#define L_AGO "acum"
#define L_FROMNOW "peste"
@@ -76,6 +73,7 @@
#define L_WAS "a fost"
/* What to add to make "minute" plural */
#define L_MPLU "e"
#define L_HPLU "e"
/* What to add to make "hour" plural */
#define L_HPLU_OVER hplu = (hdiff == 1 ? "ă" : "e");
@@ -104,5 +102,3 @@
else \
sprintf(s, "%s %d %s%s %s %d %s%s", when, hdiff, \
L_HOUR, hplu, L_AND, mdiff, L_MINUTE, mplu);
#endif /* L_IN_DOSUBST */

View File

@@ -7,7 +7,7 @@
/* Author: Rafa Couto <rafacouto@biogate.com> */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -47,9 +47,6 @@
#define L_AM "am"
#define L_PM "pm"
/*** The following are only used in dosubst.c ***/
#ifdef L_IN_DOSUBST
/* Hace y desde hoy */
#define L_AGO "hace"
#define L_FROMNOW "desde hoy"
@@ -74,5 +71,3 @@
#define L_HPLU "s"
#define L_MPLU "s"
#endif /* L_IN_DOSUBST */

View File

@@ -6,12 +6,14 @@
/* routines, etc. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
#define _XOPEN_SOURCE 600
#include "config.h"
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
@@ -35,6 +37,10 @@
#endif
#include <sys/types.h>
#ifdef REM_USE_WCHAR
#include <wctype.h>
#include <wchar.h>
#endif
#include "types.h"
#include "protos.h"
@@ -67,6 +73,7 @@ int main(int argc, char *argv[])
ArgV = (char const **) argv;
InitRemind(argc, (char const **) argv);
DBufInit(&(LastTrigger.tags));
ClearLastTriggers();
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
@@ -169,6 +176,8 @@ static void DoReminders(void)
Parser p;
int purge_handled;
DidMsgReminder = 0;
if (!UseStdin) {
FileAccessDate = GetAccessDate(InitialFile);
} else {
@@ -176,7 +185,7 @@ static void DoReminders(void)
}
if (FileAccessDate < 0) {
fprintf(ErrFp, "%s: `%s'.\n", ErrMsg[E_CANTACCESS], InitialFile);
fprintf(ErrFp, "%s: `%s': %s.\n", ErrMsg[E_CANTACCESS], InitialFile, strerror(errno));
exit(1);
}
@@ -253,6 +262,7 @@ static void DoReminders(void)
case T_Flush: r=DoFlush(&p); break;
case T_Set: r=DoSet(&p); break;
case T_Fset: r=DoFset(&p); break;
case T_Funset: r=DoFunset(&p); break;
case T_UnSet: r=DoUnset(&p); break;
case T_Clr: r=DoClear(&p); break;
case T_Debug: r=DoDebug(&p); break;
@@ -329,7 +339,8 @@ int Julian(int year, int month, int day)
/* */
/* FromJulian */
/* */
/* Convert a Julian date to year, month, day. */
/* Convert a Julian date to year, month, day. You may supply */
/* NULL for y, m or d if you're not interested in that value */
/* */
/***************************************************************/
void FromJulian(int jul, int *y, int *m, int *d)
@@ -358,9 +369,15 @@ void FromJulian(int jul, int *y, int *m, int *d)
try_mon++;
t = DaysInMonth(try_mon, try_yr);
}
*y = try_yr;
*m = try_mon;
*d = jul + 1;
if (y) {
*y = try_yr;
}
if (m) {
*m = try_mon;
}
if (d) {
*d = jul + 1;
}
return;
}
@@ -605,13 +622,23 @@ void Eprint(char const *fmt, ...)
if (FreshLine && FileName) {
FreshLine = 0;
if (strcmp(FileName, "-"))
if (strcmp(FileName, "-")) {
(void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
else
if (print_callstack(ErrFp)) {
(void) fprintf(ErrFp, ": ");
}
} else {
(void) fprintf(ErrFp, "-stdin-(%d): ", LineNo);
if (print_callstack(ErrFp)) {
(void) fprintf(ErrFp, ": ");
}
}
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
} else if (FileName) {
fprintf(ErrFp, " ");
if (print_callstack(ErrFp)) {
(void) fprintf(ErrFp, ": ");
}
}
va_start(argptr, fmt);
@@ -847,19 +874,19 @@ int DoIfTrig(ParsePtr p)
Eprint("%s", ErrMsg[r]);
}
}
syndrome = IF_TRUE | BEFORE_ELSE;
syndrome = IF_FALSE | BEFORE_ELSE;
}
else {
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
syndrome = IF_TRUE | BEFORE_ELSE;
} else {
syndrome = IF_FALSE | BEFORE_ELSE;
if (PurgeMode) {
PurgeEchoLine("%s\n", "#!P: The next IFTRIG did not trigger.");
PurgeEchoLine("%s\n", "#!P: REM statements in IFTRIG block not checked for purging.");
}
}
}
if (syndrome == (IF_FALSE | BEFORE_ELSE) && PurgeMode) {
PurgeEchoLine("%s\n", "#!P: The next IFTRIG did not trigger.");
PurgeEchoLine("%s\n", "#!P: REM statements in IFTRIG block not checked for purging.");
}
FreeTrig(&trig);
}
NumIfs++;
@@ -1135,8 +1162,8 @@ int DoErrMsg(ParsePtr p)
/* The array FoldArray[2][7] contains sample years which begin
on the specified weekday. For example, FoldArray[0][2] is a
non-leapyear beginning on Wednesday, and FoldArray[1][5] is a
leapyear beginning on Saturday. Used to fold back dates which
non-leap year beginning on Wednesday, and FoldArray[1][5] is a
leap year beginning on Saturday. Used to fold back dates which
are too high for the standard Unix representation.
NOTE: This implies that you cannot set BASE > 2001!!!!! */
static int FoldArray[2][7] = {
@@ -1166,6 +1193,8 @@ int CalcMinsFromUTC(int jul, int tim, int *mins, int *isdst)
local.tm_sec = 0;
local.tm_min = tim % 60;
local.tm_hour = tim / 60;
local.tm_mday = day;
local.tm_mon = mon;
local.tm_year = yr-1900;
@@ -1194,6 +1223,144 @@ int CalcMinsFromUTC(int jul, int tim, int *mins, int *isdst)
return 0;
}
static char const *OutputEscapeSequences(char const *s, int print)
{
while (*s == 0x1B && *(s+1) == '[') {
if (print) putchar(*s);
s++;
if (print) putchar(*s);
s++;
while (*s && (*s < 0x40 || *s > 0x7E)) {
if (print) putchar(*s);
s++;
}
if (*s) {
if (print) putchar(*s);
s++;
}
}
return s;
}
#ifdef REM_USE_WCHAR
#define ISWBLANK(c) (iswspace(c) && (c) != '\n')
static wchar_t const *OutputEscapeSequencesWS(wchar_t const *s, int print)
{
while (*s == 0x1B && *(s+1) == '[') {
if (print) PutWideChar(*s);
s++;
if (print) PutWideChar(*s);
s++;
while (*s && (*s < 0x40 || *s > 0x7E)) {
if (print) PutWideChar(*s);
s++;
}
if (*s) {
if (print) PutWideChar(*s);
s++;
}
}
return s;
}
static void
FillParagraphWCAux(wchar_t const *s)
{
int line = 0;
int i, j;
int doublespace = 1;
int pendspace;
int len;
wchar_t const *t;
int roomleft;
/* Start formatting */
while(1) {
/* If it's a carriage return, output it and start new paragraph */
if (*s == '\n') {
putchar('\n');
s++;
line = 0;
while(ISWBLANK(*s)) s++;
continue;
}
if (!*s) {
return;
}
/* Over here, we're at the beginning of a line. Emit the correct
number of spaces */
j = line ? SubsIndent : FirstIndent;
for (i=0; i<j; i++) {
putchar(' ');
}
/* Calculate the amount of room left on this line */
roomleft = FormWidth - j;
pendspace = 0;
/* Emit words until the next one won't fit */
while(1) {
while(ISWBLANK(*s)) s++;
if (*s == '\n') break;
while(1) {
t = s;
s = OutputEscapeSequencesWS(s, 1);
if (s == t) break;
while(ISWBLANK(*s)) s++;
}
t = s;
len = 0;
while(*s && !iswspace(*s)) {
if (*s == 0x1B && *(s+1) == '[') {
s = OutputEscapeSequencesWS(s, 0);
continue;
}
len += wcwidth(*s);
s++;
}
if (s == t) {
return;
}
if (!pendspace || len+pendspace <= roomleft) {
for (i=0; i<pendspace; i++) {
putchar(' ');
}
while(t < s) {
PutWideChar(*t);
if (strchr(EndSent, *t)) doublespace = 2;
else if (!strchr(EndSentIg, *t)) doublespace = 1;
t++;
}
} else {
s = t;
putchar('\n');
line++;
break;
}
roomleft -= len+doublespace;
pendspace = doublespace;
}
}
}
static int
FillParagraphWC(char const *s)
{
size_t len;
wchar_t *buf;
len = mbstowcs(NULL, s, 0);
if (len == (size_t) -1) return E_NO_MEM;
buf = calloc(len+1, sizeof(wchar_t));
if (!buf) return E_NO_MEM;
(void) mbstowcs(buf, s, len+1);
FillParagraphWCAux(buf);
free(buf);
return OK;
}
#endif
/***************************************************************/
/* */
/* FillParagraph */
@@ -1220,11 +1387,17 @@ void FillParagraph(char const *s)
char const *t;
int roomleft;
if (!s || !*s) return;
/* Skip leading spaces */
while(ISBLANK(*s)) s++;
if (!*s) return;
#ifdef REM_USE_WCHAR
if (FillParagraphWC(s) == OK) {
return;
}
#endif
/* Start formatting */
while(1) {
@@ -1255,10 +1428,23 @@ void FillParagraph(char const *s)
while(1) {
while(ISBLANK(*s)) s++;
if (*s == '\n') break;
while(1) {
t = s;
s = OutputEscapeSequences(s, 1);
if (s == t) break;
while(ISBLANK(*s)) s++;
}
t = s;
while(*s && !isspace(*s)) s++;
len = s - t;
if (!len) {
len = 0;
while(*s && !isspace(*s)) {
if (*s == 0x1B && *(s+1) == '[') {
s = OutputEscapeSequences(s, 0);
continue;
}
s++;
len++;
}
if (s == t) {
return;
}
if (!pendspace || len+pendspace <= roomleft) {
@@ -1347,13 +1533,23 @@ void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
/* command-line flag is supplied. */
/* */
/***************************************************************/
static sig_atomic_t got_sigint = 0;
void SigIntHandler(int d)
void
SigIntHandler(int d)
{
UNUSED(d);
signal(SIGINT, SigIntHandler);
GotSigInt();
exit(0);
got_sigint = 1;
}
int
GotSigInt(void)
{
if (got_sigint) {
got_sigint = 0;
return 1;
}
return 0;
}
void
@@ -1394,6 +1590,7 @@ ClearLastTriggers(void)
LastTrigger.warn[0] = 0;
LastTrigger.omitfunc[0] = 0;
LastTrigger.passthru[0] = 0;
DBufFree(&(LastTrigger.tags));
LastTimeTrig.ttime = NO_TIME;
LastTimeTrig.delta = NO_DELTA;
@@ -1414,8 +1611,10 @@ SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigt
void
SaveLastTrigger(Trigger const *t)
{
DBufFree(&(LastTrigger.tags));
memcpy(&LastTrigger, t, sizeof(LastTrigger));
DBufInit(&(LastTrigger.tags));
DBufPuts(&(LastTrigger.tags), DBufValue(&(t->tags)));
}
void

View File

@@ -5,7 +5,7 @@
/* Calculations for figuring out moon phases. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -400,8 +400,8 @@ static double phase(double pdate,
double *suangdia)
{
double Day, N, M, Ec, Lambdasun, ml, MM, MN, Ev, Ae, A3, MmP,
mEc, A4, lP, V, lPP, NP, y, x, Lambdamoon,
double Day, N, M, Ec, Lambdasun, ml, MM, Ev, Ae, A3, MmP,
mEc, A4, lP, V, lPP,
MoonAge, MoonPhase,
MoonDist, MoonDFrac, MoonAng,
F, SunDist, SunAng;
@@ -431,9 +431,6 @@ static double phase(double pdate,
/* Moon's mean anomaly */
MM = fixangle(ml - 0.1114041 * Day - mmlongp);
/* Moon's ascending node mean longitude */
MN = fixangle(mlnode - 0.0529539 * Day);
/* Evection */
Ev = 1.2739 * sin(torad(2 * (ml - Lambdasun) - MM));
@@ -461,19 +458,6 @@ static double phase(double pdate,
/* 1 longitude */
lPP = lP + V;
/* Corrected longitude of the node */
NP = MN - 0.16 * sin(torad(M));
/* Y inclination coordinate */
y = sin(torad(lPP - NP)) * cos(torad(minc));
/* X inclination coordinate */
x = cos(torad(lPP - NP));
/* Ecliptic longitude */
Lambdamoon = todeg(atan2(y, x));
Lambdamoon += NP;
/* Calculation of the phase of the Moon */
/* Age of the Moon in degrees */

View File

@@ -6,7 +6,7 @@
/* the data structures for OMITted dates. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -28,6 +28,8 @@ static void InsertIntoSortedArray (int *array, int num, int key);
static int FullOmitArray[MAX_FULL_OMITS];
static int PartialOmitArray[MAX_PARTIAL_OMITS];
/* WeekdayOmits is declared in global.h */
/* How many of each omit types do we have? */
static int NumFullOmits, NumPartialOmits;
@@ -37,6 +39,7 @@ typedef struct omitcontext {
int numfull, numpart;
int *fullsave;
int *partsave;
int weekdaysave;
} OmitContext;
/* The stack of saved omit contexts */
@@ -52,6 +55,7 @@ static OmitContext *SavedOmitContexts = NULL;
int ClearGlobalOmits(void)
{
NumFullOmits = NumPartialOmits = 0;
WeekdayOmits = 0;
return OK;
}
@@ -113,6 +117,7 @@ int PushOmitContext(ParsePtr p)
context->numfull = NumFullOmits;
context->numpart = NumPartialOmits;
context->weekdaysave = WeekdayOmits;
context->fullsave = malloc(NumFullOmits * sizeof(int));
if (NumFullOmits && !context->fullsave) {
free(context);
@@ -154,6 +159,7 @@ int PopOmitContext(ParsePtr p)
if (!c) return E_POP_NO_PUSH;
NumFullOmits = c->numfull;
NumPartialOmits = c->numpart;
WeekdayOmits = c->weekdaysave;
/* Copy the context over */
for (i=0; i<NumFullOmits; i++)
@@ -213,6 +219,12 @@ int IsOmitted(int jul, int localomit, char const *omitfunc, int *omit)
return OK;
}
/* Is it omitted because of global weekday omits? */
if (WeekdayOmits & (1 << (jul % 7))) {
*omit = 1;
return OK;
}
/* Is it omitted because of fully-specified omits? */
if (BexistsIntArray(FullOmitArray, NumFullOmits, jul)) {
*omit = 1;
@@ -271,7 +283,6 @@ static void InsertIntoSortedArray(int *array, int num, int key)
*cur = key;
}
static int DoThroughOmit(ParsePtr p, int y, int m, int d);
static void DumpOmits(void);
/***************************************************************/
@@ -283,11 +294,16 @@ static void DumpOmits(void);
/***************************************************************/
int DoOmit(ParsePtr p)
{
int y = NO_YR, m = NO_MON, d = NO_DAY, r;
int y[2] = {NO_YR, NO_YR}, m[2] = {NO_MON, NO_MON}, d[2] = {NO_DAY, NO_DAY}, r;
Token tok;
int parsing=1;
int parsing = 1;
int seen_through = 0;
int syndrome;
int not_first_token = -1;
int start, end, tmp;
int wd = 0;
int mc, dc;
DynamicBuffer buf;
DBufInit(&buf);
@@ -298,9 +314,15 @@ int DoOmit(ParsePtr p)
if ( (r=ParseToken(p, &buf)) ) return r;
FindToken(DBufValue(&buf), &tok);
switch (tok.type) {
case T_Dumpvars:
if (not_first_token) return E_PARSE_ERR;
case T_WkDay:
DBufFree(&buf);
if (wd & (1 << tok.val)) return E_WD_TWICE;
wd |= (1 << tok.val);
break;
case T_Dumpvars:
DBufFree(&buf);
if (not_first_token) return E_PARSE_ERR;
r = VerifyEoln(p);
if (r != OK) return r;
DumpOmits();
@@ -308,28 +330,28 @@ int DoOmit(ParsePtr p)
case T_Date:
DBufFree(&buf);
if (y != NO_YR) return E_YR_TWICE;
if (m != NO_MON) return E_MON_TWICE;
if (d != NO_DAY) return E_DAY_TWICE;
FromJulian(tok.val, &y, &m, &d);
if (y[seen_through] != NO_YR) return E_YR_TWICE;
if (m[seen_through] != NO_MON) return E_MON_TWICE;
if (d[seen_through] != NO_DAY) return E_DAY_TWICE;
FromJulian(tok.val, &y[seen_through], &m[seen_through], &d[seen_through]);
break;
case T_Year:
DBufFree(&buf);
if (y != NO_YR) return E_YR_TWICE;
y = tok.val;
if (y[seen_through] != NO_YR) return E_YR_TWICE;
y[seen_through] = tok.val;
break;
case T_Month:
DBufFree(&buf);
if (m != NO_MON) return E_MON_TWICE;
m = tok.val;
if (m[seen_through] != NO_MON) return E_MON_TWICE;
m[seen_through] = tok.val;
break;
case T_Day:
DBufFree(&buf);
if (d != NO_DAY) return E_DAY_TWICE;
d = tok.val;
if (d[seen_through] != NO_DAY) return E_DAY_TWICE;
d[seen_through] = tok.val;
break;
case T_Delta:
@@ -338,8 +360,10 @@ int DoOmit(ParsePtr p)
case T_Through:
DBufFree(&buf);
if (y == NO_YR || m == NO_MON || d == NO_DAY) return E_INCOMPLETE;
return DoThroughOmit(p, y, m, d);
if (wd) return E_PARSE_ERR;
if (seen_through) return E_UNTIL_TWICE;
seen_through = 1;
break;
case T_Empty:
case T_Comment:
@@ -358,26 +382,97 @@ int DoOmit(ParsePtr p)
return E_UNKNOWN_TOKEN;
}
}
if (m == NO_MON || d == NO_DAY) return E_SPEC_MON_DAY;
if (y == NO_YR) {
if (NumPartialOmits == MAX_PARTIAL_OMITS) return E_2MANY_PART;
if (wd) {
if (y[0] != NO_YR || m[0] != NO_MON || d[0] != NO_DAY) {
return E_PARSE_ERR;
}
if ((WeekdayOmits | wd) == 0x7F) {
return E_2MANY_LOCALOMIT;
}
WeekdayOmits |= wd;
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}
if (d > MonthDays[m]) return E_BAD_DATE;
syndrome = (m<<5) + d;
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
InsertIntoSortedArray(PartialOmitArray, NumPartialOmits, syndrome);
NumPartialOmits++;
}
if (!seen_through) {
/* We must have at least a month */
if (m[0] == NO_MON) return E_SPEC_MON;
m[1] = m[0];
y[1] = y[0];
if (d[0] == NO_DAY) {
d[0] = 1;
if (y[0] == NO_YR) {
d[1] = MonthDays[m[0]];
} else {
d[1] = DaysInMonth(m[0], y[0]);
}
} else {
d[1] = d[0];
m[1] = m[0];
y[1] = y[0];
}
} else {
if (d > DaysInMonth(m, y)) return E_BAD_DATE;
syndrome = Julian(y, m, d);
r = AddGlobalOmit(syndrome);
if (r) {
return r;
if (m[0] == NO_MON) return E_SPEC_MON;
if (m[1] == NO_MON) return E_SPEC_MON;
if ((y[0] != NO_YR && y[1] == NO_YR) ||
(y[0] == NO_YR && y[1] != NO_YR)) {
return E_BAD_DATE;
}
if (d[0] == NO_DAY) d[0] = 1;
if (d[1] == NO_DAY) {
if (y[1] == NO_YR) {
d[1] = MonthDays[m[1]];
} else {
d[1] = DaysInMonth(m[1], y[1]);
}
}
}
if (y[0] == NO_YR) {
/* Partial OMITs */
if (d[0] > MonthDays[m[0]]) return E_BAD_DATE;
if (d[1] > MonthDays[m[1]]) return E_BAD_DATE;
dc = d[0];
mc = m[0];
while(1) {
syndrome = (mc<<5) + dc;
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
InsertIntoSortedArray(PartialOmitArray, NumPartialOmits, syndrome);
NumPartialOmits++;
}
if (mc == m[1] && dc == d[1]) {
break;
}
dc++;
if (dc > MonthDays[mc]) {
dc = 1;
mc++;
if (mc > 11) {
mc = 0;
}
}
}
} else {
/* Full OMITs */
if (d[0] > DaysInMonth(m[0], y[0])) return E_BAD_DATE;
if (d[1] > DaysInMonth(m[1], y[1])) return E_BAD_DATE;
start = Julian(y[0], m[0], d[0]);
end = Julian(y[1], m[1], d[1]);
if (end < start) {
Eprint("Error: THROUGH date earlier than start date");
return E_BAD_DATE;
}
for (tmp = start; tmp <= end; tmp++) {
if (!BexistsIntArray(FullOmitArray, NumFullOmits, tmp)) {
if (NumFullOmits >= MAX_FULL_OMITS) return E_2MANY_FULL;
InsertIntoSortedArray(FullOmitArray, NumFullOmits, tmp);
NumFullOmits++;
}
}
}
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
@@ -394,95 +489,6 @@ AddGlobalOmit(int jul)
return OK;
}
static int
DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
{
int yend = NO_YR, mend = NO_MON, dend = NO_DAY, r;
int start, end, tmp;
int parsing = 1;
Token tok;
DynamicBuffer buf;
DBufInit(&buf);
while(parsing) {
if ( (r=ParseToken(p, &buf)) ) return r;
FindToken(DBufValue(&buf), &tok);
switch(tok.type) {
case T_Date:
DBufFree(&buf);
if (yend != NO_YR) return E_YR_TWICE;
if (mend != NO_MON) return E_MON_TWICE;
if (dend != NO_DAY) return E_DAY_TWICE;
FromJulian(tok.val, &yend, &mend, &dend);
break;
case T_Year:
DBufFree(&buf);
if (yend != NO_YR) return E_YR_TWICE;
yend = tok.val;
break;
case T_Month:
DBufFree(&buf);
if (mend != NO_MON) return E_MON_TWICE;
mend = tok.val;
break;
case T_Day:
DBufFree(&buf);
if (dend != NO_DAY) return E_DAY_TWICE;
dend = tok.val;
break;
case T_Empty:
case T_Comment:
case T_RemType:
case T_Priority:
case T_Tag:
case T_Duration:
DBufFree(&buf);
parsing = 0;
break;
default:
Eprint("%s: `%s' (OMIT)", ErrMsg[E_UNKNOWN_TOKEN],
DBufValue(&buf));
DBufFree(&buf);
return E_UNKNOWN_TOKEN;
}
}
if (yend == NO_YR || mend == NO_MON || dend == NO_DAY) return E_INCOMPLETE;
if (dend > DaysInMonth(mend, yend)) return E_BAD_DATE;
if (dstart > DaysInMonth(mstart, ystart)) return E_BAD_DATE;
start = Julian(ystart, mstart, dstart);
end = Julian(yend, mend, dend);
if (end < start) {
Wprint("Warning: Swapping dates on OMIT ... THROUGH ... line");
tmp = start;
start = end;
end = tmp;
}
tmp = end - start + 1;
/* Don't create any OMITs if there would be too many. */
if (NumFullOmits + tmp >= MAX_FULL_OMITS) return E_2MANY_FULL;
for (tmp = start; tmp <= end; tmp++) {
if (!BexistsIntArray(FullOmitArray, NumFullOmits, tmp)) {
InsertIntoSortedArray(FullOmitArray, NumFullOmits, tmp);
NumFullOmits++;
}
}
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}
void
DumpOmits(void)
{
@@ -508,5 +514,15 @@ DumpOmits(void)
printf("\t%02d%c%02d\n", m+1, DateSep, d);
}
}
printf("Global Weekday OMITs:\n");
if (WeekdayOmits == 0) {
printf("\tNone.\n");
} else {
for (i=0; i<7; i++) {
if (WeekdayOmits & (1<<i)) {
printf("\t%s\n", EnglishDayName[i]);
}
}
}
}

View File

@@ -5,7 +5,7 @@
/* Function Prototypes. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -22,9 +22,11 @@
#define isempty(c) (isspace(c) || ((c) == '\\'))
#include "dynbuf.h"
#include <ctype.h>
int CallUserFunc (char const *name, int nargs, ParsePtr p);
int DoFset (ParsePtr p);
int DoFunset (ParsePtr p);
void ProduceCalendar (void);
char const *SimpleTime (int tim);
char const *CalendarTime (int tim, int duration);
@@ -143,7 +145,7 @@ int MoonPhase (int date, int time);
void HuntPhase (int startdate, int starttim, int phas, int *date, int *time);
int CompareRems (int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio, int untimed_first);
void SigIntHandler (int d);
void GotSigInt (void);
int GotSigInt (void);
void PurgeEchoLine(char const *fmt, ...);
void FreeTrig(Trigger *t);
void AppendTag(DynamicBuffer *buf, char const *s);
@@ -154,8 +156,8 @@ 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);
char const *Decolorize(void);
char const *Colorize(int r, int g, int b, int bg, int clamp);
void PrintJSONString(char const *s);
void PrintJSONKeyPairInt(char const *name, int val);
void PrintJSONKeyPairString(char const *name, char const *val);
@@ -170,3 +172,15 @@ void set_components_from_lat_and_long(void);
char const *get_day_name(int wkday);
char const *get_month_name(int mon);
int push_call(char const *filename, char const *func, int lineno);
void clear_callstack(void);
int have_callstack(void);
int print_callstack(FILE *fp);
void pop_call(void);
#ifdef REM_USE_WCHAR
#define _XOPEN_SOURCE 600
#include <wctype.h>
#include <wchar.h>
void PutWideChar(wchar_t const wc);
#endif

View File

@@ -5,7 +5,7 @@
/* Queue up reminders for subsequent execution. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -59,6 +59,7 @@ static QueuedRem *FindNextReminder (void);
static int CalculateNextTimeUsingSched (QueuedRem *q);
static void DaemonWait (struct timeval *sleep_tv);
static void reread (void);
static void PrintQueue(void);
/***************************************************************/
/* */
@@ -123,9 +124,10 @@ void HandleQueuedReminders(void)
Trigger trig;
struct timeval tv;
struct timeval sleep_tv;
struct sigaction sa;
/* Suppress the BANNER from being issued */
NumTriggered = 1;
DidMsgReminder = 1;
/* Turn off sorting -- otherwise, TriggerReminder has no effect! */
SortByDate = 0;
@@ -161,7 +163,11 @@ void HandleQueuedReminders(void)
q = q->next;
}
if (!DontFork || Daemon) signal(SIGINT, SigIntHandler);
if (!DontFork || Daemon) {
sa.sa_handler = SigIntHandler;
sa.sa_flags = 0;
(void) sigaction(SIGINT, &sa, NULL);
}
/* Sit in a loop, issuing reminders when necessary */
while(1) {
@@ -184,7 +190,9 @@ void HandleQueuedReminders(void)
while (TimeToSleep > 0L) {
SleepTime = TimeToSleep;
if (Daemon > 0 && SleepTime > (unsigned int) 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
case of laptop hibernation */
@@ -203,6 +211,10 @@ void HandleQueuedReminders(void)
sleep(SleepTime);
}
if (GotSigInt()) {
PrintQueue();
}
/* If not in daemon mode and day has rolled around,
exit -- not much we can do. */
if (!Daemon) {
@@ -230,7 +242,7 @@ void HandleQueuedReminders(void)
/* Do NOT trigger the reminder if tt.nexttime is more than a
minute in the past. This can happen if the clock is
changed or a laptop awakes from hibernation.
However, DO triger if tt.nexttime == tt.ttime so all
However, DO trigger if tt.nexttime == tt.ttime so all
queued reminders are triggered at least once. */
if ((SystemTime(1) - (q->tt.nexttime * 60) <= 60) ||
(q->tt.nexttime == q->tt.ttime)) {
@@ -335,13 +347,13 @@ static QueuedRem *FindNextReminder(void)
/***************************************************************/
/* */
/* GotSigInt */
/* PrintQueue */
/* */
/* Split out what's done on a SIGINT from the SIGINT Handler. */
/* This will be necessary for OS/2 multithreaded. */
/* For debugging: Print queue contents to STDOUT */
/* */
/***************************************************************/
void GotSigInt(void)
static
void PrintQueue(void)
{
QueuedRem *q = QueueHead;
@@ -366,6 +378,7 @@ void GotSigInt(void)
q = q->next;
}
printf(NL);
printf("To terminate program, send SIGQUIT (probably Ctrl-\\ on the keyboard.)%s", NL);
}
/***************************************************************/

View File

@@ -5,7 +5,7 @@
/* Print a PostScript calendar. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -349,7 +349,7 @@ int main(int argc, char *argv[])
!strcmp(DBufValue(&buf), PSBEGIN2)) {
if (!validfile) {
if (Verbose) {
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2021 by Dianne Skoll\n\n", VERSION);
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2022 by Dianne Skoll\n\n", VERSION);
fprintf(stderr, "Generating PostScript calendar\n");
}
}

View File

@@ -5,7 +5,7 @@
/* Define the PostScript prologue */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -13,7 +13,7 @@ char *PSProlog1[] =
{
"% This file was produced by Remind and Rem2PS, written by",
"% Dianne Skoll.",
"% Remind and Rem2PS are Copyright 1992-2021 Dianne Skoll.",
"% Remind and Rem2PS are Copyright 1992-2022 Dianne Skoll.",
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",

View File

@@ -5,7 +5,7 @@
/* Routines for sorting reminders by trigger date */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -4,9 +4,23 @@
ALL=`grep ^#define lang.h | grep -v '#define LANG' | awk '{print $2}'`
OUTPUT_COMPILED=lang-compiled.out
OUTPUT_RUNTIME=lang-runtime.out
cat /dev/null > $OUTPUT_COMPILED
cat /dev/null > $OUTPUT_RUNTIME
for i in $ALL ; do
make clean
make -j`nproc` all LANGDEF=-DLANG=$i || exit 1
./remind -q -r ../tests/tstlang.rem
./remind -q -r ../tests/tstlang.rem >> $OUTPUT_COMPILED 2>&1
done
# Rebuild English version
make clean
make -j`nproc` all || exit 1
ALL=`ls ../include/lang/*.rem`
for i in $ALL; do
./remind -q -r "-ii=\"$i\"" ../tests/tstlang.rem >> $OUTPUT_RUNTIME 2>&1
done
exit 0

View File

@@ -6,7 +6,7 @@
/* classifying the tokens parsed. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -62,6 +62,7 @@ Token TokArray[] = {
{ "friday", 3, T_WkDay, 4 },
{ "from", 4, T_Scanfrom, FROM_TYPE },
{ "fset", 4, T_Fset, 0 },
{ "funset", 6, T_Funset, 0 },
{ "if", 2, T_If, 0 },
{ "iftrig", 6, T_IfTrig, 0 },
{ "in", 2, T_In, 0 },
@@ -155,10 +156,6 @@ void FindToken(char const *s, Token *tok)
int top, bot, mid, r, max;
int l;
#if LANG != ENGLISH
size_t i;
#endif
tok->type = T_Illegal;
if (! *s) {
tok->type = T_Empty;
@@ -358,7 +355,8 @@ static int TokStrCmp(Token const *t, char const *s)
register int r;
char const *tk = t->name;
while(*tk && *s && !(*s == ',' && *(s+1) == 0)) {
r = tolower(*tk) - tolower(*s);
/* t->name is already lower-case */
r = *tk - tolower(*s);
tk++;
s++;
if (r) return r;
@@ -366,5 +364,5 @@ static int TokStrCmp(Token const *t, char const *s)
/* Ignore trailing commas on s */
if (!*s || (*s == ',' && !*(s+1))) return 0;
return (tolower(*tk) - tolower(*s));
return (*tk - tolower(*s));
}

View File

@@ -5,7 +5,7 @@
/* Routines for figuring out the trigger date of a reminder */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -530,7 +530,7 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
*err = OK;
/* But check for obvious problems... */
if (trig->localomit == 1 + 2 + 4 + 8 + 16 + 32 + 64) {
if ((WeekdayOmits | trig->localomit) == 0x7F) {
*err = E_2MANY_LOCALOMIT;
return -1;
}

View File

@@ -5,7 +5,7 @@
/* Type definitions all dumped here. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -155,7 +155,7 @@ enum TokTypes
/* Commands first */
T_Rem, T_Push, T_Pop, T_Preserve, T_Include, T_IncludeR, T_IncludeCmd, T_If, T_Else, T_EndIf,
T_IfTrig, T_ErrMsg,
T_Set, T_UnSet, T_Fset, T_Omit, T_Banner, T_Exit,
T_Set, T_UnSet, T_Fset, T_Funset, T_Omit, T_Banner, T_Exit,
T_AddOmit,
T_WkDay,
T_Month, T_Time, T_Date, T_DateTime,
@@ -238,6 +238,6 @@ typedef struct {
/* Pure JSON */
#define PSCAL_LEVEL3 3
#define TERMINAL_BACKGROUND_UNKNOWN 0
#define TERMINAL_BACKGROUND_DARK 1
#define TERMINAL_BACKGROUND_LIGHT 2
#define TERMINAL_BACKGROUND_UNKNOWN -1
#define TERMINAL_BACKGROUND_DARK 0
#define TERMINAL_BACKGROUND_LIGHT 1

View File

@@ -6,7 +6,7 @@
/* functions. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -32,6 +32,8 @@ typedef struct udf_struct {
Var *locals;
char IsActive;
int nargs;
char const *filename;
int lineno;
} UserFunc;
/* The hash table */
@@ -51,6 +53,34 @@ static void FSet (UserFunc *f);
static int SetUpLocalVars (UserFunc *f);
static void DestroyLocalVals (UserFunc *f);
/***************************************************************/
/* */
/* DoFunset */
/* */
/* Undefine a user-defined function - the FUNSET command. */
/* */
/***************************************************************/
int DoFunset(ParsePtr p)
{
int r;
int seen_one = 0;
DynamicBuffer buf;
DBufInit(&buf);
while(1) {
r = ParseIdentifier(p, &buf);
if (r == E_EOLN) {
DBufFree(&buf);
break;
}
seen_one = 1;
FUnset(DBufValue(&buf));
DBufFree(&buf);
}
if (seen_one) return OK;
return E_PARSE_ERR;
}
/***************************************************************/
/* */
/* DoFset */
@@ -93,6 +123,11 @@ int DoFset(ParsePtr p)
DBufFree(&buf);
return E_NO_MEM;
}
func->filename = StrDup(FileName);
if (!func->filename) {
return E_NO_MEM;
}
func->lineno = LineNo;
StrnCpy(func->name, DBufValue(&buf), VAR_NAME_LEN);
DBufFree(&buf);
if (!Hush) {
@@ -196,6 +231,9 @@ static void DestroyUserFunc(UserFunc *f)
/* Free the function definition */
if (f->text) free( (char *) f->text);
/* Free the filename */
if (f->filename) free( (char *) f->filename);
/* Free the data structure itself */
free(f);
}
@@ -306,7 +344,11 @@ int CallUserFunc(char const *name, int nargs, ParsePtr p)
/* Skip the opening bracket, if there's one */
while (isempty(*s)) s++;
if (*s == BEG_OF_EXPR) s++;
push_call(f->filename, f->name, f->lineno);
h = Evaluate(&s, f->locals, p);
if (h == OK) {
pop_call();
}
f->IsActive = 0;
DestroyLocalVals(f);
if (DebugFlag &DB_PRTEXPR) {

View File

@@ -5,7 +5,7 @@
/* Useful utility functions. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -24,8 +24,6 @@ static char const DontEscapeMe[] =
#include "globals.h"
#include "protos.h"
#define UPPER(c) toupper(c)
/***************************************************************/
/* */
/* StrnCpy */
@@ -68,12 +66,12 @@ int StrinCmp(char const *s1, char const *s2, int n)
register int r;
while (n && *s1 && *s2) {
n--;
r = UPPER(*s1) - UPPER(*s2);
r = toupper(*s1) - toupper(*s2);
if (r) return r;
s1++;
s2++;
}
if (n) return (UPPER(*s1) - UPPER(*s2)); else return 0;
if (n) return (toupper(*s1) - toupper(*s2)); else return 0;
}
/***************************************************************/
@@ -102,12 +100,12 @@ int StrCmpi(char const *s1, char const *s2)
{
int r;
while (*s1 && *s2) {
r = UPPER(*s1) - UPPER(*s2);
r = toupper(*s1) - toupper(*s2);
if (r) return r;
s1++;
s2++;
}
return UPPER(*s1) - UPPER(*s2);
return toupper(*s1) - toupper(*s2);
}
/***************************************************************/
@@ -130,24 +128,33 @@ int DateOK(int y, int m, int d)
/* Functions designed to defeat gcc optimizer */
int _private_div(int a, int b) { return a/b; }
int _private_add_overflow(int result, int b, int old)
int _private_mul_overflow(int a, int b)
{
if (b > 0 && result < old) return 1;
if (b < 0 && result > old) return 1;
return 0;
}
int _private_sub_overflow(int result, int b, int old)
{
if (b < 0 && result < old) return 1;
if (b > 0 && result > old) return 1;
double aa = (double) a;
double bb = (double) b;
if (aa*bb > (double) INT_MAX || aa*bb < (double) INT_MIN) {
return 1;
}
return 0;
}
int _private_unminus_overflow(int a, int b)
int _private_add_overflow(int a, int b)
{
if (a > 0 && b > 0) return 1;
if (a < 0 && b < 0) return 1;
double aa = (double) a;
double bb = (double) b;
if (aa+bb < (double) INT_MIN) return 1;
if (aa+bb > (double) INT_MAX) return 1;
return 0;
}
int _private_sub_overflow(int a, int b)
{
double aa = (double) a;
double bb = (double) b;
if (aa-bb < (double) INT_MIN) return 1;
if (aa-bb > (double) INT_MAX) return 1;
return 0;
}
@@ -162,3 +169,90 @@ ShellEscape(char const *in, DynamicBuffer *out)
}
return OK;
}
/* Call-stack for printing errors from user-defined functions */
typedef struct cs_s {
struct cs_s *next;
char const *filename;
char const *func;
int lineno;
} cs;
static cs *callstack = NULL;
static void
destroy_cs(cs *entry)
{
if (entry->filename) free( (void *) entry->filename);
if (entry->func) free( (void *) entry->func);
free( (void *) entry);
}
int
push_call(char const *filename, char const *func, int lineno)
{
cs *entry = NEW(cs);
if (!entry) {
return E_NO_MEM;
}
entry->next = NULL;
entry->filename = StrDup(filename);
entry->func = StrDup(func);
entry->lineno = lineno;
if (!entry->filename || !entry->func) {
destroy_cs(entry);
return E_NO_MEM;
}
entry->next = callstack;
callstack = entry;
return OK;
}
void
clear_callstack(void)
{
cs *entry = callstack;
cs *next;
while(entry) {
next = entry->next;
destroy_cs(entry);
entry = next;
}
callstack = NULL;
}
int
have_callstack(void)
{
if (callstack) return 1;
return 0;
}
static void
print_callstack_aux(FILE *fp, cs *entry)
{
if (entry) {
print_callstack_aux(fp, entry->next);
fprintf(fp, "\n");
(void) fprintf(fp, "%s(%d): In function `%s'", entry->filename, entry->lineno, entry->func);
}
}
int
print_callstack(FILE *fp)
{
print_callstack_aux(fp, callstack);
if (callstack) return 1;
return 0;
}
void
pop_call(void)
{
cs *entry = callstack;
if (entry) {
callstack = entry->next;
destroy_cs(entry);
}
}

269
src/var.c
View File

@@ -6,7 +6,7 @@
/* user- and system-defined variables. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Copyright (C) 1992-2022 by Dianne Skoll */
/* */
/***************************************************************/
@@ -19,12 +19,12 @@
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <locale.h>
#include "types.h"
#include "expr.h"
#include "globals.h"
#include "protos.h"
#include "err.h"
#define UPPER(c) (islower(c) ? toupper(c) : c)
/* The variable hash table */
@@ -40,6 +40,36 @@ static Var *VHashTbl[VAR_HASH_SIZE];
typedef int (*SysVarFunc)(int, Value *);
static double
strtod_in_c_locale(char const *str, char **endptr)
{
/* Get current locale */
char const *loc = setlocale(LC_NUMERIC, NULL);
double x;
/* If it failed, punt */
if (!loc) {
return strtod(str, endptr);
}
/* Set locale to C */
setlocale(LC_NUMERIC, "C");
x = strtod(str, endptr);
/* Back to original locale */
setlocale(LC_NUMERIC, loc);
/* If we got an error, try in original locale, but issue a warning */
if (**endptr) {
x = strtod(str, endptr);
if (!**endptr) {
Wprint("Accepting \"%s\" for $Latitude/$Longitude, but you should use the \"C\" locale decimal separator \".\" instead", str);
}
}
return x;
}
static void deprecated_var(char const *var, char const *instead)
{
if (DebugFlag & DB_PRTLINE) {
@@ -96,9 +126,16 @@ static int latitude_longitude_func(int do_set, Value *val, double *var, double m
char buf[64];
double x;
char *endptr;
char const *loc = setlocale(LC_NUMERIC, NULL);
if (!do_set) {
if (loc) {
setlocale(LC_NUMERIC, "C");
}
snprintf(buf, sizeof(buf), "%f", *var);
if (loc) {
setlocale(LC_NUMERIC, loc);
}
val->v.str = malloc(strlen(buf)+1);
if (!val->v.str) return E_NO_MEM;
strcpy(val->v.str, buf);
@@ -109,9 +146,7 @@ static int latitude_longitude_func(int do_set, Value *val, double *var, double m
x = (double) val->v.val;
} else {
if (val->type != STR_TYPE) return E_BAD_TYPE;
errno = 0;
x = strtod(val->v.str, &endptr);
if (errno) return E_BAD_TYPE;
x = strtod_in_c_locale(val->v.str, &endptr);
if (*endptr) return E_BAD_TYPE;
}
if (x < min) return E_2LOW;
@@ -135,10 +170,11 @@ static int latitude_func(int do_set, Value *val)
static int trig_date_func(int do_set, Value *val)
{
UNUSED(do_set);
val->type = DATE_TYPE;
if (!LastTrigValid) {
val->type = INT_TYPE;
val->v.val = 0;
} else {
val->type = DATE_TYPE;
val->v.val = LastTriggerDate;
}
return OK;
@@ -727,7 +763,6 @@ typedef struct {
void *value;
int min;
int max;
int (*validate)(void const *newvalue);
} SysVar;
/* If the type of a sys variable is STR_TYPE, then min is redefined
@@ -739,83 +774,107 @@ typedef struct {
/* All of the system variables sorted alphabetically */
static SysVar SysVarArr[] = {
/* name mod type value min/mal max validate*/
{"April", 1, STR_TYPE, &DynamicMonthName[3], 0, 0, NULL },
{"August", 1, STR_TYPE, &DynamicMonthName[7], 0, 0, NULL },
{"CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1, NULL },
{"CalMode", 0, INT_TYPE, &DoCalendar, 0, 0, NULL },
{"Daemon", 0, INT_TYPE, &Daemon, 0, 0, NULL },
{"DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0, NULL },
{"DateTimeSep", 1, SPECIAL_TYPE, datetime_sep_func, 0, 0, NULL },
{"December", 1, STR_TYPE, &DynamicMonthName[11],0, 0, NULL },
{"DefaultColor", 1, SPECIAL_TYPE, default_color_func, 0, 0, NULL },
{"DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999, NULL },
{"DefaultTDelta", 1, INT_TYPE, &DefaultTDelta, 0, 1440, NULL },
{"DeltaOffset", 0, INT_TYPE, &DeltaOffset, 0, 0, NULL },
{"DontFork", 0, INT_TYPE, &DontFork, 0, 0, NULL },
{"DontQueue", 0, INT_TYPE, &DontQueue, 0, 0, NULL },
{"DontTrigAts", 0, INT_TYPE, &DontIssueAts, 0, 0, NULL },
{"EndSent", 1, STR_TYPE, &EndSent, 0, 0, NULL },
{"EndSentIg", 1, STR_TYPE, &EndSentIg, 0, 0, NULL },
{"February", 1, STR_TYPE, &DynamicMonthName[1], 0, 0, NULL },
{"FirstIndent", 1, INT_TYPE, &FirstIndent, 0, 132, NULL },
{"FoldYear", 1, INT_TYPE, &FoldYear, 0, 1, NULL },
{"FormWidth", 1, INT_TYPE, &FormWidth, 20, 500, NULL },
{"Friday", 1, STR_TYPE, &DynamicDayName[4], 0, 0, NULL },
{"HushMode", 0, INT_TYPE, &Hush, 0, 0, NULL },
{"IgnoreOnce", 0, INT_TYPE, &IgnoreOnce, 0, 0, NULL },
{"InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0, NULL },
{"IntMax", 0, INT_TYPE, &IntMax, 0, 0, NULL },
{"IntMin", 0, INT_TYPE, &IntMin, 0, 0, NULL },
{"January", 1, STR_TYPE, &DynamicMonthName[0], 0, 0, NULL },
{"July", 1, STR_TYPE, &DynamicMonthName[6], 0, 0, NULL },
{"June", 1, STR_TYPE, &DynamicMonthName[5], 0, 0, NULL },
{"LatDeg", 1, SPECIAL_TYPE, latdeg_func, 0, 0, NULL },
{"Latitude", 1, SPECIAL_TYPE, latitude_func, 0, 0, NULL },
{"LatMin", 1, SPECIAL_TYPE, latmin_func, 0, 0, NULL },
{"LatSec", 1, SPECIAL_TYPE, latsec_func, 0, 0, NULL },
{"Location", 1, STR_TYPE, &Location, 0, 0, NULL },
{"LongDeg", 1, SPECIAL_TYPE, longdeg_func, 0, 0, NULL },
{"Longitude", 1, SPECIAL_TYPE, longitude_func, 0, 0, NULL },
{"LongMin", 1, SPECIAL_TYPE, longmin_func, 0, 0, NULL },
{"LongSec", 1, SPECIAL_TYPE, longsec_func, 0, 0, NULL },
{"March", 1, STR_TYPE, &DynamicMonthName[2], 0, 0, NULL },
{"MaxSatIter", 1, INT_TYPE, &MaxSatIter, 10, ANY, NULL },
{"MaxStringLen", 1, INT_TYPE, &MaxStringLen, -1, ANY, NULL },
{"May", 1, STR_TYPE, &DynamicMonthName[4], 0, 0, NULL },
{"MinsFromUTC", 1, INT_TYPE, &MinsFromUTC, -780, 780, NULL },
{"Monday", 1, STR_TYPE, &DynamicDayName[0], 0, 0, NULL },
{"NextMode", 0, INT_TYPE, &NextMode, 0, 0, NULL },
{"November", 1, STR_TYPE, &DynamicMonthName[10],0, 0, NULL },
{"NumQueued", 0, INT_TYPE, &NumQueued, 0, 0, NULL },
{"NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0, NULL },
{"October", 1, STR_TYPE, &DynamicMonthName[9], 0, 0, NULL },
{"PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo, 0, 0, NULL },
{"PSCal", 0, INT_TYPE, &PsCal, 0, 0, NULL },
{"RunOff", 0, INT_TYPE, &RunDisabled, 0, 0, NULL },
{"Saturday", 1, STR_TYPE, &DynamicDayName[5], 0, 0, NULL },
{"September", 1, STR_TYPE, &DynamicMonthName[8], 0, 0, NULL },
{"SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0, NULL },
{"SortByDate", 0, INT_TYPE, &SortByDate, 0, 0, NULL },
{"SortByPrio", 0, INT_TYPE, &SortByPrio, 0, 0, NULL },
{"SortByTime", 0, INT_TYPE, &SortByTime, 0, 0, NULL },
{"SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132, NULL },
{"Sunday", 1, STR_TYPE, &DynamicDayName[6], 0, 0, NULL },
{"T", 0, SPECIAL_TYPE, trig_date_func, 0, 0, NULL },
{"Td", 0, SPECIAL_TYPE, trig_day_func, 0, 0, NULL },
{"Thursday", 1, STR_TYPE, &DynamicDayName[3], 0, 0, NULL },
{"TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0, NULL },
{"Tm", 0, SPECIAL_TYPE, trig_mon_func, 0, 0, NULL },
{"Tuesday", 1, STR_TYPE, &DynamicDayName[1], 0, 0, NULL },
{"Tw", 0, SPECIAL_TYPE, trig_wday_func, 0, 0, NULL },
{"Ty", 0, SPECIAL_TYPE, trig_year_func, 0, 0, NULL },
{"U", 0, SPECIAL_TYPE, today_date_func, 0, 0, NULL },
{"Ud", 0, SPECIAL_TYPE, today_day_func, 0, 0, NULL },
{"Um", 0, SPECIAL_TYPE, today_mon_func, 0, 0, NULL },
{"UntimedFirst", 0, INT_TYPE, &UntimedBeforeTimed, 0, 0, NULL },
{"Uw", 0, SPECIAL_TYPE, today_wday_func, 0, 0, NULL },
{"Uy", 0, SPECIAL_TYPE, today_year_func, 0, 0, NULL },
{"Wednesday", 1, STR_TYPE, &DynamicDayName[2], 0, 0, NULL }
/* name mod type value min/mal max */
{"AddBlankLines", 1, INT_TYPE, &AddBlankLines, 0, 1 },
{"Ago", 1, STR_TYPE, &DynamicAgo, 0, 0 },
{"Am", 1, STR_TYPE, &DynamicAm, 0, 0 },
{"And", 1, STR_TYPE, &DynamicAnd, 0, 0 },
{"April", 1, STR_TYPE, &DynamicMonthName[3], 0, 0 },
{"At", 1, STR_TYPE, &DynamicAt, 0, 0 },
{"August", 1, STR_TYPE, &DynamicMonthName[7], 0, 0 },
{"CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1 },
{"CalMode", 0, INT_TYPE, &DoCalendar, 0, 0 },
{"Daemon", 0, INT_TYPE, &Daemon, 0, 0 },
{"DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0 },
{"DateTimeSep", 1, SPECIAL_TYPE, datetime_sep_func, 0, 0 },
{"December", 1, STR_TYPE, &DynamicMonthName[11],0, 0 },
{"DefaultColor", 1, SPECIAL_TYPE, default_color_func, 0, 0 },
{"DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999 },
{"DefaultTDelta", 1, INT_TYPE, &DefaultTDelta, 0, 1440 },
{"DeltaOffset", 0, INT_TYPE, &DeltaOffset, 0, 0 },
{"DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
{"DontQueue", 0, INT_TYPE, &DontQueue, 0, 0 },
{"DontTrigAts", 0, INT_TYPE, &DontIssueAts, 0, 0 },
{"EndSent", 1, STR_TYPE, &EndSent, 0, 0 },
{"EndSentIg", 1, STR_TYPE, &EndSentIg, 0, 0 },
{"February", 1, STR_TYPE, &DynamicMonthName[1], 0, 0 },
{"FirstIndent", 1, INT_TYPE, &FirstIndent, 0, 132 },
{"FoldYear", 1, INT_TYPE, &FoldYear, 0, 1 },
{"FormWidth", 1, INT_TYPE, &FormWidth, 20, 500 },
{"Friday", 1, STR_TYPE, &DynamicDayName[4], 0, 0 },
{"Fromnow", 1, STR_TYPE, &DynamicFromnow, 0, 0 },
{"Hour", 1, STR_TYPE, &DynamicHour, 0, 0 },
{"Hplu", 1, STR_TYPE, &DynamicHplu, 0, 0 },
{"HushMode", 0, INT_TYPE, &Hush, 0, 0 },
{"IgnoreOnce", 0, INT_TYPE, &IgnoreOnce, 0, 0 },
{"InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0 },
{"IntMax", 0, INT_TYPE, &IntMax, 0, 0 },
{"IntMin", 0, INT_TYPE, &IntMin, 0, 0 },
{"Is", 1, STR_TYPE, &DynamicIs, 0, 0 },
{"January", 1, STR_TYPE, &DynamicMonthName[0], 0, 0 },
{"July", 1, STR_TYPE, &DynamicMonthName[6], 0, 0 },
{"June", 1, STR_TYPE, &DynamicMonthName[5], 0, 0 },
{"LatDeg", 1, SPECIAL_TYPE, latdeg_func, 0, 0 },
{"Latitude", 1, SPECIAL_TYPE, latitude_func, 0, 0 },
{"LatMin", 1, SPECIAL_TYPE, latmin_func, 0, 0 },
{"LatSec", 1, SPECIAL_TYPE, latsec_func, 0, 0 },
{"Location", 1, STR_TYPE, &Location, 0, 0 },
{"LongDeg", 1, SPECIAL_TYPE, longdeg_func, 0, 0 },
{"Longitude", 1, SPECIAL_TYPE, longitude_func, 0, 0 },
{"LongMin", 1, SPECIAL_TYPE, longmin_func, 0, 0 },
{"LongSec", 1, SPECIAL_TYPE, longsec_func, 0, 0 },
{"March", 1, STR_TYPE, &DynamicMonthName[2], 0, 0 },
{"MaxSatIter", 1, INT_TYPE, &MaxSatIter, 10, ANY },
{"MaxStringLen", 1, INT_TYPE, &MaxStringLen, -1, ANY },
{"May", 1, STR_TYPE, &DynamicMonthName[4], 0, 0 },
{"MinsFromUTC", 1, INT_TYPE, &MinsFromUTC, -780, 780 },
{"Minute", 1, STR_TYPE, &DynamicMinute, 0, 0 },
{"Monday", 1, STR_TYPE, &DynamicDayName[0], 0, 0 },
{"Mplu", 1, STR_TYPE, &DynamicMplu, 0, 0 },
{"NextMode", 0, INT_TYPE, &NextMode, 0, 0 },
{"November", 1, STR_TYPE, &DynamicMonthName[10],0, 0 },
{"Now", 1, STR_TYPE, &DynamicNow, 0, 0 },
{"NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
{"NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
{"October", 1, STR_TYPE, &DynamicMonthName[9], 0, 0 },
{"On", 1, STR_TYPE, &DynamicOn, 0, 0 },
{"Pm", 1, STR_TYPE, &DynamicPm, 0, 0 },
{"PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo, 0, 0 },
{"PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
{"RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
{"Saturday", 1, STR_TYPE, &DynamicDayName[5], 0, 0 },
{"September", 1, STR_TYPE, &DynamicMonthName[8], 0, 0 },
{"SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
{"SortByDate", 0, INT_TYPE, &SortByDate, 0, 0 },
{"SortByPrio", 0, INT_TYPE, &SortByPrio, 0, 0 },
{"SortByTime", 0, INT_TYPE, &SortByTime, 0, 0 },
{"SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132 },
{"Sunday", 1, STR_TYPE, &DynamicDayName[6], 0, 0 },
{"SuppressLRM", 1, INT_TYPE, &SuppressLRM, 0, 1 },
{"SysInclude", 0, STR_TYPE, &SysDir, 0, 0 },
{"T", 0, SPECIAL_TYPE, trig_date_func, 0, 0 },
{"Td", 0, SPECIAL_TYPE, trig_day_func, 0, 0 },
{"TerminalBackground", 0, INT_TYPE, &TerminalBackground, 0, 0 },
{"Thursday", 1, STR_TYPE, &DynamicDayName[3], 0, 0 },
{"TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 },
{"Tm", 0, SPECIAL_TYPE, trig_mon_func, 0, 0 },
{"Today", 1, STR_TYPE, &DynamicToday, 0, 0 },
{"Tomorrow", 1, STR_TYPE, &DynamicTomorrow, 0, 0 },
{"Tuesday", 1, STR_TYPE, &DynamicDayName[1], 0, 0 },
{"Tw", 0, SPECIAL_TYPE, trig_wday_func, 0, 0 },
{"Ty", 0, SPECIAL_TYPE, trig_year_func, 0, 0 },
{"U", 0, SPECIAL_TYPE, today_date_func, 0, 0 },
{"Ud", 0, SPECIAL_TYPE, today_day_func, 0, 0 },
{"Um", 0, SPECIAL_TYPE, today_mon_func, 0, 0 },
{"UntimedFirst", 0, INT_TYPE, &UntimedBeforeTimed, 0, 0 },
{"Use256Colors", 0, INT_TYPE, &Use256Colors, 0, 0 },
{"UseBGVTColors", 0, INT_TYPE, &UseBGVTColors, 0, 0 },
{"UseTrueColors", 0, INT_TYPE, &UseTrueColors, 0, 0 },
{"UseVTColors", 0, INT_TYPE, &UseVTColors, 0, 0 },
{"Uw", 0, SPECIAL_TYPE, today_wday_func, 0, 0 },
{"Uy", 0, SPECIAL_TYPE, today_year_func, 0, 0 },
{"Was", 1, STR_TYPE, &DynamicWas, 0, 0 },
{"Wednesday", 1, STR_TYPE, &DynamicDayName[2], 0, 0 }
};
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
@@ -846,16 +905,7 @@ int SetSysVar(char const *name, Value *value)
DestroyValue(*value);
return r;
}
if (v->validate) {
if (v->type == STR_TYPE) {
r = (v->validate)((void *) value->v.str);
} else {
r = (v->validate)((void *) &(value->v.val));
}
if (r != OK) {
return r;
}
}
if (v->type == STR_TYPE) {
/* If it's already the same, don't bother doing anything */
if (!strcmp(value->v.str, (char const *) v->value)) {
@@ -969,6 +1019,7 @@ void DumpSysVarByName(char const *name)
static void DumpSysVar(char const *name, const SysVar *v)
{
char buffer[VAR_NAME_LEN+10];
Value vtmp;
if (name && !*name) name=NULL;
if (!v && !name) return; /* Shouldn't happen... */
@@ -982,32 +1033,20 @@ static void DumpSysVar(char const *name, const SysVar *v)
fprintf(ErrFp, "%16s ", buffer);
if (v) {
if (v->type == SPECIAL_TYPE) {
Value val;
SysVarFunc f = (SysVarFunc) v->value;
f(0, &val);
PrintValue(&val, ErrFp);
f(0, &vtmp);
PrintValue(&vtmp, ErrFp);
putc('\n', ErrFp);
DestroyValue(val);
DestroyValue(vtmp);
} else if (v->type == STR_TYPE) {
char const *s = *((char **)v->value);
int y;
putc('"', ErrFp);
for (y=0; y<MAX_PRT_LEN && *s; y++) {
if (*s == '"') {
fprintf(ErrFp, "\" + char(34) + \"");
s++;
} else {
putc(*s++, ErrFp);
}
}
putc('"', ErrFp);
if (*s) fprintf(ErrFp, "...");
vtmp.type = STR_TYPE;
vtmp.v.str = * ((char **)v->value);
PrintValue(&vtmp, ErrFp);
putc('\n', ErrFp);
} else if (v->type == DATE_TYPE) {
Value val;
val.type = DATE_TYPE;
val.v.val = * (int *) v->value;
PrintValue(&val, ErrFp);
vtmp.type = DATE_TYPE;
vtmp.v.val = * (int *) v->value;
PrintValue(&vtmp, ErrFp);
putc('\n', ErrFp);
} else {
if (!v->modifiable) fprintf(ErrFp, "%d\n", *((int *)v->value));

49
tests/ansicolors.rem Normal file
View File

@@ -0,0 +1,49 @@
BANNER %
MSG TerminalBackground is: [$TerminalBackground]%
MSG UseVTColors is: [$UseVTColors]%
MSG Use256Colors is: [$Use256Colors]%
MSG UseTrueColors is: [$UseTrueColors]%
MSG UseBGVTColors is: [$UseBGVTColors]%
set n ansicolor("")]
MSG This is [ansicolor(0,255,0)]green[n], [ansicolor("255 0 0")]red[n] and [ansicolor("0 0 255")]blue[n] text.%
MSG This is [ansicolor(0,0,0)][ansicolor(0,255,0,1)]black text on a green background[n]%
MSG This is [ansicolor(0,0,0,0,1)]clamped black text[n]%
MSG This is [ansicolor(255,255,255,0,1)]clamped white text[n]
FLUSH
# Test that MSF ignores ansi color sequences
set r ansicolor(255, 0, 0)
set g ansicolor(0, 255, 0)
set b ansicolor(0, 0, 255)
set n ansicolor("")
REM MSF Here we have a formatted reminder. It should be word-wrapped nicely and neatly by Remind. Although it is very long and unwieldy, the MSF keyword will wrap it so it's pleasantly readable.%_Here we have a formatted reminder. It should be word-wrapped nicely and neatly by Remind. Although it is very long and unwieldy, the MSF keyword will wrap it so it's pleasantly readable.
# Should have exactly the same word breaks
REM MSF [r]Here [g]we [b]have [r]a [g]formatted [b]reminder. [r]It [g]should[b] be [r]word-wrapped[g] nicely [b]and [r]neatly [g]by Remind. [b]Although [r]it [g]is [b]very [r]long [g]and [b]u[r]n[g]w[b]i[r]e[g]l[b]d[r]y[g], [r]the [g]MSF [b]keyword [r]will [r] [g] [b] [g]wrap [b]it [r]so [g]it's [b]pleasantly [r]readable.[n]%_[r]Here [g]we [b]have [r]a [g]formatted [b]reminder. [r]It [g]should[b] be [r]word-wrapped[g] nicely [b]and [r]neatly [g]by Remind. [b]Although [r]it [g]is [b]very [r]long [g]and [b]u[r]n[g]w[b]i[r]e[g]l[b]d[r]y[g], [r]the [g]MSF [b]keyword [r]will [r] [g] [b] [g]wrap [b]it [r]so [g]it's [b]pleasantly [r]readable.[n]
REM MSF Εδώ έχουμε μια μορφοποιημένη υπενθύμιση. Θα πρέπει να είναι τυλιγμένο με λέξεις όμορφα και τακτοποιημένα από το Remind. Αν και είναι πολύ μακρύ και δυσκίνητο, η λέξη-κλειδί των ΓΧΣ θα το τυλίξει έτσι ώστε να είναι ευχάριστα ευανάγνωστο. 🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅%_Εδώ έχουμε μια μορφοποιημένη υπενθύμιση. Θα πρέπει να είναι τυλιγμένο με λέξεις όμορφα και τακτοποιημένα από το Remind. Αν και είναι πολύ μακρύ και δυσκίνητο, η λέξη-κλειδί των ΓΧΣ θα το τυλίξει έτσι ώστε να είναι ευχάριστα ευανάγνωστο. 🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅
REM MSF [r]Εδώ [g]έχουμε [b]μια [r]μ[g]ο[b]ρ[r]φοποιημένη[n] υπενθύμιση. Θα πρέπει να είναι τυλιγμένο με λέξεις όμορφα και τακτοποιημένα από το Remind. Αν και είναι πολύ μακρύ και δυσκίνητο, η λέξη-κλειδί των ΓΧΣ θα το τυλίξει έτσι ώστε να είναι ευχάριστα ευανάγνωστο. 🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅%_[r]Εδώ [g]έχουμε [b]μια [r]μ[g]ο[b]ρ[r]φοποιημένη[n] υπενθύμιση. Θα πρέπει να είναι τυλιγμένο με λέξεις όμορφα και τακτοποιημένα από το Remind. Αν και είναι πολύ μακρύ και δυσκίνητο, η λέξη-κλειδί των ΓΧΣ θα το τυλίξει έτσι ώστε να είναι ευχάριστα ευανάγνωστο. 🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅🌅 🌅 🌅 🌅 🌅
FLUSH
# Some invalid combos
set a ansicolor(1)
set a ansicolor(-1, 0, 0)
set a ansicolor(42, 42, 256)
set a ansicolor("foo")
set a ansicolor("1 1")
set a ansicolor("-1 -1 0");
set a ansicolor("256 1 1");
set a ansicolor(128, 128, 128, 2)
set a ansicolor(128, 128, 128, -1)
set a ansicolor(128, 128, 128, 0, 2)
set a ansicolor(128, 128, 128, 0, -1)
set a ansicolor(128,0,0)
set str a + "foo: 🌅"
set w columns(str)
MSG Width of [str] is: [w]

Some files were not shown because too many files have changed in this diff Show More