[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua without stdio?
- From: Chunlin Zhang <zhangchunlin@...>
- Date: Thu, 14 Aug 2008 14:27:50 +0800
Enrico Colombini wrote:
David Given wrote:
Does anyone have a patch to remove stdio support from Lua 5.1?
It's something I can certainly do myself, but a quick look shows that
it's surprisingly complicated, so I thought I'd ask first before getting
Having to integrate Lua into an embedded system with an incomplete and
broken stdio, I couldn't just redefine stdio functions (they would have
conflicted with existing ones).
Sorry, no patch. But, in case it may be useful, this is what I did
according to my notes (approx. line numbers refer to Lua 5.1.2).
I also didn't use iolib, loadlib, oslib, where most of the references to
stdio are; furthermore, I removed file loading and reimplemented it
externally using luaL_loadbuffer. So I guess this will not be of great
help to you, but just in case...
- changed strcoll to strcmp (~207) [not really stdio-related]
- changed fputs to <proprietary_function> in luaB_print (~30)
- removed luaB_loadfile (~285 and table ~455)
- removed luaB_dofile (~327 and table ~454)
- removed LoadF, getF, errfile, luaL_loadfile (~522)
- changed fprintf to <proprietary_function> in panic (~646)
To Roberto and Luiz: it would be great (for us embedded users) to
someday have stdio (and strcoll) fully decoupled from Lua sources, e.g.
by using macros in luaconf.h for all the relevant functions, or by
adding a stdio_funcs.c file.
At least for baselib and auxlib (see above), so we wouldn't have to
re-patch at every new release.
That's just a suggestion, anyway: I'd like to stress that I'm _very_
happy with Lua... and with the support I received here :-)
I have same problem in a embedded environment.
I have not much time to work on it these days.But I have make same
decision like your way,make a simplified version lua with self written
IOlib.It is glad to see your detail suggestion,it is valuable for me!