From aa1ab2bbb49ecc2186eee16cd511c8dfeabd37b9 Mon Sep 17 00:00:00 2001 From: "David F. Skoll" Date: Mon, 3 Sep 2007 06:28:34 -0400 Subject: [PATCH] Don't sort SPECIALs ahead of normal reminders. Allow all SPECIALs to include times; back-ends can use or ignore them as they see fit. --- src/calendar.c | 83 ++++++++------------------------------------------ tests/test.cmp | 6 ++-- 2 files changed, 15 insertions(+), 74 deletions(-) diff --git a/src/calendar.c b/src/calendar.c index 410a3b87..9d21df8a 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -41,7 +41,6 @@ typedef struct cal_entry { /* Global variables */ static CalEntry *CalColumn[7]; -static CalEntry *CalPs[7]; static int ColSpaces; @@ -588,7 +587,6 @@ static int DoCalRem(ParsePtr p, int col) int r; int jul; CalEntry *CurCol = CalColumn[col]; - CalEntry *CurPs = CalPs[col]; CalEntry *e; char *s, *s2; DynamicBuffer buf, obuf, pre_buf; @@ -780,44 +778,20 @@ static int DoCalRem(ParsePtr p, int col) } e->lineno = LineNo; - /* 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") && - strcmp(trig.passthru, "HTML")) { + if (trig.typ == PASSTHRU_TYPE) { StrnCpy(e->passthru, trig.passthru, PASSTHRU_LEN); - e->pos = e->passthru; - if (!strcmp(trig.passthru, "PostScript") || - !strcmp(trig.passthru, "PSFile")) { - e->time = NO_TIME; - } else { - if (jul == JulianToday) { - e->time = tim.ttime; - } else { - e->time = NO_TIME; - } - } - e->next = CurPs; - CalPs[col] = e; - SortCol(&CalPs[col]); } else { - if (trig.typ == PASSTHRU_TYPE) { - StrnCpy(e->passthru, trig.passthru, PASSTHRU_LEN); - } else { - e->passthru[0] = 0; - } - e->pos = e->text; - if (jul == JulianToday) { - e->time = tim.ttime; - } else { - e->time = NO_TIME; - } - e->next = CurCol; - CalColumn[col] = e; - SortCol(&CalColumn[col]); + e->passthru[0] = 0; } + e->pos = e->text; + if (jul == JulianToday) { + e->time = tim.ttime; + } else { + e->time = NO_TIME; + } + e->next = CurCol; + CalColumn[col] = e; + SortCol(&CalColumn[col]); } return OK; } @@ -831,44 +805,11 @@ static int DoCalRem(ParsePtr p, int col) /***************************************************************/ static void WriteSimpleEntries(int col, int jul) { - CalEntry *e = CalPs[col]; + CalEntry *e = CalColumn[col]; CalEntry *n; int y, m, d; -/* Do all the PASSTHRU entries first, if any */ FromJulian(jul, &y, &m, &d); - while(e) { - if (e->passthru) { - if (!strcmp(e->passthru, "PostScript") || - !strcmp(e->passthru, "PSFile")) { - e->duration = NO_TIME; - e->time = NO_TIME; - } - } - - if (DoPrefixLineNo) printf("# fileinfo %d %s\n", e->lineno, e->filename); - printf("%04d/%02d/%02d ", y, m+1, d); - printf("%s %s ", e->passthru, e->tag); - if (e->duration != NO_TIME) { - printf("%d ", e->duration); - } else { - printf("* "); - } - if (e->time != NO_TIME) { - printf("%d ", e->time); - } else { - printf("* "); - } - printf("%s\n", e->text); - free(e->text); - free(e->filename); - n = e->next; - free(e); - e = n; - } - CalPs[col] = NULL; - - e = CalColumn[col]; while(e) { if (DoPrefixLineNo) printf("# fileinfo %d %s\n", e->lineno, e->filename); printf("%04d/%02d/%02d", y, m+1, d); diff --git a/tests/test.cmp b/tests/test.cmp index 002eba6d..4a821a34 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -889,21 +889,21 @@ September 30 2007/08/20 COLOR * * 825 6 7 8 1:45pm Mooo! 2007/08/20 * * * * 18 NonOmit-1 2007/08/20 * * * * 12 NonOmit-2 -2007/08/21 PostScript * * * (wookie) show +2007/08/21 PostScript * * 115 (wookie) show 2007/08/21 * * * * 19 NonOmit-1 2007/08/21 * * * * 13 NonOmit-2 -2007/08/22 PostScript * * * (cabbage) show 2007/08/22 COLOR * * * 0 0 255 Blue Wednesday 2007/08/22 * * * * 20 NonOmit-1 2007/08/22 * * * * 14 NonOmit-2 +2007/08/22 PostScript * * * (cabbage) show 2007/08/23 blort * * 1004 snoo glup 2007/08/23 COLOR * * * 255 0 0 Red Thursday 2007/08/23 * * * * 21 NonOmit-1 2007/08/23 * * * * 15 NonOmit-2 2007/08/24 SHADE * * * 0 255 0 -2007/08/24 blort * * * gulp wookie 2007/08/24 * * * * 22 NonOmit-1 2007/08/24 * * * * 16 NonOmit-2 +2007/08/24 blort * * * gulp wookie 2007/08/25 * * * * 23 NonOmit-1 2007/08/25 * * * * 17 NonOmit-2 2007/08/26 * * * * 24 NonOmit-1