Add format string doku, simplify format string handling.
[adu.git] / format.h
1 /* format.h */
2 enum atom_type {AT_STRING, AT_ID, AT_COUNT, AT_SIZE};
3 /*
4 * STRING: %(foo:a:w)
5 * (U)INT: %(foo:a:w:u)
6 */
7 struct atom {
8 const char const *name;
9 enum atom_type type;
10 };
11
12 union atom_value {
13 char *string_value;
14 long long unsigned num_value;
15 };
16
17 struct format_info; /* opaque */
18 int parse_format_string(char *fmt, struct atom *atoms, struct format_info **result);
19 char *format_items(struct format_info *info, union atom_value *values);
20 void free_format_info(struct format_info *info);