mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Compare commits
80 Commits
03.04.00-B
...
03.04.02-B
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
732ce8283f | ||
|
|
122bd3e07e | ||
|
|
0ac5cbb837 | ||
|
|
7f3d4812a8 | ||
|
|
e1fa11c94c | ||
|
|
c06c65acf1 | ||
|
|
a84fa0bc8f | ||
|
|
054648e02b | ||
|
|
9548041334 | ||
|
|
da306f2900 | ||
|
|
26587aea02 | ||
|
|
adc86e0f00 | ||
|
|
a9ed5f075e | ||
|
|
21e30c980e | ||
|
|
a657b2e55a | ||
|
|
ff8c55b8b6 | ||
|
|
eb36c5bca0 | ||
|
|
89173ce1ee | ||
|
|
5d115ba3e3 | ||
|
|
7e3adeb9c9 | ||
|
|
080cda86fa | ||
|
|
6274cbad52 | ||
|
|
85c4ad821d | ||
|
|
b758a2fea8 | ||
|
|
6619cc7ca4 | ||
|
|
961f7a8a62 | ||
|
|
905287901f | ||
|
|
669be7bf57 | ||
|
|
9b8eb2dc4c | ||
|
|
00ab7b196d | ||
|
|
f616be4bdd | ||
|
|
8ae9ce8523 | ||
|
|
6d2bbbd7e2 | ||
|
|
1453be83b2 | ||
|
|
8659131be2 | ||
|
|
0276ce322d | ||
|
|
b36c99a34b | ||
|
|
ad575f1485 | ||
|
|
a9162f1472 | ||
|
|
221e2554a9 | ||
|
|
04ec6c3695 | ||
|
|
b1594980fc | ||
|
|
024a8ef38d | ||
|
|
b281051421 | ||
|
|
aa1b275b51 | ||
|
|
c22ca68857 | ||
|
|
3804ce3fe3 | ||
|
|
0977f1db04 | ||
|
|
83c97934c9 | ||
|
|
44c9d74caa | ||
|
|
172f56754a | ||
|
|
dc184cc713 | ||
|
|
2c30088553 | ||
|
|
6f0c189afb | ||
|
|
0e2996c3e1 | ||
|
|
ce8040dd1f | ||
|
|
a8fd2d463d | ||
|
|
237813127c | ||
|
|
3e6259532f | ||
|
|
c015441130 | ||
|
|
9661455fee | ||
|
|
df983b4123 | ||
|
|
068d5429eb | ||
|
|
6c593fe849 | ||
|
|
6a7bdb2ec7 | ||
|
|
a4aead18dd | ||
|
|
d277154d9f | ||
|
|
d2662fb026 | ||
|
|
2f522ea705 | ||
|
|
cd68041312 | ||
|
|
9c2556f16d | ||
|
|
b80b938d3d | ||
|
|
0bd6278050 | ||
|
|
b2746f28db | ||
|
|
cfd3698b53 | ||
|
|
6b5150d30e | ||
|
|
b011adf94e | ||
|
|
d09b725710 | ||
|
|
2f1e3524df | ||
|
|
2de47cfa51 |
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -1,4 +1,5 @@
|
||||
.gitignore export-ignore
|
||||
.gitattributes export-ignore
|
||||
remind.php export-ignore
|
||||
sync-to-dianne-git export-ignore
|
||||
sync-to-dianne-git export-ignore
|
||||
php export-ignore
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,3 +24,4 @@ blib/
|
||||
pm_to_blib
|
||||
rem2pdf/Makefile.top
|
||||
rem2pdf/bin/rem2pdf
|
||||
rem2html/rem2html.1
|
||||
|
||||
4
Makefile
4
Makefile
@@ -20,10 +20,10 @@ install:
|
||||
@echo ""
|
||||
@$(MAKE) -C src install
|
||||
@$(MAKE) -C rem2html install
|
||||
@$(MAKE) -C rem2pdf -f Makefile.top install
|
||||
@$(MAKE) -C rem2pdf -f Makefile.top install INSTALL_BASE=$(INSTALL_BASE)
|
||||
clean:
|
||||
find . -name '*~' -exec rm {} \;
|
||||
$(MAKE) -C src clean
|
||||
-$(MAKE) -C src clean
|
||||
-$(MAKE) -C rem2pdf clean
|
||||
|
||||
test:
|
||||
|
||||
38
build.tk
38
build.tk
@@ -27,8 +27,10 @@ proc SetConfigDefaults {} {
|
||||
global Config
|
||||
set Config(LAT_DEG) 45
|
||||
set Config(LAT_MIN) 24
|
||||
set Config(LAT_SEC) 14
|
||||
set Config(LON_DEG) 75
|
||||
set Config(LON_MIN) 39
|
||||
set Config(LON_SEC) 23
|
||||
set Config(LOCATION) "Ottawa"
|
||||
set Config(DEFAULT_PAGE) "Letter"
|
||||
set Config(DATESEP) "-"
|
||||
@@ -157,10 +159,14 @@ proc CreateLocationDialog { w } {
|
||||
-from 0 -to 89 -length 300 -variable Config(LAT_DEG)
|
||||
scale $w.latmin -label "Latitude (minutes)" -orient horizontal \
|
||||
-from 0 -to 59 -length 300 -variable Config(LAT_MIN)
|
||||
scale $w.latsec -label "Latitude (seconds)" -orient horizontal \
|
||||
-from 0 -to 59 -length 300 -variable Config(LAT_SEC)
|
||||
scale $w.londeg -label "Longitude (degrees)" -orient horizontal \
|
||||
-from 0 -to 179 -length 300 -variable Config(LON_DEG)
|
||||
scale $w.lonmin -label "Longtude (minutes)" -orient horizontal \
|
||||
-from 0 -to 59 -length 300 -variable Config(LON_MIN)
|
||||
scale $w.lonsec -label "Longitude (seconds)" -orient horizontal \
|
||||
-from 0 -to 59 -length 300 -variable Config(LON_SEC)
|
||||
|
||||
radiobutton $w.north -text "Northern Hemisphere" \
|
||||
-variable Config(NORTHERN_HEMISPHERE) -value 1
|
||||
@@ -176,8 +182,10 @@ proc CreateLocationDialog { w } {
|
||||
$w.location insert end $Config(LOCATION)
|
||||
grid $w.latdeg -
|
||||
grid $w.latmin -
|
||||
grid $w.latsec -
|
||||
grid $w.londeg -
|
||||
grid $w.lonmin -
|
||||
grid $w.lonsec -
|
||||
|
||||
grid $w.north $w.west
|
||||
grid $w.south $w.east
|
||||
@@ -406,15 +414,19 @@ proc CreateCustomH {} {
|
||||
# modify them willy-nilly
|
||||
set LAT_DEG $Config(LAT_DEG)
|
||||
set LAT_MIN $Config(LAT_MIN)
|
||||
set LAT_SEC $Config(LAT_SEC)
|
||||
set LON_DEG $Config(LON_DEG)
|
||||
set LON_MIN $Config(LON_MIN)
|
||||
set LON_SEC $Config(LON_SEC)
|
||||
if {!$Config(NORTHERN_HEMISPHERE)} {
|
||||
set LAT_DEG "-$LAT_DEG"
|
||||
set LAT_MIN "-$LAT_MIN"
|
||||
set LAT_SEC "-$LAT_SEC"
|
||||
}
|
||||
if {!$Config(WESTERN_HEMISPHERE)} {
|
||||
set LON_DEG "-$LON_DEG"
|
||||
set LON_MIN "-$LON_MIN"
|
||||
set LON_SEC "-$LON_SEC"
|
||||
}
|
||||
set Config(LOCATION) [$Loc.location get]
|
||||
|
||||
@@ -431,21 +443,15 @@ proc CreateCustomH {} {
|
||||
|
||||
while {[gets $in line] != -1} {
|
||||
switch -glob -- $line {
|
||||
"#define LAT_DEG *" {
|
||||
puts $out "#define LAT_DEG $LAT_DEG"
|
||||
.msgs insert end "#define LAT_DEG $LAT_DEG\n"
|
||||
"#define DEFAULT_LATITUDE *" {
|
||||
set lat [expr $LAT_DEG + ($LAT_MIN/60.0) + ($LAT_SEC/3600.0)];
|
||||
puts $out "#define DEFAULT_LATITUDE $lat"
|
||||
.msgs insert end "#define DEFAULT_LATITUDE $lat"
|
||||
}
|
||||
"#define LAT_MIN *" {
|
||||
puts $out "#define LAT_MIN $LAT_MIN"
|
||||
.msgs insert end "#define LAT_MIN $LAT_MIN\n"
|
||||
}
|
||||
"#define LON_DEG *" {
|
||||
puts $out "#define LON_DEG $LON_DEG"
|
||||
.msgs insert end "#define LON_DEG $LON_DEG\n"
|
||||
}
|
||||
"#define LON_MIN *" {
|
||||
puts $out "#define LON_MIN $LON_MIN"
|
||||
.msgs insert end "#define LON_MIN $LON_MIN\n"
|
||||
"#define DEFAULT_LONGITUDE *" {
|
||||
set lon [expr -1.0 * ($LON_DEG + ($LON_MIN/60.0) + ($LON_SEC/3600.0))]
|
||||
puts $out "#define DEFAULT_LONGITUDE $lon"
|
||||
.msgs insert end "#define DEFAULT_LONGITUDE $lon"
|
||||
}
|
||||
"#define LOCATION *" {
|
||||
puts $out "#define LOCATION \"$Config(LOCATION)\""
|
||||
@@ -758,14 +764,17 @@ proc SetConfigFromRemind {} {
|
||||
# Query Remind for the rest
|
||||
QueryRemind $rem LAT_DEG {$LatDeg}
|
||||
QueryRemind $rem LAT_MIN {$LatMin}
|
||||
QueryRemind $rem LAT_SEC {$LatSec}
|
||||
QueryRemind $rem LON_DEG {$LongDeg}
|
||||
QueryRemind $rem LON_MIN {$LongMin}
|
||||
QueryRemind $rem LON_SEC {$LongSec}
|
||||
QueryRemind $rem LOCATION {$Location}
|
||||
QueryRemind $rem DATESEP {$DateSep}
|
||||
QueryRemind $rem TIMESEP {$TimeSep}
|
||||
QueryRemind $rem LANGUAGE {language()}
|
||||
|
||||
set $Config(LAT_MIN) [expr abs($Config(LAT_MIN))]
|
||||
set $Config(LAT_SEC) [expr abs($Config(LAT_SEC))]
|
||||
if {$Config(LAT_DEG) >= 0} {
|
||||
set Config(NORTHERN_HEMISPHERE) 1
|
||||
} else {
|
||||
@@ -774,6 +783,7 @@ proc SetConfigFromRemind {} {
|
||||
}
|
||||
|
||||
set $Config(LON_MIN) [expr abs($Config(LON_MIN))]
|
||||
set $Config(LON_SEC) [expr abs($Config(LON_SEC))]
|
||||
if {$Config(LON_DEG) >= 0} {
|
||||
set Config(WESTERN_HEMISPHERE) 1
|
||||
} else {
|
||||
|
||||
61
configure
vendored
61
configure
vendored
@@ -622,6 +622,7 @@ ac_includes_default="\
|
||||
ac_header_list=
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
PERLARTIFACTS
|
||||
VERSION
|
||||
EGREP
|
||||
GREP
|
||||
@@ -681,6 +682,7 @@ SHELL'
|
||||
ac_subst_files=''
|
||||
ac_user_opts='
|
||||
enable_option_checking
|
||||
enable_perl_build_artifacts
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
host_alias
|
||||
@@ -1305,6 +1307,13 @@ if test -n "$ac_init_help"; then
|
||||
|
||||
cat <<\_ACEOF
|
||||
|
||||
Optional Features:
|
||||
--disable-option-checking ignore unrecognized --enable/--with options
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--disable-perl-build-artifacts
|
||||
Disable perllocal.pod and .packlist generation
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
CFLAGS C compiler flags
|
||||
@@ -2292,6 +2301,16 @@ EOF
|
||||
ac_config_headers="$ac_config_headers src/config.h"
|
||||
|
||||
|
||||
# Check whether --enable-perl-build-artifacts was given.
|
||||
if test "${enable_perl_build_artifacts+set}" = set; then :
|
||||
enableval=$enable_perl_build_artifacts; ac_cv_perlartifacts=$enableval
|
||||
else
|
||||
ac_cv_perlartifacts=yes
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@@ -3731,39 +3750,6 @@ fi
|
||||
done
|
||||
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned short" >&5
|
||||
$as_echo_n "checking size of unsigned short... " >&6; }
|
||||
if ${ac_cv_sizeof_unsigned_short+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned short))" "ac_cv_sizeof_unsigned_short" "$ac_includes_default"; then :
|
||||
|
||||
else
|
||||
if test "$ac_cv_type_unsigned_short" = yes; then
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error 77 "cannot compute sizeof (unsigned short)
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
ac_cv_sizeof_unsigned_short=0
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_short" >&5
|
||||
$as_echo "$ac_cv_sizeof_unsigned_short" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short
|
||||
_ACEOF
|
||||
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
@@ -3990,6 +3976,12 @@ if test "$GCC" = yes; then
|
||||
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
|
||||
fi
|
||||
|
||||
if test "$ac_cv_perlartifacts" = "yes" ; then
|
||||
PERLARTIFACTS=
|
||||
else
|
||||
PERLARTIFACTS='NO_PACKLIST=1 NO_PERLLOCAL=1'
|
||||
fi
|
||||
|
||||
for ac_func in setenv unsetenv glob mbstowcs setlocale initgroups
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
@@ -4002,7 +3994,8 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION=03.04.00
|
||||
VERSION=03.04.02
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf"
|
||||
|
||||
16
configure.in
16
configure.in
@@ -14,6 +14,12 @@ EOF
|
||||
|
||||
AC_CONFIG_HEADER(src/config.h)
|
||||
|
||||
AC_ARG_ENABLE(perl-build-artifacts,
|
||||
[ --disable-perl-build-artifacts
|
||||
Disable perllocal.pod and .packlist generation], ac_cv_perlartifacts=$enableval, ac_cv_perlartifacts=yes)
|
||||
|
||||
AH_BOTTOM([#include <custom.h>])
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
@@ -27,7 +33,6 @@ dnl Replace `main' with a function in -lm:
|
||||
AC_CHECK_LIB(m, sqrt)
|
||||
|
||||
dnl Integer sizes
|
||||
AC_CHECK_SIZEOF(unsigned short)
|
||||
AC_CHECK_SIZEOF(unsigned int)
|
||||
AC_CHECK_SIZEOF(unsigned long)
|
||||
|
||||
@@ -45,9 +50,16 @@ if test "$GCC" = yes; then
|
||||
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
|
||||
fi
|
||||
|
||||
if test "$ac_cv_perlartifacts" = "yes" ; then
|
||||
PERLARTIFACTS=
|
||||
else
|
||||
PERLARTIFACTS='NO_PACKLIST=1 NO_PERLLOCAL=1'
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
||||
VERSION=03.04.00
|
||||
VERSION=03.04.02
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(PERL)
|
||||
AC_SUBST(PERLARTIFACTS)
|
||||
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL rem2pdf/Makefile.top rem2pdf/bin/rem2pdf)
|
||||
chmod a+x rem2pdf/bin/rem2pdf
|
||||
|
||||
106
docs/WHATSNEW
106
docs/WHATSNEW
@@ -1,6 +1,77 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* VERSION 3.4 Patch 0 - 2022-??-??
|
||||
* VERSION 3.4 Patch 2 - 2022-??-??
|
||||
|
||||
- NEW FEATURE: remind: Add syntactic sugar to simplify some common
|
||||
types of reminders. See "SYNTACTIC SUGAR FOR REM" in the remind
|
||||
man page. Based on suggestions from Ian! D. Allen.
|
||||
|
||||
- NEW FEATURE: remind: Add the "trig" function to allow more
|
||||
expressiveness when creating triggers. See man page for details.
|
||||
|
||||
- IMPROVEMENT: tkremind: Tweak the calendar display; improve ability to
|
||||
customize colors, including supplying two built-in themes. Based on
|
||||
patch and suggestion from Paulo (last name unknown).
|
||||
|
||||
- CHANGE: remind: Increase $MaxSatIter default to 1000 instead of 150.
|
||||
Computers are much faster than when I first wrote remind and they
|
||||
can handle this higher limit easily. The higher limit also enables
|
||||
certain reasonable reminders that failed in the past because of the
|
||||
low SATISFY iteration limit.
|
||||
|
||||
- CHANGE: remind: The "||" operator now returns the value of the first
|
||||
non-zero operand rather than just returning 1 or 0. Similarly, "&&"
|
||||
returns 0 if either operand is false or the value of the last
|
||||
operand if both operands are true.
|
||||
|
||||
NOTE POTENTIAL INCOMPATIBILITY: Remind scripts that depend on ||
|
||||
and && always returning exactly one of 1 or 0 may need
|
||||
adjustment.
|
||||
|
||||
- CHANGE: The || and && operators can accept any non-STRING type as long
|
||||
as both operands have the same type. The "false" values are defined
|
||||
as follows; true values are any other value:
|
||||
|
||||
INT: 0
|
||||
TIME: 00:00
|
||||
DATE: '1990-01-01' (the Remind epoch)
|
||||
DATETIME: '1990-01-01@00:00' (the Remind epoch)
|
||||
|
||||
- IMPROVEMENT: remind: Issue diagnostics if an UNTIL or THROUGH date
|
||||
is earlier than any possible trigger date, as well as an UNTIL date
|
||||
with a fully-specified date and no repeat ("*N"). Suggestion from
|
||||
Ian! D. Allen.
|
||||
|
||||
- BUG FIX: tkremind: If the same moon phase appeared twice in a month,
|
||||
TkRemind would not display the first occurrence correctly. This has
|
||||
been fixed.
|
||||
|
||||
- BUG FIX: remind: The IF command documentation didn't reflect how it
|
||||
actually worked; now it does.
|
||||
|
||||
- BUG FIX: remind: Use correct UNTIL/THROUGH keyword in error message.
|
||||
|
||||
- BUG FIX: rem2pdf: Correct the calculation that warns about an over-full
|
||||
calendar box. Problem noted by Jonathan Kamens.
|
||||
|
||||
* VERSION 3.4 Patch 1 - 2022-02-23
|
||||
|
||||
- MINOR IMPROVEMENT: Support the INSTALL_BASE environment variable for
|
||||
installing rem2pdf in a non-standard location like your home directory.
|
||||
This is passed in to rem2pdf's Makefile at build and install time.
|
||||
|
||||
- MINOR IMPROVEMENT: ./configure: Add --disable-perl-build-artifacts flag
|
||||
to avoid installation of perllocal.pod and .packlist files.
|
||||
|
||||
- BUG FIX: tkremind: If the system date rolls over, update the display
|
||||
to correctly highlight the current date. This worked in older versions
|
||||
of Remind, but was broken by 03.04.00.
|
||||
|
||||
- BUG FIX: rem2pdf: The small calendar font would sometimes be scaled
|
||||
incorrectly so the small calendar overflowed the box. This has been
|
||||
fixed.
|
||||
|
||||
* VERSION 3.4 Patch 0 - 2022-02-10
|
||||
|
||||
- MAJOR CHANGE: Remind and its helpers (except for rem2ps) fully support
|
||||
UTF-8. If your system locale is a UTF-8 locale and your terminal
|
||||
@@ -11,7 +82,13 @@ CHANGES TO REMIND
|
||||
type that lets you format the text in the PDF calendar (by changing the
|
||||
font size, color, underlining, etc.)
|
||||
|
||||
rem2pdf requires the Pango and Cairo Perl modules.
|
||||
rem2pdf requires the Pango and Cairo Perl modules. On Debian or
|
||||
Debian-derived systems, these may be installed with:
|
||||
|
||||
apt install libpango-perl libcairo-perl
|
||||
|
||||
Unlike rem2ps, the default font in rem2pdf is "Sans" rather than
|
||||
"Helvetica", as Sans seems to be typeset better by the Pango library.
|
||||
|
||||
- NEW FEATURE: remind: New system variables $Sunday through $Saturday
|
||||
and $January through $December let you set weekday and month names
|
||||
@@ -22,9 +99,34 @@ CHANGES TO REMIND
|
||||
- NEW FEATURE: tkremind: If rem2pdf installed, TkRemind offers you the
|
||||
choice of PDF or PostScript output in the Print dialog.
|
||||
|
||||
- CHANGE: remind: Increase the number of allowed "full OMITs" from 500
|
||||
to 1000.
|
||||
|
||||
- CHANGE: Remove the annoying code that slowed compilation and running
|
||||
on Windows and Mac OS X. I believe the point has been made and free
|
||||
OSes have enough of a critical mass that the annoyances are
|
||||
counter-productive.
|
||||
|
||||
- CLEANUP: remind: C source code: Replace the LAT_DEG, LAT_MIN,
|
||||
LAT_SEC and LON_DEG, LON_MIN, LON_SEC macros with DEFAULT_LATITUDE
|
||||
and DEFAULT_LONGITUDE.
|
||||
|
||||
- CLEANUP: remind: C source code: Remove various unused or obsolete macros.
|
||||
|
||||
- BUG FIXES: Minor fixups to groff source and Makefiles courtesy of
|
||||
Jochen Sprickerhof.
|
||||
|
||||
- BUG FIX: Properly support formatting of double-wide characters in the
|
||||
terminal mode "remind -c" calendar.
|
||||
|
||||
- BUG FIX: rem2html: Document how to highlight today with a red border
|
||||
|
||||
- BUG FIX: rem2html: Generate and install a man page for rem2html
|
||||
|
||||
- BUG FIX: remind: Get rid of LAT_DEG/LAT_MIN/LAT_SEC and
|
||||
LON_DEG/LON_MIN/LON_SEC macros in favour of DEFAULT_LATITUDE and
|
||||
DEFAULT_LONGITUDE.
|
||||
|
||||
- IMPROVEMENT: All localized languages now use UTF-8 exclusively.
|
||||
Support for old character encodings like ISO-8859-1 and ISO-8859-2
|
||||
has been dropped since modern UNIXes have pretty much standardized
|
||||
|
||||
@@ -675,4 +675,5 @@ You should ensure that the values you supply for margin widths are sensible.
|
||||
If they are too big for the media size, \fBRem2ps\fR will not complain,
|
||||
but again, the PostScript output will probably not work.
|
||||
.SH SEE ALSO
|
||||
\fBremind\fR, \fBrem2pdf\fR
|
||||
\fBremind\fR, \fBrem2pdf\fR, \fBrem2html\fR, \fBtkremind\fR.
|
||||
|
||||
|
||||
254
man/remind.1
254
man/remind.1
@@ -267,7 +267,7 @@ calendar output.
|
||||
.TP
|
||||
\fB\-x\fR[\fIn\fR]
|
||||
Sets the iteration limit for the \fBSATISFY\fR clause of a \fBREM\fR
|
||||
command. Defaults to 150.
|
||||
command. Defaults to 1000.
|
||||
.TP
|
||||
\fB\-k\fR\fIcmd\fR
|
||||
Instead of simply printing \fBMSG\fR-type
|
||||
@@ -814,7 +814,8 @@ could be specified as:
|
||||
However, events that do not repeat daily, weekly, monthly or yearly require
|
||||
another approach. The \fIrepeat\fR component of the \fBREM\fR command
|
||||
fills this need. To use it, you must completely specify a date (year, month
|
||||
and day, and optionally weekday.) The \fIrepeat\fR component is an asterisk
|
||||
and day, and optionally weekday); this is the start date of the
|
||||
repetition period. The \fIrepeat\fR component is an asterisk
|
||||
followed by a number specifying the repetition period in days.
|
||||
.PP
|
||||
For example, suppose you get paid every second Wednesday, and your
|
||||
@@ -824,12 +825,12 @@ last payday was Wednesday, 28 October, 1992. You can use:
|
||||
REM 28 Oct 1992 *14 MSG Payday
|
||||
.fi
|
||||
.PP
|
||||
This issues the reminder every 14 days, starting from the calculated trigger
|
||||
date. You can use \fIdelta\fR and \fIback\fR with \fIrepeat.\fR Note,
|
||||
however, that the \fIback\fR is used only to compute the initial
|
||||
trigger date; thereafter, the reminder repeats with the specified
|
||||
This issues the reminder every 14 days, starting from 28 Oct 1992.
|
||||
You can use \fIdelta\fR and \fIback\fR with \fIrepeat.\fR Note,
|
||||
however, that the \fIback\fR is used only to compute the starting
|
||||
date; thereafter, the reminder repeats with the specified
|
||||
period. Similarly, if you specify a weekday, it is used only to calculate
|
||||
the initial date, and does not affect the repetition period.
|
||||
the starting date, and does not affect the repetition period.
|
||||
.PP
|
||||
.B SCANFROM \fRand\fB FROM
|
||||
.PP
|
||||
@@ -1152,6 +1153,84 @@ Note that \fIduration\fR is specified either in hours and minutes as a
|
||||
duration of 00:00 or 0, then \fBRemind\fR behaves exactly as if no
|
||||
\fBDURATION\fR at all had been present.
|
||||
|
||||
.PP
|
||||
.SH SYNTACTIC SUGAR FOR REM
|
||||
.PP
|
||||
The REM command has syntactic sugar to let you express common
|
||||
reminders. The following pairs of reminders are equivalent:
|
||||
.PP
|
||||
.nf
|
||||
REM First Monday April MSG Foo
|
||||
REM Mon 1 April MSG Foo
|
||||
|
||||
REM Second Monday May MSG Bar
|
||||
REM Mon 8 May MSG Bar
|
||||
|
||||
REM Third Monday MSG Third Monday of every month
|
||||
REM Mon 15 MSG Third Monday of every month
|
||||
|
||||
REM Fourth Sunday June 2025 MSG Fourth Sunday in June 2025
|
||||
REM Sun 22 June 2025 MSG Fourth Sunday in June 2025
|
||||
|
||||
REM Last Monday MSG Last Monday of every month
|
||||
REM Mon 1 --7 MSG Last Monday of every month
|
||||
|
||||
REM Last Monday April MSG Last Monday of every April
|
||||
REM Mon 1 May --7 MSG Last Monday of every April
|
||||
|
||||
REM Last Monday December 2025 MSG Last Monday of Dec 2025
|
||||
REM Monday 1 Jan 2026 --7 MSG Last Monday of Dec 2025
|
||||
.fi
|
||||
.PP
|
||||
Note that \fBLast\fR effectively adjusts the month and year, if necessary, to
|
||||
make the reminder trigger on the correct date.
|
||||
.PP
|
||||
The keyword \fBIN\fR is completely ignored, so you can write (for example):
|
||||
.PP
|
||||
.nf
|
||||
REM Second Monday in May MSG foo
|
||||
REM Last Monday in December 2025 MSG Bar
|
||||
.fi
|
||||
.PP
|
||||
An alternate form of \fIback\fR makes writing reminders easier.
|
||||
The following groups of reminders are equivalent:
|
||||
.PP
|
||||
.nf
|
||||
REM ~~1 MSG Last day of every month
|
||||
REM Lastday MSG Last day of every month
|
||||
REM 1 --1 MSG Last day of every month
|
||||
|
||||
REM May ~~1 MSG Last day of May
|
||||
REM Lastday May MSG Last day of May
|
||||
REM 1 June --1 MSG Last day of May
|
||||
|
||||
REM Dec 2025 ~~1 MSG Last day of December 2025
|
||||
REM Lastday Dec 2025 MSG Last day of December 2025
|
||||
REM 1 Jan 2026 --1 MSG Last day of December 2025
|
||||
|
||||
REM Apr ~1 OMIT SAT SUN MSG Last workday of April
|
||||
REM Lastworkday April OMIT SAT SUN MSG Last workday of April
|
||||
REM 1 May -1 OMIT SAT SUN MSG Last workday of April
|
||||
|
||||
REM Apr ~~7 MSG Seventh-last day of April
|
||||
REM 1 May --7 MSG Seventh-last day of April
|
||||
|
||||
REM Apr ~2 OMIT SAT SUN MSG Second-last workday of April
|
||||
REM 1 May -2 OMIT SAT SUN MSG Second-last workday of April
|
||||
.fi
|
||||
.PP
|
||||
As we see, "Lastday" is equivalent to ~~1 and "Lastworkday" to ~1.
|
||||
.PP
|
||||
Note that the First/Second/Third/Fourth/Last keywords and the ~ and ~~ form
|
||||
of \fIback\fR imply a value for the day of the month; as such, they cannot
|
||||
be combined with a day. Additionally, First/Second/Third/Fourth/Last
|
||||
must have at least one weekday name. The following are illegal:
|
||||
.PP
|
||||
.nf
|
||||
REM First Monday 3 June MSG Huh?
|
||||
REM April 3 ~~1 MSG What?
|
||||
REM Second June MSG Where's the weekday???
|
||||
.fi
|
||||
.PP
|
||||
.SH THE SUBSTITUTION FILTER
|
||||
.PP
|
||||
@@ -1828,7 +1907,7 @@ quotes \fImust\fR be supplied. This distinguishes date constants
|
||||
from division or subtraction of integers. Examples:
|
||||
.PP
|
||||
.RS
|
||||
\'1993/02/22', '1992-12-25', '1999/01/01'
|
||||
\(aq1993/02/22', '1992-12-25', '1999/01/01'
|
||||
.PP
|
||||
Note that \fBDATE\fR values are \fIprinted\fR
|
||||
without the quotes. Although either '-' or '/' is accepted as a date
|
||||
@@ -1846,13 +1925,33 @@ constants with the addition of an "@HH:MM" part, optionally followed
|
||||
by "am" or "pm". For example:
|
||||
.PP
|
||||
.RS
|
||||
\'2008-04-05@23:11', '1999/02/03@14:06', '2001-04-07@08:30', '2020-01-01@3:20pm'
|
||||
\(aq2008-04-05@23:11', '1999/02/03@14:06', '2001-04-07@08:30', '2020-01-01@3:20pm'
|
||||
.PP
|
||||
\fBDATETIME\fR values are printed without the quotes. Notes about date
|
||||
and time separator characters for \fBDATE\fR and \fBTIME\fR constants apply
|
||||
also to \fBDATETIME\fR constants.
|
||||
.RE
|
||||
.PP
|
||||
.B ZERO VALUES
|
||||
.PP
|
||||
The non-string types all have an associated \fIzero\fR value, which is
|
||||
treated as "false" by the IF command and the logical operators. The
|
||||
zero values are:
|
||||
.PP
|
||||
.RS
|
||||
.PP
|
||||
\fBINT\fR - 0
|
||||
.PP
|
||||
\fBDATE\fR - '1990-01-01'
|
||||
.PP
|
||||
\fBTIME\fR - 00:00
|
||||
.PP
|
||||
\fBDATETIME\fR - '1990-01-01@00:00'
|
||||
.RE
|
||||
.PP
|
||||
Additionally, for the purpose of the IF command (but \fInot\fR the
|
||||
logical operators) the empty string "" is considered a false value.
|
||||
.PP
|
||||
.B OPERATORS
|
||||
.PP
|
||||
\fBRemind\fR has the following operators. Operators on the same line
|
||||
@@ -1976,14 +2075,16 @@ If the operands are not of the same type, == returns 0 and != returns
|
||||
.RE
|
||||
.TP
|
||||
.B &&
|
||||
This is the logical AND operator. Both of its operands must be of
|
||||
type \fBINT\fR. It returns 1 if both operands are non-zero, and 0
|
||||
otherwise.
|
||||
This is the logical AND operator. Both of its operands must be of the
|
||||
same type and must not be \fBSTRING\fR type. Returns the second
|
||||
operand if both operands are non-zero. Otherwise, returns a zero
|
||||
of the same type as the operands.
|
||||
.TP
|
||||
.B ||
|
||||
This is the logical OR operator. Both of its operands must be of
|
||||
type \fBINT\fR. It returns 1 if either operand is non-zero, and 0
|
||||
otherwise.
|
||||
the same type and must not be of \fBSTRING\fR type. It returns
|
||||
the first operand that is non-zero; if both operands are zero, then
|
||||
returns a zero of the same type as the operands.
|
||||
.PP
|
||||
.B NOTES
|
||||
.PP
|
||||
@@ -2418,7 +2519,7 @@ Returns the time of "astronomical twilight" on the specified \fIdate\fR. If
|
||||
.TP
|
||||
.B ampm(tq_time [,s_am [,s_pm]])
|
||||
Returns a \fBSTRING\fR that is the result of converting \fItime\fR
|
||||
(which is either a \fBTIME\R or a \fBDATETIME\fR object) to "AM/PM"
|
||||
(which is either a \fBTIME\fR or a \fBDATETIME\fR object) to "AM/PM"
|
||||
format. The optional arguments \fIam\fR and \fIpm\fR are the strings
|
||||
to append in the AM and PM case, respectively; they default to "AM"
|
||||
and "PM". The function obeys the system variables $DateSep,
|
||||
@@ -3116,6 +3217,114 @@ Returns \fBRemind\fR's notion of "today." This may be the actual system
|
||||
date, or a date supplied on the command line, or the date of the
|
||||
calendar entry currently being computed.
|
||||
.TP
|
||||
.B trig(s_1 [,s_2, ...])
|
||||
For each string argument s_\fIn\fR, \fBtrig\fR evaluates s_\fIn\fR
|
||||
as if it were a REM or IFTRIG trigger
|
||||
specification. If the trigger would trigger today, then the trigger
|
||||
date is returned and no further triggers are evaluated. If none
|
||||
of the triggers would trigger today, then the zero date
|
||||
1990-01-01 is returned.
|
||||
.RS
|
||||
\fBtrig\fR also has a zero-argument form; this returns the trigger
|
||||
date of the \fImost recent\fR \fBtrig\fR function that returned a
|
||||
non-zero trigger date.
|
||||
.PP
|
||||
\fBtrig\fR can be used to make more sophisticated versions of
|
||||
\fBIFTRIG\fR. For example, if you have meetings every Monday in
|
||||
June and July, and you want warnings 3 days in advance, you
|
||||
could use:
|
||||
.nf
|
||||
REM [trig("Mon Jun +3", "Mon July +3")] +3 MSG Meeting %b
|
||||
.fi
|
||||
.PP
|
||||
NOTE: We need to repeat the +3 delta outside of the \fBtrig\fR
|
||||
function for advance warning to work properly. This is because
|
||||
\fBtrig\fR returns a date constant (the trigger date) and the
|
||||
REM command does not know the details of \fBtrig\fR's arguments.
|
||||
.PP
|
||||
Note that because \fBRemind\fR does not have short-circuit logical
|
||||
operators, something like:
|
||||
.PP
|
||||
.nf
|
||||
SET a trig("Mon +7") || trig("Fri +7")
|
||||
.fi
|
||||
|
||||
would set the value of trig() to the date of the following
|
||||
Thursday. Even though trig("Mon +7") always returns true,
|
||||
the logical-OR operator still evaluates trig("Fri +7") which
|
||||
\fIalso\fR returns true and sets \fBtrig()\fR.
|
||||
.PP
|
||||
You can work around the lack of a short-circuit logical-OR as follows:
|
||||
If \fBtrig\fR returns a true value, the specific value it returns
|
||||
can be coerced to a DATE which is the trigger date. So the following code:
|
||||
.PP
|
||||
.nf
|
||||
SET a trig("Mon +4") || trig("Fri +4")
|
||||
IF a
|
||||
REM [a] +4 MSG [wkday($T)] %b.
|
||||
ENDIF
|
||||
.fi
|
||||
.PP
|
||||
would operate as follows:
|
||||
.PP
|
||||
.nf
|
||||
On Monday: Monday today.
|
||||
On Tuesday: Friday in 3 days' time.
|
||||
On Wednesday: Friday in 2 days' time.
|
||||
On Thursday: Monday in 4 days' time.
|
||||
On Friday: Monday in 3 days' time.
|
||||
On Saturday: Monday in 2 days' time.
|
||||
On Sunday: Monday tomorrow.
|
||||
.fi
|
||||
.PP
|
||||
Compare with the following:
|
||||
.PP
|
||||
.nf
|
||||
SET a trig("Mon +4") || trig("Fri +4")
|
||||
IF a
|
||||
REM [trig()] +4 MSG [wkday($T)] %b.
|
||||
ENDIF
|
||||
.fi
|
||||
.PP
|
||||
which yields:
|
||||
.PP
|
||||
.nf
|
||||
On Monday: Friday in 4 days' time.
|
||||
On Tuesday: Friday in 3 days' time.
|
||||
On Wednesday: Friday in 2 days' time.
|
||||
On Thursday: Friday tomorrow.
|
||||
On Friday: Friday today.
|
||||
On Saturday: Monday in 2 days' time.
|
||||
On Sunday: Monday tomorrow.
|
||||
.fi
|
||||
.PP
|
||||
That is because \fBtrig()\fR returns the trigger date of
|
||||
the \fIlast\fR trig function that returns true,
|
||||
whereas the value of \fBa\fR is the trigger date of the \fIfirst\fR
|
||||
trig function that returns true.
|
||||
.PP
|
||||
\fBImportant Note\fR: Because \fBtrig()\fR always returns an absolute
|
||||
date, it will \fBnot\fR work properly with a \fBSATISFY\fR clause.
|
||||
Consider this reminder:
|
||||
.PP
|
||||
.nf
|
||||
REM [trig("Mar", "Apr")] SATISFY [$Td == 15] MSG 15 Mar or April
|
||||
.fi
|
||||
.PP
|
||||
If we run \fBRemind\fR on 5 March 2022, we might expect the trigger
|
||||
date to be calculated as 15 March 2022... but that's not what happens.
|
||||
Instead, the \fBtrig\fR function is evaluated first, and it returns
|
||||
2022-03-05. So as far as \fBRemind\fR is concerned, the REM statement
|
||||
becomes:
|
||||
.PP
|
||||
.nf
|
||||
REM 2022-03-05 SATISFY [$Td == 15] MSG 15 Mar or April
|
||||
.fi
|
||||
.PP
|
||||
and the SATISFY expression is never true. So: \fIDo not mix
|
||||
trig() and SATISFY\fR.
|
||||
.RE
|
||||
.TP
|
||||
.B trigdate()
|
||||
Returns the calculated trigger date of the last \fBREM\fR
|
||||
or \fBIFTRIG\fR command. If used
|
||||
@@ -3532,12 +3741,12 @@ Note that the commands are shown indented for clarity. Also, the \fBELSE\fR
|
||||
portion can be omitted. \fBIF\fR commands can be nested up to a small limit,
|
||||
probably around 8 or 16 levels of nesting, depending on your system.
|
||||
.PP
|
||||
If the \fIexpr\fR evaluates to a non-zero \fBINT\fR, or a non-null
|
||||
\fBSTRING\fR, then the \fBIF\fR portion is considered true, and the
|
||||
\fIt-commands\fR are executed. If \fIexpr\fR evaluates to zero or
|
||||
null, then the \fIf-commands\fR (if the \fBELSE\fR portion is present)
|
||||
are executed. If \fIexpr\fR is not of type \fBINT\fR or \fBSTRING\fR,
|
||||
then it is an error.
|
||||
If the \fIexpr\fR evaluates to a non-zero \fBINT\fR, a \fBDATE\fR that
|
||||
is not 1990-01-01, a \fBTIME\fR that is not 00:00, a \fBDATETIME\fR
|
||||
that is not 1990-01-01@00:00, or a non-null \fBSTRING\fR, then the
|
||||
\fBIF\fR portion is considered true, and the \fIt-commands\fR are
|
||||
executed. If \fIexpr\fR evaluates to zero or null, then the
|
||||
\fIf-commands\fR (if the \fBELSE\fR portion is present) are executed.
|
||||
.PP
|
||||
Examples:
|
||||
.PP
|
||||
@@ -5050,4 +5259,5 @@ Catalog\fR, Jewish Publication Society of America.
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
\fBrem\fR(1), \fBrem2ps\fR(1), \fBrem2pdf\fR(1), \fBtkremind\fR(1)
|
||||
\fBrem\fR(1), \fBrem2ps\fR(1), \fBrem2pdf\fR(1), \fBtkremind\fR(1), \fBrem2html\fR(1)
|
||||
|
||||
|
||||
@@ -402,4 +402,5 @@ $HOME/.reminders -- default reminder file.
|
||||
$HOME/.tkremindrc -- \fBTkRemind\fR saved options.
|
||||
|
||||
.SH SEE ALSO
|
||||
remind, rem2ps
|
||||
\fBremind\fR, \fBrem2ps\fR, \fBrem2pdf\fR, \fBrem2html\fR
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ install:
|
||||
$(PERL) -M$$m -e 1 > /dev/null 2>&1; \
|
||||
if test $$? != 0 ; then echo "Not installing rem2html; missing $$m"; exit 0; fi; \
|
||||
done; \
|
||||
pod2man rem2html > rem2html.1 && mkdir -p $(DESTDIR)$(mandir)/man1 && cp rem2html.1 $(DESTDIR)$(mandir)/man1/rem2html.1 || true; \
|
||||
echo "Installing rem2html in $(DESTDIR)$(bindir)"; \
|
||||
mkdir -p $(DESTDIR)$(bindir) && sed -e 's|^#!perl|#!$(PERL)|' < rem2html > $(DESTDIR)$(bindir)/rem2html && chmod 755 $(DESTDIR)$(bindir)/rem2html && exit 0; \
|
||||
exit 1;
|
||||
|
||||
@@ -68,7 +68,7 @@ and newmoon.png, which are expected to live in C<--imgbase>.
|
||||
=item --stylesheet I<url.css>
|
||||
|
||||
Use I<url.css> as the stylesheet. If this option is used,
|
||||
I<url.css> is interpreted relative to B<imgbase> I<unless> it start
|
||||
I<url.css> is interpreted relative to B<imgbase> I<unless> it starts
|
||||
with a "/".
|
||||
|
||||
=item --nostyle
|
||||
@@ -96,11 +96,43 @@ Insert I<html_text> right before the E<lt>/bodyE<gt> tag.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SPECIALS SUPPORTED
|
||||
|
||||
The rem2html back-end supports the following SPECIAL reminders:
|
||||
|
||||
=over
|
||||
|
||||
=item HTML
|
||||
|
||||
Add an HTML reminder to the calendar. All HTML tags are available.
|
||||
|
||||
=item HTMLCLASS
|
||||
|
||||
Add a CSS class to the box representing the trigger date. See
|
||||
"HIGHLIGHTING TODAY" for an example
|
||||
|
||||
=item WEEK, MOON, SHARE, COLOR
|
||||
|
||||
The standard SPECIALs supported by all back-ends
|
||||
|
||||
=back
|
||||
|
||||
=head1 HIGHLIGHTING TODAY
|
||||
|
||||
Older versions of rem2html used to highlight today's date with a red outline.
|
||||
The current version does not do that by default. If you wish to highlight
|
||||
today's date, add the following reminder to your reminders file:
|
||||
|
||||
REM [realtoday()] SPECIAL HTMLCLASS rem-today
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
rem2html was written by Dianne Skoll with much inspiration from an
|
||||
earlier version by Don Schwarz.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
B<remind>, B<rem2ps>, B<rem2pdf>, B<tkremind>
|
||||
=cut
|
||||
|
||||
sub usage
|
||||
@@ -487,7 +519,7 @@ sub output_calendar
|
||||
}
|
||||
|
||||
for (my $day=1; $day<=$Numdays; $day++) {
|
||||
draw_day_cell($day, $number_of_rows);
|
||||
draw_day_cell($day, $number_of_rows);
|
||||
$col++;
|
||||
if ($col == 7) {
|
||||
$col = 0;
|
||||
|
||||
@@ -29,15 +29,14 @@ install:
|
||||
if test $$? != 0 ; then echo "Not installing rem2pdf; missing $$m"; exit 0; fi; \
|
||||
done; \
|
||||
echo "Installing rem2pdf"; \
|
||||
if test "$(prefix)" = "/usr" ; then \
|
||||
if test "$(INSTALL_BASE)" != "" ; then \
|
||||
$(MAKE) install DESTDIR=$(DESTDIR) "INSTALL_BASE=$(INSTALL_BASE)" && exit 0; \
|
||||
elif test "$(prefix)" = "/usr" ; then \
|
||||
$(MAKE) install DESTDIR=$(DESTDIR) INSTALLDIRS=vendor && exit 0; \
|
||||
else \
|
||||
$(MAKE) install DESTDIR=$(DESTDIR) && exit 0; \
|
||||
fi; \
|
||||
exit 1;
|
||||
|
||||
|
||||
|
||||
|
||||
Makefile: Makefile.PL
|
||||
$(PERL) Makefile.PL || true
|
||||
$(PERL) Makefile.PL @PERLARTIFACTS@ INSTALL_BASE=$(INSTALL_BASE) || true
|
||||
|
||||
@@ -40,14 +40,14 @@ my $settings = {
|
||||
width => 0,
|
||||
height => 0,
|
||||
|
||||
title_font => 'Helvetica',
|
||||
header_font => 'Helvetica',
|
||||
daynum_font => 'Helvetica Bold Oblique',
|
||||
entry_font => 'Helvetica',
|
||||
small_cal_font => 'Helvetica',
|
||||
title_font => 'Sans',
|
||||
header_font => 'Sans',
|
||||
daynum_font => 'Sans Bold Oblique',
|
||||
entry_font => 'Sans',
|
||||
small_cal_font => 'Sans',
|
||||
|
||||
title_size => 14,
|
||||
header_size => 14,
|
||||
header_size => 12,
|
||||
daynum_size => 14,
|
||||
entry_size => 8,
|
||||
|
||||
@@ -186,10 +186,11 @@ my $errored_out = 0;
|
||||
my $surface = Cairo::PdfSurface->create_for_stream(sub { print $_[1] unless $errored_out; }, undef,
|
||||
$settings->{width}, $settings->{height});
|
||||
|
||||
$surface->set_metadata('title', 'Calendar');
|
||||
$surface->set_metadata('author', 'Remind (https://dianne.skoll.ca/projects/remind/)');
|
||||
$surface->set_metadata('creator', 'rem2pdf (https://dianne.skoll.ca/projects/remind/)');
|
||||
$surface->set_metadata('subject', 'Calendar');
|
||||
# set_metadata not available in older versions of Cairo
|
||||
eval { $surface->set_metadata('title', 'Calendar'); };
|
||||
eval { $surface->set_metadata('author', 'Remind (https://dianne.skoll.ca/projects/remind/)'); };
|
||||
eval { $surface->set_metadata('creator', 'rem2pdf (https://dianne.skoll.ca/projects/remind/)'); };
|
||||
eval { $surface->set_metadata('subject', 'Calendar'); };
|
||||
|
||||
my $cr = Cairo::Context->create($surface);
|
||||
$cr->set_line_width($settings->{line_thickness});
|
||||
@@ -355,27 +356,27 @@ width and height for the options to be respected.
|
||||
=item --title-font=I<font>
|
||||
|
||||
Specify the font used for the calendar title. It can be any font that
|
||||
the Pango library on your system can use. The default is Helvetica. If
|
||||
the Pango library on your system can use. The default is Sans. If
|
||||
you choose a font with spaces in its name, you may need to quote this
|
||||
argument.
|
||||
|
||||
=item --header-font=I<font>
|
||||
|
||||
Specify the font used for the weekday names. The default is Helvetica.
|
||||
Specify the font used for the weekday names. The default is Sans.
|
||||
|
||||
=item --daynum-font=I<font>
|
||||
|
||||
Specify the font used for the day numbers. The default is
|
||||
Helvetica Bold Oblique.
|
||||
Sans Bold Oblique.
|
||||
|
||||
=item --entry-font=I<font>
|
||||
|
||||
Specify the font used for calendar entries. The default is Helvetica.
|
||||
Specify the font used for calendar entries. The default is Sans.
|
||||
|
||||
=item --small-cal-font=I<font>
|
||||
|
||||
Specify the font used for the small next- and previous-month
|
||||
calendars. The default is Helvetica.
|
||||
calendars. The default is Sans.
|
||||
|
||||
=item --title-size=I<n>
|
||||
|
||||
@@ -504,4 +505,5 @@ B<Rem2PDF> was written by Dianne Skoll <dianne@skoll.ca>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
B<remind>, B<rem2ps>
|
||||
B<remind>, B<rem2ps>, B<rem2html>, B<tkremind>
|
||||
|
||||
|
||||
@@ -231,6 +231,10 @@ sub parse_oldstyle_line
|
||||
$hash->{r} = $1;
|
||||
$hash->{g} = $2;
|
||||
$hash->{b} = $3;
|
||||
} elsif ($hash->{body} =~ /^\s*(\d+)/) {
|
||||
$hash->{r} = $1;
|
||||
$hash->{g} = $1;
|
||||
$hash->{b} = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -633,7 +637,7 @@ sub draw_day
|
||||
$so_far += $h2;
|
||||
}
|
||||
if ($height) {
|
||||
if ($entry_height > $height) {
|
||||
if ($h + $entry_height + 2 * $settings->{border_size} > $height) {
|
||||
print STDERR "WARNING: overfull box at $day " . $self->{monthname} . ' ' . $self->{year} . "\n";
|
||||
$entry_height = $height;
|
||||
}
|
||||
@@ -701,7 +705,8 @@ sub draw_title
|
||||
my ($self, $cr, $settings) = @_;
|
||||
my $title = $self->{monthname} . ' ' . $self->{year};
|
||||
|
||||
$cr->get_target()->set_page_label($title);
|
||||
# set_page_label not available in older versions of Cairo
|
||||
eval { $cr->get_target()->set_page_label($title); };
|
||||
my $layout = Pango::Cairo::create_layout($cr);
|
||||
$layout->set_text(Encode::decode('UTF-8', $title));
|
||||
my $desc = Pango::FontDescription->from_string($settings->{title_font} . ' ' . $settings->{title_size} . 'px');
|
||||
@@ -748,24 +753,13 @@ sub draw_small_calendar
|
||||
$last_day_on_row += 7;
|
||||
$rows++;
|
||||
}
|
||||
my $layout = Pango::Cairo::create_layout($cr);
|
||||
my $desc = Pango::FontDescription->from_string($settings->{small_cal_font} . ' ' . '10px');
|
||||
$layout->set_font_description($desc);
|
||||
$layout->set_text('88 88 88 88 88 88 88');
|
||||
my ($wid, $h) = $layout->get_pixel_size();
|
||||
$h += 1;
|
||||
$h *= ($rows + 2); # row for month name; row for day names
|
||||
my $font_size = $self->calculate_small_calendar_font_size($cr, $width, $height, $settings, $rows);
|
||||
|
||||
my $scale = $width / $wid;
|
||||
if (($height / $h) < $scale) {
|
||||
$scale = $height / $h;
|
||||
}
|
||||
my $font_size = int($scale * 10);
|
||||
$layout = Pango::Cairo::create_layout($cr);
|
||||
$desc = Pango::FontDescription->from_string($settings->{small_cal_font} . ' ' . $font_size . 'px');
|
||||
my $layout = Pango::Cairo::create_layout($cr);
|
||||
my $desc = Pango::FontDescription->from_string($settings->{small_cal_font} . ' ' . $font_size . 'px');
|
||||
$layout->set_font_description($desc);
|
||||
$layout->set_text('88 ');
|
||||
($wid, $h) = $layout->get_pixel_size();
|
||||
my ($wid, $h) = $layout->get_pixel_size();
|
||||
$h += 1;
|
||||
|
||||
# Month name
|
||||
@@ -819,6 +813,43 @@ sub draw_small_calendar
|
||||
}
|
||||
}
|
||||
|
||||
sub calculate_small_calendar_font_size
|
||||
{
|
||||
my ($self, $cr, $width, $height, $settings, $rows) = @_;
|
||||
|
||||
my $layout = Pango::Cairo::create_layout($cr);
|
||||
my $desc = Pango::FontDescription->from_string($settings->{small_cal_font} . ' ' . '10px');
|
||||
$layout->set_font_description($desc);
|
||||
$layout->set_text('88 88 88 88 88 88 88');
|
||||
my ($wid, $h) = $layout->get_pixel_size();
|
||||
$h += 1;
|
||||
$h *= ($rows + 2); # row for month name; row for day names
|
||||
|
||||
my $scale = $width / $wid;
|
||||
if (($height / $h) < $scale) {
|
||||
$scale = $height / $h;
|
||||
}
|
||||
my $font_size = int($scale * 10);
|
||||
|
||||
# Check
|
||||
$desc = Pango::FontDescription->from_string($settings->{small_cal_font} . ' ' . $font_size . 'px');
|
||||
$layout->set_font_description($desc);
|
||||
$layout->set_text('88 88 88 88 88 88 88');
|
||||
($wid, $h) = $layout->get_pixel_size();
|
||||
$h += 1;
|
||||
$h *= ($rows + 2); # row for month name; row for day names
|
||||
|
||||
$scale = $width / $wid;
|
||||
if (($height / $h) < $scale) {
|
||||
$scale = $height / $h;
|
||||
}
|
||||
|
||||
if ($scale < 1) { # Font size is too big
|
||||
$font_size--;
|
||||
}
|
||||
return $font_size;
|
||||
}
|
||||
|
||||
package Remind::PDF::Multi;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
266
scripts/tkremind
266
scripts/tkremind
@@ -127,6 +127,12 @@ set OptDescr(BackgroundColor) "Default background color of calendar boxes"
|
||||
set Option(TextColor) "#000000"
|
||||
set OptDescr(TextColor) "Default text color in calendar boxes"
|
||||
|
||||
set Option(TodayColor) "#00C0C0"
|
||||
set OptDescr(TodayColor) "Background color for today heading"
|
||||
|
||||
set Option(LineColor) "#000000"
|
||||
set OptDescr(LineColor) "Color of gridlines on calendar"
|
||||
|
||||
set Option(LabelColor) "#000000"
|
||||
set OptDescr(LabelColor) "Default label color for headings"
|
||||
|
||||
@@ -282,7 +288,17 @@ proc is_warning_header { line } {
|
||||
proc Initialize {} {
|
||||
global DayNames argc argv CommandLine ReminderFile AppendFile Remind PSCmd
|
||||
global MondayFirst TwentyFourHourMode ReminderFileModTime
|
||||
global TodayDay TodayMonth TodayYear
|
||||
|
||||
global Option ConfigFile
|
||||
|
||||
# In case date has rolled over, recalculate Today* values
|
||||
set now [clock seconds]
|
||||
|
||||
set TodayMonth [expr [string trim [clock format $now -format %N]] - 1]
|
||||
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 i 0
|
||||
@@ -449,7 +465,7 @@ proc CreateCalFrame { w dayNames } {
|
||||
}
|
||||
|
||||
global MondayFirst
|
||||
frame $w -background $Option(WinBackground)
|
||||
frame $w -background $Option(LineColor)
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
if {$MondayFirst} {
|
||||
set index [expr ($i+1)%7]
|
||||
@@ -457,28 +473,31 @@ proc CreateCalFrame { w dayNames } {
|
||||
set index $i
|
||||
}
|
||||
|
||||
label $w.day$i -border 1 -text [lindex $dayNames $index] -justify center -font HeadingFont -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
grid configure $w.day$i -row 0 -column $i -sticky ew
|
||||
label $w.day$i -bd 0 -text [lindex $dayNames $index] -justify center -font HeadingFont -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||
grid configure $w.day$i -row 0 -column $i -sticky ew -padx 1 -pady 1
|
||||
}
|
||||
for {set i 0} {$i < 6} {incr i} {
|
||||
set n [expr $i*7]
|
||||
for {set j 0} {$j < 7} {incr j} {
|
||||
set f [expr $n+$j]
|
||||
button $w.l$f -text "" -justify center -command "" \
|
||||
-state disabled -relief flat -border 0 -padx 0 -pady 0 -font HeadingFont
|
||||
text $w.t$f -width 12 -height $h -border 1 -spacing3 3 -wrap word -relief flat \
|
||||
-state disabled -takefocus 0 -cursor {} -font CalboxFont -foreground $Option(TextColor) -background $Option(BackgroundColor)
|
||||
-state disabled -relief flat -bd 0 -padx 0 -pady 0 -font HeadingFont -highlightthickness 1
|
||||
text $w.t$f -width 12 -height $h -bd 0 -spacing3 3 -wrap word -relief flat \
|
||||
-state disabled -takefocus 0 -cursor {} -font CalboxFont -foreground $Option(TextColor) -background $Option(BackgroundColor) \
|
||||
-highlightthickness 0
|
||||
frame $w.f$f -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0
|
||||
$w.t$f tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$f"
|
||||
$w.t$f tag bind REM <ButtonPress-3> "FireEditor $w.t$f"
|
||||
grid configure $w.l$f -row [expr $i*2+1] -column $j -sticky ew
|
||||
grid configure $w.t$f -row [expr $i*2+2] -column $j -sticky nsew
|
||||
pack $w.l$f -in $w.f$f -side top -expand 0 -fill x
|
||||
pack $w.t$f -in $w.f$f -side top -expand 1 -fill both
|
||||
grid configure $w.f$f -row [expr $i+1] -column $j -sticky nsew -padx 1 -pady 1
|
||||
}
|
||||
}
|
||||
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
grid columnconfigure $w $i -weight 1
|
||||
}
|
||||
for {set i 2} {$i < 14} {incr i 2} {
|
||||
for {set i 1} {$i < 7} {incr i} {
|
||||
grid rowconfigure $w $i -weight 1
|
||||
}
|
||||
}
|
||||
@@ -504,8 +523,12 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
set last [expr $offset+$numDays]
|
||||
|
||||
for {set i 0} {$i < $first} {incr i} {
|
||||
grid $w.l$i $w.t$i
|
||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
grid $w.f$i
|
||||
pack $w.l$i -in $w.f$i -side top -expand 0 -fill x
|
||||
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
||||
raise $w.l$i
|
||||
raise $w.t$i
|
||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
$w.l$i configure -state disabled
|
||||
balloon_add_help $w.l$i ""
|
||||
$w.t$i configure -relief flat -takefocus 0 -state normal -background $Option(WinBackground)
|
||||
@@ -515,13 +538,17 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
}
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled
|
||||
$w.t$i configure -state disabled -takefocus 0
|
||||
}
|
||||
for {set i $first} {$i <= $last} {incr i} {
|
||||
grid $w.l$i $w.t$i
|
||||
grid $w.f$i
|
||||
pack $w.l$i -in $w.f$i -side top -expand 0 -fill x
|
||||
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
||||
raise $w.l$i
|
||||
raise $w.t$i
|
||||
set d [expr $i-$first+1]
|
||||
$w.l$i configure -text $d -state normal -relief flat \
|
||||
-command "ModifyDay $d $firstDay" -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
-command "ModifyDay $d $firstDay" -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help $w.l$i "Add a reminder..."
|
||||
$w.t$i configure -relief sunken -takefocus 1 -state normal -foreground $Option(TextColor) -background $Option(BackgroundColor)
|
||||
$w.t$i delete 1.0 end
|
||||
@@ -530,23 +557,27 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
}
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled
|
||||
$w.t$i configure -state disabled -takefocus 0
|
||||
}
|
||||
set forgetIt 0
|
||||
for {set i [expr $last+1]} {$i < 42} {incr i} {
|
||||
if {$i%7 == 0} {
|
||||
set forgetIt 1
|
||||
}
|
||||
set row [expr ($i/7)*2+1]
|
||||
set row [expr ($i/7)+1]
|
||||
if {$forgetIt} {
|
||||
grid remove $w.l$i $w.t$i
|
||||
grid remove $w.f$i
|
||||
grid rowconfigure $w $row -weight 0
|
||||
grid rowconfigure $w [expr $row+1] -weight 0
|
||||
} else {
|
||||
grid $w.l$i $w.t$i
|
||||
grid $w.f$i
|
||||
pack $w.l$i -in $w.f$i -side top -expand 0 -fill x
|
||||
pack $w.t$i -in $w.f$i -side top -expand 1 -fill both
|
||||
raise $w.l$i
|
||||
raise $w.t$i
|
||||
grid rowconfigure $w [expr $row+1] -weight 1
|
||||
}
|
||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
$w.l$i configure -text "" -command "" -state normal -relief flat -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
$w.l$i configure -state disabled
|
||||
balloon_add_help $w.l$i ""
|
||||
$w.t$i configure -relief flat -takefocus 0 -state normal -background $Option(WinBackground)
|
||||
@@ -556,11 +587,11 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
}
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled
|
||||
$w.t$i configure -state disabled -takefocus 0
|
||||
}
|
||||
if { $CurMonth == $TodayMonth && $CurYear == $TodayYear } {
|
||||
set n [expr $TodayDay + $offset]
|
||||
$w.l$n configure -background "#00c0c0"
|
||||
$w.l$n configure -background $Option(TodayColor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,36 +608,36 @@ proc DoQueue {} {
|
||||
#---------------------------------------------------------------------------
|
||||
proc CreateCalWindow { dayNames } {
|
||||
global Option
|
||||
frame .h -background $Option(WinBackground);
|
||||
label .h.title -text "" -justify center -pady 1 -border 1 -relief raised -font HeadingFont -background $Option(WinBackground) -foreground $Option(LabelColor)
|
||||
pack .h.title -side top -fill x
|
||||
frame .h -background $Option(LineColor)
|
||||
label .h.title -text "" -justify center -pady 2 -bd 0 -relief flat -font HeadingFont -background $Option(WinBackground) -foreground $Option(LabelColor)
|
||||
pack .h.title -side top -fill x -pady 1 -padx 1
|
||||
pack .h -side top -expand 0 -fill x
|
||||
|
||||
. configure -background $Option(LineColor)
|
||||
CreateCalFrame .cal $dayNames
|
||||
|
||||
frame .b -background $Option(WinBackground);
|
||||
button .b.prev -text "\u2b9c" -command {MoveMonth -1} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
frame .b -background $Option(LineColor)
|
||||
button .b.prev -text "\u2b9c" -command {MoveMonth -1} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.prev "Go to previous month"
|
||||
button .b.this -text {Today} -command {ThisMonth} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
button .b.this -text {Today} -command {ThisMonth} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.this "Go to this month"
|
||||
button .b.next -text "\u2b9e" -command {MoveMonth 1} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
button .b.next -text "\u2b9e" -command {MoveMonth 1} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.next "Go to next month"
|
||||
button .b.goto -text {Go To Date...} -command {GotoDialog} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
button .b.goto -text {Go To Date...} -command {GotoDialog} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.goto "Go to a specific date"
|
||||
button .b.print -text {Print...} -command {DoPrint} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
balloon_add_help .b.print "Print a PostScript calendar"
|
||||
button .b.queue -text {Queue...} -command {DoQueue} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
balloon_add_help .b.queue "See the queue of pending reminders (debugging purposes only)"
|
||||
button .b.quit -text {Quit} -command {Quit} -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
balloon_add_help .b.quit "Quit TkRemind"
|
||||
button .b.options -text {Options...} -command EditOptions -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
button .b.print -text {Print...} -command {DoPrint} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.print "Print a PostScript or PDF calendar"
|
||||
button .b.options -text {Options...} -command EditOptions -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.options "Set TkRemind options"
|
||||
label .b.status -text "" -width 25 -relief sunken -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
label .b.nqueued -text "" -width 20 -relief sunken -border 1 -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.queue .b.quit -side left -fill both
|
||||
pack .b.status -side left -fill both -expand 1
|
||||
pack .b.nqueued -side left -fill both
|
||||
pack .b -side bottom -fill x -expand 0
|
||||
button .b.queue -text {Queue...} -command {DoQueue} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.queue "See the queue of pending reminders (debugging purposes only)"
|
||||
button .b.quit -text {Quit} -command {Quit} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
balloon_add_help .b.quit "Quit TkRemind"
|
||||
label .b.status -text "" -width 25 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||
label .b.nqueued -text "" -width 20 -relief flat -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 0
|
||||
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.queue .b.quit -side left -fill both -padx 1
|
||||
pack .b.status -side left -fill both -expand 1 -padx 1
|
||||
pack .b.nqueued -side left -fill both -padx 1
|
||||
pack .b -side bottom -fill x -expand 0 -pady 1
|
||||
pack .cal -side top -fill both -expand 1
|
||||
wm title . "TkRemind"
|
||||
wm iconname . ""
|
||||
@@ -689,7 +720,7 @@ proc EditOptions {} {
|
||||
pack $w.cmd -in $w.rf -side left -expand 1 -fill x
|
||||
$w.cmd insert 0 $tmpOpt(RunCmd)
|
||||
|
||||
frame $w.sep3 -border 1 -relief sunken
|
||||
frame $w.sep3 -bd 1 -relief sunken
|
||||
# E-mail reminder if popup not dismissed
|
||||
frame $w.eml
|
||||
label $w.lab_email_address -text "E-mail reminders here if popup not dismissed:" -anchor w -justify left
|
||||
@@ -734,6 +765,12 @@ proc EditOptions {} {
|
||||
label $w.bgcolor -text " Background color:"
|
||||
button $w.bbgcolor -background $Option(BackgroundColor) -command [list PickColor BackgroundColor $w.bbgcolor] -text ...
|
||||
|
||||
label $w.tbgcolor -text "Color for highlighting \"today\":"
|
||||
button $w.tbbgcolor -background $Option(TodayColor) -command [list PickColor TodayColor $w.tbbgcolor] -text ...
|
||||
|
||||
label $w.gridcolor -text " Gridline color:"
|
||||
button $w.gridbcolor -background $Option(LineColor) -command [list PickColor LineColor $w.gridbcolor] -text ...
|
||||
|
||||
grid $w.textcolor $w.btextcolor $w.bgcolor $w.bbgcolor -in $w.colors1
|
||||
grid $w.bgcolor $w.bbgcolor -in $w.colors1
|
||||
|
||||
@@ -742,11 +779,12 @@ proc EditOptions {} {
|
||||
label $w.wincolor -text " Window color:"
|
||||
button $w.bwincolor -background $Option(WinBackground) -command [list PickColor WinBackground $w.bwincolor] -text ...
|
||||
grid $w.headcolor $w.bheadcolor $w.wincolor $w.bwincolor -in $w.colors1
|
||||
|
||||
grid $w.tbgcolor $w.tbbgcolor $w.gridcolor $w.gridbcolor -in $w.colors1
|
||||
|
||||
grid columnconfigure $w.colors1 0 -weight 1
|
||||
grid columnconfigure $w.colors1 2 -weight 1
|
||||
frame $w.sep1 -border 1 -relief sunken
|
||||
frame $w.sep2 -border 1 -relief sunken
|
||||
frame $w.sep1 -bd 1 -relief sunken
|
||||
frame $w.sep2 -bd 1 -relief sunken
|
||||
|
||||
checkbutton $w.feed \
|
||||
-text "Feed popped-up reminder to command's standard input" \
|
||||
@@ -770,10 +808,12 @@ proc EditOptions {} {
|
||||
pack $w.colors1 -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.sep2 -in $w.f -side top -expand 0 -fill x -ipady 1
|
||||
|
||||
button $w.default -text "Light Theme" -command [list set_default_colors $w]
|
||||
button $w.dark -text "Dark Theme" -command [list set_dark_colors $w]
|
||||
button $w.save -text "Save Options" -command "SaveOptions $w; destroy $w"
|
||||
button $w.cancel -text "Cancel" -command "CancelOptions; destroy $w"
|
||||
wm protocol $w WM_DELETE_WINDOW "CancelOptions; destroy $w"
|
||||
pack $w.save $w.cancel -in $w.b -side left -expand 0 -fill x
|
||||
pack $w.default $w.dark $w.save $w.cancel -in $w.b -side left -expand 0 -fill x
|
||||
CenterWindow $w .
|
||||
}
|
||||
|
||||
@@ -845,6 +885,10 @@ proc SaveOptions { w } {
|
||||
.b.queue configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
.b.quit configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
.b.options configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
. configure -background $Option(LineColor);
|
||||
.h configure -background $Option(LineColor);
|
||||
.cal configure -background $Option(LineColor)
|
||||
.b configure -background $Option(LineColor)
|
||||
}
|
||||
|
||||
proc WriteOptionsToFile {} {
|
||||
@@ -1032,7 +1076,7 @@ proc FillCalWindow {} {
|
||||
continue
|
||||
}
|
||||
"MOON" {
|
||||
DoMoonSpecial $n $stuff $fntag
|
||||
DoMoonSpecial $n $stuff $fntag $day
|
||||
continue
|
||||
}
|
||||
"COLOUR" -
|
||||
@@ -1057,7 +1101,7 @@ proc FillCalWindow {} {
|
||||
set extratags "clr$color"
|
||||
.cal.t$n configure -state normal
|
||||
.cal.t$n tag configure $extratags -foreground "#$color"
|
||||
.cal.t$n configure -state disabled
|
||||
.cal.t$n configure -state disabled -takefocus 0
|
||||
set stuff $rest
|
||||
set type "COLOR"
|
||||
}
|
||||
@@ -1083,7 +1127,7 @@ proc FillCalWindow {} {
|
||||
}
|
||||
}
|
||||
.cal.t$n insert end "\n"
|
||||
.cal.t$n configure -state disabled
|
||||
.cal.t$n configure -state disabled -takefocus 0
|
||||
|
||||
}
|
||||
set problem [catch { close $file } errmsg]
|
||||
@@ -1152,13 +1196,13 @@ proc DoPrint {} {
|
||||
toplevel .p
|
||||
wm title .p "TkRemind Print..."
|
||||
wm iconname .p "Print..."
|
||||
frame .p.f1 -relief sunken -border 2
|
||||
frame .p.f1 -relief sunken -bd 2
|
||||
frame .p.f11
|
||||
frame .p.f12
|
||||
frame .p.f2 -relief sunken -border 2
|
||||
frame .p.f2a -relief sunken -border 2
|
||||
frame .p.f3 -relief sunken -border 2
|
||||
frame .p.f3a -relief sunken -border 2
|
||||
frame .p.f2 -relief sunken -bd 2
|
||||
frame .p.f2a -relief sunken -bd 2
|
||||
frame .p.f3 -relief sunken -bd 2
|
||||
frame .p.f3a -relief sunken -bd 2
|
||||
frame .p.f4
|
||||
|
||||
radiobutton .p.tofile -text "To file: " -variable Option(PrintDest) -value file
|
||||
@@ -1169,7 +1213,7 @@ proc DoPrint {} {
|
||||
.p.command insert end "lpr"
|
||||
|
||||
if { $HaveRem2PDF } {
|
||||
frame .p.ff -relief sunken -border 2
|
||||
frame .p.ff -relief sunken -bd 2
|
||||
label .p.format -text "Output Format:"
|
||||
radiobutton .p.pdf -text "PDF" -variable Option(PrintFormat) -value pdf
|
||||
radiobutton .p.ps -text "PostScript" -variable Option(PrintFormat) -value ps
|
||||
@@ -1451,16 +1495,16 @@ proc CreateModifyDialog {w day firstDay args} {
|
||||
set month [lindex $MonthNames $CurMonth]
|
||||
set wkday [lindex $EnglishDayNames [expr ($day+$firstDay-1) % 7]]
|
||||
|
||||
frame $w.o -border 4 -relief ridge
|
||||
frame $w.o1 -border 4
|
||||
frame $w.o2 -border 4
|
||||
frame $w.o3 -border 4
|
||||
frame $w.exp -border 4
|
||||
frame $w.adv -border 4
|
||||
frame $w.weekend -border 4
|
||||
frame $w.durationbox -border 4
|
||||
frame $w.time -border 4
|
||||
frame $w.hol -border 4
|
||||
frame $w.o -bd 4 -relief ridge
|
||||
frame $w.o1 -bd 4
|
||||
frame $w.o2 -bd 4
|
||||
frame $w.o3 -bd 4
|
||||
frame $w.exp -bd 4
|
||||
frame $w.adv -bd 4
|
||||
frame $w.weekend -bd 4
|
||||
frame $w.durationbox -bd 4
|
||||
frame $w.time -bd 4
|
||||
frame $w.hol -bd 4
|
||||
frame $w.msg
|
||||
frame $w.buttons
|
||||
pack $w.o1 $w.o2 $w.o3 -side top -anchor w -in $w.o
|
||||
@@ -3530,7 +3574,7 @@ proc DoShadeSpecial { n r g b } {
|
||||
# %DESCRIPTION:
|
||||
# Handles the "MOON" special -- draws a moon symbol
|
||||
#***********************************************************************
|
||||
proc DoMoonSpecial { n stuff fntag } {
|
||||
proc DoMoonSpecial { n stuff fntag day } {
|
||||
set msg ""
|
||||
set num [scan $stuff "%d %d %d %s" phase junk1 junk2 msg]
|
||||
if {$num < 1} {
|
||||
@@ -3539,11 +3583,27 @@ proc DoMoonSpecial { n stuff fntag } {
|
||||
if {$phase < 0 || $phase > 3} {
|
||||
return
|
||||
}
|
||||
switch -exact -- $phase {
|
||||
0 { set win .moon_new }
|
||||
1 { set win .moon_first }
|
||||
2 { set win .moon_full }
|
||||
3 { set win .moon_last }
|
||||
|
||||
# We need two sets of moon phase windows. There can be
|
||||
# two of a given phase in the same month, but Tk does
|
||||
# not allow the same embedded window in two separate
|
||||
# text boxes. So we use this hack to make sure
|
||||
# we use a different window if the same moon phase
|
||||
# happens twice in a month.
|
||||
if { $day < 16 } {
|
||||
switch -exact -- $phase {
|
||||
0 { set win .moon_new }
|
||||
1 { set win .moon_first }
|
||||
2 { set win .moon_full }
|
||||
3 { set win .moon_last }
|
||||
}
|
||||
} else {
|
||||
switch -exact -- $phase {
|
||||
0 { set win .moon_new2 }
|
||||
1 { set win .moon_first2 }
|
||||
2 { set win .moon_full2 }
|
||||
3 { set win .moon_last2 }
|
||||
}
|
||||
}
|
||||
.cal.t$n configure -state normal
|
||||
.cal.t$n window create 1.0 -window $win
|
||||
@@ -3569,7 +3629,7 @@ proc DoMoonSpecial { n stuff fntag } {
|
||||
.cal.t$n tag bind $fntag <ButtonPress-1> "FireEditor .cal.t$n $fntag"
|
||||
}
|
||||
}
|
||||
.cal.t$n configure -state disabled
|
||||
.cal.t$n configure -state disabled -takefocus 0
|
||||
}
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: DisplayTime
|
||||
@@ -3607,6 +3667,11 @@ proc CreateMoonWindows {} {
|
||||
catch { destroy .moon_full }
|
||||
catch { destroy .moon_last }
|
||||
|
||||
catch { destroy .moon_new2 }
|
||||
catch { destroy .moon_first2}
|
||||
catch { destroy .moon_full2 }
|
||||
catch { destroy .moon_last2 }
|
||||
|
||||
set extra 1
|
||||
#set wid [font measure CalboxFont 0]
|
||||
set wid [font metrics CalboxFont -ascent]
|
||||
@@ -3633,10 +3698,29 @@ proc CreateMoonWindows {} {
|
||||
.moon_last create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
.moon_last create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 270 -extent 180 -outline {}
|
||||
|
||||
canvas .moon_new2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_new2 create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
|
||||
canvas .moon_first2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_first2 create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
.moon_first2 create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 90 -extent 180 -outline {}
|
||||
|
||||
canvas .moon_full2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_full2 create oval $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -width 1
|
||||
|
||||
canvas .moon_last2 -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_last2 create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
.moon_last2 create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 270 -extent 180 -outline {}
|
||||
|
||||
balloon_add_help .moon_new "New Moon"
|
||||
balloon_add_help .moon_first "First Quarter"
|
||||
balloon_add_help .moon_full "Full Moon"
|
||||
balloon_add_help .moon_last "Last Quarter"
|
||||
|
||||
balloon_add_help .moon_new2 "New Moon"
|
||||
balloon_add_help .moon_first2 "First Quarter"
|
||||
balloon_add_help .moon_full2 "Full Moon"
|
||||
balloon_add_help .moon_last2 "Last Quarter"
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
@@ -3996,4 +4080,38 @@ proc FindConfigFile {} {
|
||||
set ConfigFile "~/.tkremindrc"
|
||||
}
|
||||
|
||||
proc set_default_colors { w } {
|
||||
global tmpOpt
|
||||
set tmpOpt(BackgroundColor) "#d9d9d9"
|
||||
set tmpOpt(LabelColor) "#000000"
|
||||
set tmpOpt(LineColor) "#000000"
|
||||
set tmpOpt(TextColor) "#000000"
|
||||
set tmpOpt(TodayColor) "#00C0C0"
|
||||
set tmpOpt(WinBackground) "#d9d9d9"
|
||||
update_color_buttons $w
|
||||
}
|
||||
|
||||
proc set_dark_colors { w } {
|
||||
global tmpOpt
|
||||
set tmpOpt(BackgroundColor) "#000000"
|
||||
set tmpOpt(LabelColor) "#00ffff"
|
||||
set tmpOpt(LineColor) "#0080fc"
|
||||
set tmpOpt(TextColor) "#ffffff"
|
||||
set tmpOpt(TodayColor) "#b000b6"
|
||||
set tmpOpt(WinBackground) "#000000"
|
||||
update_color_buttons $w
|
||||
}
|
||||
|
||||
proc update_color_buttons { w } {
|
||||
global tmpOpt
|
||||
$w.bbgcolor configure -background $tmpOpt(BackgroundColor)
|
||||
$w.bheadcolor configure -background $tmpOpt(LabelColor)
|
||||
$w.gridbcolor configure -background $tmpOpt(LineColor)
|
||||
$w.btextcolor configure -background $tmpOpt(TextColor)
|
||||
$w.tbbgcolor configure -background $tmpOpt(TodayColor)
|
||||
$w.bwincolor configure -background $tmpOpt(WinBackground)
|
||||
}
|
||||
|
||||
# Rem2PS program to execute -- supply full path if you want
|
||||
|
||||
main
|
||||
|
||||
@@ -684,7 +684,7 @@ static void DoCalendarOneWeek(int nleft)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
for (l=0; l<CalPad; l++) {
|
||||
gon();
|
||||
DRAW(tb);
|
||||
@@ -695,7 +695,7 @@ static void DoCalendarOneWeek(int nleft)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
/* Write the body lines */
|
||||
@@ -716,7 +716,7 @@ static void DoCalendarOneWeek(int nleft)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
/* Write the final line */
|
||||
@@ -867,7 +867,7 @@ static int WriteCalendarRow(void)
|
||||
sprintf(buf, "%d ", d+i-wd);
|
||||
if (Julian(y, m, d+i-wd) == RealToday) {
|
||||
PrintLeft(buf, ColSpaces-1, '*');
|
||||
PutChar(' ');
|
||||
putchar(' ');
|
||||
} else {
|
||||
PrintLeft(buf, ColSpaces, ' ');
|
||||
}
|
||||
@@ -876,7 +876,7 @@ static int WriteCalendarRow(void)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
for (l=0; l<CalPad; l++) {
|
||||
gon();
|
||||
DRAW(tb);
|
||||
@@ -887,7 +887,7 @@ static int WriteCalendarRow(void)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
/* Write the body lines */
|
||||
@@ -908,7 +908,7 @@ static int WriteCalendarRow(void)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
moreleft = (d+7-wd <= DaysInMonth(m, y));
|
||||
@@ -934,7 +934,7 @@ static void PrintLeft(char const *s, int width, char pad)
|
||||
#ifndef REM_USE_WCHAR
|
||||
int len = strlen(s);
|
||||
printf("%s", s);
|
||||
while (len++ < width) PutChar(pad);
|
||||
while (len++ < width) putchar(pad);
|
||||
#else
|
||||
size_t len = mbstowcs(NULL, s, 0);
|
||||
int i;
|
||||
@@ -999,10 +999,10 @@ static void PrintCentered(char const *s, int width, char *pad)
|
||||
for (i=0; i<width; i++) {
|
||||
if (*s) {
|
||||
if (isspace(*s)) {
|
||||
PutChar(' ');
|
||||
putchar(' ');
|
||||
s++;
|
||||
} else {
|
||||
PutChar(*s++);
|
||||
putchar(*s++);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
@@ -1084,7 +1084,7 @@ static int WriteOneCalLine(void)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
|
||||
return done;
|
||||
}
|
||||
@@ -1157,7 +1157,7 @@ static int WriteOneColLine(int col)
|
||||
for (ws = e->wc_pos; ws - e->wc_pos < ColSpaces; ws++) {
|
||||
if (!*ws) break;
|
||||
if (iswspace(*ws)) {
|
||||
PutChar(' ');
|
||||
putchar(' ');
|
||||
numwritten++;
|
||||
} else {
|
||||
if (wcwidth(*ws) > 0) {
|
||||
@@ -1172,7 +1172,7 @@ static int WriteOneColLine(int col)
|
||||
for (ws = e->wc_pos; ws<wspace; ws++) {
|
||||
if (!*ws) break;
|
||||
if (iswspace(*ws)) {
|
||||
PutChar(' ');
|
||||
putchar(' ');
|
||||
numwritten++;
|
||||
} else {
|
||||
if (wcwidth(*ws) > 0) {
|
||||
@@ -1189,7 +1189,7 @@ static int WriteOneColLine(int col)
|
||||
}
|
||||
|
||||
/* Flesh out the rest of the column */
|
||||
while(numwritten++ < ColSpaces) PutChar(' ');
|
||||
while(numwritten++ < ColSpaces) putchar(' ');
|
||||
|
||||
/* Skip any spaces before next word */
|
||||
while (iswspace(*ws)) ws++;
|
||||
@@ -1244,9 +1244,9 @@ static int WriteOneColLine(int col)
|
||||
if (!*s) break;
|
||||
numwritten++;
|
||||
if (isspace(*s)) {
|
||||
PutChar(' ');
|
||||
putchar(' ');
|
||||
} else {
|
||||
PutChar(*s);
|
||||
putchar(*s);
|
||||
}
|
||||
}
|
||||
e->pos = s;
|
||||
@@ -1256,9 +1256,9 @@ static int WriteOneColLine(int col)
|
||||
if (!*s) break;
|
||||
numwritten++;
|
||||
if (isspace(*s)) {
|
||||
PutChar(' ');
|
||||
putchar(' ');
|
||||
} else {
|
||||
PutChar(*s);
|
||||
putchar(*s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1269,7 +1269,7 @@ static int WriteOneColLine(int col)
|
||||
}
|
||||
|
||||
/* Flesh out the rest of the column */
|
||||
while(numwritten++ < ColSpaces) PutChar(' ');
|
||||
while(numwritten++ < ColSpaces) putchar(' ');
|
||||
|
||||
/* Skip any spaces before next word */
|
||||
while (isspace(*s)) s++;
|
||||
@@ -1423,7 +1423,7 @@ static void WriteCalHeader(void)
|
||||
gon();
|
||||
DRAW(tb);
|
||||
goff();
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
|
||||
WritePostHeaderLine();
|
||||
WriteCalDays();
|
||||
@@ -1437,7 +1437,7 @@ static void WriteCalHeader(void)
|
||||
/***************************************************************/
|
||||
static void WriteCalTrailer(void)
|
||||
{
|
||||
PutChar('\f');
|
||||
putchar('\f');
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -2051,7 +2051,7 @@ static void WriteTopCalLine(void)
|
||||
PrintCentered("", CalWidth-2, linestruct->lr);
|
||||
DRAW(bl);
|
||||
goff();
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void WriteBottomCalLine(void)
|
||||
@@ -2068,7 +2068,7 @@ static void WriteBottomCalLine(void)
|
||||
}
|
||||
}
|
||||
goff();
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void WritePostHeaderLine(void)
|
||||
@@ -2085,7 +2085,7 @@ static void WritePostHeaderLine(void)
|
||||
}
|
||||
}
|
||||
goff();
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void WriteWeekHeaderLine(void)
|
||||
@@ -2102,7 +2102,7 @@ static void WriteWeekHeaderLine(void)
|
||||
}
|
||||
}
|
||||
goff();
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void WriteIntermediateCalLine(void)
|
||||
@@ -2120,7 +2120,7 @@ static void WriteIntermediateCalLine(void)
|
||||
}
|
||||
}
|
||||
goff();
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void WriteCalDays(void)
|
||||
@@ -2138,7 +2138,7 @@ static void WriteCalDays(void)
|
||||
DRAW(tb);
|
||||
goff();
|
||||
}
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
@@ -38,7 +38,4 @@
|
||||
/* The number of bytes in a unsigned long. */
|
||||
#undef SIZEOF_UNSIGNED_LONG
|
||||
|
||||
/* The number of bytes in a unsigned short. */
|
||||
#undef SIZEOF_UNSIGNED_SHORT
|
||||
|
||||
#include "custom.h"
|
||||
|
||||
49
src/custom.h
49
src/custom.h
@@ -11,22 +11,18 @@
|
||||
/***************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||
/* DEFAULT_LATITUDE: Latitude of your location */
|
||||
/* DEFAULT_LONGITUDE: Longitude of your location */
|
||||
/* LOCATION: A string identifying your location. */
|
||||
/* All latitude and longitude numbers should be positive for the */
|
||||
/* northern and western hemisphere. If you live in the southern */
|
||||
/* hemisphere, ALL latitude values should be negative. If you live */
|
||||
/* in the eastern hemisphere, ALL longitude values should be negative. */
|
||||
/* Latitude and longitude should be positive for the */
|
||||
/* northern and eastern hemisphere and negative for the southern and */
|
||||
/* western hemisphere. */
|
||||
/* */
|
||||
/* The default values are initially set to Ottawa, Ontario, Canada. */
|
||||
/* The default values are initially set to the city hall in Ottawa, */
|
||||
/* Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LAT_DEG 45
|
||||
#define LAT_MIN 25
|
||||
#define LAT_SEC 30
|
||||
#define LON_DEG 75
|
||||
#define LON_MIN 41
|
||||
#define LON_SEC 59
|
||||
#define DEFAULT_LATITUDE 45.42055555555555
|
||||
#define DEFAULT_LONGITUDE -75.68972222222223
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
@@ -58,12 +54,6 @@
|
||||
#define DATETIMESEP '@'
|
||||
/* #define DATETIMESEP '/' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* WANT_U_OPTION: Comment out the next define to permanently disable */
|
||||
/* the -u option. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define WANT_U_OPTION 1
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
@@ -81,16 +71,7 @@
|
||||
/* WANT_SHELL_ESCAPING: Define this if you want special shell */
|
||||
/* characters to be escaped with a backslash for the -k option. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#if defined(UNIX)
|
||||
#define WANT_SHELL_ESCAPING 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Some implementations have a broken 'putc' and 'putchar'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#ifdef __SASC_60
|
||||
#define BROKEN_PUTC
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* BASE: The base year for date calculation. NOTE! January 1 of the */
|
||||
@@ -135,7 +116,7 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAL_STACK_SIZE 500
|
||||
#define VAL_STACK_SIZE 1000
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
||||
@@ -156,7 +137,7 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_FULL_OMITS 500
|
||||
#define MAX_FULL_OMITS 1000
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form MM DD do we handle? */
|
||||
@@ -190,14 +171,6 @@
|
||||
#define PSBEGIN2 "# rem2ps2 begin"
|
||||
#define PSEND2 "# rem2ps2 end"
|
||||
|
||||
#ifdef BROKEN_PUTC
|
||||
#define Putc SafePutc
|
||||
#define PutChar SafePutChar
|
||||
#else
|
||||
#define Putc putc
|
||||
#define PutChar putchar
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MBSTOWCS) && defined(HAVE_WCTYPE_H)
|
||||
#define REM_USE_WCHAR 1
|
||||
#else
|
||||
|
||||
@@ -11,22 +11,18 @@
|
||||
/***************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||
/* DEFAULT_LATITUDE: Latitude of your location */
|
||||
/* DEFAULT_LONGITUDE: Longitude of your location */
|
||||
/* LOCATION: A string identifying your location. */
|
||||
/* All latitude and longitude numbers should be positive for the */
|
||||
/* northern and western hemisphere. If you live in the southern */
|
||||
/* hemisphere, ALL latitude values should be negative. If you live */
|
||||
/* in the eastern hemisphere, ALL longitude values should be negative. */
|
||||
/* Latitude and longitude should be positive for the */
|
||||
/* northern and eastern hemisphere and negative for the southern and */
|
||||
/* western hemisphere. */
|
||||
/* */
|
||||
/* The default values are initially set to Ottawa, Ontario, Canada. */
|
||||
/* The default values are initially set to the city hall in Ottawa, */
|
||||
/* Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LAT_DEG 45
|
||||
#define LAT_MIN 25
|
||||
#define LAT_SEC 30
|
||||
#define LON_DEG 75
|
||||
#define LON_MIN 41
|
||||
#define LON_SEC 59
|
||||
#define DEFAULT_LATITUDE 45.42055555555555
|
||||
#define DEFAULT_LONGITUDE -75.68972222222223
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
@@ -58,12 +54,6 @@
|
||||
#define DATETIMESEP '@'
|
||||
/* #define DATETIMESEP '/' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* WANT_U_OPTION: Comment out the next define to permanently disable */
|
||||
/* the -u option. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define WANT_U_OPTION 1
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
@@ -81,16 +71,7 @@
|
||||
/* WANT_SHELL_ESCAPING: Define this if you want special shell */
|
||||
/* characters to be escaped with a backslash for the -k option. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#if defined(UNIX)
|
||||
#define WANT_SHELL_ESCAPING 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Some implementations have a broken 'putc' and 'putchar'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#ifdef __SASC_60
|
||||
#define BROKEN_PUTC
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* BASE: The base year for date calculation. NOTE! January 1 of the */
|
||||
@@ -135,7 +116,7 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAL_STACK_SIZE 500
|
||||
#define VAL_STACK_SIZE 1000
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
||||
@@ -156,7 +137,7 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_FULL_OMITS 500
|
||||
#define MAX_FULL_OMITS 1000
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form MM DD do we handle? */
|
||||
@@ -190,14 +171,6 @@
|
||||
#define PSBEGIN2 "# rem2ps2 begin"
|
||||
#define PSEND2 "# rem2ps2 end"
|
||||
|
||||
#ifdef BROKEN_PUTC
|
||||
#define Putc SafePutc
|
||||
#define PutChar SafePutChar
|
||||
#else
|
||||
#define Putc putc
|
||||
#define PutChar putchar
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MBSTOWCS) && defined(HAVE_WCTYPE_H)
|
||||
#define REM_USE_WCHAR 1
|
||||
#else
|
||||
|
||||
122
src/dorem.c
122
src/dorem.c
@@ -28,7 +28,7 @@ static int ParseTimeTrig (ParsePtr s, TimeTrig *tim, int save_in_globals);
|
||||
static int ParseLocalOmit (ParsePtr s, Trigger *t);
|
||||
static int ParseScanFrom (ParsePtr s, Trigger *t, int type);
|
||||
static int ParsePriority (ParsePtr s, Trigger *t);
|
||||
static int ParseUntil (ParsePtr s, Trigger *t);
|
||||
static int ParseUntil (ParsePtr s, Trigger *t, int type);
|
||||
static int ShouldTriggerBasedOnWarn (Trigger *t, int jul, int *err);
|
||||
static int ComputeTrigDuration(TimeTrig *t);
|
||||
|
||||
@@ -237,11 +237,15 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
tim->delta = DefaultTDelta;
|
||||
tim->rep = NO_REP;
|
||||
tim->duration = NO_TIME;
|
||||
trig->need_wkday = 0;
|
||||
trig->adj_for_last = 0;
|
||||
|
||||
if (save_in_globals) {
|
||||
LastTriggerTime = NO_TIME;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
int parsing = 1;
|
||||
while(parsing) {
|
||||
/* Read space-delimited string */
|
||||
r = ParseToken(s, &buf);
|
||||
if (r) return r;
|
||||
@@ -249,6 +253,25 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
/* Figure out what we've got */
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
switch(tok.type) {
|
||||
case T_In:
|
||||
/* Completely ignored */
|
||||
DBufFree(&buf);
|
||||
break;
|
||||
|
||||
case T_Ordinal:
|
||||
DBufFree(&buf);
|
||||
if (trig->d != NO_DAY) return E_DAY_TWICE;
|
||||
if (tok.val < 0) {
|
||||
if (trig->back != NO_BACK) return E_BACK_TWICE;
|
||||
trig->back = -7;
|
||||
trig->d = 1;
|
||||
trig->adj_for_last = 1;
|
||||
} else {
|
||||
trig->d = 1 + 7 * tok.val;
|
||||
}
|
||||
trig->need_wkday = 1;
|
||||
break;
|
||||
|
||||
case T_Date:
|
||||
DBufFree(&buf);
|
||||
if (trig->d != NO_DAY) return E_DAY_TWICE;
|
||||
@@ -322,7 +345,6 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
DBufFree(&buf);
|
||||
trig->typ = tok.val;
|
||||
if (s->isnested) return E_CANT_NEST_RTYPE;
|
||||
if (trig->scanfrom == NO_DATE) trig->scanfrom = JulianToday;
|
||||
if (trig->typ == PASSTHRU_TYPE) {
|
||||
r = ParseToken(s, &buf);
|
||||
if (r) return r;
|
||||
@@ -332,19 +354,20 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
}
|
||||
StrnCpy(trig->passthru, DBufValue(&buf), PASSTHRU_LEN);
|
||||
}
|
||||
return OK;
|
||||
parsing = 0;
|
||||
break;
|
||||
|
||||
case T_Through:
|
||||
DBufFree(&buf);
|
||||
if (trig->rep != NO_REP) return E_REP_TWICE;
|
||||
trig->rep = 1;
|
||||
r = ParseUntil(s, trig);
|
||||
r = ParseUntil(s, trig, tok.type);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_Until:
|
||||
DBufFree(&buf);
|
||||
r=ParseUntil(s, trig);
|
||||
r=ParseUntil(s, trig, tok.type);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
@@ -378,6 +401,15 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
trig->back = tok.val;
|
||||
break;
|
||||
|
||||
case T_BackAdj:
|
||||
DBufFree(&buf);
|
||||
if (trig->back != NO_BACK) return E_BACK_TWICE;
|
||||
if (trig->d != NO_DAY) return E_DAY_TWICE;
|
||||
trig->back = tok.val;
|
||||
trig->d = 1;
|
||||
trig->adj_for_last = 1;
|
||||
break;
|
||||
|
||||
case T_Once:
|
||||
DBufFree(&buf);
|
||||
if (trig->once != NO_ONCE) return E_ONCE_TWICE;
|
||||
@@ -401,8 +433,8 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
|
||||
case T_Empty:
|
||||
DBufFree(&buf);
|
||||
if (trig->scanfrom == NO_DATE) trig->scanfrom = JulianToday;
|
||||
return OK;
|
||||
parsing = 0;
|
||||
break;
|
||||
|
||||
case T_OmitFunc:
|
||||
if (trig->localomit) {
|
||||
@@ -474,10 +506,58 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
|
||||
DBufFree(&buf);
|
||||
trig->typ = MSG_TYPE;
|
||||
if (s->isnested) return E_CANT_NEST_RTYPE;
|
||||
if (trig->scanfrom == NO_DATE) trig->scanfrom = JulianToday;
|
||||
return OK;
|
||||
parsing = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (trig->need_wkday && trig->wd == NO_WD) {
|
||||
Eprint("Weekday name(s) required");
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
|
||||
/* Adjust month and possibly year */
|
||||
if (trig->adj_for_last) {
|
||||
if (trig->m != NO_MON) {
|
||||
trig->m++;
|
||||
if (trig->m >= 12) {
|
||||
trig->m = 0;
|
||||
if (trig->y != NO_YR) {
|
||||
trig->y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
trig->adj_for_last = 0;
|
||||
}
|
||||
|
||||
/* Check for some warning conditions */
|
||||
if (!s->nonconst_expr) {
|
||||
if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL) {
|
||||
if (Julian(trig->y, trig->m, trig->d) > trig->until) {
|
||||
Eprint("Warning: UNTIL/THROUGH date earlier than start date");
|
||||
}
|
||||
}
|
||||
if (trig->from != NO_DATE) {
|
||||
if (trig->until != NO_UNTIL && trig->until < trig->from) {
|
||||
Eprint("Warning: UNTIL/THROUGH date earlier than FROM date");
|
||||
}
|
||||
} else if (trig->scanfrom != NO_DATE) {
|
||||
if (trig->until != NO_UNTIL && trig->until < trig->scanfrom) {
|
||||
Eprint("Warning: UNTIL/THROUGH date earlier than SCANFROM date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (trig->y != NO_YR && trig->m != NO_MON && trig->d != NO_DAY && trig->until != NO_UNTIL && trig->rep == NO_REP) {
|
||||
Eprint("Warning: Useless use of UNTIL with fully-specified date and no *rep");
|
||||
}
|
||||
|
||||
/* Set scanfrom to default if not set explicitly */
|
||||
if (trig->scanfrom == NO_DATE) {
|
||||
trig->scanfrom = JulianToday;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -568,12 +648,18 @@ static int ParseLocalOmit(ParsePtr s, Trigger *t)
|
||||
/* ParseUntil - parse the UNTIL portion of a reminder */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
static int ParseUntil(ParsePtr s, Trigger *t, int type)
|
||||
{
|
||||
int y = NO_YR,
|
||||
m = NO_MON,
|
||||
d = NO_DAY;
|
||||
|
||||
char const *which;
|
||||
if (type == T_Until) {
|
||||
which = "UNTIL";
|
||||
} else {
|
||||
which = "THROUGH";
|
||||
}
|
||||
Token tok;
|
||||
int r;
|
||||
DynamicBuffer buf;
|
||||
@@ -589,7 +675,7 @@ static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
case T_Year:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_YR_TWICE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_YR_TWICE]);
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
@@ -598,7 +684,7 @@ static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
case T_Month:
|
||||
DBufFree(&buf);
|
||||
if (m != NO_MON) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_MON_TWICE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_MON_TWICE]);
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
@@ -607,7 +693,7 @@ static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
case T_Day:
|
||||
DBufFree(&buf);
|
||||
if (d != NO_DAY) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_DAY_TWICE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_DAY_TWICE]);
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
@@ -616,15 +702,15 @@ static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
case T_Date:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_YR_TWICE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_YR_TWICE]);
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
if (m != NO_MON) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_MON_TWICE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_MON_TWICE]);
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
if (d != NO_DAY) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_DAY_TWICE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_DAY_TWICE]);
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
FromJulian(tok.val, &y, &m, &d);
|
||||
@@ -632,7 +718,7 @@ static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
|
||||
default:
|
||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_INCOMPLETE]);
|
||||
Eprint("%s: %s", which, ErrMsg[E_INCOMPLETE]);
|
||||
DBufFree(&buf);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
|
||||
94
src/expr.c
94
src/expr.c
@@ -44,21 +44,32 @@ static int MakeValue (char const *s, Value *v, Var *locals, ParsePtr p);
|
||||
|
||||
/* Binary operators - all left-associative */
|
||||
|
||||
/* Operator precedence:
|
||||
* Highest: Unary - Unary !
|
||||
* / %
|
||||
* + -
|
||||
* < <= > >=
|
||||
* == !=
|
||||
* &&
|
||||
* Lowest: ||
|
||||
*
|
||||
*/
|
||||
|
||||
/* Make SURE they are sorted lexically... this may die on an EBCDIC
|
||||
system... */
|
||||
|
||||
Operator BinOp[] = {
|
||||
{ "!=", 15, BIN_OP, NotEqual },
|
||||
{ "%", 20, BIN_OP, Mod },
|
||||
{ "%", 20, BIN_OP, Mod },
|
||||
{ "&&", 14, BIN_OP, LogAND },
|
||||
{ "*", 20, BIN_OP, Multiply },
|
||||
{ "+", 18, BIN_OP, Add },
|
||||
{ "-", 18, BIN_OP, Subtract },
|
||||
{ "/", 20, BIN_OP, Divide },
|
||||
{ "<", 16, BIN_OP, LessThan },
|
||||
{ "*", 20, BIN_OP, Multiply },
|
||||
{ "+", 18, BIN_OP, Add },
|
||||
{ "-", 18, BIN_OP, Subtract },
|
||||
{ "/", 20, BIN_OP, Divide },
|
||||
{ "<", 16, BIN_OP, LessThan },
|
||||
{ "<=", 16, BIN_OP, LessOrEqual },
|
||||
{ "==", 15, BIN_OP, EqualTo },
|
||||
{ ">", 16, BIN_OP, GreaterThan },
|
||||
{ ">", 16, BIN_OP, GreaterThan },
|
||||
{ ">=", 16, BIN_OP, GreaterOrEqual },
|
||||
{ "||", 12, BIN_OP, LogOR },
|
||||
};
|
||||
@@ -66,8 +77,8 @@ Operator BinOp[] = {
|
||||
|
||||
/* These ones must be sorted too. */
|
||||
Operator UnOp[] = {
|
||||
{ "!", 22, UN_OP, LogNot },
|
||||
{ "-", 22, UN_OP, UnMinus },
|
||||
{ "!", 22, UN_OP, LogNot },
|
||||
{ "-", 22, UN_OP, UnMinus },
|
||||
};
|
||||
#define NUM_UN_OPS (sizeof(UnOp) / sizeof(Operator))
|
||||
|
||||
@@ -75,7 +86,8 @@ extern BuiltinFunc Func[];
|
||||
|
||||
Operator OpStack[OP_STACK_SIZE];
|
||||
Value ValStack[VAL_STACK_SIZE];
|
||||
int OpStackPtr, ValStackPtr;
|
||||
int OpStackPtr = 0;
|
||||
int ValStackPtr = 0;
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -101,7 +113,7 @@ static int DebugPerform(Operator *op)
|
||||
fprintf(ErrFp, " => ");
|
||||
if (!r) {
|
||||
PrintValue(&ValStack[ValStackPtr-1], ErrFp);
|
||||
Putc('\n', ErrFp);
|
||||
putc('\n', ErrFp);
|
||||
} else {
|
||||
fprintf(ErrFp, "%s\n", ErrMsg[r]);
|
||||
}
|
||||
@@ -115,12 +127,13 @@ static int DebugPerform(Operator *op)
|
||||
/* Clean the stack after an error occurs. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void CleanStack(void)
|
||||
static void CleanStack(int old_op_stack_ptr, int old_val_stack_ptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<ValStackPtr; i++) DestroyValue(ValStack[i]);
|
||||
ValStackPtr = 0;
|
||||
for (i=old_val_stack_ptr; i<ValStackPtr; i++) DestroyValue(ValStack[i]);
|
||||
ValStackPtr = old_val_stack_ptr;
|
||||
OpStackPtr = old_op_stack_ptr;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -306,8 +319,8 @@ int EvalExpr(char const **e, Value *v, ParsePtr p)
|
||||
{
|
||||
int r;
|
||||
|
||||
OpStackPtr = 0;
|
||||
ValStackPtr = 0;
|
||||
int old_op_stack_ptr = OpStackPtr;
|
||||
int old_val_stack_ptr = ValStackPtr;
|
||||
|
||||
r = Evaluate(e, NULL, p);
|
||||
|
||||
@@ -316,11 +329,15 @@ int EvalExpr(char const **e, Value *v, ParsePtr p)
|
||||
DBufFree(&ExprBuf);
|
||||
|
||||
if (r) {
|
||||
CleanStack();
|
||||
CleanStack(old_op_stack_ptr, old_val_stack_ptr);
|
||||
/* fprintf(stderr, "O=%d V=%d\n", OpStackPtr, ValStackPtr); */
|
||||
return r;
|
||||
}
|
||||
*v = *ValStack;
|
||||
ValStack[0].type = ERR_TYPE;
|
||||
OpStackPtr = old_op_stack_ptr;
|
||||
ValStackPtr = old_val_stack_ptr;
|
||||
*v = ValStack[old_val_stack_ptr];
|
||||
ValStack[old_val_stack_ptr].type = ERR_TYPE;
|
||||
/* fprintf(stderr, "O=%d V=%d\n", OpStackPtr, ValStackPtr); */
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -580,7 +597,7 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
|
||||
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
||||
if (r == OK) {
|
||||
PrintValue(v, ErrFp);
|
||||
Putc('\n', ErrFp);
|
||||
putc('\n', ErrFp);
|
||||
}
|
||||
return r;
|
||||
} else { /* Must be a symbol */
|
||||
@@ -591,7 +608,7 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
|
||||
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
||||
if (r == OK) {
|
||||
PrintValue(v, ErrFp);
|
||||
Putc('\n', ErrFp);
|
||||
putc('\n', ErrFp);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -1108,13 +1125,16 @@ static int LogOR(void)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (v1.type == INT_TYPE && v2.type == INT_TYPE) {
|
||||
v1.v.val = (v1.v.val || v2.v.val) ? 1 : 0;
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
if (v1.type != v2.type || v1.type == STR_TYPE || v2.type == STR_TYPE) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_BAD_TYPE;
|
||||
|
||||
if (v1.v.val == 0) {
|
||||
v1.v.val = v2.v.val;
|
||||
}
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -1135,13 +1155,15 @@ static int LogAND(void)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (v1.type == INT_TYPE && v2.type == INT_TYPE) {
|
||||
v1.v.val = (v1.v.val && v2.v.val) ? 1 : 0;
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
if (v1.type != v2.type || v1.type == STR_TYPE || v2.type == STR_TYPE) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_BAD_TYPE;
|
||||
if (v1.v.val != 0) {
|
||||
v1.v.val = v2.v.val;
|
||||
}
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -1232,9 +1254,9 @@ void PrintValue (Value *v, FILE *fp)
|
||||
|
||||
if (v->type == STR_TYPE) {
|
||||
s=v->v.str;
|
||||
Putc('"', fp);
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) Putc(*s++, fp);
|
||||
Putc('"',fp);
|
||||
putc('"', fp);
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) putc(*s++, fp);
|
||||
putc('"',fp);
|
||||
if (*s) fprintf(fp, "...");
|
||||
}
|
||||
else if (v->type == INT_TYPE) fprintf(fp, "%d", v->v.val);
|
||||
|
||||
66
src/funcs.c
66
src/funcs.c
@@ -58,6 +58,7 @@ static int FADusk (func_info *);
|
||||
static int FAbs (func_info *);
|
||||
static int FAccess (func_info *);
|
||||
static int FAmpm (func_info *);
|
||||
static int FTrig (func_info *);
|
||||
static int FIsAny (func_info *);
|
||||
static int FArgs (func_info *);
|
||||
static int FAsc (func_info *);
|
||||
@@ -126,6 +127,7 @@ static int FSunset (func_info *);
|
||||
static int FTime (func_info *);
|
||||
static int FTimepart (func_info *);
|
||||
static int FToday (func_info *);
|
||||
static int FTrig (func_info *);
|
||||
static int FTrigback (func_info *);
|
||||
static int FTrigdate (func_info *);
|
||||
static int FTrigdatetime (func_info *);
|
||||
@@ -279,6 +281,7 @@ BuiltinFunc Func[] = {
|
||||
{ "time", 2, 2, 1, FTime },
|
||||
{ "timepart", 1, 1, 1, FTimepart },
|
||||
{ "today", 0, 0, 0, FToday },
|
||||
{ "trig", 0, NO_MAX, 0, FTrig },
|
||||
{ "trigback", 0, 0, 0, FTrigback },
|
||||
{ "trigdate", 0, 0, 0, FTrigdate },
|
||||
{ "trigdatetime", 0, 0, 0, FTrigdatetime },
|
||||
@@ -2971,8 +2974,12 @@ FEvalTrig(func_info *info)
|
||||
CreateParser(ARGSTR(0), &p);
|
||||
p.allownested = 0;
|
||||
r = ParseRem(&p, &trig, &tim, 0);
|
||||
if (r) return r;
|
||||
if (r) {
|
||||
DestroyParser(&p);
|
||||
return r;
|
||||
}
|
||||
if (trig.typ != NO_TYPE) {
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
@@ -2990,6 +2997,7 @@ FEvalTrig(func_info *info)
|
||||
jul = -1;
|
||||
}
|
||||
FreeTrig(&trig);
|
||||
DestroyParser(&p);
|
||||
if (r) return r;
|
||||
if (jul < 0) {
|
||||
RetVal.type = INT_TYPE;
|
||||
@@ -3003,3 +3011,59 @@ FEvalTrig(func_info *info)
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int LastTrig = 0;
|
||||
static int
|
||||
FTrig(func_info *info)
|
||||
{
|
||||
Parser p;
|
||||
Trigger trig;
|
||||
TimeTrig tim;
|
||||
int jul;
|
||||
int r;
|
||||
int i;
|
||||
|
||||
RetVal.type = DATE_TYPE;
|
||||
if (Nargs == 0) {
|
||||
RETVAL = LastTrig;
|
||||
return OK;
|
||||
}
|
||||
|
||||
for (i=0; i<Nargs; i++) {
|
||||
ASSERT_TYPE(i, STR_TYPE);
|
||||
}
|
||||
|
||||
RETVAL = 0;
|
||||
|
||||
for (i=0; i<Nargs; i++) {
|
||||
CreateParser(ARGSTR(i), &p);
|
||||
p.allownested = 0;
|
||||
r = ParseRem(&p, &trig, &tim, 0);
|
||||
if (r) {
|
||||
DestroyParser(&p);
|
||||
return r;
|
||||
}
|
||||
if (trig.typ != NO_TYPE) {
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
|
||||
|
||||
if (r == E_CANT_TRIG) {
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
continue;
|
||||
}
|
||||
if (ShouldTriggerReminder(&trig, &tim, jul, &r)) {
|
||||
LastTrig = jul;
|
||||
RETVAL = jul;
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
return OK;
|
||||
}
|
||||
DestroyParser(&p);
|
||||
FreeTrig(&trig);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ EXTERN INIT( int DefaultColorB, -1);
|
||||
EXTERN INIT( int DefaultColorG, -1);
|
||||
EXTERN INIT( int SynthesizeTags, 0);
|
||||
EXTERN INIT( int ScFormat, SC_AMPM);
|
||||
EXTERN INIT( int MaxSatIter, 150);
|
||||
EXTERN INIT( int MaxSatIter, 1000);
|
||||
EXTERN INIT( int MaxStringLen, MAX_STR_LEN);
|
||||
EXTERN INIT( char *FileName, NULL);
|
||||
EXTERN INIT( int UseStdin, 0);
|
||||
@@ -118,14 +118,14 @@ EXTERN INIT( int UseTrueColors, 0);
|
||||
EXTERN INIT( int TerminalBackground, TERMINAL_BACKGROUND_UNKNOWN);
|
||||
|
||||
/* Latitude and longitude */
|
||||
EXTERN INIT( int LatDeg, LAT_DEG);
|
||||
EXTERN INIT( int LatMin, LAT_MIN);
|
||||
EXTERN INIT( int LatSec, LAT_SEC);
|
||||
EXTERN INIT( int LongDeg, LON_DEG);
|
||||
EXTERN INIT( int LongMin, LON_MIN);
|
||||
EXTERN INIT( int LongSec, LON_SEC);
|
||||
EXTERN INIT( double Longitude, -999.0);
|
||||
EXTERN INIT( double Latitude, -999.0);
|
||||
EXTERN INIT( int LatDeg, 0);
|
||||
EXTERN INIT( int LatMin, 0);
|
||||
EXTERN INIT( int LatSec, 0);
|
||||
EXTERN INIT( int LongDeg, 0);
|
||||
EXTERN INIT( int LongMin, 0);
|
||||
EXTERN INIT( int LongSec, 0);
|
||||
EXTERN INIT( double Longitude, DEFAULT_LONGITUDE);
|
||||
EXTERN INIT( double Latitude, DEFAULT_LATITUDE);
|
||||
|
||||
EXTERN INIT( char *Location, LOCATION);
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
|
||||
|
||||
/* Initialize Latitude and Longitude */
|
||||
set_lat_and_long_from_components();
|
||||
set_components_from_lat_and_long();
|
||||
|
||||
/* See if we were invoked as "rem" rather than "remind" */
|
||||
if (argv[0]) {
|
||||
@@ -698,7 +698,7 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trig v=dumpvars l=showline f=tracefiles\n");
|
||||
fprintf(ErrFp, " -e Divert messages normally sent to stderr to stdout\n");
|
||||
fprintf(ErrFp, " -b[n] Time format for cal: 0=am/pm, 1=24hr, 2=none\n");
|
||||
fprintf(ErrFp, " -x[n] Iteration limit for SATISFY clause (def=150)\n");
|
||||
fprintf(ErrFp, " -x[n] Iteration limit for SATISFY clause (def=1000)\n");
|
||||
fprintf(ErrFp, " -kcmd Run `cmd' for MSG-type reminders\n");
|
||||
fprintf(ErrFp, " -g[dddd] Sort reminders by date, time, priority, and 'timedness'\n");
|
||||
fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
|
||||
|
||||
@@ -283,7 +283,7 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -d... Virheenetsintä: e=echo x=expr-eval t=trig v=dumpvars l=showline\n");
|
||||
fprintf(ErrFp, " -e Ohjaa virhetulostus stdout-vuohon\n");
|
||||
fprintf(ErrFp, " -b[n] Ajan ilmaisu: 0=ap/ip, 1=24 tuntia, 2=ei aikoja\n");
|
||||
fprintf(ErrFp, " -x[n] SATISFY-lauseen toistoraja (oletus 150)\n");
|
||||
fprintf(ErrFp, " -x[n] SATISFY-lauseen toistoraja (oletus 1000)\n");
|
||||
fprintf(ErrFp, " -kcmd Suorita 'cmd' MSG-tyyppisille viesteille\n");
|
||||
fprintf(ErrFp, " -g[ddd] Lajittele viestit päiväyksen, ajan ja tärkeyden mukaan\n");
|
||||
fprintf(ErrFp, " -ivar=val Alusta muuttuja var arvolla val ja säilytä var\n");
|
||||
|
||||
@@ -258,7 +258,7 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trig v=dumpvars l=showline\n");
|
||||
fprintf(ErrFp, " -e Envoyer les messages de stderr à stdout\n");
|
||||
fprintf(ErrFp, " -b[n] Formats de l'heure pour le calendrier: 0=am/pm, 1=24hr, 2=aucun\n");
|
||||
fprintf(ErrFp, " -x[n] Limite d'itérations pour la clause SATISFY (def=150)\n");
|
||||
fprintf(ErrFp, " -x[n] Limite d'itérations pour la clause SATISFY (def=1000)\n");
|
||||
fprintf(ErrFp, " -kcmd Exécuter 'cmd' pour les rappels de type MSG\n");
|
||||
fprintf(ErrFp, " -g[ddd] Trier les rappels par date, heure et priorité avant d'émettre\n");
|
||||
fprintf(ErrFp, " -ivar=val Initialiser var à val et conserver var\n");
|
||||
|
||||
@@ -270,7 +270,7 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -d... Odpluskwianie: e=echo x=expr-eval t=trig v=dumpvars l=showline\n");
|
||||
fprintf(ErrFp, " -e Komunikaty o błędach skieruj na stdout\n");
|
||||
fprintf(ErrFp, " -b[n] Format czasu: 0=am/pm, 1=24godz., 2=żaden\n");
|
||||
fprintf(ErrFp, " -x[n] Limit powtórzeń klauzuli SATISFY (domyślnie=150)\n");
|
||||
fprintf(ErrFp, " -x[n] Limit powtórzeń klauzuli SATISFY (domyślnie=1000)\n");
|
||||
fprintf(ErrFp, " -kcmd Wywołaj 'cmd' dla przypomnień typu MSG\n");
|
||||
fprintf(ErrFp, " -g[ddd] Sortuj przypomnienia według daty, czasu i priorytetu\n");
|
||||
fprintf(ErrFp, " -ivar=val Zainicjuj zmienną var wartościa val i zachowaj ja\n");
|
||||
|
||||
@@ -283,7 +283,7 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trigger v=dumpvars l=showline\n");
|
||||
fprintf(ErrFp, " -e Desvia mensagens normalmente enviadas a stderr para stdout\n");
|
||||
fprintf(ErrFp, " -b[n] Formato da hora para o cal: 0=am/pm, 1=24hr, 2=nenhum\n");
|
||||
fprintf(ErrFp, " -x[n] Limite de iteracoes para a clausula SATISFY (default=150)\n");
|
||||
fprintf(ErrFp, " -x[n] Limite de iteracoes para a clausula SATISFY (default=1000)\n");
|
||||
fprintf(ErrFp, " -kcmd Executa `cmd' para os compromissos com MSG\n");
|
||||
fprintf(ErrFp, " -g[ddd] Classifica compromissos por data, hora e prioridade antes de exibir\n");
|
||||
fprintf(ErrFp, " -ivar=val Inicializa (e preserva) variavel var com val\n");
|
||||
|
||||
20
src/main.c
20
src/main.c
@@ -44,10 +44,6 @@
|
||||
|
||||
static void DoReminders(void);
|
||||
|
||||
/* Whooo... the putchar/Putchar/PutChar macros are a mess...
|
||||
my apologies... */
|
||||
#define Putchar(c) PutChar(c)
|
||||
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/** **/
|
||||
@@ -616,11 +612,11 @@ void OutputLine(FILE *fp)
|
||||
char c = 0;
|
||||
|
||||
while (*s) {
|
||||
if (*s == '\n') Putc('\\', fp);
|
||||
Putc(*s, fp);
|
||||
if (*s == '\n') putc('\\', fp);
|
||||
putc(*s, fp);
|
||||
c = *s++;
|
||||
}
|
||||
if (c != '\n') Putc('\n', fp);
|
||||
if (c != '\n') putc('\n', fp);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -1212,7 +1208,7 @@ void FillParagraph(char const *s)
|
||||
|
||||
/* If it's a carriage return, output it and start new paragraph */
|
||||
if (*s == '\n') {
|
||||
Putchar('\n');
|
||||
putchar('\n');
|
||||
s++;
|
||||
line = 0;
|
||||
while(ISBLANK(*s)) s++;
|
||||
@@ -1225,7 +1221,7 @@ void FillParagraph(char const *s)
|
||||
number of spaces */
|
||||
j = line ? SubsIndent : FirstIndent;
|
||||
for (i=0; i<j; i++) {
|
||||
Putchar(' ');
|
||||
putchar(' ');
|
||||
}
|
||||
|
||||
/* Calculate the amount of room left on this line */
|
||||
@@ -1244,17 +1240,17 @@ void FillParagraph(char const *s)
|
||||
}
|
||||
if (!pendspace || len+pendspace <= roomleft) {
|
||||
for (i=0; i<pendspace; i++) {
|
||||
Putchar(' ');
|
||||
putchar(' ');
|
||||
}
|
||||
while(t < s) {
|
||||
Putchar(*t);
|
||||
putchar(*t);
|
||||
if (strchr(EndSent, *t)) doublespace = 2;
|
||||
else if (!strchr(EndSentIg, *t)) doublespace = 1;
|
||||
t++;
|
||||
}
|
||||
} else {
|
||||
s = t;
|
||||
Putchar('\n');
|
||||
putchar('\n');
|
||||
line++;
|
||||
break;
|
||||
}
|
||||
|
||||
16
src/rem2ps.c
16
src/rem2ps.c
@@ -146,9 +146,9 @@ put_escaped_string(char const *s)
|
||||
{
|
||||
while(*s) {
|
||||
if (*s == '\\' || *s == '(' || *s == ')') {
|
||||
PutChar('\\');
|
||||
putchar('\\');
|
||||
}
|
||||
PutChar(*s);
|
||||
putchar(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
@@ -625,7 +625,7 @@ void WriteProlog(void)
|
||||
strcmp(SmallFont, DayFont) &&
|
||||
strcmp(TitleFont, SmallFont) &&
|
||||
strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont);
|
||||
PutChar('\n');
|
||||
putchar('\n');
|
||||
printf("%%%%Creator: Rem2PS\n");
|
||||
printf("%%%%Pages: (atend)\n");
|
||||
printf("%%%%Orientation: %s\n", PortraitMode ? "Portrait" : "Landscape");
|
||||
@@ -805,20 +805,20 @@ void WriteOneEntry(CalEntry *c)
|
||||
}
|
||||
}
|
||||
|
||||
PutChar('(');
|
||||
putchar('(');
|
||||
while(*s) {
|
||||
/* Use the "unsigned char" cast to fix problem on Solaris 2.5 */
|
||||
/* which treated some latin1 characters as white space. */
|
||||
ch = (unsigned char) *s++;
|
||||
if (ch == '\\' || ch == '(' || ch == ')') PutChar('\\');
|
||||
if (!isspace(ch)) PutChar(ch);
|
||||
if (ch == '\\' || ch == '(' || ch == ')') putchar('\\');
|
||||
if (!isspace(ch)) putchar(ch);
|
||||
else {
|
||||
PutChar(')');
|
||||
putchar(')');
|
||||
while(isspace((unsigned char)*s)) s++;
|
||||
if (!*s) {
|
||||
goto finish;
|
||||
}
|
||||
PutChar('(');
|
||||
putchar('(');
|
||||
}
|
||||
}
|
||||
printf(")\n");
|
||||
|
||||
26
src/token.c
26
src/token.c
@@ -43,30 +43,36 @@ Token TokArray[] = {
|
||||
{ "at", 2, T_At, 0 },
|
||||
{ "august", 3, T_Month, 7 },
|
||||
{ "banner", 3, T_Banner, 0 },
|
||||
{ "before", 3, T_Skip, BEFORE_SKIP },
|
||||
{ "before", 3, T_Skip, BEFORE_SKIP },
|
||||
{ "cal", 3, T_RemType, CAL_TYPE },
|
||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||
{ "debug", 5, T_Debug, 0 },
|
||||
{ "debug", 5, T_Debug, 0 },
|
||||
{ "december", 3, T_Month, 11 },
|
||||
{ "do", 2, T_IncludeR, 0 },
|
||||
{ "dumpvars", 4, T_Dumpvars, 0 },
|
||||
{ "dumpvars", 4, T_Dumpvars, 0 },
|
||||
{ "duration", 3, T_Duration, 0 },
|
||||
{ "else", 4, T_Else, 0 },
|
||||
{ "else", 4, T_Else, 0 },
|
||||
{ "endif", 5, T_EndIf, 0 },
|
||||
{ "errmsg", 6, T_ErrMsg, 0 },
|
||||
{ "errmsg", 6, T_ErrMsg, 0 },
|
||||
{ "exit", 4, T_Exit, 0 },
|
||||
{ "february", 3, T_Month, 1 },
|
||||
{ "first", 5, T_Ordinal, 0 },
|
||||
{ "flush", 5, T_Flush, 0 },
|
||||
{ "fourth", 6, T_Ordinal, 3 },
|
||||
{ "friday", 3, T_WkDay, 4 },
|
||||
{ "from", 4, T_Scanfrom, FROM_TYPE },
|
||||
{ "fset", 4, T_Fset, 0 },
|
||||
{ "if", 2, T_If, 0 },
|
||||
{ "iftrig", 6, T_IfTrig, 0 },
|
||||
{ "in", 2, T_In, 0 },
|
||||
{ "include", 3, T_Include, 0 },
|
||||
{ "includecmd", 10, T_IncludeCmd, 0 },
|
||||
{ "january", 3, T_Month, 0 },
|
||||
{ "july", 3, T_Month, 6 },
|
||||
{ "june", 3, T_Month, 5 },
|
||||
{ "last", 4, T_Ordinal, -1 },
|
||||
{ "lastday", 7, T_BackAdj, -1 },
|
||||
{ "lastworkday", 11, T_BackAdj, 1 },
|
||||
{ "march", 3, T_Month, 2 },
|
||||
{ "may", 3, T_Month, 4 },
|
||||
{ "maybe-uncomputable", 5, T_MaybeUncomputable, 0},
|
||||
@@ -90,12 +96,14 @@ Token TokArray[] = {
|
||||
{ "saturday", 3, T_WkDay, 5 },
|
||||
{ "scanfrom", 4, T_Scanfrom, SCANFROM_TYPE },
|
||||
{ "sched", 5, T_Sched, 0 },
|
||||
{ "second", 6, T_Ordinal, 1 },
|
||||
{ "september", 3, T_Month, 8 },
|
||||
{ "set", 3, T_Set, 0 },
|
||||
{ "skip", 3, T_Skip, SKIP_SKIP },
|
||||
{ "special", 7, T_RemType, PASSTHRU_TYPE },
|
||||
{ "sunday", 3, T_WkDay, 6 },
|
||||
{ "tag", 3, T_Tag, 0 },
|
||||
{ "third", 5, T_Ordinal, 2 },
|
||||
{ "through", 7, T_Through, 0 },
|
||||
{ "thursday", 3, T_WkDay, 3 },
|
||||
{ "tuesday", 3, T_WkDay, 1 },
|
||||
@@ -325,6 +333,14 @@ void FindNumericToken(char const *s, Token *t)
|
||||
t->type = T_Back;
|
||||
t->val *= mult;
|
||||
return;
|
||||
} else if (*s == '~') {
|
||||
s++;
|
||||
if (*s == '~') { mult = -1; s++; }
|
||||
PARSENUM(t->val, s);
|
||||
if (*s) return; /* Illegal token if followed by non-numeric char */
|
||||
t->type = T_BackAdj;
|
||||
t->val *= mult;
|
||||
return;
|
||||
}
|
||||
return; /* Unknown token type */
|
||||
}
|
||||
|
||||
10
src/types.h
10
src/types.h
@@ -69,6 +69,8 @@ typedef struct {
|
||||
int once;
|
||||
int scanfrom;
|
||||
int from;
|
||||
int adj_for_last; /* Adjust month/year for use of LAST */
|
||||
int need_wkday; /* Set if we *need* a weekday */
|
||||
int priority;
|
||||
int duration_days; /* Duration converted to days to search */
|
||||
int eventstart; /* Original event start (datetime) */
|
||||
@@ -157,7 +159,8 @@ enum TokTypes
|
||||
T_AddOmit,
|
||||
T_WkDay,
|
||||
T_Month, T_Time, T_Date, T_DateTime,
|
||||
T_Skip, T_At, T_RemType, T_Until, T_Year, T_Day, T_Rep, T_Delta, T_Back,
|
||||
T_Skip, T_At, T_RemType, T_Until, T_Year, T_Day, T_Rep, T_Delta,
|
||||
T_Back, T_BackAdj,
|
||||
T_Once,
|
||||
T_Empty,
|
||||
T_Comment,
|
||||
@@ -175,7 +178,10 @@ enum TokTypes
|
||||
T_LongTime,
|
||||
T_OmitFunc,
|
||||
T_Through,
|
||||
T_MaybeUncomputable
|
||||
T_MaybeUncomputable,
|
||||
T_Ordinal,
|
||||
T_In,
|
||||
T_LastBack
|
||||
};
|
||||
|
||||
/* The structure of a token */
|
||||
|
||||
14
src/var.c
14
src/var.c
@@ -743,8 +743,8 @@ static SysVar SysVarArr[] = {
|
||||
/* name mod type value min/mal max validate*/
|
||||
{"April", 1, STR_TYPE, &DynamicMonthName[3], 0, 0, NULL },
|
||||
{"August", 1, STR_TYPE, &DynamicMonthName[7], 0, 0, NULL },
|
||||
{"CalMode", 0, INT_TYPE, &DoCalendar, 0, 0, NULL },
|
||||
{"CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1, NULL },
|
||||
{"CalMode", 0, INT_TYPE, &DoCalendar, 0, 0, NULL },
|
||||
{"Daemon", 0, INT_TYPE, &Daemon, 0, 0, NULL },
|
||||
{"DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0, NULL },
|
||||
{"DateTimeSep", 1, SPECIAL_TYPE, datetime_sep_func, 0, 0, NULL },
|
||||
@@ -989,29 +989,29 @@ static void DumpSysVar(char const *name, const SysVar *v)
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
f(0, &val);
|
||||
PrintValue(&val, ErrFp);
|
||||
Putc('\n', ErrFp);
|
||||
putc('\n', ErrFp);
|
||||
DestroyValue(val);
|
||||
} else if (v->type == STR_TYPE) {
|
||||
char const *s = *((char **)v->value);
|
||||
int y;
|
||||
Putc('"', ErrFp);
|
||||
putc('"', ErrFp);
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) {
|
||||
if (*s == '"') {
|
||||
fprintf(ErrFp, "\" + char(34) + \"");
|
||||
s++;
|
||||
} else {
|
||||
Putc(*s++, ErrFp);
|
||||
putc(*s++, ErrFp);
|
||||
}
|
||||
}
|
||||
Putc('"', ErrFp);
|
||||
putc('"', ErrFp);
|
||||
if (*s) fprintf(ErrFp, "...");
|
||||
Putc('\n', ErrFp);
|
||||
putc('\n', ErrFp);
|
||||
} else if (v->type == DATE_TYPE) {
|
||||
Value val;
|
||||
val.type = DATE_TYPE;
|
||||
val.v.val = * (int *) v->value;
|
||||
PrintValue(&val, ErrFp);
|
||||
Putc('\n', ErrFp);
|
||||
putc('\n', ErrFp);
|
||||
} else {
|
||||
if (!v->modifiable) fprintf(ErrFp, "%d\n", *((int *)v->value));
|
||||
else {
|
||||
|
||||
707
tests/test.cmp
707
tests/test.cmp
File diff suppressed because it is too large
Load Diff
153
tests/test.rem
153
tests/test.rem
@@ -447,6 +447,99 @@ REM MAYBE-UNCOMPUTABLE Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
|
||||
|
||||
dump
|
||||
dump $
|
||||
msg [$April]%
|
||||
msg [$August]%
|
||||
msg [$CalcUTC]%
|
||||
msg [$CalMode]%
|
||||
msg [$Daemon]%
|
||||
msg [$DateSep]%
|
||||
msg [$DateTimeSep]%
|
||||
msg [$December]%
|
||||
msg [$DefaultColor]%
|
||||
msg [$DefaultPrio]%
|
||||
msg [$DefaultTDelta]%
|
||||
msg [$DeltaOffset]%
|
||||
msg [$DontFork]%
|
||||
msg [$DontQueue]%
|
||||
msg [$DontTrigAts]%
|
||||
msg [$EndSent]%
|
||||
msg [$EndSentIg]%
|
||||
msg [$February]%
|
||||
msg [$FirstIndent]%
|
||||
msg [$FoldYear]%
|
||||
msg [$FormWidth]%
|
||||
msg [$Friday]%
|
||||
msg [$HushMode]%
|
||||
msg [$IgnoreOnce]%
|
||||
msg [$InfDelta]%
|
||||
msg [$IntMax]%
|
||||
msg [$IntMin]%
|
||||
msg [$January]%
|
||||
msg [$July]%
|
||||
msg [$June]%
|
||||
msg [$LatDeg]%
|
||||
msg [$Latitude]%
|
||||
msg [$LatMin]%
|
||||
msg [$LatSec]%
|
||||
msg [$Location]%
|
||||
msg [$LongDeg]%
|
||||
msg [$Longitude]%
|
||||
msg [$LongMin]%
|
||||
msg [$LongSec]%
|
||||
msg [$March]%
|
||||
msg [$MaxSatIter]%
|
||||
msg [$MaxStringLen]%
|
||||
msg [$May]%
|
||||
msg [$MinsFromUTC]%
|
||||
msg [$Monday]%
|
||||
msg [$NextMode]%
|
||||
msg [$November]%
|
||||
msg [$NumQueued]%
|
||||
msg [$NumTrig]%
|
||||
msg [$October]%
|
||||
msg [$PrefixLineNo]%
|
||||
msg [$PSCal]%
|
||||
msg [$RunOff]%
|
||||
msg [$Saturday]%
|
||||
msg [$September]%
|
||||
msg [$SimpleCal]%
|
||||
msg [$SortByDate]%
|
||||
msg [$SortByPrio]%
|
||||
msg [$SortByTime]%
|
||||
msg [$SubsIndent]%
|
||||
msg [$Sunday]%
|
||||
msg [$T]%
|
||||
msg [$Td]%
|
||||
msg [$Thursday]%
|
||||
msg [$TimeSep]%
|
||||
msg [$Tm]%
|
||||
msg [$Tuesday]%
|
||||
msg [$Tw]%
|
||||
msg [$Ty]%
|
||||
msg [$U]%
|
||||
msg [$Ud]%
|
||||
msg [$Um]%
|
||||
msg [$UntimedFirst]%
|
||||
msg [$Uw]%
|
||||
msg [$Uy]%
|
||||
msg [$Wednesday]%
|
||||
|
||||
# Diagnose until before start date, only for non-constant expressions and
|
||||
# fully-specified start date
|
||||
REM Mon 1992 UNTIL 1991-01-01 MSG Not diagnosed - not fully-specified start
|
||||
REM 1992-01-01 *1 UNTIL 1991-12-31 MSG Diagnosed
|
||||
set x '1992-01-01'
|
||||
REM [x] *1 UNTIL 1991-12-31 MSG Not diagnosed - nonconst expression
|
||||
|
||||
REM MON FROM 1992-01-01 UNTIL 1991-12-31 Diagnosed
|
||||
REM MON SCANFROM 1992-01-01 UNTIL 1991-12-31 Diagnosed
|
||||
|
||||
REM MON FROM [x] UNTIL 1991-12-31 Not diagnosed
|
||||
REM MON SCANFROM [x] UNTIL 1991-12-31 Not diagnosed
|
||||
|
||||
REM 1992-01-01 UNTIL 1992-02-02 MSG Diagnosed
|
||||
REM [x] UNTIL 1992-02-02 MSG Diagnosed
|
||||
|
||||
dump $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
OMIT 2010-09-03 THROUGH 2010-09-15
|
||||
OMIT December 25 MSG X
|
||||
@@ -637,6 +730,66 @@ msg [a]
|
||||
set x psshade(50)
|
||||
set x psmoon(0)
|
||||
|
||||
# Trig
|
||||
IF trig("sun +1") || trig("thu +1")
|
||||
REM [trig()] +1 MSG Foo %b
|
||||
ENDIF
|
||||
|
||||
# Trig with a bad warnfunc
|
||||
FSET w(x) x/0
|
||||
IF trig("sun warn w") || trig("thu warn w")
|
||||
REM [trig()] +1 MSG Foo %b
|
||||
ENDIF
|
||||
|
||||
# Trig with a good warnfunc
|
||||
FSET w(x) choose(x, 5, 3, 1, 0)
|
||||
|
||||
# Ugh. This is where short-circuit logical operators
|
||||
# would really come in handy.
|
||||
IF trig("sun warn w") || trig("thu warn w")
|
||||
REM [trig()] +5 MSG Foo %b
|
||||
ENDIF
|
||||
|
||||
REM [trig("Mon", "Tue", "Wed", "Sat")] MSG foo
|
||||
REM [trig("Mon", "Tue", "Wed")] MSG bar
|
||||
|
||||
# The new syntactic sugar
|
||||
REM First Monday January MSG x
|
||||
REM Second Tuesday in April MSG x
|
||||
REM Third Wednesday in October MSG x
|
||||
REM Fourth Friday in July MSG x
|
||||
REM Last Tuesday in August MSG x
|
||||
REM Last Sunday in December MSG x
|
||||
|
||||
REM First Monday January 2000 MSG x
|
||||
REM Second Tuesday in April 2000 MSG x
|
||||
REM Third Wednesday in October 2000 MSG x
|
||||
REM Fourth Friday in July 2000 MSG x
|
||||
REM Last Tuesday in August 2000 MSG x
|
||||
REM Last Sunday in December 2000 MSG x
|
||||
|
||||
REM January ~~1 MSG y
|
||||
REM February ~~1 MSG y
|
||||
REM February ~~2 MSG y
|
||||
REM February ~~3 MSG y
|
||||
REM February ~~8 MSG y
|
||||
REM February ~~20 MSG y
|
||||
PUSH
|
||||
OMIT 31 March
|
||||
REM March ~1 MSG y
|
||||
REM March ~~1 MSG y
|
||||
REM Lastday March MSG y
|
||||
REM Lastworkday March MSG y
|
||||
POP
|
||||
REM Dec 2000 ~~1 MSG y
|
||||
REM Dec 2000 ~~2 MSG y
|
||||
REM Dec 2000 ~~3 MSG y
|
||||
REM Dec 2000 ~~7 MSG y
|
||||
REM Jan 2001 ~~1 MSG y
|
||||
|
||||
REM Lastday April 2022 OMIT SAT SUN MSG foo
|
||||
REM Lastworkday April 2022 OMIT SAT SUN MSG foo
|
||||
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user