preliminary lua iolib and oslib port - page 2 - General Discussion and Assistance - CHDK Forum

preliminary lua iolib and oslib port

  • 36 Replies
  • 24719 Views
Re: preliminary lua iolib and oslib port
« Reply #10 on: 19 / September / 2008, 14:51:02 »
Advertisements
Works for the S2 IS.  :D
Great job with much potential for new scripting ideas !

libtst.log attached.


*

Offline reyalp

  • ******
  • 14128
Re: preliminary lua iolib and oslib port
« Reply #11 on: 19 / September / 2008, 17:46:03 »
Nice to see so many working.
Works for the S2 IS.  :D
Which platform sub ?

To make this easier, I've added a lua function to return the build info. Also useful for scripts that need to behave differently on different cameras. Updated script attached. New build should hit the autobuilds soon. No need to run again if you already posted a log.
Don't forget what the H stands for.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: preliminary lua iolib and oslib port
« Reply #12 on: 20 / September / 2008, 04:53:01 »
Tested OK (using #520 + new script) on ixus70_sd1000-101b and A630-100c.
Logfiles attached.

looks like a good job, thanks

wim
« Last Edit: 20 / September / 2008, 04:56:01 by whim »

Re: preliminary lua iolib and oslib port
« Reply #13 on: 20 / September / 2008, 15:12:48 »
Test OK (using #520 + new script) on s2is 100e
Logfile is attached

 :D

*

Offline chr

  • ***
  • 138
  • IXUS 82 IS
Re: preliminary lua iolib and oslib port
« Reply #14 on: 21 / September / 2008, 10:14:39 »
Works well in my porting sd1100 branch  :)

I have some lua feature request:

 * call (addr, r0, r1, ... )
    this would make hacking the cam much more exciting  8)

 * md_detect_motion is a parameter beast. I just started with lua. Would be nice to see a OO wrapper around that so the parameter get names.

*

Offline reyalp

  • ******
  • 14128
Re: preliminary lua iolib and oslib port
« Reply #15 on: 21 / September / 2008, 15:17:39 »
Works well in my porting sd1100 branch  :)

I have some lua feature request:

 * call (addr, r0, r1, ... )
    this would make hacking the cam much more exciting  8)
hmm, just use poke to re-write some convenient function ;)

Quote
* md_detect_motion is a parameter beast. I just started with lua. Would be nice to see a OO wrapper around that so the parameter get names.
Yes, there's a lot of things in the script interface that can be done much more nicely with lua than they are in ubasic. Feel free to offer suggestions of what they should look like. Probably a topic for another thread.
Don't forget what the H stands for.

Re: preliminary lua iolib and oslib port
« Reply #16 on: 23 / September / 2008, 14:23:33 »
I would like to contribute for os.tmpname. I had looked @ the code.

#define lua_tmpnam(b,e) { \
   strcpy(b, "/tmp/lua_XXXXXX"); \
   e = mkstemp(b); \
   if (e != -1) close(e); \
   e = (e == -1); }

This looks fine for me except the string "/tmp/lua_XXXXXX". Do we have any folder as /tmp in CHDK?
One more question: I am little weak in assembly language. Because I had seen some of the functions getting mapped in tools/signatures_dryos.h of the trunk.

*

Offline reyalp

  • ******
  • 14128
Re: preliminary lua iolib and oslib port
« Reply #17 on: 23 / September / 2008, 16:07:32 »
the folder isn't a problem, we can create that (I'd suggest CHDK/TMP)

Note that we can't use the above without finding a working mkstemp in both vxworks and dryos, but we don't actually need to use mkstemp in CHDK, because the main reason that is used is because of security concerns on multi-users sytsems.

for chdk, you just need a unique file name, which you could generate quite easily in lua. (it'll be easier once we have 'stat' in lua)

tmpfile would be more useful, but that requires extra logic for the delete-on-close behavior.

You can see Signature finder - CHDK Wiki for a description of how signattures_dryos.h is generated.
Don't forget what the H stands for.

Re: preliminary lua iolib and oslib port
« Reply #18 on: 24 / September / 2008, 07:21:18 »
for chdk, you just need a unique file name, which you could generate quite easily in lua. (it'll be easier once we have 'stat' in lua)

By 'stat' you mean "lua -e stat", where stat is a string, I believe  :) For example :
lua -e 'a=1' -e 'print(a)'
outputs to 1. If I am wrong do help me to correct my mistake.

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: preliminary lua iolib and oslib port
« Reply #19 on: 24 / September / 2008, 09:48:05 »
tested s3is and a620, it worked :)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal