News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Another minor tweak to QE.

Started by hutch--, March 30, 2006, 02:22:00 PM

Previous topic - Next topic

hutch--

I have had the code around for a while but had to get round to putting it into QE. I have added the whole word replace option for the replace dialog and it seems to be working OK here at the moment. I also have a whole word replace algo floating around that bypasses quoted text if anyone thinks it would be useful. Its main use is in processing code but it could be useful in some contexts.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zooba

An 'Ignore Quoted Text' and maybe an 'Ignore Commented Text' option as well could be very useful.

What characters are interpreted as end of words?

Cheers,

Zooba

hutch--

zooba,

This is the actual character table I use and its a normal acceptable character table.


  chtbl:
    ! db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    ! db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0     ' 31
    ! db 0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0     ' 47
    ! db 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1     ' 63   ' numbers
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ' 79   ' upper case
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ' 95
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ' 111  ' lower case
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1     ' 127
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
    ! db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1


I have another version of the whole word replace algo that also tests normal double quotes but it may be a bit too fusy for general purpose text in that it branches on the first quote and does not return until the next quote unless it finds the terminator so if someone for some reason had one double quote that was not followed by another, it would return an error on the zero.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zooba

So if I'm reading that right, the characters are:

' ', '"', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?'

In terms of code, returning at the next EOL would sense. Free text might not respond as well to that rule, but that isn't what QEditor is designed for :bg

hutch--

zooba,

I just added the extra algo and changed the dialog interface so it was tidier. See what you think of this layout.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zooba

Only had time for one quick test, which failed because underscores aren't included as a word separator :P

Dialog interface looks nice, though personally I'd put each option one above the other. BTW, you don't happen to have an algo for regular replace excluding quoted text? It would be nice to have checkboxes for each option. I can roll you an algo if you like (the current ones would be helpful if there's no copyrights involved) :U

Cheers,

Zooba

hutch--

The problem with using an underscore as a seperator is that it excludes a whole list of windows style names like the WM_XXXX messages and programmers regularly name functions using an underscore.

The basic function I used was the masm32 library function,


wordreplace proc src:DWORD,dst:DWORD,wrd1:DWORD,wrd2:DWORD


in the library module "wordrep.asm". I ported it directly to PowerBASIC but modified it with an internal buffer to allow for replacement words that are longer than the source word. Basic uses OLE string memory so its easy to allocate an internal buffer to receive the results and return its handle as the return string. To do it directly in MASM, it would commit the algo to one memory allocation strategy to use the same technique.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php