Compare commits

...

57 Commits

Author SHA1 Message Date
Dianne Skoll
6750a393f1 Add comment.
All checks were successful
Remind unit tests / tests (push) Successful in 3m33s
2024-11-06 11:54:30 -05:00
Dianne Skoll
e18cd72791 Add Japanese holidays courtesy of Brandon Wilson. 2024-11-06 11:49:57 -05:00
Dianne Skoll
6e1dc7dcd7 Don't SET any variables in holiday files.
All checks were successful
Remind unit tests / tests (push) Successful in 31s
2024-11-03 13:19:11 -05:00
Dianne Skoll
bf193250cc Don't SET any variables in a holiday file. 2024-11-03 13:18:16 -05:00
Dianne Skoll
2c5eeb02f6 Merge branch 'holidays_de' into 'master'
Add German holidays

See merge request dskoll/remind!6
2024-11-03 17:54:47 +00:00
Jochen Sprickerhof
5cd343c27c Add German holidays 2024-11-03 18:42:08 +01:00
Dianne Skoll
81b48b70c4 Change include policy so regional files do not include the country file. 2024-11-03 11:28:31 -05:00
Dianne Skoll
5e738020a7 Make a note about include ca.rem directly
All checks were successful
Remind unit tests / tests (push) Successful in 32s
2024-11-02 18:03:18 -04:00
Dianne Skoll
7949341037 Split Canadian holidays by province. 2024-11-02 16:59:20 -04:00
Dianne Skoll
f4d8331456 Clarify invocation commandlines.
All checks were successful
Remind unit tests / tests (push) Successful in 30s
2024-11-02 10:45:05 -04:00
Dianne Skoll
17beef5ce6 Use a much shorter static size for dynamic buffers.
All checks were successful
Remind unit tests / tests (push) Successful in 32s
Most strings are pretty short.
2024-11-01 16:40:44 -04:00
Dianne Skoll
aaae80d02b Update manual to reflect that iif() and choose() only evaluate arguments needed for the final result.
All checks were successful
Remind unit tests / tests (push) Successful in 25s
2024-10-21 23:35:41 -04:00
Dianne Skoll
e97de16203 Clarify that arg of OMITFUNC must be a user-defined function.
All checks were successful
Remind unit tests / tests (push) Successful in 27s
2024-10-21 08:58:36 -04:00
Dianne Skoll
d5e38ee3b4 Fix typo in test.rem.
All checks were successful
Remind unit tests / tests (push) Successful in 28s
2024-10-18 11:26:41 -04:00
Dianne Skoll
11594aee2d Rename configure.in to configure.ac to avoid autoreconf warning. 2024-10-18 11:21:41 -04:00
Dianne Skoll
711f0b6c69 Rename contrib/ical2rem-0.7.1 to contrib/ical2rem-0.8
All checks were successful
Remind unit tests / tests (push) Successful in 29s
2024-10-17 15:29:15 -04:00
Dianne Skoll
87a8b9811d Update to upstream 0.8. 2024-10-17 15:28:42 -04:00
Dianne Skoll
689b1d0e13 Rebuild src/config.h.in with autoreconf
All checks were successful
Remind unit tests / tests (push) Successful in 30s
2024-10-17 13:19:53 -04:00
Dianne Skoll
a8650e888f Add comment to AC_DEFINE_UNQUOTED 2024-10-17 13:17:44 -04:00
Dianne Skoll
dea2aed628 Update release notes.
All checks were successful
Remind unit tests / tests (push) Successful in 32s
2024-10-16 13:23:04 -04:00
Dianne Skoll
5618b928e0 Add National Day for Truth and Reconciliation 2024-10-16 13:13:01 -04:00
Dianne Skoll
91187c4c60 Include Remind version in Options dialog. 2024-10-16 10:00:04 -04:00
Dianne Skoll
636ae8f21a Include TkRemind version in title bar.
All checks were successful
Remind unit tests / tests (push) Successful in 30s
2024-10-15 14:59:09 -04:00
Dianne Skoll
405398b226 Use % instead of @ for substitution to avoid possible autoconf conflicts. 2024-10-15 14:56:25 -04:00
Dianne Skoll
0df3a903b1 Remove useless comment. 2024-10-15 14:54:25 -04:00
Dianne Skoll
eac07d212c Bump version to 05.00.07
All checks were successful
Remind unit tests / tests (push) Successful in 29s
2024-10-15 11:55:40 -04:00
Dianne Skoll
96da3a6596 Add note about safety of eval remind --print-config-cmd 2024-10-15 11:22:42 -04:00
Dianne Skoll
94ef20d702 Make sure string is well-formed C 2024-10-15 11:18:16 -04:00
Dianne Skoll
c9c309e436 Document how to use --print-config-cmd 2024-10-15 10:36:55 -04:00
Dianne Skoll
52c973509b Add --print-config-cmd long option. 2024-10-15 10:32:01 -04:00
Dianne Skoll
c192c580da Fix permissions.
All checks were successful
Remind unit tests / tests (push) Successful in 27s
2024-10-14 08:41:00 -04:00
Dianne Skoll
235e5ec1c7 Make ./configure generate tkremind from tkremind.in. 2024-10-14 08:40:05 -04:00
Dianne Skoll
3d30173f9a Print version info in options window. 2024-10-14 08:36:44 -04:00
Dianne Skoll
8b0bbc9fb7 Remove obsolete comment.
All checks were successful
Remind unit tests / tests (push) Successful in 28s
2024-10-13 10:35:33 -04:00
Dianne Skoll
c57d2fd52a Tweak "astro" example. 2024-10-13 10:33:38 -04:00
Dianne Skoll
2970591187 Add a couple more examples.
All checks were successful
Remind unit tests / tests (push) Successful in 31s
2024-10-12 12:47:17 -04:00
Dianne Skoll
23ec559ddf Fix typo 2024-10-12 12:47:04 -04:00
Dianne Skoll
302bc5a5de Make hash table sizes prime numbers instead of powers of two. 2024-10-12 10:24:22 -04:00
Dianne Skoll
950c0b3747 Use HashPJW for hasing user-defined function names and variable names.
All checks were successful
Remind unit tests / tests (push) Successful in 26s
2024-10-12 10:17:50 -04:00
Dianne Skoll
ad382fea25 Print hash-table statistics with "-ds" debugging.
Some checks failed
Remind unit tests / tests (push) Failing after 29s
2024-10-11 16:34:11 -04:00
Dianne Skoll
a66e855ca7 Remove dead code; remove unnecessary catch { ... } 2024-10-11 16:00:47 -04:00
Dianne Skoll
a1b814d6b1 Allow "hostname" to fail.
All checks were successful
Remind unit tests / tests (push) Successful in 27s
2024-10-10 11:43:26 -04:00
Dianne Skoll
62030719bb Set app name to tkremind.
All checks were successful
Remind unit tests / tests (push) Successful in 30s
2024-10-02 11:08:17 -04:00
Dianne Skoll
985816dc32 Document that system notifications work if notify-send is installed. 2024-10-02 11:05:38 -04:00
Dianne Skoll
a131a53132 Fix typos. 2024-10-02 11:05:27 -04:00
Dianne Skoll
c5e723b6ac Use "notify-send" if Tk < 9.0 2024-10-02 11:00:28 -04:00
Dianne Skoll
3fe2b88e65 Document "Use system notifications when issuing a reminder" 2024-10-02 09:26:11 -04:00
Dianne Skoll
54603090ee Use "tk sysnotify" if we have it.
All checks were successful
Remind unit tests / tests (push) Successful in 39s
2024-10-01 11:02:32 -04:00
Dianne Skoll
2514b3681f Make tkremind work with Tcl/Tk 9.0.
All checks were successful
Remind unit tests / tests (push) Successful in 35s
2024-09-30 11:40:03 -04:00
Dianne Skoll
0b7b101814 Accept Tk >= 8.5 including 9.0 2024-09-30 11:26:30 -04:00
Dianne Skoll
3ac1c622fd Update ical2rem to upstream 0.7.1.
All checks were successful
Remind unit tests / tests (push) Successful in 30s
2024-09-19 16:14:23 -04:00
Dianne Skoll
7878f6623c Fix typo
All checks were successful
Remind unit tests / tests (push) Successful in 35s
2024-09-16 14:48:57 -04:00
Dianne Skoll
00ad38e5fe Put N_ERROR at the end. 2024-09-16 14:47:09 -04:00
Dianne Skoll
10ae0b0077 Add DEBUG +s test. 2024-09-16 14:43:37 -04:00
Dianne Skoll
e032f3315d Mark a freshly-allocated node of type N_ERROR rather than N_FREE. 2024-09-16 14:41:30 -04:00
Dianne Skoll
a38fd95a90 Add guard against double-free of expr_node. 2024-09-16 14:39:26 -04:00
Dianne Skoll
9f7609b2c6 Fix typo. Sigh. 2024-09-16 09:48:50 -04:00
50 changed files with 1028 additions and 402 deletions

1
.gitignore vendored
View File

@@ -22,6 +22,7 @@ rem2pdf/Makefile.PL
rem2pdf/Makefile.old
rem2pdf/Makefile.top
rem2pdf/bin/rem2pdf
scripts/tkremind
set-irc-topic
src/*.tar.gz*
src/Makefile

View File

@@ -24,7 +24,7 @@ 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
-rm man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind
-$(MAKE) -C src clean
-$(MAKE) -C rem2pdf clean

29
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for remind 05.00.06.
# Generated by GNU Autoconf 2.71 for remind 05.00.07.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -608,8 +608,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='remind'
PACKAGE_TARNAME='remind'
PACKAGE_VERSION='05.00.06'
PACKAGE_STRING='remind 05.00.06'
PACKAGE_VERSION='05.00.07'
PACKAGE_STRING='remind 05.00.07'
PACKAGE_BUGREPORT=''
PACKAGE_URL='https://dianne.skoll.ca/projects/remind/'
@@ -651,6 +651,7 @@ LIBOBJS
RELEASE_DATE
PERLARTIFACTS
VERSION
CONFIG_CMD
PERL
SET_MAKE
LN_S
@@ -1264,7 +1265,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures remind 05.00.06 to adapt to many kinds of systems.
\`configure' configures remind 05.00.07 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1326,7 +1327,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of remind 05.00.06:";;
short | recursive ) echo "Configuration of remind 05.00.07:";;
esac
cat <<\_ACEOF
@@ -1414,7 +1415,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
remind configure 05.00.06
remind configure 05.00.07
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1864,7 +1865,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by remind $as_me 05.00.06, which was
It was created by remind $as_me 05.00.07, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -4198,11 +4199,17 @@ fi
VERSION=$PACKAGE_VERSION
CONFIG_CMD="$0$ac_configure_args_raw"
CONFIG_CMD=`echo "$CONFIG_CMD" | sed -e 's/"/\\\\"/g'`
printf "%s\n" "#define CONFIG_CMD \"$CONFIG_CMD\"" >>confdefs.h
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1"
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4703,7 +4710,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by remind $as_me 05.00.06, which was
This file was extended by remind $as_me 05.00.07, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4768,7 +4775,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
remind config.status 05.00.06
remind config.status 05.00.07
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
@@ -4903,6 +4910,7 @@ do
"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" ;;
"scripts/tkremind") CONFIG_FILES="$CONFIG_FILES scripts/tkremind" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -5490,4 +5498,5 @@ printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2
fi
chmod a+x rem2pdf/bin/rem2pdf
chmod a+x scripts/tkremind

View File

@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(remind, 05.00.06, , , https://dianne.skoll.ca/projects/remind/)
AC_INIT(remind, 05.00.07, , , https://dianne.skoll.ca/projects/remind/)
AC_CONFIG_SRCDIR([src/queue.c])
cat <<'EOF'
@@ -87,10 +87,15 @@ fi
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp setenv unsetenv glob mbstowcs setlocale initgroups inotify_init1)
VERSION=$PACKAGE_VERSION
CONFIG_CMD="$0$ac_configure_args_raw"
CONFIG_CMD=`echo "$CONFIG_CMD" | sed -e 's/"/\\\\"/g'`
AC_DEFINE_UNQUOTED([CONFIG_CMD], ["$CONFIG_CMD"], [Configuration command used to build Remind])
AC_SUBST(CONFIG_CMD)
AC_SUBST(VERSION)
AC_SUBST(PERL)
AC_SUBST(PERLARTIFACTS)
AC_SUBST(RELEASE_DATE)
AC_CONFIG_FILES([src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1])
AC_CONFIG_FILES([src/Makefile www/Makefile src/version.h rem2html/Makefile rem2html/rem2html rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf man/rem.1 man/rem2ps.1 man/remind.1 man/tkremind.1 scripts/tkremind])
AC_OUTPUT
chmod a+x rem2pdf/bin/rem2pdf
chmod a+x scripts/tkremind

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019 Justin B. Alcorn
Copyright (c) 2005, 2007, 2019 Justin B. Alcorn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -3,53 +3,65 @@
# ical2rem.pl -
# Reads iCal files and outputs remind-compatible files. Tested ONLY with
# calendar files created by Mozilla Calendar/Sunbird. Use at your own risk.
# Copyright (c) 2005, 2007, Justin B. Alcorn
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# MIT License
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Copyright (c) 2005, 2007, 2019 Justin B. Alcorn
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# version 0.8 2024-10-16
# - Issue 9. Remove extra day notation on all day events.
# version 0.7.1 2024-09-19
# - Made sure license statements were consistent
# version 0.7 2024-09-04
# - Added dummy _sfun to resolve Issue #8
# version 0.6 2019-03-01
# - Updates to put on GitHub
# version 0.5.2 2007-03-23
# - BUG: leadtime for recurring events had a max of 4 instead of DEFAULT_LEAD_TIME
# - remove project-lead-time, since Category was a non-standard attribute
# - NOTE: There is a bug in iCal::Parser v1.14 that causes multiple calendars to
# fail if a calendar with recurring events is followed by a calendar with no
# recurring events. This has been reported to the iCal::Parser author.
# - BUG: leadtime for recurring events had a max of 4 instead of DEFAULT_LEAD_TIME
# - remove project-lead-time, since Category was a non-standard attribute
# - NOTE: There is a bug in iCal::Parser v1.14 that causes multiple calendars to
# fail if a calendar with recurring events is followed by a calendar with no
# recurring events. This has been reported to the iCal::Parser author.
# version 0.5.1 2007-03-21
# - BUG: Handle multiple calendars on STDIN
# - add --heading option for priority on section headers
# - BUG: Handle multiple calendars on STDIN
# - add --heading option for priority on section headers
# 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
# - Add more help options
# - --project-lead-time option
# - Supress 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
# - Change to pipe
# - Add --label, --help options
# - Add Help Text
# - Change to subroutines
# - Efficiency and Cleanup
# - Version 0.4 changes all written or inspired by, and thanks to Mark Stosberg
# - Change to GetOptions
# - Change to pipe
# - Add --label, --help options
# - Add Help Text
# - Change to subroutines
# - Efficiency and Cleanup
# version 0.3
# - Convert to GPL (Thanks to Mark Stosberg)
# - Add usage
# - Convert to GPL (Thanks to Mark Stosberg)
# - Add usage
# version 0.2
# - add command line switches
# - add debug code
# - add SCHED _sfun keyword
# - fix typos
# - add command line switches
# - add debug code
# - add SCHED _sfun keyword
# - fix typos
# version 0.1 - ALPHA CODE.
=head1 SYNOPSIS
@@ -57,19 +69,19 @@
cat /path/to/file*.ics | ical2rem.pl > ~/.ical2rem
All options have reasonable defaults:
--label Calendar name (Default: Calendar)
--label Calendar name (Default: Calendar)
--start Start of time period to parse (parsed by str2time)
--end End of time period to parse
--lead-time Advance days to start reminders (Default: 3)
--lead-time Advance days to start reminders (Default: 3)
--todos, --no-todos Process Todos? (Default: Yes)
--iso8601 Use YYYY-MM-DD date format
--iso8601 Use YYYY-MM-DD date format
--locations, --no-locations Include location? (Default: Yes)
--end-times, --no-end-times Include event end times in reminder text
(Default: No)
--heading Define a priority for static entries
--help Usage
--debug Enable debug output
--man Complete man page
--help Usage
--debug Enable debug output
--man Complete man page
Expects an ICAL stream on STDIN. Converts it to the format
used by the C<remind> script and prints it to STDOUT.
@@ -137,18 +149,18 @@ my $end;
my $label = 'Calendar';
GetOptions (
"label=s" => \$label,
"start=s" => \$start,
"end=s" => \$end,
"lead-time=i" => \$DEFAULT_LEAD_TIME,
"todos!" => \$PROCESS_TODOS,
"iso8601!" => \$iso8601,
"locations!" => \$do_location,
"end-times!" => \$do_end_times,
"heading=s" => \$HEADING,
"help|?" => \$help,
"debug" => \$debug,
"man" => \$man
"label=s" => \$label,
"start=s" => \$start,
"end=s" => \$end,
"lead-time=i" => \$DEFAULT_LEAD_TIME,
"todos!" => \$PROCESS_TODOS,
"iso8601!" => \$iso8601,
"locations!" => \$do_location,
"end-times!" => \$do_end_times,
"heading=s" => \$HEADING,
"help|?" => \$help,
"debug" => \$debug,
"man" => \$man
) or pod2usage(1);
pod2usage(1) if $help;
pod2usage(-verbose => 2) if $man;
@@ -159,11 +171,11 @@ my @calendars;
my $in;
while (<>) {
$in .= $_;
if (/END:VCALENDAR/) {
push(@calendars,$in);
$in = "";
}
$in .= $_;
if (/END:VCALENDAR/) {
push(@calendars,$in);
$in = "";
}
}
print STDERR "Read all calendars\n" if $debug;
my(%parser_opts) = ("debug" => $debug);
@@ -192,57 +204,57 @@ print STDERR "Calendars parsed\n" if $debug;
# expects 'todos' hashref from iCal::Parser is input
# returns String to output
sub _process_todos {
my $todos = shift;
my ($todo, @newtodos, $leadtime);
my $output = "";
my $todos = shift;
my ($todo, @newtodos, $leadtime);
my $output = "";
$output .= 'REM '.$HEADING.' MSG '.$label.' ToDos:%"%"%'."\n";
$output .= 'REM '.$HEADING.' MSG '.$label.' ToDos:%"%"%'."\n";
# For sorting, make sure everything's got something
# To sort on.
my $now = DateTime->now;
for $todo (@{$todos}) {
# remove completed items
if ($todo->{'STATUS'} && $todo->{'STATUS'} eq 'COMPLETED') {
next;
} elsif ($todo->{'DUE'}) {
# All we need is a due date, everything else is sugar
$todo->{'SORT'} = $todo->{'DUE'}->clone;
} elsif ($todo->{'DTSTART'}) {
# for sorting, sort on start date if there's no due date
$todo->{'SORT'} = $todo->{'DTSTART'}->clone;
} else {
# if there's no due or start date, just make it now.
$todo->{'SORT'} = $now;
}
push(@newtodos,$todo);
}
if (! (scalar @newtodos)) {
return "";
}
my $now = DateTime->now;
for $todo (@{$todos}) {
# remove completed items
if ($todo->{'STATUS'} && $todo->{'STATUS'} eq 'COMPLETED') {
next;
} elsif ($todo->{'DUE'}) {
# All we need is a due date, everything else is sugar
$todo->{'SORT'} = $todo->{'DUE'}->clone;
} elsif ($todo->{'DTSTART'}) {
# for sorting, sort on start date if there's no due date
$todo->{'SORT'} = $todo->{'DTSTART'}->clone;
} else {
# if there's no due or start date, just make it now.
$todo->{'SORT'} = $now;
}
push(@newtodos,$todo);
}
if (! (scalar @newtodos)) {
return "";
}
# Now sort on the new Due dates and print them out.
for $todo (sort { DateTime->compare($a->{'SORT'}, $b->{'SORT'}) } @newtodos) {
my $due = $todo->{'SORT'}->clone();
my $priority = "";
if (defined($todo->{'PRIORITY'})) {
if ($todo->{'PRIORITY'} == 1) {
$priority = "PRIORITY 1000";
} elsif ($todo->{'PRIORITY'} == 3) {
$priority = "PRIORITY 7500";
}
}
if (defined($todo->{'DTSTART'}) && defined($todo->{'DUE'})) {
# Lead time is duration of task + lead time
my $diff = ($todo->{'DUE'}->delta_days($todo->{'DTSTART'})->days())+$DEFAULT_LEAD_TIME;
$leadtime = "+".$diff;
} else {
$leadtime = "+".$DEFAULT_LEAD_TIME;
}
$output .= "REM ".$due->month_abbr." ".$due->day." ".$due->year." $leadtime $priority MSG \%a $todo->{'SUMMARY'}\%\"\%\"\%\n";
}
$output .= 'REM '.$HEADING.' MSG %"%"%'."\n";
return $output;
for $todo (sort { DateTime->compare($a->{'SORT'}, $b->{'SORT'}) } @newtodos) {
my $due = $todo->{'SORT'}->clone();
my $priority = "";
if (defined($todo->{'PRIORITY'})) {
if ($todo->{'PRIORITY'} == 1) {
$priority = "PRIORITY 1000";
} elsif ($todo->{'PRIORITY'} == 3) {
$priority = "PRIORITY 7500";
}
}
if (defined($todo->{'DTSTART'}) && defined($todo->{'DUE'})) {
# Lead time is duration of task + lead time
my $diff = ($todo->{'DUE'}->delta_days($todo->{'DTSTART'})->days())+$DEFAULT_LEAD_TIME;
$leadtime = "+".$diff;
} else {
$leadtime = "+".$DEFAULT_LEAD_TIME;
}
$output .= "REM ".$due->month_abbr." ".$due->day." ".$due->year." $leadtime $priority MSG \%a $todo->{'SUMMARY'}\%\"\%\"\%\n";
}
$output .= 'REM '.$HEADING.' MSG %"%"%'."\n";
return $output;
}
@@ -274,7 +286,7 @@ foreach $yearkey (sort keys %{$events} ) {
DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'})
} keys %{$dayevents}) {
my $event = $dayevents->{$uid};
if ($eventsbyuid{$uid}) {
if ($eventsbyuid{$uid}) {
my $curreventday = $event->{'DTSTART'}->clone;
$curreventday->truncate( to => 'day' );
$eventsbyuid{$uid}{$curreventday->epoch()} =1;
@@ -283,13 +295,17 @@ foreach $yearkey (sort keys %{$events} ) {
$event->{'LEADTIME'} = $i;
}
}
# Issue 9. Multi-day events have extra day with zero time. Mark this as the date not needed in reminders file so we can skip later
# Repeating multi-day events have the same uid so we need to mark each one.
if ($event->{'DTSTART'} eq $event->{'DTEND'} and $event->{'DTEND'}->hour eq 0 and $event->{'DTEND'}->minute eq 0 and $event->{'DTEND'}->second eq 0) {
$eventsbyuid{$uid}{$event->{'DTSTART'}->ymd} = 'rm';
}
} else {
$eventsbyuid{$uid} = $event;
my $curreventday = $event->{'DTSTART'}->clone;
$curreventday->truncate( to => 'day' );
$eventsbyuid{$uid}{$curreventday->epoch()} =1;
}
}
}
}
@@ -312,6 +328,10 @@ foreach $yearkey (sort keys %{$events} ) {
my $start = $event->{'DTSTART'};
my $end = $event->{'DTEND'};
my $duration = "";
# Issue 9. All Day events create an event that has zero length and DTSTART and DTEND at 00:00 on last day. Marked while handling multi-day events. Ignore these
if ($start eq $end and $eventsbyuid{$uid}{$start->ymd} and $eventsbyuid{$uid}{$start->ymd} eq 'rm') {
next;
}
if ($end and ($start->hour or $start->minute or $end->hour or $end->minute)) {
# We need both an HH:MM version of the delta, to put in the
# DURATION specifier, and a human-readable version of the
@@ -373,4 +393,4 @@ sub quote {
}
exit 0;
#:vim set ft=perl ts=4 sts=4 expandtab :
#:vim set ft=perl ts=4 sts=4 tabstop=4 expandtab :

View File

@@ -1,5 +1,35 @@
CHANGES TO REMIND
* VERSION 5.0 Patch 7 - 2024-10-16
- NEW FEATURE: tkremind: Add option to create a desktop notification when
a queued reminder is triggered. For Tcl/Tk 9.0 or later, uses the native
"tk sysnotify" facility. For earlier versions of Tcl/Tk, executes the
"notify-send" program if possible.
- NEW FEATURE: remind: Add --print-config-cmd option which prints the
exact ./configure command used to build Remind. This will let you
configure future Remind releases exactly the same way an installed
version was configured.
- UPDATE: include/holidays/ca.rem: Add National Day for Truth and
Reconciliation to Canadian holiday list.
- MINOR IMPROVEMENTS: Update examples/ansitext and examples/astro
- MINOR IMPROVEMENT: remind: Use HashPJW to hash variable and function
names; make the hash table size a prime rather than a power of two.
This seems to improve hash performance ever so slightly in most cases.
- UPDATE: Update contrib/ical2rem to upstream version 0.7.1
- FIX: tkremind: Make tkremind work with Tcl/Tk 8.5 or higher, including
Tcl/Tk 9.0
- MINOR CHANGE: remind: Add hash table statistics to "-ds" debugging
output. This is probably of no use to anyone except the author of
Remind.
* VERSION 5.0 Patch 6 - 2024-09-16
- NEW FEATURE: remind: Include a file containing the dates of Chinese
@@ -18,7 +48,7 @@ CHANGES TO REMIND
matches DATEs and DATETIMEs which are enclosed in single-quotes.
(The quotes are optional for TIME constants, however.)
- IMPROVEMENT: Improve many error emssages and warnings.
- IMPROVEMENT: Improve many error messages and warnings.
- UPDATE: contrib/ical2rem: Update to upstream version 0.7

View File

@@ -26,7 +26,10 @@ 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("")]%_
MSG This is [ansicolor(0,255,255)]cyan.[ansicolor("")]
MSG This is [ansi_bold][ansicolor(255,255,255)][ansicolor(0,0,0,1)]white on black[ansicolor("")][ansi_normal]
MSG This is [ansi_bold][ansicolor(0,0,0)][ansicolor(255,255,255,1)]black on white[ansicolor("")][ansi_normal]
MSG %_
# 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("")]

View File

@@ -5,9 +5,6 @@
# Best used in a UTF-8 environment.
# SPDX-License-Identifier: GPL-2.0-only
# Set this variable to 1 if your terminal has a dark background or 0 if
# it: light.
# Set your latitude and longitude correctly for Sunrise/Sunset/Equinox/Solstice
#
# The values below are for Ottawa, Ontario, Canada
@@ -20,7 +17,8 @@ BANNER %
INCLUDE [$SysInclude]/ansitext.rem
MSG Today is [ansi_bold][$T][ansi_normal], being the [ord($T-date(year($T),1,1)+1)] day of [year($T)].%_
MSG Today is [ansi_bold][$T][ansi_normal], being the [ord($T-date(year($T),1,1)+1)] day of [year($T)].
MSG Not including today, the year [year($T)] has [date(year($T)+1, 1, 1)-$T-1] more [plural(date(year($T)+1, 1, 1)-$T-1, "day")] left.%_
IF $TerminalBackground == 0
SPECIAL COLOR 255 255 0 Sunrise: 🌅 [sunrise()] today and [sunrise($T+1)] tomorrow

View File

@@ -1,30 +1,16 @@
# Canadian holidays
# Canadian Federal Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file ONLY includes Federal holidays that are observed throughout
# Canada. You should also include the appropriate file for the province
# or territory where you live to get all of the statutory holidays for
# that province. For example, if you live in Ontario, use:
#
# INCLUDE [$SysInclude]/ca.rem
# INCLUDE [$SysInclude]/ca/on.rem
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
REM 30 Sep MSG National Day for Truth and Reconciliation
OMIT 25 Dec MSG Christmas
OMIT 26 Dec MSG Boxing Day

View File

@@ -0,0 +1,12 @@
# Alberta Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Alberta.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Family Day
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,12 @@
# British Columbia Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for British Columbia.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Family Day
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,11 @@
# Manitoba Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Manitoba.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Louis Riel Day
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,10 @@
# New Brunswick Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for New Brunswick.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Family Day
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,11 @@
# Newfoundland and Labrador Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Newfoundland and Labrador.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT 17 March MSG St. Patrick's Day
OMIT [easterdate($Uy) - 2] MSG Good Friday
OMIT 23 April MSG St. George's Day
OMIT 24 June MSG Discovery Day
REM 11 November MSG Remembrance Day

View File

@@ -0,0 +1,10 @@
# Nova Scotia Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Nova Scotia.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Heritage Day
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM 11 November MSG Remembrance Day

View File

@@ -0,0 +1,11 @@
# Northwest Territories Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for the Northwest Territories.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
OMIT 21 June MSG National Aboriginal Day
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,11 @@
# Nunavut Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Nunavut.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
OMIT 9 July MSG Nunavut Day
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,12 @@
# Ontario Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Ontario.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Family Day
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
REM 11 November MSG Remembrance Day
OMIT 26 Dec MSG Boxing Day

View File

@@ -0,0 +1,10 @@
# Prince Edward Island Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Prince Edward Island.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Islander Day
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,11 @@
# Quebec Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Quebec.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) + 1] MSG Easter Monday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
OMIT 24 June MSG Fête Nationale
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
REM 11 November MSG Remembrance Day

View File

@@ -0,0 +1,12 @@
# Saskatchewan Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Saskatchewan.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Family Day
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
OMIT 11 November MSG Remembrance Day

View File

@@ -0,0 +1,12 @@
# Yukon Territory Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file includes holidays only for Yukon Territory.
# To get Federal holidays as well, INCLUDE [$SysInclude]/ca.rem
REM Third Monday in Feb SCANFROM -7 ADDOMIT MSG Discovery Day
OMIT [easterdate($Uy) - 2] MSG Good Friday
REM Mon 18 May SCANFROM -7 ADDOMIT MSG Victoria Day
OMIT June 21 MSG National Indigenous Peoples Day
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
OMIT 11 November MSG Remembrance Day

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

@@ -0,0 +1,20 @@
# German Federal Holidays
# SPDX-License-Identifier: GPL-2.0-only
# NOTE: This file ONLY includes Federal holidays that are observed throughout Germany.
# You should also include the appropriate file for the state where you live
# to get all of the statutory holidays.
# For example, if you live in Lower Saxony, use:
#
# INCLUDE [$SysInclude]/de.rem
# INCLUDE [$SysInclude]/de/ni.rem
OMIT Jan 1 MSG Neujahr
OMIT [easterdate($Uy)-2] MSG Karfreitag
OMIT [easterdate($Uy)+1] MSG Ostermontag
OMIT May 1 MSG Tag der Arbeit
OMIT [easterdate($Uy)+39] MSG Christi Himmelfahrt
OMIT [easterdate($Uy)+50] MSG Pfingstmontag
OMIT Oct 3 MSG Tag der deutschen Einheit
OMIT Dec 25 MSG 1. Weihnachtsfeiertag
OMIT Dec 26 MSG 2. Weihnachtsfeiertag

View File

@@ -0,0 +1,7 @@
# Bavarian Holidays
# SPDX-License-Identifier: GPL-2.0-only
OMIT Jan 6 MSG Heilige Drei Könige
OMIT [easterdate($Uy)+60] MSG Fronleichnam
OMIT Aug 15 MSG Mariä Himmelfahrt
OMIT Nov 1 MSG Allerheiligen (regional)

View File

@@ -0,0 +1,4 @@
# Lower Saxony Holidays
# SPDX-License-Identifier: GPL-2.0-only
OMIT Oct 31 MSG Tag Reformationstag

View File

@@ -5,14 +5,12 @@
# 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 [easterdate($Uy)+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 [easterdate($Uy)+39] MSG %"Jeudi de l'Ascension%"
REM [easterdate($Uy)+50] MSG %"Lundi de Pentecôte%"
REM Jul 14 MSG %"Fête nationale%"
REM Aug 15 MSG %"Assomption%"
REM Nov 1 MSG %"La Toussaint%"

View File

@@ -31,10 +31,9 @@ REM Monday 1 August SCANFROM -7 ADDOMIT MSG August Public Holiday
REM Monday 1 -7 November SCANFROM -7 ADDOMIT MSG October Public Holiday
; Easter
SET easter easterdate(today())
REM [TRIGGER(easter-2)] MSG Good Friday (Aoine an Chéasta)
REM [TRIGGER(easter)] MSG Easter Sunday (Domhnach Cásca)
OMIT [TRIGGER(easter+1)] MSG Easter Monday (Luan Cásca) Public Holiday
REM [easterdate($Uy)-2] MSG Good Friday (Aoine an Chéasta)
REM [easterdate($Uy)] MSG Easter Sunday (Domhnach Cásca)
OMIT [easterdate($Uy)+1] MSG Easter Monday (Luan Cásca) Public Holiday
; St. Brigid's Day
REM 1 February MSG Saint Brigid's Day (Lá Fhéile Bríde or Imbolc)

27
include/holidays/jp.rem Normal file
View File

@@ -0,0 +1,27 @@
# SPDX-License-Identifier: MIT
# Public Holidays in Japan, courtesy of Brandon Wilson.
OMIT January 01 MSG 元日
REM January 15 UNTIL December 31 1999 ADDOMIT MSG 成人の日
REM Second Monday in January SCANFROM -7 ADDOMIT SATISFY [$Ty >= 2000] MSG 成人の日
REM February 11 ADDOMIT SATISFY [$Ty >= 1967] MSG 建国記念の日
REM February 23 ADDOMIT SATISFY [$Ty >= 2020] MSG 天皇誕生日
REM [soleq(0)] NOQUEUE SCANFROM -7 ADDOMIT MSG 春分の日
REM April 29 UNTIL December 31 2006 ADDOMIT SATISFY [$Ty >= 1989] MSG みどりの日
REM April 29 ADDOMIT SATISFY [$Ty >= 2007] MSG 昭和の日
OMIT May 03 MSG 憲法記念日
REM May 4 ADDOMIT SATISFY [$Ty >= 2007] MSG みどりの日
OMIT May 05 MSG こどもの日
REM July 20 UNTIL December 31 2002 ADDOMIT SATISFY [$Ty >= 1996] MSG 海の日
REM Third Monday in July SCANFROM -7 ADDOMIT SATISFY [$Ty >= 2003] MSG 海の日
REM August 11 ADDOMIT SATISFY [$Ty >= 2016] MSG 山の日
REM September 15 UNTIL December 31 2002 ADDOMIT SATISFY [$Ty >= 1966] MSG 敬老の日
REM Third Monday in September SCANFROM -7 ADDOMIT SATISFY [$Ty >= 2003] MSG 敬老の日
REM [soleq(2)] NOQUEUE SCANFROM -7 ADDOMIT MSG 秋分の日
REM October 10 UNTIL December 31 1999 ADDOMIT SATISFY [$Ty >= 1966] MSG 体育の日
REM Second Monday in October UNTIL December 31 2019 SCANFROM -7 ADDOMIT SATISFY [$Ty >= 2000] MSG 体育の日
REM Second Monday in October SCANFROM -7 ADDOMIT SATISFY [$Ty >= 2020] MSG スポーツの日
OMIT November 03 MSG 文化の日
OMIT November 23 MSG 勤労感謝の日
REM December 23 UNTIL December 31 2018 ADDOMIT SATISFY [$Ty >= 1989] MSG 天皇の誕生日

View File

@@ -467,6 +467,23 @@ case-sensitive:
.B \-\-version
The \fB\-\-version\fR option causes \fBRemind\fR to print its version number
to standard output and then exit.
.TP
.B \-\-print-config-cmd
This option causes \fBRemind\fR to print the exact \fB./configure\fR
command that was used when \fBRemind\fR was built. You can use this
to build a new version of \fBRemind\fR using the same configuration
as an existing one by running:
.RS
.PP
.nf
eval `remind --print-config-cmd`
.fi
.PP
from the top-level \fBRemind\fR source directory. (However, it's safer
to simply run \fBremind --print-config-cmd\fR and then type in the
command once you've verified that it looks OK.)
.RE
.TP
.B \-\-print-tokens
The \fB\-\-print-tokens\fR option causes \fBRemind\fR to print the tokens
@@ -1122,6 +1139,10 @@ be Friday, Saturday and Sunday.
.PP
The \fBOMITFUNC\fR phrase of the \fBREM\fR command allows you to
supply a function that determines whether or not a date is omitted.
Note that \fBOMITFUNC\fR must be given just the name of a user-defined
function; it can't take an arbitrary expression or the name of a built-in
function.
.PP
The function is passed a single parameter of type \fBDATE\fR, and must
return a non-zero integer if the date is considered "omitted" and 0
otherwise. Here's an example:
@@ -3080,8 +3101,9 @@ arguments, then the last argument is returned. Examples:
\fBchoose(4, "foo", 1:13, 1000)\fR returns 1000
.fi
.RS
Note that all arguments to \fBchoose()\fR are \fIalways\fR
evaluated.
.PP
Note that only the first argument and the chosen result are
evaluated. Any non-chosen arguments will not be evaluated.
.RE
.TP
.B coerce(s_type, x_arg)
@@ -3340,8 +3362,9 @@ when it encounters a ">".
.B iif(x_test1, x_arg1, [x_test2, x_arg2,...], x_default)
If \fItest1\fR is true, returns \fIarg1\fR. Otherwise, if \fItest2\fR
is true, returns \fIarg2\fR, and so on. If all of the \fItest\fR
arguments are false, returns \fIdefault\fR. Note that all arguments
are \fIalways\fR evaluated. This function accepts an odd number of
arguments are false, returns \fIdefault\fR. Note that only
those arguments needed to determine the final result are
evaluated. This function accepts an odd number of
arguments - note that prior to version 03.00.05 of \fBRemind\fR, it
accepted 3 arguments only. The 3-argument version of \fBiif()\fR is
compatible with previous versions of \fBRemind\fR.

View File

@@ -224,6 +224,14 @@ If this is selected, pop-up reminder boxes will be closed after one minute
has elapsed. Otherwise, they remain on your screen forever until you
explicitly dismiss them.
.TP
.B Use system notifications when issuing a reminder
This option is available only for Tcl/Tk version 9.0 or later, or if
you have the \fBnotify-send\fR program installed; it will be greyed
out if neither condition is true. If selected, then when a reminder
is popped up, it will also be sent to the desktop notification system,
causing a notification to appear.
.TP
.B Beep terminal when popping up a reminder
If selected, \fBTkRemind\fR beeps the terminal bell when a queued reminder

View File

@@ -26,12 +26,12 @@ rem2html - Convert the output of "remind -pp" to HTML
=head1 SYNOPSIS
remind -pp ... | rem2html [options]
remind -pp [remind_options] file | rem2html [options]
You can also use the old interchange format as below, but the -pp
version is preferred.
remind -p ... | rem2html [options]
remind -p [remind_options] file | rem2html [options]
=head1 OPTIONS
@@ -155,7 +155,7 @@ sub usage
print STDERR <<"EOM";
$TIDY_PROGNAME: Produce an HTML calendar from the output of "remind -pp"
Usage: remind -pp ... | rem2html [options]
Usage: remind -pp [remind_options] file | rem2html [options]
Options:

View File

@@ -336,10 +336,10 @@ rem2pdf - draw a PDF, SVG or PostScript calendar from Remind output
=head1 SYNOPSIS
remind -pp [options] file | rem2pdf [options] > output.pdf
remind -pp [options] file | rem2pdf --svg [options] > output.svg
remind -pp [options] file | rem2pdf --ps [options] > output.ps
remind -pp [options] file | rem2pdf --eps [options] > output.eps
remind -pp [remind_options] file | rem2pdf [options] > output.pdf
remind -pp [remind_options] file | rem2pdf --svg [options] > output.svg
remind -pp [remind_options] file | rem2pdf --ps [options] > output.ps
remind -pp [remind_options] file | rem2pdf --eps [options] > output.eps
=head1 DESCRIPTION

105
scripts/tkremind → scripts/tkremind.in Executable file → Normal file
View File

@@ -15,8 +15,10 @@
# the next line restarts using wish \
exec wish "$0" "$@"
tk appname tkremind
# We need at least version 8.5 because of {*} list expansion operator
if {[catch {package require Tcl 8.5}]} {
if {[catch {package require Tcl 8.5-}]} {
puts stderr "This program requires Tcl 8.5 or higher."
puts stderr "You have version [info tclversion]"
exit 1
@@ -24,7 +26,33 @@ if {[catch {package require Tcl 8.5}]} {
wm withdraw .
set Hostname [exec hostname]
catch {
set Hostname [exec hostname]
}
global env
set HOME $env(HOME)
# Check if we have "tk sysnotify"
set HAVE_SYSNOTIFY 0
set NOTIFY_SEND_PATH ""
catch { tk sysnotify } err opt
if { [dict get $opt -errorcode] == "TCL WRONGARGS" } {
set HAVE_SYSNOTIFY 1
} else {
set path [split $env(PATH) :]
foreach d $path {
if { [file executable [file join $d "notify-send"]] } {
set NOTIFY_SEND_PATH [file join $d "notify-send"]
break
}
}
}
proc home { f } {
global HOME
return [string cat $HOME $f]
}
# Our icon photo
catch {
@@ -166,6 +194,9 @@ set OptDescr(Deiconify) "(0/1) If 1, TkRemind deiconifies the calendar window wh
set Option(ShowTodaysReminders) 1
set OptDescr(ShowTodaysReminders) "(0/1) If 1, TkRemind shows all of today's non-timed reminders in a window at startup and when the date changes"
set Option(SysNotify) 0
set OptDescr(SysNotify) "(0/1) If 1, TkRemind uses the system notification mechanism when a reminder pops up (Tcl 9.0 or newer)"
set Option(RunCmd) ""
set OptDescr(RunCmd) "(String) If non-blank, run specified command when a pop-up reminder appears"
set Option(FeedReminder) 0
@@ -231,8 +262,7 @@ if {[string match "rem2pdf:*" "$a"]} {
}
# Reminder file to source -- default
set ReminderFile {NOSUCHFILE}
set ReminderFile [file nativename "~/.reminders"]
set ReminderFile [file nativename [home "/.reminders"]]
# Default options file
set ConfigFile ""
@@ -243,8 +273,7 @@ set EditorPid -1
set RemindErrors ""
# Reminder file to append to -- default
set AppendFile {NOSUCHFILE}
catch {set AppendFile $ReminderFile}
set AppendFile $ReminderFile
# Array of tags -> JSON dicts
array unset TagToObj
@@ -400,8 +429,8 @@ proc Initialize {} {
set TodayYear [clock format $now -format %Y]
set TodayDay [string trim [clock format $now -format %e]]
set CommandLine "$Remind -itkremind=1 -pp -y -l @EXTRA@"
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l @EXTRA@"
set CommandLine "$Remind -itkremind=1 -pp -y -l %EXTRA%"
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l %EXTRA%"
set i 0
while {$i < $argc} {
if {[regexp -- {-[bgxim].*} [lindex $argv $i]]} {
@@ -478,7 +507,7 @@ proc Initialize {} {
append PSCmd " "
append PSCmd [posix_escape $ReminderFile]
set CommandLine "|/bin/sh -c \"$CommandLine @MONTH@ @YEAR@\""
set CommandLine "|/bin/sh -c \"$CommandLine %MONTH% %YEAR%\""
}
#***********************************************************************
@@ -734,7 +763,7 @@ proc CreateCalWindow { dayNames } {
# Lets user edit options
#***********************************************************************
proc EditOptions {} {
global Option tmpOpt
global Option tmpOpt HAVE_SYSNOTIFY NOTIFY_SEND_PATH ver
# Make a working copy of current option set
foreach name [array names Option] {
@@ -751,6 +780,8 @@ proc EditOptions {} {
pack $w.f -side top -expand 1 -fill both
pack $w.b -side top -expand 0 -fill x
label $w.ver -text "TkRemind version @VERSION@ on Tcl/Tk version [info tclversion] with Remind version $ver"
pack $w.ver -in $w.f -side top -expand 0 -fill x
# Start iconified
checkbutton $w.startIconified -text "Start up Iconified" \
-anchor w -justify left \
@@ -770,6 +801,16 @@ proc EditOptions {} {
-text "Automatically close pop-up reminders after a minute" \
-anchor w -justify left -variable tmpOpt(AutoClose)
checkbutton $w.sysNotify \
-text "Use system notifications when issuing a reminder" \
-anchor w -justify left -variable tmpOpt(SysNotify)
if { ! $HAVE_SYSNOTIFY } {
if { "$NOTIFY_SEND_PATH" == "" } {
$w.sysNotify configure -state disabled -takefocus 0
}
}
# Ring bell when popping up reminder
checkbutton $w.ring -text "Beep terminal when popping up a reminder" \
-anchor w -justify left -variable tmpOpt(RingBell)
@@ -873,6 +914,7 @@ proc EditOptions {} {
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.sysNotify -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
@@ -1063,7 +1105,11 @@ proc LoadOptions {} {
proc ConfigureCalWindow { month year firstDay numDays } {
global Hostname
.h.title configure -text "$month $year"
wm title . "$month $year - TkRemind on $Hostname"
if {[info exists Hostname]} {
wm title . "$month $year - TkRemind @VERSION@ on $Hostname"
} else {
wm title . "$month $year - TkRemind @VERSION@"
}
wm iconname . "$month $year"
ConfigureCalFrame .cal $firstDay $numDays
}
@@ -1082,9 +1128,9 @@ proc FillCalWindow {} {
set_button_to_queue
set month [lindex $MonthNames $CurMonth]
set cmd [regsub @EXTRA@ $CommandLine $Option(ExtraRemindArgs)]
set cmd [regsub @MONTH@ $cmd $month]
set cmd [regsub @YEAR@ $cmd $CurYear]
set cmd [regsub %EXTRA% $CommandLine $Option(ExtraRemindArgs)]
set cmd [regsub %MONTH% $cmd $month]
set cmd [regsub %YEAR% $cmd $CurYear]
set file [open $cmd r]
# Look for # rem2ps2 begin line
@@ -1428,13 +1474,13 @@ proc DoPrint {} {
}
if {$HaveRem2PDF && $Option(PrintFormat) == "pdf"} {
set p [regsub @EXTRA@ $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set p [regsub %EXTRA% $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF"
} elseif {$HaveRem2PDF && $Option(PrintFormat) == "ps1"} {
set p [regsub @EXTRA@ $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set p [regsub %EXTRA% $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --ps"
} else {
set p [regsub @EXTRA@ $PSCmd $Option(ExtraRemindArgs)]
set p [regsub %EXTRA% $PSCmd $Option(ExtraRemindArgs)]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PS"
set Option(PrintFormat) ps
}
@@ -2868,7 +2914,7 @@ proc DaemonReadable { file } {
# Reads a background reminder from daemon and pops up window.
#---------------------------------------------------------------------------
proc IssueBackgroundReminder { body time now tag qid } {
global BgCounter Option Ignore DaemonFile
global BgCounter Option Ignore DaemonFile HAVE_SYSNOTIFY NOTIFY_SEND_PATH
if {$Option(Deiconify)} {
wm deiconify .
}
@@ -2928,6 +2974,15 @@ proc IssueBackgroundReminder { body time now tag qid } {
if {$Option(RingBell)} {
bell
}
if {$Option(SysNotify)} {
if {$HAVE_SYSNOTIFY} {
tk sysnotify "Reminder for $time" $body
} elseif {"$NOTIFY_SEND_PATH" != "" } {
catch {
exec $NOTIFY_SEND_PATH -a tkremind -i dialog-information "Reminder for $time" "$body"
}
}
}
if {$Option(RunCmd) != ""} {
if {$Option(FeedReminder)} {
FeedReminderToCommand $Option(RunCmd) "$time: $body"
@@ -4225,7 +4280,7 @@ proc FindConfigFile {} {
set confighome $env(XDG_CONFIG_HOME)
}
if {"$confighome" == ""} {
set confighome "~/.config"
set confighome [home "/.config"]
}
# If $confighome does not exist, attempt to
@@ -4236,15 +4291,15 @@ proc FindConfigFile {} {
if {[file isdirectory $confighome]} {
# Migrate .tkremindrc to $confighome/tkremindrc
if {[file exists "~/.tkremindrc"]} {
if {[file exists [home "/.tkremindrc"]]} {
if {![file exists "$confighome/tkreminderc"]} {
puts "Migrating ~/.tkremindrc to $confighome/tkremindrc"
if {[catch { file copy "~/.tkremindrc" "$confighome/tkremindrc"}]} {
if {[catch { file copy [home "/.tkremindrc"] "$confighome/tkremindrc"}]} {
puts "FAILED!\n"
set ConfigFile "~/.tkremindrc"
set ConfigFile [home "/.tkremindrc"]
return
}
catch { file delete "~/.tkremindrc" }
catch { file delete [home "/.tkremindrc"] }
}
set ConfigFile "$confighome/tkremindrc"
return
@@ -4252,7 +4307,7 @@ proc FindConfigFile {} {
set ConfigFile "$confighome/tkremindrc"
return
}
set ConfigFile "~/.tkremindrc"
set ConfigFile [home "/.tkremindrc"]
}
proc set_default_colors { w } {
@@ -4342,6 +4397,4 @@ proc DoneShowingErrors {} {
destroy .errors
}
# Rem2PS program to execute -- supply full path if you want
main

View File

@@ -1,52 +1,119 @@
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <sys/inotify.h> header file. */
#undef HAVE_SYS_INOTIFY_H
/* Define if you have the <glob.h> header file */
#undef HAVE_GLOB_H
/* Define if you have <stdint.h> */
#undef HAVE_STDINT_H
#undef HAVE_STRINGS_H
#undef HAVE_STRDUP
#undef HAVE_STRCASECMP
#undef HAVE_STRNCASECMP
#undef HAVE_WCTYPE_H
#undef HAVE_LOCALE_H
#undef HAVE_INOTIFY_INIT1
#undef HAVE_LANGINFO_H
/* Configuration command used to build Remind */
#undef CONFIG_CMD
/* Define to 1 if you have the `glob' function. */
#undef HAVE_GLOB
#undef HAVE_SETENV
/* Define to 1 if you have the <glob.h> header file. */
#undef HAVE_GLOB_H
/* Define to 1 if you have the `initgroups' function. */
#undef HAVE_INITGROUPS
#undef HAVE_UNSETENV
/* Define to 1 if you have the `inotify_init1' function. */
#undef HAVE_INOTIFY_INIT1
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the `mbstowcs' function. */
#undef HAVE_MBSTOWCS
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* The number of bytes in a unsigned int. */
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP
/* Define to 1 if you have the <sys/inotify.h> header file. */
#undef HAVE_SYS_INOTIFY_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T
/* The size of `unsigned int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_INT
/* The number of bytes in a unsigned long. */
/* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
#define PACKAGE_NAME "@PACKAGE_NAME@"
#define PACKAGE_URL "@PACKAGE_URL@"
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
#include "custom.h"
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
#include <custom.h>

View File

@@ -15,7 +15,7 @@
#include <stdio.h> /* For FILE */
#define DBUF_STATIC_SIZE 128
#define DBUF_STATIC_SIZE 32
typedef struct {
char *buffer;
size_t len;

View File

@@ -38,8 +38,8 @@
5) N_BUILTIN_FUNC: A reference to a built-in function
6) N_USER_FUNC: A reference to a user-defined function
7) N_OPERATOR: A reference to an operator such as "+" or "&&"
8) N_ERROR: A node resulting from a parse error
9) N_SHORT_STR: A string constant short enough to store in u.name
8) N_SHORT_STR: A string constant short enough to store in u.name
9) N_ERROR: An uninitialized node, or a parse error
Additional types are N_SHORT_VAR, N_SHORT_SYSVAR, and N_SHORT_USER_FUNC
which behave identically to N_VARIABLE, N_SYSVAR and N_USER_FUNC
@@ -97,7 +97,7 @@
1) For N_CONSTANT nodes: The constant
2) For N_VARIABLE nodes: The value of the variable
3) For N_SYSVAR nodes: The value of the system variable
4) For N_LOCAL_VAR nodes: The value of the user-defined functions argument
4) For N_LOCAL_VAR nodes: The value of the user-defined function's argument
User-defined functions contain their own expr_node tree. This is
evaluated with the "locals" parameter set to the values of all
@@ -156,7 +156,7 @@
/* Constants for the "how" arg to compare() */
enum { EQ, GT, LT, GE, LE, NE };
/* Our pool of free expr_node objext, as a linked list, linked by child ptr */
/* Our pool of free expr_node objects, as a linked list, linked by child ptr */
static expr_node *expr_node_free_list = NULL;
#define TOKEN_IS(x) (!strcmp(DBufValue(&ExprBuf), x))
@@ -231,7 +231,7 @@ alloc_expr_node(int *r)
if (ExprNodesUsed > ExprNodesHighWater) ExprNodesHighWater = ExprNodesUsed;
node = expr_node_free_list;
expr_node_free_list = node->child;
node->type = N_FREE;
node->type = N_ERROR;
node->child = NULL;
node->sibling = NULL;
node->num_kids = 0;
@@ -1698,7 +1698,7 @@ static int peek_expr_token(DynamicBuffer *buf, char const *in)
/***************************************************************/
expr_node * free_expr_tree(expr_node *node)
{
if (node) {
if (node && (node->type != N_FREE)) {
ExprNodesUsed--;
if (node->type == N_CONSTANT ||
node->type == N_VARIABLE ||

View File

@@ -1071,6 +1071,10 @@ ProcessLongOption(char const *arg)
printf("%s\n", VERSION);
exit(EXIT_SUCCESS);
}
if (!strcmp(arg, "print-config-cmd")) {
printf("%s\n", CONFIG_CMD);
exit(EXIT_SUCCESS);
}
if (!strcmp(arg, "print-tokens")) {
print_remind_tokens();
print_builtinfunc_tokens();

View File

@@ -60,9 +60,15 @@ exitfunc(void)
/* Kill any execution-time-limiter process */
unlimit_execution_time();
int maxlen, total;
double avglen;
if (DebugFlag & DB_PARSE_EXPR) {
fflush(stdout);
fflush(stderr);
get_var_hash_stats(&total, &maxlen, &avglen);
fprintf(stderr, " Var hash: total = %d; maxlen = %d; avglen = %.3f\n", total, maxlen, avglen);
get_userfunc_hash_stats(&total, &maxlen, &avglen);
fprintf(stderr, "Func hash: total = %d; maxlen = %d; avglen = %.3f\n", total, maxlen, avglen);
UnsetAllUserFuncs();
print_expr_nodes_stats();
}

View File

@@ -247,3 +247,6 @@ extern int _private_sub_overflow(int a, int b);
void print_sysvar_tokens(void);
void print_builtinfunc_tokens(void);
void print_remind_tokens(void);
void get_var_hash_stats(int *total, int *maxlen, double *avglen);
void get_userfunc_hash_stats(int *total, int *maxlen, double *avglen);

View File

@@ -41,8 +41,7 @@ typedef struct {
/* New-style expr_node structure and constants */
enum expr_node_type
{
N_FREE,
N_ERROR,
N_FREE = 0,
N_CONSTANT,
N_SHORT_STR,
N_LOCAL_VAR,
@@ -54,6 +53,7 @@ enum expr_node_type
N_SHORT_USER_FUNC,
N_USER_FUNC,
N_OPERATOR,
N_ERROR = 32767,
};
/* Structure for passing in Nargs and out RetVal from functions */

View File

@@ -27,7 +27,7 @@
#include "protos.h"
#include "err.h"
#define FUNC_HASH_SIZE 32 /* Size of User-defined function hash table */
#define FUNC_HASH_SIZE 31 /* Size of User-defined function hash table */
/* The hash table */
static UserFunc *FuncHash[FUNC_HASH_SIZE];
@@ -44,17 +44,17 @@ static void FSet (UserFunc *f);
/***************************************************************/
unsigned int HashVal_nocase(char const *str)
{
register unsigned int i=0;
register unsigned int j=1;
register unsigned int len=0;
while(*str && len < VAR_NAME_LEN) {
i += j * (*str);
str++;
len++;
j = 3-j;
unsigned int h = 0, high;
while(*str) {
h = (h << 4) + (unsigned int) *str;
str++;
high = h & 0xF0000000;
if (high) {
h ^= (high >> 24);
}
h &= ~high;
}
return i;
return h;
}
/***************************************************************/
@@ -401,3 +401,28 @@ UnsetAllUserFuncs(void)
FuncHash[i] = NULL;
}
}
void
get_userfunc_hash_stats(int *total, int *maxlen, double *avglen)
{
int len;
int i;
UserFunc *f;
*maxlen = 0;
*total = 0;
for (i=0; i<FUNC_HASH_SIZE; i++) {
len = 0;
f = FuncHash[i];
while(f) {
len++;
(*total)++;
f = f->next;
}
if (len > *maxlen) {
*maxlen = len;
}
}
*avglen = (double) *total / (double) FUNC_HASH_SIZE;
}

View File

@@ -28,7 +28,7 @@
#define UPPER(c) (islower(c) ? toupper(c) : c)
/* The variable hash table */
#define VAR_HASH_SIZE 64
#define VAR_HASH_SIZE 67
#define VARIABLE ErrMsg[E_VAR]
#define VALUE ErrMsg[E_VAL]
#define UNDEF ErrMsg[E_UNDEF]
@@ -461,17 +461,17 @@ static int time_sep_func(int do_set, Value *val)
/***************************************************************/
unsigned int HashVal(char const *str)
{
register unsigned int i=0;
register unsigned int j=1;
register unsigned int len=0;
while(*str && len < VAR_NAME_LEN) {
i += j * (unsigned int) UPPER(*str);
str++;
len++;
j = 3-j;
unsigned int h = 0, high;
while(*str) {
h = (h << 4) + (unsigned int) UPPER(*str);
str++;
high = h & 0xF0000000;
if (high) {
h ^= (high >> 24);
}
h &= ~high;
}
return i;
return h;
}
/***************************************************************/
@@ -1208,3 +1208,28 @@ print_sysvar_tokens(void)
printf("$%s\n", SysVarArr[i].name);
}
}
void
get_var_hash_stats(int *total, int *maxlen, double *avglen)
{
int len;
int i;
Var *v;
*maxlen = 0;
*total = 0;
for (i=0; i<VAR_HASH_SIZE; i++) {
len = 0;
v = VHashTbl[i];
while(v) {
len++;
(*total)++;
v = v->next;
}
if (len > *maxlen) {
*maxlen = len;
}
}
*avglen = (double) *total / (double) VAR_HASH_SIZE;
}

View File

@@ -1029,7 +1029,7 @@ set a057 value("a05"+"6")
"a05" + "6" => "a056"
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
set a058 version()
version() => "05.00.06"
version() => "05.00.07"
set a059 wkday(today())
today() => 1991-02-16
wkday(1991-02-16) => "Saturday"
@@ -2578,141 +2578,141 @@ wkdaynum(1993-12-27) => 1
dump
Variable Value
a017 29
a036 "bar"
a054b 11:22
a055 1
a074 "Tuesday, 5 May, 1992 In 444 days' time T"...
a093 0
a116 -4
a135 72:00
a008 "11:44"
a027 0
a046 "ies"
a065 1
a084 7
a107 3
a126 14:00
a018 1
a037 1991-02-15
a056 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
a075 "05-05 Tuesday, May 5th, 1992 Tuesday, Ma"...
a094 0
a117 -3
a136 "FILE"
a028 1
a047 -1
a066 0
a085 7
a108 14
a127 04:30
a019 0
a038 33
a057 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
a076 "S' 05 Th 05 Tuesday, 5th May, 1992 Tuesd"...
a095 -1
a118 0
a029 0
a048 "foo"
a067 "INT"
a086 4
a109 2012-01-01
a128 2018-02-03@16:45
a039 "February"
a058 "05.00.06"
a077 "1992 92\n"
a096 -4
a119 -1
a049 21
a068 "STRING"
a087 3
a129 2019-02-03@16:14
a059 "Saturday"
a078 1991-04-07
a097 -3
a069 "TIME"
a088 14
a079 1992-04-26
a098 0
a089 2012-01-01
a099 -1
a000 1
a010 12
a001 1
a020 "../tests/test.rem"
a100 2010-09-03
a011 704
a030 1
a110 1991-02-16
a002 102
a021 "foo bar baz"
a040 2
a101 2010-09-03
a120 2010-09-03
a012 411
a031 "foobarbaz"
a111 -1
a130 1991-02-16
a003 1990
a022 11
a041 "3rd"
a060 6
a102 5000
a121 2010-09-03
a013 1992-02-02
a032 34
a070 "DATE"
a112 7
a131 00:00
a004 "B7BMB"
a023 1
a042 "4th"
a061 1991
a080 2027-05-02
a103 0
a122 5000
a033 "foo"
a052 03:07
a071 2
a090 1991-02-16
a113 15
a131b 00:00
a132 1991-02-16@00:00
a005 "baz"
a024 0
a043 "UNIX"
a062 -19
a081 ""
a104 0
a123 0
a015 16
a034 1991-02-17
a053 1992-01-10
a072 0
a091 -1
a114 2
a133 16:00
a006 "1"
a025 4
a044 "s"
a063 0
a082 1991-03-13
a105 -1
a124 0
mltest "a b"
a016 28
a030 1
a031 "foobarbaz"
a074 "Tuesday, 5 May, 1992 In 444 days' time T"...
a032 34
a054b 11:22
a075 "05-05 Tuesday, May 5th, 1992 Tuesday, Ma"...
a033 "foo"
a076 "S' 05 Th 05 Tuesday, 5th May, 1992 Tuesd"...
a034 1991-02-17
a077 "1992 92\n"
a035 1
a054 11:22
a092 7
a115 03:33
a134 1991-02-13@16:00
a007 "1991-02-16"
a026 7
a045 "iess"
a064 1
a083 1991-03-24
a078 1991-04-07
a036 "bar"
a079 1992-04-26
a037 1991-02-15
a100 2010-09-03
a038 33
a101 2010-09-03
a039 "February"
a102 5000
a103 0
a104 0
a105 -1
mltest "a b"
a080 2027-05-02
a106 4
a081 ""
a107 3
a082 1991-03-13
a108 14
a040 2
a083 1991-03-24
a109 2012-01-01
a041 "3rd"
a084 7
a042 "4th"
a085 7
a000 1
a043 "UNIX"
a086 4
a001 1
a044 "s"
a087 3
a002 102
a045 "iess"
a088 14
a003 1990
a046 "ies"
a089 2012-01-01
a004 "B7BMB"
a047 -1
a110 1991-02-16
a005 "baz"
a048 "foo"
a111 -1
a006 "1"
a049 21
a112 7
a007 "1991-02-16"
a113 15
a008 "11:44"
a114 2
a115 03:33
a090 1991-02-16
a116 -4
a091 -1
a117 -3
a092 7
a118 0
a093 0
a119 -1
a094 0
a052 03:07
a095 -1
a010 12
a053 1992-01-10
a096 -4
a011 704
a054 11:22
a097 -3
a012 411
a055 1
a098 0
a013 1992-02-02
a056 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
a099 -1
a057 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
a120 2010-09-03
a015 16
a058 "05.00.07"
a121 2010-09-03
a016 28
a059 "Saturday"
a122 5000
a017 29
a123 0
a018 1
a124 0
a019 0
a125 -1
a126 14:00
a127 04:30
a128 2018-02-03@16:45
a060 6
a129 2019-02-03@16:14
a061 1991
a062 -19
a020 "../tests/test.rem"
a063 0
a021 "foo bar baz"
a064 1
a022 11
a065 1
a023 1
a066 0
a131b 00:00
a024 0
a067 "INT"
a130 1991-02-16
a025 4
a068 "STRING"
a131 00:00
a026 7
a069 "TIME"
a132 1991-02-16@00:00
a027 0
a133 16:00
a028 1
a134 1991-02-13@16:00
a029 0
a135 72:00
a136 "FILE"
a070 "DATE"
dump $
Variable Value
@@ -5439,16 +5439,164 @@ REM SATISFY 0
../tests/test.rem(1044): Trig = Sunday, 14 July, 1991
../tests/test.rem(1044): Trig = Monday, 15 July, 1991
../tests/test.rem(1044): Can't compute trigger
REM SATSIFY ""
../tests/test.rem(1045): Missing REM type; assuming MSG
REM SATISFY ""
../tests/test.rem(1045): SATISFY: constant "" will never be true
../tests/test.rem(1045): Trig = Saturday, 16 February, 1991
SATSIFY ""
../tests/test.rem(1045): Trig = Sunday, 17 February, 1991
../tests/test.rem(1045): Trig = Monday, 18 February, 1991
../tests/test.rem(1045): Trig = Tuesday, 19 February, 1991
../tests/test.rem(1045): Trig = Wednesday, 20 February, 1991
../tests/test.rem(1045): Trig = Thursday, 21 February, 1991
../tests/test.rem(1045): Trig = Friday, 22 February, 1991
../tests/test.rem(1045): Trig = Saturday, 23 February, 1991
../tests/test.rem(1045): Trig = Sunday, 24 February, 1991
../tests/test.rem(1045): Trig = Monday, 25 February, 1991
../tests/test.rem(1045): Trig = Tuesday, 26 February, 1991
../tests/test.rem(1045): Trig = Wednesday, 27 February, 1991
../tests/test.rem(1045): Trig = Thursday, 28 February, 1991
../tests/test.rem(1045): Trig = Friday, 1 March, 1991
../tests/test.rem(1045): Trig = Saturday, 2 March, 1991
../tests/test.rem(1045): Trig = Sunday, 3 March, 1991
../tests/test.rem(1045): Trig = Monday, 4 March, 1991
../tests/test.rem(1045): Trig = Tuesday, 5 March, 1991
../tests/test.rem(1045): Trig = Wednesday, 6 March, 1991
../tests/test.rem(1045): Trig = Thursday, 7 March, 1991
../tests/test.rem(1045): Trig = Friday, 8 March, 1991
../tests/test.rem(1045): Trig = Saturday, 9 March, 1991
../tests/test.rem(1045): Trig = Sunday, 10 March, 1991
../tests/test.rem(1045): Trig = Monday, 11 March, 1991
../tests/test.rem(1045): Trig = Tuesday, 12 March, 1991
../tests/test.rem(1045): Trig = Wednesday, 13 March, 1991
../tests/test.rem(1045): Trig = Thursday, 14 March, 1991
../tests/test.rem(1045): Trig = Friday, 15 March, 1991
../tests/test.rem(1045): Trig = Saturday, 16 March, 1991
../tests/test.rem(1045): Trig = Sunday, 17 March, 1991
../tests/test.rem(1045): Trig = Monday, 18 March, 1991
../tests/test.rem(1045): Trig = Tuesday, 19 March, 1991
../tests/test.rem(1045): Trig = Wednesday, 20 March, 1991
../tests/test.rem(1045): Trig = Thursday, 21 March, 1991
../tests/test.rem(1045): Trig = Friday, 22 March, 1991
../tests/test.rem(1045): Trig = Saturday, 23 March, 1991
../tests/test.rem(1045): Trig = Sunday, 24 March, 1991
../tests/test.rem(1045): Trig = Monday, 25 March, 1991
../tests/test.rem(1045): Trig = Tuesday, 26 March, 1991
../tests/test.rem(1045): Trig = Wednesday, 27 March, 1991
../tests/test.rem(1045): Trig = Thursday, 28 March, 1991
../tests/test.rem(1045): Trig = Friday, 29 March, 1991
../tests/test.rem(1045): Trig = Saturday, 30 March, 1991
../tests/test.rem(1045): Trig = Sunday, 31 March, 1991
../tests/test.rem(1045): Trig = Monday, 1 April, 1991
../tests/test.rem(1045): Trig = Tuesday, 2 April, 1991
../tests/test.rem(1045): Trig = Wednesday, 3 April, 1991
../tests/test.rem(1045): Trig = Thursday, 4 April, 1991
../tests/test.rem(1045): Trig = Friday, 5 April, 1991
../tests/test.rem(1045): Trig = Saturday, 6 April, 1991
../tests/test.rem(1045): Trig = Sunday, 7 April, 1991
../tests/test.rem(1045): Trig = Monday, 8 April, 1991
../tests/test.rem(1045): Trig = Tuesday, 9 April, 1991
../tests/test.rem(1045): Trig = Wednesday, 10 April, 1991
../tests/test.rem(1045): Trig = Thursday, 11 April, 1991
../tests/test.rem(1045): Trig = Friday, 12 April, 1991
../tests/test.rem(1045): Trig = Saturday, 13 April, 1991
../tests/test.rem(1045): Trig = Sunday, 14 April, 1991
../tests/test.rem(1045): Trig = Monday, 15 April, 1991
../tests/test.rem(1045): Trig = Tuesday, 16 April, 1991
../tests/test.rem(1045): Trig = Wednesday, 17 April, 1991
../tests/test.rem(1045): Trig = Thursday, 18 April, 1991
../tests/test.rem(1045): Trig = Friday, 19 April, 1991
../tests/test.rem(1045): Trig = Saturday, 20 April, 1991
../tests/test.rem(1045): Trig = Sunday, 21 April, 1991
../tests/test.rem(1045): Trig = Monday, 22 April, 1991
../tests/test.rem(1045): Trig = Tuesday, 23 April, 1991
../tests/test.rem(1045): Trig = Wednesday, 24 April, 1991
../tests/test.rem(1045): Trig = Thursday, 25 April, 1991
../tests/test.rem(1045): Trig = Friday, 26 April, 1991
../tests/test.rem(1045): Trig = Saturday, 27 April, 1991
../tests/test.rem(1045): Trig = Sunday, 28 April, 1991
../tests/test.rem(1045): Trig = Monday, 29 April, 1991
../tests/test.rem(1045): Trig = Tuesday, 30 April, 1991
../tests/test.rem(1045): Trig = Wednesday, 1 May, 1991
../tests/test.rem(1045): Trig = Thursday, 2 May, 1991
../tests/test.rem(1045): Trig = Friday, 3 May, 1991
../tests/test.rem(1045): Trig = Saturday, 4 May, 1991
../tests/test.rem(1045): Trig = Sunday, 5 May, 1991
../tests/test.rem(1045): Trig = Monday, 6 May, 1991
../tests/test.rem(1045): Trig = Tuesday, 7 May, 1991
../tests/test.rem(1045): Trig = Wednesday, 8 May, 1991
../tests/test.rem(1045): Trig = Thursday, 9 May, 1991
../tests/test.rem(1045): Trig = Friday, 10 May, 1991
../tests/test.rem(1045): Trig = Saturday, 11 May, 1991
../tests/test.rem(1045): Trig = Sunday, 12 May, 1991
../tests/test.rem(1045): Trig = Monday, 13 May, 1991
../tests/test.rem(1045): Trig = Tuesday, 14 May, 1991
../tests/test.rem(1045): Trig = Wednesday, 15 May, 1991
../tests/test.rem(1045): Trig = Thursday, 16 May, 1991
../tests/test.rem(1045): Trig = Friday, 17 May, 1991
../tests/test.rem(1045): Trig = Saturday, 18 May, 1991
../tests/test.rem(1045): Trig = Sunday, 19 May, 1991
../tests/test.rem(1045): Trig = Monday, 20 May, 1991
../tests/test.rem(1045): Trig = Tuesday, 21 May, 1991
../tests/test.rem(1045): Trig = Wednesday, 22 May, 1991
../tests/test.rem(1045): Trig = Thursday, 23 May, 1991
../tests/test.rem(1045): Trig = Friday, 24 May, 1991
../tests/test.rem(1045): Trig = Saturday, 25 May, 1991
../tests/test.rem(1045): Trig = Sunday, 26 May, 1991
../tests/test.rem(1045): Trig = Monday, 27 May, 1991
../tests/test.rem(1045): Trig = Tuesday, 28 May, 1991
../tests/test.rem(1045): Trig = Wednesday, 29 May, 1991
../tests/test.rem(1045): Trig = Thursday, 30 May, 1991
../tests/test.rem(1045): Trig = Friday, 31 May, 1991
../tests/test.rem(1045): Trig = Saturday, 1 June, 1991
../tests/test.rem(1045): Trig = Sunday, 2 June, 1991
../tests/test.rem(1045): Trig = Monday, 3 June, 1991
../tests/test.rem(1045): Trig = Tuesday, 4 June, 1991
../tests/test.rem(1045): Trig = Wednesday, 5 June, 1991
../tests/test.rem(1045): Trig = Thursday, 6 June, 1991
../tests/test.rem(1045): Trig = Friday, 7 June, 1991
../tests/test.rem(1045): Trig = Saturday, 8 June, 1991
../tests/test.rem(1045): Trig = Sunday, 9 June, 1991
../tests/test.rem(1045): Trig = Monday, 10 June, 1991
../tests/test.rem(1045): Trig = Tuesday, 11 June, 1991
../tests/test.rem(1045): Trig = Wednesday, 12 June, 1991
../tests/test.rem(1045): Trig = Thursday, 13 June, 1991
../tests/test.rem(1045): Trig = Friday, 14 June, 1991
../tests/test.rem(1045): Trig = Saturday, 15 June, 1991
../tests/test.rem(1045): Trig = Sunday, 16 June, 1991
../tests/test.rem(1045): Trig = Monday, 17 June, 1991
../tests/test.rem(1045): Trig = Tuesday, 18 June, 1991
../tests/test.rem(1045): Trig = Wednesday, 19 June, 1991
../tests/test.rem(1045): Trig = Thursday, 20 June, 1991
../tests/test.rem(1045): Trig = Friday, 21 June, 1991
../tests/test.rem(1045): Trig = Saturday, 22 June, 1991
../tests/test.rem(1045): Trig = Sunday, 23 June, 1991
../tests/test.rem(1045): Trig = Monday, 24 June, 1991
../tests/test.rem(1045): Trig = Tuesday, 25 June, 1991
../tests/test.rem(1045): Trig = Wednesday, 26 June, 1991
../tests/test.rem(1045): Trig = Thursday, 27 June, 1991
../tests/test.rem(1045): Trig = Friday, 28 June, 1991
../tests/test.rem(1045): Trig = Saturday, 29 June, 1991
../tests/test.rem(1045): Trig = Sunday, 30 June, 1991
../tests/test.rem(1045): Trig = Monday, 1 July, 1991
../tests/test.rem(1045): Trig = Tuesday, 2 July, 1991
../tests/test.rem(1045): Trig = Wednesday, 3 July, 1991
../tests/test.rem(1045): Trig = Thursday, 4 July, 1991
../tests/test.rem(1045): Trig = Friday, 5 July, 1991
../tests/test.rem(1045): Trig = Saturday, 6 July, 1991
../tests/test.rem(1045): Trig = Sunday, 7 July, 1991
../tests/test.rem(1045): Trig = Monday, 8 July, 1991
../tests/test.rem(1045): Trig = Tuesday, 9 July, 1991
../tests/test.rem(1045): Trig = Wednesday, 10 July, 1991
../tests/test.rem(1045): Trig = Thursday, 11 July, 1991
../tests/test.rem(1045): Trig = Friday, 12 July, 1991
../tests/test.rem(1045): Trig = Saturday, 13 July, 1991
../tests/test.rem(1045): Trig = Sunday, 14 July, 1991
../tests/test.rem(1045): Trig = Monday, 15 July, 1991
../tests/test.rem(1045): Can't compute trigger
REM SATISFY [version() > "01.00.00"]
../tests/test.rem(1046): SATISFY: expression has no reference to trigdate() or $T...
../tests/test.rem(1046): Trig = Saturday, 16 February, 1991
version() => "05.00.06"
"05.00.06" > "01.00.00" => 1
version() => "05.00.07"
"05.00.07" > "01.00.00" => 1
../tests/test.rem(1046): Trig(satisfied) = Saturday, 16 February, 1991
REM SATISFY [max(x, max(x, 1, 2, 3), 4, 5, 6) * 5]
../tests/test.rem(1047): SATISFY: expression has no reference to trigdate() or $T...
@@ -5684,8 +5832,16 @@ Barf
Barf
# Output expression-node stats
DEBUG +s
# Don't want Remind to queue reminders
EXIT
Var hash: total = 141; maxlen = 4; avglen = 2.104
Func hash: total = 15; maxlen = 2; avglen = 0.484
Expression nodes allocated: 128
Expression nodes high-water: 73
Expression nodes leaked: 0
Parse level high-water: 25
Test 2
@@ -12581,7 +12737,7 @@ SECURITY: Won't read world-writable file or directory!
Error reading include_dir/ww: Can't open file
SECURITY: Won't read world-writable file or directory!
Error reading include_dir/ww: No files matching *.rem
05.00.06
05.00.07
NOTE JSONQUEUE
[{"priority":2,"eventstart":"VOLATILE","time":"23:59","nexttime":"23:59","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue2.rem","lineno":1,"type":"MSG_TYPE","body":"XXXX"},{"priority":999,"eventstart":"VOLATILE","time":"23:58","nexttime":"23:58","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","lineno":5,"type":"MSG_TYPE","body":"quux"},{"priority":42,"eventstart":"VOLATILE","time":"23:57","nexttime":"23:57","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","lineno":4,"type":"MSG_TYPE","body":"bar"},{"priority":5000,"eventstart":"VOLATILE","time":"23:56","nexttime":"23:56","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","lineno":3,"type":"MSG_TYPE","body":"foo"}]
NOTE ENDJSONQUEUE
@@ -13133,6 +13289,8 @@ Parsed expression: isany("foo", 1 + 1, 2:00 + 1, '2021-01-01' + 1, '2021-01-01@1
"f" + "oo" => "foo"
isany("foo", 2, 02:01, 2021-01-02, 2021-01-01@14:01, "foo", ?) => 1
No reminders.
Var hash: total = 1; maxlen = 1; avglen = 0.015
Func hash: total = 0; maxlen = 0; avglen = 0.000
Expression nodes allocated: 512
Expression nodes high-water: 499
Expression nodes leaked: 0

View File

@@ -1042,7 +1042,7 @@ REM SATISFY recursive_t(2)
# These should be diagnosed
REM SATISFY 0
REM SATSIFY ""
REM SATISFY ""
REM SATISFY [version() > "01.00.00"]
REM SATISFY [max(x, max(x, 1, 2, 3), 4, 5, 6) * 5]
@@ -1131,6 +1131,8 @@ set $SuppressImplicitWarnings 1
REM wookie
Barf
# Output expression-node stats
DEBUG +s
# Don't want Remind to queue reminders
EXIT