lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi!

I’ve found some bugs and minors in Lua source while developing. Maybe it would be useful for others as well.

 

lauxlib.c

=========

574: freopen doesn't work on WinCE devices, use fclose and fopen instead

 

llex.c

======

199: isalnum returns true for EOZ(-1) on WinCE device, so I have to check it in the condition like this: ls->current != EOZ &&

 

mathlib.c (in order to compile with integer Lua number type)

=========

27: use fabs instead of abs

30-180 : use define LUA_NUMBER_DOUBLE to remove functions that are not defined for integer type Lua number (sin, sinh, cos, cosh, tan, tanh, asin, acos, atan, atan2, ceil, floor, modf, sqrt, log, log10, exp, deg, rad, frexp, ldexp )

92: use luai_nummod instead of fmod (thatswhy it's defined I think)

110: use luai_numpow instead of pow (thatswhy it's defined I think)

184: replace lua_Number to double like this: double r = (double)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;

215-245: use define LUA_NUMBER_DOUBLE to remove functions that are not defined for integer type Lua number

 

lobject.h

=========

103: l_isfalse may contain this: || (ttisnumber(o) && nvalue(o) == 0) in order to work like other languages

 

lucaonf.h

=========

164: surround LUA_API define with ifdef in order to be able to use differently in different projects/solutions

521: surround LUA_NUMBER_SCAN and LUA_NUMBER_FMT with #ifdef LUA_NUMBER_DOUBLE in order to be able to use integer as Lua number and define these as "%d" in else case

537: surround luai_nummod with #ifdef LUA_NUMBER_DOUBLE and define as ( (a) % (b) ) in else case

538: convert a and b to double before calling pow (in order to compile with integer type Lua number)

595: change double u member to LUA_NUMBER in the union (I think)

 

Please tell me if I’m wrong.

Kind regards,

Gergely BOROMISSZA
Developer

T: +36 (1) 872-0000
F: +36 (1) 872-0100
E: Gergely.BOROMISSZA@navngo.com