From d0be59edff8c1c0fa58695dc3b91fdd54e497297 Mon Sep 17 00:00:00 2001 From: dfs Date: Wed, 18 Dec 1996 00:20:43 +0000 Subject: [PATCH] -- Changed version number. -- Made sunrise() and sunset() distinguish between cases when sun never rises and sun never sets. --- Makefile | 14 +++++++------- Makefile_QDOS | 4 ++-- README_QDOS | 4 ++-- WHATSNEW.30 | 15 +++++++++++++++ defs.rem | 10 +++++++++- funcs.c | 23 +++++++++++++++++++++-- makefile.bcc | 4 ++-- makefile.tc | 4 ++-- rem2ps.c | 10 ++++++---- remind.1 | 7 ++++--- remind.LSM | 4 ++-- test-rem.ami | 4 ++-- test.cmp | 4 ++-- test1.cmp | 6 +++--- test2.cmp | 6 +++--- version.h | 4 ++-- 16 files changed, 84 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index a85fd947..1d5a8eb3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Makefile for REMIND -# $Id: Makefile,v 1.15 1996-10-27 21:49:54 dfs Exp $ +# $Id: Makefile,v 1.16 1996-12-18 00:20:43 dfs Exp $ #----------------------------------------------------------------------------- # THINGS FOR YOU TO EDIT START BELOW @@ -54,7 +54,7 @@ GROUP=bin # YOU SHOULDN'T EDIT ANYTHING BELOW HERE. You may want to change some things # in config.h; then, you should be able to type 'make'. #----------------------------------------------------------------------------- -VERSION= 03.00.15 +VERSION= 03.00.16 MATHLIB= -lm HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \ @@ -133,9 +133,9 @@ tgz: -rm -rf remind-$(VERSION) -mkdir remind-$(VERSION) cd remind-$(VERSION); for i in $(MANIFEST) ;do ln -s ../$$i .; done; cd .. - tar -c -h -v -f remind-3.0.15.tar remind-$(VERSION) - gzip -v -9 remind-3.0.15.tar - mv remind-3.0.15.tar.gz remind-3.0.15.tgz + tar -c -h -v -f remind-3.0.16.tar remind-$(VERSION) + gzip -v -9 remind-3.0.16.tar + mv remind-3.0.16.tar.gz remind-3.0.16.tgz rm -rf remind-$(VERSION) shar: @@ -206,9 +206,9 @@ install-man: release: -mkdir RELEASE -rm -f RELEASE/* - mkpatch ../prev . patch.15 Shar "Remind-3.0/Patch-15/part" + mkpatch ../prev . patch.16 Shar "Remind-3.0/Patch-15/part" mv Shar* RELEASE - rm -f patch.15* + rm -f patch.16* for i in *.1; do nroff -man $$i | sed -e 's/_//g' > `basename $$i .1`.man; done mv *.man RELEASE for i in *.1; do groff -man -Tps $$i > `basename $$i .1`.ps; done diff --git a/Makefile_QDOS b/Makefile_QDOS index f6180628..8e2045c7 100644 --- a/Makefile_QDOS +++ b/Makefile_QDOS @@ -1,4 +1,4 @@ -#$Id: Makefile_QDOS,v 1.3 1996-09-28 18:17:06 dfs Exp $ +#$Id: Makefile_QDOS,v 1.4 1996-12-18 00:20:43 dfs Exp $ # Makefile for REMIND for QDOS / SMSQ #----------------------------------------------------------------------------- @@ -24,7 +24,7 @@ LDFLAGS= -bufp200K # YOU SHOULDN'T EDIT ANYTHING BELOW HERE. You may want to change some things # in config_h; then, you should be able to type 'make'. #----------------------------------------------------------------------------- -VERSION= 03.00.15 +VERSION= 03.00.16 MATHLIB= -lm HDRS= config_h err_h expr_h globals_h protos_h types_h version_h \ diff --git a/README_QDOS b/README_QDOS index 23210ed0..88bbe707 100644 --- a/README_QDOS +++ b/README_QDOS @@ -1,5 +1,5 @@ -$Id: README_QDOS,v 1.3 1996-09-28 18:17:07 dfs Exp $ -REMIND version 3.0.15 for QDOS / SMSQ +$Id: README_QDOS,v 1.4 1996-12-18 00:20:44 dfs Exp $ +REMIND version 3.0.16 for QDOS / SMSQ REMIND is a sophisticated alarm/calendar program. Details are given in the documentation file, "remind_doc" (QUILL format). diff --git a/WHATSNEW.30 b/WHATSNEW.30 index 53e2b056..9270333d 100644 --- a/WHATSNEW.30 +++ b/WHATSNEW.30 @@ -6,6 +6,21 @@ CHANGES TO REMIND - Added support for the Romanian language, courtesy of Liviu Daia +- Changed sunrise() and sunset() as follows: If the sun never rises, + sunrise() returns 1440 and sunset() returns 0. In this case, + sunrise()-sunset() returns the length of the dark period of the + day, in minutes. If the sun never sets, sunrise() returns 0 and + sunset() returns 1440, and sunset()-sunrise() returns the length + of the light period of the day, in minutes. Thanks to Michael Salmon + for explaining the utility of this. See the file "defs.rem" for the + functions _light_len and _dark_len which return the length in minutes + of the light and dark period of the day, respectively. + ++ BUG FIXES + +- Fixed a problem under Solaris 2.5 whereby rem2ps was skipping some + latin1 characters which it interpreted as white space. + * Version 3.0 Patch 15 + IMPORTANT NOTES diff --git a/defs.rem b/defs.rem index 5733470b..a8b1ef85 100644 --- a/defs.rem +++ b/defs.rem @@ -22,7 +22,7 @@ ############################################################################# # -# $Id: defs.rem,v 1.1 1996-03-27 03:25:51 dfs Exp $ +# $Id: defs.rem,v 1.2 1996-12-18 00:20:44 dfs Exp $ # RUN OFF @@ -160,6 +160,14 @@ FSET _am_pm(tm) IIF(tm<01:00, tm+12*60+"am", \ FSET _no_lz(s) IIF(SUBSTR(s, 1, 1)=="0", SUBSTR(s, 2), s) +################################################################# +# Return the length of the daylight/night portion of a date, # +# in minutes. # +################################################################# + +FSET _light_len(date) MAX(SUNSET(date)-SUNRISE(date), 0) +FSET _dark_len(date) 1440-_light_len(date) + ############################################################ # Function to calculate number of years since a given year # # or number of months since a given month and year... # diff --git a/funcs.c b/funcs.c index 61cccbed..0f6e5233 100644 --- a/funcs.c +++ b/funcs.c @@ -10,7 +10,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: funcs.c,v 1.4 1996-10-06 21:03:49 dfs Exp $"; +static char const RCSID[] = "$Id: funcs.c,v 1.5 1996-12-18 00:20:45 dfs Exp $"; #include "config.h" #include @@ -2030,7 +2030,14 @@ int jul; /* Cosine of sun's local hour angle */ cosH = (cosz - sinDelta * sin(latitude)) / (cosDelta * cos(latitude)); - if (cosH > 1.0 || cosH < -1.0) return NO_TIME; + if (cosH < -1.0) { /* Summer -- permanent daylight */ + if (rise) return NO_TIME; + else return -NO_TIME; + } + if (cosH > 1.0) { /* Winter -- permanent darkness */ + if (rise) return -NO_TIME; + else return NO_TIME; + } H = RADDEG * acos(cosH); if (rise) H = 360.0 - H; @@ -2049,6 +2056,15 @@ int jul; hours = (int) local; mins = (int) ((local - hours) * 60.0); + /* Sometimes, we get roundoff error. Check for "reasonableness" of + answer. */ + if (rise) { + /* Sunrise so close to midnight it wrapped around -- permament light */ + if (hours >= 23) return NO_TIME; + } else { + /* Sunset so close to midnight it wrapped around -- permament light */ + if (hours <= 1) return -NO_TIME; + } return hours*60 + mins; } @@ -2077,6 +2093,9 @@ int rise; if (r == NO_TIME) { RetVal.v.val = 0; RetVal.type = INT_TYPE; + } else if (r == -NO_TIME) { + RetVal.v.val = 1440; + RetVal.type = INT_TYPE; } else { RetVal.v.val = r; RetVal.type = TIM_TYPE; diff --git a/makefile.bcc b/makefile.bcc index 39cd58c0..ad6a55db 100644 --- a/makefile.bcc +++ b/makefile.bcc @@ -1,7 +1,7 @@ # Makefile for REMIND for Borland C++ -# $Id: makefile.bcc,v 1.3 1996-09-28 18:17:07 dfs Exp $ +# $Id: makefile.bcc,v 1.4 1996-12-18 00:20:46 dfs Exp $ -VERSION= 03.00.15 +VERSION= 03.00.16 MODEL=l diff --git a/makefile.tc b/makefile.tc index baa9d471..18f653d3 100644 --- a/makefile.tc +++ b/makefile.tc @@ -1,8 +1,8 @@ # Makefile for REMIND for Turbo C for MSDOS -# $Id: makefile.tc,v 1.3 1996-09-28 18:17:08 dfs Exp $ +# $Id: makefile.tc,v 1.4 1996-12-18 00:20:46 dfs Exp $ CC= tcc -VERSION= 03.00.15 +VERSION= 03.00.16 HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \ lang.h english.h german.h dutch.h finnish.h french.h norwgian.h \ diff --git a/rem2ps.c b/rem2ps.c index bca2fd32..da619ebf 100644 --- a/rem2ps.c +++ b/rem2ps.c @@ -9,7 +9,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: rem2ps.c,v 1.4 1996-07-07 16:35:42 dfs Exp $"; +static char const RCSID[] = "$Id: rem2ps.c,v 1.5 1996-12-18 00:20:46 dfs Exp $"; #include "config.h" #include "lang.h" @@ -550,16 +550,18 @@ char *s; printf(" ["); /* Chew up leading spaces */ - while(isspace(*s)) s++; + while(isspace((unsigned char) *s)) s++; PutChar('('); while(*s) { - c = *s++; + /* Use the "unsigned char" cast to fix problem on Solaris 2.5 */ + /* which treated some latin1 characters as white space. */ + c = (unsigned char) *s++; if (c == '\\' || c == '(' || c == ')') PutChar('\\'); if (!isspace(c)) PutChar(c); else { PutChar(')'); - while(isspace(*s)) s++; + while(isspace((unsigned char)*s)) s++; if (!*s) { printf("]\n"); return; diff --git a/remind.1 b/remind.1 index e3fb3546..877d5e46 100644 --- a/remind.1 +++ b/remind.1 @@ -1,4 +1,4 @@ -.\" $Id: remind.1,v 1.6 1996-12-10 02:36:34 dfs Exp $ +.\" $Id: remind.1,v 1.7 1996-12-18 00:20:47 dfs Exp $ .TH REMIND 1 "27 April 1996" .UC 4 .SH NAME @@ -2157,13 +2157,14 @@ of \fIstr\fR. Returns a \fBTIME\fR indicating the time of sunrise on the specified \fIdate\fR (default \fBtoday()\fR.) In high lattitudes, there may be no sunrise on a particular day, in which case \fBsunrise()\fR -returns the \fBINT\fR 0. +returns the \fBINT\fR 0 if the sun never sets, or 1440 if it never rises. .TP .B sunset([d_date]) Returns a \fBTIME\fR indicating the time of sunset on the specified \fIdate\fR (default \fBtoday()\fR.) In high lattitudes, there may be no sunset on a particular day, in which case \fBsunset()\fR -returns the \fBINT\fR 0. +returns the \fBINT\fR 0 if the sun never rises, or 1440 if it never +sets. .RS .PP The functions \fBsunrise()\fR and \fBsunset()\fR are based on diff --git a/remind.LSM b/remind.LSM index 756dd945..eae6311c 100644 --- a/remind.LSM +++ b/remind.LSM @@ -1,6 +1,6 @@ Begin3 Title: Remind -Version: 03.00.15 +Version: 03.00.16 Entered-date: 27 October 1996 Description: Full-featured calendar/reminder program featuring sophisticated date calculation, moon phases, sunrise/sunset, @@ -12,7 +12,7 @@ Keywords: calendar reminder alarm datebook PostScript Author: aa775@freenet.carleton.ca (David F. Skoll) Maintained-by: aa775@freenet.carleton.ca (David F. Skoll) Primary-site: ftp.doe.carleton.ca /pub/Remind-3.0 - 215kB remind-3.0.15.tgz + 215kB remind-3.0.16.tgz Alternate-site: Original-site: Platform: Linux, Solaris, SunOS, HP-UX -- virtually any UN*X-like diff --git a/test-rem.ami b/test-rem.ami index 16fcd603..e5a94f4b 100644 --- a/test-rem.ami +++ b/test-rem.ami @@ -631,7 +631,7 @@ set a057 value("a05"+"6") "a05" + "6" => "a056" value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH" set a058 version() -version() => "03.00.15" +version() => "03.00.16" set a059 wkday(today()) today() => 1991/02/16 wkday(1991/02/16) => "Saturday" @@ -772,7 +772,7 @@ dump a048 "foo" a067 "INT" a039 "February" - a058 "03.00.15" + a058 "03.00.16" a077 "1992 92 " a049 21 diff --git a/test.cmp b/test.cmp index c382f01c..a570b499 100644 --- a/test.cmp +++ b/test.cmp @@ -631,7 +631,7 @@ set a057 value("a05"+"6") "a05" + "6" => "a056" value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH" set a058 version() -version() => "03.00.15" +version() => "03.00.16" set a059 wkday(today()) today() => 1991/02/16 wkday(1991/02/16) => "Saturday" @@ -772,7 +772,7 @@ dump a048 "foo" a067 "INT" a039 "February" - a058 "03.00.15" + a058 "03.00.16" a077 "1992 92 " a049 21 diff --git a/test1.cmp b/test1.cmp index 3c719515..b2c0a3a3 100644 --- a/test1.cmp +++ b/test1.cmp @@ -1,6 +1,6 @@ # Test file for REMIND # -# $Id: test1.cmp,v 1.4 1996-09-28 18:17:09 dfs Exp $ +# $Id: test1.cmp,v 1.5 1996-12-18 00:20:50 dfs Exp $ # # Use this file to test the date calculation routines # of the REMIND program by typing: @@ -633,7 +633,7 @@ set a057 value("a05"+"6") "a05" + "6" => "a056" value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH" set a058 version() -version() => "03.00.15" +version() => "03.00.16" set a059 wkday(today()) today() => 1991/02/16 wkday(1991/02/16) => "Saturday" @@ -774,7 +774,7 @@ dump a048 "foo" a067 "INT" a039 "February" - a058 "03.00.15" + a058 "03.00.16" a077 "1992 92 " a049 21 diff --git a/test2.cmp b/test2.cmp index 2cf39ee7..d9287d81 100644 --- a/test2.cmp +++ b/test2.cmp @@ -1,6 +1,6 @@ # Test file for REMIND # -# $Id: test2.cmp,v 1.4 1996-09-28 18:17:10 dfs Exp $ +# $Id: test2.cmp,v 1.5 1996-12-18 00:20:50 dfs Exp $ # # Use this file to test the date calculation routines # of the REMIND program by typing: @@ -633,7 +633,7 @@ set a057 value("a05"+"6") "a05" + "6" => "a056" value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH" set a058 version() -version() => "03.00.15" +version() => "03.00.16" set a059 wkday(today()) today() => 1991/02/16 wkday(1991/02/16) => "Saturday" @@ -774,7 +774,7 @@ dump a048 "foo" a067 "INT" a039 "February" - a058 "03.00.15" + a058 "03.00.16" a077 "1992 92 " a049 21 diff --git a/version.h b/version.h index 20c0fed2..2e9a3392 100644 --- a/version.h +++ b/version.h @@ -9,5 +9,5 @@ /* */ /***************************************************************/ -/* $Id: version.h,v 1.3 1996-09-28 18:17:10 dfs Exp $ */ -#define VERSION "03.00.15" +/* $Id: version.h,v 1.4 1996-12-18 00:20:51 dfs Exp $ */ +#define VERSION "03.00.16"