The MASM Forum

Microsoft 64 bit MASM => Examples => Topic started by: HSE on January 03, 2025, 07:06:46 AM

Title: CodeEdit, the New Year version
Post by: HSE on January 03, 2025, 07:06:46 AM
Hi all!

Here an adaptation of CodeEdit, the Middle Year Edition (https://masm32.com/board/index.php?topic=10980.0).

Main thing is to show macros lines numbers, because assemblers report errors inside macros in that way.

Some better behavior can be thinked, but it's no easy in a simple RichEdit without to build something similar to a line editor (how I think RadAsm and other editors have).

Any idea is welcome  :thumbsup:

(https://i.postimg.cc/K1SVC6y5/CE-NY.png) (https://postimg.cc/K1SVC6y5)


Zip file contains binary and source code, additional files and tools are same from previous editions.

Regards, HSE.

Updated zip file 11/01/2025

Title: Re: CodeEdit, the New Year version
Post by: zedd151 on January 03, 2025, 07:22:28 AM
Looks like you are overlaying the colored text over the original uncolored text, giving the appearance of doubling as they do not line up exactly.
(https://i.postimg.cc/2SpPyP3G/screenshot.png)

I though that enlarging the text would help using ctrl+mouse wheel, this is the outcome:
(https://i.postimg.cc/y62Vhpkg/screenshot.png)

Title: Re: CodeEdit, the New Year version
Post by: HSE on January 03, 2025, 08:05:02 AM
Hi Zed!

Quote from: zedd151 on January 03, 2025, 07:22:28 AMoverlaying the colored text over

It's Iczelion method.

Quote from: zedd151 on January 03, 2025, 07:22:28 AMusing ctrl+mouse wheel

I never change sizes. Nice point :thumbsup:

Thanks, HSE.



Title: Re: CodeEdit, the New Year version
Post by: zedd151 on January 03, 2025, 08:17:32 AM
Some fonts may look/work better but still use that method of overlaying the colored text...

The line numbering appears to work well, though. I haven't tested yet on very large files yet.  Maybe I can do some quick testing in a little while.

A couple minutes later:
I tested and it seems line numbers are restricted to 5 digits. But the alignment remains true otherwise.
On each 10 lines I repeated the sequence:
1...
2
3
4
5
6
7
8
9
0
copy and pasted to get a huge line count... (The embedded editor on the forum truncates the series of periods, see image there were a lot of periods to take up some width)
Over a line count of 100000:
The line number area takes up a lot of horizontal space:
(https://i.postimg.cc/4d9hw7bp/screenshot.png)

After looking at your screenshot again Hector, I see that the extra space next to the source line count is reserved for macro (if used) line count?
Title: Re: CodeEdit, the New Year version
Post by: fearless on January 03, 2025, 08:34:56 AM
Got a few crash dumps from using it, just opening it, moving around some menus, clicked on terminal icon and the window icon one which opens another instance, closed window - seemed to pause there, so could be thats when it dumped the crash log, and same with the original window when clicking the close icon - small pause, then it closed. The pauses let me to double check the crash dumps folder just to see if there was anything there, and found 4 there.

Faulting application name: CodeEdit.exe, version: 1.0.0.0, time stamp: 0x6776af1b
Faulting module name: cplugin.dll_unloaded, version: 0.0.0.0, time stamp: 0x63a400f3
Exception code: 0xc0000005
Fault offset: 0x00000000000013bd
Faulting process ID: 0xb00
Faulting application start time: 0x01db5d5ac6468c53
Faulting application path: A:\Downloads\CodeEdit_NewYear\CodeEdit.exe
Faulting module path: cplugin.dll
Report ID: fd9a84ab-4679-4beb-b3bd-281223a37437
Faulting package full name:
Faulting package-relative application ID:
Title: Re: CodeEdit, the New Year version
Post by: zedd151 on January 03, 2025, 08:55:15 AM
Opening a file where a macro is present, the macro line count works. (Tested on 'macros64.inc')
However if pasting a macro into the editor, the macro line count does not get updated.
It works though (macro line count), if that text is saved to a file then opened in the editor.
Title: Re: CodeEdit, the New Year version
Post by: HSE on January 03, 2025, 10:57:30 PM
Hi Fearless and Zed!

Quote from: zedd151 on January 03, 2025, 08:55:15 AMthe macro line count does not get updated.

Now is updated when you save the file. Anyway, you have to save file previously to assembly it. The purpose is to find error lines.

The ideal could be that line numbers move whit his line when you insert something, but that need to make  things in a different way, and I don't know how (probably not so simple like this way)


Quote from: fearless on January 03, 2025, 08:34:56 AMGot a few crash dumps from using it

Fantastic. That part is Hutch's code  :biggrin:

I laugh because he could say something like: "catch exceptions is for little boys, Real Men TM must anticipate any possible error"

Because *.zip don't contain accesory files you see cplugin.dll in plugin list, but cplugin.dll it's not a plugin, that is an error Hutch don't saw :thumbsup:


Quote from: zedd151 on January 03, 2025, 08:17:32 AMOver a line count of 100000

In Masm32 SDK the file with bigger lines number is winextra.inc, wich have 25455 lines.

Hutch's idea was to build an editor skeleton to be adapted by any programmer. If you need bigger numbers just change that.

Quote from: zedd151 on January 03, 2025, 08:17:32 AMI see that the extra space next to the source line count is reserved for macro (if used) line count?

That was something secundary. Finally very easy to solve  :biggrin:

Updated a few things in first post.

Thanks, HSE.
Title: Re: CodeEdit, the New Year version
Post by: jj2007 on January 05, 2025, 03:24:17 AM
It can quickly become complex when macros are nested...
(https://i.postimg.cc/1VBJHczQ/Macro-Lines.jpg) (https://postimg.cc/1VBJHczQ)

I've chosen a slightly different approach:
- find the macro in the source, e.g. PushString MACRO
- press Ctrl O (like "change origin")
- press Ctrl G and insert the line number, now relative to the macro's first line
- hit Return to jump there

P.S., access violation for Enter 80:000000014000642D <OptionalHea | C8 8000 00                                   | enter 80,0                          |
0000000140006431              | 48:83EC 60                                   | sub rsp,60                          |
0000000140006435              | 48:8B0D 967B0000                             | mov rcx,[14000DFD2]                 | 000000014000DFD2:&"Return_App64_Path"
000000014000643C              | FF15 8E930000                                | call [<RegisterWindowMessageA>]     |
Title: Re: CodeEdit, the New Year version
Post by: HSE on January 05, 2025, 11:26:18 AM
Hi JJ!

Quote from: jj2007 on January 05, 2025, 03:24:17 AMIt can quickly become complex when macros are nested...

The idea is very clear with example, perhaps must be macro expansions are nested, because with JWASM family macros (the declaration in the code) can be nested. I used nested macros but I don't remember the error output.

The nested macro declarations will crash the current parser  :biggrin:, I'm still thinking how to do that  :thumbsup:

Quote from: jj2007 on January 05, 2025, 03:24:17 AM- hit Return to jump there

Nice idea for a plugin!


Quote from: jj2007 on January 05, 2025, 03:24:17 AMP.S., access violation for Enter 80

Very interesting  :thumbsup:

Thanks, HSE.
Title: Re: CodeEdit, the New Year version
Post by: HSE on January 11, 2025, 03:59:59 AM
Hi all!

Quote from: zedd151 on January 03, 2025, 07:22:28 AMenlarging the text would help using ctrl+mouse wheel

That is working now.

For some sizes there is a little displacement.

Apparently I'm failing to reproduce some DrawText or DC setting, then colored text sometimes have not exactly same width than base text (¿?).

Also prevented the missing ceplugin subdirectory error (what saw Fearless).

HSE
Title: Re: CodeEdit, the New Year version
Post by: zedd151 on January 11, 2025, 05:38:17 AM
Well, the project is getting there. Maybe ready by Christmas 2025?  I'll take a look at the latest version later.  :smiley:
Title: Re: CodeEdit, the New Year version
Post by: zedd151 on January 11, 2025, 06:06:43 AM
Original size, no magnification:
It might align better with COURIER (Not Courier New) or FIXEDSYS or ms sans serif (not microsoft sans serif)??
Title: Re: CodeEdit, the New Year version
Post by: HSE on January 11, 2025, 07:16:00 AM
Hi Zed,

Quote from: zedd151 on January 11, 2025, 06:06:43 AMnoticeable misalignment.

:biggrin: Yes, look strange.

But in 1 and 3 there is no misalignament, that is the antialiasing effect.

HSE


Title: Re: CodeEdit, the New Year version
Post by: HSE on January 11, 2025, 09:10:26 AM
Now read a table in size range of interest  :thumbsup:
Title: Re: CodeEdit, the New Year version
Post by: HSE on January 12, 2025, 02:59:28 AM
Hi all!

Quote from: jj2007 on January 05, 2025, 03:24:17 AMIt can quickly become complex when macros are nested...

Even if that refer to nested macro expansions, now parser can deal with nested macro declarations. You can build that only with JWAsm family assemblers. An example is mtx.inc file, wich contain Array macros (https://masm32.com/board/index.php?topic=8319.0) to mimic Basic arrays.

Updated in first post.

Regards, HSE