[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: [ANNOUNCE] Lua 5.0 (pre-release) now available
- From: Benoit Germain <bgermain@...>
- Date: Wed, 16 Apr 2003 15:47:53 +0200
Ok, I've progressed a bit. Oh, I am working with the final release of
course.
So, I just changed INT_MAX to 32767 in the file (BTW, the next prc-tools
release will fix this bug).
I also changed the core's code a bit to accommodate for various
setjmp/longjmp implementations, because the palm OS doesn't have these exact
functions. It defines instead ErrJumpBuf, ErrJongJump and ErrSetJump. So I
have created a file etc/luser_exception.h in which one can redefine the
setjmp/longjmp mechanism, this file being included in ldo.c where the macro
definitions default to the standard setjmp/longjmp mechanism. Tell me if you
are interested.
Now I am back to a single remaining sizeof(int) problem, which comes from
lua code:
lobject.c: In function `luaO_log2':
lobject.c:63: warning: right shift count >= width of type
lobject.c:64: warning: right shift count >= width of type
I just changed the code by adding 2 lines as follows:
int luaO_log2 (unsigned int x) {
static const lu_byte log_8[255] = {
0,
1,1,
2,2,2,2,
3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
};
#if INT_MAX > 32767 /* ################# */
if (x >= 0x00010000) {
if (x >= 0x01000000) return log_8[((x>>24) & 0xff) - 1]+24;
else return log_8[((x>>16) & 0xff) - 1]+16;
}
else
#endif /* ################## */
{
if (x >= 0x00000100) return log_8[((x>>8) & 0xff) - 1]+8;
else if (x) return log_8[(x & 0xff) - 1];
return -1; /* special `log' for 0 */
}
}
Then, in ltable.c:
ltable.c: In function `luaH_mainposition':
ltable.c:108: warning: cast from pointer to integer of different size
ltable.c:110: warning: cast from pointer to integer of different size
This is because sizeof(int)==2, whereas sizeof(void*)==4
I suppose that this is not important because even if data is lost when
hashing pointers to ints, the tables will still work fine, but maybe there
is a possibility to silence that warning ?
After that, the lua core compiles fine except for strtod, strcspn, strcoll
and which don't exist in the palm os headers. I'll solve that later at link
time with a host program.
Onward to the standard libraries then:
lauxlib and lbaselig being quite necessary, I had to adapt them to the
FILE-less system, loadfile-related stuff does not compile -> I added a
LUA_HAS_FILE directive that neutralizes dofile() and loadfile().
Also, no console, so no stderr, no fprintf -> I changed the default behavior
of callalert() to be defined by a user macro LUA_DEFAULT_ALERT(string)
defaulting to the current implementation.
For the rest, obviously I can't use liolib.c, so I only have to avoid
compiling it. The other files are ok.
Thanks to everybody for your rapt attention :-)
Benoit.
-----Message d'origine-----
De : Benoit Germain [mailto:bgermain@ubisoft.fr]
Envoyé : lundi 14 avril 2003 16:04
À : Multiple recipients of list
Objet : RE: [ANNOUNCE] Lua 5.0 (pre-release) now available
the INT_MAX I get is 2147483647, defined in
/lib/gcc-lib/m68k-palmos/2.95.3-kgpd/include/limits.h, so there might be a
problem with those files. But it is surprising, because I am not the first
to use this development suite.
-----Message d'origine-----
De : Roberto Ierusalimschy [mailto:roberto@inf.puc-rio.br]
Envoyé : lundi 14 avril 2003 14:56
À : Multiple recipients of list
Objet : Re: [ANNOUNCE] Lua 5.0 (pre-release) now available
> so obviously there is a problem, but I can't investigate right now.
Can you send me the value of the constant INT_MAX in your program?
(defined in limits.h)
Thanks,
-- Roberto