/* rc.h : header file for rc.c */ /* PUBLIC DOMAIN 2003 Jon Mayo */ #ifndef RC_H #define RC_H typedef enum { NODETYPE_NIL, NODETYPE_TREE, NODETYPE_NUMBER, NODETYPE_STRING, NODETYPE_VECTOR } nodetype_t; struct config_node { struct config_node *next; struct config_node *child; char *name; nodetype_t type; union { long long number; char *str; struct { unsigned nr; float *data; } vector; } value; }; struct config_node *config_parser(const char *filename); struct config_node *config_find(struct config_node *root, const char *name); void config_free(struct config_node *root); /* makes a copy of the string at the node */ int config_get_str(struct config_node *item,char *buf,size_t buf_max); /* makes a copy of the number value at the node */ int config_get_int(struct config_node *item,int *i); /* makes a copy of the vector value at the node */ int config_get_vector(struct config_node *item, unsigned max, float *vector); /* dumps a pretty picture of the tree */ void config_dump(struct config_node *root); #endif /* RC_H */