diff options
Diffstat (limited to 'vendor/librune/man/u8next.3')
| -rw-r--r-- | vendor/librune/man/u8next.3 | 24 | 
1 files changed, 10 insertions, 14 deletions
diff --git a/vendor/librune/man/u8next.3 b/vendor/librune/man/u8next.3 index 93a4f5d..eabf2a2 100644 --- a/vendor/librune/man/u8next.3 +++ b/vendor/librune/man/u8next.3 @@ -1,4 +1,4 @@ -.Dd January 18 2024 +.Dd January 27 2024  .Dt U8NEXT 3  .Os  .Sh NAME @@ -9,9 +9,9 @@  .Lb librune  .Sh SYNOPSIS  .In utf8.h -.Ft "const char8_t *" +.Ft int  .Fn u8next "rune *ch" "const char8_t **s" "size_t *n" -.Ft "const char8_t *" +.Ft int  .Fn u8prev "rune *ch" "const char8_t **s" "const char8_t *start"  .Sh DESCRIPTION  The @@ -48,11 +48,9 @@ The  .Fn u8next  and  .Fn u8prev -functions return the updated value of -.Fa s -or -.Dv NULL -at the end of iteration. +functions return the length of the UTF-8-encoded rune iterated over in +bytes, +or 0 at the end of iteration.  .Sh EXAMPLES  The following calls to  .Fn u8next @@ -63,14 +61,13 @@ iterate over and print all the codepoints in  #define STRING u8"Ta’ Ħaġrat" +int w;  rune ch;  const char8_t *s = STRING;  size_t n = sizeof(STRING) - 1; -while (u8next(&ch, &s, &n)) { -	int w = u8wdth(ch); +while (w = u8next(&ch, &s, &n))  	printf("U+%04" PRIXRUNE ": ‘%.*s’\en", ch, w, s - w); -}  .Ed  .Pp  The following example is the same as the previous, @@ -82,6 +79,7 @@ function to iterate backwards.  #define STRING u8"Ta’ Ħaġrat" +int w;  rune ch;  const char8_t *s, *start;  size_t n = sizeof(STRING) - 1; @@ -89,10 +87,8 @@ size_t n = sizeof(STRING) - 1;  start = STRING;  s = start + n; -while (u8prev(&ch, &s, start)) { -	int w = u8wdth(ch); +while (w = u8prev(&ch, &s, start))  	printf("U+%04" PRIXRUNE ": ‘%.*s’\en", ch, w, s); -}  .Ed  .Sh SEE ALSO  .Xr rune 3 ,  |