modified: Makefile

modified:   README.md
	new file:   debugOut
	modified:   doc/docu.md
	new file:   doc/overview.drawio
	new file:   doc/overview.png
	modified:   src/config.h
	modified:   src/db.c
	modified:   src/db.h
	modified:   src/iCal.c
	modified:   src/planner.c
	modified:   src/planner.h
	new file:   src/test.c
	modified:   src/ui.c

 Changes not staged for commit:
	deleted:    debugOut
This commit is contained in:
simon committed 2024-12-10 22:06:49 +01:00
1 parent 550a452249
commit b502e8040c
14 files changed
+231 -44

No files matched your search

+7 -7
View File
@@ -1,15 +1,15 @@
/* Global config file should be importet by all
/* Global config file
*/
#ifndef CONFIG
#define CONFIG
#include <time.h>
// #define seconds(n) (n * CLOCKS_PER_SEC)
#define minutes(n) (60 * n)
#define hours(n) (60 * minutes(n))
#define days(n) (24 * hours(n))
#define seconds(n) (n * CLOCKS_PER_SEC)
#define minutes(n) (n * 60 * seconds(n))
#define hours(n) (n * 60 *(minutes(n))
const time_t pauseLenght = minutes(15);
const time_t minIntervalLen = minutes(30);
static const time_t pauseLenght = minutes(15);
static const time_t minIntervalLen = minutes(30);
#endif
+15 -19
View File
@@ -1,24 +1,20 @@
/*
* databse
* stores current state and reads previous
* INPUT: query for sotred date
* linked list of subjects to sotore
*
* OUTPUT:
* linked list of subjects from file
* OK
*
*
*/
#include "planner.h"
#include <stdio.h>
const char format[] = "{ %s = { %s}\n";
struct A {
char *s1;
char *s2;
}A;
int main(){
struct A test;
test.s1 = "asdasd";
test.s2 = "asdad";
printf(format, test.s1, test.s2);
// serialize struct test
const char format[] = "{%s = {%lu, %lu, %d}\n"; //
int serialize(Subject *s) {
printf(format, s->name, s->created, s->deadline, s->priority);
return 0;
}
+3
View File
@@ -1,4 +1,7 @@
#ifndef DB
#define DB
#include "planner.h"
int serialize(Subject *s);
#endif
+6
View File
@@ -0,0 +1,6 @@
/* INPUT: linked list of events and generate ical file
* OUTPUT: Ical File, OK to caller
*
*/
#include "planner.h" // for subject and event structs
+7 -4
View File
@@ -1,7 +1,10 @@
/*
* Main Plannder
* gets data from user or db
* generates timetable
* modify data for next day and send to db
* 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)??
*
*/
#include "planner.h" // for subject and event structs
#include "config.h"
+18
View File
@@ -1,4 +1,22 @@
#ifndef PLANNER
#define PLANNER
#include <time.h>
typedef struct Subject {
char *name;
time_t created;
time_t deadline;
int priority;
unsigned long long spare;
} Subject;
typedef struct Event {
Subject subject;
time_t plannedStartTime;
time_t plannedEndTime;
unsigned long long spare;
} Event;
int genPlan(Subject *head);
#endif // !PLANNER
+29
View File
@@ -0,0 +1,29 @@
#include "config.h"
#include "db.h"
#include "iCal.h"
#include "planner.h" // for subject and event structs
#include "ui.h"
#include <stdio.h>
int main() {
time_t now = time(NULL);
Subject t1 = {.name = "LinAlg",
.created = now,
.deadline = now + days(5),
.priority = 3};
Subject t2 = {
.name = "Phys", .created = now, .deadline = now + days(2), .priority = 7};
// create plan
// planner([t1,t2])
//
printf("%s\n", ctime(&now));
serialize(&t1);
serialize(&t2);
return 0;
}
+1
View File
@@ -2,3 +2,4 @@
* command line interface for user input
*
*/
#include "planner.h" // for subject and event structs