Content-type: text/html; charset=UTF-8 Man page of GRAPHEME_IS_CHARACTER_BREAK

GRAPHEME_IS_CHARACTER_BREAK

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
suckless.org  

NAME

grapheme_is_character_break - test for a grapheme cluster break between two codepoints  

SYNOPSIS

In grapheme.h Ft size_t Fn grapheme_is_character_break uint_least32_t cp1 uint_least32_t cp2 uint_least16_t *state  

DESCRIPTION

The Fn grapheme_is_character_break function determines if there is a grapheme cluster break (see libgrapheme(7)) between the two codepoints cp1 and cp2 By specification this decision depends on a state that can at most be completely reset after detecting a break and must be reset every time one deviates from sequential processing.

If state is NULL Fn grapheme_is_character_break behaves as if it was called with a fully reset state.  

RETURN VALUES

The Fn grapheme_is_character_break function returns true if there is a grapheme cluster break between the codepoints cp1 and cp2 and false if there is not.  

EXAMPLES

/* cc (-static) -o example example.c -lgrapheme */
#include <grapheme.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
        uint_least16_t state = 0;
        uint_least32_t s1[] = ..., s2[] = ...; /* two input arrays */
        size_t i;

        for (i = 0; i + 1 < sizeof(s1) / sizeof(*s1); i++) {
                if (grapheme_is_character_break(s[i], s[i + 1], &state)) {
                        printf("break in s1 at offset %zu, i);
                }
        }
        memset(&state, 0, sizeof(state)); /* reset state */
        for (i = 0; i + 1 < sizeof(s2) / sizeof(*s2); i++) {
                if (grapheme_is_character_break(s[i], s[i + 1], &state)) {
                        printf("break in s2 at offset %zu, i);
                }
        }

        return 0;
}
 

SEE ALSO

grapheme_next_character_break3, grapheme_next_character_break_utf83, libgrapheme(7)  

STANDARDS

Fn grapheme_is_character_break is compliant with the Unicode 15.0.0 specification.  

AUTHORS

An Laslo Hunhold Aq Mt dev@frign.de


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
EXAMPLES
SEE ALSO
STANDARDS
AUTHORS

This document was created by man2html, using the manual pages.
Time: 06:27:21 GMT, December 21, 2024