From 8dfff0655a2f93cc540bbaf7b88fb820431ecd02 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Fri, 7 Jun 2024 22:05:55 +0530 Subject: src/jobs: init implement data structures and json unmarshalling --- include/jobs.h | 22 ++++++++++++++++++++++ include/util.h | 9 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 include/jobs.h (limited to 'include') 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 +#include + +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 + +#include + +#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[]); -- cgit v1.2.3