Permalink
Browse files

add fullrune

  • Loading branch information...
1 parent dbee65c commit 42d88aa25b604577e810a467eb7ffa61e537073b Rafael Sevilla committed Sep 6, 2010
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/utf.c
View
@@ -247,3 +247,23 @@ int runetochar(char *str, Rune *rune)
/* invalid rune */
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.