aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-03-14 16:23:06 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-03-14 16:23:06 +0800
commit644663969201ced8e32fe56c7d1fd712d2fa1330 (patch)
tree7d7c7dea61284622f31ca5bd1303d796ad207418 /src
parent12feee12ba92c3f47ab80bf4ebe96f51dfbc599a (diff)
downloadadvent-of-code-644663969201ced8e32fe56c7d1fd712d2fa1330.tar.gz
advent-of-code-644663969201ced8e32fe56c7d1fd712d2fa1330.zip
day1
Diffstat (limited to 'src')
-rw-r--r--src/2015/day1/aoc.cpp0
-rw-r--r--src/2015/day1/aoc.h1
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/common.cpp13
-rw-r--r--src/common.h11
5 files changed, 31 insertions, 0 deletions
diff --git a/src/2015/day1/aoc.cpp b/src/2015/day1/aoc.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/2015/day1/aoc.cpp
diff --git a/src/2015/day1/aoc.h b/src/2015/day1/aoc.h
new file mode 100644
index 0000000..6f70f09
--- /dev/null
+++ b/src/2015/day1/aoc.h
@@ -0,0 +1 @@
+#pragma once
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..7b0b9c7
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,6 @@
+set(SOLUTION_FILES
+ "2015/day1/aoc.cpp"
+)
+
+add_library(solution SHARED ${SOLUTION_FILES})
+target_include_directories(solution PRIVATE ${PROJECT_SOURCE_DIR}/src)
diff --git a/src/common.cpp b/src/common.cpp
new file mode 100644
index 0000000..8ac3a96
--- /dev/null
+++ b/src/common.cpp
@@ -0,0 +1,13 @@
+#include "common.h"
+
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+line_view load_file(const char* path) {
+ return {nullptr, 0};
+}
+
+line_view next_line(const char* file, size_t offset) {
+ return {nullptr, 0};
+}
diff --git a/src/common.h b/src/common.h
new file mode 100644
index 0000000..f242f48
--- /dev/null
+++ b/src/common.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <stdlib.h>
+
+struct line_view {
+ char* line;
+ size_t length;
+};
+
+line_view load_file(const char*);
+line_view next_line(const char*, size_t);