aboutsummaryrefslogtreecommitdiff
path: root/lutf8lib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-11 15:19:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-04-11 15:19:07 -0300
commite1daf10e4cb4276725db1bda8cdf0e3c893f1094 (patch)
tree5e830e0c0f203f4a11b88057676708c17c8614f8 /lutf8lib.c
parent115fa770091881d27bf265c61078dd80f17fd1a0 (diff)
downloadlua-e1daf10e4cb4276725db1bda8cdf0e3c893f1094.tar.gz
lua-e1daf10e4cb4276725db1bda8cdf0e3c893f1094.tar.bz2
lua-e1daf10e4cb4276725db1bda8cdf0e3c893f1094.zip
details in comments
Diffstat (limited to 'lutf8lib.c')
-rw-r--r--lutf8lib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lutf8lib.c b/lutf8lib.c
index f7eb676f..f2a60dbc 100644
--- a/lutf8lib.c
+++ b/lutf8lib.c
@@ -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*/
37static const char *utf8_decode (const char *o, int *val) { 37static 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*/
67static int utflen (lua_State *L) { 68static 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*/
96static int codepoint (lua_State *L) { 97static int codepoint (lua_State *L) {
97 size_t len; 98 size_t len;