Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:14 05 May 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 : Problem using ERASE in Command mode

Author Message
flip
Senior Member

Joined: 18/07/2016
Location: Australia
Posts: 114
Posted: 01:32am 24 Jun 2017
Copy link to clipboard 
Print this post

Hi all,
Hope someone can help again
I'm having trouble with ERASE. See following snippet of commands.


> q%=5
> dim gg(q%) as float
> for i= 0 to 5:gg(i)=i:next i
> for i= 0 to 5:? gg(i):next i
0
1
2
3
4
5
> erase gg
Error: Cannot find GG
> ? gg(3)
3
> erase gg()
Error: Cannot find GG()


Is this something to do with the limited command environment?
Regards Phil
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 01:59am 24 Jun 2017
Copy link to clipboard 
Print this post

Probably. Put the exact same code in the editor, save that, and then RUN the code.
When it stops at the command prompt, THEN type erase gg and see what happens.

It is possible you have found a wee bug or something - who knows. I will have to find a MM and try this out myself now.
Smoke makes things work. When the smoke gets out, it stops!
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 02:17am 24 Jun 2017
Copy link to clipboard 
Print this post

The command refers to array variables not arrays. It looks to me that you have to specify every array variable that you wish to delete.

GG is a non arrayed variable and GG() is invalid (I think).
 
flip
Senior Member

Joined: 18/07/2016
Location: Australia
Posts: 114
Posted: 02:29am 24 Jun 2017
Copy link to clipboard 
Print this post

Thanks for the quick responses !!

I tried
q%=5
dim gg(q%) as float
For i= 0 to 5:gg(i)=i:next i
for i= 0 to 5:? gg(i):next i
if s=0 then clear gg
so I could either clear or not, but still got failure

Result on running above program (and manual) MMEDIT session:
> run
0
1
2
3
4
5
[5] If s=0 Then Clear gg
Error: Unexpected text: gg
> ? gg(3)
3
> clear gg
Error: Unexpected text: gg
> clear gg()
Error: Unexpected text: gg()
> clear gg(3)
Error: Unexpected text: gg(3)
>
? mm.device$;" ";mm.ver
Micromite MkII 5.0404

So it may be a bug...(ver as above)Edited by flip 2017-06-25
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 02:41am 24 Jun 2017
Copy link to clipboard 
Print this post

Phil
as your results and the manual show, CLEAR does not need parameters as it deletes all variables.

The way I read it, if you wish to delete specific variables then you have to specify each one.

ERASE gg(0), gg(1) etc.

BobEdited by BobD 2017-06-25
 
flip
Senior Member

Joined: 18/07/2016
Location: Australia
Posts: 114
Posted: 03:16am 24 Jun 2017
Copy link to clipboard 
Print this post

Thanks Bob,
I got myself confused with CLEAR and ERASE...there seems to be no problem with CLEAR
but I still can't make ERASE work
>> list
Clear
q%=5
Dim gg(q%) As float
For i= 0 To 5:gg(i)=i:Next i
For i= 0 To 5:Print gg(i):Next i
Erase gg
q%=q%+1
Dim gg(q%) As float
> run
0
1
2
3
4
5
[6] Erase gg
Error: Cannot find GG
>

>


Unfortunately when I tried ERASEing individual elements in the array gave same message. The way I read it though the entire array gets ERASEd.
I deleted library as well in case that was causing a problem but no joy...maybe next I'll try re-flashing the chip.

Thanks again for your help.
Regards,
Phil
 
flip
Senior Member

Joined: 18/07/2016
Location: Australia
Posts: 114
Posted: 03:22am 24 Jun 2017
Copy link to clipboard 
Print this post

Found the bug!
array declared as type unable to be erased...
see following...

> dim ssss%(23)
> erase ssss%
> dim wwww(5) as float
> erase wwww
Error: Cannot find WWWW
>



Edit:
Workaround really easy...use type-declaration character (or default).
Geoff if you read this in my opinion this is very low priority...

Regards,
PhilEdited by flip 2017-06-25
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 09:12pm 30 Jun 2017
Copy link to clipboard 
Print this post

Thanks for the great detective work Phil,

I have fixed it in the recently released V5.04.05 which also fixed a couple of other annoying niggles.

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


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

© JAQ Software 2024