Huge Ubasic bug - General Help and Assistance on using CHDK stable releases - CHDK Forum

Huge Ubasic bug

  • 12 Replies
  • 6438 Views
*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Huge Ubasic bug
« on: 17 / May / 2008, 17:49:02 »
Advertisements
Hi folks,

I have tested this on SDM and Allbest, and this code fails.
The probem is that after 3 loops it enters the "else" and prints "ERROR"

Code: [Select]
@title bug

print_screen 1

:loop

 if 3=2 then
  print "This never happens"
 endif

 if 2>1 then
  print "This is ok"
 else
  print "ERROR!!!"
 endif


 sleep 200

goto "loop"

The first "if" seems necessary to cause the bug.

I don't know the uBasic source well enough to pinpoint the problem in C, but I guess the interpreter considers the else as pertaining to the first if, not the second..


*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Huge Ubasic bug
« Reply #1 on: 18 / May / 2008, 05:15:32 »
Confirmed and fixed.
CHDK Developer.

*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: Huge Ubasic bug
« Reply #2 on: 18 / May / 2008, 05:42:06 »
fixed?
wow, thanks, that was fast :-)!

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Huge Ubasic bug
« Reply #3 on: 18 / May / 2008, 06:02:53 »
@GrAnd

Thanks for the fixes, GrAnd ! I wonder what this means, though:

Quote
+ Added a lot of camera functions in order to compile standalone ubasic interpreter.

wim


*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: Huge Ubasic bug
« Reply #4 on: 18 / May / 2008, 06:07:26 »
I think he refers to lib\ubasic\camera_functions.c

There are a lot of "dummy" functions like this:
Code: [Select]
void ubasic_camera_click(const char *s)
{
    printf("*** button click '%s' ***\n",s);
}

with these functions. you could run uBasic sripts on your PC
« Last Edit: 18 / May / 2008, 06:09:35 by fbonomi »

*

Offline zeno

  • *****
  • 891
Re: Huge Ubasic bug
« Reply #5 on: 18 / May / 2008, 07:55:38 »
Running uBasic scripts on a PC would make script debugging much much easier. Is that really coming soon?
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Huge Ubasic bug
« Reply #6 on: 18 / May / 2008, 08:10:48 »
Is that really coming soon?

Hmm... Actually, it exists a long time. I updated it to the latest version: http://grandag.nm.ru/hdk/ubasic_test.rar
It can be compiled from recent CHDK sources. Go to '/lib/ubasic' folder and type 'gmake check'.

But it has only generic functionality and does not operate with camera parameters (it has dummy functions). So, you can't emulate complex behavior.
« Last Edit: 18 / May / 2008, 08:13:32 by GrAnd »
CHDK Developer.

*

Offline zeno

  • *****
  • 891
Re: Huge Ubasic bug
« Reply #7 on: 18 / May / 2008, 13:21:19 »
Ah - I knew about the old ubasic_test.exe, but as you say it's of limited use in debugging scripts. I was hoping that someone would provide a debugging environment for ubasic where you could step through a script's execution (and supply values when a script tred to execute a camera function).

How easy would it be to build a UI around the ubasic interpreter for this sort of thing?
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit


*

Offline zeno

  • *****
  • 891
Re: Huge Ubasic bug
« Reply #8 on: 27 / May / 2008, 15:48:07 »
Well, since no-one else seemed interested, I did it myself. I've built a java-based interactive script debugger. Beta-testers are welcome to download the prototype here http://www.zenonic.demon.co.uk/zips/ubdb.zip

There's a PDF document here http://www.zenonic.demon.co.uk/zips/UBDB.pdf

Comments, suggestions and bug reports welcome.

Dave
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline wontolla

  • ****
  • 413
  • S3 & G9 & A720
Re: Huge Ubasic bug
« Reply #9 on: 27 / May / 2008, 16:44:47 »
Well very nice zeno!

"no one else seemed interested, I did it myself"
That's how everything starts around here, isn't it?

I saw the manual and it looks promising, but I couldn't run your debugger. I execute the BAT file and get this:

C:\Downloads\CHDK>java -cp UBDB.jar UBDebugUI
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)


I have the JVM. Is there something else I need?


Edit: Found your dedicated thread, I guess things should continue there.
Any interest in an interactive UBasic debugger for PC (or Mac?)
« Last Edit: 27 / May / 2008, 16:48:11 by wontolla »

 

Related Topics