lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 1aead7f5536c92cfbd1dd7dbb51f5ac95f239e14
parent 75d8470f0f3719594637ddaba4bb9dbbb30e94ec
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 10 Dec 2010 12:52:51 -0200

'hexafloat' moved to 'lobject.c' (hexa conversion needs it too)

Diffstat:
Mllex.c | 11++---------
Mlobject.h | 3++-
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/llex.c b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.41 2010/11/18 18:38:44 roberto Exp roberto $ +** $Id: llex.c,v 2.42 2010/12/06 21:08:36 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -286,13 +286,6 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { } -static int hexavalue (int c) { - if (lisdigit(c)) return c - '0'; - else if (lisupper(c)) return c - 'A' + 10; - else return c - 'a' + 10; -} - - static int readhexaesc (LexState *ls) { int c1, c2 = EOZ; if (!lisxdigit(c1 = next(ls)) || !lisxdigit(c2 = next(ls))) { @@ -302,7 +295,7 @@ static int readhexaesc (LexState *ls) { if (c2 != EOZ) save(ls, c2); lexerror(ls, "hexadecimal digit expected", TK_STRING); } - return (hexavalue(c1) << 4) + hexavalue(c2); + return (luaO_hexavalue(c1) << 4) + luaO_hexavalue(c2); } diff --git a/lobject.h b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.43 2010/11/26 14:32:31 roberto Exp roberto $ +** $Id: lobject.h,v 2.44 2010/12/06 21:08:36 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -413,6 +413,7 @@ LUAI_FUNC int luaO_ceillog2 (lu_int32 x); LUAI_FUNC lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2); LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); LUAI_FUNC int luaO_str2d (const char *s, size_t len, lua_Number *result); +LUAI_FUNC int luaO_hexavalue (int c); LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp); LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);