From b90fbef0a8e7acf3d4a485ca83126afc8a745828 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Fri, 8 Sep 2023 23:22:24 +0200 Subject: ICS import is functional! --- src/main.odin | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/main.odin') diff --git a/src/main.odin b/src/main.odin index 729715b..7884f28 100644 --- a/src/main.odin +++ b/src/main.odin @@ -13,12 +13,24 @@ main :: proc() { // for cache reasons, and to simplify the process of // adding new Workdays to the array. - _, _ = importICS("res/test.ics") + workdays : [dynamic]Workday + //resize(&workdays, 3) + + { // No need to keep this array in memory forever + c, _ := importICS("res/test.ics") + + for thing, i in c { + fmt.println("\n\nAdding workday nr", i, "\n", toString(thing), "\n") + append(&workdays, new_workday({00, 00, 1, 1, 1850}, + thing.start, + thing.end, + thing.end)) + } + } - workdays: [dynamic]^Workday - resize(&workdays, 3) + //if true do return - workday0: = new_workday({10, 22, 3, 5, 2023}, + /*workday0: = new_workday({10, 22, 3, 5, 2023}, {00, 08, 4, 5, 2023}, {00, 22, 4, 5, 2023}, {30, 21, 4, 5, 2023}) @@ -35,8 +47,9 @@ main :: proc() { {15, 17, 6, 5, 2023}, {00, 17, 6, 5, 2023}) workdays[2] = &workday2 + */ - slice.sort_by(workdays[:], lessWorkdayPtr) + slice.sort_by(workdays[:], lessWorkday) //call_text: cstring = "00:00" call_text: = make([]byte, 6) @@ -47,7 +60,7 @@ main :: proc() { defer delete(wrap_text) wrap_text[len(wrap_text)-1] = 0 - date_text: = make([]byte, len(toString(workday0.call))+1 ) + date_text: = make([]byte, len(toString(workdays[0].call))+1 ) defer delete(date_text) wrap_text[len(wrap_text)-1] = 0 @@ -83,7 +96,7 @@ main :: proc() { // Setting up the timelines - for day in workdays { + for day in &workdays { beginning: Moment = {0, 0, day.call.day, day.call.month, day.call.year} fmt.println("\nNew day!") -- cgit v1.2.1