aboutsummaryrefslogtreecommitdiff
path: root/parse.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-01-19 19:06:09 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-01-19 19:06:14 +0100
commitc42c2834d8c7b5d81465b9d9d127d8384151b9cb (patch)
tree53b1a8eb0368d5f91525604eea2c3173083c1955 /parse.h
parentCan now parse entire directory in one go. (diff)
downloadcalp-c42c2834d8c7b5d81465b9d9d127d8384151b9cb.tar.gz
calp-c42c2834d8c7b5d81465b9d9d127d8384151b9cb.tar.xz
[BROKEN] Work on adding hash tables.
Diffstat (limited to 'parse.h')
-rw-r--r--parse.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/parse.h b/parse.h
new file mode 100644
index 00000000..cb6c2d1e
--- /dev/null
+++ b/parse.h
@@ -0,0 +1,41 @@
+#ifndef PARSE_H
+#define PARSE_H
+
+#define SAFE_STR
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "strbuf.h"
+#include "vcal.h"
+
+/*
+ * Max length of a line.
+ * TODO update this to allow longer lines, in case someone doesn't
+ * follow the standard.
+ */
+#define SEGSIZE 75
+
+#define ERR(x, line) fprintf(stderr, "ERR %i: %s (cal %i)\n", __LINE__, (x), (line));
+
+#define LINE(nr, key, value) fprintf(stderr, "(%i) %i: [%s] := [%s]\n", __LINE__, nr, key, value);
+
+typedef enum {
+ p_key, p_value, p_param_name, p_param_value
+} part_context;
+
+typedef enum {
+ s_none, s_calendar, s_event
+} scope_context;
+
+int handle_kv(
+ vcalendar* cal,
+ vevent* ev,
+ content_line* cline,
+ int line,
+ scope_context* s_ctx
+ );
+
+int parse_file(FILE* f, vcalendar* cal);
+
+#endif /* PARSE_H */