cRuneRange
Overview
Module with functions and types to work with a cRuneRange values.
Example
#include "clingo/lang/expect.h" #include "clingo/type/cRuneRange.h" int main( void ) { init_tap_c_(); cRuneRange ascii = utf32_rune_range_c( 0x0000, 0x007F ); cRuneRange digits = rune_range_c( "0", "9" ); cRuneRange buginese = utf16_rune_range_c( 0x1A00, 0x1A1F ); expect_c_( in_rune_range_c_( ascii, "a" ) ); expect_c_( !in_rune_range_c_( digits, "a" ) ); expect_c_( !in_rune_range_c_( buginese, "a" ) ); expect_c_( in_rune_range_c_( ascii, "5" ) ); expect_c_( in_rune_range_c_( digits, "5" ) ); expect_c_( !in_rune_range_c_( buginese, "a" ) ); expect_c_( !in_rune_range_c_( ascii, "ᨒ" ) ); expect_c_( !in_rune_range_c_( digits, "ᨒ" ) ); expect_c_( in_rune_range_c_( buginese, "ᨒ" ) ); expect_c_( eq_rune_range_c( ascii, ascii ) ); expect_c_( !eq_rune_range_c( ascii, digits ) ); return finish_tap_c_(); }
Types and Definitions
cRuneRange
struct cRuneRange { int64_t min; int64_t max; }; typedef struct cRuneRange cRuneRange;
A cRuneRange is bounded inclusively below and above [min..max].
Functions
init
build_rune_range_c
cRuneRange build_rune_range_c( cRune min, cRune max );
Creates a cRuneRange.
make_rune_range_c
cRuneRange make_rune_range_c( cChars min, cChars max );
Creates a cRuneRange from the UTF-8 encoded code points at the front.
rune_range_c
cRuneRange rune_range_c( char const min[static 1], char const max[static 1] );
Creates a cRuneRange from the UTF-8 encoded code points at the front.
utf16_rune_range_c
cRuneRange utf16_rune_range_c( uint16_t min, uint16_t max );
Creates a cRuneRange from a UTF-16 encoded code points.
utf32_rune_range_c
cRuneRange utf32_rune_range_c( uint32_t min, uint32_t max );
Creates a cRuneRange from a UTF-32 encoded code points.
overall
eq_rune_range_c
bool eq_rune_range_c( cRuneRange a, cRuneRange b );
in_rune_range_c
#define in_rune_range_c_( Range, Cstr ) \ in_rune_range_c( (Range), rune_c( Cstr ) ) bool in_rune_range_c( cRuneRange range, cRune r );
Returns true if r is greater or equal than min and less or equal than max, otherwise false.
rune_range_is_valid_c
bool rune_range_is_valid_c( cRuneRange range );