Blame


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