Compare commits

...

38 Commits

Author SHA1 Message Date
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
28 changed files with 435 additions and 223 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

28
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,16 @@ 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 +4709,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 +4774,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 +4909,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 +5497,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"])
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,22 +3,32 @@
# 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.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

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

@@ -20,6 +20,8 @@ REM First Monday in Aug SCANFROM -7 ADDOMIT MSG Civic Holiday
REM First Monday in Sep SCANFROM -7 ADDOMIT MSG Labour Day
REM 30 Sep MSG National Day for Truth and Reconciliation
REM Second Monday in Oct SCANFROM -7 ADDOMIT MSG Thanksgiving Day
REM 11 November MSG Remembrance Day

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

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

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

@@ -48,5 +48,7 @@
#define PACKAGE_NAME "@PACKAGE_NAME@"
#define PACKAGE_URL "@PACKAGE_URL@"
#define CONFIG_CMD "@CONFIG_CMD@"
#include "custom.h"

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
@@ -5447,8 +5447,8 @@ SATSIFY ""
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 +5684,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 +12589,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 +13141,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

@@ -1131,6 +1131,8 @@ set $SuppressImplicitWarnings 1
REM wookie
Barf
# Output expression-node stats
DEBUG +s
# Don't want Remind to queue reminders
EXIT