From 1a19c238e3741931db9e61b6a0b79259b5ed0753 Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Wed, 22 Dec 2021 19:35:48 +0100 Subject: WIP c implementation --- src_c/common.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src_c/common.h') diff --git a/src_c/common.h b/src_c/common.h index 16aeb9b..42fed63 100644 --- a/src_c/common.h +++ b/src_c/common.h @@ -8,6 +8,21 @@ #define OPCUT_ERROR 1 #define OPCUT_UNSOLVABLE 2 +#define OPCUT_STR_EMPTY ((opcut_str_t){.data = NULL, .len = 0}) +#define OPCUT_PARAMS_EMPTY \ + ((opcut_params_t){.cut_width = 0, \ + .min_initial_usage = false, \ + .panels = NULL, \ + .panels_len = 0, \ + .items = NULL, \ + .items_len = 0}) +#define OPCUT_RESULT_EMPTY \ + ((opcut_result_t){.params = NULL, \ + .used = NULL, \ + .used_len = 0, \ + .unused = NULL, \ + .unused_len = 0}) + #ifdef __cplusplus extern "C" { #endif @@ -64,10 +79,14 @@ typedef struct { } opcut_result_t; +int opcut_str_resize(opcut_str_t *str, size_t size); int opcut_params_init(opcut_params_t *params, opcut_str_t *json); -void opcut_params_destroy(opcut_params_t *params); int opcut_result_write(opcut_result_t *result, FILE *stream); +void opcut_str_destroy(opcut_str_t *str); +void opcut_params_destroy(opcut_params_t *params); +void opcut_result_destroy(opcut_result_t *result); + #ifdef __cplusplus } #endif -- cgit v1.2.3-70-g09d2