aboutsummaryrefslogtreecommitdiff
path: root/src_c/common.h
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2021-12-27 23:03:52 +0100
committerbozo.kopic <bozo@kopic.xyz>2021-12-27 23:04:04 +0100
commitb0aedec7bb1eacf5967a8f086fc7740048873a58 (patch)
treea56e148380f7818a18036daf95d0ebde036e505c /src_c/common.h
parentfd0be422180178516d6d2bf3fb1f343c9ab79e53 (diff)
WIP c implementation
Diffstat (limited to 'src_c/common.h')
-rw-r--r--src_c/common.h26
1 files changed, 10 insertions, 16 deletions
diff --git a/src_c/common.h b/src_c/common.h
index c83f808..3464a61 100644
--- a/src_c/common.h
+++ b/src_c/common.h
@@ -3,20 +3,12 @@
#include <stdbool.h>
#include <stdio.h>
+#include "pool.h"
#define OPCUT_SUCCESS 0
#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, \
- .items = NULL})
-#define OPCUT_RESULT_EMPTY \
- ((opcut_result_t){.params = NULL, .used = NULL, .unused = NULL})
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -52,6 +44,11 @@ typedef struct {
bool min_initial_usage;
opcut_panel_t *panels;
opcut_item_t *items;
+
+ // internal
+ opcut_pool_t *panel_pool;
+ opcut_pool_t *item_pool;
+ double panels_area;
} opcut_params_t;
typedef struct opcut_used_t {
@@ -84,18 +81,15 @@ typedef struct {
opcut_unused_t *unused;
// internal
- double panels_area;
+ opcut_pool_t *used_pool;
+ opcut_pool_t *unused_pool;
} 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);
+int opcut_params_init(opcut_params_t *params, opcut_pool_t *panel_pool,
+ opcut_pool_t *item_pool, opcut_str_t *json);
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