summaryrefslogtreecommitdiff
path: root/input.h
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2022-12-01 20:35:58 +0100
committerVincent Douillet <vincent@vdouillet.fr>2022-12-01 20:35:58 +0100
commit076d2ca0e0c2f0308373628272a3972241575653 (patch)
treebf60b98fe6b5a569649f41ff93836a9623a93c18 /input.h
day 1
Diffstat (limited to 'input.h')
-rw-r--r--input.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/input.h b/input.h
new file mode 100644
index 0000000..f7593ce
--- /dev/null
+++ b/input.h
@@ -0,0 +1,30 @@
+#ifndef DEF_INPUTH
+#define DEF_INPUTH
+
+/* simple macro to check a result against an expected value */
+#define CHECK(actual, expected) {\
+ if(actual == expected)\
+ printf("%ld ok\n", actual);\
+ else\
+ printf("%ld ko, expected %ld\n", actual, expected);\
+}
+
+struct input_int {
+ size_t line_count;
+ int* lines;
+};
+
+struct input_str {
+ size_t line_count;
+ char** lines;
+};
+
+void input_int_read(struct input_int* result, char* filename);
+
+void input_str_read(struct input_str* result, char* filename);
+
+void input_int_free(struct input_int* input);
+
+void input_str_free(struct input_str* input);
+
+#endif