Blob


1 /* See LICENSE file for copyright and license details. */
2 #ifndef UTIL_H
3 #define UTIL_H
5 #include <stddef.h>
6 #include <stdint.h>
8 #include "types.h"
10 #define LEN(x) (sizeof (x) / sizeof *(x))
12 struct property_spec {
13 const char *enumname;
14 const char *file;
15 const char *ucdname;
16 };
18 struct properties {
19 int_least64_t property;
20 };
22 struct properties_compressed {
23 size_t *offset;
24 struct properties *data;
25 size_t datalen;
26 };
28 struct properties_major_minor {
29 size_t *major;
30 size_t *minor;
31 size_t minorlen;
32 };
34 int hextocp(const char *, size_t, uint_least32_t *cp);
36 void parse_file_with_callback(const char *, int (*callback)(const char *,
37 char **, size_t, char *, void *), void *payload);
39 void properties_compress(const struct properties *, struct properties_compressed *comp);
40 double properties_get_major_minor(const struct properties_compressed *,
41 struct properties_major_minor *);
42 void properties_print_lookup_table(char *, size_t *, size_t);
43 void properties_print_derived_lookup_table(char *, char *, size_t *, size_t,
44 int_least64_t (*get_value)(const struct properties *,
45 size_t), const void *);
47 void properties_generate_break_property(const struct property_spec *,
48 uint_least8_t, uint_least8_t
49 (*handle_conflict)(uint_least32_t,
50 uint_least8_t, uint_least8_t),
51 uint_least8_t (*post_process)
52 (uint_least8_t), const char *,
53 const char *);
55 void break_test_list_parse(char *, struct break_test **, size_t *);
56 void break_test_list_print(const struct break_test *, size_t,
57 const char *, const char *);
58 void break_test_list_free(struct break_test *, size_t);
60 #endif /* UTIL_H */