From 5a2f6687f681fa0ceff19a42ec9ddce479e67c48 Mon Sep 17 00:00:00 2001 From: Pedro Souza Date: Thu, 4 Apr 2024 01:52:22 -0300 Subject: added truth table and expression evaluator --- truth_table.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 truth_table.h (limited to 'truth_table.h') diff --git a/truth_table.h b/truth_table.h new file mode 100644 index 0000000..37e535a --- /dev/null +++ b/truth_table.h @@ -0,0 +1,28 @@ +#ifndef TRUTH_TABLE_HG_ +#define TRUTH_TABLE_HG_ +#include +#include +#include +#include "tree.h" + +struct truth_table { + uint32_t *lines; + uint8_t lines_count; + char *letters; + size_t letters_count; +}; + +struct expr_input_iter { + struct truth_table *src; + uint32_t acc; + uint32_t count; +}; + +struct expr_input_iter expr_input_iter_init(struct truth_table *tt); +int32_t expr_input_iter_next(struct expr_input_iter *self); + +struct truth_table *truth_table_create(node *root, uint32_t letters_bitfield); +void truth_table_destroy(struct truth_table *tt); +void truth_table_fprint(FILE *stream, struct truth_table *tt); + +#endif // TRUTH_TABLE_HG_ -- cgit v1.2.3