2024-12-09 19:27:50 +01:00
|
|
|
/*
|
2024-12-10 22:06:49 +01:00
|
|
|
* INPUT: linked list of subjects
|
|
|
|
* OUTPUT: ll of events to iCal
|
|
|
|
* ll of updated subjects to db for next day
|
|
|
|
* return events_ll to caller(ui)??
|
2024-12-09 19:27:50 +01:00
|
|
|
*
|
|
|
|
*/
|
2024-12-10 22:06:49 +01:00
|
|
|
|
|
|
|
#include "planner.h" // for subject and event structs
|
2024-12-11 01:08:31 +01:00
|
|
|
// #include "config.h"
|
|
|
|
#include <stdlib.h>
|
2024-12-11 03:09:54 +01:00
|
|
|
#include <string.h>
|
2024-12-11 01:08:31 +01:00
|
|
|
|
|
|
|
Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp) {
|
|
|
|
Event *r = (Event *)malloc(sizeof(Event));
|
|
|
|
if (r != NULL) {
|
|
|
|
r->task = t;
|
|
|
|
r->plannedEndTime = s;
|
|
|
|
r->plannedEndTime = e;
|
|
|
|
r->spare = sp;
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp) {
|
|
|
|
Task *r = (Task *)malloc(sizeof(Task));
|
|
|
|
if (r != NULL) {
|
|
|
|
r->created = c;
|
|
|
|
r->deadline = d;
|
|
|
|
r->priority = p;
|
|
|
|
r->spare = sp;
|
|
|
|
r->name = n;
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
2024-12-11 03:09:54 +01:00
|
|
|
|
|
|
|
// 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); }
|