summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-06-07 22:05:55 +0530
committersinanmohd <sinan@sinanmohd.com>2024-06-09 22:43:48 +0530
commit8dfff0655a2f93cc540bbaf7b88fb820431ecd02 (patch)
treebbf2621277e920aa4bd9013b1fa9f8e1eb0b8e2c /include
parentf6a06d2fe7bd8519219f243536e77fcee46cb583 (diff)
src/jobs: init
implement data structures and json unmarshalling
Diffstat (limited to 'include')
-rw-r--r--include/jobs.h22
-rw-r--r--include/util.h9
2 files changed, 31 insertions, 0 deletions
diff --git a/include/jobs.h b/include/jobs.h
new file mode 100644
index 0000000..571be0d
--- /dev/null
+++ b/include/jobs.h
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <sys/queue.h>
+
+LIST_HEAD(output_dlist, output);
+struct output {
+ char *name, *store_path;
+ LIST_ENTRY(output) dlist;
+};
+
+LIST_HEAD(job_dlist, job);
+struct job {
+ char *drv_path, *name;
+ struct output_dlist outputs;
+ struct job_dlist deps;
+
+ LIST_ENTRY(job) dlist;
+};
+
+int jobs_init(FILE **stream);
+int job_new(struct job **j, char *name, char *drv_path);
+void job_free(struct job *j);
+int jobs_read(FILE *stream, struct job *jobs);
diff --git a/include/util.h b/include/util.h
index e69de29..c5aa0ab 100644
--- a/include/util.h
+++ b/include/util.h
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#include <cjson/cJSON.h>
+
+#define print_err(fmt, ...) \
+ fprintf(stderr, "[%s:%d] " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__)
+
+int json_streaming_read(FILE *stream, cJSON **json);
+int vpopen(FILE **stream, const char *file, char *const argv[]);