<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rockbox/apps/plugins/lua/SOURCES, branch quake5</title>
<subtitle>My Rockbox tree</subtitle>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/'/>
<entry>
<title>Lua Add Emergency Garbage Collector</title>
<updated>2019-07-28T13:17:48+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2019-07-12T10:23:52+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=45bd14b392622cb58e967a24e4652c510b3d43e4'/>
<id>45bd14b392622cb58e967a24e4652c510b3d43e4</id>
<content type='text'>
Derivative of work by RobertGabrielJakabosky
 http://lua-users.org/wiki/EmergencyGarbageCollector

I've only implemented the not enough memory part and
 expanded this idea to adding a mechanism to signal
 the OOM condition of the plugin buffer which allows us to only
 grab the playback buffer after garbage collection fails
 (SO THE MUSIC KEEPS PLAYING AS LONG AS POSSIBLE)

Change-Id: I684fb98b540ffc01f7ba324ab5b761ceb59b9f9b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Derivative of work by RobertGabrielJakabosky
 http://lua-users.org/wiki/EmergencyGarbageCollector

I've only implemented the not enough memory part and
 expanded this idea to adding a mechanism to signal
 the OOM condition of the plugin buffer which allows us to only
 grab the playback buffer after garbage collection fails
 (SO THE MUSIC KEEPS PLAYING AS LONG AS POSSIBLE)

Change-Id: I684fb98b540ffc01f7ba324ab5b761ceb59b9f9b
</pre>
</div>
</content>
</entry>
<entry>
<title>lua events from rockbox</title>
<updated>2019-07-20T01:48:34+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2019-06-27T16:28:34+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=3e2b50ed3b58daa5e3be5ea336d276b1655565f1'/>
<id>3e2b50ed3b58daa5e3be5ea336d276b1655565f1</id>
<content type='text'>
This library allows events to be subscribed / recieved within a lua script
most events in rb are synchronous so flags are set and later checked by a
secondary thread to make them (semi?) asynchronous.

There are a few caveats to be aware of:

FIRST, The main lua state is halted till the lua callback(s) are finished
 Yielding will not return control to your script from within a callback
 Also, subsequent callbacks may be delayed by the code in your lua callback
SECOND, You must store the value returned from the event_register function
 you might get away with it for a bit but gc will destroy your callback
 eventually if you do not store the event
THIRD, You only get one cb per event type
 ["action", "button", "custom", "playback", "timer"]
 (Re-registration of an event overwrites the previous one)

Usage:
 possible events =["action", "button", "custom", "playback", "timer"]

 local evX = rockev.register("event", cb_function, [timeout / flags])
  cb_function([id] [, data]) ... end

 rockev.suspend(["event"/nil][true/false]) passing nil affects all events
  stops event from executing, any but the last event before
  re-enabling will be lost, passing false, unregistering or re-registering
  an event will clear the suspend

 rockev.trigger("event", [true/false], [id])
  sets an event to triggered,
  NOTE!, CUSTOM_EVENT must be unset manually
  id is only passed to callback by custom and playback events

 rockev.unregister(evX)
  Use unregister(evX) to remove an event
  Unregistering is not necessary before script end, it will be
  cleaned up on script exit

Change-Id: Iea12a5cc0c0295b955dcc1cdf2eec835ca7e354d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This library allows events to be subscribed / recieved within a lua script
most events in rb are synchronous so flags are set and later checked by a
secondary thread to make them (semi?) asynchronous.

There are a few caveats to be aware of:

FIRST, The main lua state is halted till the lua callback(s) are finished
 Yielding will not return control to your script from within a callback
 Also, subsequent callbacks may be delayed by the code in your lua callback
SECOND, You must store the value returned from the event_register function
 you might get away with it for a bit but gc will destroy your callback
 eventually if you do not store the event
THIRD, You only get one cb per event type
 ["action", "button", "custom", "playback", "timer"]
 (Re-registration of an event overwrites the previous one)

Usage:
 possible events =["action", "button", "custom", "playback", "timer"]

 local evX = rockev.register("event", cb_function, [timeout / flags])
  cb_function([id] [, data]) ... end

 rockev.suspend(["event"/nil][true/false]) passing nil affects all events
  stops event from executing, any but the last event before
  re-enabling will be lost, passing false, unregistering or re-registering
  an event will clear the suspend

 rockev.trigger("event", [true/false], [id])
  sets an event to triggered,
  NOTE!, CUSTOM_EVENT must be unset manually
  id is only passed to callback by custom and playback events

 rockev.unregister(evX)
  Use unregister(evX) to remove an event
  Unregistering is not necessary before script end, it will be
  cleaned up on script exit

Change-Id: Iea12a5cc0c0295b955dcc1cdf2eec835ca7e354d
</pre>
</div>
</content>
</entry>
<entry>
<title>Lua replace fscanf</title>
<updated>2018-10-30T03:22:35+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2018-10-29T06:54:35+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=eab73b3deead4054ba8a1d9165b577ad935b9a05'/>
<id>eab73b3deead4054ba8a1d9165b577ad935b9a05</id>
<content type='text'>
Rocklua was using the full fscanf implementation
to simply read %ld for the file:read("*n") function
wasting 1k on unneeded/unused functionality

Instead, I've implemented a filetol function to duplicate it
without the extra overhead using strtol which as an added bonus
ERANGE errors now resolve to LONG_MIN and LONGMAX instead of
integer overflow

filetol()
   reads long int from an open file, skips preceding
   whitespaces returns -1 if error, 1 on success.
   *num set to LONG_MAX or LONG_MIN on overflow.
   If number of digits is &gt; than LUAI_MAXNUMBER2STR
   filepointer will continue till the next non digit
   but buffer will stop being filled with characters.
   Preceding zero is ignored.

Change-Id: Ia42d0f73c63a894625bca4581e9b7e1cc7387fd2
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rocklua was using the full fscanf implementation
to simply read %ld for the file:read("*n") function
wasting 1k on unneeded/unused functionality

Instead, I've implemented a filetol function to duplicate it
without the extra overhead using strtol which as an added bonus
ERANGE errors now resolve to LONG_MIN and LONGMAX instead of
integer overflow

filetol()
   reads long int from an open file, skips preceding
   whitespaces returns -1 if error, 1 on success.
   *num set to LONG_MAX or LONG_MIN on overflow.
   If number of digits is &gt; than LUAI_MAXNUMBER2STR
   filepointer will continue till the next non digit
   but buffer will stop being filled with characters.
   Preceding zero is ignored.

Change-Id: Ia42d0f73c63a894625bca4581e9b7e1cc7387fd2
</pre>
</div>
</content>
</entry>
<entry>
<title>Lua remove strncat.c &amp; strcspn.c</title>
<updated>2018-10-30T03:17:06+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2018-10-28T17:21:42+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=cc0a4c632aeda82ab4517355b4b4489190da013e'/>
<id>cc0a4c632aeda82ab4517355b4b4489190da013e</id>
<content type='text'>
Change-Id: I08256f31e733d2674054e8e589d539d1396a0ee6
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I08256f31e733d2674054e8e589d539d1396a0ee6
</pre>
</div>
</content>
</entry>
<entry>
<title>Lua remove gmtime.c use rb_plugin version instead</title>
<updated>2018-10-28T11:15:29+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2018-10-28T11:07:10+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=73f2bd9c4653498e029fcb857f43469910e886d4'/>
<id>73f2bd9c4653498e029fcb857f43469910e886d4</id>
<content type='text'>
Change-Id: Ia6d47a13ec8ae407661a78c56513ac0c164216da
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Ia6d47a13ec8ae407661a78c56513ac0c164216da
</pre>
</div>
</content>
</entry>
<entry>
<title>lua move RLIMAGE to own file</title>
<updated>2018-09-13T23:00:35+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2018-08-23T22:44:32+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=733c20d5d3d696a60a7fd7098ca45cb545e78043'/>
<id>733c20d5d3d696a60a7fd7098ca45cb545e78043</id>
<content type='text'>
Change-Id: Icd10e4c348deec7729d4a6e2bf1152e1dfc70243
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: Icd10e4c348deec7729d4a6e2bf1152e1dfc70243
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Update lua plugin to 5.2.3"</title>
<updated>2014-04-02T18:46:06+00:00</updated>
<author>
<name>Marcin Bukat</name>
<email>marcin.bukat@gmail.com</email>
</author>
<published>2014-04-02T18:46:06+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=bfd0179042b0b02fb88748d54e56e7e208bb117f'/>
<id>bfd0179042b0b02fb88748d54e56e7e208bb117f</id>
<content type='text'>
FILE typedef to *void needs more work to not break sim and
application builds. I checked only a few random native builds
unfortunately. Sorry for inconvenience.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
FILE typedef to *void needs more work to not break sim and
application builds. I checked only a few random native builds
unfortunately. Sorry for inconvenience.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update lua plugin to 5.2.3</title>
<updated>2014-04-02T18:31:54+00:00</updated>
<author>
<name>Richard Quirk</name>
<email>richard.quirk@gmail.com</email>
</author>
<published>2014-03-19T18:31:31+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=36378988ad4059982742f05f5eb50580b456840a'/>
<id>36378988ad4059982742f05f5eb50580b456840a</id>
<content type='text'>
Prior to this patch the Lua plugin used version 5.1.4. This change
reduces the number of modifications in the Lua source using some new
defines and because the upstream source is now more flexible.

Unless otherwise stated, l*.[ch] files are taken unmodified from the
upstream lua-5.2.3.

fscanf.c:
file descriptors in rockbox are just ints, they are hidden behind a
void* now so liolib requires less modifications. fscanf is updated to
use void* too.

getc.c: this is a new file required for getc implementation in lauxlib.c

lauxlib.c: LoadF replaced FILE* with int, the rockbox file
descriptor int are cast to FILE* (actually void* due to typedef).
getc uses the PREFIX version. stdin is not used, as per 5.1.4.

lbaselib.c: now uses strspn in the number parsing. print uses DEBUGF now
rather than being commented out.

lbitlib.c: use the built-in version from 5.2.3 rather than Reuben
Thomas's external library. Backwards compatible and adds some new bit
operations.

ldo.c: the LUAI_THROW/TRY defines are now in the core lua code, so have
been removed from rockconf.h

liolib.c: here the implementation has changed to use the LStream from
the original source, and cast the FILE* pointers to int. This has
reduced the number of modifications from the upstream version.

llex.c: the only change from upstream is to remove the locale include.

lmathlib.c: updated from the 5.2.3 version and re-applied the changes
that were made vs 5.1.4 for random numbers and to remove unsupported
float functions.

loadlib.c: upstream version, with the 5.1.4 changes for missing
functions.

lobject.c: upstream version, with ctype.h added and sprintf changed to
snprintf.

loslib.c: upstream version with locale.h removed and 5.1.4 changes for
unsupportable functions.

lstrlib.c: sprintf changed to snprintf.

ltable.c: upstream with the hashnum function from 5.1.4 to avoid frexp
in luai_hashnum.

luaconf.h: updated to 5.2.3 version, restored relevant parts from the
original 5.1.4 configuration. The COMPAT defines that are no longer
available are not included.

lundump.c: VERSION macro conflicts with the core Rockbox equivalent.

rocklib.c: luaL_reg is no longer available, replaced by luaL_Reg
equivalent. Moved checkboolean/optboolean functions to this file and out
of core lua files. luaL_getn is no longer available, replaced by
luaL_rawlen. luaL_register is deprecated, use the newlib/setfuncs
replacements. rli_init has to be called before setting up the newlib to
avoid overwriting the rb table.

rocklib_aux.pl: use rli_checkboolean from rocklib.c.

rocklua.c: new default bits library used, update the library loading
code with idiomatic 5.2 code.

strcspn.c: no longer needed, but strspn.c is required for strspn in
lbaselib.c

Change-Id: I0c7945c755f79083afe98ec117e1e8cf13de2651
Reviewed-on: http://gerrit.rockbox.org/774
Tested: Richard Quirk &lt;richard.quirk@gmail.com&gt;
Reviewed-by: Marcin Bukat &lt;marcin.bukat@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prior to this patch the Lua plugin used version 5.1.4. This change
reduces the number of modifications in the Lua source using some new
defines and because the upstream source is now more flexible.

Unless otherwise stated, l*.[ch] files are taken unmodified from the
upstream lua-5.2.3.

fscanf.c:
file descriptors in rockbox are just ints, they are hidden behind a
void* now so liolib requires less modifications. fscanf is updated to
use void* too.

getc.c: this is a new file required for getc implementation in lauxlib.c

lauxlib.c: LoadF replaced FILE* with int, the rockbox file
descriptor int are cast to FILE* (actually void* due to typedef).
getc uses the PREFIX version. stdin is not used, as per 5.1.4.

lbaselib.c: now uses strspn in the number parsing. print uses DEBUGF now
rather than being commented out.

lbitlib.c: use the built-in version from 5.2.3 rather than Reuben
Thomas's external library. Backwards compatible and adds some new bit
operations.

ldo.c: the LUAI_THROW/TRY defines are now in the core lua code, so have
been removed from rockconf.h

liolib.c: here the implementation has changed to use the LStream from
the original source, and cast the FILE* pointers to int. This has
reduced the number of modifications from the upstream version.

llex.c: the only change from upstream is to remove the locale include.

lmathlib.c: updated from the 5.2.3 version and re-applied the changes
that were made vs 5.1.4 for random numbers and to remove unsupported
float functions.

loadlib.c: upstream version, with the 5.1.4 changes for missing
functions.

lobject.c: upstream version, with ctype.h added and sprintf changed to
snprintf.

loslib.c: upstream version with locale.h removed and 5.1.4 changes for
unsupportable functions.

lstrlib.c: sprintf changed to snprintf.

ltable.c: upstream with the hashnum function from 5.1.4 to avoid frexp
in luai_hashnum.

luaconf.h: updated to 5.2.3 version, restored relevant parts from the
original 5.1.4 configuration. The COMPAT defines that are no longer
available are not included.

lundump.c: VERSION macro conflicts with the core Rockbox equivalent.

rocklib.c: luaL_reg is no longer available, replaced by luaL_Reg
equivalent. Moved checkboolean/optboolean functions to this file and out
of core lua files. luaL_getn is no longer available, replaced by
luaL_rawlen. luaL_register is deprecated, use the newlib/setfuncs
replacements. rli_init has to be called before setting up the newlib to
avoid overwriting the rb table.

rocklib_aux.pl: use rli_checkboolean from rocklib.c.

rocklua.c: new default bits library used, update the library loading
code with idiomatic 5.2 code.

strcspn.c: no longer needed, but strspn.c is required for strspn in
lbaselib.c

Change-Id: I0c7945c755f79083afe98ec117e1e8cf13de2651
Reviewed-on: http://gerrit.rockbox.org/774
Tested: Richard Quirk &lt;richard.quirk@gmail.com&gt;
Reviewed-by: Marcin Bukat &lt;marcin.bukat@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lua: Switch memory allocator from dl to tlsf</title>
<updated>2013-08-26T07:42:47+00:00</updated>
<author>
<name>Marcin Bukat</name>
<email>marcin.bukat@gmail.com</email>
</author>
<published>2013-08-22T10:12:47+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=a2a2e14e0d400e1c82b4d02c4399602488578dc6'/>
<id>a2a2e14e0d400e1c82b4d02c4399602488578dc6</id>
<content type='text'>
Instead of providing yet another memory allocator implementation
use tlsf and simply link tlsf library.

Another small improvement is to *grow* memory pool by grabbing
audiobuffer instead of just switching to use audiobuf exclusively.
Tested with simple lua 'memory eater' script.

This patch extends tlsf lib slightly. You can provide
void *get_new_area(size_t * size) function which will override
weak dummy implementation provided in lib itself. This allows to
automaticaly initialize memory pool as well as grow memory
pool if needed (for example grab audiobuffer when pluginbuffer
is exhaused).

Change-Id: I841af6b6b5bbbf546c14cbf139a7723fbb982f1b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of providing yet another memory allocator implementation
use tlsf and simply link tlsf library.

Another small improvement is to *grow* memory pool by grabbing
audiobuffer instead of just switching to use audiobuf exclusively.
Tested with simple lua 'memory eater' script.

This patch extends tlsf lib slightly. You can provide
void *get_new_area(size_t * size) function which will override
weak dummy implementation provided in lib itself. This allows to
automaticaly initialize memory pool as well as grow memory
pool if needed (for example grab audiobuffer when pluginbuffer
is exhaused).

Change-Id: I841af6b6b5bbbf546c14cbf139a7723fbb982f1b
</pre>
</div>
</content>
</entry>
<entry>
<title>FS#11347 by me: *dir LUA functions: luadir module</title>
<updated>2010-06-18T13:10:14+00:00</updated>
<author>
<name>Rafaël Carré</name>
<email>rafael.carre@gmail.com</email>
</author>
<published>2010-06-18T13:10:14+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=bfd8d023db7b6be9dff11a781372c382a27e053b'/>
<id>bfd8d023db7b6be9dff11a781372c382a27e053b</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
