[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua and WinCE
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 23 Sep 2002 11:35:18 -0300
> That is, is it possible to add conditional defines which take "evasive
> actions" when something is missing from the stdlib?
Instead of #defines, we try to keep a tight control over the use of
stdlib. The core of Lua uses only malloc (and only through lmem.c), a
single function from stdio (sprintf, to convert doubles to strings), and
"light" functions (that is, functions that are very easy to implement
directly in C, such as memcpy and isalpha).
In the libraries we have a more relaxed standard. Even then, besides the
stdio.h functions, I believe most of the functions we use are easily
implemented, one way or another. And remember that you can include
a LUA_USER_H header file when compiling Lua, and you can use it to
redefine some absent things. For instance, we corrected your complain
about the "#ifdef lua_filerror" by removing it. Instead, it is all too
easy to redefine "strerror" if your sistem does not have it:
In file lua_user.h or directly in the makefile:
#define strerror(x) "unknown error"
Similarly, if your system does not support `fseek', you can add
#define fseek(a,b,c) luaL_error(L, "`seek' not supported")
Or more drastically (and more Lua-independent):
#define fseek(a,b,c) assert(((void)"seek not supported", 0))