typedefs
This commit is contained in:
@ -1,29 +1,29 @@
|
||||
#ifndef LIBFLINT_BINARY_TREE_H
|
||||
#define LIBFLINT_BINARY_TREE_H
|
||||
|
||||
struct BinTreeNode {
|
||||
typedef struct BinTreeNode {
|
||||
void *data;
|
||||
struct BinTreeNode *left;
|
||||
struct BinTreeNode *right;
|
||||
};
|
||||
} BinTreeNode;
|
||||
|
||||
struct BinTree {
|
||||
typedef struct {
|
||||
int size;
|
||||
|
||||
int (*compare)(const void *a, const void *b);
|
||||
void (*destroy)(void *data);
|
||||
|
||||
struct BinTreeNode *root;
|
||||
};
|
||||
} BinTree;
|
||||
|
||||
void bintree_init(struct BinTree *tree, void (*destroy)(void *data));
|
||||
void bintree_destroy(struct BinTree *tree);
|
||||
int bintree_ins_left(struct BinTree *tree, struct BinTreeNode *node, void *data);
|
||||
int bintree_ins_right(struct BinTree *tree, struct BinTreeNode *node, void *data);
|
||||
void bintree_rem_left(struct BinTree *tree, struct BinTreeNode *node);
|
||||
void bintree_rem_right(struct BinTree *tree, struct BinTreeNode *node);
|
||||
int bintree_merge(struct BinTree *merge, struct BinTree *left, struct BinTree *right, void *data);
|
||||
void bintree_debug_print(struct BinTree *tree);
|
||||
void bintree_init(BinTree *tree, void (*destroy)(void *data));
|
||||
void bintree_destroy(BinTree *tree);
|
||||
int bintree_ins_left(BinTree *tree, BinTreeNode *node, void *data);
|
||||
int bintree_ins_right(BinTree *tree, BinTreeNode *node, void *data);
|
||||
void bintree_rem_left(BinTree *tree, BinTreeNode *node);
|
||||
void bintree_rem_right(BinTree *tree, BinTreeNode *node);
|
||||
int bintree_merge(BinTree *merge, BinTree *left, BinTree *right, void *data);
|
||||
void bintree_debug_print(BinTree *tree);
|
||||
|
||||
#define bintree_is_eob(node) ((node) == NULL)
|
||||
#define bintree_is_leaf(node) ((node)->left == NULL && (node)->right == NULL)
|
||||
|
@ -3,13 +3,13 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct ListNode {
|
||||
typedef struct ListNode {
|
||||
void* data;
|
||||
struct ListNode* next;
|
||||
struct ListNode* prev;
|
||||
};
|
||||
} ListNode;
|
||||
|
||||
struct List {
|
||||
typedef struct {
|
||||
size_t size;
|
||||
|
||||
void (*destroy)(void* data);
|
||||
@ -17,14 +17,14 @@ struct List {
|
||||
|
||||
struct ListNode* head;
|
||||
struct ListNode* tail;
|
||||
};
|
||||
} List;
|
||||
|
||||
void ll_init(struct List* list, void (*destroy)(void *data));
|
||||
void ll_destroy(struct List* list);
|
||||
int ll_ins_next(struct List* list, struct ListNode* node, const void* data);
|
||||
int ll_ins_prev(struct List* list, struct ListNode* node, const void* data);
|
||||
int ll_remove(struct List* list, struct ListNode* node, void** data);
|
||||
int ll_remove_next(struct List* list, struct ListNode* node, void** data);
|
||||
int ll_remove_prev(struct List* list, struct ListNode* node, void** data);
|
||||
void ll_init(List* list, void (*destroy)(void *data));
|
||||
void ll_destroy(List* list);
|
||||
int ll_ins_next(List* list, ListNode* node, const void* data);
|
||||
int ll_ins_prev(List* list, ListNode* node, const void* data);
|
||||
int ll_remove(List* list, ListNode* node, void** data);
|
||||
int ll_remove_next(List* list, ListNode* node, void** data);
|
||||
int ll_remove_prev(List* list, ListNode* node, void** data);
|
||||
|
||||
#endif
|
||||
|
@ -5,16 +5,16 @@
|
||||
|
||||
#define Set List
|
||||
|
||||
void set_init(struct Set* set, int (*match)(const void* a, const void* b),
|
||||
void set_init(Set* set, int (*match)(const void* a, const void* b),
|
||||
void (*destroy)(void* data));
|
||||
void set_destroy(struct Set* set);
|
||||
int set_insert(struct Set* set, const void* data);
|
||||
int set_remove(struct Set* set, void** data);
|
||||
int set_union(struct Set* setu, const struct Set* a, const struct Set* b);
|
||||
int set_intersection(struct Set* seti, const struct Set* a, const struct Set* b);
|
||||
int set_difference(struct Set* setd, const struct Set* a, const struct Set* b);
|
||||
int set_is_member(const struct Set* set, const void* data);
|
||||
int set_is_subset(const struct Set* a, const struct Set* b);
|
||||
int set_is_equal(const struct Set* a, const struct Set* b);
|
||||
void set_destroy(Set* set);
|
||||
int set_insert(Set* set, const void* data);
|
||||
int set_remove(Set* set, void** data);
|
||||
int set_union(Set* setu, const Set* a, const Set* b);
|
||||
int set_intersection(Set* seti, const Set* a, const Set* b);
|
||||
int set_difference(Set* setd, const Set* a, const Set* b);
|
||||
int set_is_member(const Set* set, const void* data);
|
||||
int set_is_subset(const Set* a, const Set* b);
|
||||
int set_is_equal(const Set* a, const Set* b);
|
||||
|
||||
#endif
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
#define Stack List
|
||||
|
||||
void stack_init(struct Stack* stack, void (*destroy)(void* data));
|
||||
void stack_destroy(struct Stack* stack);
|
||||
int stack_push(struct Stack* stack, void *data);
|
||||
void *stack_peek(struct Stack *stack);
|
||||
int stack_pop(struct Stack *stack, void **data);
|
||||
void stack_init(Stack* stack, void (*destroy)(void* data));
|
||||
void stack_destroy(Stack* stack);
|
||||
int stack_push(Stack* stack, void *data);
|
||||
void *stack_peek(Stack *stack);
|
||||
int stack_pop(Stack *stack, void **data);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user