Commit graph

79 commits

Author SHA1 Message Date
Thomas Martitz
6eaab4d004 Ged rid of uisimulator/common/io.c for android builds.
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants.
Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know).
For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one,
the values can be retrieved via the new dir_get_info().

Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
2010-09-01 21:29:34 +00:00
Thomas Martitz
cae4ae2c71 Second try: Introduce plugin_crt0.c that every plugin links.
It handles exit() properly, calling the handler also when the plugin returns
normally (also make exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex() introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases rb->default_event_handler_ex() was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27873 a1c6a512-1295-4272-9138-f99709370657
2010-08-24 14:30:46 +00:00
Thomas Martitz
46454ac2a8 Move setjmp to lib and add setjmp for sh (imported from newlib) and compile it as separate library.
It's used by both, plugins and codecs, and sh/hwcodec doesn't compile codecs
so it doesn't fit into sources.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27869 a1c6a512-1295-4272-9138-f99709370657
2010-08-24 12:38:42 +00:00
Thomas Martitz
93cb949372 Revert "Introduce plugin_crt0.c that every plugin links."
Too much errors and no time to fix them now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27863 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 17:12:26 +00:00
Thomas Martitz
abdc5935be Introduce plugin_crt0.c that every plugin links.
It handles exit() properly, calling the handler also when the plugin returns
normally (also it makes exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases it was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27862 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 16:56:49 +00:00
Rafaël Carré
9122e525cc lua: make DEBUG undefined by default, as doc states
use #ifdef / #ifndef and not #if / #if !

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27387 a1c6a512-1295-4272-9138-f99709370657
2010-07-11 16:46:45 +00:00
Thomas Martitz
57613ea5fa Rename/change SIMVER to APP_TYPE in the Makefiles.
SIMVER was really only used to detect a simulator build. With APP_TYPE you can
now differentiate between simulator, application, checkwps and database builds.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27372 a1c6a512-1295-4272-9138-f99709370657
2010-07-10 13:49:49 +00:00
Thomas Martitz
35e8b1429a Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently).
The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR).
The new define is to (de-)select code to compile on hosted platforms generally.

Should be no functional change to targets or the simulator.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-06-21 16:53:00 +00:00
Rafaël Carré
bfd8d023db FS#11347 by me: *dir LUA functions: luadir module
mkdir and rmdir are now in this module and not in the rockbox API
implements the 'dir' iterator to browse directories

Based on LuaFileSystem : http://www.keplerproject.org/luafilesystem

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26913 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 13:10:14 +00:00
Maurus Cuelenaere
d8cef9c078 Lua: document rocklib_aux.pl a bit, so it's easier to find out about it when stumbling over a CC error in rocklib_aux.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26912 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 12:28:34 +00:00
Maurus Cuelenaere
952d9bc038 Lua: make actions.lua, buttons.lua and rocklib_aux.c depend on it generators
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26911 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 12:28:30 +00:00
Frank Gevaerts
530c25130f Make the sim buildable with mingw again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26037 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 22:57:52 +00:00
Thomas Martitz
68947473e1 Move math.h to firmware/libc/include/ and fix slight incompatibilities between our and the host's math.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26020 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 12:43:45 +00:00
Michael Sevakis
057c11147e Fix LUA red and yellow.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26007 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 07:17:03 +00:00
Thomas Martitz
50a6ca39ad Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 21:04:40 +00:00
Thomas Martitz
0a1d7c28b7 Make open() posix compliant api-wise. A few calls (those with O_CREAT) need the additional optional mode parameter so add it. Impact for the core is almost zero, as open() is a wrapper macro for the real open function which doesn't take the variable parameter.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25844 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 17:35:13 +00:00
Thomas Martitz
9a3c0778c6 Fix two warnings that appear with gcc4.4.3. The one in recording.c ("compact_view is used uninitialized" seems to be false positive unfortunately).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25082 a1c6a512-1295-4272-9138-f99709370657
2010-03-08 23:56:54 +00:00
Maurus Cuelenaere
1251fa5766 Lua fscanf: use pointer of file descriptor instead of file descriptor itself to avoid 64-bit pointer<->int clash (aka fix yellow).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24633 a1c6a512-1295-4272-9138-f99709370657
2010-02-13 14:51:38 +00:00
Maurus Cuelenaere
9bf28debd8 Fix FS#11007: Lua didn't parse negative numbers correct when reading from files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24632 a1c6a512-1295-4272-9138-f99709370657
2010-02-13 14:41:00 +00:00
Maurus Cuelenaere
5ca112b21e Lua: return nil when function failed instead of returning nothing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23405 a1c6a512-1295-4272-9138-f99709370657
2009-10-29 17:13:36 +00:00
Maurus Cuelenaere
b1a7511990 Also expose functions having (s)size_t or off_t as argument/return type to Lua.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23403 a1c6a512-1295-4272-9138-f99709370657
2009-10-29 16:52:09 +00:00
Kevin Ferrare
19c3e77fa0 Boomshine plugin : port to Greyscale and B/W targets, and targets without touchscreen (currently using the virtual keyboard keymap)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23397 a1c6a512-1295-4272-9138-f99709370657
2009-10-29 07:48:26 +00:00
Maurus Cuelenaere
8dbef6d8d0 Lua: add lib/helper.c wrappers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23360 a1c6a512-1295-4272-9138-f99709370657
2009-10-26 17:07:56 +00:00
Maurus Cuelenaere
6314952ff1 Lua: add parts of the math library (all floating point functions are #ifdef'ed out)
Flyspray: FS#10389
Author: myself

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23321 a1c6a512-1295-4272-9138-f99709370657
2009-10-23 10:49:55 +00:00
Maurus Cuelenaere
9dd25adae4 Lua: add do_menu() wrapper. Also fix potential NULL pointer dereference
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23320 a1c6a512-1295-4272-9138-f99709370657
2009-10-23 10:38:20 +00:00
Thomas Martitz
8855b0c613 Use PLUGINFLAGS in lua.make, instead of only CFLAGS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23121 a1c6a512-1295-4272-9138-f99709370657
2009-10-11 21:30:37 +00:00
Frank Gevaerts
e99dd1898e Make sure to use $(CFLAGS) to get all defines when preprocessing actions.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23119 a1c6a512-1295-4272-9138-f99709370657
2009-10-11 20:55:47 +00:00
Maurus Cuelenaere
8898339fcf Lua plugin: fix bad behaviour for io.open(path, 'w')
Author: Christophe Gragnic
Patch: FS#10592

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22645 a1c6a512-1295-4272-9138-f99709370657
2009-09-06 21:41:48 +00:00
Maurus Cuelenaere
527b069653 Lua: implement the ^ and % operators
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22070 a1c6a512-1295-4272-9138-f99709370657
2009-07-27 16:06:51 +00:00
Maurus Cuelenaere
1fde0dd8e4 Lua: return nil when kbd_input() gets aborted and make it possible to preset the input string (based on FS#10455 by Christophe Gragnic)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22008 a1c6a512-1295-4272-9138-f99709370657
2009-07-23 00:54:35 +00:00
Maurus Cuelenaere
1dc0c46d93 Lua IOlib: when opening files for writing/appending, check if they exist and if not, add O_CREAT.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21918 a1c6a512-1295-4272-9138-f99709370657
2009-07-17 11:09:51 +00:00
Maurus Cuelenaere
be54b7f6a2 Revert r21863 partly: fixes Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21883 a1c6a512-1295-4272-9138-f99709370657
2009-07-15 15:16:55 +00:00
Nils Wallménius
3d4701a6e4 FS#10080
* Move strncpy() from core to the pluginlib
* Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins
* Drop strncpy() from the codec api as no codec used it
* Bump codec and plugin api versions


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
2009-07-14 13:57:45 +00:00
Maurus Cuelenaere
80b4e5d55d Lua:
* add ./?/init.lua to the search path for require
 * put Lua libs in /.rockbox/rocks/viewers/lua/


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21739 a1c6a512-1295-4272-9138-f99709370657
2009-07-10 11:30:26 +00:00
Maurus Cuelenaere
cfffedfa8b Lua IOlib: don't create files when they don't exist
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21715 a1c6a512-1295-4272-9138-f99709370657
2009-07-08 14:54:40 +00:00
Maurus Cuelenaere
59c4b6816b Lua: expose SCREEN_MAIN & SCREEN_REMOTE (for rb.lcd_*() functions)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21712 a1c6a512-1295-4272-9138-f99709370657
2009-07-08 11:59:05 +00:00
Maurus Cuelenaere
3653aea4f8 Lua: use rb->screens[] to do painting
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21676 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 19:34:57 +00:00
Maurus Cuelenaere
427bf0b893 Also make rocklib_aux.c depend on $(LUA_OBJ)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21663 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 17:59:45 +00:00
Maurus Cuelenaere
beb9066d9f Lua: implement gui_syncyesno_run
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21662 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 16:41:16 +00:00
Maurus Cuelenaere
ce5e6cefb8 Fix sim_* errors when compiling Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21660 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:52:08 +00:00
Maurus Cuelenaere
9db43dac62 Fix actions.lua & buttons.lua make errors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21659 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:45:26 +00:00
Maurus Cuelenaere
a9fdd6001f Add a Rockbox header..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21658 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:39:17 +00:00
Maurus Cuelenaere
d755a5ac58 Lua: add script which wraps not-yet ported C functions to Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21657 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:33:08 +00:00
Maurus Cuelenaere
69c73e8bd6 Lua: always expose BUTTON_TOUCHSCREEN and remove BUTTON_ constants from rocklib.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21630 a1c6a512-1295-4272-9138-f99709370657
2009-07-03 23:03:07 +00:00
Maurus Cuelenaere
9bff845b49 Lua: because Rockbox doesn't support any current working directory functionality, 'hack' loadlib so it replace '$' in LUA_PATH_DEFAULT with the directory wherein the current script is.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21595 a1c6a512-1295-4272-9138-f99709370657
2009-07-01 17:01:22 +00:00
Maurus Cuelenaere
bc4d223b6c Correct comment
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21574 a1c6a512-1295-4272-9138-f99709370657
2009-06-30 09:35:36 +00:00
Maurus Cuelenaere
f3efc26445 Lua: also expose BUTTON_REL, BUTTON_REPEAT & BUTTON_TOUCHSCREEN
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21573 a1c6a512-1295-4272-9138-f99709370657
2009-06-30 09:34:41 +00:00
Maurus Cuelenaere
2b92fe2332 Lua: remove BUTTON_TOUCHSCREEN as this constant is available in buttons.lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21544 a1c6a512-1295-4272-9138-f99709370657
2009-06-28 15:51:32 +00:00
Maurus Cuelenaere
e7db6f962a Fix typo & red
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21543 a1c6a512-1295-4272-9138-f99709370657
2009-06-28 15:04:49 +00:00
Maurus Cuelenaere
681ca21a1e 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
2009-06-28 14:55:16 +00:00