mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93aea240d6 | ||
|
|
7717b37c36 | ||
|
|
e1b2990fb0 | ||
|
|
e49194c6ee | ||
|
|
79ab150546 | ||
|
|
fc658d15d4 | ||
|
|
76d130ef82 | ||
|
|
3e9a55fbdb | ||
|
|
b071397d46 | ||
|
|
df0dd55635 | ||
|
|
960d08fd24 | ||
|
|
38603916a2 | ||
|
|
0ed1bb4017 | ||
|
|
b4ac0c9f6c | ||
|
|
b136af88ad | ||
|
|
508b5f9aae | ||
|
|
43dff67a60 | ||
|
|
41b850321f | ||
|
|
523237007b | ||
|
|
a3f6c5fd9c | ||
|
|
785cdc8726 | ||
|
|
cbf12b5601 | ||
|
|
1a6d59d9c0 | ||
|
|
23ae054abb | ||
|
|
b57852d3d8 | ||
|
|
c0e1be2f3a | ||
|
|
a442a15a8d | ||
|
|
f91bf634ad | ||
|
|
ce4311c3df | ||
|
|
08e69cb541 | ||
|
|
f8e2eaed73 | ||
|
|
e68a16e73d | ||
|
|
ca191fbd92 | ||
|
|
10276826c0 | ||
|
|
02c9129903 | ||
|
|
04e4c902bd | ||
|
|
0663ae77de | ||
|
|
0c0f5ea093 | ||
|
|
f450fd633e | ||
|
|
59cdd35f61 | ||
|
|
eab67cbda4 | ||
|
|
b3c4a48641 | ||
|
|
07ac8ed341 | ||
|
|
e32aa218fc | ||
|
|
09d11d36c3 | ||
|
|
629e287526 | ||
|
|
e2cd29c824 | ||
|
|
69e597dbe7 | ||
|
|
152e7ebac9 | ||
|
|
8d4451ed85 | ||
|
|
5b8836d4b8 | ||
|
|
be7086579e | ||
|
|
ab16c8f1fe | ||
|
|
6bb71ee5e3 | ||
|
|
ebb4ebea97 | ||
|
|
bf97e62d56 | ||
|
|
47645cddb6 | ||
|
|
cf2af56a05 | ||
|
|
50d1ae42c9 | ||
|
|
9501498a7e | ||
|
|
614ab08099 | ||
|
|
64ee338433 | ||
|
|
43556238d0 | ||
|
|
58d7ac0520 | ||
|
|
0754678ce7 | ||
|
|
2bea176816 | ||
|
|
fa90333219 | ||
|
|
e007b3bc0f | ||
|
|
978e83567b | ||
|
|
d01c1190cd |
@@ -1,54 +0,0 @@
|
||||
$Id: ACKNOWLEDGEMENTS,v 1.2 2000-02-18 03:45:11 dfs Exp $
|
||||
|
||||
I would like to thank the following people:
|
||||
|
||||
Bill Aten <netagw!bill@uunet.UU.NET> for providing remind-all.sh
|
||||
|
||||
Bradley D. Keister <keister@poincare.phys.cmu.edu>, Rhys Weatherly
|
||||
rhys@batserver.cs.uq.OZ.AU> and Anthony Cheng for initially providing
|
||||
the Turbo C compiler support.
|
||||
|
||||
Dennis Cottel <dennis@peanuts.nosc.mil> for providing the patch to
|
||||
produce calendars by weeks as well as by months.
|
||||
|
||||
Bill Silvert <bill%biomel@cs.dal.ca> and Dennis Cottel
|
||||
<dennis@peanuts.nosc.mil> for suggesting many of the new features in
|
||||
REMIND.
|
||||
|
||||
Dave Wolfe <dwolfe@pffft.sps.mot.com> and Raphael Manfredi
|
||||
<ram@eiffel.com> for noticing bugs and sending me fixes.
|
||||
|
||||
Dave Rickel and George M. Sipe for sample reminders and holidays.
|
||||
|
||||
Michael Salmon for ISO encoding of PostScript output.
|
||||
|
||||
Darrel Hankerson for helping me provide some OS/2 support. Sorry
|
||||
it's not complete, Darrel!
|
||||
|
||||
Phillipp Slusallek for suggesting the -k option.
|
||||
|
||||
Amos Shapir, David W. Tamkin and Frank Yellin for help with the Hebrew
|
||||
calendar.
|
||||
|
||||
All of the language translators whose names are listed in lang.h
|
||||
|
||||
Mark Harrison and Michael McLennan for the excellent book
|
||||
"Effective Tcl/Tk Programming". This is where I stole the source
|
||||
for Tcl/Tk tabbed notebooks, and is an excellent reference book.
|
||||
Thanks also to Lucent Technologies and Addison Wesley Longman for
|
||||
making it legal to steal the code.
|
||||
|
||||
All others who have corresponded with me to report bugs, express
|
||||
appreciation or suggest features - too many people to list here.
|
||||
|
||||
Finally, all those who donated money to support the production of
|
||||
REMIND. Your donations were gratefully appreciated.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@roaringpenguin.com> <aa775@freenet.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
$Id: COPYRIGHT,v 1.16 2005-04-12 01:27:52 dfs Exp $
|
||||
THE REMIND COPYRIGHT
|
||||
|
||||
1. REMIND refers to the entire set of files and documentation in the
|
||||
|
||||
5
Makefile
5
Makefile
@@ -1,7 +1,5 @@
|
||||
# Top-level Makefile for Remind.
|
||||
|
||||
# $Id: Makefile,v 1.28 1998-05-06 01:51:12 dfs Exp $
|
||||
|
||||
all: src/Makefile
|
||||
@echo ""
|
||||
@echo "*******************"
|
||||
@@ -27,7 +25,8 @@ clean:
|
||||
cd src; $(MAKE) clean
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status src/Makefile src/config.h
|
||||
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out
|
||||
|
||||
src/Makefile: src/Makefile.in
|
||||
./configure
|
||||
# DO NOT DELETE
|
||||
|
||||
4
README
4
README
@@ -34,7 +34,5 @@ If you do NOT have Tcl/Tk or are NOT running X Windows:
|
||||
|
||||
5) Type: "make install" -- you may need to be root to do this.
|
||||
|
||||
$Id: README,v 1.7 2000-06-26 14:43:25 dfs Exp $
|
||||
|
||||
Contact info: mailto:dfs@roaringpenguin.com
|
||||
Home page: http://www.roaringpenguin.com/remind.html
|
||||
Home page: http://www.roaringpenguin.com/remind
|
||||
|
||||
2
WINDOWS
2
WINDOWS
@@ -1,5 +1,3 @@
|
||||
$Id: WINDOWS,v 1.1 1999-04-05 17:34:28 dfs Exp $
|
||||
|
||||
MICROSOFT WINDOWS
|
||||
|
||||
I used to prohibit porting Remind to Microsoft Windows. However, this
|
||||
|
||||
4
build.tk
4
build.tk
@@ -12,8 +12,6 @@
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
|
||||
# $Id: build.tk,v 1.13 2005-04-14 17:33:26 dfs Exp $
|
||||
|
||||
# the next line restarts using wish \
|
||||
exec wish "$0" "$@"
|
||||
|
||||
@@ -34,7 +32,7 @@ proc SetConfigDefaults {} {
|
||||
set Config(LON_MIN) 39
|
||||
set Config(LOCATION) "Ottawa"
|
||||
set Config(DEFAULT_PAGE) "Letter"
|
||||
set Config(DATESEP) "/"
|
||||
set Config(DATESEP) "-"
|
||||
set Config(TIMESEP) ":"
|
||||
set Config(ISOLATIN1) 0
|
||||
set Config(IBMEXTENDED) 0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl $Id: configure.in,v 1.9 2005-09-30 03:33:52 dfs Exp $
|
||||
|
||||
AC_INIT(src/queue.c)
|
||||
|
||||
@@ -26,6 +25,11 @@ 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)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_CHECK_HEADERS(sys/file.h)
|
||||
|
||||
@@ -40,4 +44,5 @@ if test "$GCC" = yes; then
|
||||
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(setenv unsetenv)
|
||||
AC_OUTPUT(src/Makefile)
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
$Id: README.AMIGA,v 1.5 2005-09-30 03:36:19 dfs Exp $
|
||||
|
||||
Remind no longer works on AmigaDOS.
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
$Id: README.BCC,v 1.5 2005-09-30 03:36:19 dfs Exp $
|
||||
|
||||
Remind no longer works with Borland C Compiler.
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
$Id: README.DOS,v 1.5 2005-09-30 03:36:19 dfs Exp $
|
||||
|
||||
Remind no longer works on MS-DOS.
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
$Id: README.OS2,v 1.6 2005-09-30 03:36:20 dfs Exp $
|
||||
|
||||
Remind no longer works on OS/2.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
$Id: README.UNIX,v 1.5 2000-02-18 03:45:33 dfs Exp $
|
||||
REMIND version 3.0 for UNIX
|
||||
REMIND version 3.1 for UNIX
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
@@ -126,9 +125,4 @@ exit
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@roaringpenguin.com>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
http://www.roaringpenguin.com/remind.html
|
||||
http://www.roaringpenguin.com/remind/
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
$Id: README_QDOS,v 1.6 2005-09-30 03:36:20 dfs Exp $
|
||||
|
||||
Remind no longer works on QDOS.
|
||||
|
||||
@@ -1,5 +1,68 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* Version 3.1 Patch 0 - 14 August 2007
|
||||
|
||||
+ MAJOR ENHANCEMENTS
|
||||
|
||||
- Added the FROM clause. This lets you write reminders like:
|
||||
|
||||
REM Mon FROM 16 July 2007 UNTIL 13 Aug 2007 MSG Some Mondays...
|
||||
|
||||
- Remind now has a new datatype: A DATETIME object represents a date AND
|
||||
a time (to the nearest minute). DATETIME constants are written
|
||||
as '2007-09-01@14:33'. Various operators and functions have been
|
||||
modified to do sensible things with DATETIMEs and several new DATETIME
|
||||
functions have been added.
|
||||
|
||||
- The SPECIAL COLOR reminder type has been hacked to behave more like
|
||||
a MSG type. It sorts properly and is emitted as a normal reminder
|
||||
in non-calendar mode. Simlarly, SPECIAL HTML sorts with -g as well.
|
||||
|
||||
+ MINOR ENHANCEMENTS
|
||||
|
||||
- TkRemind can e-mail you reminders if you don't dismiss the popup window
|
||||
after one minute. This is useful if you need to leave your workstation
|
||||
but want reminders to "follow" you via e-mail.
|
||||
|
||||
- A new "-y" option to Remind generates tags for all reminders that lack
|
||||
a TAG clause. This may be useful for conversion tools that want each
|
||||
reminder to have a unique identifier.
|
||||
|
||||
- A new "tzconvert" function lets you convert datetimes between different
|
||||
time zones. It's only as good as your C library, so test thoroughly
|
||||
please! Based on a patch from Stefan Wehr.
|
||||
|
||||
- TkRemind sorts reminders by invoking Remind with the '-g' option.
|
||||
|
||||
- The time and date separator characters can be changed at runtime by
|
||||
setting $TimeSep and $DateSep respectively.
|
||||
|
||||
- The simple calendar ('-s') option can be immediately followed by an 'a'.
|
||||
This causes Remind to output reminders with deltas before the actual
|
||||
trigger date. Based loosely on an idea from Frank Terbeck.
|
||||
|
||||
+ MINOR CHANGES
|
||||
|
||||
- Default date separator is now '-' instead of '/'
|
||||
|
||||
- trigdate() and trigtime() behave differently - they return the integer 0
|
||||
if the last reminder could not be computed or did not have an AT clause
|
||||
(respectively).
|
||||
|
||||
- Maximum length of variable names has been increased from 12 to 16 characters.
|
||||
|
||||
+ BUG FIXES
|
||||
|
||||
- Fixed a potential memory leak in queue.c
|
||||
|
||||
- Fixed compile error on Mac OS X.
|
||||
|
||||
- Fixed behaviour of "-sa" option so deltas correctly obey omitted days
|
||||
and the scheduling function (if one is used).
|
||||
|
||||
- rem2ps would produce invalid PostScript in some rare cases
|
||||
(eg, for February 2007). This has been fixed.
|
||||
|
||||
* Version 3.0 Patch 24
|
||||
|
||||
+ MINOR ENHANCEMENTS
|
||||
@@ -22,10 +22,6 @@
|
||||
# #
|
||||
#############################################################################
|
||||
|
||||
#
|
||||
# $Id: defs.rem,v 1.5 2001-05-07 14:06:17 dfs Exp $
|
||||
#
|
||||
|
||||
RUN OFF
|
||||
|
||||
################################################
|
||||
@@ -472,8 +468,9 @@ SET Reform 0
|
||||
FSET _h(x, y) TRIGGER(HEBDATE(x,y))
|
||||
FSET _h2(x, y) HEBDATE(x, y, TODAY()-7)
|
||||
FSET _PastSat(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1))
|
||||
FSET _BackTwoFri(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=5, _h2(x,y), _h2(x,y)-2))
|
||||
FSET _BackTwoSat(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)-2))
|
||||
FSET _PastSun(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=0, _h2(x,y), _h2(x,y)+1))
|
||||
FSET _PastMon(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=1, _h2(x,y), _h2(x,y)+1))
|
||||
|
||||
# Default values in case InIsrael and Reform are not set
|
||||
SET InIsrael VALUE("InIsrael", 0)
|
||||
SET Reform VALUE("Reform", 0)
|
||||
@@ -542,9 +539,24 @@ IF !InIsrael && !Reform
|
||||
[_h(22, "Nisan")] MSG %"Pesach 8%"
|
||||
ENDIF
|
||||
|
||||
[_h(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
|
||||
[_BackTwoFri(4, "Iyar")] ++4 MSG %"Yom HaZikaron%" is %b.
|
||||
[_BackTwoSat(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||
[_PastSun(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
|
||||
|
||||
# If 4 Iyar is a Friday, then Yom Hazikaron is
|
||||
# the Wednesday before and Yom Ha'atzmaut is on
|
||||
# Thursday. If 4 Iyar is a Sunday, then Yom Hazikaron
|
||||
# moves to 5 Iyar and Yom Ha'atzmaut to 6 Iyar.
|
||||
IF WKDAYNUM(_h2(4, "Iyar")) == 5
|
||||
[_h(2, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
|
||||
[_h(3, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||
ELSE
|
||||
IF WKDAYNUM(_h2, 4, "Iyar") == 0
|
||||
[_h(5, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
|
||||
[_h(6, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||
ELSE
|
||||
[_h(4, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
|
||||
[_h(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
# Not sure about Reform's position on Lag B'Omer
|
||||
IF !Reform
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
.\" $Id: cm2rem.1,v 1.2 2000-03-15 15:51:36 dfs Exp $
|
||||
.TH CM2REM 1 "18 October 1999"
|
||||
.UC4
|
||||
.SH NAME
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
.\" $Id: kall.1,v 1.2 1998-02-16 02:35:09 dfs Exp $
|
||||
.TH KALL 1 "15 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
.\" $Id: rem.1,v 1.2 1998-02-16 02:35:09 dfs Exp $
|
||||
.TH REM 1 "15 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
.\" $Id: rem2ps.1,v 1.6 2005-04-12 00:57:48 dfs Exp $
|
||||
.TH REM2PS 1 "11 April 2005"
|
||||
.UC4
|
||||
.SH NAME
|
||||
@@ -78,10 +77,10 @@ Letter
|
||||
8.5 x 11 in.
|
||||
.TP
|
||||
Legal
|
||||
11 x 17 in.
|
||||
8.5 x 14 in.
|
||||
.TP
|
||||
Ledger
|
||||
8.5 x 14 in.
|
||||
11 x 17 in.
|
||||
.TP
|
||||
Statement
|
||||
5.5 x 8.5 in.
|
||||
|
||||
491
man/remind.1
491
man/remind.1
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
.\" $Id: tkremind.1,v 1.11 2005-04-12 13:41:27 dfs Exp $ "
|
||||
.TH TKREMIND 1 "15 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
@@ -211,6 +210,18 @@ background reminder pops up.
|
||||
If selected, feeds the text of the reminder to the command described
|
||||
above.
|
||||
|
||||
.TP
|
||||
.B E-mail reminders here if popup not dismissed
|
||||
If you enter a non-blank e-mail address in this field, then \fBTkRemind\fR
|
||||
will e-mail you a reminder if you don't dismiss the popup box within
|
||||
one minute. This is useful if you need to leave your terminal but
|
||||
want your reminders to "follow" you via e-mail.
|
||||
|
||||
.TP
|
||||
.B Name or IP address of SMTP server
|
||||
\fBTkRemind\fR uses a direct SMTP connection to send mail. Enter the
|
||||
IP address of your SMTP server here.
|
||||
|
||||
.TP
|
||||
.B Text Editor
|
||||
This specifies a text editor to invoke when a reminder is right-clicked.
|
||||
|
||||
@@ -5,6 +5,3 @@ rem -- Starts Remind with a default file of $HOME/.reminders
|
||||
remind-all.csh -- Mails reminders to all users (C-Shell version)
|
||||
remind-all.sh -- Mails reminders to all users (Bourne Shell version)
|
||||
tkremind* -- Tcl/Tk graphical calendar using Remind as engine
|
||||
|
||||
$Id: README,v 1.1 1998-01-15 02:50:20 dfs Exp $
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
|
||||
# $Id: cm2rem.tcl,v 1.3 2000-02-18 03:45:38 dfs Exp $
|
||||
|
||||
# the next line restarts using tclsh \
|
||||
exec tclsh "$0" "$@"
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Id: kall,v 1.1 1998-01-15 02:50:20 dfs Exp $
|
||||
#
|
||||
# kall - kill all processes belonging to this user that match
|
||||
# specified string.
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#
|
||||
# rem - by David Skoll - 26 February 1991
|
||||
#
|
||||
# $Id: rem,v 1.1 1998-01-15 02:50:21 dfs Exp $
|
||||
#
|
||||
# This script runs 'remind' with a default reminder file assumed. You
|
||||
# can override the default by using "rem -F newfile ..." (But why would
|
||||
# you use rem unless you wanted to accept the default??)
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
# Shell script to mail all users reminders.
|
||||
|
||||
# $Id: remind-all.csh,v 1.1 1998-01-15 02:50:21 dfs Exp $
|
||||
|
||||
# Run it AFTER MIDNIGHT so that date is correct!
|
||||
# On our system, we have the following in our crontab:
|
||||
# 05 5 * * * /usr/share/lib/remind/remind-all > /dev/null 2>&1
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
|
||||
# This file is part of REMIND
|
||||
#
|
||||
# $Id: remind-all.sh,v 1.4 2000-02-18 03:45:39 dfs Exp $
|
||||
#
|
||||
# REMIND is Copyright (C) 1992-1998 by David F. Skoll
|
||||
# Copyright (C) 1999-2000 Roaring Penguin Software Inc.
|
||||
# REMIND is Copyright (C) 1992-1998 by David F. Skoll
|
||||
# Copyright (C) 1999-2007 Roaring Penguin Software Inc.
|
||||
# This file is Copyright (C) 1990 by Bill Aten
|
||||
|
||||
# Thanks to Bill Aten for this script.
|
||||
|
||||
145
scripts/tkremind
145
scripts/tkremind
@@ -12,13 +12,25 @@
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
|
||||
# $Id: tkremind,v 1.40 2005-04-14 17:34:34 dfs Exp $
|
||||
|
||||
# the next line restarts using wish \
|
||||
exec wish "$0" "$@"
|
||||
|
||||
wm withdraw .
|
||||
|
||||
proc missing_tcllib { pkg } {
|
||||
catch { puts stderr "Could not find the '$pkg' package -- you must install tcllib.\nPlease see http://tcllib.sourceforge.net/" }
|
||||
tk_dialog .err "Error: tcllib not installed" "Could not find the '$pkg' package -- you must install tcllib. Please see http://tcllib.sourceforge.net/" error 0 OK
|
||||
exit 1
|
||||
}
|
||||
if {[catch {package require mime}]} {
|
||||
missing_tcllib mime
|
||||
}
|
||||
|
||||
if {[catch {package require smtp}]} {
|
||||
missing_tcllib smtp
|
||||
}
|
||||
|
||||
|
||||
# Check that we have the right version of wish
|
||||
if {$tcl_version < 8.0} {
|
||||
tk_dialog .error Error "You need wish version 8.0 or higher to run TkRemind; you have $tcl_version" error 0 OK
|
||||
@@ -58,6 +70,12 @@ set OptDescr(FeedReminder) "(0/1) If 1, feed the reminder to RunCmd on standard
|
||||
set Option(Editor) "emacs +%d %s"
|
||||
set OptDescr(Editor) "(String) Specify command to edit a file. %d is replaced with line number and %s with filename"
|
||||
|
||||
set Option(MailAddr) ""
|
||||
set OptDescr(MailAddr) "(String) Specify an e-mail address to which reminders should be sent if the popup window is not manually dismissed"
|
||||
|
||||
set Option(SMTPServer) "127.0.0.1"
|
||||
set OptDescr(SMTPServer) "(String) IP address or host name of SMTP server to use for sending e-mail"
|
||||
|
||||
# Remind program to execute -- supply full path if you want
|
||||
set Remind "remind"
|
||||
#set Remind "/home/dfs/Remind/src/remind"
|
||||
@@ -137,7 +155,7 @@ proc Initialize {} {
|
||||
global DayNames argc argv CommandLine ReminderFile AppendFile Remind PSCmd
|
||||
global MondayFirst
|
||||
|
||||
set CommandLine "|$Remind -itkremind=1 -p -l"
|
||||
set CommandLine "|$Remind -itkremind=1 -p -y -l"
|
||||
set PSCmd "$Remind -p -l"
|
||||
set i 0
|
||||
while {$i < $argc} {
|
||||
@@ -271,7 +289,7 @@ proc CreateCalFrame { w dayNames } {
|
||||
set index $i
|
||||
}
|
||||
|
||||
label $w.day$i -text [lindex $dayNames $index] -justify center
|
||||
label $w.day$i -border 1 -text [lindex $dayNames $index] -justify center
|
||||
grid configure $w.day$i -row 0 -column $i -sticky ew
|
||||
}
|
||||
for {set i 0} {$i < 6} {incr i} {
|
||||
@@ -279,9 +297,9 @@ proc CreateCalFrame { w dayNames } {
|
||||
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
|
||||
text $w.t$f -width 12 -height $h -wrap word -relief flat \
|
||||
-state disabled -takefocus 0 -cursor {}
|
||||
-state disabled -relief flat -border 0 -padx 0 -pady 0
|
||||
text $w.t$f -width 12 -height $h -border 1 -wrap word -relief flat \
|
||||
-state disabled -takefocus 0 -cursor {}
|
||||
$w.t$f tag bind TAGGED <Enter> "TaggedEnter $w.t$f"
|
||||
$w.t$f tag bind TAGGED <Leave> "TaggedLeave $w.t$f"
|
||||
$w.t$f tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$f"
|
||||
@@ -392,22 +410,22 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
proc CreateCalWindow { dayNames } {
|
||||
global Option
|
||||
frame .h
|
||||
label .h.title -text "" -justify center -pady 2 -relief raised
|
||||
label .h.title -text "" -justify center -pady 1 -border 1 -relief raised
|
||||
pack .h.title -side top -fill x
|
||||
pack .h -side top -expand 0 -fill x
|
||||
|
||||
CreateCalFrame .cal $dayNames
|
||||
|
||||
frame .b
|
||||
button .b.prev -text {<-} -command {MoveMonth -1}
|
||||
button .b.this -text {Today} -command {ThisMonth}
|
||||
button .b.next -text {->} -command {MoveMonth 1}
|
||||
button .b.goto -text {Go To Date...} -command {GotoDialog}
|
||||
button .b.print -text {Print...} -command {DoPrint}
|
||||
button .b.quit -text {Quit} -command {Quit}
|
||||
button .b.options -text {Options...} -command EditOptions
|
||||
label .b.status -text "" -width 25 -relief sunken
|
||||
label .b.nqueued -text "" -width 20 -relief sunken
|
||||
button .b.prev -text {<-} -command {MoveMonth -1} -border 1
|
||||
button .b.this -text {Today} -command {ThisMonth} -border 1
|
||||
button .b.next -text {->} -command {MoveMonth 1} -border 1
|
||||
button .b.goto -text {Go To Date...} -command {GotoDialog} -border 1
|
||||
button .b.print -text {Print...} -command {DoPrint} -border 1
|
||||
button .b.quit -text {Quit} -command {Quit} -border 1
|
||||
button .b.options -text {Options...} -command EditOptions -border 1
|
||||
label .b.status -text "" -width 25 -relief sunken -border 1
|
||||
label .b.nqueued -text "" -width 20 -relief sunken -border 1
|
||||
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.quit -side left -fill x
|
||||
pack .b.status -side left -fill x -expand 1
|
||||
pack .b.nqueued -side left -fill x
|
||||
@@ -486,6 +504,22 @@ 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
|
||||
# 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
|
||||
entry $w.email_address -width 30
|
||||
pack $w.lab_email_address -in $w.eml -side left -expand 0 -fill none
|
||||
pack $w.email_address -in $w.eml -side left -expand 1 -fill x
|
||||
$w.email_address insert 0 $tmpOpt(MailAddr)
|
||||
|
||||
frame $w.fsmtp
|
||||
label $w.lab_smtp -text "Name or IP address of SMTP server:" -anchor w -justify left
|
||||
entry $w.smtp -width 30
|
||||
pack $w.lab_smtp -in $w.fsmtp -side left -expand 0 -fill none
|
||||
pack $w.smtp -in $w.fsmtp -side left -expand 1 -fill x
|
||||
$w.smtp insert 0 $tmpOpt(SMTPServer)
|
||||
|
||||
# Editor
|
||||
frame $w.ef
|
||||
label $w.el -text "Text Editor:" -anchor w -justify left
|
||||
@@ -510,6 +544,9 @@ proc EditOptions {} {
|
||||
pack $w.sep1 -in $w.f -side top -expand 0 -fill x -ipady 1
|
||||
pack $w.rf -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.feed -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.sep3 -in $w.f -side top -expand 0 -fill x -ipady 1
|
||||
pack $w.eml -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.fsmtp -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.ef -in $w.f -side top -expand 0 -fill x
|
||||
pack $w.sep2 -in $w.f -side top -expand 0 -fill x -ipady 1
|
||||
|
||||
@@ -534,6 +571,9 @@ proc ApplyOptions { w } {
|
||||
global Option tmpOpt
|
||||
set tmpOpt(RunCmd) [$w.cmd get]
|
||||
set tmpOpt(Editor) [$w.editor get]
|
||||
set tmpOpt(MailAddr) [$w.email_address get]
|
||||
set tmpOpt(SMTPServer) [$w.smtp get]
|
||||
|
||||
# Copy working copy to real option set
|
||||
foreach name [array names tmpOpt] {
|
||||
set Option($name) $tmpOpt($name)
|
||||
@@ -623,7 +663,7 @@ proc LoadOptions {} {
|
||||
#***********************************************************************
|
||||
proc ConfigureCalWindow { month year firstDay numDays } {
|
||||
.h.title configure -text "$month $year"
|
||||
wm title . "TkRemind - $month $year"
|
||||
wm title . "$month $year - TkRemind"
|
||||
wm iconname . "$month $year"
|
||||
ConfigureCalFrame .cal $firstDay $numDays
|
||||
}
|
||||
@@ -990,11 +1030,11 @@ proc DoGoto {} {
|
||||
global CurYear CurMonth MonthNames
|
||||
set year [.g.y.e get]
|
||||
if { ! [regexp {^[0-9]+$} $year] } {
|
||||
tk_dialog .error Error {Illegal year specified (1990-2078)} error 0 Ok
|
||||
tk_dialog .error Error {Illegal year specified (1990-5990)} error 0 Ok
|
||||
return
|
||||
}
|
||||
if { $year < 1990 || $year > 2078 } {
|
||||
tk_dialog .error Error {Illegal year specified (1990-2078)} error 0 Ok
|
||||
if { $year < 1990 || $year > 5990 } {
|
||||
tk_dialog .error Error {Illegal year specified (1990-5990)} error 0 Ok
|
||||
return
|
||||
}
|
||||
set month [lsearch -exact $MonthNames [.g.mon cget -text]]
|
||||
@@ -2070,12 +2110,15 @@ proc IssueBackgroundReminder { file time now tag } {
|
||||
label $w.l -text "Reminder for $time issued at $now"
|
||||
message $w.msg -width 6i -text $msg
|
||||
frame $w.b
|
||||
button $w.ok -text "OK" -command "destroy $w"
|
||||
|
||||
# Automatically shut down window after a minute if option says so
|
||||
set after_token [after 60000 [list ClosePopup $w "" $Option(MailAddr) $Option(AutoClose) "" $tag $msg $time]]
|
||||
|
||||
wm protocol $w WM_DELETE_WINDOW [list ClosePopup $w $after_token "" 1 "" $tag $msg $time]
|
||||
button $w.ok -text "OK" -command [list ClosePopup $w $after_token "" 1 "" $tag $msg $time]
|
||||
if {$tag != "*"} {
|
||||
button $w.nomore -text "Don't remind me again today" -command \
|
||||
"destroy $w; set Ignore($tag) 1"
|
||||
button $w.kill -text "Delete this reminder completely" -command \
|
||||
"destroy $w; InteractiveDeleteReminder $tag"
|
||||
button $w.nomore -text "Don't remind me again today" -command [list ClosePopup $w $after_token "" 1 "ignore" $tag $msg $time]
|
||||
button $w.kill -text "Delete this reminder completely" -command [list ClosePopup $w $after_token "" 1 "kill" $tag $msg $time]
|
||||
}
|
||||
pack $w.l -side top
|
||||
pack $w.msg -side top -expand 1 -fill both
|
||||
@@ -2087,11 +2130,6 @@ proc IssueBackgroundReminder { file time now tag } {
|
||||
|
||||
CenterWindow $w
|
||||
|
||||
# Automatically shut down window after a minute if option says so
|
||||
if {$Option(AutoClose)} {
|
||||
after 60000 "catch { destroy $w }"
|
||||
}
|
||||
|
||||
update
|
||||
if {$Option(RingBell)} {
|
||||
bell
|
||||
@@ -2156,8 +2194,10 @@ proc main {} {
|
||||
}
|
||||
|
||||
global AppendFile HighestTagSoFar DayNames
|
||||
puts "\nTkRemind Copyright (C) 1996-1998 David F. Skoll"
|
||||
puts "Copyright (C) 1999-2000 Roaring Penguin Software Inc."
|
||||
catch {
|
||||
puts "\nTkRemind Copyright (C) 1996-1998 David F. Skoll"
|
||||
puts "Copyright (C) 1999-2007 Roaring Penguin Software Inc."
|
||||
}
|
||||
LoadOptions
|
||||
CreateMoonImages
|
||||
Initialize
|
||||
@@ -2685,7 +2725,7 @@ proc ShowTodaysReminders {} {
|
||||
CenterWindow $w
|
||||
|
||||
# Grab the reminders
|
||||
set stuff [exec -keepnewline $Remind -q -a -r $ReminderFile 2>/dev/null]
|
||||
set stuff [exec -keepnewline $Remind -g -q -a -r $ReminderFile 2>/dev/null]
|
||||
$w.text insert end $stuff
|
||||
$w.text configure -state disabled
|
||||
}
|
||||
@@ -2708,4 +2748,41 @@ proc InteractiveDeleteReminder { tag } {
|
||||
}
|
||||
}
|
||||
|
||||
proc SendMail { recipient subject body } {
|
||||
global Option
|
||||
|
||||
if {"$Option(MailAddr)" == ""} {
|
||||
return
|
||||
}
|
||||
if {[catch {set token [mime::initialize -canonical text/plain -string $body]
|
||||
mime::setheader $token Subject $subject
|
||||
mime::setheader $token From "Reminder Service <>"
|
||||
mime::setheader $token To "<$recipient>"
|
||||
mime::setheader $token Auto-Submitted "auto-generated"
|
||||
smtp::sendmessage $token -originator "" -servers $Option(SMTPServer) -recipients $Option(MailAddr)} err]} {
|
||||
puts stderr "ERROR sending mail: $err"
|
||||
}
|
||||
}
|
||||
|
||||
proc ClosePopup { w after_token mail_addr close_win ignore_or_kill tag reminder rem_time } {
|
||||
global Ignore
|
||||
if {"$after_token" != ""} {
|
||||
catch { after cancel $after_token }
|
||||
}
|
||||
|
||||
if {$close_win} {
|
||||
catch { destroy $w }
|
||||
}
|
||||
|
||||
if {"$mail_addr" != ""} {
|
||||
SendMail $mail_addr "Reminder for $rem_time" "Hello,\n\nThe following reminder is scheduled for $rem_time:\n\n$reminder\nRegards,\n\nTkRemind\n"
|
||||
}
|
||||
if {"$ignore_or_kill" == "ignore"} {
|
||||
set Ignore($tag) 1
|
||||
}
|
||||
if {"$ignore_or_kill" == "kill"} {
|
||||
InteractiveDeleteReminder $tag
|
||||
}
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# Makefile.in for REMIND
|
||||
#
|
||||
# $Id: Makefile.in,v 1.24 2005-09-30 03:29:32 dfs Exp $
|
||||
#
|
||||
|
||||
VERSION=03.00.24
|
||||
VERSION=03.01.00
|
||||
SHELL= /bin/sh
|
||||
|
||||
BETA = 1
|
||||
srcdir=@srcdir@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
@@ -29,9 +28,11 @@ MANS= $(srcdir)/../man/kall.1 $(srcdir)/../man/rem.1 \
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
REMINDSRCS= calendar.c dynbuf.c dorem.c dosubst.c expr.c files.c funcs.c \
|
||||
globals.c hbcal.c init.c main.c moon.c omit.c queue.c sort.c \
|
||||
token.c trigger.c userfns.c utils.c var.c
|
||||
globals.c hbcal.c init.c main.c md5.c moon.c omit.c queue.c \
|
||||
sort.c token.c trigger.c userfns.c utils.c var.c
|
||||
|
||||
REMINDHDRS=config.h custom.h dynbuf.h err.h expr.h globals.h lang.h \
|
||||
md5.h protos.h rem2ps.h types.h version.h
|
||||
REMINDOBJS= $(REMINDSRCS:.c=.o)
|
||||
|
||||
all: remind rem2ps
|
||||
@@ -72,17 +73,18 @@ depend:
|
||||
# The next targets are not very useful to you. I use them to build
|
||||
# distributions, etc.
|
||||
|
||||
# Build a tar file based on all files checked into CVS.
|
||||
# Build a tar file based on all files checked into git.
|
||||
distro:
|
||||
ln -s .. remind-$(VERSION)
|
||||
peekentry `find remind-$(VERSION) -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION).tar
|
||||
ln -s . ../remind-$(VERSION)
|
||||
(cd ..; git-ls-files) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
|
||||
gzip -f -v -9 remind-$(VERSION).tar
|
||||
rm -f remind-$(VERSION)
|
||||
rm -f ../remind-$(VERSION)
|
||||
|
||||
beta-tgz:
|
||||
ln -s .. remind-$(VERSION)-BETA
|
||||
peekentry `find remind-$(VERSION)-BETA -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION)-BETA.tar
|
||||
gzip -f -v -9 remind-$(VERSION)-BETA.tar
|
||||
rm -f remind-$(VERSION)-BETA
|
||||
ln -s . ../remind-$(VERSION)-BETA-$(BETA)
|
||||
(cd ..; git-ls-files) | sed -e 's/^/remind-$(VERSION)-BETA-$(BETA)\//' | xargs tar -C .. -cvf remind-$(VERSION)-BETA-$(BETA).tar
|
||||
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
|
||||
rm -f ../remind-$(VERSION)-BETA-$(BETA)
|
||||
|
||||
#---------------- Stuff after this added by "make depend" -----------------
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#$Id: Makefile_QDOS,v 1.1 2000-03-15 16:03:57 dfs Exp $
|
||||
# Makefile for REMIND for QDOS / SMSQ
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: amiga.c,v 1.1 2000-03-15 16:03:57 dfs Exp $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Makefile for REMIND for Borland C++
|
||||
# $Id: makefile.bcc,v 1.1 2000-03-15 16:03:57 dfs Exp $
|
||||
|
||||
MODEL=l
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Makefile for REMIND for Microsoft C for MSDOS
|
||||
# $Id: makefile.msc,v 1.1 2000-03-15 16:03:57 dfs Exp $
|
||||
|
||||
OBJS= calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
|
||||
globals.obj init.obj main.obj omit.obj token.obj trigger.obj userfns.obj \
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Makefile for REMIND
|
||||
#
|
||||
# $Id: makefile.os2,v 1.1 2000-03-15 16:03:57 dfs Exp $
|
||||
#
|
||||
# THIS IS OUT OF DATE!
|
||||
#
|
||||
# - for GNU gcc (emx 0.8g kit) [executables for OS/2 2.x or DOS (32-bit)]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Makefile for REMIND for Turbo C for MSDOS
|
||||
# $Id: makefile.tc,v 1.1 2000-03-15 16:03:57 dfs Exp $
|
||||
|
||||
CC= tcc
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: os2func.c,v 1.1 2000-03-15 16:03:57 dfs Exp $";
|
||||
|
||||
#ifdef OS2_POPUP
|
||||
#define INCL_VIO
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# $Id: smakefile,v 1.1 2000-03-15 16:03:57 dfs Exp $
|
||||
# Makefile for REMIND, suitable for SAS/C 6.50 under AmigaDOS
|
||||
# English version
|
||||
# THIS IS OUT OF DATE!
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.13 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -24,6 +23,7 @@ static char const RCSID[] = "$Id: calendar.c,v 1.13 2005-09-30 03:29:32 dfs Exp
|
||||
#include "expr.h"
|
||||
#include "globals.h"
|
||||
#include "err.h"
|
||||
#include "md5.h"
|
||||
|
||||
/* Data structures used by the calendar */
|
||||
typedef struct cal_entry {
|
||||
@@ -638,7 +638,22 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
strcpy(trig.passthru, "PSFile");
|
||||
trig.typ = PASSTHRU_TYPE;
|
||||
}
|
||||
if (!PsCal && trig.typ == PASSTHRU_TYPE) return OK;
|
||||
if (!PsCal) {
|
||||
if (trig.typ == PASSTHRU_TYPE) {
|
||||
if (strcmp(trig.passthru, "COLOR")) return OK;
|
||||
/* Strip off the three color numbers */
|
||||
DBufFree(&buf);
|
||||
r=ParseToken(p, &buf);
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
r=ParseToken(p, &buf);
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
r=ParseToken(p, &buf);
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove any "at" times from PS or PSFILE reminders */
|
||||
if (trig.typ == PASSTHRU_TYPE && strcmp(trig.passthru, "COLOR")) {
|
||||
@@ -648,12 +663,24 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
|
||||
/* If trigger date == today, add it to the current entry */
|
||||
DBufInit(&obuf);
|
||||
if (jul == JulianToday) {
|
||||
if ((jul == JulianToday) ||
|
||||
(DoSimpleCalendar &&
|
||||
DoSimpleCalDelta &&
|
||||
ShouldTriggerReminder(&trig, &tim, jul))) {
|
||||
NumTriggered++;
|
||||
|
||||
if (DoSimpleCalendar || tim.ttime != NO_TIME) {
|
||||
if (DBufPuts(&obuf, SimpleTime(tim.ttime)) != OK) {
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
/* Suppress time if it's not today */
|
||||
if (jul != JulianToday) {
|
||||
if (DBufPuts(&obuf, SimpleTime(NO_TIME)) != OK) {
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
} else {
|
||||
if (DBufPuts(&obuf, SimpleTime(tim.ttime)) != OK) {
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (trig.typ != PASSTHRU_TYPE &&
|
||||
@@ -674,7 +701,15 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
}
|
||||
oldLen = DBufLen(&obuf);
|
||||
if ( (r=DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE)) ) {
|
||||
|
||||
/* In -sa mode, run in ADVANCE mode if we're triggering
|
||||
* before the actual date */
|
||||
if (jul != JulianToday) {
|
||||
r = DoSubst(p, &obuf, &trig, &tim, jul, ADVANCE_MODE);
|
||||
} else {
|
||||
r = DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE);
|
||||
}
|
||||
if (r) {
|
||||
DBufFree(&obuf);
|
||||
return r;
|
||||
}
|
||||
@@ -714,7 +749,11 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
StrnCpy(e->tag, trig.tag, TAG_LEN);
|
||||
if (!e->tag[0]) {
|
||||
strcpy(e->tag, "*");
|
||||
if (SynthesizeTags) {
|
||||
SynthesizeTag(e->tag);
|
||||
} else {
|
||||
strcpy(e->tag, "*");
|
||||
}
|
||||
}
|
||||
e->duration = tim.duration;
|
||||
e->priority = trig.priority;
|
||||
@@ -725,10 +764,13 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
e->lineno = LineNo;
|
||||
|
||||
/* Ugly hack... a SPECIAL COLOR is not treated as "passthru"
|
||||
to preserve ordering and make it behave like a MSG-type reminder */
|
||||
/* Ugly hack... SPECIAL COLOR and SPECIAL HTML are not treated
|
||||
as "passthru" to preserve ordering and make them behave like
|
||||
a MSG-type reminder */
|
||||
|
||||
if (trig.typ == PASSTHRU_TYPE && strcmp(trig.passthru, "COLOR")) {
|
||||
if (trig.typ == PASSTHRU_TYPE &&
|
||||
strcmp(trig.passthru, "COLOR") &&
|
||||
strcmp(trig.passthru, "HTML")) {
|
||||
StrnCpy(e->passthru, trig.passthru, PASSTHRU_LEN);
|
||||
e->pos = e->passthru;
|
||||
e->time = NO_TIME;
|
||||
@@ -742,7 +784,11 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
e->passthru[0] = 0;
|
||||
}
|
||||
e->pos = e->text;
|
||||
e->time = tim.ttime;
|
||||
if (jul == JulianToday) {
|
||||
e->time = tim.ttime;
|
||||
} else {
|
||||
e->time = NO_TIME;
|
||||
}
|
||||
e->next = CurCol;
|
||||
CalColumn[col] = e;
|
||||
SortCol(&CalColumn[col]);
|
||||
@@ -769,8 +815,7 @@ static void WriteSimpleEntries(int col, int jul)
|
||||
while(e) {
|
||||
if (DoPrefixLineNo) printf("# fileinfo %d %s\n", e->lineno, e->filename);
|
||||
printf("%04d/%02d/%02d ", y, m+1, d);
|
||||
printf("%s ", e->passthru);
|
||||
printf("%s ", e->tag);
|
||||
printf("%s %s ", e->passthru, e->tag);
|
||||
if (e->duration != NO_TIME) {
|
||||
printf("%d ", e->duration);
|
||||
} else {
|
||||
@@ -884,7 +929,7 @@ char *SimpleTime(int tim)
|
||||
if (h == 0) hh=12;
|
||||
else if (h > 12) hh=h-12;
|
||||
else hh=h;
|
||||
sprintf(buf, "%2d%c%02d%s ", hh, TIMESEP, min, (h>=12) ? L_PM : L_AM);
|
||||
sprintf(buf, "%2d%c%02d%s ", hh, TimeSep, min, (h>=12) ? L_PM : L_AM);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -892,7 +937,7 @@ char *SimpleTime(int tim)
|
||||
if (tim != NO_TIME) {
|
||||
h = tim / 60;
|
||||
min = tim % 60;
|
||||
sprintf(buf, "%02d%c%02d ", h, TIMESEP, min);
|
||||
sprintf(buf, "%02d%c%02d ", h, TimeSep, min);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -935,3 +980,22 @@ static void SortCol(CalEntry **col)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SynthesizeTag(char *out)
|
||||
{
|
||||
struct MD5Context ctx;
|
||||
unsigned char buf[16];
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, (unsigned char *) CurLine, strlen(CurLine));
|
||||
MD5Final(buf, &ctx);
|
||||
sprintf(out, "__syn__%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||
(unsigned int) buf[0], (unsigned int) buf[1],
|
||||
(unsigned int) buf[2], (unsigned int) buf[3],
|
||||
(unsigned int) buf[4], (unsigned int) buf[5],
|
||||
(unsigned int) buf[6], (unsigned int) buf[7],
|
||||
(unsigned int) buf[8], (unsigned int) buf[9],
|
||||
(unsigned int) buf[10], (unsigned int) buf[11],
|
||||
(unsigned int) buf[12], (unsigned int) buf[13],
|
||||
(unsigned int) buf[14], (unsigned int) buf[15]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* $Id: config.h.in,v 1.5 2005-09-30 03:29:32 dfs Exp $ */
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#undef HAVE_UTIME_NULL
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
@@ -17,4 +12,17 @@
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
#undef HAVE_SETENV
|
||||
|
||||
#undef HAVE_UNSETENV
|
||||
|
||||
/* The number of bytes in a unsigned int. */
|
||||
#undef SIZEOF_UNSIGNED_INT
|
||||
|
||||
/* 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"
|
||||
|
||||
31
src/custom.h
31
src/custom.h
@@ -11,8 +11,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: custom.h,v 1.34 2005-10-16 14:48:02 dfs Exp $ */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||
@@ -41,11 +39,11 @@
|
||||
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* DATESEP: The default date separator. North American usage is '/'; */
|
||||
/* others may prefer '-'. */
|
||||
/* DATESEP: The default date separator. Standard usage is '-'; */
|
||||
/* others may prefer '/'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define DATESEP '/'
|
||||
/* #define DATESEP '-' */
|
||||
#define DATESEP '-'
|
||||
/* #define DATESEP '/' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TIMESEP: The default time separator. North American usage is ':'; */
|
||||
@@ -134,19 +132,16 @@
|
||||
#define BASE 1990
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
|
||||
/* integers can handle about 89 years worth of reminders; if */
|
||||
/* you use 32-bit integers, you can handle over 5 867 000 */
|
||||
/* years. Note that YR_RANGE is set to 88 rather than 89 */
|
||||
/* because we can range up to the last day of the 88th year. */
|
||||
/* YR_RANGE: The range of years allowed. With 32-bit signed integers, */
|
||||
/* the DATETIME type can store 2^31 minutes or about 4074 years. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define YR_RANGE 88
|
||||
#define YR_RANGE 4000
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||
/* any less than 12. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAR_NAME_LEN 12
|
||||
#define VAR_NAME_LEN 16
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||
@@ -178,17 +173,17 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many attempts to resolve a weird date spec? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TRIG_ATTEMPTS 25
|
||||
#define TRIG_ATTEMPTS 50
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_FULL_OMITS 75
|
||||
#define MAX_FULL_OMITS 250
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_PARTIAL_OMITS 75
|
||||
#define MAX_PARTIAL_OMITS 250
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* A newline - some systems need "\n\r" */
|
||||
@@ -207,9 +202,9 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TAG_LEN: The maximum length of tags. Don't change it */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TAG_LEN 32
|
||||
#define TAG_LEN 48
|
||||
|
||||
#define PASSTHRU_LEN 24
|
||||
#define PASSTHRU_LEN 32
|
||||
|
||||
#define PSBEGIN "# rem2ps begin"
|
||||
#define PSEND "# rem2ps end"
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: custom.h.in,v 1.8 2005-09-30 03:29:32 dfs Exp $ */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||
@@ -41,11 +39,11 @@
|
||||
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* DATESEP: The default date separator. North American usage is '/'; */
|
||||
/* others may prefer '-'. */
|
||||
/* DATESEP: The default date separator. Standard usage is '-'; */
|
||||
/* others may prefer '/'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define DATESEP '/'
|
||||
/* #define DATESEP '-' */
|
||||
#define DATESEP '-'
|
||||
/* #define DATESEP '/' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TIMESEP: The default time separator. North American usage is ':'; */
|
||||
@@ -134,19 +132,16 @@
|
||||
#define BASE 1990
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
|
||||
/* integers can handle about 89 years worth of reminders; if */
|
||||
/* you use 32-bit integers, you can handle over 5 867 000 */
|
||||
/* years. Note that YR_RANGE is set to 88 rather than 89 */
|
||||
/* because we can range up to the last day of the 88th year. */
|
||||
/* YR_RANGE: The range of years allowed. With 32-bit signed integers, */
|
||||
/* the DATETIME type can store 2^31 minutes or about 4074 years. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define YR_RANGE 88
|
||||
#define YR_RANGE 4000
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||
/* any less than 12. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAR_NAME_LEN 12
|
||||
#define VAR_NAME_LEN 16
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||
@@ -178,17 +173,17 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many attempts to resolve a weird date spec? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TRIG_ATTEMPTS 25
|
||||
#define TRIG_ATTEMPTS 50
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_FULL_OMITS 75
|
||||
#define MAX_FULL_OMITS 250
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_PARTIAL_OMITS 75
|
||||
#define MAX_PARTIAL_OMITS 250
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* A newline - some systems need "\n\r" */
|
||||
@@ -207,9 +202,9 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TAG_LEN: The maximum length of tags. Don't change it */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TAG_LEN 32
|
||||
#define TAG_LEN 48
|
||||
|
||||
#define PASSTHRU_LEN 24
|
||||
#define PASSTHRU_LEN 32
|
||||
|
||||
#define PSBEGIN "# rem2ps begin"
|
||||
#define PSEND "# rem2ps end"
|
||||
|
||||
53
src/dorem.c
53
src/dorem.c
@@ -13,8 +13,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: dorem.c,v 1.14 2005-11-20 01:26:59 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@@ -33,7 +31,7 @@ static char const DontEscapeMe[] =
|
||||
|
||||
static int ParseTimeTrig (ParsePtr s, TimeTrig *tim);
|
||||
static int ParseLocalOmit (ParsePtr s, Trigger *t);
|
||||
static int ParseScanFrom (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 ShouldTriggerBasedOnWarn (Trigger *t, int jul);
|
||||
@@ -151,6 +149,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
tim->delta = NO_DELTA;
|
||||
tim->rep = NO_REP;
|
||||
tim->duration = NO_TIME;
|
||||
LastTriggerTime = NO_TIME;
|
||||
|
||||
while(1) {
|
||||
/* Read space-delimited string */
|
||||
@@ -192,7 +191,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
|
||||
case T_Scanfrom:
|
||||
DBufFree(&buf);
|
||||
r=ParseScanFrom(s, trig);
|
||||
r=ParseScanFrom(s, trig, tok.val);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
@@ -462,10 +461,10 @@ static int ParseUntil(ParsePtr s, Trigger *t)
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseScanFrom - parse the SCANFROM portion of a reminder */
|
||||
/* ParseScanFrom - parse the FROM/SCANFROM portion */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||
{
|
||||
int y = NO_YR,
|
||||
m = NO_MON,
|
||||
@@ -475,6 +474,12 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
int r;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
char const *word;
|
||||
if (type == SCANFROM_TYPE) {
|
||||
word = "SCANFROM";
|
||||
} else {
|
||||
word = "FROM";
|
||||
}
|
||||
|
||||
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
|
||||
|
||||
@@ -486,7 +491,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
case T_Year:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_YR_TWICE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_YR_TWICE]);
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
@@ -495,7 +500,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
case T_Month:
|
||||
DBufFree(&buf);
|
||||
if (m != NO_MON) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_MON_TWICE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_MON_TWICE]);
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
@@ -504,7 +509,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
case T_Day:
|
||||
DBufFree(&buf);
|
||||
if (d != NO_DAY) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_DAY_TWICE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_DAY_TWICE]);
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
@@ -512,7 +517,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
|
||||
default:
|
||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_INCOMPLETE]);
|
||||
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
|
||||
DBufFree(&buf);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
@@ -521,6 +526,12 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
return E_BAD_DATE;
|
||||
}
|
||||
t->scanfrom = Julian(y, m, d);
|
||||
if (type == FROM_TYPE) {
|
||||
if (t->scanfrom < JulianToday) {
|
||||
t->scanfrom = JulianToday;
|
||||
}
|
||||
}
|
||||
|
||||
PushToken(DBufValue(&buf), s);
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
@@ -534,7 +545,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
/* Trigger the reminder if it's a RUN or MSG type. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
||||
int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
||||
{
|
||||
int r, y, m, d;
|
||||
char PrioExpr[25];
|
||||
@@ -546,11 +557,26 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
DBufInit(&buf);
|
||||
DBufInit(&calRow);
|
||||
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
|
||||
if (t->typ == PASSTHRU_TYPE ||
|
||||
if ((t->typ == PASSTHRU_TYPE && strcmp(t->passthru, "COLOR")) ||
|
||||
t->typ == CAL_TYPE ||
|
||||
t->typ == PS_TYPE ||
|
||||
t->typ == PSF_TYPE)
|
||||
return OK;
|
||||
|
||||
/* Handle COLOR types */
|
||||
if (t->typ == PASSTHRU_TYPE && !strcmp(t->passthru, "COLOR")) {
|
||||
/* Strip off three tokens */
|
||||
r = ParseToken(p, &buf);
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
r = ParseToken(p, &buf);
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
r = ParseToken(p, &buf);
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
t->typ = MSG_TYPE;
|
||||
}
|
||||
/* If it's a MSG-type reminder, and no -k option was used, issue the banner. */
|
||||
if ((t->typ == MSG_TYPE || t->typ == MSF_TYPE)
|
||||
&& !NumTriggered && !NextMode && !MsgCommand) {
|
||||
@@ -571,7 +597,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
return OK;
|
||||
}
|
||||
FromJulian(jul, &y, &m, &d);
|
||||
sprintf(tmpBuf, "%04d%c%02d%c%02d ", y, DATESEP, m+1, DATESEP, d);
|
||||
sprintf(tmpBuf, "%04d%c%02d%c%02d ", y, DateSep, m+1, DateSep, d);
|
||||
if (DBufPuts(&calRow, tmpBuf) != OK) {
|
||||
DBufFree(&calRow);
|
||||
return E_NO_MEM;
|
||||
@@ -675,6 +701,7 @@ static int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
reminder now. */
|
||||
switch(t->typ) {
|
||||
case MSG_TYPE:
|
||||
case PASSTHRU_TYPE:
|
||||
if (MsgCommand) {
|
||||
DoMsgCommand(MsgCommand, DBufValue(&buf));
|
||||
} else {
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: dosubst.c,v 1.11 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#define L_IN_DOSUBST
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -44,6 +42,7 @@ static char TOMORROW[] = L_TOMORROW;
|
||||
/* Process the % escapes in the reminder. If */
|
||||
/* mode==NORMAL_MODE, ignore the %" sequence. If */
|
||||
/* mode==CAL_MODE, process the %" sequence. */
|
||||
/* If mode==ADVANCE_MODE, ignore %" but don't add newline */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode)
|
||||
@@ -131,7 +130,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
}
|
||||
if (c == '\n') continue;
|
||||
if (!c) {
|
||||
if (mode != CAL_MODE && t->typ != RUN_TYPE && !MsgCommand) {
|
||||
if (mode != CAL_MODE && mode != ADVANCE_MODE &&
|
||||
t->typ != RUN_TYPE && !MsgCommand) {
|
||||
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
|
||||
}
|
||||
break;
|
||||
@@ -242,8 +242,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_E_OVER
|
||||
L_E_OVER
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DATESEP,
|
||||
m+1, DATESEP, y);
|
||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
|
||||
m+1, DateSep, y);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -252,7 +252,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_F_OVER
|
||||
L_F_OVER
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DATESEP, d, DATESEP, y);
|
||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -270,7 +270,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_H_OVER
|
||||
L_H_OVER
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d", L_ON, d, DATESEP, m+1);
|
||||
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -279,7 +279,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_I_OVER
|
||||
L_I_OVER
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DATESEP, d);
|
||||
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -308,7 +308,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_L_OVER
|
||||
L_L_OVER
|
||||
#else
|
||||
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DATESEP, m+1, DATESEP, d);
|
||||
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -463,7 +463,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_2_OVER
|
||||
L_2_OVER
|
||||
#else
|
||||
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TIMESEP, min, pm);
|
||||
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -473,7 +473,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
L_3_OVER
|
||||
#else
|
||||
|
||||
sprintf(s, "%s %02d%c%02d", L_AT, h, TIMESEP, min);
|
||||
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -554,7 +554,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_AT_OVER
|
||||
L_AT_OVER
|
||||
#else
|
||||
sprintf(s, "%d%c%02d%s", chh, TIMESEP, cmin, cpm);
|
||||
sprintf(s, "%d%c%02d%s", chh, TimeSep, cmin, cpm);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
@@ -563,13 +563,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
#ifdef L_HASH_OVER
|
||||
L_HASH_OVER
|
||||
#else
|
||||
sprintf(s, "%02d%c%02d", ch, TIMESEP, cmin);
|
||||
sprintf(s, "%02d%c%02d", ch, TimeSep, cmin);
|
||||
#endif
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '_':
|
||||
if (mode != CAL_MODE && !MsgCommand)
|
||||
if (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)
|
||||
sprintf(s, "%s", NL);
|
||||
else
|
||||
sprintf(s, " ");
|
||||
@@ -602,7 +602,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
/* If there are NO quotes, then: If CAL_MODE && RUN_TYPE, we don't want the
|
||||
reminder in the calendar. Zero the output buffer and quit. */
|
||||
if (!has_quote) {
|
||||
if (mode == CAL_MODE && t->typ == RUN_TYPE) {
|
||||
if ((mode == ADVANCE_MODE || mode == CAL_MODE) && t->typ == RUN_TYPE) {
|
||||
*DBufValue(dbuf) = 0;
|
||||
dbuf->len = 0;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
|
||||
ss = DBufValue(dbuf) + origLen;
|
||||
os = ss;
|
||||
if (mode == NORMAL_MODE) {
|
||||
if (mode == NORMAL_MODE || mode == ADVANCE_MODE) {
|
||||
while (*ss) {
|
||||
if (*ss != QUOTE_MARKER) *os++ = *ss;
|
||||
ss++;
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] =
|
||||
"$Id: dynbuf.c,v 1.6 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
#include "dynbuf.h"
|
||||
#include "err.h"
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: dynbuf.h,v 1.4 2005-09-30 03:29:32 dfs Exp $ */
|
||||
|
||||
#ifndef DYNBUF_H
|
||||
#define DYNBUF_H
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: err.h,v 1.4 2000-02-18 03:45:51 dfs Exp $ */
|
||||
|
||||
/* Note that not all of the "errors" are really errors - some are just
|
||||
messages for information purposes. Constants beginning with M_ should
|
||||
never be returned as error indicators - they should only be used to
|
||||
@@ -118,6 +116,7 @@
|
||||
#define M_QUEUED 96
|
||||
#define E_EXPECTING_NUMBER 97
|
||||
#define M_BAD_WARN_FUNC 98
|
||||
#define E_CANT_CONVERT_TZ 99
|
||||
|
||||
#ifdef MK_GLOBALS
|
||||
#undef EXTERN
|
||||
@@ -206,7 +205,7 @@ EXTERN char *ErrMsg[]
|
||||
"Expecting time after AT",
|
||||
"UNTIL keyword used twice",
|
||||
"Incomplete date specification",
|
||||
"SCANFROM keyword used twice",
|
||||
"FROM/SCANFROM keyword used twice",
|
||||
"Variable",
|
||||
"Value",
|
||||
"*UNDEFINED*",
|
||||
@@ -230,7 +229,8 @@ EXTERN char *ErrMsg[]
|
||||
"No reminders.",
|
||||
"%d reminder(s) queued for later today.\n",
|
||||
"Expecting number",
|
||||
"Bad function in WARN clause"
|
||||
"Bad function in WARN clause",
|
||||
"Can't convert between time zones"
|
||||
}
|
||||
#endif /* MK_GLOBALS */
|
||||
;
|
||||
|
||||
165
src/expr.c
165
src/expr.c
@@ -11,8 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: expr.c,v 1.10 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@@ -44,7 +42,7 @@ static int Multiply(void), Divide(void), Mod(void), Add(void),
|
||||
Compare(int);
|
||||
|
||||
static int MakeValue (char *s, Value *v, Var *locals);
|
||||
static int ParseLiteralDate (char **s, int *jul);
|
||||
static int ParseLiteralDate (char **s, int *jul, int *tim);
|
||||
|
||||
/* Binary operators - all left-associative */
|
||||
|
||||
@@ -240,7 +238,7 @@ static int ParseExprToken(DynamicBuffer *buf, char **in)
|
||||
}
|
||||
|
||||
/* Parse a constant, variable name or function */
|
||||
while (ISID(**in) || **in == ':' || **in == '.' || **in == TIMESEP) {
|
||||
while (ISID(**in) || **in == ':' || **in == '.' || **in == TimeSep) {
|
||||
if (DBufPutc(buf, **in) != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
@@ -368,8 +366,8 @@ int Evaluate(char **s, Var *locals)
|
||||
r = CallUserFunc(ufname, args);
|
||||
free(ufname);
|
||||
}
|
||||
if (r) return r;
|
||||
DBufFree(&ExprBuf);
|
||||
if (r) return r;
|
||||
}
|
||||
} else { /* Unary operator */
|
||||
f = FindFunc(DBufValue(&ExprBuf), UnOp, NUM_UN_OPS);
|
||||
@@ -468,10 +466,15 @@ static int MakeValue(char *s, Value *v, Var *locals)
|
||||
return OK;
|
||||
} else if (*s == '\'') { /* It's a literal date */
|
||||
s++;
|
||||
if ((r=ParseLiteralDate(&s, &h))) return r;
|
||||
if ((r=ParseLiteralDate(&s, &h, &m))) return r;
|
||||
if (*s != '\'') return E_BAD_DATE;
|
||||
v->type = DATE_TYPE;
|
||||
v->v.val = h;
|
||||
if (m == NO_TIME) {
|
||||
v->type = DATE_TYPE;
|
||||
v->v.val = h;
|
||||
} else {
|
||||
v->type = DATETIME_TYPE;
|
||||
v->v.val = (h * MINUTES_PER_DAY) + m;
|
||||
}
|
||||
return OK;
|
||||
} else if (isdigit(*s)) { /* It's a number - use len to hold it.*/
|
||||
len = 0;
|
||||
@@ -479,7 +482,7 @@ static int MakeValue(char *s, Value *v, Var *locals)
|
||||
len *= 10;
|
||||
len += (*s++ - '0');
|
||||
}
|
||||
if (*s == ':' || *s == '.' || *s == TIMESEP) { /* Must be a literal time */
|
||||
if (*s == ':' || *s == '.' || *s == TimeSep) { /* Must be a literal time */
|
||||
s++;
|
||||
if (!isdigit(*s)) return E_BAD_TIME;
|
||||
h = len;
|
||||
@@ -490,7 +493,7 @@ static int MakeValue(char *s, Value *v, Var *locals)
|
||||
s++;
|
||||
}
|
||||
if (*s || h>23 || m>59) return E_BAD_TIME;
|
||||
v->type = TIM_TYPE;
|
||||
v->type = TIME_TYPE;
|
||||
v->v.val = h*60 + m;
|
||||
return OK;
|
||||
}
|
||||
@@ -529,22 +532,52 @@ static int MakeValue(char *s, Value *v, Var *locals)
|
||||
/***************************************************************/
|
||||
int DoCoerce(char type, Value *v)
|
||||
{
|
||||
int h, d, m, y, i;
|
||||
int h, d, m, y, i, k;
|
||||
char *s;
|
||||
|
||||
/* Do nothing if value is already the right type */
|
||||
if (type == v->type) return OK;
|
||||
|
||||
switch(type) {
|
||||
case DATETIME_TYPE:
|
||||
switch(v->type) {
|
||||
case INT_TYPE:
|
||||
v->type = DATETIME_TYPE;
|
||||
return OK;
|
||||
case DATE_TYPE:
|
||||
v->type = DATETIME_TYPE;
|
||||
v->v.val *= MINUTES_PER_DAY;
|
||||
return OK;
|
||||
case STR_TYPE:
|
||||
s = v->v.str;
|
||||
if (ParseLiteralDate(&s, &i, &m)) return E_CANT_COERCE;
|
||||
if (*s) return E_CANT_COERCE;
|
||||
v->type = DATETIME_TYPE;
|
||||
free(v->v.str);
|
||||
if (m == NO_TIME) m = 0;
|
||||
v->v.val = i * MINUTES_PER_DAY + m;
|
||||
return OK;
|
||||
default:
|
||||
return E_CANT_COERCE;
|
||||
}
|
||||
case STR_TYPE:
|
||||
switch(v->type) {
|
||||
case INT_TYPE: sprintf(CoerceBuf, "%d", v->v.val); break;
|
||||
case TIM_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
|
||||
TIMESEP, v->v.val % 60);
|
||||
case TIME_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
|
||||
TimeSep, v->v.val % 60);
|
||||
break;
|
||||
case DATE_TYPE: FromJulian(v->v.val, &y, &m, &d);
|
||||
sprintf(CoerceBuf, "%04d%c%02d%c%02d",
|
||||
y, DATESEP, m+1, DATESEP, d);
|
||||
y, DateSep, m+1, DateSep, d);
|
||||
break;
|
||||
case DATETIME_TYPE:
|
||||
i = v->v.val / MINUTES_PER_DAY;
|
||||
FromJulian(i, &y, &m, &d);
|
||||
k = v->v.val % MINUTES_PER_DAY;
|
||||
h = k / 60;
|
||||
i = k % 60;
|
||||
sprintf(CoerceBuf, "%04d%c%02d%c%02d@%02d%c%02d",
|
||||
y, DateSep, m+1, DateSep, d, h, TimeSep, i);
|
||||
break;
|
||||
default: return E_CANT_COERCE;
|
||||
}
|
||||
@@ -581,7 +614,8 @@ int DoCoerce(char type, Value *v)
|
||||
return OK;
|
||||
|
||||
case DATE_TYPE:
|
||||
case TIM_TYPE:
|
||||
case TIME_TYPE:
|
||||
case DATETIME_TYPE:
|
||||
v->type = INT_TYPE;
|
||||
return OK;
|
||||
|
||||
@@ -598,22 +632,28 @@ int DoCoerce(char type, Value *v)
|
||||
|
||||
case STR_TYPE:
|
||||
s = v->v.str;
|
||||
if (ParseLiteralDate(&s, &i)) return E_CANT_COERCE;
|
||||
if (ParseLiteralDate(&s, &i, &m)) return E_CANT_COERCE;
|
||||
if (*s) return E_CANT_COERCE;
|
||||
v->type = DATE_TYPE;
|
||||
free(v->v.str);
|
||||
v->v.val = i;
|
||||
return OK;
|
||||
|
||||
case DATETIME_TYPE:
|
||||
v->type = DATE_TYPE;
|
||||
v->v.val /= MINUTES_PER_DAY;
|
||||
return OK;
|
||||
|
||||
default: return E_CANT_COERCE;
|
||||
}
|
||||
|
||||
case TIM_TYPE:
|
||||
case TIME_TYPE:
|
||||
switch(v->type) {
|
||||
case INT_TYPE:
|
||||
v->type = TIM_TYPE;
|
||||
v->v.val %= 1440;
|
||||
if (v->v.val < 0) v->v.val += 1440;
|
||||
case DATETIME_TYPE:
|
||||
v->type = TIME_TYPE;
|
||||
v->v.val %= MINUTES_PER_DAY;
|
||||
if (v->v.val < 0) v->v.val += MINUTES_PER_DAY;
|
||||
return OK;
|
||||
|
||||
case STR_TYPE:
|
||||
@@ -625,7 +665,7 @@ int DoCoerce(char type, Value *v)
|
||||
h *= 10;
|
||||
h += *s++ - '0';
|
||||
}
|
||||
if (*s != ':' && *s != '.' && *s != TIMESEP)
|
||||
if (*s != ':' && *s != '.' && *s != TimeSep)
|
||||
return E_CANT_COERCE;
|
||||
s++;
|
||||
if (!isdigit(*s)) return E_CANT_COERCE;
|
||||
@@ -634,7 +674,7 @@ int DoCoerce(char type, Value *v)
|
||||
m += *s++ - '0';
|
||||
}
|
||||
if (*s || h>23 || m>59) return E_CANT_COERCE;
|
||||
v->type = TIM_TYPE;
|
||||
v->type = TIME_TYPE;
|
||||
free(v->v.str);
|
||||
v->v.val = h*60+m;
|
||||
return OK;
|
||||
@@ -680,12 +720,22 @@ static int Add(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* If it's a time plus an int, add 'em mod 1440 */
|
||||
if ((v1.type == TIM_TYPE && v2.type == INT_TYPE) ||
|
||||
(v1.type == INT_TYPE && v2.type == TIM_TYPE)) {
|
||||
v1.v.val = (v1.v.val + v2.v.val) % 1440;
|
||||
if (v1.v.val < 0) v1.v.val += 1440;
|
||||
v1.type = TIM_TYPE;
|
||||
/* If it's a datetime plus an int, add 'em */
|
||||
if ((v1.type == DATETIME_TYPE && v2.type == INT_TYPE) ||
|
||||
(v1.type == INT_TYPE && v2.type == DATETIME_TYPE)) {
|
||||
v1.v.val += v2.v.val;
|
||||
if (v1.v.val < 0) return E_DATE_OVER;
|
||||
v1.type = DATETIME_TYPE;
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* If it's a time plus an int, add 'em mod MINUTES_PER_DAY */
|
||||
if ((v1.type == TIME_TYPE && v2.type == INT_TYPE) ||
|
||||
(v1.type == INT_TYPE && v2.type == TIME_TYPE)) {
|
||||
v1.v.val = (v1.v.val + v2.v.val) % MINUTES_PER_DAY;
|
||||
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
|
||||
v1.type = TIME_TYPE;
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
@@ -750,16 +800,25 @@ static int Subtract(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* If it's a time minus an int, do subtraction mod 1440 */
|
||||
if (v1.type == TIM_TYPE && v2.type == INT_TYPE) {
|
||||
v1.v.val = (v1.v.val - v2.v.val) % 1440;
|
||||
if (v1.v.val < 0) v1.v.val += 1440;
|
||||
/* If it's a datetime minus an int, do subtraction, checking for underflow */
|
||||
if (v1.type == DATETIME_TYPE && v2.type == INT_TYPE) {
|
||||
v1.v.val -= v2.v.val;
|
||||
if (v1.v.val < 0) return E_DATE_OVER;
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* If it's a time minus an int, do subtraction mod MINUTES_PER_DAY */
|
||||
if (v1.type == TIME_TYPE && v2.type == INT_TYPE) {
|
||||
v1.v.val = (v1.v.val - v2.v.val) % MINUTES_PER_DAY;
|
||||
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* If it's a time minus a time or a date minus a date, do it */
|
||||
if ((v1.type == TIM_TYPE && v2.type == TIM_TYPE) ||
|
||||
if ((v1.type == TIME_TYPE && v2.type == TIME_TYPE) ||
|
||||
(v1.type == DATETIME_TYPE && v2.type == DATETIME_TYPE) ||
|
||||
(v1.type == DATE_TYPE && v2.type == DATE_TYPE)) {
|
||||
v1.v.val -= v2.v.val;
|
||||
v1.type = INT_TYPE;
|
||||
@@ -1053,11 +1112,16 @@ void PrintValue (Value *v, FILE *fp)
|
||||
if (*s) fprintf(fp, "...");
|
||||
}
|
||||
else if (v->type == INT_TYPE) fprintf(fp, "%d", v->v.val);
|
||||
else if (v->type == TIM_TYPE) fprintf(fp, "%02d%c%02d", v->v.val / 60,
|
||||
TIMESEP, v->v.val % 60);
|
||||
else if (v->type == TIME_TYPE) fprintf(fp, "%02d%c%02d", v->v.val / 60,
|
||||
TimeSep, v->v.val % 60);
|
||||
else if (v->type == DATE_TYPE) {
|
||||
FromJulian(v->v.val, &y, &m, &d);
|
||||
fprintf(fp, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
||||
fprintf(fp, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
||||
}
|
||||
else if (v->type == DATETIME_TYPE) {
|
||||
FromJulian(v->v.val / MINUTES_PER_DAY, &y, &m, &d);
|
||||
fprintf(fp, "%04d%c%02d%c%02d@%02d%c%02d", y, DateSep, m+1, DateSep, d,
|
||||
(v->v.val % MINUTES_PER_DAY) / 60, TimeSep, (v->v.val % MINUTES_PER_DAY) % 60);
|
||||
}
|
||||
else fprintf(fp, "ERR");
|
||||
}
|
||||
@@ -1086,21 +1150,25 @@ int CopyValue(Value *dest, const Value *src)
|
||||
/* */
|
||||
/* ParseLiteralDate */
|
||||
/* */
|
||||
/* Parse a literal date. Return result in jul, update s. */
|
||||
/* Parse a literal date or datetime. Return result in jul */
|
||||
/* and tim; update s. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int ParseLiteralDate(char **s, int *jul)
|
||||
static int ParseLiteralDate(char **s, int *jul, int *tim)
|
||||
{
|
||||
int y, m, d;
|
||||
int hour, min;
|
||||
|
||||
y=0; m=0; d=0;
|
||||
hour=0; min=0;
|
||||
|
||||
*tim = NO_TIME;
|
||||
if (!isdigit(**s)) return E_BAD_DATE;
|
||||
while (isdigit(**s)) {
|
||||
y *= 10;
|
||||
y += *(*s)++ - '0';
|
||||
}
|
||||
if (**s != '/' && **s != '-' && **s != DATESEP) return E_BAD_DATE;
|
||||
if (**s != '/' && **s != '-' && **s != DateSep) return E_BAD_DATE;
|
||||
(*s)++;
|
||||
if (!isdigit(**s)) return E_BAD_DATE;
|
||||
while (isdigit(**s)) {
|
||||
@@ -1108,7 +1176,7 @@ static int ParseLiteralDate(char **s, int *jul)
|
||||
m += *(*s)++ - '0';
|
||||
}
|
||||
m--;
|
||||
if (**s != '/' && **s != '-' && **s != DATESEP) return E_BAD_DATE;
|
||||
if (**s != '/' && **s != '-' && **s != DateSep) return E_BAD_DATE;
|
||||
(*s)++;
|
||||
if (!isdigit(**s)) return E_BAD_DATE;
|
||||
while (isdigit(**s)) {
|
||||
@@ -1119,6 +1187,23 @@ static int ParseLiteralDate(char **s, int *jul)
|
||||
|
||||
*jul = Julian(y, m, d);
|
||||
|
||||
/* Do we have a time part as well? */
|
||||
if (**s == ' ' || **s == '@') {
|
||||
(*s)++;
|
||||
while(isdigit(**s)) {
|
||||
hour *= 10;
|
||||
hour += *(*s)++ - '0';
|
||||
}
|
||||
if (**s != ':' && **s != '.' && **s != TimeSep) return E_BAD_TIME;
|
||||
(*s)++;
|
||||
while(isdigit(**s)) {
|
||||
min *= 10;
|
||||
min += *(*s)++ - '0';
|
||||
}
|
||||
if (hour > 23 || min > 59) return E_BAD_TIME;
|
||||
*tim = hour * 60 + min;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
14
src/expr.h
14
src/expr.h
@@ -10,14 +10,14 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: expr.h,v 1.4 2000-02-18 03:45:53 dfs Exp $ */
|
||||
|
||||
/* Define the types of values */
|
||||
#define ERR_TYPE 0
|
||||
#define INT_TYPE 1
|
||||
#define TIM_TYPE 2
|
||||
#define DATE_TYPE 3
|
||||
#define STR_TYPE 4
|
||||
#define ERR_TYPE 0
|
||||
#define INT_TYPE 1
|
||||
#define TIME_TYPE 2
|
||||
#define DATE_TYPE 3
|
||||
#define STR_TYPE 4
|
||||
#define DATETIME_TYPE 5
|
||||
#define SPECIAL_TYPE 6 /* Only for system variables */
|
||||
|
||||
/* Define stuff for parsing expressions */
|
||||
#define BEG_OF_EXPR '['
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: files.c,v 1.11 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
617
src/funcs.c
617
src/funcs.c
@@ -12,7 +12,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: funcs.c,v 1.10 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -51,6 +50,10 @@ static char const RCSID[] = "$Id: funcs.c,v 1.10 2005-09-30 03:29:32 dfs Exp $";
|
||||
#include "version.h"
|
||||
|
||||
/* Function prototypes */
|
||||
static int FCurrent (void);
|
||||
static int FTimepart(void);
|
||||
static int FDatepart(void);
|
||||
static int FRealCurrent(void);
|
||||
static int FAbs (void);
|
||||
static int FAccess (void);
|
||||
static int FArgs (void);
|
||||
@@ -60,12 +63,14 @@ static int FChar (void);
|
||||
static int FChoose (void);
|
||||
static int FCoerce (void);
|
||||
static int FDate (void);
|
||||
static int FDateTime (void);
|
||||
static int FDay (void);
|
||||
static int FDaysinmon (void);
|
||||
static int FDefined (void);
|
||||
static int FDosubst (void);
|
||||
static int FEasterdate (void);
|
||||
static int FFiledate (void);
|
||||
static int FFiledatetime (void);
|
||||
static int FFiledir (void);
|
||||
static int FFilename (void);
|
||||
static int FGetenv (void);
|
||||
@@ -84,6 +89,7 @@ static int FMin (void);
|
||||
static int FMinute (void);
|
||||
static int FMinsfromutc (void);
|
||||
static int FMoondate (void);
|
||||
static int FMoondatetime (void);
|
||||
static int FMoonphase (void);
|
||||
static int FMoontime (void);
|
||||
static int FMon (void);
|
||||
@@ -103,6 +109,7 @@ static int FSunset (void);
|
||||
static int FSunrise (void);
|
||||
static int FTime (void);
|
||||
static int FTrigdate (void);
|
||||
static int FTrigdatetime (void);
|
||||
static int FTrigtime (void);
|
||||
static int FTrigvalid (void);
|
||||
static int FTypeof (void);
|
||||
@@ -119,6 +126,7 @@ static int FRealnow (void);
|
||||
static int FRealtoday (void);
|
||||
static int FToday (void);
|
||||
static int FTrigger (void);
|
||||
static int FTzconvert (void);
|
||||
static int CheckArgs (Operator *f, int nargs);
|
||||
static int CleanUpAfterFunc (void);
|
||||
static int SunStuff (int rise, double cosz, int jul);
|
||||
@@ -154,6 +162,15 @@ extern int ValStackPtr;
|
||||
from 0 to (Nargs - 1) */
|
||||
#define ARG(x) (ValStack[ValStackPtr - Nargs + (x)])
|
||||
|
||||
/* Macro for getting date part of a date or datetime value */
|
||||
#define DATEPART(x) ((x).type == DATE_TYPE ? (x).v.val : ((x).v.val / MINUTES_PER_DAY))
|
||||
|
||||
/* Macro for getting time part of a time or datetime value */
|
||||
#define TIMEPART(x) ((x).type == TIME_TYPE ? (x).v.val : ((x).v.val % MINUTES_PER_DAY))
|
||||
|
||||
#define HASDATE(x) ((x).type == DATE_TYPE || (x).type == DATETIME_TYPE)
|
||||
#define HASTIME(x) ((x).type == TIME_TYPE || (x).type == DATETIME_TYPE)
|
||||
|
||||
/* Macro for copying a value while destroying original copy */
|
||||
#define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE )
|
||||
|
||||
@@ -173,7 +190,10 @@ Operator Func[] = {
|
||||
{ "char", 1, NO_MAX, FChar },
|
||||
{ "choose", 2, NO_MAX, FChoose },
|
||||
{ "coerce", 2, 2, FCoerce },
|
||||
{ "current", 0, 0, FCurrent },
|
||||
{ "date", 3, 3, FDate },
|
||||
{ "datepart", 1, 1, FDatepart },
|
||||
{ "datetime", 2, 5, FDateTime },
|
||||
{ "dawn", 0, 1, FDawn},
|
||||
{ "day", 1, 1, FDay },
|
||||
{ "daysinmon", 2, 2, FDaysinmon },
|
||||
@@ -182,6 +202,7 @@ Operator Func[] = {
|
||||
{ "dusk", 0, 1, FDusk },
|
||||
{ "easterdate", 1, 1, FEasterdate },
|
||||
{ "filedate", 1, 1, FFiledate },
|
||||
{ "filedatetime", 1, 1, FFiledatetime },
|
||||
{ "filedir", 0, 0, FFiledir },
|
||||
{ "filename", 0, 0, FFilename },
|
||||
{ "getenv", 1, 1, FGetenv },
|
||||
@@ -204,6 +225,7 @@ Operator Func[] = {
|
||||
{ "mon", 1, 1, FMon },
|
||||
{ "monnum", 1, 1, FMonnum },
|
||||
{ "moondate", 1, 3, FMoondate },
|
||||
{ "moondatetime", 1, 3, FMoondatetime },
|
||||
{ "moonphase", 0, 2, FMoonphase },
|
||||
{ "moontime", 1, 3, FMoontime },
|
||||
{ "now", 0, 0, FNow },
|
||||
@@ -212,6 +234,7 @@ Operator Func[] = {
|
||||
{ "plural", 1, 3, FPlural },
|
||||
{ "psmoon", 1, 4, FPsmoon},
|
||||
{ "psshade", 1, 3, FPsshade},
|
||||
{ "realcurrent", 0, 0, FRealCurrent},
|
||||
{ "realnow", 0, 0, FRealnow},
|
||||
{ "realtoday", 0, 0, FRealtoday },
|
||||
{ "sgn", 1, 1, FSgn },
|
||||
@@ -221,12 +244,15 @@ Operator Func[] = {
|
||||
{ "sunrise", 0, 1, FSunrise},
|
||||
{ "sunset", 0, 1, FSunset },
|
||||
{ "time", 2, 2, FTime },
|
||||
{ "timepart", 1, 1, FTimepart },
|
||||
{ "today", 0, 0, FToday },
|
||||
{ "trigdate", 0, 0, FTrigdate },
|
||||
{ "trigdatetime", 0, 0, FTrigdatetime },
|
||||
{ "trigger", 1, 3, FTrigger },
|
||||
{ "trigtime", 0, 0, FTrigtime },
|
||||
{ "trigvalid", 0, 0, FTrigvalid },
|
||||
{ "typeof", 1, 1, FTypeof },
|
||||
{ "tzconvert", 2, 3, FTzconvert },
|
||||
{ "upper", 1, 1, FUpper },
|
||||
{ "value", 1, 2, FValue },
|
||||
{ "version", 0, 0, FVersion },
|
||||
@@ -395,6 +421,69 @@ static int FDate(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FDateTime - make a datetime from one of these combos: */
|
||||
/* DATE, TIME */
|
||||
/* DATE, HOUR, MINUTE */
|
||||
/* YEAR, MONTH, DAY, TIME */
|
||||
/* YEAR, MONTH, DAY, HOUR, MINUTE */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FDateTime(void)
|
||||
{
|
||||
int y, m, d;
|
||||
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
|
||||
switch(Nargs) {
|
||||
case 2:
|
||||
if (ARG(0).type != DATE_TYPE ||
|
||||
ARG(1).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
RetVal.v.val = (MINUTES_PER_DAY * ARG(0).v.val) + ARG(1).v.val;
|
||||
return OK;
|
||||
case 3:
|
||||
if (ARG(0).type != DATE_TYPE ||
|
||||
ARG(1).type != INT_TYPE ||
|
||||
ARG(2).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(1).v.val < 0 || ARG(2).v.val < 0) return E_2LOW;
|
||||
if (ARG(1).v.val > 23 || ARG(2).v.val > 59) return E_2HIGH;
|
||||
RetVal.v.val = (MINUTES_PER_DAY * ARG(0).v.val) + 60 * ARG(1).v.val + ARG(2).v.val;
|
||||
return OK;
|
||||
case 4:
|
||||
if (ARG(0).type != INT_TYPE ||
|
||||
ARG(1).type != INT_TYPE ||
|
||||
ARG(2).type != INT_TYPE ||
|
||||
ARG(3).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
y = ARG(0).v.val;
|
||||
m = ARG(1).v.val - 1;
|
||||
d = ARG(2).v.val;
|
||||
|
||||
if (!DateOK(y, m, d)) return E_BAD_DATE;
|
||||
RetVal.v.val = Julian(y, m, d) * MINUTES_PER_DAY + ARG(3).v.val;
|
||||
return OK;
|
||||
case 5:
|
||||
if (ARG(0).type != INT_TYPE ||
|
||||
ARG(1).type != INT_TYPE ||
|
||||
ARG(2).type != INT_TYPE ||
|
||||
ARG(3).type != INT_TYPE ||
|
||||
ARG(4).type != INT_TYPE) return E_BAD_TYPE;
|
||||
|
||||
y = ARG(0).v.val;
|
||||
m = ARG(1).v.val - 1;
|
||||
d = ARG(2).v.val;
|
||||
if (!DateOK(y, m, d)) return E_BAD_DATE;
|
||||
|
||||
if (ARG(3).v.val < 0 || ARG(4).v.val < 0) return E_2LOW;
|
||||
if (ARG(3).v.val > 23 || ARG(4).v.val > 59) return E_2HIGH;
|
||||
RetVal.v.val = Julian(y, m, d) * MINUTES_PER_DAY + ARG(3).v.val * 60 + ARG(4).v.val;
|
||||
return OK;
|
||||
|
||||
default:
|
||||
return E_2MANY_ARGS;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FCoerce - type coercion function. */
|
||||
@@ -413,8 +502,9 @@ static int FCoerce(void)
|
||||
|
||||
if (! StrCmpi(s, "int")) return DoCoerce(INT_TYPE, &RetVal);
|
||||
else if (! StrCmpi(s, "date")) return DoCoerce(DATE_TYPE, &RetVal);
|
||||
else if (! StrCmpi(s, "time")) return DoCoerce(TIM_TYPE, &RetVal);
|
||||
else if (! StrCmpi(s, "time")) return DoCoerce(TIME_TYPE, &RetVal);
|
||||
else if (! StrCmpi(s, "string")) return DoCoerce(STR_TYPE, &RetVal);
|
||||
else if (! StrCmpi(s, "datetime")) return DoCoerce(DATETIME_TYPE, &RetVal);
|
||||
else return E_CANT_COERCE;
|
||||
}
|
||||
|
||||
@@ -545,13 +635,15 @@ static int FChar(void)
|
||||
/***************************************************************/
|
||||
static int FDay(void)
|
||||
{
|
||||
int y, m, d;
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).v.val == CacheJul)
|
||||
int y, m, d, v;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
if (v == CacheJul)
|
||||
d = CacheDay;
|
||||
else {
|
||||
FromJulian(ARG(0).v.val, &y, &m, &d);
|
||||
CacheJul = ARG(0).v.val;
|
||||
FromJulian(v, &y, &m, &d);
|
||||
CacheJul = v;
|
||||
CacheYear = y;
|
||||
CacheMon = m;
|
||||
CacheDay = d;
|
||||
@@ -563,13 +655,15 @@ static int FDay(void)
|
||||
|
||||
static int FMonnum(void)
|
||||
{
|
||||
int y, m, d;
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).v.val == CacheJul)
|
||||
int y, m, d, v;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
if (v == CacheJul)
|
||||
m = CacheMon;
|
||||
else {
|
||||
FromJulian(ARG(0).v.val, &y, &m, &d);
|
||||
CacheJul = ARG(0).v.val;
|
||||
FromJulian(v, &y, &m, &d);
|
||||
CacheJul = v;
|
||||
CacheYear = y;
|
||||
CacheMon = m;
|
||||
CacheDay = d;
|
||||
@@ -581,13 +675,15 @@ static int FMonnum(void)
|
||||
|
||||
static int FYear(void)
|
||||
{
|
||||
int y, m, d;
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).v.val == CacheJul)
|
||||
int y, m, d, v;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
if (v == CacheJul)
|
||||
y = CacheYear;
|
||||
else {
|
||||
FromJulian(ARG(0).v.val, &y, &m, &d);
|
||||
CacheJul = ARG(0).v.val;
|
||||
FromJulian(v, &y, &m, &d);
|
||||
CacheJul = v;
|
||||
CacheYear = y;
|
||||
CacheMon = m;
|
||||
CacheDay = d;
|
||||
@@ -599,11 +695,14 @@ static int FYear(void)
|
||||
|
||||
static int FWkdaynum(void)
|
||||
{
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
int v;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
RetVal.type = INT_TYPE;
|
||||
|
||||
/* Correct so that 0 = Sunday */
|
||||
RetVal.v.val = (ARG(0).v.val+1) % 7;
|
||||
RetVal.v.val = (v+1) % 7;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -611,7 +710,7 @@ static int FWkday(void)
|
||||
{
|
||||
char *s;
|
||||
|
||||
if (ARG(0).type != DATE_TYPE && ARG(0).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (!HASDATE(ARG(0)) && ARG(0).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).type == INT_TYPE) {
|
||||
if (ARG(0).v.val < 0) return E_2LOW;
|
||||
if (ARG(0).v.val > 6) return E_2HIGH;
|
||||
@@ -619,27 +718,28 @@ static int FWkday(void)
|
||||
ARG(0).v.val--;
|
||||
if (ARG(0).v.val < 0) ARG(0).v.val = 6;
|
||||
s = DayName[ARG(0).v.val];
|
||||
} else s = DayName[ARG(0).v.val % 7];
|
||||
} else s = DayName[DATEPART(ARG(0)) % 7];
|
||||
return RetStrVal(s);
|
||||
}
|
||||
|
||||
static int FMon(void)
|
||||
{
|
||||
char *s;
|
||||
int y, m, d;
|
||||
int y, m, d, v;
|
||||
|
||||
if (!HASDATE(ARG(0)) && ARG(0).type != INT_TYPE) return E_BAD_TYPE;
|
||||
|
||||
if (ARG(0).type != DATE_TYPE && ARG(0).type != INT_TYPE)
|
||||
return E_BAD_TYPE;
|
||||
if (ARG(0).type == INT_TYPE) {
|
||||
m = ARG(0).v.val - 1;
|
||||
if (m < 0) return E_2LOW;
|
||||
if (m > 11) return E_2HIGH;
|
||||
} else {
|
||||
if (ARG(0).v.val == CacheJul)
|
||||
v = DATEPART(ARG(0));
|
||||
if (v == CacheJul)
|
||||
m = CacheMon;
|
||||
else {
|
||||
FromJulian(ARG(0).v.val, &y, &m, &d);
|
||||
CacheJul = ARG(0).v.val;
|
||||
FromJulian(v, &y, &m, &d);
|
||||
CacheJul = v;
|
||||
CacheYear = y;
|
||||
CacheMon = m;
|
||||
CacheDay = d;
|
||||
@@ -658,17 +758,21 @@ static int FMon(void)
|
||||
/***************************************************************/
|
||||
static int FHour(void)
|
||||
{
|
||||
if (ARG(0).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
int v;
|
||||
if (!HASTIME(ARG(0))) return E_BAD_TYPE;
|
||||
v = TIMEPART(ARG(0));
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = ARG(0).v.val / 60;
|
||||
RetVal.v.val = v / 60;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FMinute(void)
|
||||
{
|
||||
if (ARG(0).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
int v;
|
||||
if (!HASTIME(ARG(0))) return E_BAD_TYPE;
|
||||
v = TIMEPART(ARG(0));
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = ARG(0).v.val % 60;
|
||||
RetVal.v.val = v % 60;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -682,7 +786,7 @@ static int FTime(void)
|
||||
m = ARG(1).v.val;
|
||||
if (h<0 || m<0) return E_2LOW;
|
||||
if (h>23 || m>59) return E_2HIGH;
|
||||
RetVal.type = TIM_TYPE;
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = h*60 + m;
|
||||
return OK;
|
||||
}
|
||||
@@ -885,17 +989,32 @@ static int FRealtoday(void)
|
||||
|
||||
static int FNow(void)
|
||||
{
|
||||
RetVal.type = TIM_TYPE;
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = (int) ( SystemTime(0) / 60L );
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FRealnow(void)
|
||||
{
|
||||
RetVal.type = TIM_TYPE;
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = (int) ( SystemTime(1) / 60L );
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FCurrent(void)
|
||||
{
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RetVal.v.val = JulianToday * MINUTES_PER_DAY + (SystemTime(0) / 60);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FRealCurrent(void)
|
||||
{
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RetVal.v.val = RealToday * MINUTES_PER_DAY + (SystemTime(1) / 60);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FGetenv - get the value of an environment variable. */
|
||||
@@ -966,8 +1085,13 @@ static int FDefined(void)
|
||||
/***************************************************************/
|
||||
static int FTrigdate(void)
|
||||
{
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = LastTriggerDate;
|
||||
if (LastTrigValid) {
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = LastTriggerDate;
|
||||
} else {
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -980,8 +1104,28 @@ static int FTrigvalid(void)
|
||||
|
||||
static int FTrigtime(void)
|
||||
{
|
||||
RetVal.type = TIM_TYPE;
|
||||
RetVal.v.val = LastTriggerTime;
|
||||
if (LastTriggerTime != NO_TIME) {
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = LastTriggerTime;
|
||||
} else {
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigdatetime(void)
|
||||
{
|
||||
if (!LastTrigValid) {
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = 0;
|
||||
} else if (LastTriggerTime != NO_TIME) {
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RetVal.v.val = LastTriggerDate * MINUTES_PER_DAY + LastTriggerTime;
|
||||
} else {
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = LastTriggerDate;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1016,11 +1160,11 @@ static int FIsleap(void)
|
||||
{
|
||||
int y, m, d;
|
||||
|
||||
if (ARG(0).type != INT_TYPE && ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).type != INT_TYPE && !HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
|
||||
/* If it's a date, extract the year */
|
||||
if (ARG(0).type == DATE_TYPE)
|
||||
FromJulian(ARG(0).v.val, &y, &m, &d);
|
||||
if (HASDATE(ARG(0)))
|
||||
FromJulian(DATEPART(ARG(0)), &y, &m, &d);
|
||||
else
|
||||
y = ARG(0).v.val;
|
||||
|
||||
@@ -1039,27 +1183,51 @@ static int FIsleap(void)
|
||||
static int FTrigger(void)
|
||||
{
|
||||
int y, m, d;
|
||||
int date, time;
|
||||
char buf[40];
|
||||
int date, tim;
|
||||
char buf[128];
|
||||
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
date = ARG(0).v.val;
|
||||
if (Nargs > 2) {
|
||||
if (ARG(2).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(1).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(2).v.val) {
|
||||
UTCToLocal(ARG(0).v.val, ARG(1).v.val, &date, &time);
|
||||
} else {
|
||||
date = ARG(0).v.val;
|
||||
time = ARG(1).v.val;
|
||||
tim = NO_TIME;
|
||||
if (ARG(0).type != DATE_TYPE &&
|
||||
ARG(0).type != DATETIME_TYPE) return E_BAD_TYPE;
|
||||
|
||||
if (ARG(0).type == DATE_TYPE) {
|
||||
date = ARG(0).v.val;
|
||||
} else {
|
||||
date = ARG(0).v.val / MINUTES_PER_DAY;
|
||||
tim = ARG(0).v.val % MINUTES_PER_DAY;
|
||||
}
|
||||
|
||||
if (ARG(0).type == DATE_TYPE) {
|
||||
if (Nargs > 2) {
|
||||
/* Date Time UTCFlag */
|
||||
if (ARG(0).type == DATETIME_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(2).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(1).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
tim = ARG(1).v.val;
|
||||
if (ARG(2).v.val) {
|
||||
UTCToLocal(date, tim, &date, &tim);
|
||||
}
|
||||
} else if (Nargs > 1) {
|
||||
/* Date Time */
|
||||
if (ARG(1).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
tim = ARG(1).v.val;
|
||||
}
|
||||
} else {
|
||||
if (Nargs > 2) {
|
||||
return E_2MANY_ARGS;
|
||||
} else if (Nargs > 1) {
|
||||
/* DateTime UTCFlag */
|
||||
if (ARG(1).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(1).v.val) {
|
||||
UTCToLocal(date, tim, &date, &tim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FromJulian(date, &y, &m, &d);
|
||||
if (Nargs > 1) {
|
||||
if (ARG(1).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
if (Nargs == 2) time = ARG(1).v.val;
|
||||
if (tim != NO_TIME) {
|
||||
sprintf(buf, "%d %s %d AT %02d:%02d", d, EnglishMonthName[m], y,
|
||||
time/60, time%60);
|
||||
tim/60, tim%60);
|
||||
} else {
|
||||
sprintf(buf, "%d %s %d", d, EnglishMonthName[m], y);
|
||||
}
|
||||
@@ -1130,9 +1298,9 @@ static int FShell(void)
|
||||
/***************************************************************/
|
||||
static int FIsomitted(void)
|
||||
{
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = IsOmitted(ARG(0).v.val, 0);
|
||||
RetVal.v.val = IsOmitted(DATEPART(ARG(0)), 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1330,8 +1498,9 @@ static int FTypeof(void)
|
||||
switch(ARG(0).type) {
|
||||
case INT_TYPE: return RetStrVal("INT");
|
||||
case DATE_TYPE: return RetStrVal("DATE");
|
||||
case TIM_TYPE: return RetStrVal("TIME");
|
||||
case TIME_TYPE: return RetStrVal("TIME");
|
||||
case STR_TYPE: return RetStrVal("STRING");
|
||||
case DATETIME_TYPE: return RetStrVal("DATETIME");
|
||||
default: return RetStrVal("ERR");
|
||||
}
|
||||
}
|
||||
@@ -1381,10 +1550,18 @@ static int FDosubst(void)
|
||||
tim = NO_TIME;
|
||||
if (ARG(0).type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (Nargs >= 2) {
|
||||
if (ARG(1).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
jul = ARG(1).v.val;
|
||||
if (ARG(1).type == DATETIME_TYPE) {
|
||||
jul = DATEPART(ARG(1));
|
||||
tim = TIMEPART(ARG(1));
|
||||
} else {
|
||||
if (ARG(1).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
jul = ARG(1).v.val;
|
||||
}
|
||||
if (Nargs >= 3) {
|
||||
if (ARG(2).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(1).type == DATETIME_TYPE) {
|
||||
return E_2MANY_ARGS;
|
||||
}
|
||||
if (ARG(2).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
tim = ARG(2).v.val;
|
||||
}
|
||||
}
|
||||
@@ -1450,8 +1627,8 @@ static int FHebdate(void)
|
||||
RetVal.v.val = r;
|
||||
RetVal.type = DATE_TYPE;
|
||||
return OK;
|
||||
} else if (ARG(2).type == DATE_TYPE) {
|
||||
r = GetNextHebrewDate(ARG(2).v.val, mon, day, jahr, adarbehave, &ans);
|
||||
} else if (HASDATE(ARG(2))) {
|
||||
r = GetNextHebrewDate(DATEPART(ARG(2)), mon, day, jahr, adarbehave, &ans);
|
||||
if (r) return r;
|
||||
RetVal.v.val = ans;
|
||||
RetVal.type = DATE_TYPE;
|
||||
@@ -1461,14 +1638,15 @@ static int FHebdate(void)
|
||||
|
||||
static int FHebday(void)
|
||||
{
|
||||
int y, m, d;
|
||||
int y, m, d, v;
|
||||
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).v.val == CacheHebJul)
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
if (v == CacheHebJul)
|
||||
d = CacheHebDay;
|
||||
else {
|
||||
JulToHeb(ARG(0).v.val, &y, &m, &d);
|
||||
CacheHebJul = ARG(0).v.val;
|
||||
JulToHeb(v, &y, &m, &d);
|
||||
CacheHebJul = v;
|
||||
CacheHebYear = y;
|
||||
CacheHebMon = m;
|
||||
CacheHebDay = d;
|
||||
@@ -1480,15 +1658,17 @@ static int FHebday(void)
|
||||
|
||||
static int FHebmon(void)
|
||||
{
|
||||
int y, m, d;
|
||||
int y, m, d, v;
|
||||
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).v.val == CacheHebJul) {
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
if (v == CacheHebJul) {
|
||||
m = CacheHebMon;
|
||||
y = CacheHebYear;
|
||||
} else {
|
||||
JulToHeb(ARG(0).v.val, &y, &m, &d);
|
||||
CacheHebJul = ARG(0).v.val;
|
||||
JulToHeb(v, &y, &m, &d);
|
||||
CacheHebJul = v;
|
||||
CacheHebYear = y;
|
||||
CacheHebMon = m;
|
||||
CacheHebDay = d;
|
||||
@@ -1498,14 +1678,16 @@ static int FHebmon(void)
|
||||
|
||||
static int FHebyear(void)
|
||||
{
|
||||
int y, m, d;
|
||||
int y, m, d, v;
|
||||
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).v.val == CacheHebJul)
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
v = DATEPART(ARG(0));
|
||||
|
||||
if (v == CacheHebJul)
|
||||
y = CacheHebYear;
|
||||
else {
|
||||
JulToHeb(ARG(0).v.val, &y, &m, &d);
|
||||
CacheHebJul = ARG(0).v.val;
|
||||
JulToHeb(v, &y, &m, &d);
|
||||
CacheHebJul = v;
|
||||
CacheHebYear = y;
|
||||
CacheHebMon = m;
|
||||
CacheHebDay = d;
|
||||
@@ -1536,8 +1718,8 @@ static int FEasterdate(void)
|
||||
y = ARG(0).v.val;
|
||||
if (y < BASE) return E_2LOW;
|
||||
else if (y > BASE+YR_RANGE) return E_2HIGH;
|
||||
} else if (ARG(0).type == DATE_TYPE) {
|
||||
FromJulian(ARG(0).v.val, &y, &m, &d); /* We just want the year */
|
||||
} else if (HASDATE(ARG(0))) {
|
||||
FromJulian(DATEPART(ARG(0)), &y, &m, &d); /* We just want the year */
|
||||
} else return E_BAD_TYPE;
|
||||
|
||||
do {
|
||||
@@ -1561,7 +1743,7 @@ static int FEasterdate(void)
|
||||
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = Julian(y, m, d);
|
||||
y++; } while (ARG(0).type == DATE_TYPE && RetVal.v.val < ARG(0).v.val);
|
||||
y++; } while (HASDATE(ARG(0)) && RetVal.v.val < DATEPART(ARG(0)));
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -1593,10 +1775,14 @@ static int FTimeStuff(int wantmins)
|
||||
tim = 0;
|
||||
|
||||
if (Nargs >= 1) {
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
jul = ARG(0).v.val;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
jul = DATEPART(ARG(0));
|
||||
if (HASTIME(ARG(0))) {
|
||||
tim = TIMEPART(ARG(0));
|
||||
}
|
||||
if (Nargs >= 2) {
|
||||
if (ARG(1).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
if (HASTIME(ARG(0))) return E_2MANY_ARGS;
|
||||
if (ARG(1).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
tim = ARG(1).v.val;
|
||||
}
|
||||
}
|
||||
@@ -1753,24 +1939,24 @@ static int FSun(int rise)
|
||||
int r;
|
||||
|
||||
if (Nargs >= 1) {
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
jul = ARG(0).v.val;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
jul = DATEPART(ARG(0));
|
||||
}
|
||||
|
||||
|
||||
r = SunStuff(rise, cosz, jul);
|
||||
if (r == NO_TIME) {
|
||||
RetVal.v.val = 0;
|
||||
RetVal.type = INT_TYPE;
|
||||
} else if (r == -NO_TIME) {
|
||||
RetVal.v.val = 1440;
|
||||
RetVal.v.val = MINUTES_PER_DAY;
|
||||
RetVal.type = INT_TYPE;
|
||||
} else {
|
||||
RetVal.v.val = r;
|
||||
RetVal.type = TIM_TYPE;
|
||||
RetVal.type = TIME_TYPE;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
static int FSunrise(void)
|
||||
{
|
||||
return FSun(1);
|
||||
@@ -1820,6 +2006,37 @@ static int FFiledate(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FFiledatetime */
|
||||
/* */
|
||||
/* Return modification datetime of a file */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int FFiledatetime(void)
|
||||
{
|
||||
struct stat statbuf;
|
||||
struct tm *t1;
|
||||
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
|
||||
if (ARG(0).type != STR_TYPE) return E_BAD_TYPE;
|
||||
|
||||
if (stat(ARG(0).v.str, &statbuf)) {
|
||||
RetVal.v.val = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
t1 = localtime(&(statbuf.st_mtime));
|
||||
|
||||
if (t1->tm_year + 1900 < BASE)
|
||||
RetVal.v.val=0;
|
||||
else
|
||||
RetVal.v.val = MINUTES_PER_DAY * Julian(t1->tm_year+1900, t1->tm_mon, t1->tm_mday) + t1->tm_hour * 60 + t1->tm_min;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FPsshade */
|
||||
@@ -1965,12 +2182,17 @@ static int FMoonphase(void)
|
||||
time = 0;
|
||||
break;
|
||||
case 1:
|
||||
if (ARG(0).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
date = ARG(0).v.val;
|
||||
time = 0;
|
||||
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
|
||||
date = DATEPART(ARG(0));
|
||||
if (HASTIME(ARG(0))) {
|
||||
time = TIMEPART(ARG(0));
|
||||
} else {
|
||||
time = 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (ARG(0).type != DATE_TYPE && ARG(1).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).type == DATETIME_TYPE) return E_2MANY_ARGS;
|
||||
if (ARG(0).type != DATE_TYPE && ARG(1).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
date = ARG(0).v.val;
|
||||
time = ARG(1).v.val;
|
||||
break;
|
||||
@@ -1993,15 +2215,20 @@ static int FMoonphase(void)
|
||||
static int MoonStuff (int want_time);
|
||||
static int FMoondate(void)
|
||||
{
|
||||
return MoonStuff(0);
|
||||
return MoonStuff(DATE_TYPE);
|
||||
}
|
||||
|
||||
static int FMoontime(void)
|
||||
{
|
||||
return MoonStuff(1);
|
||||
return MoonStuff(TIME_TYPE);
|
||||
}
|
||||
|
||||
static int MoonStuff(int want_time)
|
||||
static int FMoondatetime(void)
|
||||
{
|
||||
return MoonStuff(DATETIME_TYPE);
|
||||
}
|
||||
|
||||
static int MoonStuff(int type_wanted)
|
||||
{
|
||||
int startdate, starttim;
|
||||
int d, t;
|
||||
@@ -2013,23 +2240,201 @@ static int MoonStuff(int want_time)
|
||||
if (ARG(0).v.val < 0) return E_2LOW;
|
||||
if (ARG(0).v.val > 3) return E_2HIGH;
|
||||
if (Nargs >= 2) {
|
||||
if (ARG(1).type != DATE_TYPE) return E_BAD_TYPE;
|
||||
startdate = ARG(1).v.val;
|
||||
if (!HASDATE(ARG(1))) return E_BAD_TYPE;
|
||||
startdate = DATEPART(ARG(1));
|
||||
if (HASTIME(ARG(1))) {
|
||||
starttim = TIMEPART(ARG(1));
|
||||
}
|
||||
|
||||
if (Nargs >= 3) {
|
||||
if (ARG(2).type != TIM_TYPE) return E_BAD_TYPE;
|
||||
if (HASTIME(ARG(1))) return E_2MANY_ARGS;
|
||||
if (ARG(2).type != TIME_TYPE) return E_BAD_TYPE;
|
||||
starttim = ARG(2).v.val;
|
||||
}
|
||||
}
|
||||
|
||||
HuntPhase(startdate, starttim, ARG(0).v.val, &d, &t);
|
||||
if (want_time) {
|
||||
RetVal.type = TIM_TYPE;
|
||||
RetVal.type = type_wanted;
|
||||
switch(type_wanted) {
|
||||
case TIME_TYPE:
|
||||
RetVal.v.val = t;
|
||||
} else {
|
||||
RetVal.type = DATE_TYPE;
|
||||
break;
|
||||
case DATE_TYPE:
|
||||
RetVal.v.val = d;
|
||||
break;
|
||||
case DATETIME_TYPE:
|
||||
RetVal.v.val = d * MINUTES_PER_DAY + t;
|
||||
break;
|
||||
default:
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTimepart(void)
|
||||
{
|
||||
if (ARG(0).type != DATETIME_TYPE) return E_BAD_TYPE;
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = TIMEPART(ARG(0));
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FDatepart(void)
|
||||
{
|
||||
if (ARG(0).type != DATETIME_TYPE) return E_BAD_TYPE;
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = DATEPART(ARG(0));
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SETENV
|
||||
/* This is NOT a general-purpose replacement for setenv. It's only
|
||||
* used for the timezone stuff! */
|
||||
static int setenv(char const *varname, char const *val, int overwrite)
|
||||
{
|
||||
static char tzbuf[256];
|
||||
if (strcmp(varname, "TZ")) {
|
||||
fprintf(stderr, "built-in setenv can only be used with TZ\n");
|
||||
abort();
|
||||
}
|
||||
if (!overwrite) {
|
||||
fprintf(stderr, "built-in setenv must have overwrite=1\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
if (strlen(val) > 250) {
|
||||
return -1;
|
||||
}
|
||||
sprintf(tzbuf, "%s=%s", varname, val);
|
||||
return(putenv(tzbuf));
|
||||
}
|
||||
#endif
|
||||
#ifndef HAVE_UNSETENV
|
||||
/* This is NOT a general-purpose replacement for unsetenv. It's only
|
||||
* used for the timezone stuff! */
|
||||
static void unsetenv(char const *varname)
|
||||
{
|
||||
static char tzbuf[8];
|
||||
if (strcmp(varname, "TZ")) {
|
||||
fprintf(stderr, "built-in unsetenv can only be used with TZ\n");
|
||||
abort();
|
||||
}
|
||||
sprintf(tzbuf, "%s", varname);
|
||||
putenv(tzbuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* FTz */
|
||||
/* */
|
||||
/* Conversion between different timezones. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static int tz_set_tz(char const *tz)
|
||||
{
|
||||
int r;
|
||||
if (tz == NULL) {
|
||||
unsetenv("TZ");
|
||||
r = 0;
|
||||
} else {
|
||||
r = setenv("TZ", tz, 1);
|
||||
}
|
||||
tzset();
|
||||
return r;
|
||||
}
|
||||
|
||||
static int tz_convert(int year, int month, int day,
|
||||
int hour, int minute,
|
||||
char const *src_tz, char const *tgt_tz,
|
||||
struct tm *tm)
|
||||
{
|
||||
int r;
|
||||
time_t t;
|
||||
struct tm *res;
|
||||
char *old_tz;
|
||||
|
||||
/* init tm struct */
|
||||
tm->tm_sec = 0;
|
||||
tm->tm_min = minute;
|
||||
tm->tm_hour = hour;
|
||||
tm->tm_mday = day;
|
||||
tm->tm_mon = month;
|
||||
tm->tm_year = year - 1900;
|
||||
tm->tm_wday = 0; /* ignored by mktime */
|
||||
tm->tm_yday = 0; /* ignored by mktime */
|
||||
tm->tm_isdst = -1; /* information not available */
|
||||
|
||||
/* backup old TZ env var */
|
||||
old_tz = getenv("TZ");
|
||||
if (tgt_tz == NULL) {
|
||||
tgt_tz = old_tz;
|
||||
}
|
||||
|
||||
/* set source TZ */
|
||||
r = tz_set_tz(src_tz);
|
||||
if (r == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* create timestamp in UTC */
|
||||
t = mktime(tm);
|
||||
|
||||
if (t == (time_t) -1) {
|
||||
tz_set_tz(old_tz);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* set target TZ */
|
||||
r = tz_set_tz(tgt_tz);
|
||||
if (r == -1) {
|
||||
tz_set_tz(old_tz);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* convert to target TZ */
|
||||
res = localtime_r(&t, tm);
|
||||
|
||||
/* restore old TZ */
|
||||
tz_set_tz(old_tz);
|
||||
|
||||
/* return result */
|
||||
if (res == NULL) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int FTzconvert(void)
|
||||
{
|
||||
int year, month, day, hour, minute, r;
|
||||
int jul, tim;
|
||||
struct tm tm;
|
||||
|
||||
if (ARG(0).type != DATETIME_TYPE ||
|
||||
ARG(1).type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (Nargs == 3 && ARG(2).type != STR_TYPE) return E_BAD_TYPE;
|
||||
|
||||
FromJulian(DATEPART(ARG(0)), &year, &month, &day);
|
||||
|
||||
r = TIMEPART(ARG(0));
|
||||
hour = r / 60;
|
||||
minute = r % 60;
|
||||
|
||||
if (Nargs == 2) {
|
||||
r = tz_convert(year, month, day, hour, minute,
|
||||
ARG(1).v.str, NULL, &tm);
|
||||
} else {
|
||||
r = tz_convert(year, month, day, hour, minute,
|
||||
ARG(1).v.str, ARG(2).v.str, &tm);
|
||||
}
|
||||
|
||||
if (r == -1) return E_CANT_CONVERT_TZ;
|
||||
|
||||
jul = Julian(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday);
|
||||
tim = tm.tm_hour * 60 + tm.tm_min;
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RetVal.v.val = jul * MINUTES_PER_DAY + tim;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: globals.c,v 1.4 2000-02-18 03:45:56 dfs Exp $";
|
||||
|
||||
#include <stdio.h> /* For defintion of FILE - sigh! */
|
||||
#include "types.h"
|
||||
#include "custom.h"
|
||||
#define MK_GLOBALS
|
||||
#include "globals.h"
|
||||
#include "err.h"
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: globals.h,v 1.9 2005-09-30 03:29:32 dfs Exp $ */
|
||||
|
||||
#ifdef MK_GLOBALS
|
||||
#undef EXTERN
|
||||
#define EXTERN
|
||||
@@ -24,6 +22,8 @@
|
||||
#define INIT(var, val) var
|
||||
#endif
|
||||
|
||||
#define MINUTES_PER_DAY 1440
|
||||
|
||||
#define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
|
||||
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
|
||||
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
|
||||
@@ -42,6 +42,7 @@ EXTERN INIT( int ShowAllErrors, 0);
|
||||
EXTERN INIT( int DebugFlag, 0);
|
||||
EXTERN INIT( int DoCalendar, 0);
|
||||
EXTERN INIT( int DoSimpleCalendar, 0);
|
||||
EXTERN INIT( int DoSimpleCalDelta, 0);
|
||||
EXTERN INIT( int DoPrefixLineNo, 0);
|
||||
EXTERN INIT( int MondayFirst, 0);
|
||||
EXTERN INIT( int Iterations, 1);
|
||||
@@ -68,8 +69,9 @@ EXTERN INIT( int DontQueue, 0);
|
||||
EXTERN INIT( int NumQueued, 0);
|
||||
EXTERN INIT( int DontIssueAts, 0);
|
||||
EXTERN INIT( int Daemon, 0);
|
||||
|
||||
|
||||
EXTERN INIT( char DateSep, DATESEP);
|
||||
EXTERN INIT( char TimeSep, TIMESEP);
|
||||
EXTERN INIT( int SynthesizeTags, 0);
|
||||
EXTERN INIT( int ScFormat, SC_AMPM);
|
||||
EXTERN INIT( int MaxSatIter, 150);
|
||||
EXTERN INIT( char *FileName, NULL);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: hbcal.c,v 1.5 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h> /* For FILE used by protos.h - sigh. */
|
||||
#include "types.h"
|
||||
|
||||
23
src/init.c
23
src/init.c
@@ -8,12 +8,11 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* Copyright (C) 1999-2005 by Roaring Penguin Software Inc. */
|
||||
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: init.c,v 1.16 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#define L_IN_INIT 1
|
||||
#include <stdio.h>
|
||||
@@ -170,6 +169,11 @@ void InitRemind(int argc, char *argv[])
|
||||
IgnoreOnce = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
case 'Y':
|
||||
SynthesizeTags = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
case 'T':
|
||||
InfiniteDelta = 1;
|
||||
@@ -258,6 +262,10 @@ void InitRemind(int argc, char *argv[])
|
||||
case 's':
|
||||
case 'S':
|
||||
DoSimpleCalendar = 1;
|
||||
if (*arg == 'a' || *arg == 'A') {
|
||||
DoSimpleCalDelta = 1;
|
||||
arg++;
|
||||
}
|
||||
if (*arg == '+') {
|
||||
arg++;
|
||||
PARSENUM(CalWeeks, arg);
|
||||
@@ -272,6 +280,10 @@ void InitRemind(int argc, char *argv[])
|
||||
case 'P':
|
||||
DoSimpleCalendar = 1;
|
||||
PsCal = 1;
|
||||
if (*arg == 'a' || *arg == 'A') {
|
||||
DoSimpleCalDelta = 1;
|
||||
arg++;
|
||||
}
|
||||
PARSENUM(CalMonths, arg);
|
||||
if (!CalMonths) CalMonths = 1;
|
||||
break;
|
||||
@@ -444,7 +456,7 @@ void InitRemind(int argc, char *argv[])
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "Copyright 1999-2005 Roaring Penguin Software Inc.\n");
|
||||
fprintf(ErrFp, "Copyright 1999-2007 Roaring Penguin Software Inc.\n");
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
@@ -455,8 +467,8 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -c[n] Produce a calendar for n (default 1) months\n");
|
||||
fprintf(ErrFp, " -c+[n] Produce a calendar for n (default 1) weeks\n");
|
||||
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");
|
||||
fprintf(ErrFp, " -s[+][n] Produce `simple calendar' for n (1) months (weeks)\n");
|
||||
fprintf(ErrFp, " -p[n] Same as -s, but input compatible with rem2ps\n");
|
||||
fprintf(ErrFp, " -s[a][+][n] Produce `simple calendar' for n (1) months (weeks)\n");
|
||||
fprintf(ErrFp, " -p[a][n] Same as -s, but input compatible with rem2ps\n");
|
||||
fprintf(ErrFp, " -l Prefix each simple calendar line with line number and filename comment\n");
|
||||
fprintf(ErrFp, " -v Verbose mode\n");
|
||||
fprintf(ErrFp, " -o Ignore ONCE directives\n");
|
||||
@@ -474,6 +486,7 @@ void Usage(void)
|
||||
fprintf(ErrFp, " -g[ddd] Sort reminders by date, time and priority before issuing\n");
|
||||
fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
|
||||
fprintf(ErrFp, " -m Start calendar with Monday rather than Sunday\n");
|
||||
fprintf(ErrFp, " -y Synthesize tags for tagless reminders\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif /* L_USAGE_OVERRIDE */
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: lang.h,v 1.6 2000-12-18 14:05:32 dfs Exp $ */
|
||||
|
||||
/* I'm chauvinistic and name each language with its English name... */
|
||||
|
||||
#define ENGLISH 0 /* original by David F. Skoll */
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: danish.h,v 1.7 2000-02-18 03:46:17 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Danish"
|
||||
|
||||
@@ -103,11 +101,11 @@
|
||||
#define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " om natten" : " om formiddagen" : (hour > 17) ? " om aftenen" : " om eftermiddagen";
|
||||
#define L_ORDINAL_OVERRIDE plu = ".";
|
||||
#define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
|
||||
#define L_E_OVER sprintf(s, "den %02d%c%02d%c%04d", d, DATESEP, m+1, DATESEP, y);
|
||||
#define L_F_OVER sprintf(s, "den %02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
|
||||
#define L_E_OVER sprintf(s, "den %02d%c%02d%c%04d", d, DateSep, m+1, DateSep, y);
|
||||
#define L_F_OVER sprintf(s, "den %02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
|
||||
#define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
|
||||
#define L_H_OVER sprintf(s, "den %02d%c%02d", d, DATESEP, m+1);
|
||||
#define L_I_OVER sprintf(s, "den %02d%c%02d", m+1, DATESEP, d);
|
||||
#define L_H_OVER sprintf(s, "den %02d%c%02d", d, DateSep, m+1);
|
||||
#define L_I_OVER sprintf(s, "den %02d%c%02d", m+1, DateSep, d);
|
||||
#define L_U_OVER L_A_OVER
|
||||
#define L_V_OVER L_G_OVER
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: dutch.h,v 1.5 2000-02-18 03:46:18 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Dutch"
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: english.h,v 1.5 2000-02-18 03:46:19 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "English"
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: finnish.h,v 1.10 2000-02-18 03:53:49 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Finnish"
|
||||
|
||||
@@ -166,18 +164,18 @@
|
||||
#define L_A_OVER sprintf(s, "%s%s %d. %s%s %d", DayName[jul%7], L_ON, d, \
|
||||
MonthName[m], L_PARTIT, y);
|
||||
#define L_C_OVER sprintf(s, "%s%s", DayName[jul%7], L_ON);
|
||||
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DATESEP, m+1, DATESEP, \
|
||||
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, \
|
||||
y);
|
||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
|
||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
|
||||
#define L_G_OVER sprintf(s, "%s%s %d. %s%s", DayName[jul%7], L_ON, d, \
|
||||
MonthName[m], L_PARTIT);
|
||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DATESEP, m+1);
|
||||
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DATESEP, d);
|
||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DateSep, m+1);
|
||||
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DateSep, d);
|
||||
#define L_J_OVER sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, \
|
||||
MonthName[m], d, plu, y);
|
||||
#define L_K_OVER sprintf(s, "%s%s %sn %d%s", DayName[jul%7], L_ON, \
|
||||
MonthName[m], d, plu);
|
||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
||||
#define L_Q_OVER sprintf(s, "n");
|
||||
#define L_U_OVER sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, \
|
||||
d, plu, MonthName[m], L_PARTIT, y);
|
||||
@@ -284,7 +282,7 @@ EXTERN char *ErrMsg[] =
|
||||
"AT-sanan per\xE4st\xE4 puuttuu aika",
|
||||
"UNTIL-sanaa k\xE4ytetty kahdesti",
|
||||
"Ep\xE4t\xE4ydellinen p\xE4iv\xE4ys",
|
||||
"SCANFROM-sanaa k\xE4ytetty kahdesti",
|
||||
"FROM/SCANFROM-sanaa k\xE4ytetty kahdesti",
|
||||
"Muuttuja",
|
||||
"Arvo",
|
||||
"*M\xC4\xC4RITTELEM\xC4T\xD6N*",
|
||||
@@ -308,7 +306,8 @@ EXTERN char *ErrMsg[] =
|
||||
"Ei viestej\xE4.",
|
||||
"%d viesti(\xE4) t\xE4m\xE4n p\xE4iv\xE4n jonossa.\n",
|
||||
"Numero puuttuu",
|
||||
"Virheellinen funktio WARN-lausekkeessa"
|
||||
"Virheellinen funktio WARN-lausekkeessa",
|
||||
"Can't convert between time zones"
|
||||
|
||||
#elif IBMEXTENDED
|
||||
"Ok",
|
||||
@@ -385,7 +384,7 @@ EXTERN char *ErrMsg[] =
|
||||
"AT-sanan per\x84st\x84 puuttuu aika",
|
||||
"UNTIL-sanaa k\x84ytetty kahdesti",
|
||||
"Ep\x84t\x84ydellinen p\x84iv\x84ys",
|
||||
"SCANFROM-sanaa k\x84ytetty kahdesti",
|
||||
"FROM/SCANFROM-sanaa k\x84ytetty kahdesti",
|
||||
"Muuttuja",
|
||||
"Arvo",
|
||||
"*M\x8E\x8ERITTELEM\x8ET\x99N*",
|
||||
@@ -409,7 +408,8 @@ EXTERN char *ErrMsg[] =
|
||||
"Ei viestej\x84.",
|
||||
"%d viesti(\x84) t\x84m\x84n p\x84iv\x84n jonossa.\n",
|
||||
"Numero puuttuu"
|
||||
"Virheellinen funktio WARN-lausekkeessa"
|
||||
"Virheellinen funktio WARN-lausekkeessa",
|
||||
"Can't convert between time zones"
|
||||
#else
|
||||
"Ok",
|
||||
"Puuttuva ']'",
|
||||
@@ -485,7 +485,7 @@ EXTERN char *ErrMsg[] =
|
||||
"AT-sanan per{st{ puuttuu aika",
|
||||
"UNTIL-sanaa k{ytetty kahdesti",
|
||||
"Ep{t{ydellinen p{iv{ys",
|
||||
"SCANFROM-sanaa k{ytetty kahdesti",
|
||||
"FROM/SCANFROM-sanaa k{ytetty kahdesti",
|
||||
"Muuttuja",
|
||||
"Arvo",
|
||||
"*M[[RITTELEM[T\\N*",
|
||||
@@ -509,7 +509,9 @@ EXTERN char *ErrMsg[] =
|
||||
"Ei viestej{.",
|
||||
"%d viesti({) t{m{n p{iv{n jonossa.\n",
|
||||
"Numero puuttuu",
|
||||
"Virheellinen funktio WARN-lausekkeessa"
|
||||
"Virheellinen funktio WARN-lausekkeessa",
|
||||
"Can't convert between time zones"
|
||||
|
||||
#endif
|
||||
};
|
||||
#endif /* MK_GLOBALS */
|
||||
@@ -517,11 +519,7 @@ EXTERN char *ErrMsg[] =
|
||||
/* The following is only used in init.c */
|
||||
#ifdef L_IN_INIT
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void Usage(void)
|
||||
#else
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: french.h,v 1.9 2000-02-18 03:53:50 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "French"
|
||||
|
||||
@@ -221,7 +219,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Heure attendue apr\350s AT",
|
||||
"Mot-cl\351 UNTIL utilis\351 deux fois",
|
||||
"Sp\351cification de date incompl\350te",
|
||||
"Mot-cl\351 SCANFROM utilis\351 deux fois",
|
||||
"Mot-cl\351 FROM/SCANFROM utilis\351 deux fois",
|
||||
"Variable",
|
||||
"Valeur",
|
||||
"*NON-DEFINI*",
|
||||
@@ -245,7 +243,8 @@ EXTERN char *ErrMsg[] =
|
||||
"Pas de rappels.",
|
||||
"%d rappel(s) en file pour aujourd'hui.\n",
|
||||
"Nombre attendu",
|
||||
"Fonction ill\351gale apr\350s WARN"
|
||||
"Fonction ill\351gale apr\350s WARN",
|
||||
"Can't convert between time zones"
|
||||
#else /* ISOLATIN1 */
|
||||
"Ok",
|
||||
"']' manquant",
|
||||
@@ -321,7 +320,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Heure attendue apres AT",
|
||||
"Mot-cle UNTIL utilise deux fois",
|
||||
"Specification de date incomplete",
|
||||
"Mot-cle SCANFROM utilise deux fois",
|
||||
"Mot-cle FROM/SCANFROM utilise deux fois",
|
||||
"Variable",
|
||||
"Valeur",
|
||||
"*NON-DEFINI*",
|
||||
@@ -345,7 +344,8 @@ EXTERN char *ErrMsg[] =
|
||||
"Pas de rappels.",
|
||||
"%d rappel(s) en file pour aujourd'hui.\n",
|
||||
"Nombre attendu",
|
||||
"Fonction illegale apres WARN"
|
||||
"Fonction illegale apres WARN",
|
||||
"Can't convert between time zones"
|
||||
#endif /* ISOLATIN1 */
|
||||
};
|
||||
#endif /* MK_GLOBALS */
|
||||
@@ -353,11 +353,7 @@ EXTERN char *ErrMsg[] =
|
||||
/* The following is only used in init.c */
|
||||
#ifdef L_IN_INIT
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void Usage(void)
|
||||
#else
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: german.h,v 1.6 2000-02-18 03:46:22 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "German"
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: icelandic.h,v 1.1 2000-12-18 14:05:33 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Icelandic"
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: italian.h,v 1.6 2000-02-18 03:46:23 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Italian"
|
||||
|
||||
@@ -108,23 +106,23 @@
|
||||
MonthName[m], y);
|
||||
#define L_C_OVER sprintf(s, "%s", DayName[jul%7]);
|
||||
|
||||
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DATESEP,\
|
||||
m+1, DATESEP, y);
|
||||
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep,\
|
||||
m+1, DateSep, y);
|
||||
|
||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
|
||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
|
||||
|
||||
#define L_G_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, MonthName[m]);
|
||||
|
||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DATESEP, m+1);
|
||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DateSep, m+1);
|
||||
|
||||
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DATESEP, d);
|
||||
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DateSep, d);
|
||||
|
||||
#define L_J_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, \
|
||||
MonthName[m], y);
|
||||
|
||||
#define L_K_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, \
|
||||
MonthName[m]);
|
||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
||||
|
||||
#define L_U_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, \
|
||||
MonthName[m], y);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: norwgian.h,v 1.6 2000-02-18 03:46:24 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Norwegian"
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: polish.h,v 1.9 2000-02-18 03:53:51 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Polish"
|
||||
|
||||
@@ -256,7 +254,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Po AT oczekiwany jest czas",
|
||||
"S\263owo UNTIL u\277yte dw\363krotnie",
|
||||
"Niekompletna specyfikacja daty",
|
||||
"S\263owo SCANFROM u\277yte dw\363krotnie",
|
||||
"S\263owo FROM/SCANFROM u\277yte dw\363krotnie",
|
||||
"Zmienna",
|
||||
"Warto\266\346",
|
||||
"*NIE ZDEFINIOWANE*",
|
||||
@@ -280,7 +278,8 @@ EXTERN char *ErrMsg[] =
|
||||
"Brak przypomnie\361.",
|
||||
"%d Przypomnienia zakolejkowane na p\363\274niej.\n",
|
||||
"Spodziewana liczba",
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)"
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)",
|
||||
"Can't convert between time zones"
|
||||
#else /* ISOLATIN1 */
|
||||
"OK",
|
||||
"Brakujacy ']'",
|
||||
@@ -356,7 +355,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Po AT oczekiwany jest czas",
|
||||
"Slowo UNTIL uzyte dwokrotnie",
|
||||
"Niekompletna specyfikacja daty",
|
||||
"Slowo SCANFROM uzyte dwokrotnie",
|
||||
"Slowo FROM/SCANFROM uzyte dwokrotnie",
|
||||
"Zmienna",
|
||||
"Wartosc",
|
||||
"*UNDEFINED*",
|
||||
@@ -380,7 +379,8 @@ EXTERN char *ErrMsg[] =
|
||||
"Brak przypomnien.",
|
||||
"%d Przypomnienia zakolejkowane na pozniej.\n",
|
||||
"Spodziewana liczba",
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)"
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)",
|
||||
"Can't convert between time zones"
|
||||
#endif /* ISOLATIN1 */
|
||||
};
|
||||
#endif /* MK_GLOBALS */
|
||||
@@ -388,11 +388,7 @@ EXTERN char *ErrMsg[] =
|
||||
/* The following is only used in init.c */
|
||||
#ifdef L_IN_INIT
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void Usage(void)
|
||||
#else
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: portbr.h,v 1.8 2000-02-18 03:53:52 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Brazilian Portuguese"
|
||||
|
||||
@@ -222,7 +220,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Esperando hora apos AT",
|
||||
"Keyword UNTIL usada duas vezes",
|
||||
"Especificacao de data incompleta",
|
||||
"Keyword SCANFROM usada duas vezes",
|
||||
"Keyword FROM/SCANFROM usada duas vezes",
|
||||
"Variavel",
|
||||
"Valor",
|
||||
"*INDEFINIDO*",
|
||||
@@ -246,18 +244,15 @@ EXTERN char *ErrMsg[] =
|
||||
"Sem compromissos.",
|
||||
"%d compromisso(s) colocados na fila para mais tarde.\n",
|
||||
"Esperando numero",
|
||||
"Funcao ilegal na clausula WARN"
|
||||
"Funcao ilegal na clausula WARN",
|
||||
"Can't convert between time zones"
|
||||
};
|
||||
#endif /* MK_GLOBALS */
|
||||
|
||||
/* The following is only used in init.c */
|
||||
#ifdef L_IN_INIT
|
||||
#define L_USAGE_OVERRIDE 1
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void Usage(void)
|
||||
#else
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
void Usage(void)
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "(C) 1999-2000 Roaring Penguin Software Inc.\n");
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: romanian.h,v 1.6 2000-02-18 03:46:27 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Romanian"
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: spanish.h,v 1.3 2000-02-18 03:46:28 dfs Exp $ */
|
||||
|
||||
#define L_LANGNAME "Spanish"
|
||||
|
||||
/* Nombres de los di'as de la semana */
|
||||
|
||||
13
src/main.c
13
src/main.c
@@ -12,7 +12,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: main.c,v 1.14 2005-10-16 14:48:02 dfs Exp $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -1171,10 +1170,10 @@ void LocalToUTC(int locdate, int loctime, int *utcdate, int *utctime)
|
||||
|
||||
loctime -= diff;
|
||||
if (loctime < 0) {
|
||||
loctime += 1440;
|
||||
loctime += MINUTES_PER_DAY;
|
||||
locdate--;
|
||||
} else if (loctime >= 1440) {
|
||||
loctime -= 1440;
|
||||
} else if (loctime >= MINUTES_PER_DAY) {
|
||||
loctime -= MINUTES_PER_DAY;
|
||||
locdate++;
|
||||
}
|
||||
*utcdate = locdate;
|
||||
@@ -1199,10 +1198,10 @@ void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
|
||||
|
||||
utctime += diff;
|
||||
if (utctime < 0) {
|
||||
utctime += 1440;
|
||||
utctime += MINUTES_PER_DAY;
|
||||
utcdate--;
|
||||
} else if (utctime >= 1440) {
|
||||
utctime -= 1440;
|
||||
} else if (utctime >= MINUTES_PER_DAY) {
|
||||
utctime -= MINUTES_PER_DAY;
|
||||
utcdate++;
|
||||
}
|
||||
*locdate = utcdate;
|
||||
|
||||
249
src/md5.c
Normal file
249
src/md5.c
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* LIC: GPL
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
#include <string.h> /* for memcpy() */
|
||||
#include "md5.h"
|
||||
|
||||
static void byteReverse(unsigned char *buf, unsigned longs);
|
||||
|
||||
/*
|
||||
* Note: this code is harmless on little-endian machines.
|
||||
*/
|
||||
static void
|
||||
byteReverse(unsigned char *buf, unsigned longs)
|
||||
{
|
||||
uint32 t;
|
||||
do {
|
||||
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(uint32 *) buf = t;
|
||||
buf += 4;
|
||||
} while (--longs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Init(struct MD5Context *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bits[0] = 0;
|
||||
ctx->bits[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
||||
{
|
||||
uint32 t;
|
||||
|
||||
/* Update bitcount */
|
||||
|
||||
t = ctx->bits[0];
|
||||
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
|
||||
ctx->bits[1]++; /* Carry from low to high */
|
||||
ctx->bits[1] += len >> 29;
|
||||
|
||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||
|
||||
/* Handle any leading odd-sized chunks */
|
||||
|
||||
if (t) {
|
||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||
|
||||
t = 64 - t;
|
||||
if (len < t) {
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
/* Process data in 64-byte chunks */
|
||||
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
|
||||
memcpy(ctx->in, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||
|
||||
/* Set the first char of padding to 0x80. This is safe since there is
|
||||
always at least one byte free */
|
||||
p = ctx->in + count;
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 64 bytes */
|
||||
count = 64 - 1 - count;
|
||||
|
||||
/* Pad out to 56 mod 64 */
|
||||
if (count < 8) {
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in, 0, 56);
|
||||
} else {
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
}
|
||||
byteReverse(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
((uint32 *) ctx->in)[14] = ctx->bits[0];
|
||||
((uint32 *) ctx->in)[15] = ctx->bits[1];
|
||||
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
#ifndef ASM_MD5
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void MD5Transform(uint32 buf[4], uint32 const in[16])
|
||||
{
|
||||
register uint32 a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
#endif
|
||||
34
src/md5.h
Normal file
34
src/md5.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
/*
|
||||
* LIC: GPL
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if SIZEOF_UNSIGNED_INT == 4
|
||||
typedef unsigned int uint32;
|
||||
#elif SIZEOF_UNSIGNED_LONG == 4
|
||||
typedef unsigned long uint32;
|
||||
#else
|
||||
# error Could not find a 32-bit integer type
|
||||
#endif
|
||||
|
||||
struct MD5Context {
|
||||
uint32 buf[4];
|
||||
uint32 bits[2];
|
||||
unsigned char in[64];
|
||||
};
|
||||
|
||||
void MD5Init(struct MD5Context *context);
|
||||
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
||||
unsigned len);
|
||||
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
||||
void MD5Transform(uint32 buf[4], uint32 const in[16]);
|
||||
|
||||
/*
|
||||
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
||||
*/
|
||||
typedef struct MD5Context MD5_CTX;
|
||||
|
||||
#endif /* !MD5_H */
|
||||
@@ -11,7 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: moon.c,v 1.6 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
/* All of these routines were adapted from the program "moontool"
|
||||
by John Walker, February 1988. Here's the blurb from moontool:
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: omit.c,v 1.7 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: protos.h,v 1.10 2005-09-30 03:29:32 dfs Exp $ */
|
||||
|
||||
/* Define a string assignment macro - be careful!!! */
|
||||
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
|
||||
|
||||
@@ -134,4 +132,4 @@ void HuntPhase (int startdate, int starttim, int phas, int *date, int *time);
|
||||
int CompareRems (int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio);
|
||||
void SigIntHandler (int d);
|
||||
void GotSigInt (void);
|
||||
|
||||
void SynthesizeTag(char *);
|
||||
|
||||
29
src/queue.c
29
src/queue.c
@@ -11,7 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: queue.c,v 1.18 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
/* Solaris needs this to get select() prototype */
|
||||
#ifdef __sun__
|
||||
@@ -96,6 +95,9 @@ int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
qelem->ntrig = 0;
|
||||
strcpy(qelem->sched, sched);
|
||||
strcpy(qelem->tag, trig->tag);
|
||||
if (! *qelem->tag && SynthesizeTags) {
|
||||
SynthesizeTag(qelem->tag);
|
||||
}
|
||||
QueueHead = qelem;
|
||||
return OK;
|
||||
}
|
||||
@@ -110,7 +112,7 @@ int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
void HandleQueuedReminders(void)
|
||||
{
|
||||
QueuedRem *q = QueueHead;
|
||||
long TimeToSleep;
|
||||
int TimeToSleep;
|
||||
unsigned SleepTime;
|
||||
Parser p;
|
||||
Trigger trig;
|
||||
@@ -164,16 +166,16 @@ void HandleQueuedReminders(void)
|
||||
if (Daemon && !q) {
|
||||
if (Daemon < 0) {
|
||||
/* Sleep until midnight */
|
||||
TimeToSleep = (long) 1440*60L - SystemTime(0);
|
||||
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
|
||||
} else {
|
||||
TimeToSleep = (long) 60*Daemon;
|
||||
TimeToSleep = 60*Daemon;
|
||||
}
|
||||
} else {
|
||||
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
|
||||
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
|
||||
}
|
||||
|
||||
while (TimeToSleep > 0L) {
|
||||
SleepTime = (unsigned) ((TimeToSleep > 30000L) ? 30000 : TimeToSleep);
|
||||
SleepTime = TimeToSleep;
|
||||
|
||||
if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
|
||||
|
||||
@@ -188,12 +190,12 @@ void HandleQueuedReminders(void)
|
||||
if (Daemon && !q) {
|
||||
if (Daemon < 0) {
|
||||
/* Sleep until midnight */
|
||||
TimeToSleep = (long) 1440*60L - SystemTime(0);
|
||||
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
|
||||
} else {
|
||||
TimeToSleep = (long) 60*Daemon;
|
||||
TimeToSleep = 60*Daemon;
|
||||
}
|
||||
} else {
|
||||
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
|
||||
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -227,6 +229,7 @@ void HandleQueuedReminders(void)
|
||||
|
||||
/* Calculate the next trigger time */
|
||||
q->tt.nexttime = CalculateNextTime(q);
|
||||
DestroyParser(&p);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
@@ -314,8 +317,8 @@ void GotSigInt(void)
|
||||
while (q) {
|
||||
if (q->tt.nexttime != NO_TIME) {
|
||||
printf("Trigger: %02d%c%02d Activate: %02d%c%02d Rep: %d Delta: %d Sched: %s",
|
||||
q->tt.ttime / 60, TIMESEP, q->tt.ttime % 60,
|
||||
q->tt.nexttime / 60, TIMESEP, q->tt.nexttime % 60,
|
||||
q->tt.ttime / 60, TimeSep, q->tt.ttime % 60,
|
||||
q->tt.nexttime / 60, TimeSep, q->tt.nexttime % 60,
|
||||
q->tt.rep, q->tt.delta, q->sched);
|
||||
if (*q->sched) printf("(%d)", q->ntrig+1);
|
||||
printf("%s", NL);
|
||||
@@ -382,7 +385,7 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
|
||||
q->sched[0] = 0;
|
||||
return NO_TIME;
|
||||
}
|
||||
if (v.type == TIM_TYPE) {
|
||||
if (v.type == TIME_TYPE) {
|
||||
ThisTime = v.v.val;
|
||||
} else if (v.type == INT_TYPE) {
|
||||
if (v.v.val > 0)
|
||||
@@ -396,7 +399,7 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
|
||||
return NO_TIME;
|
||||
}
|
||||
if (ThisTime < 0) ThisTime = 0; /* Can't be less than 00:00 */
|
||||
if (ThisTime > 1439) ThisTime = 1439; /* or greater than 11:59 */
|
||||
if (ThisTime > (MINUTES_PER_DAY-1)) ThisTime = (MINUTES_PER_DAY-1); /* or greater than 11:59 */
|
||||
if (ThisTime > q->tt.nexttime) return ThisTime;
|
||||
if (ThisTime <= LastTime) {
|
||||
q->sched[0] = 0;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "dynbuf.h"
|
||||
static char const RCSID[] = "$Id: rem2ps.c,v 1.14 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -601,7 +600,6 @@ void WriteOneEntry(CalEntry *c)
|
||||
PutChar(')');
|
||||
while(isspace((unsigned char)*s)) s++;
|
||||
if (!*s) {
|
||||
printf("]\n");
|
||||
goto finish;
|
||||
}
|
||||
PutChar('(');
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: rem2ps.h,v 1.5 2004-08-11 01:55:32 dfs Exp $ */
|
||||
|
||||
char *PSProlog1[] =
|
||||
{
|
||||
"% This file was produced by Remind and Rem2PS, written by",
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: sort.c,v 1.8 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: token.c,v 1.13 2005-11-20 01:26:59 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -61,6 +60,7 @@ Token TokArray[] = {
|
||||
{ "february", 3, T_Month, 1 },
|
||||
{ "flush", 5, T_Flush, 0 },
|
||||
{ "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 },
|
||||
@@ -87,7 +87,7 @@ Token TokArray[] = {
|
||||
{ "run", 3, T_RemType, RUN_TYPE },
|
||||
{ "satisfy", 7, T_RemType, SAT_TYPE },
|
||||
{ "saturday", 3, T_WkDay, 5 },
|
||||
{ "scanfrom", 4, T_Scanfrom, 0 },
|
||||
{ "scanfrom", 4, T_Scanfrom, SCANFROM_TYPE },
|
||||
{ "sched", 5, T_Sched, 0 },
|
||||
{ "september", 3, T_Month, 8 },
|
||||
{ "set", 3, T_Set, 0 },
|
||||
@@ -278,7 +278,7 @@ void FindNumericToken(const char *s, Token *t)
|
||||
return;
|
||||
}
|
||||
/* If we hit a colon or a period, we've probably got a time hr:min */
|
||||
if (*s == ':' || *s == '.' || *s == TIMESEP) {
|
||||
if (*s == ':' || *s == '.' || *s == TimeSep) {
|
||||
s++;
|
||||
hour = t->val;
|
||||
PARSENUM(min, s);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: trigger.c,v 1.6 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -357,6 +355,7 @@ int ComputeTrigger(int today, Trigger *trig, int *err)
|
||||
result;
|
||||
|
||||
LastTrigValid = 0;
|
||||
|
||||
/* Assume everything works */
|
||||
*err = OK;
|
||||
|
||||
|
||||
12
src/types.h
12
src/types.h
@@ -10,8 +10,6 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: types.h,v 1.7 2005-11-20 01:26:59 dfs Exp $ */
|
||||
|
||||
#include <limits.h>
|
||||
#include "dynbuf.h"
|
||||
|
||||
@@ -169,8 +167,10 @@ typedef struct {
|
||||
#define IF_ELSE_MASK 2
|
||||
|
||||
/* Flags for the DoSubst function */
|
||||
#define NORMAL_MODE 0
|
||||
#define CAL_MODE 1
|
||||
#define NORMAL_MODE 0
|
||||
#define CAL_MODE 1
|
||||
#define ADVANCE_MODE 2
|
||||
|
||||
#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
|
||||
|
||||
/* Flags for disabling run */
|
||||
@@ -187,3 +187,7 @@ typedef struct {
|
||||
#define SORT_NONE 0
|
||||
#define SORT_ASCEND 1
|
||||
#define SORT_DESCEND 2
|
||||
|
||||
/* Flags for FROM / SCANFROM */
|
||||
#define SCANFROM_TYPE 0
|
||||
#define FROM_TYPE 1
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: userfns.c,v 1.7 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: utils.c,v 1.7 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
88
src/var.c
88
src/var.c
@@ -7,12 +7,11 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: var.c,v 1.10 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -35,6 +34,46 @@ static char const RCSID[] = "$Id: var.c,v 1.10 2005-09-30 03:29:32 dfs Exp $";
|
||||
|
||||
static Var *VHashTbl[VAR_HASH_SIZE];
|
||||
|
||||
typedef int (*SysVarFunc)(int, Value *);
|
||||
|
||||
static int date_sep_func(int do_set, Value *val)
|
||||
{
|
||||
if (!do_set) {
|
||||
val->v.str = malloc(2);
|
||||
if (!val->v.str) return E_NO_MEM;
|
||||
val->v.str[0] = DateSep;
|
||||
val->v.str[1] = 0;
|
||||
val->type = STR_TYPE;
|
||||
return OK;
|
||||
}
|
||||
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (strcmp(val->v.str, "/") &&
|
||||
strcmp(val->v.str, "-")) {
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
DateSep = val->v.str[0];
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int time_sep_func(int do_set, Value *val)
|
||||
{
|
||||
if (!do_set) {
|
||||
val->v.str = malloc(2);
|
||||
if (!val->v.str) return E_NO_MEM;
|
||||
val->v.str[0] = TimeSep;
|
||||
val->v.str[1] = 0;
|
||||
val->type = STR_TYPE;
|
||||
return OK;
|
||||
}
|
||||
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (strcmp(val->v.str, ":") &&
|
||||
strcmp(val->v.str, ".")) {
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
TimeSep = val->v.str[0];
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* HashVal */
|
||||
@@ -414,13 +453,15 @@ typedef struct {
|
||||
#define been_malloced min
|
||||
|
||||
/* Flag for no min/max constraint */
|
||||
#define ANY 4532
|
||||
#define ANY -31415926
|
||||
|
||||
/* All of the system variables sorted alphabetically */
|
||||
static SysVar SysVarArr[] = {
|
||||
/* name mod type value min/mal max */
|
||||
{ "CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1 },
|
||||
{ "CalMode", 0, INT_TYPE, &DoCalendar, 0, 0 },
|
||||
{ "Daemon", 0, INT_TYPE, &Daemon, 0, 0 },
|
||||
{ "DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0 },
|
||||
{ "DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999 },
|
||||
{ "DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
|
||||
{ "DontQueue", 0, INT_TYPE, &DontQueue, 0, 0 },
|
||||
@@ -446,13 +487,14 @@ static SysVar SysVarArr[] = {
|
||||
{ "NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
|
||||
{ "NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
|
||||
{ "PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo,0, 0 },
|
||||
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
|
||||
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
|
||||
{ "RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
|
||||
{ "SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
|
||||
{ "SortByDate", 0, INT_TYPE, &SortByDate, 0, 0},
|
||||
{ "SortByPrio", 0, INT_TYPE, &SortByPrio, 0, 0},
|
||||
{ "SortByTime", 0, INT_TYPE, &SortByTime, 0, 0},
|
||||
{ "SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132}
|
||||
{ "SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132},
|
||||
{ "TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 }
|
||||
};
|
||||
|
||||
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
|
||||
@@ -469,14 +511,18 @@ int SetSysVar(const char *name, Value *value)
|
||||
{
|
||||
SysVar *v = FindSysVar(name);
|
||||
if (!v) return E_NOSUCH_VAR;
|
||||
if (v->type != value->type) return E_BAD_TYPE;
|
||||
if (v->type != SPECIAL_TYPE &&
|
||||
v->type != value->type) return E_BAD_TYPE;
|
||||
if (!v->modifiable) {
|
||||
Eprint("%s: `$%s'", ErrMsg[E_CANT_MODIFY], name);
|
||||
return E_CANT_MODIFY;
|
||||
}
|
||||
|
||||
/* If it's a string variable, special measures must be taken */
|
||||
if (v->type == STR_TYPE) {
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
return f(1, value);
|
||||
} 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)));
|
||||
v->been_malloced = 1;
|
||||
*((char **) v->value) = value->v.str;
|
||||
@@ -502,7 +548,10 @@ int GetSysVar(const char *name, Value *val)
|
||||
|
||||
val->type = ERR_TYPE;
|
||||
if (!v) return E_NOSUCH_VAR;
|
||||
if (v->type == STR_TYPE) {
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
return f(0, val);
|
||||
} else if (v->type == STR_TYPE) {
|
||||
val->v.str = StrDup(*((char **) v->value));
|
||||
if (!val->v.str) return E_NO_MEM;
|
||||
} else {
|
||||
@@ -583,13 +632,28 @@ static void DumpSysVar(const char *name, const SysVar *v)
|
||||
|
||||
buffer[0]='$'; buffer[1] = 0;
|
||||
if (name) strcat(buffer, name); else strcat(buffer, v->name);
|
||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, buffer);
|
||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN+1, buffer);
|
||||
if (v) {
|
||||
if (v->type == STR_TYPE) {
|
||||
if (v->type == SPECIAL_TYPE) {
|
||||
Value val;
|
||||
SysVarFunc f = (SysVarFunc) v->value;
|
||||
f(0, &val);
|
||||
if (DoCoerce(STR_TYPE, &val) == OK) {
|
||||
fprintf(ErrFp, "\"%s\"\n", val.v.str);
|
||||
}
|
||||
DestroyValue(val);
|
||||
} else if (v->type == STR_TYPE) {
|
||||
char *s = *((char **)v->value);
|
||||
int y;
|
||||
Putc('"', ErrFp);
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) Putc(*s++, ErrFp);
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) {
|
||||
if (*s == '"') {
|
||||
fprintf(ErrFp, "\" + char(34) + \"");
|
||||
s++;
|
||||
} else {
|
||||
Putc(*s++, ErrFp);
|
||||
}
|
||||
}
|
||||
Putc('"', ErrFp);
|
||||
if (*s) fprintf(ErrFp, "...");
|
||||
Putc('\n', ErrFp);
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: version.h,v 1.12 2005-09-30 03:29:33 dfs Exp $ */
|
||||
#define VERSION "03.00.24"
|
||||
#define VERSION "03.01.00"
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# TEST-REM
|
||||
#
|
||||
# $Id: test-rem,v 1.4 2000-02-18 03:46:29 dfs Exp $
|
||||
#
|
||||
# This file runs an acceptance test for Remind. To use it, type:
|
||||
# sh test-rem OR make test
|
||||
# in the build directory.
|
||||
|
||||
@@ -1,830 +0,0 @@
|
||||
# Test file for REMIND
|
||||
#
|
||||
# Use this file to test the date calculation routines
|
||||
# of the REMIND program by typing:
|
||||
#
|
||||
# ./test-rem # From WITHIN Remind source directory!
|
||||
|
||||
REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
|
||||
test.rem(8): Trig = Saturday, 16 February, 1991
|
||||
Reminders for Saturday, 16th February, 1991:
|
||||
|
||||
today() => 1991/02/16
|
||||
hebday(1991/02/16) => 2
|
||||
today() => 1991/02/16
|
||||
hebmon(1991/02/16) => "Adar"
|
||||
today() => 1991/02/16
|
||||
hebyear(1991/02/16) => 5751
|
||||
Today is 2 Adar 5751
|
||||
|
||||
fset _h(x, y) trigger(hebdate(x,y))
|
||||
|
||||
[_h(1, "Tishrey")] MSG Rosh Hashana 1
|
||||
Entering UserFN _h(1, "Tishrey")
|
||||
x => 1
|
||||
y => "Tishrey"
|
||||
hebdate(1, "Tishrey") => 1991/09/09
|
||||
trigger(1991/09/09) => "9 September 1991"
|
||||
Leaving UserFN _h() => "9 September 1991"
|
||||
test.rem(11): Trig = Monday, 9 September, 1991
|
||||
[_h(2, "Tishrey")] MSG Rosh Hashana 2
|
||||
Entering UserFN _h(2, "Tishrey")
|
||||
x => 2
|
||||
y => "Tishrey"
|
||||
hebdate(2, "Tishrey") => 1991/09/10
|
||||
trigger(1991/09/10) => "10 September 1991"
|
||||
Leaving UserFN _h() => "10 September 1991"
|
||||
test.rem(12): Trig = Tuesday, 10 September, 1991
|
||||
[_h(3, "Tishrey")] MSG Tzom Gedalia
|
||||
Entering UserFN _h(3, "Tishrey")
|
||||
x => 3
|
||||
y => "Tishrey"
|
||||
hebdate(3, "Tishrey") => 1991/09/11
|
||||
trigger(1991/09/11) => "11 September 1991"
|
||||
Leaving UserFN _h() => "11 September 1991"
|
||||
test.rem(13): Trig = Wednesday, 11 September, 1991
|
||||
[_h(10, "Tishrey")] MSG Yom Kippur
|
||||
Entering UserFN _h(10, "Tishrey")
|
||||
x => 10
|
||||
y => "Tishrey"
|
||||
hebdate(10, "Tishrey") => 1991/09/18
|
||||
trigger(1991/09/18) => "18 September 1991"
|
||||
Leaving UserFN _h() => "18 September 1991"
|
||||
test.rem(14): Trig = Wednesday, 18 September, 1991
|
||||
[_h(15, "Tishrey")] MSG Sukkot 1
|
||||
Entering UserFN _h(15, "Tishrey")
|
||||
x => 15
|
||||
y => "Tishrey"
|
||||
hebdate(15, "Tishrey") => 1991/09/23
|
||||
trigger(1991/09/23) => "23 September 1991"
|
||||
Leaving UserFN _h() => "23 September 1991"
|
||||
test.rem(15): Trig = Monday, 23 September, 1991
|
||||
[_h(25, "Kislev")] MSG Channuka
|
||||
Entering UserFN _h(25, "Kislev")
|
||||
x => 25
|
||||
y => "Kislev"
|
||||
hebdate(25, "Kislev") => 1991/12/02
|
||||
trigger(1991/12/02) => "2 December 1991"
|
||||
Leaving UserFN _h() => "2 December 1991"
|
||||
test.rem(16): Trig = Monday, 2 December, 1991
|
||||
[_h(10, "Tevet")] MSG Asara B'Tevet
|
||||
Entering UserFN _h(10, "Tevet")
|
||||
x => 10
|
||||
y => "Tevet"
|
||||
hebdate(10, "Tevet") => 1991/12/17
|
||||
trigger(1991/12/17) => "17 December 1991"
|
||||
Leaving UserFN _h() => "17 December 1991"
|
||||
test.rem(17): Trig = Tuesday, 17 December, 1991
|
||||
[_h(15, "Shvat")] MSG Tu B'Shvat
|
||||
Entering UserFN _h(15, "Shvat")
|
||||
x => 15
|
||||
y => "Shvat"
|
||||
hebdate(15, "Shvat") => 1992/01/20
|
||||
trigger(1992/01/20) => "20 January 1992"
|
||||
Leaving UserFN _h() => "20 January 1992"
|
||||
test.rem(18): Trig = Monday, 20 January, 1992
|
||||
[_h(15, "Adar A")] MSG Purim Katan
|
||||
Entering UserFN _h(15, "Adar A")
|
||||
x => 15
|
||||
y => "Adar A"
|
||||
hebdate(15, "Adar A") => 1992/02/19
|
||||
trigger(1992/02/19) => "19 February 1992"
|
||||
Leaving UserFN _h() => "19 February 1992"
|
||||
test.rem(19): Trig = Wednesday, 19 February, 1992
|
||||
[_h(14, "Adar")] MSG Purim
|
||||
Entering UserFN _h(14, "Adar")
|
||||
x => 14
|
||||
y => "Adar"
|
||||
hebdate(14, "Adar") => 1991/02/28
|
||||
trigger(1991/02/28) => "28 February 1991"
|
||||
Leaving UserFN _h() => "28 February 1991"
|
||||
test.rem(20): Trig = Thursday, 28 February, 1991
|
||||
[_h(15, "Nisan")] MSG Pesach
|
||||
Entering UserFN _h(15, "Nisan")
|
||||
x => 15
|
||||
y => "Nisan"
|
||||
hebdate(15, "Nisan") => 1991/03/30
|
||||
trigger(1991/03/30) => "30 March 1991"
|
||||
Leaving UserFN _h() => "30 March 1991"
|
||||
test.rem(21): Trig = Saturday, 30 March, 1991
|
||||
[_h(27, "Nisan")] MSG Yom HaShoah
|
||||
Entering UserFN _h(27, "Nisan")
|
||||
x => 27
|
||||
y => "Nisan"
|
||||
hebdate(27, "Nisan") => 1991/04/11
|
||||
trigger(1991/04/11) => "11 April 1991"
|
||||
Leaving UserFN _h() => "11 April 1991"
|
||||
test.rem(22): Trig = Thursday, 11 April, 1991
|
||||
[_h(4, "Iyar")] MSG Yom HaZikaron
|
||||
Entering UserFN _h(4, "Iyar")
|
||||
x => 4
|
||||
y => "Iyar"
|
||||
hebdate(4, "Iyar") => 1991/04/18
|
||||
trigger(1991/04/18) => "18 April 1991"
|
||||
Leaving UserFN _h() => "18 April 1991"
|
||||
test.rem(23): Trig = Thursday, 18 April, 1991
|
||||
[_h(5, "Iyar")] MSG Yom Ha'atzmaut
|
||||
Entering UserFN _h(5, "Iyar")
|
||||
x => 5
|
||||
y => "Iyar"
|
||||
hebdate(5, "Iyar") => 1991/04/19
|
||||
trigger(1991/04/19) => "19 April 1991"
|
||||
Leaving UserFN _h() => "19 April 1991"
|
||||
test.rem(24): Trig = Friday, 19 April, 1991
|
||||
[_h(28, "Iyar")] MSG Yom Yerushalayim
|
||||
Entering UserFN _h(28, "Iyar")
|
||||
x => 28
|
||||
y => "Iyar"
|
||||
hebdate(28, "Iyar") => 1991/05/12
|
||||
trigger(1991/05/12) => "12 May 1991"
|
||||
Leaving UserFN _h() => "12 May 1991"
|
||||
test.rem(25): Trig = Sunday, 12 May, 1991
|
||||
[_h(6, "Sivan")] MSG Shavuot
|
||||
Entering UserFN _h(6, "Sivan")
|
||||
x => 6
|
||||
y => "Sivan"
|
||||
hebdate(6, "Sivan") => 1991/05/19
|
||||
trigger(1991/05/19) => "19 May 1991"
|
||||
Leaving UserFN _h() => "19 May 1991"
|
||||
test.rem(26): Trig = Sunday, 19 May, 1991
|
||||
[_h(9, "Av")] MSG Tish'a B'Av
|
||||
Entering UserFN _h(9, "Av")
|
||||
x => 9
|
||||
y => "Av"
|
||||
hebdate(9, "Av") => 1991/07/20
|
||||
trigger(1991/07/20) => "20 July 1991"
|
||||
Leaving UserFN _h() => "20 July 1991"
|
||||
test.rem(27): Trig = Saturday, 20 July, 1991
|
||||
|
||||
# Test some jahrzeit cases
|
||||
fset _i(x,y,z,a) trigger(hebdate(x,y,z,a))
|
||||
[_i(30, "Heshvan", today(), 5759)] MSG Complete-Complete
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5759)
|
||||
x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
a => 5759
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5759) => 1991/11/07
|
||||
trigger(1991/11/07) => "7 November 1991"
|
||||
Leaving UserFN _i() => "7 November 1991"
|
||||
test.rem(31): Trig = Thursday, 7 November, 1991
|
||||
[_i(30, "Heshvan", today(), 5760)] MSG Complete-Defective
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5760)
|
||||
x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
a => 5760
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5760) => 1991/11/07
|
||||
trigger(1991/11/07) => "7 November 1991"
|
||||
Leaving UserFN _i() => "7 November 1991"
|
||||
test.rem(32): Trig = Thursday, 7 November, 1991
|
||||
[_i(30, "Heshvan", today(), 5761)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5761)
|
||||
x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
a => 5761
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5761) => test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
[_i(30, "Kislev", today(), 5759)] MSG Complete-Complete
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5759)
|
||||
x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
a => 5759
|
||||
hebdate(30, "Kislev", 1991/02/16, 5759) => 1991/12/07
|
||||
trigger(1991/12/07) => "7 December 1991"
|
||||
Leaving UserFN _i() => "7 December 1991"
|
||||
test.rem(35): Trig = Saturday, 7 December, 1991
|
||||
[_i(30, "Kislev", today(), 5760)] MSG Complete-Defective
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5760)
|
||||
x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
a => 5760
|
||||
hebdate(30, "Kislev", 1991/02/16, 5760) => 1991/12/07
|
||||
trigger(1991/12/07) => "7 December 1991"
|
||||
Leaving UserFN _i() => "7 December 1991"
|
||||
test.rem(36): Trig = Saturday, 7 December, 1991
|
||||
[_i(30, "Kislev", today(), 5761)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5761)
|
||||
x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
a => 5761
|
||||
hebdate(30, "Kislev", 1991/02/16, 5761) => test.rem(37): 30 Kislev 5761: Invalid Hebrew date
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
[_i(30, "Adar A", today(), 5755)] MSG Leap
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Adar A", 1991/02/16, 5755)
|
||||
x => 30
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
a => 5755
|
||||
hebdate(30, "Adar A", 1991/02/16, 5755) => 1992/03/05
|
||||
trigger(1992/03/05) => "5 March 1992"
|
||||
Leaving UserFN _i() => "5 March 1992"
|
||||
test.rem(39): Trig = Thursday, 5 March, 1992
|
||||
[_i(30, "Adar A", today(), 5756)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Adar A", 1991/02/16, 5756)
|
||||
x => 30
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
a => 5756
|
||||
hebdate(30, "Adar A", 1991/02/16, 5756) => test.rem(40): No Adar A in 5756
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
[_i(29, "Adar A", today(), 5755)] MSG Leap
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(29, "Adar A", 1991/02/16, 5755)
|
||||
x => 29
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
a => 5755
|
||||
hebdate(29, "Adar A", 1991/02/16, 5755) => 1991/03/15
|
||||
trigger(1991/03/15) => "15 March 1991"
|
||||
Leaving UserFN _i() => "15 March 1991"
|
||||
test.rem(41): Trig = Friday, 15 March, 1991
|
||||
[_i(29, "Adar A", today(), 5756)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(29, "Adar A", 1991/02/16, 5756)
|
||||
x => 29
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
a => 5756
|
||||
hebdate(29, "Adar A", 1991/02/16, 5756) => test.rem(42): No Adar A in 5756
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
# Test each possible case of the basic reminders.
|
||||
|
||||
REM MSG Every Day
|
||||
test.rem(46): Trig = Saturday, 16 February, 1991
|
||||
Every Day
|
||||
|
||||
|
||||
REM 18 MSG Every 18th
|
||||
test.rem(48): Trig = Monday, 18 February, 1991
|
||||
REM 15 MSG Every 15th
|
||||
test.rem(49): Trig = Friday, 15 March, 1991
|
||||
|
||||
REM Feb MSG February
|
||||
test.rem(51): Trig = Saturday, 16 February, 1991
|
||||
February
|
||||
|
||||
REM Jan MSG January
|
||||
test.rem(52): Trig = Wednesday, 1 January, 1992
|
||||
REM March MSG March
|
||||
test.rem(53): Trig = Friday, 1 March, 1991
|
||||
|
||||
REM 13 Jan MSG 13 Jan
|
||||
test.rem(55): Trig = Monday, 13 January, 1992
|
||||
REM 15 Feb MSG 15 Feb
|
||||
test.rem(56): Trig = Saturday, 15 February, 1992
|
||||
REM 28 Feb MSG 28 Feb
|
||||
test.rem(57): Trig = Thursday, 28 February, 1991
|
||||
REM 29 Feb MSG 29 Feb
|
||||
test.rem(58): Trig = Saturday, 29 February, 1992
|
||||
REM 5 Mar MSG 5 Mar
|
||||
test.rem(59): Trig = Tuesday, 5 March, 1991
|
||||
|
||||
REM 1990 MSG 1990
|
||||
test.rem(61): Expired
|
||||
REM 1991 MSG 1991
|
||||
test.rem(62): Trig = Saturday, 16 February, 1991
|
||||
1991
|
||||
|
||||
REM 1992 MSG 1991
|
||||
test.rem(63): Trig = Wednesday, 1 January, 1992
|
||||
|
||||
REM 1 1990 MSG 1 1990
|
||||
test.rem(65): Expired
|
||||
REM 29 1991 MSG 29 1991
|
||||
test.rem(66): Trig = Friday, 29 March, 1991
|
||||
REM 29 1992 MSG 29 1992
|
||||
test.rem(67): Trig = Wednesday, 29 January, 1992
|
||||
REM 16 1991 MSG 16 1991
|
||||
test.rem(68): Trig = Saturday, 16 February, 1991
|
||||
16 1991
|
||||
|
||||
|
||||
REM Jan 1990 MSG Jan 1990
|
||||
test.rem(70): Expired
|
||||
REM Feb 1991 MSG Feb 1991
|
||||
test.rem(71): Trig = Saturday, 16 February, 1991
|
||||
Feb 1991
|
||||
|
||||
REM Dec 1991 MSG Dec 1991
|
||||
test.rem(72): Trig = Sunday, 1 December, 1991
|
||||
REM May 1992 MSG May 1992
|
||||
test.rem(73): Trig = Friday, 1 May, 1992
|
||||
|
||||
REM 1 Jan 1991 MSG 1 Jan 1991
|
||||
test.rem(75): Expired
|
||||
REM 16 Feb 1991 MSG 16 Feb 1991
|
||||
test.rem(76): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
|
||||
REM 29 Dec 1992 MSG 29 Dec 1992
|
||||
test.rem(77): Trig = Tuesday, 29 December, 1992
|
||||
|
||||
REM Sun MSG Sun
|
||||
test.rem(79): Trig = Sunday, 17 February, 1991
|
||||
REM Fri Sat Tue MSG Fri Sat Tue
|
||||
test.rem(80): Trig = Saturday, 16 February, 1991
|
||||
Fri Sat Tue
|
||||
|
||||
|
||||
REM Sun 16 MSG Sun 16
|
||||
test.rem(82): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue Wed Thu Fri 1 MSG Mon Tue Wed Thu Fri 1
|
||||
test.rem(83): Trig = Friday, 1 March, 1991
|
||||
|
||||
REM Sun Feb MSG Sun Feb
|
||||
test.rem(85): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue March MSG Mon Tue March
|
||||
test.rem(86): Trig = Monday, 4 March, 1991
|
||||
|
||||
REM Sun 16 Feb MSG Sun 16 Feb
|
||||
test.rem(88): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue 10 March MSG Mon Tue 10 March
|
||||
test.rem(89): Trig = Monday, 11 March, 1991
|
||||
|
||||
REM Sat Sun 1991 MSG Sat Sun 1991
|
||||
test.rem(91): Trig = Saturday, 16 February, 1991
|
||||
Sat Sun 1991
|
||||
|
||||
REM Mon Tue 1992 MSG Mon Tue 1992
|
||||
test.rem(92): Trig = Monday, 6 January, 1992
|
||||
|
||||
REM Sun 16 1991 MSG Sun 16 1991
|
||||
test.rem(94): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue Wed Thu Fri 1 1992 MSG Mon Tue Wed Thu Fri 1 1992
|
||||
test.rem(95): Trig = Wednesday, 1 January, 1992
|
||||
|
||||
REM Mon Feb 1991 MSG Mon Feb 1991
|
||||
test.rem(97): Trig = Monday, 18 February, 1991
|
||||
REM Tue Jan 1992 MSG Tue Jan 1992
|
||||
test.rem(98): Trig = Tuesday, 7 January, 1992
|
||||
|
||||
REM Sun Mon 16 Feb 1991 MSG Sun Mon 16 Feb 1991
|
||||
test.rem(100): Trig = Sunday, 17 February, 1991
|
||||
REM Tue 28 Jan 1992 MSG Tue 28 Jan 1992
|
||||
test.rem(101): Trig = Tuesday, 28 January, 1992
|
||||
|
||||
# Try some Backs
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun
|
||||
test.rem(105): Trig = Thursday, 28 February, 1991
|
||||
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun
|
||||
test.rem(106): Trig = Thursday, 28 February, 1991
|
||||
|
||||
OMIT 28 Feb
|
||||
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun (28 Feb omitted)
|
||||
test.rem(109): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun (28 Feb omitted)
|
||||
test.rem(110): Trig = Thursday, 28 February, 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
|
||||
# Try out UNTIL
|
||||
REM Wed UNTIL 21 Feb 1991 MSG Wed UNTIL 21 Feb 1991
|
||||
test.rem(115): Trig = Wednesday, 20 February, 1991
|
||||
|
||||
# Try playing with the OMIT context
|
||||
|
||||
OMIT 28 Feb 1991
|
||||
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
|
||||
test.rem(120): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
|
||||
test.rem(121): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
|
||||
test.rem(122): Trig = Wednesday, 27 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
|
||||
test.rem(123): Trig = Friday, 28 February, 1992
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
|
||||
test.rem(124): Trig = Friday, 1 March, 1991
|
||||
|
||||
PUSH-OMIT-CONTEXT
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 1 Mar -1 MSG 1 mar -1
|
||||
test.rem(128): Trig = Thursday, 28 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1
|
||||
test.rem(129): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE
|
||||
test.rem(130): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP
|
||||
test.rem(131): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER
|
||||
test.rem(132): Trig = Thursday, 28 February, 1991
|
||||
|
||||
POP-OMIT-CONTEXT
|
||||
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
|
||||
test.rem(135): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
|
||||
test.rem(136): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
|
||||
test.rem(137): Trig = Wednesday, 27 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
|
||||
test.rem(138): Trig = Friday, 28 February, 1992
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
|
||||
test.rem(139): Trig = Friday, 1 March, 1991
|
||||
|
||||
|
||||
REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91
|
||||
test.rem(142): Trig = Wednesday, 13 March, 1991
|
||||
|
||||
# Test BACK
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1
|
||||
test.rem(146): Trig = Monday, 18 February, 1991
|
||||
|
||||
OMIT 17 Feb 1991
|
||||
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 (17Feb91 omitted)
|
||||
test.rem(149): Trig = Monday, 18 February, 1991
|
||||
18 Feb 1991 +1 (17Feb91 omitted)
|
||||
|
||||
REM 18 Feb 1991 ++1 MSG 18 Feb 1991 ++1 (17Feb91 omitted)
|
||||
test.rem(150): Trig = Monday, 18 February, 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
# Test the scanfrom clause
|
||||
REM Fri SATISFY 1
|
||||
test.rem(154): Trig = Friday, 22 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991/02/22
|
||||
trigger(1991/02/22) => "22 February 1991"
|
||||
REM Fri after MSG 23 Feb 1991
|
||||
test.rem(156): Trig = Saturday, 23 February, 1991
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 7 => 1991/02/09
|
||||
trigger(1991/02/09) => "9 February 1991"
|
||||
test.rem(158): Trig = Friday, 15 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991/02/15
|
||||
trigger(1991/02/15) => "15 February 1991"
|
||||
REM Fri after MSG 16 Feb 1991
|
||||
test.rem(160): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
set a000 abs(1)
|
||||
abs(1) => 1
|
||||
set a001 abs(-1)
|
||||
- 1 => -1
|
||||
abs(-1) => 1
|
||||
set a002 asc("foo")
|
||||
asc("foo") => 102
|
||||
set a003 baseyr()
|
||||
baseyr() => 1990
|
||||
set a004 char(66,55,66,77,66)
|
||||
char(66, 55, 66, 77, 66) => "B7BMB"
|
||||
set a005 choose(3, "foo", "bar", "baz", "blech")
|
||||
choose(3, "foo", "bar", "baz", "blech") => "baz"
|
||||
set a006 coerce("string", 1)
|
||||
coerce("string", 1) => "1"
|
||||
set a007 coerce("string", today())
|
||||
today() => 1991/02/16
|
||||
coerce("string", 1991/02/16) => "1991/02/16"
|
||||
set a008 coerce("string", 11:44)
|
||||
coerce("string", 11:44) => "11:44"
|
||||
set a009 coerce("int", "badnews")
|
||||
coerce("int", "badnews") => Can't coerce
|
||||
test.rem(171): Can't coerce
|
||||
set a010 coerce("int", "12")
|
||||
coerce("int", "12") => 12
|
||||
set a011 coerce("int", 11:44)
|
||||
coerce("int", 11:44) => 704
|
||||
set a012 coerce("int", today())
|
||||
today() => 1991/02/16
|
||||
coerce("int", 1991/02/16) => 411
|
||||
set a013 date(1992, 2, 2)
|
||||
date(1992, 2, 2) => 1992/02/02
|
||||
set a014 date(1993, 2, 29)
|
||||
date(1993, 2, 29) => Bad date specification
|
||||
test.rem(176): Bad date specification
|
||||
set a015 day(today())
|
||||
today() => 1991/02/16
|
||||
day(1991/02/16) => 16
|
||||
set a016 daysinmon(2, 1991)
|
||||
daysinmon(2, 1991) => 28
|
||||
set a017 daysinmon(2, 1992)
|
||||
daysinmon(2, 1992) => 29
|
||||
set a018 defined("a017")
|
||||
defined("a017") => 1
|
||||
set a019 defined("a019")
|
||||
defined("a019") => 0
|
||||
set a020 filename()
|
||||
filename() => "test.rem"
|
||||
set a021 getenv("TEST_GETENV")
|
||||
getenv("TEST_GETENV") => "foo bar baz"
|
||||
set a022 hour(11:22)
|
||||
hour(11:22) => 11
|
||||
set a023 iif(1, 1, 0)
|
||||
iif(1, 1, 0) => 1
|
||||
set a024 iif(0, 1, 0)
|
||||
iif(0, 1, 0) => 0
|
||||
set a025 index("barfoobar", "foo")
|
||||
index("barfoobar", "foo") => 4
|
||||
set a026 index("barfoobar", "bar", 2)
|
||||
index("barfoobar", "bar", 2) => 7
|
||||
set a027 isleap(today())
|
||||
today() => 1991/02/16
|
||||
isleap(1991/02/16) => 0
|
||||
set a028 isleap(1992)
|
||||
isleap(1992) => 1
|
||||
omit [trigger(today())]
|
||||
today() => 1991/02/16
|
||||
trigger(1991/02/16) => "16 February 1991"
|
||||
set a030 isomitted(today())
|
||||
today() => 1991/02/16
|
||||
isomitted(1991/02/16) => 1
|
||||
clear
|
||||
set a029 isomitted(today())
|
||||
today() => 1991/02/16
|
||||
isomitted(1991/02/16) => 0
|
||||
set a031 lower("FOOBARBAZ")
|
||||
lower("FOOBARBAZ") => "foobarbaz"
|
||||
set a032 max(1, 2, 34, 1, 3)
|
||||
max(1, 2, 34, 1, 3) => 34
|
||||
set a033 max("foo", "bar", "baz")
|
||||
max("foo", "bar", "baz") => "foo"
|
||||
set a034 max(today(), today()+1, today()-1)
|
||||
today() => 1991/02/16
|
||||
today() => 1991/02/16
|
||||
1991/02/16 + 1 => 1991/02/17
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 1 => 1991/02/15
|
||||
max(1991/02/16, 1991/02/17, 1991/02/15) => 1991/02/17
|
||||
set a035 min(1, 2, 34, 1, 3)
|
||||
min(1, 2, 34, 1, 3) => 1
|
||||
set a036 min("foo", "bar", "baz")
|
||||
min("foo", "bar", "baz") => "bar"
|
||||
set a037 min(today(), today()+1, today()-1)
|
||||
today() => 1991/02/16
|
||||
today() => 1991/02/16
|
||||
1991/02/16 + 1 => 1991/02/17
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 1 => 1991/02/15
|
||||
min(1991/02/16, 1991/02/17, 1991/02/15) => 1991/02/15
|
||||
set a038 minute(11:33)
|
||||
minute(11:33) => 33
|
||||
set a039 mon(today())
|
||||
today() => 1991/02/16
|
||||
mon(1991/02/16) => "February"
|
||||
set a040 monnum(today())
|
||||
today() => 1991/02/16
|
||||
monnum(1991/02/16) => 2
|
||||
set a041 ord(3)
|
||||
ord(3) => "3rd"
|
||||
set a042 ord(4)
|
||||
ord(4) => "4th"
|
||||
set a043 ostype()
|
||||
ostype() => "AmigaDOS"
|
||||
set a044 plural(2)
|
||||
plural(2) => "s"
|
||||
set a045 plural(2, "ies")
|
||||
plural(2, "ies") => "iess"
|
||||
set a046 plural(2, "y", "ies")
|
||||
plural(2, "y", "ies") => "ies"
|
||||
set a047 sgn(-2)
|
||||
- 2 => -2
|
||||
sgn(-2) => -1
|
||||
set a048 shell("echo foo")
|
||||
shell("echo foo") => "foo"
|
||||
set a049 strlen("sadjflkhsldkfhsdlfjhk")
|
||||
strlen("sadjflkhsldkfhsdlfjhk") => 21
|
||||
set a050 substr(a049, 2)
|
||||
a049 => 21
|
||||
substr(21, 2) => Type mismatch
|
||||
test.rem(214): Type mismatch
|
||||
set a051 substr(a050, 2, 6)
|
||||
a050 => test.rem(215): Undefined variable: a050
|
||||
set a052 time(1+2, 3+4)
|
||||
1 + 2 => 3
|
||||
3 + 4 => 7
|
||||
time(3, 7) => 03:07
|
||||
rem 10 jan 1992 AT 11:22 CAL
|
||||
test.rem(217): Trig = Friday, 10 January, 1992
|
||||
set a053 trigdate()
|
||||
trigdate() => 1992/01/10
|
||||
set a054 trigtime()
|
||||
trigtime() => 11:22
|
||||
set a055 trigvalid()
|
||||
trigvalid() => 1
|
||||
set a056 upper("sdfjhsdf ksjdfh kjsdfh ksjdfh")
|
||||
upper("sdfjhsdf ksjdfh kjsdfh ksjdfh") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "03.00.19"
|
||||
set a059 wkday(today())
|
||||
today() => 1991/02/16
|
||||
wkday(1991/02/16) => "Saturday"
|
||||
set a060 wkdaynum(today())
|
||||
today() => 1991/02/16
|
||||
wkdaynum(1991/02/16) => 6
|
||||
set a061 year(today())
|
||||
today() => 1991/02/16
|
||||
year(1991/02/16) => 1991
|
||||
set a062 1+2*(3+4-(5*7/2))
|
||||
3 + 4 => 7
|
||||
5 * 7 => 35
|
||||
35 / 2 => 17
|
||||
7 - 17 => -10
|
||||
2 * -10 => -20
|
||||
1 + -20 => -19
|
||||
set a063 1>=2
|
||||
1 >= 2 => 0
|
||||
set a064 1<2 || 3 > 4
|
||||
1 < 2 => 1
|
||||
3 > 4 => 0
|
||||
1 || 0 => 1
|
||||
set a065 1 && 1
|
||||
1 && 1 => 1
|
||||
set a066 !a065
|
||||
a065 => 1
|
||||
! 1 => 0
|
||||
set a067 typeof(2)
|
||||
typeof(2) => "INT"
|
||||
set a068 typeof("foo")
|
||||
typeof("foo") => "STRING"
|
||||
set a069 typeof(11:33)
|
||||
typeof(11:33) => "TIME"
|
||||
set a070 typeof(today())
|
||||
today() => 1991/02/16
|
||||
typeof(1991/02/16) => "DATE"
|
||||
fset g(x,y) max(x,y)
|
||||
fset h(x,y) min(g(x+y, x*y), g(x-y, x/y))
|
||||
set a071 g(1, 2)
|
||||
Entering UserFN g(1, 2)
|
||||
x => 1
|
||||
y => 2
|
||||
max(1, 2) => 2
|
||||
Leaving UserFN g() => 2
|
||||
set a072 h(2, 3)
|
||||
Entering UserFN h(2, 3)
|
||||
x => 2
|
||||
y => 3
|
||||
2 + 3 => 5
|
||||
x => 2
|
||||
y => 3
|
||||
2 * 3 => 6
|
||||
Entering UserFN g(5, 6)
|
||||
x => 5
|
||||
y => 6
|
||||
max(5, 6) => 6
|
||||
Leaving UserFN g() => 6
|
||||
x => 2
|
||||
y => 3
|
||||
2 - 3 => -1
|
||||
x => 2
|
||||
y => 3
|
||||
2 / 3 => 0
|
||||
Entering UserFN g(-1, 0)
|
||||
x => -1
|
||||
y => 0
|
||||
max(-1, 0) => 0
|
||||
Leaving UserFN g() => 0
|
||||
min(6, 0) => 0
|
||||
Leaving UserFN h() => 0
|
||||
set a073 h("foo", 11:33)
|
||||
Entering UserFN h("foo", 11:33)
|
||||
x => "foo"
|
||||
y => 11:33
|
||||
"foo" + 11:33 => "foo11:33"
|
||||
x => "foo"
|
||||
y => 11:33
|
||||
"foo" * 11:33 => Type mismatch
|
||||
test.rem(240): '*': Type mismatch
|
||||
Leaving UserFN h() => Type mismatch
|
||||
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
|
||||
dosubst("%a %b %c %d %e %f %g %h", 1992/05/05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
msg [a074]%
|
||||
test.rem(242): Trig = Saturday, 16 February, 1991
|
||||
a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05/05/1992 on 05/05/1992 on Tuesday, 5 May on 05/05
|
||||
set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
|
||||
dosubst("%i %j %k %l %m %n %o %p", 1992/05/05) => "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
msg [a075]%
|
||||
test.rem(244): Trig = Saturday, 16 February, 1991
|
||||
a075 => "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
on 05/05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992/05/05 May 5 s
|
||||
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
|
||||
dosubst("%q %r %s %t %u %v %w %x", 1992/05/05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
msg [a076]%
|
||||
test.rem(246): Trig = Saturday, 16 February, 1991
|
||||
a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444
|
||||
set a077 dosubst("%y %z", '1992/5/5')
|
||||
dosubst("%y %z", 1992/05/05) => "1992 92
|
||||
"
|
||||
msg [a077]%
|
||||
test.rem(248): Trig = Saturday, 16 February, 1991
|
||||
a077 => "1992 92
|
||||
"
|
||||
1992 92
|
||||
set a078 easterdate(today())
|
||||
today() => 1991/02/16
|
||||
easterdate(1991/02/16) => 1991/03/31
|
||||
set a079 easterdate(1992)
|
||||
easterdate(1992) => 1992/04/19
|
||||
set a080 easterdate(1995)
|
||||
easterdate(1995) => 1995/04/16
|
||||
set a081 ""
|
||||
dump
|
||||
Variable Value
|
||||
|
||||
a017 29
|
||||
a036 "bar"
|
||||
a055 1
|
||||
a074 "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
a008 "11:44"
|
||||
a027 0
|
||||
a046 "ies"
|
||||
a065 1
|
||||
a018 1
|
||||
a037 1991/02/15
|
||||
a056 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a075 "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
a028 1
|
||||
a047 -1
|
||||
a066 0
|
||||
a019 0
|
||||
a038 33
|
||||
a057 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a076 "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
a029 0
|
||||
a048 "foo"
|
||||
a067 "INT"
|
||||
a039 "February"
|
||||
a058 "03.00.19"
|
||||
a077 "1992 92
|
||||
"
|
||||
a049 21
|
||||
a068 "STRING"
|
||||
a059 "Saturday"
|
||||
a078 1991/03/31
|
||||
a069 "TIME"
|
||||
a079 1992/04/19
|
||||
a000 1
|
||||
a010 12
|
||||
a001 1
|
||||
a020 "test.rem"
|
||||
a011 704
|
||||
a030 1
|
||||
a002 102
|
||||
a021 "foo bar baz"
|
||||
a040 2
|
||||
a012 411
|
||||
a031 "foobarbaz"
|
||||
a003 1990
|
||||
a022 11
|
||||
a041 "3rd"
|
||||
a060 6
|
||||
a013 1992/02/02
|
||||
a032 34
|
||||
a070 "DATE"
|
||||
a004 "B7BMB"
|
||||
a023 1
|
||||
a042 "4th"
|
||||
a061 1991
|
||||
a080 1995/04/16
|
||||
a033 "foo"
|
||||
a052 03:07
|
||||
a071 2
|
||||
a005 "baz"
|
||||
a024 0
|
||||
a043 "AmigaDOS"
|
||||
a062 -19
|
||||
a081 ""
|
||||
a015 16
|
||||
a034 1991/02/17
|
||||
a053 1992/01/10
|
||||
a072 0
|
||||
a006 "1"
|
||||
a025 4
|
||||
a044 "s"
|
||||
a063 0
|
||||
a016 28
|
||||
a035 1
|
||||
a054 11:22
|
||||
a007 "1991/02/16"
|
||||
a026 7
|
||||
a045 "iess"
|
||||
a064 1
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
@echo off
|
||||
rem ---------------------------------------------------------------------------
|
||||
rem TEST-REM
|
||||
rem
|
||||
rem $Id: test-rem.bat,v 1.3 2000-02-18 03:46:31 dfs Exp $
|
||||
rem
|
||||
rem This file runs an MSDOS acceptance test for Remind. To use it, type:
|
||||
rem test-rem
|
||||
rem in the build directory.
|
||||
rem
|
||||
rem This file is part of REMIND.
|
||||
rem Copyright (C) 1992-1997 David F. Skoll
|
||||
rem Copyright (C) 1999-2000 Roaring Penguin Software Inc.
|
||||
rem ---------------------------------------------------------------------------
|
||||
|
||||
del test.out > nul
|
||||
set TEST_GETENV=foo bar baz
|
||||
if exist ..\msdos-ex\remind.exe goto bcc
|
||||
remind -e -dxte ./test.rem 16 feb 1991 > test.out
|
||||
goto cmp
|
||||
:bcc
|
||||
..\msdos-ex\remind -e -dxte .\test.rem 16 feb 1991 > test.out
|
||||
:cmp
|
||||
echo n | comp test.out test1.cmp
|
||||
if errorlevel 1 goto oops
|
||||
echo "Remind: Acceptance test PASSED"
|
||||
goto quit
|
||||
:oops
|
||||
echo "Remind: Acceptance test FAILED"
|
||||
echo ""
|
||||
echo "Examine the file test.out to see where it differs from the"
|
||||
echo "reference file test1.cmp."
|
||||
:quit
|
||||
@@ -1,35 +0,0 @@
|
||||
@echo off
|
||||
rem ---------------------------------------------------------------------------
|
||||
rem TEST-REM
|
||||
rem
|
||||
rem $Id: test-rem.cmd,v 1.3 2000-02-18 03:46:32 dfs Exp $
|
||||
rem
|
||||
rem This file runs an OS/2 acceptance test for Remind. To use it, type:
|
||||
rem test-rem
|
||||
rem in the build directory.
|
||||
rem
|
||||
rem This file is part of REMIND.
|
||||
rem Copyright (C) 1992-1997 David F. Skoll
|
||||
rem Copyright (C) 1999-2000 Roaring Penguin Software Inc.
|
||||
rem ---------------------------------------------------------------------------
|
||||
|
||||
del /f test.out > nul
|
||||
setlocal
|
||||
set TEST_GETENV=foo bar baz
|
||||
if exist ..\os2-ex\remind.exe goto bcc
|
||||
remind -e -dxte ./test.rem 16 feb 1991 > .\test.out
|
||||
goto cmp
|
||||
:bcc
|
||||
..\os2-ex\remind -e -dxte .\test.rem 16 feb 1991 > .\test.out
|
||||
:cmp
|
||||
echo n | comp test.out test2.cmp
|
||||
if errorlevel 1 goto oops
|
||||
echo "Remind: Acceptance test PASSED"
|
||||
goto quit
|
||||
:oops
|
||||
echo "Remind: Acceptance test FAILED"
|
||||
echo ""
|
||||
echo "Examine the file test.out to see where it differs from the"
|
||||
echo "reference file test2.cmp."
|
||||
:quit
|
||||
endlocal
|
||||
@@ -1,23 +0,0 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
$Id: test-rem.rexx,v 1.1 1998-01-15 02:50:50 dfs Exp $
|
||||
TEST-REM
|
||||
This file runs an AmigaDOS acceptance test for Remind. To use it, type:
|
||||
rx test-rem
|
||||
in the build directory.
|
||||
(Use this with the ENGLISH version only !!!)
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
address 'COMMAND'
|
||||
options results
|
||||
|
||||
'setenv TEST_GETENV "foo bar baz"'
|
||||
'remind -e -dxte test.rem 16 feb 1991 >ram:test.out'
|
||||
'diff ram:test.out test-rem.ami >NIL:'
|
||||
if rc=0 then do
|
||||
say "Remind: Acceptance test PASSED"
|
||||
end
|
||||
else do
|
||||
say "Remind: Acceptance test FAILED"
|
||||
end
|
||||
'delete ram:test.out quiet'
|
||||
446
tests/test.cmp
446
tests/test.cmp
@@ -9,12 +9,12 @@ REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
|
||||
../tests/test.rem(8): Trig = Saturday, 16 February, 1991
|
||||
Reminders for Saturday, 16th February, 1991:
|
||||
|
||||
today() => 1991/02/16
|
||||
hebday(1991/02/16) => 2
|
||||
today() => 1991/02/16
|
||||
hebmon(1991/02/16) => "Adar"
|
||||
today() => 1991/02/16
|
||||
hebyear(1991/02/16) => 5751
|
||||
today() => 1991-02-16
|
||||
hebday(1991-02-16) => 2
|
||||
today() => 1991-02-16
|
||||
hebmon(1991-02-16) => "Adar"
|
||||
today() => 1991-02-16
|
||||
hebyear(1991-02-16) => 5751
|
||||
Today is 2 Adar 5751
|
||||
|
||||
fset _h(x, y) trigger(hebdate(x,y))
|
||||
@@ -23,247 +23,247 @@ fset _h(x, y) trigger(hebdate(x,y))
|
||||
Entering UserFN _h(1, "Tishrey")
|
||||
x => 1
|
||||
y => "Tishrey"
|
||||
hebdate(1, "Tishrey") => 1991/09/09
|
||||
trigger(1991/09/09) => "9 September 1991"
|
||||
hebdate(1, "Tishrey") => 1991-09-09
|
||||
trigger(1991-09-09) => "9 September 1991"
|
||||
Leaving UserFN _h() => "9 September 1991"
|
||||
../tests/test.rem(11): Trig = Monday, 9 September, 1991
|
||||
[_h(2, "Tishrey")] MSG Rosh Hashana 2
|
||||
Entering UserFN _h(2, "Tishrey")
|
||||
x => 2
|
||||
y => "Tishrey"
|
||||
hebdate(2, "Tishrey") => 1991/09/10
|
||||
trigger(1991/09/10) => "10 September 1991"
|
||||
hebdate(2, "Tishrey") => 1991-09-10
|
||||
trigger(1991-09-10) => "10 September 1991"
|
||||
Leaving UserFN _h() => "10 September 1991"
|
||||
../tests/test.rem(12): Trig = Tuesday, 10 September, 1991
|
||||
[_h(3, "Tishrey")] MSG Tzom Gedalia
|
||||
Entering UserFN _h(3, "Tishrey")
|
||||
x => 3
|
||||
y => "Tishrey"
|
||||
hebdate(3, "Tishrey") => 1991/09/11
|
||||
trigger(1991/09/11) => "11 September 1991"
|
||||
hebdate(3, "Tishrey") => 1991-09-11
|
||||
trigger(1991-09-11) => "11 September 1991"
|
||||
Leaving UserFN _h() => "11 September 1991"
|
||||
../tests/test.rem(13): Trig = Wednesday, 11 September, 1991
|
||||
[_h(10, "Tishrey")] MSG Yom Kippur
|
||||
Entering UserFN _h(10, "Tishrey")
|
||||
x => 10
|
||||
y => "Tishrey"
|
||||
hebdate(10, "Tishrey") => 1991/09/18
|
||||
trigger(1991/09/18) => "18 September 1991"
|
||||
hebdate(10, "Tishrey") => 1991-09-18
|
||||
trigger(1991-09-18) => "18 September 1991"
|
||||
Leaving UserFN _h() => "18 September 1991"
|
||||
../tests/test.rem(14): Trig = Wednesday, 18 September, 1991
|
||||
[_h(15, "Tishrey")] MSG Sukkot 1
|
||||
Entering UserFN _h(15, "Tishrey")
|
||||
x => 15
|
||||
y => "Tishrey"
|
||||
hebdate(15, "Tishrey") => 1991/09/23
|
||||
trigger(1991/09/23) => "23 September 1991"
|
||||
hebdate(15, "Tishrey") => 1991-09-23
|
||||
trigger(1991-09-23) => "23 September 1991"
|
||||
Leaving UserFN _h() => "23 September 1991"
|
||||
../tests/test.rem(15): Trig = Monday, 23 September, 1991
|
||||
[_h(25, "Kislev")] MSG Channuka
|
||||
Entering UserFN _h(25, "Kislev")
|
||||
x => 25
|
||||
y => "Kislev"
|
||||
hebdate(25, "Kislev") => 1991/12/02
|
||||
trigger(1991/12/02) => "2 December 1991"
|
||||
hebdate(25, "Kislev") => 1991-12-02
|
||||
trigger(1991-12-02) => "2 December 1991"
|
||||
Leaving UserFN _h() => "2 December 1991"
|
||||
../tests/test.rem(16): Trig = Monday, 2 December, 1991
|
||||
[_h(10, "Tevet")] MSG Asara B'Tevet
|
||||
Entering UserFN _h(10, "Tevet")
|
||||
x => 10
|
||||
y => "Tevet"
|
||||
hebdate(10, "Tevet") => 1991/12/17
|
||||
trigger(1991/12/17) => "17 December 1991"
|
||||
hebdate(10, "Tevet") => 1991-12-17
|
||||
trigger(1991-12-17) => "17 December 1991"
|
||||
Leaving UserFN _h() => "17 December 1991"
|
||||
../tests/test.rem(17): Trig = Tuesday, 17 December, 1991
|
||||
[_h(15, "Shvat")] MSG Tu B'Shvat
|
||||
Entering UserFN _h(15, "Shvat")
|
||||
x => 15
|
||||
y => "Shvat"
|
||||
hebdate(15, "Shvat") => 1992/01/20
|
||||
trigger(1992/01/20) => "20 January 1992"
|
||||
hebdate(15, "Shvat") => 1992-01-20
|
||||
trigger(1992-01-20) => "20 January 1992"
|
||||
Leaving UserFN _h() => "20 January 1992"
|
||||
../tests/test.rem(18): Trig = Monday, 20 January, 1992
|
||||
[_h(15, "Adar A")] MSG Purim Katan
|
||||
Entering UserFN _h(15, "Adar A")
|
||||
x => 15
|
||||
y => "Adar A"
|
||||
hebdate(15, "Adar A") => 1992/02/19
|
||||
trigger(1992/02/19) => "19 February 1992"
|
||||
hebdate(15, "Adar A") => 1992-02-19
|
||||
trigger(1992-02-19) => "19 February 1992"
|
||||
Leaving UserFN _h() => "19 February 1992"
|
||||
../tests/test.rem(19): Trig = Wednesday, 19 February, 1992
|
||||
[_h(14, "Adar")] MSG Purim
|
||||
Entering UserFN _h(14, "Adar")
|
||||
x => 14
|
||||
y => "Adar"
|
||||
hebdate(14, "Adar") => 1991/02/28
|
||||
trigger(1991/02/28) => "28 February 1991"
|
||||
hebdate(14, "Adar") => 1991-02-28
|
||||
trigger(1991-02-28) => "28 February 1991"
|
||||
Leaving UserFN _h() => "28 February 1991"
|
||||
../tests/test.rem(20): Trig = Thursday, 28 February, 1991
|
||||
[_h(15, "Nisan")] MSG Pesach
|
||||
Entering UserFN _h(15, "Nisan")
|
||||
x => 15
|
||||
y => "Nisan"
|
||||
hebdate(15, "Nisan") => 1991/03/30
|
||||
trigger(1991/03/30) => "30 March 1991"
|
||||
hebdate(15, "Nisan") => 1991-03-30
|
||||
trigger(1991-03-30) => "30 March 1991"
|
||||
Leaving UserFN _h() => "30 March 1991"
|
||||
../tests/test.rem(21): Trig = Saturday, 30 March, 1991
|
||||
[_h(27, "Nisan")] MSG Yom HaShoah
|
||||
Entering UserFN _h(27, "Nisan")
|
||||
x => 27
|
||||
y => "Nisan"
|
||||
hebdate(27, "Nisan") => 1991/04/11
|
||||
trigger(1991/04/11) => "11 April 1991"
|
||||
hebdate(27, "Nisan") => 1991-04-11
|
||||
trigger(1991-04-11) => "11 April 1991"
|
||||
Leaving UserFN _h() => "11 April 1991"
|
||||
../tests/test.rem(22): Trig = Thursday, 11 April, 1991
|
||||
[_h(4, "Iyar")] MSG Yom HaZikaron
|
||||
Entering UserFN _h(4, "Iyar")
|
||||
x => 4
|
||||
y => "Iyar"
|
||||
hebdate(4, "Iyar") => 1991/04/18
|
||||
trigger(1991/04/18) => "18 April 1991"
|
||||
hebdate(4, "Iyar") => 1991-04-18
|
||||
trigger(1991-04-18) => "18 April 1991"
|
||||
Leaving UserFN _h() => "18 April 1991"
|
||||
../tests/test.rem(23): Trig = Thursday, 18 April, 1991
|
||||
[_h(5, "Iyar")] MSG Yom Ha'atzmaut
|
||||
Entering UserFN _h(5, "Iyar")
|
||||
x => 5
|
||||
y => "Iyar"
|
||||
hebdate(5, "Iyar") => 1991/04/19
|
||||
trigger(1991/04/19) => "19 April 1991"
|
||||
hebdate(5, "Iyar") => 1991-04-19
|
||||
trigger(1991-04-19) => "19 April 1991"
|
||||
Leaving UserFN _h() => "19 April 1991"
|
||||
../tests/test.rem(24): Trig = Friday, 19 April, 1991
|
||||
[_h(28, "Iyar")] MSG Yom Yerushalayim
|
||||
Entering UserFN _h(28, "Iyar")
|
||||
x => 28
|
||||
y => "Iyar"
|
||||
hebdate(28, "Iyar") => 1991/05/12
|
||||
trigger(1991/05/12) => "12 May 1991"
|
||||
hebdate(28, "Iyar") => 1991-05-12
|
||||
trigger(1991-05-12) => "12 May 1991"
|
||||
Leaving UserFN _h() => "12 May 1991"
|
||||
../tests/test.rem(25): Trig = Sunday, 12 May, 1991
|
||||
[_h(6, "Sivan")] MSG Shavuot
|
||||
Entering UserFN _h(6, "Sivan")
|
||||
x => 6
|
||||
y => "Sivan"
|
||||
hebdate(6, "Sivan") => 1991/05/19
|
||||
trigger(1991/05/19) => "19 May 1991"
|
||||
hebdate(6, "Sivan") => 1991-05-19
|
||||
trigger(1991-05-19) => "19 May 1991"
|
||||
Leaving UserFN _h() => "19 May 1991"
|
||||
../tests/test.rem(26): Trig = Sunday, 19 May, 1991
|
||||
[_h(9, "Av")] MSG Tish'a B'Av
|
||||
Entering UserFN _h(9, "Av")
|
||||
x => 9
|
||||
y => "Av"
|
||||
hebdate(9, "Av") => 1991/07/20
|
||||
trigger(1991/07/20) => "20 July 1991"
|
||||
hebdate(9, "Av") => 1991-07-20
|
||||
trigger(1991-07-20) => "20 July 1991"
|
||||
Leaving UserFN _h() => "20 July 1991"
|
||||
../tests/test.rem(27): Trig = Saturday, 20 July, 1991
|
||||
|
||||
# Test some jahrzeit cases
|
||||
fset _i(x,y,z,a) trigger(hebdate(x,y,z,a))
|
||||
[_i(30, "Heshvan", today(), 5759)] MSG Complete-Complete
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5759)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Heshvan", 1991-02-16, 5759)
|
||||
x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5759
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5759) => 1991/11/07
|
||||
trigger(1991/11/07) => "7 November 1991"
|
||||
hebdate(30, "Heshvan", 1991-02-16, 5759) => 1991-11-07
|
||||
trigger(1991-11-07) => "7 November 1991"
|
||||
Leaving UserFN _i() => "7 November 1991"
|
||||
../tests/test.rem(31): Trig = Thursday, 7 November, 1991
|
||||
[_i(30, "Heshvan", today(), 5760)] MSG Complete-Defective
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5760)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Heshvan", 1991-02-16, 5760)
|
||||
x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5760
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5760) => 1991/11/07
|
||||
trigger(1991/11/07) => "7 November 1991"
|
||||
hebdate(30, "Heshvan", 1991-02-16, 5760) => 1991-11-07
|
||||
trigger(1991-11-07) => "7 November 1991"
|
||||
Leaving UserFN _i() => "7 November 1991"
|
||||
../tests/test.rem(32): Trig = Thursday, 7 November, 1991
|
||||
[_i(30, "Heshvan", today(), 5761)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5761)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Heshvan", 1991-02-16, 5761)
|
||||
x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5761
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5761) => ../tests/test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
|
||||
hebdate(30, "Heshvan", 1991-02-16, 5761) => ../tests/test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
[_i(30, "Kislev", today(), 5759)] MSG Complete-Complete
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5759)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Kislev", 1991-02-16, 5759)
|
||||
x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5759
|
||||
hebdate(30, "Kislev", 1991/02/16, 5759) => 1991/12/07
|
||||
trigger(1991/12/07) => "7 December 1991"
|
||||
hebdate(30, "Kislev", 1991-02-16, 5759) => 1991-12-07
|
||||
trigger(1991-12-07) => "7 December 1991"
|
||||
Leaving UserFN _i() => "7 December 1991"
|
||||
../tests/test.rem(35): Trig = Saturday, 7 December, 1991
|
||||
[_i(30, "Kislev", today(), 5760)] MSG Complete-Defective
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5760)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Kislev", 1991-02-16, 5760)
|
||||
x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5760
|
||||
hebdate(30, "Kislev", 1991/02/16, 5760) => 1991/12/07
|
||||
trigger(1991/12/07) => "7 December 1991"
|
||||
hebdate(30, "Kislev", 1991-02-16, 5760) => 1991-12-07
|
||||
trigger(1991-12-07) => "7 December 1991"
|
||||
Leaving UserFN _i() => "7 December 1991"
|
||||
../tests/test.rem(36): Trig = Saturday, 7 December, 1991
|
||||
[_i(30, "Kislev", today(), 5761)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5761)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Kislev", 1991-02-16, 5761)
|
||||
x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5761
|
||||
hebdate(30, "Kislev", 1991/02/16, 5761) => ../tests/test.rem(37): 30 Kislev 5761: Invalid Hebrew date
|
||||
hebdate(30, "Kislev", 1991-02-16, 5761) => ../tests/test.rem(37): 30 Kislev 5761: Invalid Hebrew date
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
[_i(30, "Adar A", today(), 5755)] MSG Leap
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Adar A", 1991/02/16, 5755)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Adar A", 1991-02-16, 5755)
|
||||
x => 30
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5755
|
||||
hebdate(30, "Adar A", 1991/02/16, 5755) => 1992/03/05
|
||||
trigger(1992/03/05) => "5 March 1992"
|
||||
hebdate(30, "Adar A", 1991-02-16, 5755) => 1992-03-05
|
||||
trigger(1992-03-05) => "5 March 1992"
|
||||
Leaving UserFN _i() => "5 March 1992"
|
||||
../tests/test.rem(39): Trig = Thursday, 5 March, 1992
|
||||
[_i(30, "Adar A", today(), 5756)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Adar A", 1991/02/16, 5756)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(30, "Adar A", 1991-02-16, 5756)
|
||||
x => 30
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5756
|
||||
hebdate(30, "Adar A", 1991/02/16, 5756) => ../tests/test.rem(40): No Adar A in 5756
|
||||
hebdate(30, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(40): No Adar A in 5756
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
[_i(29, "Adar A", today(), 5755)] MSG Leap
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(29, "Adar A", 1991/02/16, 5755)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(29, "Adar A", 1991-02-16, 5755)
|
||||
x => 29
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5755
|
||||
hebdate(29, "Adar A", 1991/02/16, 5755) => 1991/03/15
|
||||
trigger(1991/03/15) => "15 March 1991"
|
||||
hebdate(29, "Adar A", 1991-02-16, 5755) => 1991-03-15
|
||||
trigger(1991-03-15) => "15 March 1991"
|
||||
Leaving UserFN _i() => "15 March 1991"
|
||||
../tests/test.rem(41): Trig = Friday, 15 March, 1991
|
||||
[_i(29, "Adar A", today(), 5756)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(29, "Adar A", 1991/02/16, 5756)
|
||||
today() => 1991-02-16
|
||||
Entering UserFN _i(29, "Adar A", 1991-02-16, 5756)
|
||||
x => 29
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
z => 1991-02-16
|
||||
a => 5756
|
||||
hebdate(29, "Adar A", 1991/02/16, 5756) => ../tests/test.rem(42): No Adar A in 5756
|
||||
hebdate(29, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(42): No Adar A in 5756
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
@@ -463,19 +463,19 @@ CLEAR-OMIT-CONTEXT
|
||||
REM Fri SATISFY 1
|
||||
../tests/test.rem(154): Trig = Friday, 22 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991/02/22
|
||||
trigger(1991/02/22) => "22 February 1991"
|
||||
trigdate() => 1991-02-22
|
||||
trigger(1991-02-22) => "22 February 1991"
|
||||
REM Fri after MSG 23 Feb 1991
|
||||
../tests/test.rem(156): Trig = Saturday, 23 February, 1991
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 7 => 1991/02/09
|
||||
trigger(1991/02/09) => "9 February 1991"
|
||||
today() => 1991-02-16
|
||||
1991-02-16 - 7 => 1991-02-09
|
||||
trigger(1991-02-09) => "9 February 1991"
|
||||
../tests/test.rem(158): Trig = Friday, 15 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991/02/15
|
||||
trigger(1991/02/15) => "15 February 1991"
|
||||
trigdate() => 1991-02-15
|
||||
trigger(1991-02-15) => "15 February 1991"
|
||||
REM Fri after MSG 16 Feb 1991
|
||||
../tests/test.rem(160): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
@@ -497,8 +497,8 @@ choose(3, "foo", "bar", "baz", "blech") => "baz"
|
||||
set a006 coerce("string", 1)
|
||||
coerce("string", 1) => "1"
|
||||
set a007 coerce("string", today())
|
||||
today() => 1991/02/16
|
||||
coerce("string", 1991/02/16) => "1991/02/16"
|
||||
today() => 1991-02-16
|
||||
coerce("string", 1991-02-16) => "1991-02-16"
|
||||
set a008 coerce("string", 11:44)
|
||||
coerce("string", 11:44) => "11:44"
|
||||
set a009 coerce("int", "badnews")
|
||||
@@ -509,16 +509,16 @@ coerce("int", "12") => 12
|
||||
set a011 coerce("int", 11:44)
|
||||
coerce("int", 11:44) => 704
|
||||
set a012 coerce("int", today())
|
||||
today() => 1991/02/16
|
||||
coerce("int", 1991/02/16) => 411
|
||||
today() => 1991-02-16
|
||||
coerce("int", 1991-02-16) => 411
|
||||
set a013 date(1992, 2, 2)
|
||||
date(1992, 2, 2) => 1992/02/02
|
||||
date(1992, 2, 2) => 1992-02-02
|
||||
set a014 date(1993, 2, 29)
|
||||
date(1993, 2, 29) => Bad date specification
|
||||
../tests/test.rem(176): Bad date specification
|
||||
set a015 day(today())
|
||||
today() => 1991/02/16
|
||||
day(1991/02/16) => 16
|
||||
today() => 1991-02-16
|
||||
day(1991-02-16) => 16
|
||||
set a016 daysinmon(2, 1991)
|
||||
daysinmon(2, 1991) => 28
|
||||
set a017 daysinmon(2, 1992)
|
||||
@@ -542,20 +542,20 @@ index("barfoobar", "foo") => 4
|
||||
set a026 index("barfoobar", "bar", 2)
|
||||
index("barfoobar", "bar", 2) => 7
|
||||
set a027 isleap(today())
|
||||
today() => 1991/02/16
|
||||
isleap(1991/02/16) => 0
|
||||
today() => 1991-02-16
|
||||
isleap(1991-02-16) => 0
|
||||
set a028 isleap(1992)
|
||||
isleap(1992) => 1
|
||||
omit [trigger(today())]
|
||||
today() => 1991/02/16
|
||||
trigger(1991/02/16) => "16 February 1991"
|
||||
today() => 1991-02-16
|
||||
trigger(1991-02-16) => "16 February 1991"
|
||||
set a030 isomitted(today())
|
||||
today() => 1991/02/16
|
||||
isomitted(1991/02/16) => 1
|
||||
today() => 1991-02-16
|
||||
isomitted(1991-02-16) => 1
|
||||
clear
|
||||
set a029 isomitted(today())
|
||||
today() => 1991/02/16
|
||||
isomitted(1991/02/16) => 0
|
||||
today() => 1991-02-16
|
||||
isomitted(1991-02-16) => 0
|
||||
set a031 lower("FOOBARBAZ")
|
||||
lower("FOOBARBAZ") => "foobarbaz"
|
||||
set a032 max(1, 2, 34, 1, 3)
|
||||
@@ -563,31 +563,31 @@ max(1, 2, 34, 1, 3) => 34
|
||||
set a033 max("foo", "bar", "baz")
|
||||
max("foo", "bar", "baz") => "foo"
|
||||
set a034 max(today(), today()+1, today()-1)
|
||||
today() => 1991/02/16
|
||||
today() => 1991/02/16
|
||||
1991/02/16 + 1 => 1991/02/17
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 1 => 1991/02/15
|
||||
max(1991/02/16, 1991/02/17, 1991/02/15) => 1991/02/17
|
||||
today() => 1991-02-16
|
||||
today() => 1991-02-16
|
||||
1991-02-16 + 1 => 1991-02-17
|
||||
today() => 1991-02-16
|
||||
1991-02-16 - 1 => 1991-02-15
|
||||
max(1991-02-16, 1991-02-17, 1991-02-15) => 1991-02-17
|
||||
set a035 min(1, 2, 34, 1, 3)
|
||||
min(1, 2, 34, 1, 3) => 1
|
||||
set a036 min("foo", "bar", "baz")
|
||||
min("foo", "bar", "baz") => "bar"
|
||||
set a037 min(today(), today()+1, today()-1)
|
||||
today() => 1991/02/16
|
||||
today() => 1991/02/16
|
||||
1991/02/16 + 1 => 1991/02/17
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 1 => 1991/02/15
|
||||
min(1991/02/16, 1991/02/17, 1991/02/15) => 1991/02/15
|
||||
today() => 1991-02-16
|
||||
today() => 1991-02-16
|
||||
1991-02-16 + 1 => 1991-02-17
|
||||
today() => 1991-02-16
|
||||
1991-02-16 - 1 => 1991-02-15
|
||||
min(1991-02-16, 1991-02-17, 1991-02-15) => 1991-02-15
|
||||
set a038 minute(11:33)
|
||||
minute(11:33) => 33
|
||||
set a039 mon(today())
|
||||
today() => 1991/02/16
|
||||
mon(1991/02/16) => "February"
|
||||
today() => 1991-02-16
|
||||
mon(1991-02-16) => "February"
|
||||
set a040 monnum(today())
|
||||
today() => 1991/02/16
|
||||
monnum(1991/02/16) => 2
|
||||
today() => 1991-02-16
|
||||
monnum(1991-02-16) => 2
|
||||
set a041 ord(3)
|
||||
ord(3) => "3rd"
|
||||
set a042 ord(4)
|
||||
@@ -620,7 +620,7 @@ time(3, 7) => 03:07
|
||||
rem 10 jan 1992 AT 11:22 CAL
|
||||
../tests/test.rem(217): Trig = Friday, 10 January, 1992
|
||||
set a053 trigdate()
|
||||
trigdate() => 1992/01/10
|
||||
trigdate() => 1992-01-10
|
||||
set a054 trigtime()
|
||||
trigtime() => 11:22
|
||||
set a055 trigvalid()
|
||||
@@ -631,16 +631,16 @@ set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "03.00.24"
|
||||
version() => "03.01.00"
|
||||
set a059 wkday(today())
|
||||
today() => 1991/02/16
|
||||
wkday(1991/02/16) => "Saturday"
|
||||
today() => 1991-02-16
|
||||
wkday(1991-02-16) => "Saturday"
|
||||
set a060 wkdaynum(today())
|
||||
today() => 1991/02/16
|
||||
wkdaynum(1991/02/16) => 6
|
||||
today() => 1991-02-16
|
||||
wkdaynum(1991-02-16) => 6
|
||||
set a061 year(today())
|
||||
today() => 1991/02/16
|
||||
year(1991/02/16) => 1991
|
||||
today() => 1991-02-16
|
||||
year(1991-02-16) => 1991
|
||||
set a062 1+2*(3+4-(5*7/2))
|
||||
3 + 4 => 7
|
||||
5 * 7 => 35
|
||||
@@ -666,8 +666,8 @@ typeof("foo") => "STRING"
|
||||
set a069 typeof(11:33)
|
||||
typeof(11:33) => "TIME"
|
||||
set a070 typeof(today())
|
||||
today() => 1991/02/16
|
||||
typeof(1991/02/16) => "DATE"
|
||||
today() => 1991-02-16
|
||||
typeof(1991-02-16) => "DATE"
|
||||
fset g(x,y) max(x,y)
|
||||
fset h(x,y) min(g(x+y, x*y), g(x-y, x/y))
|
||||
set a071 g(1, 2)
|
||||
@@ -713,25 +713,25 @@ y => 11:33
|
||||
../tests/test.rem(240): `*': Type mismatch
|
||||
Leaving UserFN h() => Type mismatch
|
||||
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
|
||||
dosubst("%a %b %c %d %e %f %g %h", 1992/05/05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
dosubst("%a %b %c %d %e %f %g %h", 1992-05-05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
msg [a074]%
|
||||
../tests/test.rem(242): Trig = Saturday, 16 February, 1991
|
||||
a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05/05/1992 on 05/05/1992 on Tuesday, 5 May on 05/05
|
||||
on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05-05-1992 on 05-05-1992 on Tuesday, 5 May on 05-05
|
||||
set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
|
||||
dosubst("%i %j %k %l %m %n %o %p", 1992/05/05) => "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
dosubst("%i %j %k %l %m %n %o %p", 1992-05-05) => "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
msg [a075]%
|
||||
../tests/test.rem(244): Trig = Saturday, 16 February, 1991
|
||||
a075 => "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
on 05/05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992/05/05 May 5 s
|
||||
a075 => "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
on 05-05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992-05-05 May 5 s
|
||||
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
|
||||
dosubst("%q %r %s %t %u %v %w %x", 1992/05/05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
dosubst("%q %r %s %t %u %v %w %x", 1992-05-05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
msg [a076]%
|
||||
../tests/test.rem(246): Trig = Saturday, 16 February, 1991
|
||||
a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444
|
||||
set a077 dosubst("%y %z", '1992/5/5')
|
||||
dosubst("%y %z", 1992/05/05) => "1992 92
|
||||
dosubst("%y %z", 1992-05-05) => "1992 92
|
||||
"
|
||||
msg [a077]%
|
||||
../tests/test.rem(248): Trig = Saturday, 16 February, 1991
|
||||
@@ -739,92 +739,92 @@ a077 => "1992 92
|
||||
"
|
||||
1992 92
|
||||
set a078 easterdate(today())
|
||||
today() => 1991/02/16
|
||||
easterdate(1991/02/16) => 1991/03/31
|
||||
today() => 1991-02-16
|
||||
easterdate(1991-02-16) => 1991-03-31
|
||||
set a079 easterdate(1992)
|
||||
easterdate(1992) => 1992/04/19
|
||||
easterdate(1992) => 1992-04-19
|
||||
set a080 easterdate(1995)
|
||||
easterdate(1995) => 1995/04/16
|
||||
easterdate(1995) => 1995-04-16
|
||||
set a081 ""
|
||||
dump
|
||||
Variable Value
|
||||
Variable Value
|
||||
|
||||
a017 29
|
||||
a036 "bar"
|
||||
a055 1
|
||||
a074 "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
a008 "11:44"
|
||||
a027 0
|
||||
a046 "ies"
|
||||
a065 1
|
||||
a018 1
|
||||
a037 1991/02/15
|
||||
a056 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a075 "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
a028 1
|
||||
a047 -1
|
||||
a066 0
|
||||
a019 0
|
||||
a038 33
|
||||
a057 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a076 "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
a029 0
|
||||
a048 "foo"
|
||||
a067 "INT"
|
||||
a039 "February"
|
||||
a058 "03.00.24"
|
||||
a077 "1992 92
|
||||
a017 29
|
||||
a036 "bar"
|
||||
a055 1
|
||||
a074 "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
a008 "11:44"
|
||||
a027 0
|
||||
a046 "ies"
|
||||
a065 1
|
||||
a018 1
|
||||
a037 1991-02-15
|
||||
a056 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a075 "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
a028 1
|
||||
a047 -1
|
||||
a066 0
|
||||
a019 0
|
||||
a038 33
|
||||
a057 "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
a076 "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
a029 0
|
||||
a048 "foo"
|
||||
a067 "INT"
|
||||
a039 "February"
|
||||
a058 "03.01.00"
|
||||
a077 "1992 92
|
||||
"
|
||||
a049 21
|
||||
a068 "STRING"
|
||||
a059 "Saturday"
|
||||
a078 1991/03/31
|
||||
a069 "TIME"
|
||||
a079 1992/04/19
|
||||
a000 1
|
||||
a010 12
|
||||
a001 1
|
||||
a020 "../tests/test.rem"
|
||||
a011 704
|
||||
a030 1
|
||||
a002 102
|
||||
a021 "foo bar baz"
|
||||
a040 2
|
||||
a012 411
|
||||
a031 "foobarbaz"
|
||||
a003 1990
|
||||
a022 11
|
||||
a041 "3rd"
|
||||
a060 6
|
||||
a013 1992/02/02
|
||||
a032 34
|
||||
a070 "DATE"
|
||||
a004 "B7BMB"
|
||||
a023 1
|
||||
a042 "4th"
|
||||
a061 1991
|
||||
a080 1995/04/16
|
||||
a033 "foo"
|
||||
a052 03:07
|
||||
a071 2
|
||||
a005 "baz"
|
||||
a024 0
|
||||
a043 "UNIX"
|
||||
a062 -19
|
||||
a081 ""
|
||||
a015 16
|
||||
a034 1991/02/17
|
||||
a053 1992/01/10
|
||||
a072 0
|
||||
a006 "1"
|
||||
a025 4
|
||||
a044 "s"
|
||||
a063 0
|
||||
a016 28
|
||||
a035 1
|
||||
a054 11:22
|
||||
a007 "1991/02/16"
|
||||
a026 7
|
||||
a045 "iess"
|
||||
a064 1
|
||||
a049 21
|
||||
a068 "STRING"
|
||||
a059 "Saturday"
|
||||
a078 1991-03-31
|
||||
a069 "TIME"
|
||||
a079 1992-04-19
|
||||
a000 1
|
||||
a010 12
|
||||
a001 1
|
||||
a020 "../tests/test.rem"
|
||||
a011 704
|
||||
a030 1
|
||||
a002 102
|
||||
a021 "foo bar baz"
|
||||
a040 2
|
||||
a012 411
|
||||
a031 "foobarbaz"
|
||||
a003 1990
|
||||
a022 11
|
||||
a041 "3rd"
|
||||
a060 6
|
||||
a013 1992-02-02
|
||||
a032 34
|
||||
a070 "DATE"
|
||||
a004 "B7BMB"
|
||||
a023 1
|
||||
a042 "4th"
|
||||
a061 1991
|
||||
a080 1995-04-16
|
||||
a033 "foo"
|
||||
a052 03:07
|
||||
a071 2
|
||||
a005 "baz"
|
||||
a024 0
|
||||
a043 "UNIX"
|
||||
a062 -19
|
||||
a081 ""
|
||||
a015 16
|
||||
a034 1991-02-17
|
||||
a053 1992-01-10
|
||||
a072 0
|
||||
a006 "1"
|
||||
a025 4
|
||||
a044 "s"
|
||||
a063 0
|
||||
a016 28
|
||||
a035 1
|
||||
a054 11:22
|
||||
a007 "1991-02-16"
|
||||
a026 7
|
||||
a045 "iess"
|
||||
a064 1
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Test file for REMIND
|
||||
#
|
||||
# $Id: test1.cmp,v 1.2 1998-03-01 20:44:20 dfs Exp $
|
||||
#
|
||||
# Use this file to test the date calculation routines
|
||||
# of the REMIND program by typing:
|
||||
#
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Test file for REMIND
|
||||
#
|
||||
# $Id: test2.cmp,v 1.2 1998-03-01 20:44:21 dfs Exp $
|
||||
#
|
||||
# Use this file to test the date calculation routines
|
||||
# of the REMIND program by typing:
|
||||
#
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#
|
||||
# TSTLANG.REM
|
||||
#
|
||||
# $Id: tstlang.rem,v 1.3 2000-02-18 03:46:33 dfs Exp $
|
||||
#
|
||||
# Use this file to test new language headers you may want to create.
|
||||
# Usage: remind -rq tstlang.rem
|
||||
#
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
#$Id: unconfigure,v 1.1 1998-01-17 03:58:13 dfs Exp $
|
||||
echo "Unconfiguring Remind..."
|
||||
echo rm -f config.cache config.log config.status src/Makefile src/config.h
|
||||
rm -f config.cache config.log config.status src/Makefile src/config.h
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
# Copyright (C) 1992-1997 by David F. Skoll
|
||||
# Copyright (C) 1999 by Roaring Penguin Software Inc.
|
||||
|
||||
# $Id: Makefile,v 1.13 2000-06-26 14:44:17 dfs Exp $
|
||||
|
||||
# The complete name of your www host. Example: www.mycompany.com
|
||||
WWWHOST = localhost
|
||||
# WWWHOST = www.mycompany.com
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
README
|
||||
$Id: README,v 1.7 1997-08-31 17:17:51 dfs Exp $
|
||||
|
||||
HTML Hebrew Calendar Server
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
REM2HTML
|
||||
$Id: README.rem2html,v 1.3 1998-01-24 03:20:11 dfs Exp $
|
||||
|
||||
Rem2HTML is a Perl script which transforms the output of
|
||||
`remind -p ...' to an HTML table. Type `perl rem2html --help' for
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
# CAL_DISPATCH -- Shell script for CGI directory to dispatch calendar
|
||||
# commands.
|
||||
#
|
||||
# $Id: cal_dispatch-DIST,v 1.5 2000-02-18 03:46:34 dfs Exp $
|
||||
#
|
||||
# WARNING WARNING WARNING -- If your /bin/sh is really GNU's "bash",
|
||||
# make sure you don't have a buggy version which treats char 0xFF as
|
||||
# a command separator -- it is a security risk!
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user