Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:31 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 : MM 3.1 bug in NONUMBER/long lines

Author Message
iggy
Newbie

Joined: 26/12/2011
Location: Australia
Posts: 15
Posted: 12:30pm 28 Jan 2012
Copy link to clipboard 
Print this post

Just tried running NONUMBER.BAS to convert a line numbered program of mine but nonumber dies with a SYNTAX error on editor line 97 because the line is too long and gets scrambled.

If I EDIT the program then lots of this very long line appear as I delete characters from the front of the line.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 09:28pm 28 Jan 2012
Copy link to clipboard 
Print this post

I am not sure that this is a bug in MMBasic.

If the line is longer than the screen width EDIT will only show the part that will fit on the screen. If you delete the character at the start of the line EDIT will shift the line to the left and you can see more of it. Think of it as if your long line is still there, it is just dangling in mid air off to the right of your screen.

If you want to edit a long line you can position the cursor somewhere near the right hand margin of the screen and hit enter. This will split the line into two and hopefully both parts will fit on your screen. Later you can rejoin the line by deleting the enter key. It's a kludge I know, but it will work until horizontal scrolling is implemented.

NONUMBER.BAS has a good try at deciphering MMBasic programs but it can still get tripped up on odd constructs. When that happens the only resort is to fire up EDIT.

Geoff
Geoff Graham - http://geoffg.net
 
iggy
Newbie

Joined: 26/12/2011
Location: Australia
Posts: 15
Posted: 12:06am 29 Jan 2012
Copy link to clipboard 
Print this post

Hi Geoff,

Okay so the bug is in NONUMBER.bas straight out of the 27/1/2012 user library. I've just xmodem'd it to the board again and done a LIST.


ptr = ptr + Len(kw$) 'step over it and process
On n GoSub Proc_Gto_Gsub, Proc_Gto_Gsub, Proc_Then_else, Proc_Then_Else, Proc_Setpin, Proc_Tick, Proc_Open, Proc_Setpin,
Proc_I2CSen, Proc_On
EndIf
Loop While ptr <> 0
Loop
'
'''''''''''''''''''''''''
PRESS ANY KEY ...


You can see the huge On n GoSub line. When you run the program you get.


Program to No-Number: pactest.bas

Output file name: pacnon.bas

Finished Pass 1, found 248 Program lines

Processing Pass 2

....
[97] On n GoSub Proc_Gto_Gsub, Proc_Gto_Gsub, Proc_Then_else, Proc_Then_Else, Proc_Setpin, Proc_Tick, Proc_Open, Proc_Setpin,
Error: Invalid syntax
>


FYI n=10 at that point.

and if you try to EDIT the program the characters of the line past column 80 don't wrap around but continue off into never land as you say but forcing a wrap still leaves the syntax error.


ptr = ptr + Len(kw$) 'step over it and process
On n GoSub Proc_Gto_Gsub, Proc_Gto_Gsub, Proc_Then_else, Proc_Then_Else
Proc_I2CSen, Proc_On
EndIf
Loop While ptr <> 0


Maybe there is something in the file it is processing which is tripping up NONUMBER.BAS and as you said it's not a MM bug but looks like a NONUMBER bug.

iggy
Edited by iggy 2012-01-30
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 01:10am 29 Jan 2012
Copy link to clipboard 
Print this post

It is not really a bug in nonumber either, but perhaps it is a limitation. As Geoff suggested you will need to manually edit your code.

As it seems you cannot wrap the <target>'s of on gosub over multiple lines either so you might need to break the on gosub into smaller one line chunks.

eg. (example only, not tested)

if n<=8 then on gosub a,b,c,d,e,f,g,h
n=n-8
if n>0 and n<=8 then on gosub i,j,k,l,m,n,o,p
n=n-8
if n>0 and n<=8 then on gosub q,r,s,t,u,v,w,x
n=n+16 'if you need to restore n


Anthony.

  Geoffg said  
NONUMBER.BAS has a good try at deciphering MMBasic programs but it can still get tripped up on odd constructs. When that happens the only resort is to fire up EDIT.
Geoff
 
iggy
Newbie

Joined: 26/12/2011
Location: Australia
Posts: 15
Posted: 01:29am 29 Jan 2012
Copy link to clipboard 
Print this post

Really simple:

NONUMBER.BAS crashes with a syntax error at editor line 97.

Not my code, this is just me highlighting that NONUMBER.bas as it comes in the 27 Jan user library appears to be buggy or something changed in MM 3.1 between testing of NONUMBER and the final release involving long lines.

Thank you, I know there are ways to code an ON GOSUB to break it up into smaller chunks but I'm approaching this from the point of I thought it worked as shipped so I was reporting a possible bug in someone else's code, not mine.

Yes I can and will manually edit my own code to remove the line numbers, which has NOTHING to do with what I reported in the first place!





 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 02:38am 29 Jan 2012
Copy link to clipboard 
Print this post

Right'o Iggy, only trying to help. :-)

Yes I can see now whos' code you have posted, given that the line in question in the nonumber program is 1. the longest line in the program, and 2. Wraps a line with the <target>'s then perhaps there is something in the Nonumber program that needs looking at.

I am about to try a edit and test of Version 7 Nonumber.

Cheers,
Anthony.
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 02:58am 29 Jan 2012
Copy link to clipboard 
Print this post

Oh the pain of 1 'stray' CR.

I couldn't edit it out on the Maximite editor but on the PC I could.

Iggy perhaps you would like to try this edit on yours and confirm the problem/fix?

Cheers,
Anthony.



Good, all on one line
On n GoSub Proc_Gto_Gsub, Proc_Gto_Gsub, Proc_Then_else, Proc_Then_Else, Proc_Setpin, Proc_Tick, Proc_Open, Proc_Setpin, Proc_I2CSen, Proc_On



No good, line is split by a CR after Proc_Setpin,
On n GoSub Proc_Gto_Gsub, Proc_Gto_Gsub, Proc_Then_else, Proc_Then_Else, Proc_Setpin, Proc_Tick, Proc_Open, Proc_Setpin,
Proc_I2CSen, Proc_On
 
iggy
Newbie

Joined: 26/12/2011
Location: Australia
Posts: 15
Posted: 04:30am 29 Jan 2012
Copy link to clipboard 
Print this post

Cheers Anthony I know you were trying to help :-)

Yep I pasted a single long line in and it is fine. I got the impression you could break the line with a CR from what Geoff said but obviously not.

So now even NONUMBER is fixed ;-)

Now I need to clean up my one line If THEN Else statements because they don't work in 3.1. Breaking them up into proper looking multi-line IF blocks works fine.Edited by iggy 2012-01-30
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 04:50am 29 Jan 2012
Copy link to clipboard 
Print this post

Ah, thanks iggy and ajkw. I was worried about a bug in MMBasic but it was just a line in NONUMBER.BAS that somehow got split in half when the library was zipped up.

I have rebuilt the library and copied it up. It is now called MMBasic Library 29-Jan-2012.

Geoff
Geoff Graham - http://geoffg.net
 
Keith W.
Senior Member

Joined: 09/10/2011
Location: Australia
Posts: 118
Posted: 05:21am 29 Jan 2012
Copy link to clipboard 
Print this post

Hey, That was exciting and I almost missed it.

In an effort to now have meaningful labels I replaced the short labels generated by NONUMBER, working on itself, with ones that gave some hint at what is happening. The On Gosub line quickly directs to correct routines for different keywords but must be on one line as pointed out above. It also grew as new keywords were added. That results here in a line that exceed the Editors line length unfortunately.

Geoff, could the Editor wrap the display of long lines automatically by some method, with perhaps a symbol (<<)to indicate that it is actually part of the previous line? I have tried to limit the length but also fail in some cases trying to preserve readability.

Keith W.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 07:56am 29 Jan 2012
Copy link to clipboard 
Print this post

I have not yet figured out the best way to handle long lines. The structure of the editor allows for horizontal scrolling but, in the interest of not holding everything up, I left the actual implementation for later.

Wrapping is another way of accommodating long lines. Probably it would be simpler than horizontal scrolling.

I will have to experiment.

Geoff
Geoff Graham - http://geoffg.net
 
Print this page


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

© JAQ Software 2024