diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-11 15:19:07 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-11 15:19:07 -0300 |
commit | e1daf10e4cb4276725db1bda8cdf0e3c893f1094 (patch) | |
tree | 5e830e0c0f203f4a11b88057676708c17c8614f8 /lutf8lib.c | |
parent | 115fa770091881d27bf265c61078dd80f17fd1a0 (diff) | |
download | lua-e1daf10e4cb4276725db1bda8cdf0e3c893f1094.tar.gz lua-e1daf10e4cb4276725db1bda8cdf0e3c893f1094.tar.bz2 lua-e1daf10e4cb4276725db1bda8cdf0e3c893f1094.zip |
details in comments
Diffstat (limited to 'lutf8lib.c')
-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; |