Author Topic: Automated Plugin Builder plugin for qe  (Read 7595 times)

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #15 on: September 21, 2015, 10:31:12 PM »
Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                        ;;
;;  boxcmt is a plugin for qeditor that creates a boxed in style comment  ;;
;;  from the text selected in qeditor. Example:                           ;;
;;                                                                        ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

------- snippet --------
this is a test comment
------ end snippet -----
will become
Code: [Select]
------- snippet --------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                          ;;
;;  this is a test comment  ;;
;;                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
------ end snippet -----
after being processed by the plugin.


It features the ability to handle tabs (replaces with 4 spaces).

It creates, as you can see, a border around the selected text

with extra space at the top bottom and sides for extra emphasis.



zedd



Box Comment Final
« Last Edit: July 20, 2018, 02:30:24 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Full Source for Box Comment plugin
« Reply #16 on: September 22, 2015, 07:49:57 AM »
Had to remove the 'Box Comment' plugin. There were some serious flaws in it somewhere.

I think the problem was the rich edit control itself. Because I reworked the box comment procedure,
to modify text files as large as 10MB, then write the result to file. Changed the memory management
to calculate required output buffer size by using the number of lines to be printed times the length
of the longest line, plus the overhead for writing the box style border itself. I checked and rechecked
the source code. When printing to file it works fine. (and using 13,10 as line terminator)

But when I rebuild the plugin, it works okay once (sometimes) but crashes qeditor after multiple uses.
I checked and double checked that all memory used, including the tokenizer array memory has been
properly freed.

I am still working on it and will post either a working version, or the results of the full rebuild.
« Last Edit: July 20, 2018, 02:30:44 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #17 on: September 23, 2015, 09:06:49 PM »
Okay. I have written a little test piece, to test the Box Comment procedures.
It reads 'windows.inc' (what else??) and writes back to a file 'TestBoxComment.txt'

The methods used are all okay, and working properly in this test piece.

Now to transfer it to a (hopefully) working plugin.

Anyway, here is the test piece for the 'Box Comment' procedures...

btw, windows.inc (masm32 sdk version 10) expands to a little over 6 MB with the
formatted box around it  :shock:

One thing about BoxComment:
It does not retain the formatting of the original, I think this is due to
the tokenizer used. It removes leading spaces, and empty lines.
I might have to roll my own.  8)

Removed attachment as it is no longer needed.
« Last Edit: July 20, 2018, 02:31:08 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Rewrite of BoxComment
« Reply #18 on: September 23, 2015, 10:27:22 PM »
Another total rewrite of the 'BoxComment' plugin.

After thorough testing with the testbed posted above, I am 99.9% certain that the problems
are not due to the plugin procedures.

Here I have written from scratch (again) two versions of the 'Box Comment' plugin.
They both work fine for one or two times. Usually on the third round, qeditor crashes.

Thinking that changing to the other plugin interface might change matters, I wrote
a plugin using that interface.


« Last Edit: July 20, 2018, 02:31:33 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #19 on: September 23, 2015, 10:35:07 PM »
.... continuation of above post

version 2 coded with the newer plugin interface

Code: [Select]

 

If you download and tried to use the attached plugins

YOU ARE USING THEM AT YOUR OWN RISK!
See above three posts regarding the still unfound bugs!

Attachments removed as they are no longer needed - this particular bug has been fixed.
« Last Edit: July 20, 2018, 02:32:00 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Box Comment plugin - Fixed!!
« Reply #20 on: September 25, 2015, 12:50:26 AM »
Box Comment plugin - Fixed!!

I found the bug that was plaguing this plugin.

It was not my code, or the plugin interface or qeditor itself.

It was the tokenizer.

I knew that the tokenizer in masm32.lib was inadequate for the purposes of this
plugin. It removes leading spaces and empty lines. Thereby discarding all formatting.

So, I wrote a tokenizer that retained the leading spaces and empty lines.

After many test runs with the custom tokenizer, I can safely say that this
plugin is now 99.5% bug-free (still .5% doubt, as many things can go awry).

I have even Box commented large files such as windows.inc (favorite guinea pig)
and no problems.

Also I reinstated the UNDO feature for this plugin.




Attachment removed as it is no longer needed.
The final version of 'Box Comment' qe plugin is attached two posts down
Source code included in that attachment


Box Comment Final
« Last Edit: July 20, 2018, 02:33:10 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5899
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Automated Plugin Builder plugin for qe
« Reply #21 on: September 25, 2015, 01:48:30 AM »
Z,

Here is a tokeniser that does not strip leading white space or empty lines. Its in its own test piece.


; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                    include \masm32\include\masm32rt.inc
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

comment * -----------------------------------------------------
                        Build this  template with
                       "CONSOLE ASSEMBLE AND LINK"
        ----------------------------------------------------- *

    line_tokeniser PROTO :DWORD
    get_lcnt       PROTO :DWORD

    .data
      caesar \
      db "Friends, Romans, countrymen, lend me your ears;",13,10
      db "    I come to bury Caesar, not to praise him.",13,10,13,10
      db "    The evil that men do lives after them;",13,10
      db "The good is oft interred with their bones;",13,10,0

      ptxt dd caesar

    .code

start:
   
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    call main
    print chr$(13,10)
    inkey "Thats all folks, press a key to exit..."
    exit

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

main proc

    LOCAL pMem  :DWORD
    LOCAL lcnt  :DWORD

    mov pMem, rv(line_tokeniser,ptxt)   ; tokenise text
    mov lcnt, ecx                       ; save the line count

    push esi
    push edi

    mov esi, pMem                       ; load array into ESI
    mov edi, lcnt                       ; use EDI as the counter

  @@:
    print [esi],13,10                   ; display each line of text
    add esi, 4                          ; increment to next pointer
    sub edi, 1                          ; dec the counter
    jnz @B                              ; loop back if not zero

    pop edi
    pop esi

    free pMem                           ; release memory from tokeniser

    ret

main endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

line_tokeniser proc src:DWORD

  ; ---------------------------------------------------
  ; tokeniser for CRLF delimited text
  ; ---------------------------------------------------
  ; replaces the ascii 13 with zero and writes apointer
  ; to the allocated memory as an array of pointers
  ; return value in EAX = pointer array address
  ; return value in ECX = the line count
  ; array address must be de-allocated using
  ; GlobalFree() or the macro "free".
  ; ---------------------------------------------------

    LOCAL lcnt :DWORD
    LOCAL pMem :DWORD
    LOCAL alen :DWORD

    push src
    call get_lcnt               ; get the line count
    mov lcnt, eax               ; store line count in variable
    lea eax, [eax*4]            ; set pointer array length
    mov alen, eax               ; store the array size in alen

    mov pMem, alloc(alen)       ; allocate the pointer array

    mov edx, src                ; source address in ESI
    mov ecx, pMem               ; pointer array address in EBX

    mov [ecx], edx              ; load array address into 1st member of array
    add ecx, 4
    sub edx, 1

  lbl1:
    add edx, 1
    movzx eax, BYTE PTR [edx]   ; zero extend byte into EAX
    test eax, eax               ; test for zero
    jz lbl2                     ; exit loop on zero
    cmp eax, 13                 ; test for ascii 13
    jne lbl1                    ; short loop back if not 13

    mov BYTE PTR [edx], 0       ; write terminator at ascii 13 location
    add edx, 2                  ; step over ascii 13 and 10
    mov [ecx], edx              ; write the next line start to pointer
    add ecx, 4                  ; increment to next pointer
    jmp lbl1                    ; long loop after writing pointer

  lbl2:
    mov ecx, lcnt               ; return the line count in ECX
    mov eax, pMem               ; the array pointer in EAX

    ret

line_tokeniser endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

get_lcnt proc src:DWORD

  ; --------------------------------------
  ; count ascii 13 to determine line count
  ; --------------------------------------
    mov edx, [esp+4]                    ; the source address
    sub edx, 1
    xor eax, eax
    jmp lbl1

  pre:
    add eax, 1                          ; increment the counter
  lbl1:
  ; -----------
  ; unroll by 4
  ; -----------
    add edx, 1
    movzx ecx, BYTE PTR [edx]
    cmp ecx, 13
    je pre
    test ecx, ecx
    jz lbl2

    add edx, 1
    movzx ecx, BYTE PTR [edx]
    cmp ecx, 13
    je pre
    test ecx, ecx
    jz lbl2

    add edx, 1
    movzx ecx, BYTE PTR [edx]
    cmp ecx, 13
    je pre
    test ecx, ecx
    jz lbl2

    add edx, 1
    movzx ecx, BYTE PTR [edx]
    cmp ecx, 13
    je pre
    test ecx, ecx
    jnz lbl1

  lbl2:
    ret 4

get_lcnt endp

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

end start

hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #22 on: September 25, 2015, 01:56:54 AM »
hi hutch. Yes I have seen that elsewhere in the forum.

I should add that to one of my libraries. How does it time compared to masm32.lib ltok?


Later... I made the line counter faster :)

modified get_lcnt
195
195
195
195
195
195
195
195
195
196

hutch get_lcnt
222
221
221
222
222
223
224
223
223
224


modified get_lcnt :biggrin:


Code: [Select]
align 16
nop
nop ; ----------------------------------; padding to align inner loop
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

z_lcnt proc src:DWORD
  ; --------------------------------------
  ; count ascii 13 to determine line count
  ; --------------------------------------
    mov edx, [esp+4]                    ; the source address
    sub edx, 1
    xor eax, eax
    jmp lbl1
pre:
    add eax, 1                          ; increment the counter
lbl1:                                   ; innermost loop align to 16
    repeat 7 ; as long as the longest jump is less than 80 bytes --> unroll more :)
    add edx, 1
    movzx ecx, BYTE PTR [edx]
    cmp ecx, 13
    je pre
    test ecx, ecx
    jz lbl2
    endm
    add edx, 1
    movzx ecx, BYTE PTR [edx]
    cmp ecx, 13
    je pre
    test ecx, ecx
    jnz lbl1
  lbl2:
    ret 4
z_lcnt endp
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef



« Last Edit: September 25, 2015, 05:49:36 AM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #23 on: September 25, 2015, 04:56:13 AM »
The Box Comment plugin is now finished.


It properly retains all formatting.

Code: [Select]
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;                               ;;
    ;;      ;;;;;;;;;;;;;;;;;;;      ;;
    ;;      ;;               ;;      ;;
    ;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;
    ;;  ;;                       ;;  ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                       ;;
;;  ;;  ;;  ;;  hello world  ;;  ;;  ;;  ;;
;;                                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;  ;;                       ;;  ;;
    ;;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;
    ;;      ;;               ;;      ;;
    ;;      ;;;;;;;;;;;;;;;;;;;      ;;
    ;;                               ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   8)




Box Comment Final
« Last Edit: July 20, 2018, 02:34:03 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #24 on: September 25, 2015, 07:00:42 AM »
I plan a major rewrite of the Plugin Builder. It will offer the user more options when creating a new plugin. Right now, the PB (PluginBuilder) automatically copies the plugin into a folder named
'plugins' in masm32s' directory. Also it automatically creates an entry in the 'menus.ini. file.

Those options will still be present, plus I wll give the option to also not copy the plugin to the plugins folder, or to copy it to somewhere else. Also, the PB will detect which drive(s) you have masm32 installed on - then ask which installation should receive the plugin, and menu entry.

Also certain internal features will be completely rebuilt. I will ensure that the new PluginBuilder is compatible with existing plugin snippets.

It will just take some tome to get everything together and working well enough to post it.

zedd.

« Last Edit: July 21, 2018, 04:18:56 PM by zedd151 »
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #25 on: April 15, 2018, 02:43:58 AM »
Just dusting the cobwebs off to ask  thread pertinent question...

I admit I hadn't kept up with the latest developments with Masm64 and/or QE64

Is there still plugin capability in QE for 64 bits ???
hutch??

zedd

Keeping in mind I dont have the capability to download and see masm64 for myself (no ' puter just yet)
Just want to know for when that time comes.   :bgrin:
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #26 on: April 19, 2018, 02:25:02 AM »
Just answered my own question by downloading and looking through the 64 bit SDK.  Sadly, no plugins folder and therefore no plugin support.   :(

Possible to be added in the future? hutch--??
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5899
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Automated Plugin Builder plugin for qe
« Reply #27 on: April 19, 2018, 03:10:16 AM »
Z,

QE is a 32 bit MASM app, just use the normal plugin design.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #28 on: May 27, 2018, 07:39:31 PM »
I am currently working on a rewrite for my Plugin Builder DLL. The reason for this is that it crashed QE last week.   :shock:
Not 100% sure if it was the builder or the plugin itself.  But I decided to make a more modern version of the plugin builder.

Found there was a slight bug in the design that apparently hadn't presented itself until recently.


Also,  I plan on recreating some of my lost plugins - for which I no longer have the sources for. I have a general idea for about a dozen of them.  But as it was almost three years ago,  the new plugins may or may not function as the originals.

If anyone has any of the plugin sets (other than currently attached in this thread)  I would appreciate if you could get in contact with me by PM.  I used to have a link in my signature to the hosting site,  and can no longer retrieve my works. IIRC,  there were
4 plugin sets in total.  Probably in the range of 25 - 30 plugins.
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

zedd151

  • Member
  • ****
  • Posts: 850
Re: Automated Plugin Builder plugin for qe
« Reply #29 on: July 21, 2018, 01:05:30 PM »
I am currently trying to track down the bug that is plaguing the PluginBuilder DLL. If I cannot find and fix it, a brand new version will be coming soon.


It will be much the same style, select the code you wish to transform into a plugin, and the PluginBuilder will automatically create your plugin and all plugin project files, then copy the plugin to the masm32 plugins folder, and write a 'menus.ini' entry for the newly created plugin.


The old PluginBulder version 4 still works (does everything advertised), but crashes QE just before exit.  :(


I wonder what version of QE I originally designed the PluginBuilder for. It was only three years ago, but I may not have had the same QE version then as I do now.
I'm not always the sharpest knife in the drawer, but I have my moments.  :P