summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklib.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-06-28 14:55:16 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-06-28 14:55:16 +0000
commit681ca21a1e6731d7ce46be2a2419e600e957fae9 (patch)
tree77f111b10cb3ab26e1b97f9047972bc9004f69ae /apps/plugins/lua/rocklib.c
parent8e4098bd663c18ea800f47f88e657206d23a76ae (diff)
Lua:
* add IO lib (adapted to Rockbox) * remove old IO wrappers * rework helloworld.lua to work with the IO lib * do some stuff in helloworld.lua better (part of FS#10379, by James Callahan) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21541 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r--apps/plugins/lua/rocklib.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index f22bd01b48..6da57d154e 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -685,62 +685,6 @@ RB_WRAP(backlight_set_brightness)
}
#endif
-RB_WRAP(open)
-{
- const char* pathname = luaL_checkstring(L, 1);
- int flags = luaL_checkint(L, 2);
- int result = rb->open(pathname, flags);
- lua_pushinteger(L, result);
- return 1;
-}
-
-RB_WRAP(close)
-{
- int fd = luaL_checkint(L, 1);
- int result = rb->close(fd);
- lua_pushinteger(L, result);
- return 1;
-}
-
-RB_WRAP(read)
-{
- size_t len, n, result = 0;
- luaL_Buffer b;
-
- int fd = luaL_checkint(L, 1);
- size_t count = luaL_checkint(L, 2);
-
- luaL_buffinit(L, &b);
- len = LUAL_BUFFERSIZE;
- do
- {
- char *p = luaL_prepbuffer(&b);
-
- if (len > count)
- len = count;
-
- n = rb->read(fd, p, len);
-
- luaL_addsize(&b, n);
- count -= n;
- result += n;
- } while (count > 0 && n == len);
- luaL_pushresult(&b); /* close buffer */
-
- lua_pushinteger(L, result);
- return 2;
-}
-
-RB_WRAP(lseek)
-{
- int fd = luaL_checkint(L, 1);
- off_t offset = luaL_checkint(L, 2);
- int whence = luaL_checkint(L, 3);
- off_t result = rb->lseek(fd, offset, whence);
- lua_pushinteger(L, result);
- return 1;
-}
-
RB_WRAP(creat)
{
const char* pathname = luaL_checkstring(L, 1);
@@ -749,16 +693,6 @@ RB_WRAP(creat)
return 1;
}
-RB_WRAP(write)
-{
- size_t count;
- int fd = luaL_checkint(L, 1);
- void* buf = (void*)luaL_checklstring(L, 2, &count);
- ssize_t result = rb->write(fd, buf, count);
- lua_pushinteger(L, result);
- return 1;
-}
-
RB_WRAP(remove)
{
const char* pathname = luaL_checkstring(L, 1);
@@ -776,23 +710,6 @@ RB_WRAP(rename)
return 1;
}
-RB_WRAP(ftruncate)
-{
- int fd = luaL_checkint(L, 1);
- off_t length = luaL_checkint(L, 2);
- int result = rb->ftruncate(fd, length);
- lua_pushinteger(L, result);
- return 1;
-}
-
-RB_WRAP(filesize)
-{
- int fd = luaL_checkint(L, 1);
- off_t result = rb->filesize(fd);
- lua_pushinteger(L, result);
- return 1;
-}
-
RB_WRAP(file_exists)
{
const char* path = luaL_checkstring(L, 1);
@@ -940,16 +857,9 @@ static const luaL_Reg rocklib[] =
#endif
/* File handling */
- R(open),
- R(close),
- R(read),
- R(lseek),
R(creat),
- R(write),
R(remove),
R(rename),
- R(ftruncate),
- R(filesize),
R(file_exists),
/* Kernel */
@@ -1008,16 +918,6 @@ LUALIB_API int luaopen_rock(lua_State *L)
RB_CONSTANT(LCD_WIDTH);
RB_CONSTANT(LCD_HEIGHT);
- RB_CONSTANT(O_RDONLY);
- RB_CONSTANT(O_WRONLY);
- RB_CONSTANT(O_RDWR);
- RB_CONSTANT(O_CREAT);
- RB_CONSTANT(O_APPEND);
- RB_CONSTANT(O_TRUNC);
- RB_CONSTANT(SEEK_SET);
- RB_CONSTANT(SEEK_CUR);
- RB_CONSTANT(SEEK_END);
-
RB_CONSTANT(FONT_SYSFIXED);
RB_CONSTANT(FONT_UI);