diff options
| -rw-r--r-- | lutf8lib.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lutf8lib.c,v 1.6 2014/04/02 17:01:22 roberto Exp roberto $ | 2 | ** $Id: lutf8lib.c,v 1.7 2014/04/03 13:45:09 roberto Exp roberto $ |
| 3 | ** Standard library for UTF-8 manipulation | 3 | ** Standard library for UTF-8 manipulation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -32,7 +32,7 @@ static lua_Integer u_posrelat (lua_Integer pos, size_t len) { | |||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | /* | 34 | /* |
| 35 | ** Decode an UTF-8 sequence, returning NULL if byte sequence is invalid. | 35 | ** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. |
| 36 | */ | 36 | */ |
| 37 | static const char *utf8_decode (const char *o, int *val) { | 37 | static const char *utf8_decode (const char *o, int *val) { |
| 38 | static unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; | 38 | static unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; |
| @@ -61,8 +61,9 @@ static const char *utf8_decode (const char *o, int *val) { | |||
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | ** utf8len(s [, i [, j]]) --> number of codepoints in 's' between 'i'; | 64 | ** utf8len(s [, i [, j]]) --> number of characters that start in the |
| 65 | ** nil + current position if 's' not well formed | 65 | ** range [i,j], or nil + current position if 's' is not well formed in |
| 66 | ** that interval | ||
| 66 | */ | 67 | */ |
| 67 | static int utflen (lua_State *L) { | 68 | static int utflen (lua_State *L) { |
| 68 | int n = 0; | 69 | int n = 0; |
| @@ -91,7 +92,7 @@ static int utflen (lua_State *L) { | |||
| 91 | 92 | ||
| 92 | /* | 93 | /* |
| 93 | ** codepoint(s, [i, [j]]) -> returns codepoints for all characters | 94 | ** codepoint(s, [i, [j]]) -> returns codepoints for all characters |
| 94 | ** between i and j | 95 | ** that start in the range [i,j] |
| 95 | */ | 96 | */ |
| 96 | static int codepoint (lua_State *L) { | 97 | static int codepoint (lua_State *L) { |
| 97 | size_t len; | 98 | size_t len; |
