sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

isspacerune.c (520B)


      1 /* Automatically generated by mkrunetype.awk */
      2 #include <stdlib.h>
      3 
      4 #include "../utf.h"
      5 #include "runetype.h"
      6 
      7 static const Rune space2[][2] = {
      8 	{ 0x0009, 0x000D },
      9 	{ 0x001C, 0x0020 },
     10 	{ 0x2000, 0x200A },
     11 	{ 0x2028, 0x2029 },
     12 };
     13 
     14 static const Rune space1[] = {
     15 	0x0085,
     16 	0x00A0,
     17 	0x1680,
     18 	0x202F,
     19 	0x205F,
     20 	0x3000,
     21 };
     22 
     23 int
     24 isspacerune(Rune r)
     25 {
     26 	if(bsearch(&r, space2, nelem(space2), sizeof *space2, &rune2cmp))
     27 		return 1;
     28 	if(bsearch(&r, space1, nelem(space1), sizeof *space1, &rune1cmp))
     29 		return 1;
     30 	return 0;
     31 }