4 /* have a care with this one. It can't be used when (c) has side-effects */
6 #define ISSPACE(c) ((c) == ' ' || (c) == '\t')
10 unsigned line
; /* starting line */
17 #define next_var(c) (c->cur_var >= c->vars ? NULL : c->vlist[c->cur_var++])
20 const char *name
; /* filename, or everything leading up to '{' */
21 char *buf
; /* file contents, if this is a file */
22 char *template_name
; /* 'name' entry from compound */
23 char *use
; /* the value of any "use" variables */
24 unsigned int vars
; /* number of variables */
25 unsigned int cur_var
; /* current variable (for next_var) */
26 unsigned int vlist_len
; /* size of vlist */
27 unsigned start
, end
; /* starting and ending line */
28 unsigned nested
; /* number of compounds nested below this */
29 struct cfg_var
**vlist
; /* array of variables */
30 struct cfg_comp
*parent
; /* nested from */
31 struct cfg_comp
**nest
; /* compounds nested inside this one */
35 struct cfg_comp
*cfg_parse_file(const char *path
);
36 void cfg_destroy_compound(struct cfg_comp
*comp
);
37 void cfg_warn(struct cfg_comp
*comp
, struct cfg_var
*v
, const char *fmt
, ...)
38 __attribute__((__format__(__printf__
, 3, 4)));
39 void cfg_error(struct cfg_comp
*comp
, struct cfg_var
*v
, const char *fmt
, ...)
40 __attribute__((__format__(__printf__
, 3, 4), __noreturn__
));
41 char *cfg_copy_value(struct cfg_var
*v
);
43 #endif /* _CONFIG_H */