Compare commits
2 Commits
03d7dff9aa
...
7c16f20bc2
Author | SHA1 | Date |
---|---|---|
simon | 7c16f20bc2 | |
simon | 6c91fb7d60 |
|
@ -0,0 +1,116 @@
|
|||
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.2 Chrome/128.0.6613.186 Electron/32.2.7 Safari/537.36" version="25.0.2">
|
||||
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
|
||||
<mxGraphModel dx="1527" dy="2012" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
|
||||
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-5" target="sFZgEorzihY-HOV9npow-36">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="-10" y="-10" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-5" value="ui" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="90" y="20" width="120" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-6" value="db" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="90" y="460" width="120" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-7" target="sFZgEorzihY-HOV9npow-21">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="490" y="520" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-7" value="iCal" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="430" y="360" width="120" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-8" value="planner" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="430" y="30" width="120" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-10" value="" style="curved=1;endArrow=classic;html=1;rounded=0;entryX=0.025;entryY=0.313;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-5" target="sFZgEorzihY-HOV9npow-6">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="180" y="240" as="sourcePoint" />
|
||||
<mxPoint x="140" y="280" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="50" y="180" />
|
||||
<mxPoint x="30" y="370" />
|
||||
<mxPoint x="80" y="430" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-11" value="get stored subjects<div><br></div>" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="30" y="290" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-12" value="" style="curved=1;endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-6" target="sFZgEorzihY-HOV9npow-5">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="290" y="310" as="sourcePoint" />
|
||||
<mxPoint x="160" y="110" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="130" y="320" />
|
||||
<mxPoint x="150" y="210" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-13" value="return stored data" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="130" y="280" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-14" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-5" target="sFZgEorzihY-HOV9npow-8">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="290" y="310" as="sourcePoint" />
|
||||
<mxPoint x="340" y="260" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-15" value="send subjects" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="250" y="20" width="100" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-18" value="" style="endArrow=classic;html=1;rounded=0;exitX=0.45;exitY=0.988;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-8" target="sFZgEorzihY-HOV9npow-7">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="500" y="120" as="sourcePoint" />
|
||||
<mxPoint x="340" y="260" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-19" value="send event list" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="490" y="190" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-21" value="generate and safe iCal file" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="430" y="490" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-22" value="" style="endArrow=classic;html=1;rounded=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-8" target="sFZgEorzihY-HOV9npow-6">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="290" y="310" as="sourcePoint" />
|
||||
<mxPoint x="340" y="260" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-23" value="send updated subjects" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="260" y="270" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-24" value="subject db file" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="90" y="620" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-25" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-6" target="sFZgEorzihY-HOV9npow-24">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="290" y="440" as="sourcePoint" />
|
||||
<mxPoint x="340" y="390" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-26" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="sFZgEorzihY-HOV9npow-6" target="sFZgEorzihY-HOV9npow-24">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="290" y="440" as="sourcePoint" />
|
||||
<mxPoint x="340" y="390" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-27" value="serialise/deserialise<div><br></div>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="150" y="573" width="130" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-36" value="" style="shape=actor;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="-30" y="-80" width="40" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="sFZgEorzihY-HOV9npow-40" value="ask human for input" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||
<mxGeometry x="-10" y="20" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
16
src/llist.c
16
src/llist.c
|
@ -1,5 +1,7 @@
|
|||
#include "llist.h"
|
||||
#include <asm-generic/errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* create new linked list
|
||||
* use llistFree after use
|
||||
|
@ -8,7 +10,7 @@
|
|||
* only use to initialize
|
||||
* To insert into list use llistAppend
|
||||
*/
|
||||
llist *llistNew(void *data, int (*cmpFN)(void *a, void *b)) {
|
||||
llist *llistNew(void *data, int (*cmpFN)(const void *a, const void *b)) {
|
||||
llist *r = (llist *)malloc(sizeof(llist));
|
||||
if (r != NULL) {
|
||||
r->cmpFn = cmpFN;
|
||||
|
@ -71,3 +73,15 @@ void llistFree(llist *head) {
|
|||
head = tmp;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* get linked list length
|
||||
*/
|
||||
int llistLen(llist *head) {
|
||||
int len = 0;
|
||||
llist *c = head;
|
||||
while (c != NULL) {
|
||||
len += 1;
|
||||
c = c->next;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ typedef struct llist {
|
|||
struct llist *next;
|
||||
struct llist *prev;
|
||||
struct llist *tail;
|
||||
int (*cmpFn)(void *a, void *b); // function that compares data
|
||||
int (*cmpFn)(const void *a, const void *b); // function that compares data
|
||||
} llist;
|
||||
|
||||
// create new linked list with content(void* data) and cmpFN
|
||||
llist *llistNew(void *data, int (*cmpFN)(void *a, void *b));
|
||||
llist *llistNew(void *data, int (*cmpFN)(const void *a, const void *b));
|
||||
// create new node with data and append to tail of head
|
||||
llist *llistAppend(llist *head, void *data);
|
||||
// return llistNode that contains key or NULL
|
||||
|
@ -20,5 +20,10 @@ llist *llistGet(llist *head, void *key);
|
|||
bool llistContains(llist *head, void *key);
|
||||
// free llist node (Does Not free data it contains!!)
|
||||
void llistFree(llist *head);
|
||||
// count llistLen
|
||||
int llistLen(llist *head);
|
||||
|
||||
void llistPrintT(llist *head);
|
||||
void llistPrintH(llist *head);
|
||||
|
||||
#endif
|
||||
|
|
116
src/planner.c
116
src/planner.c
|
@ -7,35 +7,60 @@
|
|||
*/
|
||||
|
||||
#include "planner.h" // for subject and event structs
|
||||
#include "config.h"
|
||||
#include "llist.h"
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
const char taskFormat[] =
|
||||
"Task { %.64s = {\n created={%lu},\n deadline={%lu},\n "
|
||||
"priority={%d},\n spare={%lu}\n}\n";
|
||||
|
||||
const char eventFormat[] =
|
||||
"Event { %s = {\n start={%lu},\n end={%lu},\n spare={%lu}\n}\n";
|
||||
"Event { %s = {\n start={%s},\n end={%s},\n spare={%lu}\n}\n";
|
||||
void llistPrintT(llist *head) {
|
||||
llist *c = head;
|
||||
while (c != NULL) {
|
||||
printTask((Task *)c->data);
|
||||
c = c->next;
|
||||
}
|
||||
}
|
||||
// print Event to stdout
|
||||
void printEvent(Event *s) {
|
||||
char st[26];
|
||||
char e[26];
|
||||
ctime_r(&s->plannedStartTime, st);
|
||||
ctime_r(&s->plannedEndTime, e);
|
||||
printf(eventFormat, s->task->name, st, e, s->spare);
|
||||
}
|
||||
void llistPrintE(llist *head) {
|
||||
llist *c = head;
|
||||
while (c != NULL) {
|
||||
printEvent((Event *)c->data);
|
||||
c = c->next;
|
||||
}
|
||||
}
|
||||
void planLog(char *msg, bool e) {
|
||||
if (!e)
|
||||
printf("[Planner][log] %s\n", msg);
|
||||
else
|
||||
fprintf(stderr, "==== [Planner][Err] %s\n", msg);
|
||||
}
|
||||
|
||||
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->plannedStartTime = s;
|
||||
r->plannedEndTime = e;
|
||||
r->spare = sp;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// print Event to stdout
|
||||
void printEvent(Event *s) {
|
||||
printf(eventFormat, s->task->name, s->plannedStartTime, s->plannedEndTime,
|
||||
s->spare);
|
||||
}
|
||||
|
||||
/*
|
||||
* creat new task with name n created c deadline d priority p spare sp
|
||||
*/
|
||||
|
@ -87,22 +112,87 @@ char *taskToStr(Task *t) {
|
|||
// for llist
|
||||
|
||||
// compare task by name
|
||||
int cmpTaskN(void *a, void *b) {
|
||||
int cmpTaskN(const void *a, const void *b) {
|
||||
Task *aa = (Task *)a;
|
||||
Task *bb = (Task *)b;
|
||||
return strcmp(aa->name, bb->name);
|
||||
}
|
||||
|
||||
// compare task by priority
|
||||
int cmpTaskP(void *a, void *b) {
|
||||
int cmpTaskP(const void *a, const void *b) {
|
||||
Task *aa = (Task *)a;
|
||||
Task *bb = (Task *)b;
|
||||
return aa->priority - bb->priority;
|
||||
return bb->priority - aa->priority;
|
||||
}
|
||||
|
||||
// cmp event by task name
|
||||
int cmpEvent(void *a, void *b) {
|
||||
int cmpEvent(const void *a, const void *b) {
|
||||
Event *aa = (Event *)a;
|
||||
Event *bb = (Event *)b;
|
||||
return cmpTaskN(aa->task, bb->task);
|
||||
}
|
||||
|
||||
llist *genPlan(llist *head) {
|
||||
|
||||
// map llist to pointer arr & sort by priority
|
||||
// second arr sorted bby name
|
||||
int lLen = llistLen(head);
|
||||
planLog("genpla: got llist\n", false);
|
||||
printf("len: %d\n", lLen);
|
||||
llistPrintT(head);
|
||||
|
||||
Task *sortedNames = calloc(lLen, sizeof(Task));
|
||||
Task *sortedPrio = calloc(lLen, sizeof(Task));
|
||||
if (sortedNames == NULL || sortedPrio == NULL) {
|
||||
planLog("gen plan : calloc failed!!\n", true);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// add Tasks from llist to arr
|
||||
llist *c = head;
|
||||
for (int i = 0; c != NULL; i++) {
|
||||
sortedNames[i] = *(Task *)c->data;
|
||||
sortedPrio[i] = *(Task *)c->data;
|
||||
c = c->next;
|
||||
}
|
||||
|
||||
// sort
|
||||
qsort(sortedNames, lLen, sizeof(Task), cmpTaskN);
|
||||
qsort(sortedPrio, lLen, sizeof(Task), cmpTaskP);
|
||||
|
||||
// test print
|
||||
planLog("sortendName", 0);
|
||||
for (int i = 0; i < lLen; i++) {
|
||||
printTask(sortedNames + i);
|
||||
}
|
||||
|
||||
planLog("sortendPrio", 0);
|
||||
for (int i = 0; i < lLen; i++) {
|
||||
printTask(sortedPrio + i);
|
||||
}
|
||||
|
||||
planLog("creating eventList", false);
|
||||
|
||||
time_t now = time(NULL);
|
||||
struct tm *lc = localtime(&now);
|
||||
llist *events_ll = llistNew(NULL, cmpEvent);
|
||||
for (int i = 0; i < lLen; i++) {
|
||||
time_t start = mktime(lc);
|
||||
|
||||
printf("start:: %s\n", ctime(&start));
|
||||
lc->tm_min += 45;
|
||||
time_t end = mktime(lc);
|
||||
printf("end:: %s\n", ctime(&end));
|
||||
|
||||
Event *c = newEvent(sortedPrio + i, start, end, 0);
|
||||
printEvent(c);
|
||||
lc->tm_min += 15;
|
||||
llistAppend(events_ll, c);
|
||||
}
|
||||
|
||||
llistPrintE(events_ll->next);
|
||||
|
||||
planLog("END GEN PLAN", 0);
|
||||
|
||||
return events_ll;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef PLANNER
|
||||
#define PLANNER
|
||||
#include "llist.h"
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
* task subject struct used to track different tasks
|
||||
* create new task with taskNew(name, time_t created, time_t deadline, int
|
||||
d* create new task with taskNew(name, time_t created, time_t deadline, int
|
||||
* priority, uint64_t spare)
|
||||
*
|
||||
* should be freed by user
|
||||
|
@ -29,8 +30,8 @@ Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp);
|
|||
/*
|
||||
* compare function for Task
|
||||
*/
|
||||
int cmpTaskN(void *a, void *b);
|
||||
int cmpTaskP(void *a, void *b);
|
||||
int cmpTaskN(const void *a, const void *b);
|
||||
int cmpTaskP(const void *a, const void *b);
|
||||
|
||||
/*
|
||||
* return allocated string representation of Task
|
||||
|
@ -73,8 +74,10 @@ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
|
|||
/*
|
||||
* compare function for Event
|
||||
*/
|
||||
int cmpEvent(void *a, void *b);
|
||||
|
||||
int genPlan(Task *head);
|
||||
int cmpEvent(const void *a, const void *b);
|
||||
/*
|
||||
* takes llist of tasks and returns llist of events
|
||||
*/
|
||||
llist *genPlan(llist *head);
|
||||
|
||||
#endif // !PLANNER
|
||||
|
|
19
src/test.c
19
src/test.c
|
@ -4,6 +4,7 @@
|
|||
#include "llist.h"
|
||||
#include "planner.h" // for subject and event structs
|
||||
#include "ui.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -14,20 +15,29 @@ int main() {
|
|||
// create new task named LinAlg with priority 3, created now with deadline in
|
||||
// 5 days sp is currently unused spare var
|
||||
Task *t1 = newTask("LinAlg", now, now + days(5), 3, 0);
|
||||
assert(t1 != NULL);
|
||||
|
||||
// Stack Allocated vars only for local use!
|
||||
Task t2 = {
|
||||
.name = "Phys", .created = now, .deadline = now + days(2), .priority = 7};
|
||||
Task *t2 = newTask("Phys", now, now + days(2), 7, 0);
|
||||
assert(t2 != NULL);
|
||||
Task *t3 = newTask("Analysis", now, now + days(10), 5, 0);
|
||||
assert(t3 != NULL);
|
||||
Task *t4 = newTask("TM1", now, now + days(1), 9, 0);
|
||||
assert(t4 != NULL);
|
||||
|
||||
printf("%s\n", ctime(&now));
|
||||
|
||||
// new llist test
|
||||
llist *list1 = llistNew(t1, cmpTaskN);
|
||||
llistAppend(list1, &t2);
|
||||
llistAppend(list1, t2);
|
||||
llistAppend(list1, t3);
|
||||
llistAppend(list1, t4);
|
||||
|
||||
genPlan(list1);
|
||||
|
||||
// print test tasks
|
||||
printTask(t1);
|
||||
printTask(&t2);
|
||||
printTask(t2);
|
||||
|
||||
// find in list & modify
|
||||
Task search = {.name = "Phys"}; // key to look for. cmpTask only compares
|
||||
|
@ -46,6 +56,7 @@ int main() {
|
|||
free(t1Str);
|
||||
|
||||
free(t1);
|
||||
free(t2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue