From e1cf4d5e70790ec035c22de537bbda39aac3d86a Mon Sep 17 00:00:00 2001 From: dfs Date: Sun, 21 Sep 1997 23:23:34 +0000 Subject: [PATCH] - Added TAG and DURATION clauses for communicating more information to back-ends and eventually converting REMIND into a full-fledged scheduler. - Completely reworked the PS/PSFILE mechanism to use the more general SPECIAL mechanism for customizing output in REMIND back-ends. - Modified tkremind, rem2ps and www/rem2html to use new "SPECIAL" communication channel. --- WHATSNEW.30 | 11 ++++++++ calendar.c | 25 ++++++----------- config.h | 4 +-- rem2ps.c | 76 +++++++++++++++++++++++++++++++++++++--------------- tkremind | 7 +++-- www/rem2html | 10 +++---- 6 files changed, 86 insertions(+), 47 deletions(-) diff --git a/WHATSNEW.30 b/WHATSNEW.30 index 5e3e23f4..7c7669c1 100644 --- a/WHATSNEW.30 +++ b/WHATSNEW.30 @@ -1,5 +1,16 @@ CHANGES TO REMIND +* Version 3.0 Patch 18 + ++ MAJOR ENHANCEMENTS + +- Added TAG and DURATION clauses for communicating more information to + back-ends and eventually converting REMIND into a full-fledged + scheduler. + +- Completely reworked the PS/PSFILE mechanism to use the more + general SPECIAL mechanism for customizing output in REMIND back-ends. + * Version 3.0 Patch 17 + MINOR ENHANCEMENTS diff --git a/calendar.c b/calendar.c index 1412e7bb..31a5498d 100644 --- a/calendar.c +++ b/calendar.c @@ -10,7 +10,7 @@ /***************************************************************/ #include "config.h" -static char const RCSID[] = "$Id: calendar.c,v 1.5 1997-09-16 03:16:30 dfs Exp $"; +static char const RCSID[] = "$Id: calendar.c,v 1.6 1997-09-21 23:23:35 dfs Exp $"; #include #include @@ -681,10 +681,10 @@ int col; /* Convert PS and PSF to PASSTHRU */ if (trig.typ == PS_TYPE) { - strcpy(trig.passthru, "PPPP"); + strcpy(trig.passthru, "PostScript"); trig.typ = PASSTHRU_TYPE; } else if (trig.typ == PSF_TYPE) { - strcpy(trig.passthru, "FFFF"); + strcpy(trig.passthru, "PSFile"); trig.typ = PASSTHRU_TYPE; } if (!PsCal && trig.typ == PASSTHRU_TYPE) return OK; @@ -779,23 +779,14 @@ int col, jul; { CalEntry *e = CalPs[col]; CalEntry *n; - int y, m, d, i, j; + int y, m, d; /* Do all the PASSTHRU entries first, if any */ FromJulian(jul, &y, &m, &d); while(e) { - /* Print the PASSTHRU */ - j = 0; - for(i=0; ipos+j)); - if (*(e->pos+j+1)) { - j++; - } else { - j=0; - } - } - printf("%c%02d%c%02d ", DATESEP, + printf("%04d%c%02d%c%02d ", y, DATESEP, m+1, DATESEP, d); + printf("%s ", e->passthru); printf("%s ", e->tag); if (e->duration != NO_TIME) { printf("%d ", e->duration); @@ -817,8 +808,8 @@ int col, jul; e = CalColumn[col]; while(e) { - printf("%04d%c%02d%c%02d ", y, DATESEP, m+1, DATESEP, d); - printf("%s ", e->tag); + printf("%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d); + printf(" * %s ", e->tag); if (e->duration != NO_TIME) { printf("%d ", e->duration); } else { diff --git a/config.h b/config.h index 7ebb8f3e..f8b7ca6d 100644 --- a/config.h +++ b/config.h @@ -11,7 +11,7 @@ /* */ /***************************************************************/ -/* $Id: config.h,v 1.9 1997-09-16 03:16:31 dfs Exp $ */ +/* $Id: config.h,v 1.10 1997-09-21 23:23:36 dfs Exp $ */ /*---------------------------------------------------------------------*/ /* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */ @@ -273,7 +273,7 @@ /*---------------------------------------------------------------------*/ #define TAG_LEN 32 -#define PASSTHRU_LEN 4 +#define PASSTHRU_LEN 24 #define PUBLIC #define PRIVATE static diff --git a/rem2ps.c b/rem2ps.c index 7cabccc5..34353ae1 100644 --- a/rem2ps.c +++ b/rem2ps.c @@ -10,7 +10,7 @@ /***************************************************************/ #include "config.h" -static char const RCSID[] = "$Id: rem2ps.c,v 1.8 1997-09-16 03:16:32 dfs Exp $"; +static char const RCSID[] = "$Id: rem2ps.c,v 1.9 1997-09-21 23:23:36 dfs Exp $"; #include "lang.h" #include @@ -132,6 +132,7 @@ void WriteProlog ARGS ((void)); void WriteCalEntry ARGS ((void)); void WriteOneEntry ARGS ((char *s)); void GetSmallLocations ARGS ((void)); +char *EatToken(char *in, char *out, int maxlen); /***************************************************************/ /* */ @@ -198,6 +199,7 @@ void DoPsCal() int is_ps; int firstcol; char *startOfBody; + char passthru[PASSTHRU_LEN+1]; CalEntry *c, *d; @@ -285,28 +287,25 @@ void DoPsCal() } c->next = NULL; - is_ps = ((LineBuffer[0] == 'F' && - LineBuffer[1] == 'F' && - LineBuffer[2] == 'F' && - LineBuffer[3] == 'F') || - (LineBuffer[0] == 'P' && - LineBuffer[1] == 'P' && - LineBuffer[2] == 'P' && - LineBuffer[3] == 'P')); - /* Skip the tag, duration and time */ startOfBody = LineBuffer+10; - while(*startOfBody && isspace(*startOfBody)) startOfBody++; - while(*startOfBody && !isspace(*startOfBody)) startOfBody++; - while(*startOfBody && isspace(*startOfBody)) startOfBody++; - while(*startOfBody && !isspace(*startOfBody)) startOfBody++; - while(*startOfBody && isspace(*startOfBody)) startOfBody++; - while(*startOfBody && !isspace(*startOfBody)) startOfBody++; - while(*startOfBody && isspace(*startOfBody)) startOfBody++; - /* If no time, skip it */ - if (*startOfBody == '*') { - startOfBody++; + /* Eat the passthru */ + startOfBody = EatToken(startOfBody, passthru, PASSTHRU_LEN); + + /* Eat the tag */ + startOfBody = EatToken(startOfBody, NULL, 0); + + /* Eat the duration */ + startOfBody = EatToken(startOfBody, NULL, 0); + + /* Eat the time */ + startOfBody = EatToken(startOfBody, NULL, 0); + + is_ps = 0; + if (!strcmp(passthru, "PostScript") || + !strcmp(passthru, "PSFile")) { + is_ps = 1; } c->entry = malloc(strlen(startOfBody) + 1 + is_ps); if (!c->entry) { @@ -317,7 +316,11 @@ void DoPsCal() if (is_ps) { /* Save the 'P' or 'F' flag */ - *(c->entry) = *LineBuffer; + if (!strcmp(passthru, "PostScript")) { + *(c->entry) = 'P'; + } else { + *(c->entry) = 'F'; + } if (!PsEntries[DayNum]) PsEntries[DayNum] = c; else { d = PsEntries[DayNum]; @@ -982,3 +985,34 @@ void GetSmallLocations() return; } +/***************************************************************/ +/* */ +/* EatToken */ +/* */ +/* Read a space-delimited token into an output buffer. */ +/* */ +/***************************************************************/ +#ifdef HAVE_PROTOS +PUBLIC char *EatToken(char *in, char *out, int maxlen) +#else +char *EatToken(in, out, maxlen) +char *in, *out; +int maxlen; +#endif +{ + int i = 0; + + /* Skip space before token */ + while(*in && isspace(*in)) in++; + + /* Eat the token */ + while(*in && !isspace(*in)) { + if (i < maxlen) { + if (out) *out++ = *in; + i++; + } + in++; + } + if (out) *out = 0; + return in; +} diff --git a/tkremind b/tkremind index 0003201e..92a5cf57 100755 --- a/tkremind +++ b/tkremind @@ -11,7 +11,7 @@ # #-------------------------------------------------------------- -# $Id: tkremind,v 1.12 1997-01-16 04:14:32 dfs Exp $ +# $Id: tkremind,v 1.13 1997-09-21 23:23:37 dfs Exp $ # the next line restarts using wish \ exec wish "$0" "$@" @@ -276,7 +276,10 @@ proc FillCalWindow {} { CreateCalWindow $firstWkday $mondayFirst $daysInMonth $monthName $year $DayNames Status "Filling calendar entries..." while { [gets $file line] >= 0 } { - if { [regexp {^([0-9][0-9][0-9][0-9])/([0-9][0-9])/([0-9][0-9])(.*)} $line all year month day stuff] == 0 } { + if { [regexp {^([0-9][0-9][0-9][0-9])/([0-9][0-9])/([0-9][0-9]) +([^ ]+) +[^ ]+ +[^ ]+ +[^ ]+(.*)} $line all year month day type stuff] == 0 } { + continue + } + if { $type != "*"} { continue } set day [string trimleft $day 0] diff --git a/www/rem2html b/www/rem2html index 6628c85c..b46f44f6 100755 --- a/www/rem2html +++ b/www/rem2html @@ -2,7 +2,7 @@ # rem2html # -# $Id: rem2html,v 1.3 1997-09-16 03:16:42 dfs Exp $ +# $Id: rem2html,v 1.4 1997-09-21 23:23:41 dfs Exp $ # # A script to convert from the output of "remind -p" to Hyper-Text Markup # Language (HTML), the text format used in WWW documents. By default, it @@ -111,11 +111,11 @@ sub parse_input { @nextsc = split(" "); } else { last if /rem2(html|ps) end/; - next unless m/^(....).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/; - $type = $1; - $msg = $7; + next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/; + $type = $4; + $msg = $8; $day = $3; - next unless ($type eq "HTML" || ($type =~ /\d\d\d\d/)); + next unless ($type eq "HTML" || ($type eq "*")); if ($type eq "HTML") { $days[$day] .= "$msg "; } else {