Determine CHDK build using ubasic - Script Writing - CHDK Forum supplierdeeply

Determine CHDK build using ubasic

  • 8 Replies
  • 4288 Views
*

Offline you1

  • *
  • 10
Determine CHDK build using ubasic
« on: 09 / August / 2009, 04:46:09 »
Advertisements
Greetings,

Is there a way to determine the CHDK build from a ubasic script?

I have a peace of code that is required on Microfunguy's Builds (set_sync), that is not necessary in other build(s).  I would like to determine the CHDK build in the script so that I can exclucde a code segment from executing.

tnx
Edvin

*

Offline zeno

  • *****
  • 891
Re: Determine CHDK build using ubasic
« Reply #1 on: 09 / August / 2009, 06:30:52 »
I don't think so. I did once add string support to Ubasic (http://www.zenoshrdlu.com/kapstuff/zexpubdb.html) and provided a get_buildinfo function, but no-one was interested so it never got into the trunk.

It would be very easy to write a function for ubasic that indicated which of SDM or CHDK was running but getting such a function into the two official builds is more problematic.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline fe50

  • ******
  • 3147
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: Determine CHDK build using ubasic
« Reply #2 on: 09 / August / 2009, 08:31:46 »
In CHDK, such a function is only available in Lua - get_buildinfo...

Re: Determine CHDK build using ubasic
« Reply #3 on: 09 / August / 2009, 08:57:22 »
I have a peace of code that is required on Microfunguy's Builds (set_sync)

Incidentally, with SDM 1.81 and later you can now use 'sync_on' and 'sync_off'.


David


*

Offline zeno

  • *****
  • 891
Re: Determine CHDK build using ubasic
« Reply #4 on: 09 / August / 2009, 10:00:18 »
Thinking about it, if you write a script that has commands that are not in CHDK and run it under CHDK (or not in SDM and run it under SDM) you'll may well get a syntax error even if the lines that has the invalid statement doesn't get executed because of the way parsing works. The ubasic parser scans in a strictly sequential fashion and may well scan an invalid line on its way to a valid one.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline you1

  • *
  • 10
Re: Determine CHDK build using ubasic
« Reply #5 on: 09 / August / 2009, 13:04:44 »
Thanks for the info gang...

* I can't use Lua because it is not supported under SDM.
* I'm using set_sync instead of sync_off to stay backwords compatible.
* I was planning to use gosub/return branch to skip over build specific routines.

Perhaps a workaround...
Does anyone know of get_prop value that is not supported (returning inconsistent value for different builds)?  Then again, even if it is inconsitant right now, it may be made consistant later on!

Best,
Edvin

*

Offline zeno

  • *****
  • 891
Re: Determine CHDK build using ubasic
« Reply #6 on: 09 / August / 2009, 13:29:47 »
Edvin

code like this:
Code: [Select]
if c = 1 then
  gosub "chdk"
else
  gosub "sdm"

:chdk
  rem chdk dependent code
  return

:sdm
 rem sdm dependent code
 return
will cause a parse error under sdm (because to get to the sdm subroutine, the parser has to read and parse the chdk routine)
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Determine CHDK build using ubasic
« Reply #7 on: 09 / August / 2009, 16:20:50 »
Does anyone know of get_prop value that is not supported (returning inconsistent value for different builds)?

get_prop and set_prop are script commands for accessing property cases (much like global variables) of the Canon firmware using similarly named C functions of the Canon firmware. They have no relation to CHDK or its versions and as such will not help.

A quick & dirty solution would be to add an @param for switching the script between mainstream CHDK and SDM compatibility. Remembering what zeno says above, commands supported by SDM but not CHDK will have to be placed in subs after all code that your script's 'CHDK mode' will execute (and if you use non-CHDK commands of SDM, you can't use non-SDM commands of CHDK in the same script should any exist nowadays, because there's only one end).


*

Offline you1

  • *
  • 10
Re: Determine CHDK build using ubasic
« Reply #8 on: 10 / August / 2009, 01:49:02 »
fudgey and zeno,
thank you for the valuable info

Best,
Edvin

 

Related Topics