<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rockbox/apps/plugins/lua/rockaux.c, branch quake5</title>
<subtitle>My Rockbox tree</subtitle>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/'/>
<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 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 optimize current_path function</title>
<updated>2018-10-15T16:24:10+00:00</updated>
<author>
<name>William Wilgus</name>
<email>me.theuser@yahoo.com</email>
</author>
<published>2018-10-13T17:35:01+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=07fed9053a476b4c6e5ecd23fc43ec84f4094978'/>
<id>07fed9053a476b4c6e5ecd23fc43ec84f4094978</id>
<content type='text'>
frees up around 500 bytes by using the builtin string functionality

Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
frees up around 500 bytes by using the builtin string functionality

Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c
</pre>
</div>
</content>
</entry>
<entry>
<title>Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM &amp; PLATFORM_HOSTED) (or equivalently).</title>
<updated>2010-06-21T16:53:00+00:00</updated>
<author>
<name>Thomas Martitz</name>
<email>kugel@rockbox.org</email>
</author>
<published>2010-06-21T16:53:00+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=35e8b1429a2cdcf6580f6d25890fed9865165d0b'/>
<id>35e8b1429a2cdcf6580f6d25890fed9865165d0b</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>Make the sim buildable with mingw again</title>
<updated>2010-05-14T22:57:52+00:00</updated>
<author>
<name>Frank Gevaerts</name>
<email>frank@gevaerts.be</email>
</author>
<published>2010-05-14T22:57:52+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=530c25130fb561a1260d32b756d008385d7e5a69'/>
<id>530c25130fb561a1260d32b756d008385d7e5a69</id>
<content type='text'>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26037 a1c6a512-1295-4272-9138-f99709370657
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26037 a1c6a512-1295-4272-9138-f99709370657
</pre>
</div>
</content>
</entry>
<entry>
<title>Lua: implement the ^ and % operators</title>
<updated>2009-07-27T16:06:51+00:00</updated>
<author>
<name>Maurus Cuelenaere</name>
<email>mcuelenaere@gmail.com</email>
</author>
<published>2009-07-27T16:06:51+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=527b069653bf06661b8a9650e1f5eb2c6e7cc2bf'/>
<id>527b069653bf06661b8a9650e1f5eb2c6e7cc2bf</id>
<content type='text'>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22070 a1c6a512-1295-4272-9138-f99709370657
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22070 a1c6a512-1295-4272-9138-f99709370657
</pre>
</div>
</content>
</entry>
<entry>
<title>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.</title>
<updated>2009-07-01T17:01:22+00:00</updated>
<author>
<name>Maurus Cuelenaere</name>
<email>mcuelenaere@gmail.com</email>
</author>
<published>2009-07-01T17:01:22+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=9bff845b49e277af46d6b7a09bb111472f3d3f49'/>
<id>9bff845b49e277af46d6b7a09bb111472f3d3f49</id>
<content type='text'>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21595 a1c6a512-1295-4272-9138-f99709370657
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21595 a1c6a512-1295-4272-9138-f99709370657
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix mingw &amp; cygwin builds</title>
<updated>2009-05-25T12:00:13+00:00</updated>
<author>
<name>Maurus Cuelenaere</name>
<email>mcuelenaere@gmail.com</email>
</author>
<published>2009-05-25T12:00:13+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=88cf5b307a4124789a59a1ca1c7fb38e0213b935'/>
<id>88cf5b307a4124789a59a1ca1c7fb38e0213b935</id>
<content type='text'>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21075 a1c6a512-1295-4272-9138-f99709370657
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21075 a1c6a512-1295-4272-9138-f99709370657
</pre>
</div>
</content>
</entry>
<entry>
<title>Commit FS#9174: Lua scripting language by Dan Everton</title>
<updated>2009-05-21T19:01:41+00:00</updated>
<author>
<name>Maurus Cuelenaere</name>
<email>mcuelenaere@gmail.com</email>
</author>
<published>2009-05-21T19:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=cf87597226f5d6b269f1f2c4d6f402aa1eccb852'/>
<id>cf87597226f5d6b269f1f2c4d6f402aa1eccb852</id>
<content type='text'>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21020 a1c6a512-1295-4272-9138-f99709370657
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21020 a1c6a512-1295-4272-9138-f99709370657
</pre>
</div>
</content>
</entry>
</feed>
