Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:27 27 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 : New version of MMBasic (ver 4.3)

     Page 3 of 3    
Author Message
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 10:01pm 30 Jan 2013
Copy link to clipboard 
Print this post

  ratall said   Hi Geoff
Sorry to bug you.
But I think I've found a small bug

Agghh, another bug! At least they are getting more obscure.

Thanks, it will be fixed in the next version.

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

Joined: 27/11/2012
Location: Australia
Posts: 12
Posted: 07:27pm 02 Feb 2013
Copy link to clipboard 
Print this post

Hi Geoff

Sorry to bug you again.
But I think I may have found another bug.


Option base 1

LabelCount = 1
If LabelCount>0 then Dim Labels$(LabelCount)


Gives an error of

Error: Invalid array dimension


I don't know about anybody else but I do have the annoying habit of counting stuff then creating an array to keep it in (not too big, not too small. Just right ) and occasionally there is only one.

I do have a work round so again not urgent.

The program I'm working on currently uses "option base 1" so my work round is to change it to "option base 0", add 1 to all array sizes at the dim and carry on as though I am still using "option base 1". Ignoring element 0 of the the array.

Thanks

R.

 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 07:53pm 02 Feb 2013
Copy link to clipboard 
Print this post

from the mmbasic manual

DIM. Specifies variables that have more than one element in a single
dimension, i.e., arrayed variables.

edit/add:
so the behavior of getting an error when trying to dimension an array of 1 element is correct as things stand. However I can see that with your idea of dynamically dimensioning arrays that when you have a count of 1 you have a problem.

It would generally speaking be unusual to need to declare an array of 1 element, perhaps Geoff would explain for you if this is a convention (to only be able to dimension arrays with 2 or more elements) or if there is a technical obstruction to declaring an 1 element array.

Cheers,
Anthony.Edited by ajkw 2013-02-04
 
ratall
Newbie

Joined: 27/11/2012
Location: Australia
Posts: 12
Posted: 09:39pm 02 Feb 2013
Copy link to clipboard 
Print this post

  ajkw said   from the mmbasic manual

DIM. Specifies variables that have more than one element in a single
dimension, i.e., arrayed variables.



Thanks for pointing that out I missed it. I am afraid I made an assumption based what some other basics let me get away with.

May be I should treat arrays as self contained objects and store the length in element zero. Or may be a terminator in the last element in case of string arrays. Waste not want not.

Sorry for wasting time.

Thanks for your help.

R.

 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 10:33pm 02 Feb 2013
Copy link to clipboard 
Print this post

  Quote  store the length in element zero


Would be handy spot to store the number of elements
 
ratall
Newbie

Joined: 27/11/2012
Location: Australia
Posts: 12
Posted: 10:50pm 02 Feb 2013
Copy link to clipboard 
Print this post

  ajkw said  
  Quote  store the length in element zero


Would be handy spot to store the number of elements


And it has the added bonus that when you erase the array it goes too.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 10:30pm 05 Feb 2013
Copy link to clipboard 
Print this post

Hi ratal,

Have a look at my recent post on stack, queue's and lists - these may prove usefull to you if you need multiple pidgeon holes for small strings rather than arrays and has the advantage of being able to pass to subroutines.

Cheers, Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 06:39am 06 Feb 2013
Copy link to clipboard 
Print this post

There are a few functions in other basic that can be usefull with arrays.
REDIM with optional preserve to make arrays smaller or bigger.
LBOUND and UBOUND to get the lower and upper bound of an array.

I am not sure if these were only in newer basic versions.

Microblocks. Build with logic.
 
James_From_Canb

Senior Member

Joined: 19/06/2011
Location: Australia
Posts: 265
Posted: 01:51pm 18 Feb 2013
Copy link to clipboard 
Print this post

  James_From_Canb said   David,

Print "Goto 100" will have problems. Good pickup. Thanks.

Maybe I can treat text within double quotes like a remark - trim it out while I process everything else, then put it back together again. I'll think about it.

James


It took a little work to handle text within double quotes and lines resizing when different length linenumbers were inserted, but I think it's finally debugged.

I'll start a new thread so I don't clutter up the 4.3 thread.

James
My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention.

Hedley Lamarr, Blazing Saddles (1974)
 
     Page 3 of 3    
Print this page


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

© JAQ Software 2024