My omnium-gatherom of scripts and source code.
at main 35 lines 1.1 kB view raw
1#ifndef NODE_H 2typedef enum { N_QUOTE, N_VAR, N_NUM, N_AND, N_OR, N_NOT, N_COMP, N_ELE, N_CASE } node_type_t; 3 4typedef struct NODE { 5 node_type_t type; 6 int isbool; /* Is this node a Boolean expression? */ 7 char *sval; 8 struct NODE *arg1; 9 struct NODE *arg2; 10 int ref; /* For var, how many times has it been referenced? */ 11 struct NODE *next; 12} node_rec, *node_ptr; 13 14void init_node(int argc, char **argv); 15void finish_node(int check_ref); 16 17node_ptr make_quote(char *qstring); 18node_ptr make_var(char *name); 19node_ptr make_num(char *name); 20void set_bool(node_ptr varnode); 21node_ptr make_not(node_ptr arg); 22node_ptr make_and(node_ptr arg1, node_ptr arg2); 23node_ptr make_or(node_ptr arg1, node_ptr arg2); 24node_ptr make_comp(node_ptr op, node_ptr arg1, node_ptr arg2); 25node_ptr make_ele(node_ptr arg1, node_ptr arg2); 26node_ptr make_case(node_ptr arg1, node_ptr arg2); 27 28node_ptr concat(node_ptr n1, node_ptr n2); 29 30void insert_code(node_ptr qstring); 31void add_arg(node_ptr var, node_ptr qstring, int isbool); 32void gen_funct(node_ptr var, node_ptr expr, int isbool); 33#define NODE_H 34#endif 35