From 4f867b29cbbfe2afbc0a30fa12b96534526cbd50 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 11 Dec 2024 03:09:54 +0100 Subject: [PATCH] modified: Makefile modified: src/planner.c modified: src/planner.h --- Makefile | 8 +++++--- src/planner.c | 5 +++++ src/planner.h | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ec07a06..4a35442 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,17 @@ UIF=src/ui.c src/ui.h #UI files PLF=src/planner.c src/planner.h #planner files DBF=src/db.c src/db.h #db files CALF=src/iCal.c src/iCal.h +LLST=src/llist.c src/llist.h CONFIG=src/config.h #config file #targets -debug: test ui planner db iCal config - gcc test.o ui.o planner.o db.o iCal.o -o debugOut +debug: test ui planner db iCal config llist + gcc test.o ui.o planner.o db.o iCal.o llist.o -o debugOut config: $(CONFIG) - +llist: $(LLST) + gcc -c $(CFLAGS) $(LLST) test: src/test.c gcc -c $(CFLAGS) src/test.c iCal: $(CALF) diff --git a/src/planner.c b/src/planner.c index 2d704ca..be8e953 100644 --- a/src/planner.c +++ b/src/planner.c @@ -9,6 +9,7 @@ #include "planner.h" // for subject and event structs // #include "config.h" #include +#include Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp) { Event *r = (Event *)malloc(sizeof(Event)); @@ -33,3 +34,7 @@ Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp) { return r; } + +// for llist +int cmpTask(Task *a, Task *b) { return strcmp(a->name, b->name); } +int cmpEvent(Event *a, Event *b) { return cmpTask(a->task, b->task); } diff --git a/src/planner.h b/src/planner.h index e12af76..9c8ac01 100644 --- a/src/planner.h +++ b/src/planner.h @@ -26,6 +26,8 @@ typedef struct Task { */ Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp); +int cmpTask(Task *a, Task *b); + /* * Event struct contains task and planned time frame * @@ -45,6 +47,7 @@ typedef struct Event { * returns NULL on failure */ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp); +int cmpEvent(Event *a, Event *b); int genPlan(Task *head);