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