libgrapheme

unicode string library
git clone git://git.suckless.org/libgrapheme
Log | Files | Refs | README | LICENSE

grapheme.h (660B)


      1 /* See LICENSE file for copyright and license details. */
      2 #ifndef GRAPHEME_H
      3 #define GRAPHEME_H
      4 
      5 #include <stdbool.h>
      6 #include <stddef.h>
      7 #include <stdint.h>
      8 
      9 typedef struct grapheme_internal_segmentation_state {
     10 	uint_least8_t prop;
     11 	bool prop_set;
     12 	bool gb11_flag;
     13 	bool gb12_13_flag;
     14 } GRAPHEME_STATE;
     15 
     16 #define GRAPHEME_INVALID_CODEPOINT UINT32_C(0xFFFD)
     17 
     18 size_t grapheme_next_character_break(const char *, size_t);
     19 
     20 bool grapheme_is_character_break(uint_least32_t, uint_least32_t, GRAPHEME_STATE *);
     21 
     22 size_t grapheme_decode_utf8(const char *, size_t, uint_least32_t *);
     23 size_t grapheme_encode_utf8(uint_least32_t, char *, size_t);
     24 
     25 #endif /* GRAPHEME_H */