diff --git a/MANIFEST.DOS b/MANIFEST.DOS deleted file mode 100644 index c49b927e..00000000 --- a/MANIFEST.DOS +++ /dev/null @@ -1,72 +0,0 @@ -calendar.c -config.h -copyrigh -danish.h -defs.rem -dorem.c -dosubst.c -dutch.h -english.h -err.h -expr.c -expr.h -files.c -finnish.h -french.h -funcs.c -german.h -globals.c -globals.h -hbcal.c -init.c -kall -kall.1 -lang.h -lnk.bcc -lnk.msc -lnk.tc -main.c -makefile -makefile.bcc -makefile.msc -makefile.os2 -makefile.tc -manifest.dos -manifest.unx -moon.c -norwgian.h -omit.c -os2func.c -polish.h -protos.h -queue.c -readme.bcc -readme.dos -readme.os2 -readme.uni -rem -rem.1 -rem2ps.1 -rem2ps.c -rem2ps.h -remind-a.csh -remind-a.sh -remind.1 -remind.def -sort.c -test-rem -test-rem.bat -test-rem.cmd -test.cmp -test.rem -test1.cmp -test2.cmp -token.c -trigger.c -tstlang.rem -types.h -userfns.c -utils.c -var.c -version.h -whatsnew.30 diff --git a/MANIFEST.UNX b/MANIFEST.UNX deleted file mode 100644 index 4c3195f2..00000000 --- a/MANIFEST.UNX +++ /dev/null @@ -1,72 +0,0 @@ -COPYRIGHT -MANIFEST.DOS -MANIFEST.UNX -Makefile -README.BCC -README.DOS -README.OS2 -README.UNIX -WHATSNEW.30 -calendar.c -config.h -danish.h -defs.rem -dorem.c -dosubst.c -dutch.h -english.h -err.h -expr.c -expr.h -files.c -finnish.h -french.h -funcs.c -german.h -globals.c -globals.h -hbcal.c -init.c -kall -kall.1 -lang.h -lnk.bcc -lnk.msc -lnk.tc -main.c -makefile.bcc -makefile.msc -makefile.os2 -makefile.tc -moon.c -norwgian.h -omit.c -os2func.c -polish.h -protos.h -queue.c -rem -rem.1 -rem2ps.1 -rem2ps.c -rem2ps.h -remind-all.csh -remind-all.sh -remind.1 -remind.def -sort.c -test-rem -test-rem.bat -test-rem.cmd -test.cmp -test.rem -test1.cmp -test2.cmp -token.c -trigger.c -tstlang.rem -types.h -userfns.c -utils.c -var.c -version.h diff --git a/Makefile b/Makefile index 4305bf69..38a91eb0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Makefile for REMIND -# $Id: Makefile,v 1.1 1996-03-27 03:25:48 dfs Exp $ +# $Id: Makefile,v 1.2 1996-03-31 04:01:51 dfs Exp $ #----------------------------------------------------------------------------- # THINGS FOR YOU TO EDIT START BELOW @@ -19,8 +19,8 @@ CC= gcc LD= gcc # Put any additional flags for the C compiler or linker here - if you -# are not using gcc, you probably want to remove '-ansi'. -CFLAGS= -O -ansi +# are not using gcc, you probably want to remove '-ansi -pedantic -Wall'. +CFLAGS= -O -ansi -pedantic -Wall CDEFS= LDFLAGS= @@ -128,24 +128,6 @@ tarZ: shar: shar -x -n"Remind $(VERSION)" -l45 -o./Shar $(MANIFEST) -todos: - mcopy -tn $(MANIFEST) a: - -fromdos: - mcopy -tn 'a:*' . - -mv -f copyrigh COPYRIGHT - -mv -f makefile Makefile - -mv -f readme.os2 README.OS2 - -mv -f readme.dos README.DOS - -mv -f readme.bcc README.BCC - -mv -f readme.uni README.UNIX - -mv -f remind-a.csh remind-all.csh - -mv -f remind-a.sh remind-all.sh - -mv -f manifest.dos MANIFEST.DOS - -mv -f manifest.unx MANIFEST.UNX - -mv -f whatsnew.30 WHATSNEW.30 - -chmod u+x test-rem - backup: cp $(MANIFEST) ../backup diff --git a/Makefile_QDOS b/Makefile_QDOS new file mode 100644 index 00000000..687092c0 --- /dev/null +++ b/Makefile_QDOS @@ -0,0 +1,86 @@ +#$Id: Makefile_QDOS,v 1.1 1996-03-31 04:01:52 dfs Exp $ +# Makefile for REMIND for QDOS / SMSQ + +#----------------------------------------------------------------------------- +# THINGS FOR YOU TO EDIT START BELOW +#----------------------------------------------------------------------------- + +# Uncomment the next lines if you want to use gcc instead of default compiler +# NOTE: Tempting as it may be, if you use 'cc' for the C compiler, do not +# use 'ld' for the linker. It will probably work much better if you use +# LD= cc rather than LD= ld. +# QDOS remark: I made it work the following way, and I found it to be working. +CC= cc +LD= ld + +# Put any additional flags for the C compiler or linker here - if you +# are not using gcc, you probably want to remove '-ansi'. +# QDOS remark: no -ansi option and no gcc on QDOS / SMSQ +CFLAGS= -V -O -DQDOS +CDEFS= +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.13 +MATHLIB= -lm + +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 \ +danish_h polish_h + +STDHDRS= config_h types_h protos_h globals_h err_h lang_h + +LANGHDRS= english_h german_h dutch_h finnish_h french_h norwgian_h danish_h \ +polish_h + +SRCS= calendar_c dorem_c dosubst_c expr_c files_c funcs_c globals_c hbcal_c \ +init_c main_c moon_c omit_c sort_c queue_c token_c trigger_c userfns_c \ +utils_c var_c + +OBJS= calendar_o dorem_o dosubst_o expr_o files_o funcs_o globals_o hbcal_o \ +init_o main_o moon_o omit_o sort_o queue_o token_o trigger_o userfns_o \ +utils_o var_o + +all: remind rem2ps + +# _c_o: +# $(CC) $(UNIX) $(SYSV) -c $(CFLAGS) $(CDEFS) $*_c + +rem2ps: rem2ps_o +# $(CC) $(CFLAGS) rem2ps_c + $(LD) $(LDFLAGS) -orem2ps rem2ps_o + +remind: $(OBJS) +# $(CC) $(CFLAGS) $(SRCS) + $(LD) $(LDFLAGS) -oremind $(OBJS) $(MATHLIB) + +rem2ps_o: rem2ps_c rem2ps_h lang_h config_h +calendar_o: calendar_c $(STDHDRS) expr_h +dorem_o: dorem_c $(STDHDRS) expr_h +dosubst_o: dosubst_c $(STDHDRS) $(LANGHDRS) +expr_o: expr_c $(STDHDRS) expr_h +files_o: files_c $(STDHDRS) +funcs_o: funcs_c $(STDHDRS) expr_h version_h +globals_o: globals_c config_h types_h globals_h err_h lang_h $(LANGHDRS) +hbcal_o: hbcal_c $(STDHDRS) +init_o: init_c $(STDHDRS) expr_h version_h lang_h $(LANGHDRS) +main_o: main_c $(STDHDRS) expr_h +moon_o: moon_c $(STDHDRS) +omit_o: omit_c $(STDHDRS) +sort_o: sort_c $(STDHDRS) +queue_o: queue_c $(STDHDRS) +token_o: token_c $(STDHDRS) +trigger_o: trigger_c $(STDHDRS) expr_h +userfns_o: userfns_c $(STDHDRS) expr_h +utils_o: utils_c $(STDHDRS) +var_o: var_c $(STDHDRS) expr_h + + +clean: + rm -f *_o *_bak + +clobber: + rm -f *_o remind rem2ps test_out *_bak diff --git a/README.AMIGA b/README.AMIGA new file mode 100644 index 00000000..a033db33 --- /dev/null +++ b/README.AMIGA @@ -0,0 +1,57 @@ +$Id: README.AMIGA,v 1.1 1996-03-31 04:01:52 dfs Exp $ +REMIND version 3.0 for AmigaDOS + +REMIND is a sophisticated alarm/calendar program. Details are given +in the man page, "remind.1". + +1 - Read the file COPYRIGHT. + +2 - Examine the file config.h and adjust parameters as needed + +3 - If you are using SAS/C to compile Remind, type: + + copy amiga-SCOPTIONS SCOPTIONS + smake -f smakefile + +This will create remind, which is ready to be executed. + +The file "defs.rem" has some sample Remind definitions and commands, +as well as U.S. and Jewish holidays. + +OTHER LANGUAGE SUPPORT + +Remind has support for languages other than English. See the file +"lang.h" for details. The language support may vary - you can change +only the substitution filter, or you can translate all of the usage +instructions and error messages as well. See "french.h" for an example. + +If you add support for a non-English language, Remind will accept both the +English and non-English names of months and weekdays in an input script. +However, you should not rely on this feature if you want to write portable +Remind scripts. + +At a minimum, you should support month and day names in the foreign +language, and should modify the substitution filter appropriately. +If you are truly diligent, you can translate usage and error messages +too. + +Take a look at the files "english.h" and "german.h" if you want to add +support for your favourite language. If you do add another language +to Remind, please let me know! Here are the basic guidelines: + +- Your language file should be called "lxxx.h", where lxxx is the first 8 +characters of the ENGLISH name of your language. + +- You should define L_LANGNAME to be the full English name of your language, + with the first letter capitalized and the rest lower-case. + +[Please note: I CANNOT SUPPORT THE AMIGA VERSION!] + +-- +David F. Skoll +986 Eiffel Avenue +Ottawa, Ontario K2C 0J2 +CANADA + +Tel. (613) 225-8687 + diff --git a/README_QDOS b/README_QDOS new file mode 100644 index 00000000..1d1c303c --- /dev/null +++ b/README_QDOS @@ -0,0 +1,95 @@ +$Id: README_QDOS,v 1.1 1996-03-31 04:01:52 dfs Exp $ +REMIND version 3.0.13 for QDOS / SMSQ + +REMIND is a sophisticated alarm/calendar program. Details are given +in the documentation file, "remind_doc" (QUILL format). +[Note from David Skoll -- I was not sent the file `remind_doc', so + you're on your own here. You'll have to use the UNIX man pages.] + +1 - Read the file COPYRIGHT. + +2 - Do NOT redistribute Remind WITHOUT the sources! + +3 - Examine the Makefile and change any parameters which need to be + changed for your system. (The makefile for QDOS / SMSQ is + makefile_QDOS). + +4 - Examine the file config_h and adjust parameters as needed + +5 - Examine lang_h and choose the language you want Remind to use. + There has no effort been put in making the language modules working + on the QL. You'll have to adjust the files for yourself to get + them working (umlauts etc). + +6 - Execute "make;'-fMakefile_QDOS'". Be sure, that your DATA_DEFAULT + directory is the directory where the remind source files are + placed. + +7 - There is an acceptance test for other systems. If you want to + test remind on your QDOS / SMSQ system execute the following + commands from your command line: + SETENV "TEST_GETENV=foo bar baz" + ex datad$&'remind';'-e -dxte test_rem 16 feb 1991 > test_out' + ex diff;'test_out test_cmp >test_diff' + Then check the output of diff. You will find lots of differences. + If there are other than differences in the filename + (supplied test-result: ./test.rem, QDOS result: test_rem) and + in the ostype (supplied: UNIX, QDOS: QDOS / SMSQ) Remind does + not work correctly. + + +The file "defs_rem" has some sample Remind definitions and commands, +as well as U.S. and Jewish holidays. You should delete the definitions +for ANSI colours as the QL does not support the ANSI standard. + + +OTHER LANGUAGE SUPPORT + +Remind has support for languages other than English. See the file +"lang_h" for details. The language support may vary - you can change +only the substitution filter, or you can translate all of the usage +instructions and error messages as well. See "french_h" for an +example of the latter. + +If you add support for a non-English language, Remind will accept both the +English and non-English names of months and weekdays in an input script. +However, you should not rely on this feature if you want to write portable +Remind scripts. + +At a minimum, you should support month and day names in the foreign +language, and should modify the substitution filter appropriately. +If you are truly diligent, you can translate usage and error messages +too. + +Take a look at the files "english_h" and "german_h" if you want to add +support for your favourite language. If you do add another language +to Remind, please let me know! Here are the basic guidelines: + +- Your language file should be called "lxxx_h", where lxxx is the first 8 + characters of the ENGLISH name of your language. + +- Your language file should define L_LANGNAME to be the full English + name of your language, with the first letter capitalized and the rest + lower-case. + +RELEASE NOTES -- miscellaneous info that couldn't go anywhere else! + +The QDOS / SMSQ version does not support the enhanced features of +the UNIX and/or OS/2 versions. + +I had some problems with the sunrise() and sunset() functions, +but didn't examine it. + +I've ported Remind on a SMSQ/SGC system. It should work on other +systems without problems. The compiler used was C68 v4.14c. + +Remind should work with each QL or compatible with 512K or more RAM. +It'll however NOT work on a standard QL due to it's code size. + +Any problems with the QDOS / SMSQ versions should be sent to: + +Robert H. Klein +Bluecherstrasse 24 +D-56349 Kaub + +Germany diff --git a/WHATSNEW.30 b/WHATSNEW.30 index e87ad85d..1ca05d8e 100644 --- a/WHATSNEW.30 +++ b/WHATSNEW.30 @@ -1,5 +1,27 @@ CHANGES TO REMIND +* Version 3.0 Patch 14 + ++ MINOR ENHANCEMENTS + +- Added support for QDOS/SMSQ on the Sinclair QL microcomputer, + courtesy of Robert H. Klein + NOTE THAT I CANNOT TEST NOR SUPPORT THIS VERSION! + +- Added support for AmigaDOS / SAS/C, courtesy of Martin Hohl + . As before, I CANNOT TEST NOR + SUPPORT THIS VERSION, but will rely on feedback from others. + ++ BUG FIXES + +- Removed the "-n" option from Rem2PS. Instead, if you want the + PostScript calendar to start on a Monday, supply the "-m" option + to Remind. It was repugnant to have two options to two programs + to accomplish one thing. + +- The "hebdate" built-in function worked incorrectly with 5 arguments. + The bug was pointed out by Hershel Safer + * Version 3.0 Patch 13 + MINOR ENHANCEMENTS diff --git a/amiga-SCOPTIONS b/amiga-SCOPTIONS new file mode 100644 index 00000000..5b29c0a8 --- /dev/null +++ b/amiga-SCOPTIONS @@ -0,0 +1,7 @@ +IGNORE=154 +IGNORE=161 +IGNORE=100 +IGNORE=85 +LINKOPT SC +LINKOPT SD +LINKOPT NOICONS diff --git a/amiga.c b/amiga.c new file mode 100644 index 00000000..cc03fab6 --- /dev/null +++ b/amiga.c @@ -0,0 +1,63 @@ +/***************************************************************/ +/* */ +/* AMIGA.C */ +/* */ +/* Support functions for AmigaDOS */ +/* */ +/* This file is Copyright (C) 1995 by Martin Hohl */ +/* */ +/* This file is part of REMIND. */ +/* Remind is Copyright (C) 1992-1996 by David F. Skoll */ +/* */ +/***************************************************************/ +static char const RCSID[] = "$Id: amiga.c,v 1.1 1996-03-31 04:01:53 dfs Exp $"; + +#include +#include + +#include +#include +#include + +#include + +#include "version.h" /* Hopefully this will define VERSION as a string */ + +#ifdef __SASC_60 +/* AmigaDOS 2.04 compatible version string for "version" utility */ +const static char ver_string[] = "$VER: remind "VERSION" "__AMIGADATE__; +#endif + +void sleep(int dt) +{ + register long Ticks; + + if (dt != 0) { + Ticks = 50L * dt; + Delay(Ticks); + } +} + +void execvp(char *name, char **argvec) +{ + char *cmdline; + int i,l; + + l = strlen(name)+2; + i=1; + while (argvec[i] != 0L) { + l += strlen(argvec[i])+1; + i++; + }; + cmdline = malloc(l+1); + if (cmdline == 0L) return; + strcpy(cmdline,name); + i=1; + while (argvec[i] != 0L) { + strcat(cmdline," "); + strcat(cmdline,argvec[i]); + i++; + }; + system(cmdline); + free(cmdline); +} diff --git a/calendar.c b/calendar.c index 1580eba6..07fa0aa7 100644 --- a/calendar.c +++ b/calendar.c @@ -9,7 +9,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: calendar.c,v 1.1 1996-03-27 03:25:50 dfs Exp $"; +static char const RCSID[] = "$Id: calendar.c,v 1.2 1996-03-31 04:01:54 dfs Exp $"; #include "config.h" #include @@ -138,7 +138,7 @@ static void DoCalendarOneWeek() } /* Here come the first few lines... */ - putchar('|'); + PutChar('|'); for (i=0; i<7; i++) { FromJulian(OrigJul+i, &y, &m, &d); sprintf(buf, "%d %c%c%c ", d, MonthName[m][0], MonthName[m][1], @@ -147,16 +147,16 @@ static void DoCalendarOneWeek() PrintLeft(buf, ColSpaces, '*'); else PrintLeft(buf, ColSpaces, ' '); - putchar('|'); + PutChar('|'); } - putchar('\n'); + PutChar('\n'); for (l=0; lDaysInMonth(m, y)) PrintLeft("", ColSpaces, ' '); @@ -271,16 +272,16 @@ static int WriteCalendarRow() sprintf(buf, "%d", d+i-wd); PrintLeft(buf, ColSpaces, ' '); } - putchar('|'); + PutChar('|'); } - putchar('\n'); + PutChar('\n'); for (l=0; lpos; s - e->pos < ColSpaces; s++) { if (!*s) break; numwritten++; - putchar(*s); + PutChar(*s); } e->pos = s; } else { @@ -439,12 +440,12 @@ int col; for (s = e->pos; s header file, comment the */ /* following line. */ @@ -205,7 +212,7 @@ /* the only bad side effect is a compiler warning, so don't worry too */ /* much about it. */ /*---------------------------------------------------------------------*/ -/* #define SIGHANDLER_INT_ARG 1 */ +#define SIGHANDLER_INT_ARG 1 /*---------------------------------------------------------------------*/ /* Do we have the header? If not, use sys/files.h */ @@ -259,5 +266,17 @@ #define _POSIX_SOURCE #endif +#ifdef SYSV +#define __USE_SVID +#endif + #define PSBEGIN "# rem2ps begin" #define PSEND "# rem2ps end" + +#ifdef BROKEN_PUTC +#define Putc SafePutc +#define PutChar SafePutChar +#else +#define Putc putc +#define PutChar putchar +#endif diff --git a/dorem.c b/dorem.c index c7fc62b0..5546ba12 100644 --- a/dorem.c +++ b/dorem.c @@ -11,7 +11,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: dorem.c,v 1.1 1996-03-27 03:25:52 dfs Exp $"; +static char const RCSID[] = "$Id: dorem.c,v 1.2 1996-03-31 04:01:55 dfs Exp $"; #include "config.h" #include @@ -29,6 +29,14 @@ static char const RCSID[] = "$Id: dorem.c,v 1.1 1996-03-27 03:25:52 dfs Exp $"; #include "protos.h" #include "expr.h" +/* Define the shell characters to escape */ +static char const EscapeMe[] = +#ifdef QDOS +"\"'!$%^&*()|<>[]{}\x9F~;?\\"; +#else +"\"'!$%^&*()|<>[]{}`~;?\\"; +#endif + PRIVATE int ParseTimeTrig ARGS ((ParsePtr s, TimeTrig *tim)); PRIVATE int ParseLocalOmit ARGS ((ParsePtr s, Trigger *t)); PRIVATE int ParseScanFrom ARGS ((ParsePtr s, Trigger *t)); @@ -779,7 +787,7 @@ ParsePtr p; /* Escape shell characters in msg INCLUDING WHITESPACE! */ for (t=buf, s=msg; *s; s++) { - if (isspace(*s) || strchr("\"'!$%^&*()|<>[]{}`~;?\\", *s)) *t++ = '\\'; + if (isspace(*s) || strchr(EscapeMe, *s)) *t++ = '\\'; *t++ = *s; } *t = 0; diff --git a/expr.c b/expr.c index e49bc4f2..cd0db366 100644 --- a/expr.c +++ b/expr.c @@ -9,7 +9,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: expr.c,v 1.1 1996-03-27 03:25:54 dfs Exp $"; +static char const RCSID[] = "$Id: expr.c,v 1.2 1996-03-31 04:01:55 dfs Exp $"; #include "config.h" #include @@ -123,7 +123,7 @@ Operator *op; fprintf(ErrFp, " => "); if (!r) { PrintValue(&ValStack[ValStackPtr-1], ErrFp); - putc('\n', ErrFp); + Putc('\n', ErrFp); } else { fprintf(ErrFp, "%s\n", ErrMsg[r]); } @@ -488,7 +488,7 @@ Var *locals; if (! (DebugFlag & DB_PRTEXPR)) return r; if (r == OK) { PrintValue(v, ErrFp); - putc('\n', ErrFp); + Putc('\n', ErrFp); } return r; } else /* Must be a symbol */ @@ -498,7 +498,7 @@ Var *locals; if (! (DebugFlag & DB_PRTEXPR)) return r; if (r == OK) { PrintValue(v, ErrFp); - putc('\n', ErrFp); + Putc('\n', ErrFp); } return r; } @@ -1097,9 +1097,9 @@ FILE *fp; if (v->type == STR_TYPE) { s=v->v.str; - putc('"', fp); - for (y=0; ytype == INT_TYPE) fprintf(fp, "%d", v->v.val); diff --git a/funcs.c b/funcs.c index d5d77484..09b64111 100644 --- a/funcs.c +++ b/funcs.c @@ -10,7 +10,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: funcs.c,v 1.2 1996-03-30 04:00:29 dfs Exp $"; +static char const RCSID[] = "$Id: funcs.c,v 1.3 1996-03-31 04:01:56 dfs Exp $"; #include "config.h" #include @@ -122,7 +122,7 @@ PRIVATE int CheckArgs ARGS ((Operator *f, int nargs)); PRIVATE int CleanUpAfterFunc ARGS ((void)); PRIVATE int SunStuff ARGS ((int rise, double cosz, int jul)); -#if defined(__MSDOS__) || defined(__BORLANDC__) +#if defined(__MSDOS__) || defined(__BORLANDC__) || defined(AMIGA) PRIVATE FILE *os_popen ARGS((char *cmd, char *mode)); PRIVATE int os_pclose ARGS((FILE *fp)); #define POPEN os_popen @@ -963,10 +963,18 @@ static int FOstype() #else #ifdef __OS2__ return RetStrVal(OS2MODE ? "OS/2" : "MSDOS"); +#else +#ifdef QDOS + return RetStrVal("QDOS / SMSQ"); +#else +#ifdef AMIGA + return RetStrVal("AmigaDOS"); #else return RetStrVal("MSDOS"); #endif #endif +#endif +#endif } /***************************************************************/ @@ -1531,7 +1539,7 @@ static int FAccess() return OK; } -#if defined(__MSDOS__) || defined(__BORLANDC__) +#if defined(__MSDOS__) || defined(__BORLANDC__) || defined(AMIGA) /***************************************************************/ /* */ /* popen and pclose */ @@ -1586,6 +1594,9 @@ FILE *fp; #endif unlink(TmpFile); +#ifdef AMIGA + free(TmpFile); +#endif return fclose(fp); } diff --git a/main.c b/main.c index 6b3b6700..be4f6cc3 100644 --- a/main.c +++ b/main.c @@ -10,7 +10,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: main.c,v 1.1 1996-03-27 03:26:01 dfs Exp $"; +static char const RCSID[] = "$Id: main.c,v 1.2 1996-03-31 04:01:57 dfs Exp $"; #include "config.h" #ifdef HAVE_STDLIB_H @@ -33,15 +33,22 @@ static char const RCSID[] = "$Id: main.c,v 1.1 1996-03-27 03:26:01 dfs Exp $"; #include #include +#ifdef AMIGA +#include +#else #if defined(__MSDOS__) || defined(__OS2__) #include #else #include #ifndef SYSV +#ifdef QDOS +#include +#else #include -#endif +#endif /* QDOS */ +#endif /* ndef SYSV */ #endif /* if defined(__MSDOS__)... */ - +#endif /* AMIGA */ #include "types.h" #include "protos.h" #include "expr.h" @@ -59,10 +66,12 @@ long timelocal ARGS((struct tm *tm)); static char TPushBuffer[TOKSIZE+1]; /* Buffer for pushing back a token. */ static char *TokenPushed = NULL; +/* Whooo... the putchar/Putchar/PutChar macros are a mess... + my apologies... */ #ifdef OS2_POPUP #define Putchar(c) {if (AsPopUp) PutcPopUp(c); else putchar(c);} #else -#define Putchar(c) putchar(c) +#define Putchar(c) PutChar(c) #endif /***************************************************************/ @@ -648,11 +657,11 @@ FILE *fp; register char c = 0; while (*s) { - if (*s == '\n') putc('\\', fp); - putc(*s, fp); + if (*s == '\n') Putc('\\', fp); + Putc(*s, fp); c = *s++; } - if (c != '\n') putc('\n', fp); + if (c != '\n') Putc('\n', fp); } /***************************************************************/ diff --git a/protos.h b/protos.h index 519b7553..391d2465 100644 --- a/protos.h +++ b/protos.h @@ -9,7 +9,7 @@ /* */ /***************************************************************/ -/* $Id: protos.h,v 1.1 1996-03-27 03:26:05 dfs Exp $ */ +/* $Id: protos.h,v 1.2 1996-03-31 04:01:57 dfs Exp $ */ #ifdef HAVE_PROTOS #define ARGS(x) x @@ -169,3 +169,8 @@ int PutlPopUp ARGS ((char *s)); int PutsPopUp ARGS ((char *s)); #endif #endif + +#ifdef BROKEN_PUTC +int SafePutChar ARGS ((int ch)); +int SafePutc ARGS ((int ch, FILE *fp)); +#endif diff --git a/rem2ps.c b/rem2ps.c index d79d4ccd..98a731c8 100644 --- a/rem2ps.c +++ b/rem2ps.c @@ -9,7 +9,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: rem2ps.c,v 1.1 1996-03-27 03:26:07 dfs Exp $"; +static char const RCSID[] = "$Id: rem2ps.c,v 1.2 1996-03-31 04:01:58 dfs Exp $"; #include "config.h" #include "lang.h" @@ -204,7 +204,8 @@ void DoPsCal() /* Read the month and year name, followed by # days in month and 1st day of month */ gets(LineBuffer); - sscanf(LineBuffer, "%s %s %d %d", month, year, &days, &wkday); + sscanf(LineBuffer, "%s %s %d %d %d", month, year, &days, &wkday, + &MondayFirst); gets(LineBuffer); sscanf(LineBuffer, "%s %d", prevm, &prevdays); gets(LineBuffer); @@ -372,7 +373,7 @@ void WriteProlog() strcmp(SmallFont, DayFont) && strcmp(TitleFont, SmallFont) && strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont); - putchar('\n'); + PutChar('\n'); printf("%%%%Creator: Rem2PS\n"); printf("%%%%Pages: (atend)\n"); printf("%%%%Orientation: %s\n", PortraitMode ? "Portrait" : "Landscape"); @@ -545,19 +546,19 @@ char *s; /* Chew up leading spaces */ while(isspace(*s)) s++; - putchar('('); + PutChar('('); while(*s) { c = *s++; - if (c == '\\' || c == '(' || c == ')') putchar('\\'); - if (!isspace(c)) putchar(c); + if (c == '\\' || c == '(' || c == ')') PutChar('\\'); + if (!isspace(c)) PutChar(c); else { - putchar(')'); + PutChar(')'); while(isspace(*s)) s++; if (!*s) { printf("]\n"); return; } - putchar('('); + PutChar('('); } } printf(")]\n"); @@ -604,10 +605,6 @@ char *argv[]; switch(*s++) { - case 'n': - MondayFirst = 1; - break; - case 'p': if (i == argc) Usage("Prologue filename must be supplied"); UserProlog = argv[i++]; @@ -747,7 +744,6 @@ char *s; fprintf(stderr, "-t size Set line thickness\n"); fprintf(stderr, "-e Make calendar fill entire page\n"); fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n"); - fprintf(stderr, "-n Start calendar with Monday rather than Sunday\n"); exit(1); } diff --git a/smakefile b/smakefile new file mode 100644 index 00000000..e72a5aa8 --- /dev/null +++ b/smakefile @@ -0,0 +1,93 @@ +# $Id: smakefile,v 1.1 1996-03-31 04:01:58 dfs Exp $ +# Makefile for REMIND, suitable for SAS/C 6.50 under AmigaDOS +# English version + +#----------------------------------------------------------------------------- +# THINGS FOR YOU TO EDIT START BELOW +#----------------------------------------------------------------------------- + +# Uncomment the next line if you are running on a SYSV system +# SYSV= -DSYSV + +# Uncomment the next line if you are running under UNIX (including SYSV!) +#UNIX= -DUNIX + +# Uncomment the next lines if you want to use gcc instead of default compiler +# NOTE: Tempting as it may be, if you use 'cc' for the C compiler, do not +# use 'ld' for the linker. It will probably work much better if you use +# LD= cc rather than LD= ld. +CC= SC +LD= SC + +# Put any additional flags for the C compiler or linker here - if you +# are not using gcc, you probably want to remove '-ansi'. +CFLAGS= OPT NOSTKCHK NOSINT MATH=IEEE +CDEFS= +LDFLAGS= LINK + +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 + +STDHDRS= config.h types.h protos.h globals.h err.h lang.h + +LANGHDRS= english.h german.h dutch.h finnish.h french.h norwgian.h + +SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c hbcal.c \ +init.c main.c moon.c omit.c sort.c queue.c token.c trigger.c userfns.c \ +utils.c var.c amiga/amiga.c + +OBJS= calendar.o dorem.o dosubst.o expr.o files.o funcs.o globals.o hbcal.o \ +init.o main.o moon.o omit.o sort.o queue.o token.o trigger.o userfns.o \ +utils.o var.o amiga.o + +MANIFEST= README.UNIX README.DOS COPYRIGHT $(HDRS) $(SRCS) Makefile rem rem.1 \ +remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \ +makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \ +defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \ +tstlang.rem README.BCC lnk.bcc makefile.bcc os2func.c \ +test-rem.bat test-rem.cmd test1.cmp test2.cmp + + +all: remind rem2ps + +.c.o: + $(CC) $(UNIX) $(SYSV) $(CFLAGS) $(CDEFS) $*.c + +rem2ps: rem2ps.o + $(LD) MATH=IEEE $(LDFLAGS) PNAME=rem2ps rem2ps.o + +remind: $(OBJS) + $(LD) MATH=IEEE $(LDFLAGS) PNAME=remind $(OBJS) + +clean: + rm -f *.o *~ core *.bak + +clobber: + rm -f *.o *~ remind rem2ps test.out core *.bak + +test: remind + sh test-rem + +rem2ps.o: rem2ps.c rem2ps.h lang.h config.h +calendar.o: calendar.c $(STDHDRS) expr.h +dorem.o: dorem.c $(STDHDRS) expr.h +dosubst.o: dosubst.c $(STDHDRS) $(LANGHDRS) +expr.o: expr.c $(STDHDRS) expr.h +files.o: files.c $(STDHDRS) +funcs.o: funcs.c $(STDHDRS) expr.h version.h +globals.o: globals.c config.h types.h globals.h err.h lang.h $(LANGHDRS) +hbcal.o: hbcal.c $(STDHDRS) +init.o: init.c $(STDHDRS) expr.h version.h lang.h $(LANGHDRS) +main.o: main.c $(STDHDRS) expr.h +moon.o: moon.c $(STDHDRS) +omit.o: omit.c $(STDHDRS) +sort.o: sort.c $(STDHDRS) +queue.o: queue.c $(STDHDRS) +token.o: token.c $(STDHDRS) +trigger.o: trigger.c $(STDHDRS) expr.h +userfns.o: userfns.c $(STDHDRS) expr.h +utils.o: utils.c $(STDHDRS) +var.o: var.c $(STDHDRS) expr.h + +amiga.o: amiga/amiga.c + $(CC) OBJNAME=amiga.o $(CFLAGS) amiga/amiga.c diff --git a/test-rem.ami b/test-rem.ami new file mode 100644 index 00000000..82265634 --- /dev/null +++ b/test-rem.ami @@ -0,0 +1,830 @@ +# 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.13" +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.13" + 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 + diff --git a/test-rem.rexx b/test-rem.rexx new file mode 100644 index 00000000..f8ce1f8b --- /dev/null +++ b/test-rem.rexx @@ -0,0 +1,23 @@ +/* --------------------------------------------------------------------------- + $Id: test-rem.rexx,v 1.1 1996-03-31 04:02:00 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' diff --git a/utils.c b/utils.c index c0253958..ae2ce0a6 100644 --- a/utils.c +++ b/utils.c @@ -9,7 +9,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: utils.c,v 1.1 1996-03-27 03:26:15 dfs Exp $"; +static char const RCSID[] = "$Id: utils.c,v 1.2 1996-03-31 04:02:00 dfs Exp $"; #include "config.h" #include @@ -181,3 +181,31 @@ int y, m, d; d > DaysInMonth(m, y) ) return 0; else return 1; } + +#ifdef BROKEN_PUTC +/***************************************************************/ +/* */ +/* Safe versions of putc and putchar */ +/* */ +/***************************************************************/ +#ifdef HAVE_PROTOS +PUBLIC int SafePutChar(int c) +#else +int SafePutChar(c) +int c; +#endif +{ + return putchar(c); +} + +#ifdef HAVE_PROTOS +PUBLIC int SafePutc(int c, FILE *fp) +#else +int SafePutc(c, fp) +int c; +FILE *fp; +#endif +{ + return putc(c, fp); +} +#endif diff --git a/var.c b/var.c index b5c6e420..c4f031ff 100644 --- a/var.c +++ b/var.c @@ -10,7 +10,7 @@ /* */ /***************************************************************/ -static char const RCSID[] = "$Id: var.c,v 1.1 1996-03-27 03:26:16 dfs Exp $"; +static char const RCSID[] = "$Id: var.c,v 1.2 1996-03-31 04:02:00 dfs Exp $"; #include "config.h" #include @@ -633,11 +633,11 @@ SysVar *v; if (v->type == STR_TYPE) { char *s = *((char **)v->value); int y; - putc('"', ErrFp); - for (y=0; ymodifiable) fprintf(ErrFp, "%d\n", *((int *)v->value)); else {