mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
40 Commits
03.03.10
...
3.3.11-RC-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a4f939a3 | ||
|
|
c7ae214853 | ||
|
|
68a9cc047e | ||
|
|
1f2b25f852 | ||
|
|
20040c8857 | ||
|
|
ac64b0c11f | ||
|
|
ba47ce7ca8 | ||
|
|
be1ab4ea36 | ||
|
|
13cd9f3d04 | ||
|
|
8e1f82de5f | ||
|
|
8631ad3122 | ||
|
|
90e6aef9d7 | ||
|
|
698190fb72 | ||
|
|
27cfaa9404 | ||
|
|
9f296fe76d | ||
|
|
d0112adb08 | ||
|
|
75f4fe3595 | ||
|
|
211bfbc1e2 | ||
|
|
afaa1841fc | ||
|
|
027662c9c3 | ||
|
|
43e652321b | ||
|
|
83a2216d19 | ||
|
|
82ae568add | ||
|
|
2573003034 | ||
|
|
c33e873577 | ||
|
|
a1d03b8159 | ||
|
|
762530f6ab | ||
|
|
f53a3ecc69 | ||
|
|
1ed60fecee | ||
|
|
c1a12ea4e9 | ||
|
|
0efd235e36 | ||
|
|
c7be8c59f3 | ||
|
|
20bb3eb674 | ||
|
|
cde0e5883e | ||
|
|
0b43099621 | ||
|
|
386f36c3ae | ||
|
|
b391b2129e | ||
|
|
5478673bda | ||
|
|
6295048b3e | ||
|
|
4fa956aa27 |
2
configure
vendored
2
configure
vendored
@@ -4032,7 +4032,7 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION=03.03.10
|
||||
VERSION=03.03.11
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile"
|
||||
|
||||
@@ -76,7 +76,7 @@ if test "$GCC" = yes; then
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
|
||||
VERSION=03.03.10
|
||||
VERSION=03.03.11
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(PERL)
|
||||
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile)
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* VERSION 3.3 Patch 11 - 2021-12-30
|
||||
|
||||
- IMPROVEMENT: TkRemind: Save the print dialog settings so they persist.
|
||||
|
||||
- IMPROVEMENT: TkRemind: Show queue in sorted order.
|
||||
|
||||
- IMPROVEMENT: TkRemind: Pass "-r" flag to inotifywait
|
||||
|
||||
- IMPROVEMENT: TkRemind: Draw moon phases with Tk canvas items rather than
|
||||
using PNG images. This lets them change color along with other TkRemind
|
||||
preferences.
|
||||
|
||||
- IMPROVEMENT: TkRemind: Underline editable reminders when the pointer enters
|
||||
them; fire up the editor with either Button-1 or Button-3 for
|
||||
non-TkRemind-generated reminders.
|
||||
|
||||
- NEW FUNCTION: Remind: Add the isany() built-in function.
|
||||
|
||||
- IMPROVEMENT: rem2html: Add class names indicating number of rows in calendar
|
||||
|
||||
- IMPROVEMENT: remind: In -z0 mode, sleep with higher precision to ensure we
|
||||
wake as close to possible to each 1-minute boundary.
|
||||
|
||||
- IMPROVEMENT: rem2html: Coalesce table.rem-cal CSS into one block. Thanks
|
||||
to Ian! D. Allen for pointing this out.
|
||||
|
||||
- IMPROVEMENT: examples/defs.rem: Modernize the examples and get rid of some
|
||||
cruft.
|
||||
|
||||
- CHANGE: Add $Latitude and $Longitude system variables. Deprecate
|
||||
$LatDeg, $LatMin, $LatSec, $LongDeg, $LongMin and $LongSec.
|
||||
|
||||
- CHANGE: Test: Add "dump $" to test.rem.
|
||||
|
||||
* VERSION 3.3 Patch 10 - 2021-11-30
|
||||
|
||||
- IMPROVEMENT: TkRemind: Apply window and text colors to all GUI elements
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
# "#USHOLS" for U.S. holidays #
|
||||
# "#JHOLS" for Jewish holidays #
|
||||
# "#PSSTUFF" for nifty PostScript examples #
|
||||
# "#COLORS" for examples of ANSI color escape sequences. #
|
||||
# #
|
||||
# This file is part of REMIND. #
|
||||
# Copyright (C) 1992-2018 Dianne Skoll #
|
||||
@@ -26,8 +25,8 @@ RUN OFF
|
||||
################################################
|
||||
# Ensure required version of remind is used... #
|
||||
################################################
|
||||
IF version() < "03.01.09"
|
||||
ERRMSG This file requires at least version 03.01.09 of Remind.%
|
||||
IF version() < "03.01.10"
|
||||
ERRMSG This file requires at least version 03.01.10 of Remind.%
|
||||
ERRMSG This version is version [version()].
|
||||
EXIT
|
||||
ENDIF
|
||||
@@ -93,9 +92,6 @@ SET Week_3 15
|
||||
SET Week_4 22
|
||||
FSET _last(mo) "1 " + MON((mo%12)+1) + " --7"
|
||||
|
||||
# Handy function to provide SCANFROM dates...
|
||||
FSET _back(days) $U-days
|
||||
|
||||
#################################################################
|
||||
# Function that removes a single leading zero from a string... #
|
||||
#################################################################
|
||||
@@ -135,7 +131,7 @@ REM 1 MSG John's [_mo_num(11, 1984)] 'monthly' anniversary
|
||||
############################################################################
|
||||
|
||||
# Calculate the weekday of the holiday.
|
||||
REM 4 July SCANFROM [_back(7)] SATISFY 1
|
||||
REM 4 July SCANFROM -7 SATISFY 1
|
||||
|
||||
SET iday $T
|
||||
IF WKDAYNUM(iday) == Sat
|
||||
@@ -217,17 +213,15 @@ REM [easter+39] MSG %"Ascension Day%"
|
||||
REM [easter+49] MSG %"Pentecost%"
|
||||
|
||||
# Some holidays are omitted, some are not. You may want to change
|
||||
# which ones are omitted - use the general forms shown below.
|
||||
# You'll need the _back() function and the Week_n variables defined
|
||||
# way up in the file.
|
||||
# which ones are omitted - use the general forms shown below. You'll
|
||||
# need the Week_n variables defined way up in the file.
|
||||
|
||||
OMIT Jan 1 MSG %"New Year's%" Day
|
||||
REM Mon Jan [Week_3] MSG Martin Luther King - %"MLK Day%"
|
||||
REM Feb 2 MSG %"Ground Hog Day%"
|
||||
REM Feb 14 MSG %"Valentine's%" Day
|
||||
REM Mon Feb [Week_3] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [$T] MSG %"President's Day%"
|
||||
REM Mar 17 MSG %"St. Patrick's%" Day
|
||||
OMIT Jan 1 MSG %"New Year's%" Day
|
||||
REM Mon Jan [Week_3] MSG Martin Luther King - %"MLK Day%"
|
||||
REM Feb 2 MSG %"Ground Hog Day%"
|
||||
REM Feb 14 MSG %"Valentine's%" Day
|
||||
REM Mon Feb [Week_3] SCANFROM -7 ADDOMIT MSG %"President's Day%"
|
||||
REM Mar 17 MSG %"St. Patrick's%" Day
|
||||
|
||||
# The DST rules are accurate for most locations in
|
||||
# North America
|
||||
@@ -237,38 +231,31 @@ REM Sun Mar 8 ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST starts%" %b
|
||||
REM Sun [_last(Oct)] ++2 UNTIL 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
|
||||
REM Sun 1 Nov ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
|
||||
|
||||
REM Apr 1 MSG %"April Fool's%" Day
|
||||
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
|
||||
REM May 5 MSG %"Cinco de Mayo%"
|
||||
REM Sat May [Week_1] MSG %"Kentucky Derby%"
|
||||
REM Sun May [Week_2] MSG %"Mother's Day%"
|
||||
REM Sat May [Week_3] MSG %"Armed Forces Day%"
|
||||
REM Mon [_last(May)] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [$T] MSG %"Memorial Day%"
|
||||
REM Jun 14 MSG %"Flag Day%"
|
||||
REM Sun Jun [Week_3] MSG %"Father's Day%"
|
||||
REM Mon Sep [Week_1] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [$T] MSG %"Labor Day%"
|
||||
REM Mon Oct [Week_2] MSG %"Columbus Day%"
|
||||
REM Nov 11 MSG %"Veterans Day%"
|
||||
REM Apr 1 MSG %"April Fool's%" Day
|
||||
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
|
||||
REM May 5 MSG %"Cinco de Mayo%"
|
||||
REM Sat May [Week_1] MSG %"Kentucky Derby%"
|
||||
REM Sun May [Week_2] MSG %"Mother's Day%"
|
||||
REM Sat May [Week_3] MSG %"Armed Forces Day%"
|
||||
REM Mon [_last(May)] SCANFROM -7 ADDOMIT MSG %"Memorial Day%"
|
||||
REM Jun 14 MSG %"Flag Day%"
|
||||
REM Sun Jun [Week_3] MSG %"Father's Day%"
|
||||
REM Mon Sep [Week_1] SCANFROM -7 ADDOMIT MSG %"Labor Day%"
|
||||
REM Mon Oct [Week_2] MSG %"Columbus Day%"
|
||||
REM Nov 11 MSG %"Veterans Day%"
|
||||
|
||||
REM Oct 30 MSG %"Mischief Night%"
|
||||
REM Oct 31 MSG %"Halloween%"
|
||||
REM Tue Nov 2 SCANFROM [_back(7)] \
|
||||
SATISFY [($Ty % 4) == 0] \
|
||||
MSG %"Election%" Day
|
||||
REM Thu Nov [Week_4] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [$T] MSG %"Thanksgiving%" Day
|
||||
REM Fri Nov [Week_4+1] SCANFROM [_back(7)] SATISFY 1
|
||||
OMIT [$T] MSG %"Thanksgiving%" (cont.)
|
||||
OMIT Dec 24 MSG %"Christmas Eve%"
|
||||
OMIT Dec 25 MSG %"Christmas%" Day
|
||||
REM Oct 30 MSG %"Mischief Night%"
|
||||
REM Oct 31 MSG %"Halloween%"
|
||||
REM Tue Nov 2 SCANFROM -7 SATISFY [($Ty % 4) == 0] MSG %"Election Day%"
|
||||
REM Thu Nov [Week_4] SCANFROM -7 ADDOMIT MSG %"Thanksgiving Day%"
|
||||
REM Fri Nov [Week_4+1] SCANFROM -7 ADDOMIT MSG %"Thanksgiving (cont.)%"
|
||||
OMIT Dec 24 MSG %"Christmas Eve%"
|
||||
OMIT Dec 25 MSG %"Christmas%" Day
|
||||
|
||||
##########################################################################
|
||||
# #
|
||||
# If any US holidays were triggered above, shade in the calendar #
|
||||
# entry in PostScript. This is not quite correct, as it blots out any #
|
||||
# other PostScript stuff above. I was too lazy to do it properly :-) #
|
||||
# entry in PostScript. #
|
||||
# #
|
||||
##########################################################################
|
||||
if $NumTrig > SaveTrig
|
||||
@@ -495,48 +482,10 @@ REM Friday CAL Candle lighting at [sunset($T)-18]
|
||||
REM Saturday CAL Havdalah at [sunset($T)+42]
|
||||
|
||||
#COLORS
|
||||
##########################################################################
|
||||
# #
|
||||
# This contains sample ANSI escape sequences for coloring messages. #
|
||||
# It should work on an IBM PC with the ANSI.SYS driver, and on #
|
||||
# other terminals which use the ANSI sequences. #
|
||||
# #
|
||||
# This information was provided by Gail Gurman.
|
||||
# #
|
||||
##########################################################################
|
||||
# Colors - use Nrm to reset to normal text.
|
||||
SET Esc CHAR(27)
|
||||
|
||||
SET Nrm Esc + "[0m"
|
||||
SET Blk Esc + "[0;30m"
|
||||
SET Red Esc + "[0;31m"
|
||||
SET Grn Esc + "[0;32m"
|
||||
SET Ylw Esc + "[0;33m"
|
||||
SET Blu Esc + "[0;34m"
|
||||
SET Mag Esc + "[0;35m"
|
||||
SET Cyn Esc + "[0;36m"
|
||||
SET Wht Esc + "[0;37m"
|
||||
SET Gry Esc + "[30;1m"
|
||||
SET BrRed Esc + "[31;1m"
|
||||
SET BrGrn Esc + "[32;1m"
|
||||
SET BrYlw Esc + "[33;1m"
|
||||
SET BrBlu Esc + "[34;1m"
|
||||
SET BrMag Esc + "[35;1m"
|
||||
SET BrCyn Esc + "[36;1m"
|
||||
SET BrWht Esc + "[37;1m"
|
||||
|
||||
# Examples
|
||||
REM MSG A [Blu]blue[Nrm] reminder.
|
||||
REM MSG [Red]%"A red reminder%" safe to use in the calendar mode.[Nrm]
|
||||
|
||||
# Here is an example of how to use msgprefix() and msgsuffix(). These
|
||||
# will highlight priority-0 reminders in bright red,
|
||||
# priority-2500 in red, and priority-7500 in blue. All others
|
||||
# will be in the normal colors
|
||||
FSET msgprefix(x) iif(x==0, BrRed, x==2500, Red, x==7500, Blu, Nrm)
|
||||
|
||||
# Don't forget to return to normal color set at the end of reminder!
|
||||
FSET msgsuffix(x) Nrm
|
||||
REM 1 SPECIAL COLOR 0 0 255 A blue reminder.
|
||||
REM 2 SPECIAL COLOR 255 0 0 %"A red reminder%" safe to use in the calendar mode.
|
||||
|
||||
# The next examples are great for putting right at the end of the reminder
|
||||
# file. They make queued reminders more eye-catching when they pop up.
|
||||
|
||||
68
man/remind.1
68
man/remind.1
@@ -2156,11 +2156,35 @@ using twos-complement representation, this will be 2147483647.
|
||||
The smallest representable \fBINT\fR. On a machine with 32-bit signed integers
|
||||
using twos-complement representation, this will be -2147483648.
|
||||
.TP
|
||||
.B $LatDeg, $LatMin, $LatSec
|
||||
.B $Latitude (STRING type)
|
||||
The latitude of your location, expressed as a string that is a floating-point
|
||||
number. Because \fBRemind\fR does not have a native floating-point type,
|
||||
we need to express it as a string. $Latitude can range from "-90.0" to
|
||||
"90.0", with positive numbers representing points north of the equator
|
||||
and negative numbers representing south.
|
||||
.TP
|
||||
.B $Longitude (STRING type)
|
||||
The longitude of your location, expressed as a string that is a floating-point
|
||||
number. Because \fBRemind\fR does not have a native floating-point type,
|
||||
we need to express it as a string. $Longitude can range from "-180.0" to
|
||||
"180.0", with positive numbers representing points east of the Greenwich
|
||||
Meridian and negative numbers representing west.
|
||||
.RS
|
||||
.PP
|
||||
For example, the coordinates of the Statue of Liberty in New York City
|
||||
are approximately set by:
|
||||
.nf
|
||||
SET $Latitude "40.68933"
|
||||
SET $Longitude "-74.04454"
|
||||
.fi
|
||||
.RE
|
||||
.TP
|
||||
.B $LatDeg, $LatMin, $LatSec (DEPRECATED)
|
||||
These specify the latitude of your location. \fB$LatDeg\fR can
|
||||
range from \-90 to 90, and the others from \-59 to 59. Northern latitudes
|
||||
are positive; southern ones are negative. For southern latitudes, all
|
||||
three components should be negative.
|
||||
three components should be negative. These three variables
|
||||
are deprecated; you should use \fB$Latitude\fR instead.
|
||||
.TP
|
||||
.B $Location (STRING type)
|
||||
This is a string specifying the name of your location. It is usually
|
||||
@@ -2168,23 +2192,30 @@ the name of your town or city. It can be set to whatever you like,
|
||||
but good style indicates that it should be kept consistent with
|
||||
the latitude and longitude system variables.
|
||||
.TP
|
||||
.B $LongDeg, $LongMin, $LongSec
|
||||
.B $LongDeg, $LongMin, $LongSec (DEPRECATED)
|
||||
These specify the longitude of your location. \fB$LongDeg\fR can
|
||||
range from \-180 to 180. Western longitudes are positive; eastern
|
||||
ones are negative. Note that all three components should have the
|
||||
same sign: All positive for Western longitudes and all negative for
|
||||
Eastern longitudes. Note that for historical reasons, the sign for
|
||||
same sign: All positive for western longitudes and all negative for
|
||||
eastern longitudes. Note that for historical reasons, the sign for
|
||||
longitude is \fIdifferent\fR from the usual convention! If you find
|
||||
the longitude of your location from a search engine, you will most
|
||||
likely \fIneed to invert the sign to have it work correctly with
|
||||
Remind.\fR
|
||||
|
||||
Remind.\fR These three variables are deprecated; you should use
|
||||
\fB$Longitude\fR instead. Note also that \fB$Longitude\fR uses the
|
||||
standard convention of negative for western longitudes and positive
|
||||
for eastern ones.
|
||||
.RS
|
||||
.PP
|
||||
The latitude and longitude information is required for the functions
|
||||
\fBsunrise()\fR and \fBsunset()\fR. Default values can be compiled
|
||||
into \fBRemind\fR, or you can \fBSET\fR the correct values at the
|
||||
start of your reminder scripts.
|
||||
.PP
|
||||
Note that setting any of \fB$LongDec\fR, \fB$LongMin\fR and \fB$LongSec\fR
|
||||
updates \fB$Longitude\fR correspondingly, and setting \fB$Longitude\fR
|
||||
updates \fB$LongDeg\fR, \fB$LongMin\fR and \fB$LongSec\fR. Similar
|
||||
rules apply to \fB$Latitude\fR, \fB$LatDeg\fR, \fB$LatMin\fR and \fB$LatSec\fR.
|
||||
.RE
|
||||
.TP
|
||||
.B $MaxSatIter
|
||||
@@ -2637,6 +2668,21 @@ The optional parameter \fIstart\fR specifies the position in
|
||||
\fIsearch\fR at which to start looking for \fItarget\fR.
|
||||
.RE
|
||||
.TP
|
||||
.B isany(arg1 [,arg2, ..., argN]);
|
||||
Returns 1 if the first argument \fIarg1\fR is equal to any of the
|
||||
subsequent arguments \fIarg2\fR through \fIargN\fR; returns 0 otherwise.
|
||||
Also returns 0 if called with only one argument.
|
||||
.RS
|
||||
.PP
|
||||
As an example, the following two expressions are equivalent:
|
||||
.PP
|
||||
.nf
|
||||
(a == b) || (a == c) || (a == d) || (a == e)
|
||||
|
||||
isany(a, b, c, d, e)
|
||||
.fi
|
||||
.RE
|
||||
.TP
|
||||
.B isdst([d_date [,t_time]]) \fRor\fB isdst(q_datetime)
|
||||
Returns a positive number if daylight saving time is in
|
||||
effect on the specified date and time. \fIDate\fR
|
||||
@@ -3733,6 +3779,14 @@ We could also have written:
|
||||
but this would result in more iterations, since "Fridays" occur more
|
||||
often than "13ths of the month."
|
||||
.PP
|
||||
Here is another example: Suppose you want to be reminded of something
|
||||
on the 15th of January, April, July, and October. You could make
|
||||
four separate reminders, or you could use:
|
||||
.PP
|
||||
.nf
|
||||
REM 15 SATISFY [isany($Tm, 1, 4, 7, 10)] MSG 15th Reminder!
|
||||
.fi
|
||||
.PP
|
||||
This technique of using one \fBREM\fR command to calculate a trigger date
|
||||
to be used by another command is quite powerful. For example, suppose
|
||||
you wanted to OMIT Labour day, which is the first Monday in September. You
|
||||
|
||||
@@ -164,7 +164,11 @@ it with \fBTkRemind\fR.
|
||||
If you have set the "text editor" option correctly, right-clicking
|
||||
on a reminder will bring up a text editor on the file containing
|
||||
the reminder. The cursor will be positioned on the line that
|
||||
generated the reminder.
|
||||
generated the reminder. In addition, if you have a reminder that
|
||||
is editable with an editor but was not created using \fBTkRemind\fR,
|
||||
it will be underlined when you move the cursor over it, and
|
||||
you can edit it in a text editor by either left- or right-clicking
|
||||
on the reminder.
|
||||
|
||||
.SH BACKGROUND REMINDERS
|
||||
|
||||
|
||||
@@ -419,6 +419,14 @@ sub output_calendar
|
||||
# Last column
|
||||
my $last_col = ($first_col + $Numdays - 1) % 7;
|
||||
|
||||
# Figure out how many rows
|
||||
my $number_of_rows = int(($first_col + $Numdays ) / 7 + 0.999);
|
||||
|
||||
# Add a row for small calendars if necessary
|
||||
if ($first_col == 0 && $last_col == 6) {
|
||||
$number_of_rows++;
|
||||
}
|
||||
|
||||
# Start the table
|
||||
my $class;
|
||||
if ($Options{nostyle}) {
|
||||
@@ -448,7 +456,7 @@ sub output_calendar
|
||||
if ($Options{nostyle}) {
|
||||
print "<tr>\n";
|
||||
} else {
|
||||
print "<tr class=\"rem-cal-row\">\n";
|
||||
print "<tr class=\"rem-cal-row rem-cal-row-$number_of_rows-rows\">\n";
|
||||
}
|
||||
if ($first_col > 0) {
|
||||
small_calendar($Prevmon, $Prevlen, $Options{backurl},
|
||||
@@ -464,7 +472,7 @@ sub output_calendar
|
||||
if ($Options{nostyle}) {
|
||||
$class = ' width="14%"';
|
||||
} else {
|
||||
$class = ' class="rem-empty"';
|
||||
$class = ' class="rem-empty rem-empty-$number_of_rows-rows"';
|
||||
}
|
||||
while ($col < $first_col) {
|
||||
print("<td$class> </td>\n");
|
||||
@@ -472,7 +480,7 @@ sub output_calendar
|
||||
}
|
||||
|
||||
for (my $day=1; $day<=$Numdays; $day++) {
|
||||
draw_day_cell($day);
|
||||
draw_day_cell($day, $number_of_rows);
|
||||
$col++;
|
||||
if ($col == 7) {
|
||||
$col = 0;
|
||||
@@ -481,7 +489,7 @@ sub output_calendar
|
||||
if ($Options{nostyle}) {
|
||||
print "<tr>\n";
|
||||
} else {
|
||||
print "<tr class=\"rem-cal-row\">\n";
|
||||
print "<tr class=\"rem-cal-row rem-cal-row-$number_of_rows-rows\">\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,7 +520,7 @@ sub output_calendar
|
||||
if ($Options{nostyle}) {
|
||||
print "<tr>\n";
|
||||
} else {
|
||||
print "<tr class=\"rem-cal-row\">\n";
|
||||
print "<tr class=\"rem-cal-row rem-cal-row-$number_of_rows-rows\">\n";
|
||||
}
|
||||
small_calendar($Prevmon, $Prevlen, $Options{backurl},
|
||||
($Firstwkday - $Prevlen + 35) % 7);
|
||||
@@ -529,7 +537,7 @@ sub output_calendar
|
||||
|
||||
sub draw_day_cell
|
||||
{
|
||||
my($day) = @_;
|
||||
my($day, $number_of_rows) = @_;
|
||||
my $shade = $shades->[$day];
|
||||
my $week = '';
|
||||
if (exists($weeks->{$day})) {
|
||||
@@ -539,7 +547,7 @@ sub draw_day_cell
|
||||
if ($Options{nostyle}) {
|
||||
$class = $classes->[$day] || '';
|
||||
} else {
|
||||
$class = $classes->[$day] || "rem-cell";
|
||||
$class = $classes->[$day] || "rem-cell rem-cell-$number_of_rows-rows";
|
||||
}
|
||||
if ($shade) {
|
||||
$shade = " style=\"background: $shade;\"";
|
||||
|
||||
288
scripts/tkremind
288
scripts/tkremind
@@ -21,17 +21,6 @@ if {[catch {package require Tcl 8.5}]} {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# If it's 8.5, try using the Img or the TkPNG package to
|
||||
# get PNG support
|
||||
if {[info tclversion] == 8.5} {
|
||||
if {[catch {package require Img}]} {
|
||||
if {[catch {package require tkpng}]} {
|
||||
puts stderr "Tcl/Tk version 8.5 might require either the Img or tkpng"
|
||||
puts stderr "package to handle PNG images correctly. TkRemind may"
|
||||
puts stderr "crash because neither of these packages was found."
|
||||
}
|
||||
}
|
||||
}
|
||||
wm withdraw .
|
||||
|
||||
set Hostname [exec hostname]
|
||||
@@ -148,7 +137,6 @@ set TimerUpdateForChanges ""
|
||||
|
||||
# Remind program to execute -- supply full path if you want
|
||||
set Remind "remind"
|
||||
#set Remind "/home/dfs/Remind/src/remind"
|
||||
|
||||
# Rem2PS program to execute -- supply full path if you want
|
||||
set Rem2PS "rem2ps"
|
||||
@@ -211,14 +199,29 @@ set PSCmd {}
|
||||
|
||||
# Print options -- destination file; letter-size; landscape; fill page; default
|
||||
# encoding; 36pt margins; print small calendars
|
||||
set PrintDest file
|
||||
set PrintSize letter
|
||||
set PrintOrient landscape
|
||||
set PrintFill 1
|
||||
set PrintDaysRight 1
|
||||
set PrintEncoding 0
|
||||
set PrintMargins 36pt
|
||||
set PrintSmallCalendars 1
|
||||
set OptDescr(PrintDest) "Print destination: file or command"
|
||||
set Option(PrintDest) file
|
||||
|
||||
set OptDescr(PrintSize) "Page size: a4 or letter"
|
||||
set Option(PrintSize) letter
|
||||
|
||||
set OptDescr(PrintOrient) "Page orientation: portrait or landscape"
|
||||
set Option(PrintOrient) landscape
|
||||
|
||||
set OptDescr(PrintFill) "(0/1) If 1, fill entire page when printing"
|
||||
set Option(PrintFill) 1
|
||||
|
||||
set OptDescr(PrintDaysRight) "(0/1) If 1, put day numbers in the top-right of each calendar box"
|
||||
set Option(PrintDaysRight) 1
|
||||
|
||||
set OptDescr(PrintEncoding) "(0/1) If 1, apply ISO-8859-1 encoding to PostScript output"
|
||||
set Option(PrintEncoding) 0
|
||||
|
||||
set OptDescr(PrintMargins) "Print margins: One of 24pt, 36pt or 48pt"
|
||||
set Option(PrintMargins) 36pt
|
||||
|
||||
set OptDescr(PrintSmallCalendars) "(0/1) If 1, print small calendars in PostScript output"
|
||||
set Option(PrintSmallCalendars) 1
|
||||
|
||||
set WarningHeaders [list "# Lines staring with REM TAG TKTAGnnn ... were created by tkremind" "# Do not edit them by hand or results may be unpredictable."]
|
||||
|
||||
@@ -484,7 +487,6 @@ proc CreateCalFrame { w dayNames } {
|
||||
-state disabled -takefocus 0 -cursor {} -font CalboxFont -foreground $Option(TextColor) -background $Option(BackgroundColor)
|
||||
$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
|
||||
}
|
||||
@@ -512,6 +514,8 @@ proc CreateCalFrame { w dayNames } {
|
||||
proc ConfigureCalFrame { w firstDay numDays } {
|
||||
global CurMonth CurYear TodayMonth TodayYear TodayDay
|
||||
global tk_version Option
|
||||
|
||||
CreateMoonWindows
|
||||
set offset [CalEntryOffset $firstDay]
|
||||
set first [expr $offset+1]
|
||||
set last [expr $offset+$numDays]
|
||||
@@ -839,27 +843,9 @@ proc ApplyOptions { w } {
|
||||
# Saves options in specified config file
|
||||
#***********************************************************************
|
||||
proc SaveOptions { w } {
|
||||
global Option OptDescr ConfigFile
|
||||
global Option OptDescr
|
||||
ApplyOptions $w
|
||||
|
||||
set problem [catch {set f [open $ConfigFile "w"]} err]
|
||||
if {$problem} {
|
||||
tk_dialog .error Error "Can't write $ConfigFile: $err" 0 OK
|
||||
return
|
||||
}
|
||||
|
||||
puts $f "# TkRemind option file -- created automatically"
|
||||
puts $f "# [clock format [clock seconds]]"
|
||||
puts $f "# Format of each line is 'key value' where 'key'"
|
||||
puts $f "# specifies the option name, and 'value' is a"
|
||||
puts $f "# *legal Tcl list element* specifying the option value."
|
||||
foreach name [lsort [array names Option]] {
|
||||
puts $f ""
|
||||
puts $f "# $OptDescr($name)"
|
||||
puts $f [list $name $Option($name)]
|
||||
}
|
||||
puts $f ""
|
||||
close $f
|
||||
WriteOptionsToFile
|
||||
FillCalWindow
|
||||
.h.title configure -background $Option(WinBackground) -foreground $Option(LabelColor)
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
@@ -878,6 +864,30 @@ proc SaveOptions { w } {
|
||||
.b.options configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
}
|
||||
|
||||
proc WriteOptionsToFile {} {
|
||||
global ConfigFile
|
||||
global Option OptDescr
|
||||
set problem [catch {set f [open "$ConfigFile.tmp" "w"]} err]
|
||||
if {$problem} {
|
||||
tk_dialog .error Error "Can't write $ConfigFile.tmp: $err" 0 OK
|
||||
return
|
||||
}
|
||||
|
||||
puts $f "# TkRemind option file -- created automatically"
|
||||
puts $f "# [clock format [clock seconds]]"
|
||||
puts $f "# Format of each line is 'key value' where 'key'"
|
||||
puts $f "# specifies the option name, and 'value' is a"
|
||||
puts $f "# *legal Tcl list element* specifying the option value."
|
||||
foreach name [lsort [array names Option]] {
|
||||
puts $f ""
|
||||
puts $f "# $OptDescr($name)"
|
||||
puts $f [list $name $Option($name)]
|
||||
}
|
||||
puts $f ""
|
||||
close $f
|
||||
file rename -force "$ConfigFile.tmp" $ConfigFile
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: LoadOptions
|
||||
# %ARGUMENTS:
|
||||
@@ -1027,7 +1037,7 @@ proc FillCalWindow {} {
|
||||
continue
|
||||
}
|
||||
"MOON" {
|
||||
DoMoonSpecial $n $stuff
|
||||
DoMoonSpecial $n $stuff $fntag
|
||||
continue
|
||||
}
|
||||
"COLOUR" -
|
||||
@@ -1072,6 +1082,9 @@ proc FillCalWindow {} {
|
||||
.cal.t$n insert end [string trim $stuff] [list REM $extratags]
|
||||
} else {
|
||||
.cal.t$n insert end [string trim $stuff] [list REM $extratags $fntag]
|
||||
.cal.t$n tag bind $fntag <Enter> "EditableEnter .cal.t$n"
|
||||
.cal.t$n tag bind $fntag <Leave> "EditableLeave .cal.t$n"
|
||||
.cal.t$n tag bind $fntag <ButtonPress-1> "FireEditor .cal.t$n"
|
||||
}
|
||||
}
|
||||
.cal.t$n insert end "\n"
|
||||
@@ -1137,7 +1150,7 @@ proc Status { stuff } {
|
||||
# None
|
||||
#---------------------------------------------------------------------------
|
||||
proc DoPrint {} {
|
||||
global PrintDest PrintSize PrintMargins PrintOrient PrintFill PrintDaysRight PrintEncoding PrintSmallCalendars PrintStatus Rem2PS PSCmd Option
|
||||
global Rem2PS PSCmd Option PrintStatus
|
||||
global CurMonth CurYear MonthNames
|
||||
catch {destroy .p}
|
||||
toplevel .p
|
||||
@@ -1152,30 +1165,30 @@ proc DoPrint {} {
|
||||
frame .p.f3a -relief sunken -border 2
|
||||
frame .p.f4
|
||||
|
||||
radiobutton .p.tofile -text "To file: " -variable PrintDest -value file
|
||||
radiobutton .p.tofile -text "To file: " -variable Option(PrintDest) -value file
|
||||
entry .p.filename
|
||||
button .p.browse -text "Browse..." -command PrintFileBrowse
|
||||
radiobutton .p.tocmd -text "To command: " -variable PrintDest -value command
|
||||
radiobutton .p.tocmd -text "To command: " -variable Option(PrintDest) -value command
|
||||
entry .p.command
|
||||
.p.command insert end "lpr"
|
||||
|
||||
label .p.size -text "Paper Size:"
|
||||
radiobutton .p.letter -text "Letter" -variable PrintSize -value letter
|
||||
radiobutton .p.a4 -text "A4" -variable PrintSize -value a4
|
||||
radiobutton .p.letter -text "Letter" -variable Option(PrintSize) -value letter
|
||||
radiobutton .p.a4 -text "A4" -variable Option(PrintSize) -value a4
|
||||
|
||||
label .p.margin -text "Margins:"
|
||||
radiobutton .p.24pt -text "24pt margins" -variable PrintMargins -value 24pt
|
||||
radiobutton .p.36pt -text "36pt margins" -variable PrintMargins -value 36pt
|
||||
radiobutton .p.48pt -text "48pt margins" -variable PrintMargins -value 48pt
|
||||
radiobutton .p.24pt -text "24pt margins" -variable Option(PrintMargins) -value 24pt
|
||||
radiobutton .p.36pt -text "36pt margins" -variable Option(PrintMargins) -value 36pt
|
||||
radiobutton .p.48pt -text "48pt margins" -variable Option(PrintMargins) -value 48pt
|
||||
|
||||
label .p.orient -text "Orientation:"
|
||||
radiobutton .p.landscape -text "Landscape" -variable PrintOrient -value landscape
|
||||
radiobutton .p.portrait -text "Portrait" -variable PrintOrient -value portrait
|
||||
radiobutton .p.landscape -text "Landscape" -variable Option(PrintOrient) -value landscape
|
||||
radiobutton .p.portrait -text "Portrait" -variable Option(PrintOrient) -value portrait
|
||||
|
||||
checkbutton .p.fill -text "Fill page" -variable PrintFill
|
||||
checkbutton .p.right -text "Day numbers at top-right" -variable PrintDaysRight
|
||||
checkbutton .p.encoding -text "ISO 8859-1 PostScript encoding" -variable PrintEncoding
|
||||
checkbutton .p.calendars -text "Print small calendars" -variable PrintSmallCalendars
|
||||
checkbutton .p.fill -text "Fill page" -variable Option(PrintFill)
|
||||
checkbutton .p.right -text "Day numbers at top-right" -variable Option(PrintDaysRight)
|
||||
checkbutton .p.encoding -text "ISO 8859-1 PostScript encoding" -variable Option(PrintEncoding)
|
||||
checkbutton .p.calendars -text "Print small calendars" -variable Option(PrintSmallCalendars)
|
||||
|
||||
button .p.print -text "Print" -command {set PrintStatus print}
|
||||
button .p.cancel -text "Cancel" -command {set PrintStatus cancel}
|
||||
@@ -1209,7 +1222,8 @@ proc DoPrint {} {
|
||||
if {$PrintStatus == "cancel"} {
|
||||
return
|
||||
}
|
||||
if {$PrintDest == "file"} {
|
||||
WriteOptionsToFile
|
||||
if {$Option(PrintDest) == "file"} {
|
||||
if {$fname == ""} {
|
||||
tk_dialog .error Error "No filename specified" error 0 Ok
|
||||
return
|
||||
@@ -1232,36 +1246,36 @@ proc DoPrint {} {
|
||||
# Build the command line
|
||||
set p [regsub EXTRA $PSCmd $Option(ExtraRemindArgs)]
|
||||
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PS"
|
||||
if {$PrintSize == "letter"} {
|
||||
if {$Option(PrintSize) == "letter"} {
|
||||
append cmd " -m Letter"
|
||||
} else {
|
||||
append cmd " -m A4"
|
||||
}
|
||||
|
||||
if {$PrintMargins == "24pt"} {
|
||||
if {$Option(PrintMargins) == "24pt"} {
|
||||
append cmd " -or 24 -ol 24 -ot 24 -ob 24"
|
||||
} elseif {$PrintMargins == "36pt"} {
|
||||
} elseif {$Option(PrintMargins) == "36pt"} {
|
||||
append cmd " -or 36 -ol 36 -ot 36 -ob 36"
|
||||
} else {
|
||||
append cmd " -or 48 -ol 48 -ot 48 -ob 48"
|
||||
}
|
||||
|
||||
if {$PrintOrient == "landscape"} {
|
||||
if {$Option(PrintOrient) == "landscape"} {
|
||||
append cmd " -l"
|
||||
}
|
||||
|
||||
if {$PrintFill} {
|
||||
if {$Option(PrintFill)} {
|
||||
append cmd " -e"
|
||||
}
|
||||
|
||||
if {!$PrintDaysRight} {
|
||||
if {!$Option(PrintDaysRight)} {
|
||||
append cmd " -x"
|
||||
}
|
||||
if {$PrintEncoding} {
|
||||
if {$Option(PrintEncoding)} {
|
||||
append cmd " -i"
|
||||
}
|
||||
|
||||
if {$PrintSmallCalendars} {
|
||||
if {$Option(PrintSmallCalendars)} {
|
||||
append cmd " -c3"
|
||||
} else {
|
||||
append cmd " -c0"
|
||||
@@ -2505,6 +2519,7 @@ proc ShowQueue { file } {
|
||||
if {[catch {set obj [::json::json2dict $line]}]} {
|
||||
continue;
|
||||
}
|
||||
set obj [lsort -command sort_q $obj]
|
||||
foreach q $obj {
|
||||
$w.t insert end "$q\n"
|
||||
}
|
||||
@@ -2512,6 +2527,18 @@ proc ShowQueue { file } {
|
||||
$w.t configure -state disabled
|
||||
}
|
||||
|
||||
proc sort_q { a b } {
|
||||
set a_ttime [dict get $a nextttime]
|
||||
set b_ttime [dict get $b nextttime]
|
||||
if {$a_ttime < $b_ttime} {
|
||||
return -1
|
||||
}
|
||||
if {$a_ttime > $b_ttime} {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# DaemonReadable
|
||||
# Arguments:
|
||||
@@ -2705,7 +2732,6 @@ proc main {} {
|
||||
}
|
||||
}
|
||||
LoadOptions
|
||||
CreateMoonImages
|
||||
ShowTodaysReminders
|
||||
ScanForTags $AppendFile
|
||||
CreateCalWindow $DayNames
|
||||
@@ -3053,17 +3079,19 @@ proc ReadTaggedOptions { tag date } {
|
||||
}
|
||||
return $ans
|
||||
}
|
||||
proc FireEditor { w } {
|
||||
proc FireEditor { w {fntag ""}} {
|
||||
global Option
|
||||
global EditorPid
|
||||
set tags [$w tag names current]
|
||||
set index [lsearch -glob $tags "FILE_*"]
|
||||
if {$index < 0} {
|
||||
return
|
||||
if {"$fntag" == ""} {
|
||||
set tags [$w tag names current]
|
||||
set index [lsearch -glob $tags "FILE_*"]
|
||||
if {$index < 0} {
|
||||
return
|
||||
}
|
||||
set fntag [lindex $tags $index]
|
||||
}
|
||||
set tag [lindex $tags $index]
|
||||
if {![regexp {^FILE_([0-9]+)_(.*)} $tag all line file]} {
|
||||
return
|
||||
if {![regexp {^FILE_([0-9]+)_(.*)} $fntag all line file]} {
|
||||
return
|
||||
}
|
||||
set editor $Option(Editor)
|
||||
regsub -all "%s" $editor $file editor
|
||||
@@ -3116,6 +3144,7 @@ proc TaggedEnter { w } {
|
||||
$w tag configure $tag -foreground #FF0000
|
||||
}
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: TaggedLeave
|
||||
# %ARGUMENTS:
|
||||
@@ -3141,6 +3170,35 @@ proc TaggedLeave { w } {
|
||||
}
|
||||
}
|
||||
|
||||
proc EditableEnter { w } {
|
||||
set tags [$w tag names current]
|
||||
set index [lsearch -glob $tags "FILE_*"]
|
||||
if {$index < 0} {
|
||||
return
|
||||
}
|
||||
set tag [lindex $tags $index]
|
||||
|
||||
set c ""
|
||||
set index [lsearch -glob $tags "clr*"]
|
||||
if {$index >= 0} {
|
||||
set ctag [lindex $tags $index]
|
||||
set c [$w tag cget $ctag -foreground]
|
||||
}
|
||||
if {"$c" != ""} {
|
||||
$w tag configure $tag -underline 1 -underlinefg $c
|
||||
} else {
|
||||
$w tag configure $tag -underline 1
|
||||
}
|
||||
}
|
||||
proc EditableLeave { w } {
|
||||
set tags [$w tag names current]
|
||||
set index [lsearch -glob $tags "FILE_*"]
|
||||
if {$index < 0} {
|
||||
return
|
||||
}
|
||||
set tag [lindex $tags $index]
|
||||
$w tag configure $tag -underline 0
|
||||
}
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: EditTaggedReminder
|
||||
# %ARGUMENTS:
|
||||
@@ -3426,12 +3484,13 @@ proc DoShadeSpecial { n r g b } {
|
||||
# %ARGUMENTS:
|
||||
# n -- calendar box for moon
|
||||
# stuff -- Remind command line
|
||||
# fntag - filename tag, if any
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Handles the "MOON" special -- draws a moon symbol
|
||||
#***********************************************************************
|
||||
proc DoMoonSpecial { n stuff } {
|
||||
proc DoMoonSpecial { n stuff fntag } {
|
||||
set msg ""
|
||||
set num [scan $stuff "%d %d %d %s" phase junk1 junk2 msg]
|
||||
if {$num < 1} {
|
||||
@@ -3441,18 +3500,34 @@ proc DoMoonSpecial { n stuff } {
|
||||
return
|
||||
}
|
||||
switch -exact -- $phase {
|
||||
0 { set image new }
|
||||
1 { set image first }
|
||||
2 { set image full }
|
||||
3 { set image last }
|
||||
0 { set win .moon_new }
|
||||
1 { set win .moon_first }
|
||||
2 { set win .moon_full }
|
||||
3 { set win .moon_last }
|
||||
}
|
||||
.cal.t$n configure -state normal
|
||||
.cal.t$n image create 1.0 -image $image
|
||||
.cal.t$n window create 1.0 -window $win
|
||||
|
||||
if {$msg != ""} {
|
||||
.cal.t$n insert 1.1 " $msg\n"
|
||||
if {"$fntag" == "x"} {
|
||||
.cal.t$n insert 1.1 " $msg\n"
|
||||
} else {
|
||||
.cal.t$n insert 1.1 " $msg\n" [list REM $fntag]
|
||||
.cal.t$n tag bind $fntag <Enter> "EditableEnter .cal.t$n"
|
||||
.cal.t$n tag bind $fntag <Leave> "EditableLeave .cal.t$n"
|
||||
.cal.t$n tag bind $fntag <ButtonPress-1> "FireEditor .cal.t$n $fntag"
|
||||
bind $win <ButtonPress-1> "FireEditor .cal.t$n $fntag"
|
||||
bind $win <ButtonPress-3> "FireEditor .cal.t$n $fntag"
|
||||
}
|
||||
} else {
|
||||
.cal.t$n insert 1.1 "\n"
|
||||
if {"$fntag" == "x"} {
|
||||
.cal.t$n insert 1.1 "\n"
|
||||
} else {
|
||||
.cal.t$n insert 1.1 "\n" [list REM $fntag]
|
||||
.cal.t$n tag bind $fntag <Enter> "EditableEnter .cal.t$n"
|
||||
.cal.t$n tag bind $fntag <Leave> "EditableLeave .cal.t$n"
|
||||
.cal.t$n tag bind $fntag <ButtonPress-1> "FireEditor .cal.t$n $fntag"
|
||||
}
|
||||
}
|
||||
.cal.t$n configure -state disabled
|
||||
}
|
||||
@@ -3476,19 +3551,52 @@ proc DisplayTime {} {
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateMoonImages
|
||||
# %PROCEDURE: CreateMoonWindows
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Creates the moon images "new", "first", "full" and "last"
|
||||
# Creates the moon windows .moon_new, .moon_first, .moon_full and
|
||||
# .moon_last
|
||||
#***********************************************************************
|
||||
proc CreateMoonImages {} {
|
||||
image create photo full -data "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADlSURBVDiNrdNBUsJAEAXQlyw4hq4hwWPqTixET6ELkZ16CcAq7oFLqXExjaYgQVNlV/Viev7/6XT/4TjGuME7PiLXUatb8N8xwB12SFjiIXIZtU/MAntEfgvQE4YtHxhiHpjXQ5H7uLhEcaLLAleBvd0Xx9Ha/BdyU+Q5OBV5OKmj7a4YBWdSyNPe4aKHAHkzqcQZNj3JgnNexqE8heyIAulffuFF3kTfIVbBVeu/xoXGGsn2TLJJ/mqkafNiINszySYZdbS90GHlvcgsWktY4TFy7ecxTdvIzahxHQLbyFXUqkPwF2ASRNYgB/PXAAAAAElFTkSuQmCC"
|
||||
image create photo first -data "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADfSURBVDiNndM9TsNAFATgzy5yjZSAE85JBygETgENUPF3iBCitHAFQkcIhZ/Ryn9gRlrZmp2Z3ef3TBOHOMULPrDBMrhpi/4HI5xjix2+4nmJRbx/Yh7ahvkpRPVV4QDXwT3UQy46zGkAZDgK/iytefvHgCrkJsqZUH6cLnNbABSxd5Jhhf1IbkMXv8Qux7hH1Ic1xvk/jBWy6gavumvtwx7ectwZXkKh7MA95XgObeOtpI2U4zl0kGbpxgiPvwQUcXLrKFchc82f6Ur0PK49azOnmOI4TBu84zm4SV38DeIVYkrYJyNbAAAAAElFTkSuQmCC"
|
||||
image create photo new -data "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAC6SURBVDiNpdNNbsIwFATgL0HKolchHKBX6yFaBOEyoPYUabvOIVKJRaCL2JX5TRNGGvnJ8ozGz89cYoElPvET+BX2yivn/1Bggw5HHMKa1h2qcPZC/JEIhvh+brIZIY6sorhMYo9hh3KGFzzfa84NZNjDt9OG/ZcH1BlaPE1IAG0+URhxzNGESKPFaHJs9Q0Ziww7HnvGeXSrJhis0jiFfjwnj3I0WRv+TKtr4hQl3lDrZ6QN9Wt654hfWfGDmBpUwDkAAAAASUVORK5CYII="
|
||||
image create photo last -data "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADmSURBVDiNndMxTsNAEIXhzy5yCyQ6FAgcE7oQheQWUAAl5BIkREoZrgB0GFNkHBl7bURGsryaee/3jHeXdpxjghU+8InXyI0S+n0MMEeBEi+4jfV3vAvMQtsyL0J0j2GtViaeRRMyj8IlsgY8BSijE2Kur/hy09wHKMJrEolhwtwHKDHOsI4OLnoAXfl1jiNsOkR9keE4P8D4q4scbzg5xIxtjie709f1E7siC+9+Gx/8fxvPKtEsklcJSBdgWhcN8ByFR5z+AWgd5QpyE+OUWOJO+zJNU+Z6jHAdgHe7K73CuD5zFT9nCmRDIssCaAAAAABJRU5ErkJggg=="
|
||||
proc CreateMoonWindows {} {
|
||||
global Option;
|
||||
catch { destroy .moon_new }
|
||||
catch { destroy .moon_first }
|
||||
catch { destroy .moon_full }
|
||||
catch { destroy .moon_last }
|
||||
|
||||
set extra 1
|
||||
#set wid [font measure CalboxFont 0]
|
||||
set wid [font metrics CalboxFont -ascent]
|
||||
set orig_wid $wid
|
||||
incr wid $extra
|
||||
incr wid $extra
|
||||
incr wid $extra
|
||||
incr wid $extra
|
||||
incr orig_wid $extra
|
||||
incr orig_wid $extra
|
||||
|
||||
set w [expr $extra+$orig_wid]
|
||||
canvas .moon_new -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_new create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
|
||||
canvas .moon_first -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_first create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
.moon_first create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 90 -extent 180 -outline {}
|
||||
|
||||
canvas .moon_full -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_full create oval $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -width 1
|
||||
|
||||
canvas .moon_last -background $Option(BackgroundColor) -width $wid -height $wid -borderwidth 0 -highlightthickness 0
|
||||
.moon_last create oval $extra $extra $w $w -outline $Option(TextColor) -width 1
|
||||
.moon_last create arc $extra $extra $w $w -outline $Option(TextColor) -fill $Option(TextColor) -start 270 -extent 180 -outline {}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
@@ -3631,7 +3739,7 @@ proc SetFonts {} {
|
||||
proc SetupInotify {} {
|
||||
global InotifyFP
|
||||
global ReminderFile
|
||||
set failed [catch {set InotifyFP [open "|inotifywait -q -m -e close_write -e move -e create -e delete $ReminderFile" "r"] } ]
|
||||
set failed [catch {set InotifyFP [open "|inotifywait -r -q -m -e close_write -e move -e create -e delete $ReminderFile < /dev/null 2>/dev/null" "r"] } ]
|
||||
if {$failed} {
|
||||
# inotifywait probably not available... meh.
|
||||
return
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
/* The default values are initially set to Ottawa, Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LAT_DEG 45
|
||||
#define LAT_MIN 24
|
||||
#define LAT_SEC 0
|
||||
#define LAT_MIN 25
|
||||
#define LAT_SEC 30
|
||||
#define LON_DEG 75
|
||||
#define LON_MIN 39
|
||||
#define LON_SEC 0
|
||||
#define LON_MIN 41
|
||||
#define LON_SEC 59
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
/* The default values are initially set to Ottawa, Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LAT_DEG 45
|
||||
#define LAT_MIN 24
|
||||
#define LAT_SEC 0
|
||||
#define LAT_MIN 25
|
||||
#define LAT_SEC 30
|
||||
#define LON_DEG 75
|
||||
#define LON_MIN 39
|
||||
#define LON_SEC 0
|
||||
#define LON_MIN 41
|
||||
#define LON_SEC 59
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
45
src/funcs.c
45
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 FIsAny (func_info *);
|
||||
static int FArgs (func_info *);
|
||||
static int FAsc (func_info *);
|
||||
static int FBaseyr (func_info *);
|
||||
@@ -239,6 +240,7 @@ BuiltinFunc Func[] = {
|
||||
{ "hour", 1, 1, 1, FHour },
|
||||
{ "iif", 1, NO_MAX, 1, FIif },
|
||||
{ "index", 2, 3, 1, FIndex },
|
||||
{ "isany", 1, NO_MAX, 1, FIsAny },
|
||||
{ "isdst", 0, 2, 0, FIsdst },
|
||||
{ "isleap", 1, 1, 1, FIsleap },
|
||||
{ "isomitted", 1, 1, 0, FIsomitted },
|
||||
@@ -409,8 +411,9 @@ static int RetStrVal(char const *s, func_info *info)
|
||||
if (!s) {
|
||||
RetVal.v.str = malloc(1);
|
||||
if (RetVal.v.str) *RetVal.v.str = 0;
|
||||
} else
|
||||
} else {
|
||||
RetVal.v.str = StrDup(s);
|
||||
}
|
||||
|
||||
if (!RetVal.v.str) {
|
||||
RetVal.type = ERR_TYPE;
|
||||
@@ -1033,6 +1036,36 @@ static int FPlural(func_info *info)
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FIsAny */
|
||||
/* Return 1 if the first arg equals any subsequent arg, 0 */
|
||||
/* otherwise. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FIsAny(func_info *info)
|
||||
{
|
||||
int i;
|
||||
RetVal.type = INT_TYPE;
|
||||
RETVAL = 0;
|
||||
for (i=1; i<Nargs; i++) {
|
||||
if (ARG(0).type == ARG(i).type) {
|
||||
if (ARG(0).type == STR_TYPE) {
|
||||
if (!strcmp(ARGSTR(0), ARGSTR(i))) {
|
||||
RETVAL = 1;
|
||||
return OK;
|
||||
}
|
||||
} else {
|
||||
if (ARGV(0) == ARGV(i)) {
|
||||
RETVAL = 1;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FChoose */
|
||||
@@ -2113,12 +2146,8 @@ static int SunStuff(int rise, double cosz, int jul)
|
||||
} else mins = MinsFromUTC;
|
||||
|
||||
/* Get latitude and longitude */
|
||||
longdeg = (double) LongDeg + (double) LongMin / 60.0
|
||||
+ (double) LongSec / 3600.0;
|
||||
|
||||
latitude = DEGRAD * ((double) LatDeg + (double) LatMin / 60.0
|
||||
+ (double) LatSec / 3600.0);
|
||||
|
||||
longdeg = -Longitude;
|
||||
latitude = DEGRAD * Latitude;
|
||||
|
||||
FromJulian(jul, &year, &mon, &day);
|
||||
|
||||
@@ -2372,6 +2401,7 @@ static int FPsshade(func_info *info)
|
||||
if (!psshade_warned) {
|
||||
psshade_warned = 1;
|
||||
Eprint("psshade() is deprecated; use SPECIAL SHADE instead.");
|
||||
FreshLine = 1;
|
||||
}
|
||||
|
||||
sprintf(s, "/_A LineWidth 2 div def ");
|
||||
@@ -2427,6 +2457,7 @@ static int FPsmoon(func_info *info)
|
||||
if (!psmoon_warned) {
|
||||
psmoon_warned = 1;
|
||||
Eprint("psmoon() is deprecated; use SPECIAL MOON instead.");
|
||||
FreshLine = 1;
|
||||
}
|
||||
if (size > 0) {
|
||||
sprintf(sizebuf, "%d", size);
|
||||
|
||||
@@ -123,6 +123,9 @@ 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( char *Location, LOCATION);
|
||||
|
||||
/* UTC calculation stuff */
|
||||
|
||||
@@ -193,6 +193,9 @@ void InitRemind(int argc, char const *argv[])
|
||||
JulianToday = RealToday;
|
||||
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
|
||||
|
||||
/* Initialize Latitude and Longitude */
|
||||
set_lat_and_long_from_components();
|
||||
|
||||
/* See if we were invoked as "rem" rather than "remind" */
|
||||
if (argv[0]) {
|
||||
s = strrchr(argv[0], '/');
|
||||
@@ -646,6 +649,7 @@ void InitRemind(int argc, char const *argv[])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Figure out the offset from UTC */
|
||||
if (CalculateUTC)
|
||||
(void) CalcMinsFromUTC(JulianToday, SystemTime(0)/60,
|
||||
@@ -846,6 +850,7 @@ static void InitializeVar(char const *str)
|
||||
|
||||
if (*varname == '$') {
|
||||
r=SetSysVar(varname+1, &val);
|
||||
DestroyValue(val);
|
||||
if (r) fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[r]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,3 +164,5 @@ void PrintJSONKeyPairTime(char const *name, int t);
|
||||
void System(char const *cmd);
|
||||
int ShellEscape(char const *in, DynamicBuffer *out);
|
||||
int AddGlobalOmit(int jul);
|
||||
void set_lat_and_long_from_components(void);
|
||||
void set_components_from_lat_and_long(void);
|
||||
|
||||
31
src/queue.c
31
src/queue.c
@@ -57,7 +57,7 @@ static void CheckInitialFile (void);
|
||||
static int CalculateNextTime (QueuedRem *q);
|
||||
static QueuedRem *FindNextReminder (void);
|
||||
static int CalculateNextTimeUsingSched (QueuedRem *q);
|
||||
static void DaemonWait (unsigned int sleeptime);
|
||||
static void DaemonWait (struct timeval *sleep_tv);
|
||||
static void reread (void);
|
||||
|
||||
/***************************************************************/
|
||||
@@ -121,6 +121,8 @@ void HandleQueuedReminders(void)
|
||||
unsigned SleepTime;
|
||||
Parser p;
|
||||
Trigger trig;
|
||||
struct timeval tv;
|
||||
struct timeval sleep_tv;
|
||||
|
||||
/* Suppress the BANNER from being issued */
|
||||
NumTriggered = 1;
|
||||
@@ -186,16 +188,20 @@ void HandleQueuedReminders(void)
|
||||
|
||||
/* Wake up once a minute to recalibrate sleep time in
|
||||
case of laptop hibernation */
|
||||
if (Daemon <= 0) {
|
||||
if (Daemon < 0) {
|
||||
/* Wake up on the next exact minute */
|
||||
SleepTime = 60 - (SystemTime(1)%60);
|
||||
}
|
||||
|
||||
if (Daemon >= 0) {
|
||||
sleep(SleepTime);
|
||||
gettimeofday(&tv, NULL);
|
||||
sleep_tv.tv_sec = 60 - (tv.tv_sec % 60);
|
||||
if (tv.tv_usec != 0 && sleep_tv.tv_sec != 0) {
|
||||
sleep_tv.tv_sec--;
|
||||
sleep_tv.tv_usec = 1000000 - tv.tv_usec;
|
||||
} else {
|
||||
sleep_tv.tv_usec = 0;
|
||||
}
|
||||
DaemonWait(&sleep_tv);
|
||||
} else {
|
||||
DaemonWait(SleepTime);
|
||||
}
|
||||
sleep(SleepTime);
|
||||
}
|
||||
|
||||
/* If not in daemon mode and day has rolled around,
|
||||
exit -- not much we can do. */
|
||||
@@ -519,19 +525,16 @@ json_queue(QueuedRem const *q)
|
||||
/* Sleep or read command from stdin in "daemon -1" mode */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void DaemonWait(unsigned int sleeptime)
|
||||
static void DaemonWait(struct timeval *sleep_tv)
|
||||
{
|
||||
fd_set readSet;
|
||||
struct timeval timeout;
|
||||
int retval;
|
||||
int y, m, d;
|
||||
char cmdLine[256];
|
||||
|
||||
FD_ZERO(&readSet);
|
||||
FD_SET(0, &readSet);
|
||||
timeout.tv_sec = sleeptime;
|
||||
timeout.tv_usec = 0;
|
||||
retval = select(1, &readSet, NULL, NULL, &timeout);
|
||||
retval = select(1, &readSet, NULL, NULL, sleep_tv);
|
||||
|
||||
/* If date has rolled around, restart */
|
||||
if (RealToday != SystemDate(&y, &m, &d)) {
|
||||
|
||||
178
src/var.c
178
src/var.c
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include "types.h"
|
||||
#include "expr.h"
|
||||
#include "globals.h"
|
||||
@@ -39,6 +40,99 @@ static Var *VHashTbl[VAR_HASH_SIZE];
|
||||
|
||||
typedef int (*SysVarFunc)(int, Value *);
|
||||
|
||||
static void deprecated_var(char const *var, char const *instead)
|
||||
{
|
||||
if (DebugFlag & DB_PRTLINE) {
|
||||
Eprint("%s is deprecated; use %s instead", var, instead);
|
||||
FreshLine = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int latlong_component_func(int do_set, Value *val, int *var, int min, int max, char const *varname, char const *newvarname)
|
||||
{
|
||||
if (!do_set) {
|
||||
val->type = INT_TYPE;
|
||||
val->v.val = *var;
|
||||
return OK;
|
||||
}
|
||||
deprecated_var(varname, newvarname);
|
||||
if (val->type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (val->v.val < min) return E_2LOW;
|
||||
if (val->v.val > max) return E_2HIGH;
|
||||
*var = val->v.val;
|
||||
set_lat_and_long_from_components();
|
||||
return OK;
|
||||
}
|
||||
static int latdeg_func(int do_set, Value *val)
|
||||
{
|
||||
return latlong_component_func(do_set, val, &LatDeg, -90, 90, "$LatDeg", "$Latitude");
|
||||
}
|
||||
|
||||
static int latmin_func(int do_set, Value *val)
|
||||
{
|
||||
return latlong_component_func(do_set, val, &LatMin, -59, 59, "$LatMin", "$Latitude");
|
||||
}
|
||||
|
||||
static int latsec_func(int do_set, Value *val)
|
||||
{
|
||||
return latlong_component_func(do_set, val, &LatSec, -59, 59, "$LatSec", "$Latitude");
|
||||
}
|
||||
|
||||
static int longdeg_func(int do_set, Value *val)
|
||||
{
|
||||
return latlong_component_func(do_set, val, &LongDeg, -180, 180, "$LongDeg", "$Longitude");
|
||||
}
|
||||
|
||||
static int longmin_func(int do_set, Value *val)
|
||||
{
|
||||
return latlong_component_func(do_set, val, &LongMin, -59, 59, "$LongMin", "$Longitude");
|
||||
}
|
||||
|
||||
static int longsec_func(int do_set, Value *val)
|
||||
{
|
||||
return latlong_component_func(do_set, val, &LongSec, -59, 59, "$LongSec", "$Longitude");
|
||||
}
|
||||
|
||||
static int latitude_longitude_func(int do_set, Value *val, double *var, double min, double max) {
|
||||
char buf[64];
|
||||
double x;
|
||||
char *endptr;
|
||||
|
||||
if (!do_set) {
|
||||
snprintf(buf, sizeof(buf), "%f", *var);
|
||||
val->v.str = malloc(strlen(buf)+1);
|
||||
if (!val->v.str) return E_NO_MEM;
|
||||
strcpy(val->v.str, buf);
|
||||
val->type = STR_TYPE;
|
||||
return OK;
|
||||
}
|
||||
if (val->type == INT_TYPE) {
|
||||
x = (double) val->v.val;
|
||||
} else {
|
||||
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||
errno = 0;
|
||||
x = strtod(val->v.str, &endptr);
|
||||
if (errno) return E_BAD_TYPE;
|
||||
if (*endptr) return E_BAD_TYPE;
|
||||
}
|
||||
if (x < min) return E_2LOW;
|
||||
if (x > max) return E_2HIGH;
|
||||
*var = x;
|
||||
set_components_from_lat_and_long();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int longitude_func(int do_set, Value *val)
|
||||
{
|
||||
return latitude_longitude_func(do_set, val, &Longitude, -180.0, 180.0);
|
||||
}
|
||||
|
||||
static int latitude_func(int do_set, Value *val)
|
||||
{
|
||||
return latitude_longitude_func(do_set, val, &Latitude, -90.0, 90.0);
|
||||
}
|
||||
|
||||
|
||||
static int trig_date_func(int do_set, Value *val)
|
||||
{
|
||||
UNUSED(do_set);
|
||||
@@ -177,15 +271,15 @@ static int default_color_func(int do_set, Value *val)
|
||||
int col_r, col_g, col_b;
|
||||
if (!do_set) {
|
||||
/* 12 = strlen("255 255 255\0") */
|
||||
val->v.str = malloc(12);
|
||||
if (!val->v.str) return E_NO_MEM;
|
||||
snprintf(val->v.str, 12, "%d %d %d",
|
||||
DefaultColorR,
|
||||
DefaultColorG,
|
||||
DefaultColorB
|
||||
);
|
||||
val->type = STR_TYPE;
|
||||
return OK;
|
||||
val->v.str = malloc(12);
|
||||
if (!val->v.str) return E_NO_MEM;
|
||||
snprintf(val->v.str, 12, "%d %d %d",
|
||||
DefaultColorR,
|
||||
DefaultColorG,
|
||||
DefaultColorB
|
||||
);
|
||||
val->type = STR_TYPE;
|
||||
return OK;
|
||||
}
|
||||
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (sscanf(val->v.str, "%d %d %d", &col_r, &col_g, &col_b) != 3) {
|
||||
@@ -667,13 +761,15 @@ static SysVar SysVarArr[] = {
|
||||
{"InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0 },
|
||||
{"IntMax", 0, INT_TYPE, &IntMax, 0, 0 },
|
||||
{"IntMin", 0, INT_TYPE, &IntMin, 0, 0 },
|
||||
{"LatDeg", 1, INT_TYPE, &LatDeg, -90, 90 },
|
||||
{"LatMin", 1, INT_TYPE, &LatMin, -59, 59 },
|
||||
{"LatSec", 1, INT_TYPE, &LatSec, -59, 59 },
|
||||
{"LatDeg", 1, SPECIAL_TYPE, latdeg_func, 0, 0 },
|
||||
{"Latitude", 1, SPECIAL_TYPE, latitude_func, 0, 0 },
|
||||
{"LatMin", 1, SPECIAL_TYPE, latmin_func, 0, 0 },
|
||||
{"LatSec", 1, SPECIAL_TYPE, latsec_func, 0, 0 },
|
||||
{"Location", 1, STR_TYPE, &Location, 0, 0 },
|
||||
{"LongDeg", 1, INT_TYPE, &LongDeg, -180, 180 },
|
||||
{"LongMin", 1, INT_TYPE, &LongMin, -59, 59 },
|
||||
{"LongSec", 1, INT_TYPE, &LongSec, -59, 59 },
|
||||
{"LongDeg", 1, SPECIAL_TYPE, longdeg_func, 0, 0 },
|
||||
{"Longitude", 1, SPECIAL_TYPE, longitude_func, 0, 0 },
|
||||
{"LongMin", 1, SPECIAL_TYPE, longmin_func, 0, 0 },
|
||||
{"LongSec", 1, SPECIAL_TYPE, longsec_func, 0, 0 },
|
||||
{"MaxSatIter", 1, INT_TYPE, &MaxSatIter, 10, ANY },
|
||||
{"MaxStringLen", 1, INT_TYPE, &MaxStringLen, -1, ANY },
|
||||
{"MinsFromUTC", 1, INT_TYPE, &MinsFromUTC, -780, 780 },
|
||||
@@ -714,6 +810,7 @@ static void DumpSysVar (char const *name, const SysVar *v);
|
||||
/***************************************************************/
|
||||
int SetSysVar(char const *name, Value *value)
|
||||
{
|
||||
int r;
|
||||
SysVar *v = FindSysVar(name);
|
||||
if (!v) return E_NOSUCH_VAR;
|
||||
if (v->type != SPECIAL_TYPE &&
|
||||
@@ -725,7 +822,9 @@ int SetSysVar(char const *name, Value *value)
|
||||
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
return f(1, value);
|
||||
r = f(1, value);
|
||||
DestroyValue(*value);
|
||||
return r;
|
||||
} else if (v->type == STR_TYPE) {
|
||||
/* If it's a string variable, special measures must be taken */
|
||||
if (v->been_malloced) free(*((char **)(v->value)));
|
||||
@@ -767,7 +866,7 @@ int GetSysVar(char const *name, Value *val)
|
||||
/* In "verbose" mode, print attempts to test $RunOff */
|
||||
if (DebugFlag & DB_PRTLINE) {
|
||||
if (v->value == (void *) &RunDisabled) {
|
||||
Eprint("(Security note: $RunOff variable tested.)\n");
|
||||
Eprint("(Security note: $RunOff variable tested.)");
|
||||
/* Allow further messages from this line */
|
||||
FreshLine = 1;
|
||||
}
|
||||
@@ -885,3 +984,48 @@ static void DumpSysVar(char const *name, const SysVar *v)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
set_lat_and_long_from_components(void)
|
||||
{
|
||||
Latitude = (double) LatDeg + ((double) LatMin) / 60.0 + ((double) LatSec) / 3600.0;
|
||||
Longitude = - ( (double) LongDeg + ((double) LongMin) / 60.0 + ((double) LongSec) / 3600.0);
|
||||
}
|
||||
|
||||
void
|
||||
set_components_from_lat_and_long(void)
|
||||
{
|
||||
double x;
|
||||
|
||||
x = (Latitude < 0.0 ? -Latitude : Latitude);
|
||||
LatDeg = (int) x;
|
||||
x -= (double) LatDeg;
|
||||
x *= 60;
|
||||
LatMin = (int) x;
|
||||
x -= (double) LatMin;
|
||||
x *= 60;
|
||||
LatSec = (int) x;
|
||||
if (Latitude < 0.0) {
|
||||
LatDeg = -LatDeg;
|
||||
LatMin = -LatMin;
|
||||
LatSec = -LatSec;
|
||||
}
|
||||
|
||||
x = (Longitude < 0.0 ? -Longitude : Longitude);
|
||||
LongDeg = (int) x;
|
||||
x -= (double) LongDeg;
|
||||
x *= 60;
|
||||
LongMin = (int) x;
|
||||
x -= (double) LongMin;
|
||||
x *= 60;
|
||||
LongSec = (int) x;
|
||||
|
||||
/* Use STANDARD sign for $Longitude even if $LongDeg, $LongMin and
|
||||
* $LongSec are messed up */
|
||||
if (Longitude > 0.0) {
|
||||
LongDeg = -LongDeg;
|
||||
LongMin = -LongMin;
|
||||
LongSec = -LongSec;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
983
tests/test.cmp
983
tests/test.cmp
File diff suppressed because it is too large
Load Diff
@@ -233,6 +233,29 @@ REM Mon 15 Feb ADDOMIT MSG Family Day
|
||||
REM Feb 18 AFTER MSG Should trigger on Feb 19
|
||||
OMIT DUMP
|
||||
|
||||
set $CalcUTC 0
|
||||
set $DateTimeSep "@"
|
||||
set $DefaultColor "-1 -1 -1"
|
||||
set $DefaultPrio 5000
|
||||
set $EndSent ".?!"
|
||||
set $EndSentIg "" + char(34) + "')]}>"
|
||||
set $FirstIndent 0
|
||||
set $FoldYear 0
|
||||
set $FormWidth 72
|
||||
set $Location "Ottawa"
|
||||
set $MaxSatIter 150
|
||||
set $MaxStringLen 65535
|
||||
set $MinsFromUTC -300
|
||||
set $SubsIndent 0
|
||||
set $TimeSep ":"
|
||||
|
||||
set $LatDeg 30
|
||||
set $LatMin 30
|
||||
set $LatSec 0
|
||||
set $LongDeg -25
|
||||
set $LongMin 15
|
||||
set $LongSec 0
|
||||
|
||||
set a000 abs(1)
|
||||
set a001 abs(-1)
|
||||
set a002 asc("foo")
|
||||
@@ -423,6 +446,7 @@ REM MAYBE-UNCOMPUTABLE Mon OMIT Mon SKIP MSG Never ever ever...
|
||||
REM MAYBE-UNCOMPUTABLE Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
|
||||
|
||||
dump
|
||||
dump $
|
||||
dump $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
OMIT 2010-09-03 THROUGH 2010-09-15
|
||||
OMIT December 25 MSG X
|
||||
@@ -593,11 +617,26 @@ set a $IntMin * (-1)
|
||||
set a (-1) * $IntMin
|
||||
set a abs($IntMin)
|
||||
|
||||
# The "isany" function
|
||||
set a isany(1)
|
||||
set a isany("foo")
|
||||
set a isany(1:00)
|
||||
set a isany(1, 2)
|
||||
set a isany("foo", 2)
|
||||
set a isany(1:00, 2)
|
||||
set a isany(1, 2, 1, 3)
|
||||
set a isany("foo", 2, 3, "foo")
|
||||
set a isany(1:00, 2, "foo", 2:00, 1:00, 9:00)
|
||||
|
||||
# Shellescape
|
||||
set a shellescape(" !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")
|
||||
|
||||
msg [a]
|
||||
|
||||
# Deprecated functions
|
||||
set x psshade(50)
|
||||
set x psmoon(0)
|
||||
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
table.rem-cal {
|
||||
font-family: helvetica, arial, sans-serif;
|
||||
font-size: 12pt;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.rem-sc-table {
|
||||
@@ -37,11 +39,6 @@ td.rem-today {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.rem-cal {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
div.rem-daynumber {
|
||||
float: right;
|
||||
text-align: right;
|
||||
|
||||
Reference in New Issue
Block a user