39 lines
656 B
C
39 lines
656 B
C
|
|
#include <debug.h>
|
|
|
|
#include <avl/avl.h>
|
|
|
|
#include "struct.h"
|
|
#include "new.h"
|
|
|
|
static int compare_truthtables(const void* a, const void* b)
|
|
{
|
|
const truthtable_t* A = a;
|
|
const truthtable_t* B = b;
|
|
|
|
if (*A < *B)
|
|
return -1;
|
|
else if (*A > *B)
|
|
return +1;
|
|
else
|
|
return +0;
|
|
}
|
|
|
|
struct truthtable_set* new_truthtable_set(void)
|
|
{
|
|
ENTER;
|
|
|
|
struct truthtable_set* this = smalloc(sizeof(*this));
|
|
|
|
struct avl_tree_t* tree = avl_alloc_tree(
|
|
/* comparator: */ compare_truthtables,
|
|
/* free-er: */ free);
|
|
|
|
this->tree = tree;
|
|
|
|
this->n = 0;
|
|
|
|
EXIT;
|
|
return this;
|
|
}
|
|
|