Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node_t * node_init ( nodetype_t type,
- char* label,
- base_data_type_t base_type,
- expression_type_t expression_type,
- int n_children,
- va_list child_list )
- {
- //see tree.h for content description
- node_t *n = malloc(sizeof(node_t));
- n->nodetype = type;
- n->label = label;
- n->expression_type = expression_type;
- n->data_type = base_type;
- //n->string_index
- //TODO figure out this
- //esential for maneuvering va_args
- n->n_children = n_children;
- //create a list of children pointers
- node_t* children_list = (node_t *) malloc(sizeof(node_t)*n_children);
- //fill the child list with the stuff in va_args
- for(int i = 0; i < n_children; i++){
- *(child_list + i) = va_list(child_list, node_t*);
- }
- //children is a pointer to a pointer so we assign the address of children list.
- n->children = &children_list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement