Rob Kendrick | 1 Aug 01:36
Picon

Re: Bluetooth and LUA

On Fri, 31 Jul 2009 15:06:17 -0300
"Daniel Barbier" <pitufofilosofo <at> gmail.com> wrote:

> Hi everyone.
> I'm starting developing with Plua, palm environment for LUA, and I'm
> wondering if there is some code written for Bluetooth handling. My
> device is a Centro and would like to build remote control for PC's
> mmedia on Linux. Some advice? thanks a lot. BTW, check facebook group
> PLUA programming :D

Firstly, Lua is not an acronym.  Secondly, if Plua does not provide an
API for Bluetooth, I suspect you're stuffed.  (PalmOS, the last time I
looked, did not support dynamic libraries.)

B.

Thomas Harning Jr. | 1 Aug 04:09
Picon
Gravatar

Re: [Patch] Finalization of function objects

On Fri, Jul 31, 2009 at 5:51 PM, Thomas Harning Jr.<harningt <at> gmail.com> wrote:
> On Fri, Jul 31, 2009 at 4:55 PM, TNHarris<telliamed <at> whoopdedo.org> wrote:
>> I don't believe the original patch was marking the coroutines
>> properly. I redid the GC so finalizers are treated similarly to userdata
>> __gc methods, the coroutine doesn't get collected until a second
>> finalize pass is done.
>> [lua514-finalizers0609.patch]
> Awesome, the patch passes successfully.
Ran through the test and things don't quick look right.  I'll have to
write up some more detailed test cases.

Here's the diff in the output of the original and your finalizer patch:

--- out	2009-07-31 22:04:30.000000000 -0400
+++ out2	2009-07-31 22:04:38.000000000 -0400
@@ -15,8 +15,8 @@
 -- Transaction
 OK
 -- Coroutine
-F	test.lua:113: on failure
-Z	test.lua:113: on failure
 OK
 -- GC'ed coroutine
+T
+Z
 OK

Basically, it looks like the on-error-condition patch is not getting
called in the co-routine case.  I don't recall what was required to
get that working...
(Continue reading)

David Manura | 1 Aug 06:52
Favicon

Re: is it possible to make longjmp-free Lua?

On Wed, Jul 29, 2009 at 5:34 AM, Juris Kalnins wrote:
> May I ask how big was your speedup?
> I just tried microbenchmark with lua_cpcall and the following:
> .... and got 0.15 vs 0.22 seconds on 1000000 calls on core2, and 40 vs 47
> seconds on mips.  I was expecting something more spectacular...

About 1.3x (Linux/gcc3.4) to 6x (Cygwin/gcc3.4) speedup over
lua_cpcall depending on the compiler.  See below.

=====

/* improved equivalent of lua_cpcall */
/* warning: assumes function pointers fit inside regular lightuserdata */

#include <lua.h>
#include <lauxlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

const int N = 10000000;

int cpcallproxy(lua_State * L) {
  lua_CFunction f = (lua_CFunction)lua_touserdata(L, 1);
  lua_remove(L, 1);
  return f(L);
}

int myluacpcall(lua_State * L, lua_CFunction func,
                int nargs, int nresults, int errfunc)
(Continue reading)

John Belmonte | 1 Aug 14:40

Re: [Patch] Finalization of function objects

On Fri, Jul 31, 2009 at 4:55 PM, TNHarris<telliamed <at> whoopdedo.org> wrote:
> That said, I'm not even sure if this patch is needed, as I also put
> together a rough framework of finalizers in pure lua.
> [final.lua]

I'm quite interested in what you have there, but gave up trying to
deduce the meaning of your severely abbreviated variable names.  Even
undocumented code can be readily understood given good naming.

--John

Martin | 1 Aug 22:56
Picon

What am I doing wrong?

I am creating lua  binding for my library. And it works fine.
But  when I run a test under valgrind memory error detector
some errors pop up. As I was trying to narrow it down where
is error I came to this artificial minimal example that shows
same symptoms

-- mylib.c
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"

#include <math.h>

static int l_sin(lua_State *L)
{
        double d = luaL_checknumber(L, 1);
        lua_pushnumber(L, sin(d));
        return 1;
}

static const luaL_reg mylib_f [] = {
        {"mysin", l_sin},
        {0, 0}
};

LUALIB_API int
luaopen_mylib(lua_State *L)
{
        luaL_register(L, "mylib", mylib_f);
        return 0;
(Continue reading)

Picon

Re: What am I doing wrong?

On Sat, 2009-08-01 at 22:56 +0200, Martin wrote:
> I am creating lua  binding for my library. And it works fine.
> But  when I run a test under valgrind memory error detector
> some errors pop up. As I was trying to narrow it down where
> is error I came to this artificial minimal example that shows
> same symptoms

You may wish to compile Lua with debugging symbols (-ggdb3) for valgrind
to produce more explaining error messages.

eugeny gladkih | 2 Aug 11:00
Favicon

Re: What am I doing wrong?

>>>>> "Martin" == Martin  <wtxnh-lua <at> yahoo.com.au> writes:

 Martin> But when I run it under valgrind it shows some errors. There are no
 Martin> memory leaks but some invalid memory access.
 Martin> Can somebody confirm that this is not happening only to me?  Should I
 Martin> be worried about this? And what I need to do to fix it?

nothing, that's not your problem. you have too old valgrind and/or
shown errors are in glibc. you may just ignore 'em

 Martin> ==7008== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework.

--

-- 
Yours sincerely, Eugeny.
GM of Enterprise Solutions Department
Doctor Web, Ltd.
http://www.drweb.com, +79119997425

Matthew M. Burke | 2 Aug 15:38
Favicon
Gravatar

Re: Bluetooth and LUA

Rob Kendrick wrote:

> API for Bluetooth, I suspect you're stuffed.  (PalmOS, the last time I
> looked, did not support dynamic libraries.)
>
>   
Actually, PalmOS supports libraries you can load at runtime, but it 
often tends to be tricky.  Plua provides facilities for writing 
libraries in C that your lua code can load using the loadlib command.

I would check the archives of the Yahoo Plua group.  I think I remember 
people discussing making use of bluetooth before, but I'm not sure of 
the outcome.  It may be possible using the PalmOS docs to write a 
wrapper around the bluetooth functionality, but off the top of my head, 
I'm wondering if maybe the way Marcio interacts with the event queue 
might preclude it from working.

Matt

Irayo | 2 Aug 17:16

Re: Valgrind (was: What am I doing wrong?)


On Aug 2, 2009, at 4:00 AM, eugeny gladkih <john <at> gladkih.com> wrote:

>>>>>> "Martin" == Martin  <wtxnh-lua <at> yahoo.com.au> writes:
>
> Martin> But when I run it under valgrind it shows some errors. There  
> are no
> Martin> memory leaks but some invalid memory access.
> Martin> Can somebody confirm that this is not happening only to me?   
> Should I
> Martin> be worried about this? And what I need to do to fix it?
>
> nothing, that's not your problem. you have too old valgrind and/or
> shown errors are in glibc. you may just ignore 'em
>
> Martin> ==7008== Using valgrind-3.2.1-Debian, a dynamic binary  
> instrumentation framework.
>

This may be mildly off-topic but certainly Valgrind related. I've been  
debugging my own lib with valgrind and it's very difficult to sift  
through all of the warnings and errors from the libraries I'm using  
(OpenGL in particular seems to confuse valgrind). These are useless to  
me since I can't do anything about them anyway. Is there a switch to  
make it only show results from my test program and library?

Louis Mamakos | 2 Aug 17:56
Favicon
Gravatar

Re: Bluetooth and LUA


On Aug 2, 2009, at 9:38 AM, Matthew M. Burke wrote:

> Rob Kendrick wrote:
>
>> API for Bluetooth, I suspect you're stuffed.  (PalmOS, the last  
>> time I
>> looked, did not support dynamic libraries.)
>>
>>
> Actually, PalmOS supports libraries you can load at runtime, but it  
> often tends to be tricky.  Plua provides facilities for writing  
> libraries in C that your lua code can load using the loadlib command.
>
> I would check the archives of the Yahoo Plua group.  I think I  
> remember people discussing making use of bluetooth before, but I'm  
> not sure of the outcome.  It may be possible using the PalmOS docs  
> to write a wrapper around the bluetooth functionality, but off the  
> top of my head, I'm wondering if maybe the way Marcio interacts with  
> the event queue might preclude it from working.
>
> Matt
>
>

This might not even be necessary, depending on how you want to use  
Bluetooth.  A couple of years ago before switching to an iPhone, I had  
a Treo 650 with Plua installed.  I was able to use Plua's ability to  
use serial devices to communicate with a small GPS "puck" over a  
Bluetooth serial profile, if that makes sense.  I no longer have  
(Continue reading)


Gmane