From e1daf10e4cb4276725db1bda8cdf0e3c893f1094 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 11 Apr 2014 15:19:07 -0300 Subject: [PATCH] details in comments --- lutf8lib.c | 11 ++++++----- 1 file 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 @@ /* -** $Id: lutf8lib.c,v 1.6 2014/04/02 17:01:22 roberto Exp roberto $ +** $Id: lutf8lib.c,v 1.7 2014/04/03 13:45:09 roberto Exp roberto $ ** Standard library for UTF-8 manipulation ** See Copyright Notice in lua.h */ @@ -32,7 +32,7 @@ static lua_Integer u_posrelat (lua_Integer pos, size_t len) { /* -** Decode an UTF-8 sequence, returning NULL if byte sequence is invalid. +** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. */ static const char *utf8_decode (const char *o, int *val) { static unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; @@ -61,8 +61,9 @@ static const char *utf8_decode (const char *o, int *val) { /* -** utf8len(s [, i [, j]]) --> number of codepoints in 's' between 'i'; -** nil + current position if 's' not well formed +** utf8len(s [, i [, j]]) --> number of characters that start in the +** range [i,j], or nil + current position if 's' is not well formed in +** that interval */ static int utflen (lua_State *L) { int n = 0; @@ -91,7 +92,7 @@ static int utflen (lua_State *L) { /* ** codepoint(s, [i, [j]]) -> returns codepoints for all characters -** between i and j +** that start in the range [i,j] */ static int codepoint (lua_State *L) { size_t len;