Skip to content

Commit

Permalink
add fullrune
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Sevilla committed Sep 6, 2010
1 parent dbee65c commit 42d88aa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/utf.c
Expand Up @@ -247,3 +247,23 @@ int runetochar(char *str, Rune *rune)
/* invalid rune */ /* invalid rune */
return(0); return(0);
} }

int fullrune(char *str, int n)
{
int c;

if (n > 0) {
c = *(unsigned char *)str;
if (c < Tx)
return(1);
if ((c > T5 && n > 5)
|| (c > T4 && n > 4)
|| (c > T3 && n > 3))
return(1);
if (n > 1) {
if (c < T3 || n > 2)
return(1);
}
}
return(0);
}

0 comments on commit 42d88aa

Please sign in to comment.