Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:45 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 : MM Edit now does formatting

Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 09:14pm 12 Mar 2013
Copy link to clipboard 
Print this post

The latest update to MM Edit has a 'Format' command.



Indenting 400 lines of code adds 1k to the file size so there is also a command to remove the indenting.
You can set the indent level between 2 and 8 spaces.
I like 4 but 2 is a better choice for the limited screen space on the Maximite.

The formatting does NOT work on code with line numbers - sorry about that.

I am sure that there will be some layout that I have missed!

Formatting is a very useful way of checking that your loops are properly terminated.

Jim
VK7JH
MMedit   MMBasic Help
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 01:14am 13 Mar 2013
Copy link to clipboard 
Print this post

Hi Jim,

Am I doing something wrong here - I just installed it with the installer .exe over the old version as normal but it's not doing anything to the code in the edit screen when I hit the "format" button.

Great job - but I'm worried now you're just kidding us!

Greg
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 10:41am 13 Mar 2013
Copy link to clipboard 
Print this post

Check that you do have version 3.2.4 (Help/About), you might have endended up with a cached version.

Make sure that you are not trying to format code with line numbers.

Jim
VK7JH
MMedit   MMBasic Help
 
Greg Fordyce
Senior Member

Joined: 16/09/2011
Location: United Kingdom
Posts: 153
Posted: 11:21am 13 Mar 2013
Copy link to clipboard 
Print this post

The Format is working, but when I select "Remove comments and blank lines" or "Remove Indents and Trailing spaces" from the "Program" menu it deletes all the code. Undo restores the code. Anyone else notice this behaviour?

Greg
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 12:52pm 13 Mar 2013
Copy link to clipboard 
Print this post

I have found the problem.
I had made changes to the way that line endings are done.

The problems you observed are due to the program getting stuck in a mode that I had not expected.
You can prove it by changing the line ending to dos or unix.

The fixed program has been uploaded to my website or you can extract MMedit.tkn from the attached zip and replace the one in the program folder.

2013-03-13_225148_MMedit.zip

Having 'format' working will be worth it......

Hopefully that has fixed all my goofs and you can now try to find programs that don't format correctly.

JimEdited by TassyJim 2013-03-14
VK7JH
MMedit   MMBasic Help
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 04:05pm 13 Mar 2013
Copy link to clipboard 
Print this post

That's done it for me Jim - nice work! I replaced the TKN file.
Greg
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 07:04pm 13 Mar 2013
Copy link to clipboard 
Print this post

I am ashamed to admit that there was another st...up in the latest release.

Removing indents was also removing comments.

This new version should have most of the bugs squashed.

The full version on the website has been updated or the tkn file is here:

2013-03-14_050243_MMedit.zip

Jim

VK7JH
MMedit   MMBasic Help
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 09:40pm 13 Mar 2013
Copy link to clipboard 
Print this post

Well - I didn't even notice that! Must have gotten too excited when I saw the lovely formatting.

Greg
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:23pm 13 Mar 2013
Copy link to clipboard 
Print this post

It is getting better and better!
The formatting is super handy, making those indentations very visible.

Maybe working together with user Shoebuckle you can integrate his 'crunch' program.

I would offer a few 'paypal' beers for outlining. :)

Outlining is placing a small "+" sign before statements that have "blocks" of code.
Like FUNCTION, Sub, FOR, IF, ELSE, DO etc.
Larger programs can then collapse such areas to get a better overview.

Some other observations:
I would use a Pilcrow for the end of line indications. The ones used now are visually very dominant.
Also the whitespace markers are very dominant. Maybe use a very light grey?
If it is possible i would not show whitespace markers within strings and comments.

Adding spaces to code that is not within a subroutine gives at least for me the wrong impression.
I would prefer this:
[code]
A = Multiply(2, 3)

FUNCTION Multiply(a, b)
return a * b;
END FUNCTION
[/code]

instead of this:
[code]
A = Multiply(2, 3)

FUNCTION Multiply(a, b)
return a * b;
END FUNCTION
[/code]

Is it possible to add a checkmark to options chosen in the view menu, and the corresponding buttons?

Keep up the good work. From the moment i used MMEdit i never use anything else.
I especially like the run program in dos button. Very convenient.


Microblocks. Build with logic.
 
Greg Fordyce
Senior Member

Joined: 16/09/2011
Location: United Kingdom
Posts: 153
Posted: 03:42am 14 Mar 2013
Copy link to clipboard 
Print this post

Still not working for me. I've done a clean install of V3.2.5

When I open my program I get an error "Error 0 MessageNotUndertood" but the code opens. When I try to remove indents I get the same error above. 'Remove comments and blank lines' deletes the code. I'm running W7 home prem 64bit and the code I am trying to format is here; autorun.bas Edited by Greg Fordyce 2013-03-15
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 12:22pm 14 Mar 2013
Copy link to clipboard 
Print this post

  Greg Fordyce said   Still not working for me. I've done a clean install of V3.2.5

When I open my program I get an error "Error 0 MessageNotUndertood" but the code opens. When I try to remove indents I get the same error above. 'Remove comments and blank lines' deletes the code. I'm running W7 home prem 64bit and the code I am trying to format is here; autorun.bas


Greg,
'Remove comments and blank lines' deleting the code will get fixed next time.
For some reason, the problem with line endings is still there for you.

I downloaded your autorun.bas and it worked OK for me so the problem is still with the configuration settings.

Could you send me a copy of "locate.inf" and "mru.inf"
The location of both files can be found from Help/About

The last entry in the error log will be useful also.
To get to it
Help/Error log
Copy and paste the last 30 or so lines starting with something like this:

Error log timestamp Saturday 29/09/12 08:45:49
Runtime error: "isEmpty" not understood
MessageNotUnderstood>>defaultAction

You may prefer to email the inf files rather than posting here because they will contain some information about your file locations.

MMedit@c-com.com.au

You could then try deleting locate.inf and mru.inf. (Do this with MMedit shut down)

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 12:30pm 14 Mar 2013
Copy link to clipboard 
Print this post

  TZAdvantage said   It is getting better and better!
The formatting is super handy, making those indentations very visible.

Maybe working together with user Shoebuckle you can integrate his 'crunch' program.

I would offer a few 'paypal' beers for outlining. :)

Outlining is placing a small "+" sign before statements that have "blocks" of code.
Like FUNCTION, Sub, FOR, IF, ELSE, DO etc.
Larger programs can then collapse such areas to get a better overview.

Some other observations:
I would use a Pilcrow for the end of line indications. The ones used now are visually very dominant.
Also the whitespace markers are very dominant. Maybe use a very light grey?
If it is possible i would not show whitespace markers within strings and comments.

Adding spaces to code that is not within a subroutine gives at least for me the wrong impression.



Outlining will have to wait until I have sorted out the bugs in the latest 'features'
I am relying on Scintilla for the fancy stuff and I am not sure if I can ever do outlining.

I can change the white space markers so that they do not appear in the indent areas. I think that will help a lot. That is the only choice. I might be able to change the shading a bit for you.

The end of line markers are a Scintilla thing and I don't think I can change them.

There is an option in preferences to indent labels. Remove that option and you will have the layout you are after. At this stage, the change takes place after a restart but I will change that to act immediately.

Jim
VK7JH
MMedit   MMBasic Help
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 02:43pm 14 Mar 2013
Copy link to clipboard 
Print this post

  TassyJim said   I am ashamed to admit that there was another st...up in the latest release.



Hi Jim,

Don't worry mate, The person who never made a stuff up has never made anything.


Being a `line number' coder is there a program that converts between line numbered code and numberless code? And vice versa? If MM morphs to be numberless only I might be left up the creek unless I can parse any code through a converter.

Regards,

Mick


I have never made a mistake in my life.. Well there was one time when I thought I made a mistake but I was mistaken .......





Edited by bigmik 2013-03-16
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 04:30pm 14 Mar 2013
Copy link to clipboard 
Print this post

  bigmik said  
Being a `line number' coder is there a program that converts between line numbered code and numberless code? And vice versa? If MM morphs to be numberless only I might be left up the creek unless I can parse any code through a converter.

Regards,

Mick


Mick,

That was the reason why I started work on MM Edit in the first place.
I prefer to work without numbers and the MM needed them...

The ability to go to and from line numbers is still there.

Having code with half with numbers and the rest without numbers causes grief.

I haven't done any work on the number routines for a while so there might be some of the newer commands that are not catered for.

Jim
VK7JH
MMedit   MMBasic Help
 
Greg Fordyce
Senior Member

Joined: 16/09/2011
Location: United Kingdom
Posts: 153
Posted: 12:09am 15 Mar 2013
Copy link to clipboard 
Print this post

  TassyJim said  Could you send me a copy of "locate.inf" and "mru.inf"
The location of both files can be found from Help/About

The last entry in the error log will be useful also.


Jim,

I started the program this morning to get you the information you require and it started normally. So whatever the problem was it seems to have fixed itself. I don't think I did anything differently this time, but it's working so I'm happy. If I see the issue again I'll send you the info you asked for.

Thanks,

Greg
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 12:48am 15 Mar 2013
Copy link to clipboard 
Print this post

Hi Jim,

I have just had a (first) look at MMEdit and it looks great.... I really thought it was merely an editor so I never ran it...

But I found a funny when I converted my TESTER4.BAS program for the Test-A-Mite

It has a line in it that has a word enclosed by single closed quotes within a PRINT statement and it converts the closing single quote into an x92 whatever that is

I have reduced the line to its minimal form and this line shows what I mean (save it as a .BAS file and load it into MMEdit to show what I mean.


10 Print"’"

Regards,

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
shoebuckle
Senior Member

Joined: 21/01/2012
Location: Australia
Posts: 189
Posted: 12:55am 15 Mar 2013
Copy link to clipboard 
Print this post

  bigmik said  
Being a `line number' coder is there a program that converts between line numbered code and numberless code? And vice versa? If MM morphs to be numberless only I might be left up the creek unless I can parse any code through a converter.


Yes bigmik. NONUMBER.BAS in the user library will remove numbers from your code without destroying its function, so you can write with numbers, if that is what you are comfortable with, and then remove them later.

Cheers,
Hugh
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 01:03am 15 Mar 2013
Copy link to clipboard 
Print this post

Thanks Hugh,

I used to program in POWER BASIC Console Compiler (windows) which used LABELS, but It was long ago, and now I struggle understanding the code that is often posted on TBS.

I know Numberless code is better... Especially if you want to add a bunch of code `mid stream' so to speak... I really need to knuckle down and give it a go..

But for some reason my brain stalls at LABELS now and handles numbered code easier... must be early onset alcoholzeimers setting in.

Regards,

MickEdited by bigmik 2013-03-16
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 10:40am 15 Mar 2013
Copy link to clipboard 
Print this post

Mick,
You have been caught with a "smart quote", or as I prefer to call them, a "smart ar..." quote.
The normal quote ' is chr$(39) while smart quotes lean in and out to start and end. you have an ending smart quote which is chr$(146) or 92 in hex.
Word processors like to use smart quotes and cutting and pasting from word documents or PDF's that were created from Word documents will give you smart quotes.

MM Edit tends to print the hex code for characters that are not "printable" characters.

Greg,

The fact that it is working now confirms my suspicions about it being a configuration issue.

The latest version, 3.2.6 has a lot more error checking in the areas around the configuration options to help prevent this from happening to anyone else.

Jim


VK7JH
MMedit   MMBasic Help
 
Print this page


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

© JAQ Software 2024