The MASM Forum

Miscellaneous => Miscellaneous Projects => Topic started by: HSE on February 19, 2020, 03:51:37 AM

Title: QE_with_colours' evolution
Post by: HSE on February 19, 2020, 03:51:37 AM
Hi all!

Following JJ's 2012 ideas it's possible to improve amateurs experience with QE using just a little of colors. Very rustic but I think useful.

Quote from: jj2007 on February 18, 2020, 11:38:36 PM
..., but OP wants something completely different: automatic syntax highlighting à la Iczelion (http://masm32.com/board/index.php?topic=6461.0).

I can't wait to see what OP can do  :biggrin:


Quote from: jj2007 on February 18, 2020, 11:38:36 PM
In order to achieve that, you need the QE plugin interface (http://masm32.com/board/index.php?topic=4564.msg48903#msg48903), i.e. write a DLL that does the highlighting using the hRichEdit in-process. Quite a different story.

I know, it's a challenge  :wink2:. But RadAsm and many others make that very well (I think).

- here most recent version:
Title: Re: QE_with_colours' evolution
Post by: jj2007 on February 19, 2020, 06:43:48 AM
I've extracted it to \Masm32\plugins\stream1.dll - how do you activate it?
Title: Re: QE_with_colours' evolution
Post by: HSE on February 19, 2020, 07:38:05 AM
Edit menus.ini in masm32 directory and were you want write:stream1, {e}\plugins\stream1.dll

or create a new category:[MyCategory]
fantasyname, {e}\plugins\stream1.dll


Open a new instance of QE and open an assembly file (.asm or .inc), after that in the menu you execute the plugin.
Title: Re: QE_with_colours' evolution
Post by: jj2007 on February 19, 2020, 08:44:18 AM
Works like a charm :thumbsup:
Title: Re: QE_with_colours' evolution
Post by: HSE on February 19, 2020, 09:00:26 AM
Thanks JJ for testing  :thumbsup:
Title: Re: QE_with_colours' evolution
Post by: Ravi Kiran on February 19, 2020, 03:44:44 PM
Quote from: jj2007 on February 19, 2020, 08:44:18 AM
Works like a charm :thumbsup:
it's working sir.
Title: Re: QE_with_colours' evolution
Post by: HSE on February 20, 2020, 12:22:37 AM
Quote from: Ravi Kiran on February 19, 2020, 03:44:44 PM
it's working sir.

That it's the previous version. Version here also process strings, just because strings can contain semicolons.
Title: Re: QE_with_colours' evolution
Post by: HSE on February 20, 2020, 09:48:40 AM
Corrected remotion of spaces after quotation, and now brackets, etc (easy to modify if you don't like that). Files updated in first post.
Title: Re: QE_with_colours' evolution
Post by: daydreamer on February 20, 2020, 02:54:00 PM
great  :thumbsup:
Title: Re: QE_with_colours' evolution
Post by: jj2007 on February 20, 2020, 07:55:19 PM
It works fine :thumbsup:

Now your next step will be to harmonise it with [Colours] in OllyDbg.ini :badgrin:
Title: Re: QE_with_colours' evolution
Post by: HSE on February 21, 2020, 06:07:21 AM
Thanks  :thumbsup:

Quote from: jj2007 on February 20, 2020, 07:55:19 PM
Now your next step will be to harmonise it with [Colours] in OllyDbg.ini :badgrin:

qEditor don't need a plugin to do that  :biggrin:
Title: Re: QE_with_colours' evolution
Post by: HSE on March 03, 2020, 04:34:23 AM
Hi!!

Here I added the Iczelion procedure.

Quote from: jj2007 on February 18, 2020, 11:38:36 PM
..., but OP wants something completely different: automatic syntax highlighting à la Iczelion (http://masm32.com/board/index.php?topic=6461.0).

That work perfectly until you close the MessageBox.

I'm still not very succefull taking Richedit's Font and creating the GDI font :biggrin:
But work for me because plugin is builded with my qEditor's settings: fixedsys, height =12, weight= 500.

Location of wordfile.txt must be qEditor's location.



Title: Re: QE_with_colours' evolution
Post by: jj2007 on March 03, 2020, 10:47:41 AM
Works fine with a 640k source :thumbsup:
Title: Re: QE_with_colours' evolution
Post by: HSE on March 04, 2020, 04:47:44 AM
Thanks JJ!

The theoretical size of the file is around 800 Kb (asuming RTF = plain text * 3). But can be increased changing memory allocated:
  invoke SysAllocStringByteLen, NULL, 2500000 <-- memory for plain text file
  mov hReo$, eax

  invoke SysAllocStringByteLen, NULL, 2500000 <-- memory for RTF
  mov hRes$, eax


There are some glitchs perhaps because RTF is not well formed, but most likely because QE is optimized for plain text  :biggrin:

That make interesting to use only Iczelion procedure (http://masm32.com/board/index.php?topic=8391.msg91804), wich surprisingly work fine just subclassing Richedit.

Of course look better RTF  :biggrin: and not interfere with most QE functions. Perhaps both plugins could be of interest.
Title: Re: QE_with_colours' evolution
Post by: HSE on March 18, 2020, 01:59:05 AM
There was some problem forming RTF, solved now.

The process can detect "comment" now. It's maked in a very nice spaghetti style  :biggrin:, still not using  Hutch's Finite State Machines.

Updated in first post.
Title: Re: QE_with_colours' evolution
Post by: hutch-- on March 18, 2020, 02:28:21 AM
The way I did the words 20 years ago was to load them into a hash table that I had in PowerBASIC so that access time for getting the words was fast enough. I don't have one written for masm but I think you can make a IF based tree grouping words that start with the same character to reduce the number of branches that you would have in a linear word list. To get the different colours I grouped each class of words with a single number so for example, registers=1, directives=2 etc ....

I would be inclined to do all the words in a single case rather than having both upper, and lower case as well as mixed case as a case conversion is fast enough not to have to bother with all the options and it reduces by half that number of entries.
Title: Re: QE_with_colours' evolution
Post by: HSE on March 18, 2020, 03:39:00 AM
Quote from: hutch-- on March 18, 2020, 02:28:21 AM
The way I did the words 20 years ago was to load them into a hash table
You mention that recently. I taked note  :thumbsup:

Quote from: hutch-- on March 18, 2020, 02:28:21 AM
I would be inclined to do all the words in a single case...
Yes. It's the only way that syntax highlighting work like "typing error detection". Some words can be written in upper or lower case but, for example, I don't write registers in upper case, and so on.
Title: Re: QE_with_colours' evolution
Post by: HSE on March 20, 2020, 09:27:29 AM
Just playing a little more  :biggrin:

Words are detected now. And that requiere also detect numbers!

Only CPU registers are detected, using some kind of tree. I found there is examples of hashtables in \masm32\examples\advanced to copy but that will be in some future  :cool:.

Files updated in first post.
Title: Re: QE_with_colours' evolution
Post by: zedd151 on October 01, 2022, 04:56:04 AM
As some here know, I like writing and using qeditor plugins. There are many useful features/fuctions that can be added with them. I am surprised I hadn't seen this thread already. I found this thread by looking at the 'Who's Online' list. (I like seeing what other users find interesting) A Guest was viewing the thread, so I followed and found it.
The closest thing I had done with a qeditor plugin was to have a plugin that searches the text for a string and highlights the occurrences of that string if found.
Nice little plugin HSE.  :thumbsup:

For this type of plugin I would probably use an external file with the words needed to be highlighted and their color. This way the user can change the words to be highlighted and their colors without having to rebuild the plugin (of course would be slower). Would be nice if a plugin could run automatically at the startup of qeditor, rather than having to select it from the menu. (Not a request hutch-- for any changes  :tongue: ) Would make using this type of plugin much easier.
Title: Re: QE_with_colours' evolution
Post by: HSE on October 01, 2022, 06:13:54 AM
Thanks :thumbsup:

Second plugin, Iczelion syntax method, use a file with several word categories.
Title: Re: QE_with_colours' evolution
Post by: zedd151 on October 01, 2022, 06:22:37 AM
Quote from: HSE on October 01, 2022, 06:13:54 AM
Second plugin, Iczelion syntax method, use a file with several word categories.
I totally missed that one (I didn't read through all the replies). Nice.  :biggrin: