modified: Makefile

modified:   src/planner.c
	modified:   src/planner.h
sql
simon 2024-12-11 03:09:54 +01:00
parent 33cd1e87e3
commit 4f867b29cb
3 changed files with 13 additions and 3 deletions

View File

@ -8,15 +8,17 @@ UIF=src/ui.c src/ui.h #UI files
PLF=src/planner.c src/planner.h #planner files PLF=src/planner.c src/planner.h #planner files
DBF=src/db.c src/db.h #db files DBF=src/db.c src/db.h #db files
CALF=src/iCal.c src/iCal.h CALF=src/iCal.c src/iCal.h
LLST=src/llist.c src/llist.h
CONFIG=src/config.h #config file CONFIG=src/config.h #config file
#targets #targets
debug: test ui planner db iCal config debug: test ui planner db iCal config llist
gcc test.o ui.o planner.o db.o iCal.o -o debugOut gcc test.o ui.o planner.o db.o iCal.o llist.o -o debugOut
config: $(CONFIG) config: $(CONFIG)
llist: $(LLST)
gcc -c $(CFLAGS) $(LLST)
test: src/test.c test: src/test.c
gcc -c $(CFLAGS) src/test.c gcc -c $(CFLAGS) src/test.c
iCal: $(CALF) iCal: $(CALF)

View File

@ -9,6 +9,7 @@
#include "planner.h" // for subject and event structs #include "planner.h" // for subject and event structs
// #include "config.h" // #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp) { Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp) {
Event *r = (Event *)malloc(sizeof(Event)); 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; 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); }

View File

@ -26,6 +26,8 @@ typedef struct Task {
*/ */
Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp); 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 * Event struct contains task and planned time frame
* *
@ -45,6 +47,7 @@ typedef struct Event {
* returns NULL on failure * returns NULL on failure
*/ */
Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp); Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
int cmpEvent(Event *a, Event *b);
int genPlan(Task *head); int genPlan(Task *head);