Initial commit

This commit is contained in:
Phireh 2025-01-06 19:39:32 +01:00
commit f30f7a6449
10 changed files with 1126 additions and 0 deletions

32
tree.h Normal file
View file

@ -0,0 +1,32 @@
#ifndef TREE_H
#define TREE_H
typedef struct tnode_ tnode_t;
typedef struct tnode_* tnode_ptr;
typedef enum { INT, UINT, CHAR, FLOAT, DOUBLE, CHAR_PTR, VOID_PTR } tnode_value_t;
typedef struct tnode_ {
int type;
union {
int vi;
unsigned int vui;
char vc;
float vf;
double vd;
char* vcp;
void *vptr;
};
tnode_ptr parent;
tnode_ptr left_leaf;
tnode_ptr right_leaf;
} tnode_t;
tnode_t* tree_root(tnode_t* leaf)
{
tnode_t* current = leaf;
while(current = current->parent && current->parent);
return current;
}
#endif //TREE_H