Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#9174 - Lua Scripting Language for Rockbox

Attached to Project: Rockbox
Opened by Dan Everton (safetydan) - Wednesday, 09 July 2008, 12:14 GMT+2
Last edited by Maurus Cuelenaere (mcuelenaere) - Thursday, 21 May 2009, 21:02 GMT+2
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

Here is an (very, very) early proof of concept Lua viewer plugin (v.5.1.3).

Currently only a few functions are exported from the plugin API and it also lacks a setjmp/longjmp implementation for actual targets so error handling will go wrong very quickly.

However it does work so far for simple scripts like the following:

function sayhello(seconds)
message = string.format("Hello from LUA for %d seconds", 5)
rb.splash(seconds, message)
end

-- Drawn an X on the screen
rb.clear()
rb.drawline(0, 0, rb.LCD_WIDTH, rb.LCD_HEIGHT)
rb.drawline(rb.LCD_WIDTH, 0, 0, rb.LCD_HEIGHT)
rb.update()

seconds = 5

rb.sleep(5 * rb.HZ)

sayhello(seconds)
   lua-viewer-v0.patch (593 KiB)
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/viewers.config   |    1 
 apps/plugins/lua/ldebug.c     |  622 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ltablib.c    |  279 ++
 apps/plugins/lua/lstrlib.c    |  868 +++++++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lundump.c    |  225 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/rocklua.c    |   93 
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lbaselib.c   |  654 +++++
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lapi.c       | 1085 +++++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/rocklibc.h   |   47 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/strtoul.c    |   53 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/rocklib.c    |  108 
 apps/plugins/lua/rockmalloc.c |   80 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/llex.c       |  461 +++
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/rockconf.h   |   68 
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/rockaux.c    |   84 
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/strtod.c     |   64 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 apps/plugins/SUBDIRS          |    5 
 apps/plugin.h                 |    2 
 firmware/include/ctype.h      |    2 
 68 files changed, 19849 insertions(+), 2 deletions(-)

This task depends upon

Closed by  Maurus Cuelenaere (mcuelenaere)
Thursday, 21 May 2009, 21:02 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  in r21020
Comment by Dan Everton (safetydan) - Wednesday, 09 July 2008, 12:18 GMT+2
I forgot to mention that it's designed to be used as a viewer of .lua files. So you would save the above example Lua file to test.lua on your target and then play it as you would any other file.
Comment by Maurus Cuelenaere (mcuelenaere) - Wednesday, 09 July 2008, 22:09 GMT+2
Nice patch, works fine on the sim! (can't test on a device atm)

I've added some extra functions to the rb lib (see attached diff)
   lua-viewer-v1-patch.diff.patch (591.3 KiB)
 b/apps/plugin.h                 |    2 
 b/apps/plugins/CATEGORIES       |    1 
 b/apps/plugins/SUBDIRS          |    5 
 b/apps/plugins/lua/Makefile     |   84 
 b/apps/plugins/lua/README       |   19 
 b/apps/plugins/lua/SOURCES      |   33 
 b/apps/plugins/lua/lapi.c       | 1085 ++++++++
 b/apps/plugins/lua/lapi.h       |   16 
 b/apps/plugins/lua/lauxlib.c    |  654 +++++
 b/apps/plugins/lua/lauxlib.h    |  174 +
 b/apps/plugins/lua/lbaselib.c   |  654 +++++
 b/apps/plugins/lua/lcode.c      |  839 ++++++
 b/apps/plugins/lua/lcode.h      |   76 
 b/apps/plugins/lua/ldebug.c     |  622 ++++
 b/apps/plugins/lua/ldebug.h     |   33 
 b/apps/plugins/lua/ldo.c        |  518 ++++
 b/apps/plugins/lua/ldo.h        |   57 
 b/apps/plugins/lua/ldump.c      |  164 +
 b/apps/plugins/lua/lfunc.c      |  174 +
 b/apps/plugins/lua/lfunc.h      |   34 
 b/apps/plugins/lua/lgc.c        |  711 +++++
 b/apps/plugins/lua/lgc.h        |  110 
 b/apps/plugins/lua/llex.c       |  461 +++
 b/apps/plugins/lua/llex.h       |   81 
 b/apps/plugins/lua/llimits.h    |  128 +
 b/apps/plugins/lua/lmem.c       |   86 
 b/apps/plugins/lua/lmem.h       |   49 
 b/apps/plugins/lua/lobject.c    |  214 +
 b/apps/plugins/lua/lobject.h    |  381 +++
 b/apps/plugins/lua/lopcodes.c   |  102 
 b/apps/plugins/lua/lopcodes.h   |  268 ++
 b/apps/plugins/lua/lparser.c    | 1339 ++++++++++
 b/apps/plugins/lua/lparser.h    |   82 
 b/apps/plugins/lua/lstate.c     |  214 +
 b/apps/plugins/lua/lstate.h     |  169 +
 b/apps/plugins/lua/lstring.c    |  111 
 b/apps/plugins/lua/lstring.h    |   31 
 b/apps/plugins/lua/lstrlib.c    |  868 ++++++
 b/apps/plugins/lua/ltable.c     |  588 ++++
 b/apps/plugins/lua/ltable.h     |   40 
 b/apps/plugins/lua/ltablib.c    |  279 ++
 b/apps/plugins/lua/ltm.c        |   75 
 b/apps/plugins/lua/ltm.h        |   54 
 b/apps/plugins/lua/lua.h        |  388 +++
 b/apps/plugins/lua/luaconf.h    |  763 ++++++
 b/apps/plugins/lua/lualib.h     |   53 
 b/apps/plugins/lua/lundump.c    |  225 +
 b/apps/plugins/lua/lundump.h    |   36 
 b/apps/plugins/lua/lvm.c        |  763 ++++++
 b/apps/plugins/lua/lvm.h        |   36 
 b/apps/plugins/lua/lzio.c       |   82 
 b/apps/plugins/lua/lzio.h       |   67 
 b/apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++
 b/apps/plugins/lua/rockaux.c    |   84 
 b/apps/plugins/lua/rockconf.h   |   68 
 b/apps/plugins/lua/rocklib.c    |  108 
 b/apps/plugins/lua/rocklib.h    |   29 
 b/apps/plugins/lua/rocklibc.h   |   47 
 b/apps/plugins/lua/rocklua.c    |   93 
 b/apps/plugins/lua/rockmalloc.c |   80 
 b/apps/plugins/lua/strcspn.c    |   16 
 b/apps/plugins/lua/strncat.c    |   21 
 b/apps/plugins/lua/strpbrk.c    |   10 
 b/apps/plugins/lua/strstr.c     |   16 
 b/apps/plugins/lua/strtod.c     |   64 
 b/apps/plugins/lua/strtoul.c    |   53 
 b/apps/plugins/viewers.config   |    1 
 b/firmware/include/ctype.h      |    2 
 68 files changed, 19849 insertions(+), 2 deletions(-)

Comment by Jens Erdmann (pyro_maniac) - Friday, 10 April 2009, 15:17 GMT+2
I reworked the patch a bit and make it work in the current tree.

I will test it later on a device but it looked good in sim.
   lua-viewer-v2.patch (601.5 KiB)
 b/apps/plugin.h                 |    2 
 b/apps/plugins/CATEGORIES       |    1 
 b/apps/plugins/SOURCES          |    4 
 b/apps/plugins/SUBDIRS          |    5 
 b/apps/plugins/lua.c            |   33 
 b/apps/plugins/lua/Makefile     |   84 
 b/apps/plugins/lua/README       |   19 
 b/apps/plugins/lua/SOURCES      |   33 
 b/apps/plugins/lua/lapi.c       | 1085 ++++++++
 b/apps/plugins/lua/lapi.h       |   16 
 b/apps/plugins/lua/lauxlib.c    |  654 +++++
 b/apps/plugins/lua/lauxlib.h    |  174 +
 b/apps/plugins/lua/lbaselib.c   |  654 +++++
 b/apps/plugins/lua/lcode.c      |  839 ++++++
 b/apps/plugins/lua/lcode.h      |   76 
 b/apps/plugins/lua/ldebug.c     |  622 ++++
 b/apps/plugins/lua/ldebug.h     |   33 
 b/apps/plugins/lua/ldo.c        |  518 ++++
 b/apps/plugins/lua/ldo.h        |   57 
 b/apps/plugins/lua/ldump.c      |  164 +
 b/apps/plugins/lua/lfunc.c      |  174 +
 b/apps/plugins/lua/lfunc.h      |   34 
 b/apps/plugins/lua/lgc.c        |  711 +++++
 b/apps/plugins/lua/lgc.h        |  110 
 b/apps/plugins/lua/llex.c       |  461 +++
 b/apps/plugins/lua/llex.h       |   81 
 b/apps/plugins/lua/llimits.h    |  128 +
 b/apps/plugins/lua/lmem.c       |   86 
 b/apps/plugins/lua/lmem.h       |   49 
 b/apps/plugins/lua/lobject.c    |  214 +
 b/apps/plugins/lua/lobject.h    |  381 +++
 b/apps/plugins/lua/lopcodes.c   |  102 
 b/apps/plugins/lua/lopcodes.h   |  268 ++
 b/apps/plugins/lua/lparser.c    | 1339 ++++++++++
 b/apps/plugins/lua/lparser.h    |   82 
 b/apps/plugins/lua/lstate.c     |  214 +
 b/apps/plugins/lua/lstate.h     |  169 +
 b/apps/plugins/lua/lstring.c    |  111 
 b/apps/plugins/lua/lstring.h    |   31 
 b/apps/plugins/lua/lstrlib.c    |  868 ++++++
 b/apps/plugins/lua/ltable.c     |  588 ++++
 b/apps/plugins/lua/ltable.h     |   40 
 b/apps/plugins/lua/ltablib.c    |  279 ++
 b/apps/plugins/lua/ltm.c        |   75 
 b/apps/plugins/lua/ltm.h        |   54 
 b/apps/plugins/lua/lua.h        |  388 +++
 b/apps/plugins/lua/lua.make     |   46 
 b/apps/plugins/lua/luaconf.h    |  763 ++++++
 b/apps/plugins/lua/lualib.h     |   53 
 b/apps/plugins/lua/lundump.c    |  225 +
 b/apps/plugins/lua/lundump.h    |   36 
 b/apps/plugins/lua/lvm.c        |  763 ++++++
 b/apps/plugins/lua/lvm.h        |   36 
 b/apps/plugins/lua/lzio.c       |   82 
 b/apps/plugins/lua/lzio.h       |   67 
 b/apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++
 b/apps/plugins/lua/rockaux.c    |   82 
 b/apps/plugins/lua/rockconf.h   |   66 
 b/apps/plugins/lua/rocklib.c    |  108 
 b/apps/plugins/lua/rocklib.h    |   29 
 b/apps/plugins/lua/rocklibc.h   |   45 
 b/apps/plugins/lua/rocklua.c    |   86 
 b/apps/plugins/lua/rockmalloc.c |   58 
 b/apps/plugins/lua/rockmalloc.h |   46 
 b/apps/plugins/lua/strcspn.c    |   16 
 b/apps/plugins/lua/strncat.c    |   21 
 b/apps/plugins/lua/strpbrk.c    |   10 
 b/apps/plugins/lua/strstr.c     |   16 
 b/apps/plugins/lua/strtod.c     |   64 
 b/apps/plugins/lua/strtoul.c    |   53 
 b/apps/plugins/viewers.config   |    1 
 b/firmware/include/ctype.h      |    2 
 72 files changed, 19943 insertions(+), 2 deletions(-)

Comment by Tony Huynh (insanepotato) - Wednesday, 15 April 2009, 12:05 GMT+2
I'm going to try it out on my c250. Looking forward to future developments =]
Comment by Maurus Cuelenaere (mcuelenaere) - Thursday, 16 April 2009, 16:37 GMT+2
This is v2 with some more functions added, setjmp implementation and tested on target (Onda VX747 - works!).
   lua-viewer-v3.diff (600.2 KiB)
 firmware/include/ctype.h      |    2 
 apps/plugin.h                 |    2 
 apps/plugins/viewers.config   |    1 
 apps/plugins/SUBDIRS          |    5 
 apps/plugins/SOURCES          |    4 
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/lua/ldebug.c     |  622 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ltablib.c    |  279 ++
 apps/plugins/lua/lstrlib.c    |  868 +++++++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lundump.c    |  225 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/rocklua.c    |   86 
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lbaselib.c   |  654 +++++
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lapi.c       | 1085 +++++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/rocklibc.h   |   45 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/strtoul.c    |   53 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/rocklib.c    |  239 +
 apps/plugins/lua/rockmalloc.c |   58 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/rockmalloc.h |   46 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/llex.c       |  461 +++
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/rockconf.h   |   67 
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/lua.make     |   46 
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/rockaux.c    |   81 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/strtod.c     |   64 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 apps/plugins/lua.c            |   33 
 apps/plugins/lib/SOURCES      |   14 
 73 files changed, 20088 insertions(+), 2 deletions(-)

Comment by Jens Erdmann (pyro_maniac) - Thursday, 16 April 2009, 20:32 GMT+2
The current patch also worked good on my e250. :-)
Comment by Maurus Cuelenaere (mcuelenaere) - Friday, 17 April 2009, 00:15 GMT+2
* updated to Lua 5.1.4
* added more functions to rocklib
* added ability to use audiobuffer when out of pluginbuffer RAM
   lua-viewer-v4.diff (603.1 KiB)
 firmware/include/ctype.h      |    2 
 apps/plugin.h                 |    2 
 apps/plugins/viewers.config   |    1 
 apps/plugins/SUBDIRS          |    5 
 apps/plugins/SOURCES          |    4 
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/lua/ldebug.c     |  638 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ltablib.c    |  287 ++
 apps/plugins/lua/lstrlib.c    |  869 +++++++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lundump.c    |  227 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/rocklua.c    |   86 
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lbaselib.c   |  657 +++++
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lapi.c       | 1087 +++++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/rocklibc.h   |   45 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/strtoul.c    |   53 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/rocklib.c    |  345 ++
 apps/plugins/lua/rockmalloc.c |   63 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/rockmalloc.h |   46 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/llex.c       |  461 +++
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/rockconf.h   |   68 
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/lua.make     |   46 
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/rockaux.c    |   68 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/strtod.c     |   64 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 apps/plugins/lua.c            |   33 
 apps/plugins/lib/SOURCES      |   14 
 73 files changed, 20219 insertions(+), 2 deletions(-)

Comment by Jens Erdmann (pyro_maniac) - Monday, 20 April 2009, 18:37 GMT+2
Are there some open tasks?
Comment by Maurus Cuelenaere (mcuelenaere) - Monday, 20 April 2009, 18:39 GMT+2
You mean TODO's before this gets committed?
AFAIK, this is pretty stable; but I would like to get another dev to confirm that..
Comment by Maurus Cuelenaere (mcuelenaere) - Wednesday, 22 April 2009, 17:07 GMT+2
   lua-viewer-v5.diff (602.6 KiB)
 apps/plugin.h                 |    2 
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/SOURCES          |    5 
 apps/plugins/SUBDIRS          |    5 
 apps/plugins/lua.c            |   33 
 apps/plugins/lua/lapi.c       | 1087 +++++++++
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/lbaselib.c   |  657 +++++
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/ldebug.c     |  638 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/llex.c       |  461 +++
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lstrlib.c    |  869 +++++++
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/ltablib.c    |  287 ++
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lua.make     |   46 
 apps/plugins/lua/lundump.c    |  227 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/rockaux.c    |   61 
 apps/plugins/lua/rockconf.h   |   69 
 apps/plugins/lua/rocklib.c    |  345 ++
 apps/plugins/lua/rocklibc.h   |   45 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/rocklua.c    |   88 
 apps/plugins/lua/rockmalloc.c |   63 
 apps/plugins/lua/rockmalloc.h |   46 
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/strtod.c     |   64 
 apps/plugins/lua/strtoul.c    |   53 
 apps/plugins/viewers.config   |    1 
 firmware/include/ctype.h      |    2 
 72 files changed, 20202 insertions(+), 2 deletions(-)

Comment by Maurus Cuelenaere (mcuelenaere) - Thursday, 23 April 2009, 00:14 GMT+2
* Fixes issue with line numbers not showing up when error occured
* Adds UNLIKELY & LIKELY
   lua-viewer-v6.diff (602.4 KiB)
 apps/plugin.h                 |    2 
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/SOURCES          |    5 
 apps/plugins/SUBDIRS          |    5 
 apps/plugins/lua.c            |   33 
 apps/plugins/lua/lapi.c       | 1087 +++++++++
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/lbaselib.c   |  657 +++++
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/ldebug.c     |  638 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/llex.c       |  462 +++
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lstrlib.c    |  869 +++++++
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/ltablib.c    |  287 ++
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lua.make     |   46 
 apps/plugins/lua/lundump.c    |  227 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/rockaux.c    |   61 
 apps/plugins/lua/rockconf.h   |   67 
 apps/plugins/lua/rocklib.c    |  345 ++
 apps/plugins/lua/rocklibc.h   |   45 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/rocklua.c    |   89 
 apps/plugins/lua/rockmalloc.c |   63 
 apps/plugins/lua/rockmalloc.h |   46 
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/strtod.c     |   64 
 apps/plugins/lua/strtoul.c    |   53 
 firmware/include/ctype.h      |    2 
 71 files changed, 20201 insertions(+), 2 deletions(-)

Comment by Robert Kukla (roolku) - Thursday, 23 April 2009, 14:44 GMT+2
Nice stuff.

I tried v6 on the gigabeat and it looks as if numbers are not parsed correctly. I.e. the 5 seconds become 1075052544 - maybe to do with the fact that the only numerical datatype in LUA is float. Also the rectangle doesn't get drawn - I suspect for the same reason.

In the simulator (cygwin) it is worse. To get it to compile I had to make the "int error_no = 0;" unconditional. I didn't get it to draw anything, but the splash was displayed (with a rather big number).
Comment by Jens Erdmann (pyro_maniac) - Saturday, 25 April 2009, 01:23 GMT+2
You just missed the viewer.config.
But i got problems running the test script in the simulator.
The screen gets cleaned and nothing else happends.
   lua-viewer-v7.diff (602.7 KiB)
 apps/plugin.h                 |    2 
 apps/plugins/viewers.config   |    1 
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/SOURCES          |    5 
 apps/plugins/SUBDIRS          |    5 
 apps/plugins/lua.c            |   33 
 apps/plugins/lua/lapi.c       | 1087 +++++++++
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/lbaselib.c   |  657 +++++
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/ldebug.c     |  638 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/llex.c       |  462 +++
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lstrlib.c    |  869 +++++++
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/ltablib.c    |  287 ++
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lua.make     |   46 
 apps/plugins/lua/lundump.c    |  227 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/rockaux.c    |   61 
 apps/plugins/lua/rockconf.h   |   67 
 apps/plugins/lua/rocklib.c    |  345 ++
 apps/plugins/lua/rocklibc.h   |   45 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/rocklua.c    |   89 
 apps/plugins/lua/rockmalloc.c |   63 
 apps/plugins/lua/rockmalloc.h |   46 
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/strtod.c     |   64 
 apps/plugins/lua/strtoul.c    |   53 
 firmware/include/ctype.h      |    2 
 72 files changed, 20202 insertions(+), 2 deletions(-)

Comment by Maurus Cuelenaere (mcuelenaere) - Wednesday, 20 May 2009, 00:52 GMT+2
* fixes sim build
* removes strtod
* adds strtol
* should completely remove floating-point support

If this version doesn't break somewhere/something I'll probably commit it soon.
   lua-viewer-v8.diff (600.4 KiB)
 apps/plugin.h                 |    2 
 apps/plugins/CATEGORIES       |    1 
 apps/plugins/SOURCES          |    5 
 apps/plugins/SUBDIRS          |    5 
 apps/plugins/viewers.config   |    1 
 firmware/include/ctype.h      |    2 
 apps/plugins/lua/ldebug.c     |  638 +++++
 apps/plugins/lua/ldebug.h     |   33 
 apps/plugins/lua/ltablib.c    |  287 ++
 apps/plugins/lua/lstrlib.c    |  869 +++++++
 apps/plugins/lua/lualib.h     |   53 
 apps/plugins/lua/lundump.c    |  227 +
 apps/plugins/lua/lundump.h    |   36 
 apps/plugins/lua/lmem.c       |   86 
 apps/plugins/lua/Makefile     |   84 
 apps/plugins/lua/lvm.c        |  763 ++++++
 apps/plugins/lua/lmem.h       |   49 
 apps/plugins/lua/rocklua.c    |   89 
 apps/plugins/lua/lvm.h        |   36 
 apps/plugins/lua/ltable.c     |  588 ++++
 apps/plugins/lua/lfunc.c      |  174 +
 apps/plugins/lua/lparser.c    | 1339 +++++++++++
 apps/plugins/lua/ltable.h     |   40 
 apps/plugins/lua/lfunc.h      |   34 
 apps/plugins/lua/lzio.c       |   82 
 apps/plugins/lua/lbaselib.c   |  657 +++++
 apps/plugins/lua/lparser.h    |   82 
 apps/plugins/lua/lzio.h       |   67 
 apps/plugins/lua/lobject.c    |  214 +
 apps/plugins/lua/lstring.c    |  111 
 apps/plugins/lua/lapi.c       | 1087 +++++++++
 apps/plugins/lua/lua.h        |  388 +++
 apps/plugins/lua/lobject.h    |  381 +++
 apps/plugins/lua/lstring.h    |   31 
 apps/plugins/lua/lapi.h       |   16 
 apps/plugins/lua/strcspn.c    |   16 
 apps/plugins/lua/rocklibc.h   |   45 
 apps/plugins/lua/lauxlib.c    |  654 +++++
 apps/plugins/lua/lauxlib.h    |  174 +
 apps/plugins/lua/malloc.c     | 5061 ++++++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/strtoul.c    |   53 
 apps/plugins/lua/ldo.c        |  518 ++++
 apps/plugins/lua/ldump.c      |  164 +
 apps/plugins/lua/ldo.h        |   57 
 apps/plugins/lua/rocklib.c    |  345 ++
 apps/plugins/lua/rockmalloc.c |   63 
 apps/plugins/lua/strpbrk.c    |   10 
 apps/plugins/lua/rocklib.h    |   29 
 apps/plugins/lua/rockmalloc.h |   46 
 apps/plugins/lua/lstate.c     |  214 +
 apps/plugins/lua/ltm.c        |   75 
 apps/plugins/lua/lstate.h     |  169 +
 apps/plugins/lua/ltm.h        |   54 
 apps/plugins/lua/strstr.c     |   16 
 apps/plugins/lua/SOURCES      |   33 
 apps/plugins/lua/llex.c       |  462 +++
 apps/plugins/lua/lgc.c        |  711 +++++
 apps/plugins/lua/lopcodes.c   |  102 
 apps/plugins/lua/rockconf.h   |   67 
 apps/plugins/lua/llex.h       |   81 
 apps/plugins/lua/lgc.h        |  110 
 apps/plugins/lua/lua.make     |   46 
 apps/plugins/lua/README       |   19 
 apps/plugins/lua/rockaux.c    |   61 
 apps/plugins/lua/lopcodes.h   |  268 ++
 apps/plugins/lua/strncat.c    |   21 
 apps/plugins/lua/llimits.h    |  128 +
 apps/plugins/lua/lcode.c      |  839 ++++++
 apps/plugins/lua/strtol.c     |   27 
 apps/plugins/lua/lcode.h      |   76 
 apps/plugins/lua/luaconf.h    |  763 ++++++
 71 files changed, 20132 insertions(+), 2 deletions(-)

Comment by Thomas Martitz (kugel.) - Thursday, 21 May 2009, 17:28 GMT+2
Why remove floating point support?
Comment by Maurus Cuelenaere (mcuelenaere) - Thursday, 21 May 2009, 20:11 GMT+2
* adds support for auto-generating ACTION_*
* adds some more wrappers
* adds the current path & /.rockbox/rocks/viewers/ to the search path when including files
   lua-viewer-v9.diff (608.9 KiB)
 apps/plugins/lua/ldebug.c         |  638 ++++
 apps/plugins/lua/ldebug.h         |   33 
 apps/plugins/lua/ltablib.c        |  287 ++
 apps/plugins/lua/lstrlib.c        |  869 ++++++
 apps/plugins/lua/lualib.h         |   53 
 apps/plugins/lua/lundump.c        |  227 +
 apps/plugins/lua/lundump.h        |   36 
 apps/plugins/lua/lmem.c           |   86 
 apps/plugins/lua/Makefile         |   86 
 apps/plugins/lua/lvm.c            |  763 +++++
 apps/plugins/lua/lmem.h           |   49 
 apps/plugins/lua/rocklua.c        |  105 
 apps/plugins/lua/lvm.h            |   36 
 apps/plugins/lua/ltable.c         |  588 ++++
 apps/plugins/lua/action_helper.pl |   40 
 apps/plugins/lua/lfunc.c          |  174 +
 apps/plugins/lua/lparser.c        | 1339 ++++++++++
 apps/plugins/lua/ltable.h         |   40 
 apps/plugins/lua/lfunc.h          |   34 
 apps/plugins/lua/lzio.c           |   82 
 apps/plugins/lua/lbaselib.c       |  657 ++++
 apps/plugins/lua/lparser.h        |   82 
 apps/plugins/lua/lzio.h           |   67 
 apps/plugins/lua/lobject.c        |  214 +
 apps/plugins/lua/lstring.c        |  111 
 apps/plugins/lua/lapi.c           | 1087 ++++++++
 apps/plugins/lua/lua.h            |  388 ++
 apps/plugins/lua/lobject.h        |  381 ++
 apps/plugins/lua/lstring.h        |   31 
 apps/plugins/lua/lapi.h           |   16 
 apps/plugins/lua/strcspn.c        |   16 
 apps/plugins/lua/rocklibc.h       |   45 
 apps/plugins/lua/lauxlib.c        |  669 +++++
 apps/plugins/lua/lauxlib.h        |  174 +
 apps/plugins/lua/malloc.c         | 5061 ++++++++++++++++++++++++++++++++++++++
 apps/plugins/lua/strtoul.c        |   53 
 apps/plugins/lua/ldo.c            |  518 +++
 apps/plugins/lua/ldump.c          |  164 +
 apps/plugins/lua/ldo.h            |   57 
 apps/plugins/lua/rocklib.c        |  364 ++
 apps/plugins/lua/rockmalloc.c     |   63 
 apps/plugins/lua/strpbrk.c        |   10 
 apps/plugins/lua/rocklib.h        |   29 
 apps/plugins/lua/rockmalloc.h     |   46 
 apps/plugins/lua/lstate.c         |  214 +
 apps/plugins/lua/ltm.c            |   75 
 apps/plugins/lua/lstate.h         |  169 +
 apps/plugins/lua/ltm.h            |   54 
 apps/plugins/lua/strstr.c         |   16 
 apps/plugins/lua/SOURCES          |   33 
 apps/plugins/lua/llex.c           |  462 +++
 apps/plugins/lua/lgc.c            |  711 +++++
 apps/plugins/lua/lopcodes.c       |  102 
 apps/plugins/lua/rockconf.h       |   67 
 apps/plugins/lua/llex.h           |   81 
 apps/plugins/lua/lgc.h            |  110 
 apps/plugins/lua/lua.make         |   46 
 apps/plugins/lua/README           |   19 
 apps/plugins/lua/rockaux.c        |   61 
 apps/plugins/lua/lopcodes.h       |  268 ++
 apps/plugins/lua/strncat.c        |   21 
 apps/plugins/lua/llimits.h        |  128 
 apps/plugins/lua/lcode.c          |  839 ++++++
 apps/plugins/lua/strtol.c         |   27 
 apps/plugins/lua/lcode.h          |   76 
 apps/plugins/lua/luaconf.h        |  763 +++++
 apps/plugins/lua.c                |   33 
 apps/plugin.h                     |    2 
 apps/plugins/CATEGORIES           |    1 
 apps/plugins/SOURCES              |    5 
 apps/plugins/SUBDIRS              |    5 
 apps/plugins/viewers.config       |    1 
 firmware/include/ctype.h          |    2 
 73 files changed, 20257 insertions(+), 2 deletions(-)

Loading...