Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:34 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMbasic Webmite 5.09 bug

Author Message
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 03:08am 08 Jun 2024
Copy link to clipboard 
Print this post

Hi all
Just wanted to report what appears to be a bug in webmite 5.09
This has been messing me up for days.. functions that run perfectly in main program but when library saved pull up errors. I have distilled the problem down to the following code. Once library saved, the function always gets truncated after the if...endif statement (regardless of what becomes before or after). Note there is no "next i" statement after library list all. I am finding that some functions are saving no problem and others are pulling up unexplainable errors. The length of the function is not a factor.

Can someone else replicate this behaviour?

library delete
>
> autosave

function dtn(d$)

   local excelStartYear=1900
   local i
   local deltaDays
   local ddd,mmm,yyy
   yyy=val(right$(d$,4))

   For i=excelStartYear To yyy-1
       If i Mod 4=0 and i Mod 100<>0 and i Mod 400<>0 Then
           deltaDays = deltaDays + 366
       Else
           deltaDays = deltaDays + 365
       End If
   next i

End function
Saved 352 bytes
> library save
Library Saved 232 bytes
>
> library list all
Function dtn(d$)
Local excelStartYear=1900
Local i
Local deltaDays
Local ddd,mmm,yyy
yyy=Val(Right$(d$,4))
For i=excelStartYear To yyy-1
If i Mod 4=0 And i Mod 100<>0 And i Mod 400<>0 Then
deltaDays = deltaDays + 366
Else
deltaDays = deltaDays + 365
End If
>
> ? mm.info(version)
5.09


Thanks
Joe
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 03:29am 08 Jun 2024
Copy link to clipboard 
Print this post

Comment out a few lines and the function saves fine:
> library delete
>
> autosave

function dtn(d$)

   local excelStartYear=1900
   local a
   local deltaDays
   local ddd,mmm,yyy
   yyy=val(right$(d$,4))

   For a=excelStartYear To yyy-1
'        If a Mod 4=0 and a Mod 100<>0 and a Mod 400<>0 Then
'            deltaDays=deltaDays+366
'        Else
'            deltaDays=deltaDays+365
'        End If
   next a

End function
Saved 367 bytes
> library save
Library Saved 132 bytes
>
> library list all
Function dtn(d$)
Local excelStartYear=1900
Local a
Local deltaDays
Local ddd,mmm,yyy
yyy=Val(Right$(d$,4))
For a=excelStartYear To yyy-1
Next a
End Function
>


Rewrite the same few lines and the problem returns:

> library delete
>
> autosave


function dtn(d$)

   local excelStartYear=1900
   local a
   local sum
   local deltaDays
   local ddd,mmm,yyy
   yyy=val(right$(d$,4))

   For a=excelStartYear To yyy-1
       sum=365
       if a Mod 400=0 Then sum=366
       If a Mod 4=0 Then
           if a Mod 100<>0 Then sum=366
       end if
       deltaDays=deltaDays+sum
   next a

End function
Saved 373 bytes
> library save
Library Saved 212 bytes
>
> library list all
Function dtn(d$)
Local excelStartYear=1900
Local a
Local sum
Local deltaDays
Local ddd,mmm,yyy
yyy=Val(Right$(d$,4))
For a=excelStartYear To yyy-1
sum=365
If a Mod 400=0 Then sum=366
If a Mod 4=0 Then
If a Mod 100<>0 Then sum=366
End If :
>
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 04:45am 08 Jun 2024
Copy link to clipboard 
Print this post

Perhaps "End If" is being read as "End"

Try "EndIf"
Removing the space might remove the confusion, though either should work.
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 05:08am 08 Jun 2024
Copy link to clipboard 
Print this post

  phil99 said  Perhaps "End If" is being read as "End"

Try "EndIf"
Removing the space might remove the confusion, though either should work.


UN. FREAKIN.BELIEVABLE

That worked.

So it IS a bug then! "End if" is not legit in the Library WTF!!?

Yes thank you Phil that has put me out of three solid days of absolute misery... I have always used "End If" without problem but only just started using the Library... this has thrown so many stupid errors at me I have aged.

Thanks 1000000

Joe
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9110
Posted: 07:45am 09 Jun 2024
Copy link to clipboard 
Print this post

Thanks for the report - will fix in RC6
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 02:37am 11 Jun 2024
Copy link to clipboard 
Print this post

  matherp said  Thanks for the report - will fix in RC6


You are a star (and a genius). Thank you.

Is there a way to donate support$?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9110
Posted: 07:35am 11 Jun 2024
Copy link to clipboard 
Print this post

You should find the problem is fixed in the RC5 update I posted yesterday. Please check and confirm.
The pleasure is in seeing you all use my/Geoff's code. Monetary recompense is not needed or a motivation.
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 01:50am 14 Jun 2024
Copy link to clipboard 
Print this post

Hi Peter
I can only say thanks for your generosity, it is making the world a better place.
I have checked the RC5 update briefly, unfortunately nothing is running, here is a log:

WebMite MMBasic Version 5.09.00RC5
Copyright 2011-2024 Geoff Graham
Copyright 2016-2024 Peter Mather

> OPTION RESET PICO-RESTOUCH-LCD-3.5

WebMite MMBasic Version 5.09.00RC5
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION COLOURCODE ON
OPTION CPUSPEED  252000 'KHz
OPTION LCDPANEL ILI9488W, LANDSCAPE,GP8,GP15,GP9,GP13
OPTION TOUCH GP16,GP17
GUI CALIBRATE 0, 3963, 216, -1285, 859
OPTION SDCARD GP22
OPTION MODBUFF ENABLE  192
OPTION PLATFORM Pico-ResTouch-LCD-3.5

WebMite MMBasic Version 5.09.00RC5
Copyright 2011-2024 Geoff Graham
Copyright 2016-2024 Peter Mather

> autosave [code containing library being only functions and subroutines]
library save
>saved 3576 bytes
> autosave
?"hello"
Saved 18 bytes
> run
>
>
 
jovian
Regular Member

Joined: 16/04/2017
Location: Australia
Posts: 62
Posted: 02:00am 14 Jun 2024
Copy link to clipboard 
Print this post

  matherp said  You should find the problem is fixed in the RC5 update I posted yesterday. Please check and confirm.
The pleasure is in seeing you all use my/Geoff's code. Monetary recompense is not needed or a motivation.


Please scratch the above. User error. errant "end" in my functions.

Tried RC05 again.. all good! :-)

Thanks
Joe
Edited 2024-06-14 12:15 by jovian
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024