[Lazarus] TMask revisited

Juha Manninen juha.manninen62 at gmail.com
Fri Oct 15 01:54:53 CEST 2021


On Thu, Oct 14, 2021 at 7:57 PM Bart via lazarus <
lazarus at lists.lazarus-ide.org> wrote:

> You have changed the existing interface for both TMask and the
> Matches(Windows)Mask(List) functions.
> TMaskOptions has been removed.
>

It can be added for compatibility.


Noticable the ability to NOT interpret [] as a set in the mask has now
> disappeared.
>

How should a range / set [] be interpreted?

This is not some cornercase: Suppose you have files that have
> filenames like foo[1].dat, foo[2].dat etc.
> Now you could specify a mask of 'foo[*].dat' with the moDisableSets
> option set and it would find those files.
> The new implementation won't.
> (This was the usecase of the person who reported the bug for
> TShellListView, which first was hacked by using [[] to mean a single
> '[', but later was properly fixed by adding the TMaskOptions.
>

Now the same thing is done by passing MaskOpCodesDisableRange constant
where type TMaskOpcodesSet parameter is used.
TMaskOptions can be restored for compatibility.


This was discussed at length in february.
>
> Now you're doing it all over again.
> You have sacrificed consistent and reliable behaviour for gain of speed.
>

No Bart, that is not true. This is not *only* about speed. The old Mask was
buggy and limited.
Please run the test project testmasks.lpi. All current tests pass.
Now checkout a revision before my Mask changes, eg. e5ed5082d and run tests
again. Many errors. Notably there was no support for Unicode.

Yes, there should be an option for backwards compatible syntax, like
"[?]" . However the small changes in the syntax can be seen as improvements.
There already is a define for converting "[z-a]" to "[a-z]".


José's code also catered for some odd DOS behaviour where a mask like
>
'file.txt?' actually matches with the filename 'file.txt' and a mask
> 'file?.txt' would match 'file1234.txt' (but not 'file12345.txt').
> That would be rather counter-intuitive to most users.
> I did not test (it was in one of the "quirks" settings) if it behaves
> like this by default, but that should IMHO not be the case.
>

Yes it is counter-intuitive but it matches with Windows' behavior.
You can test it on a DOS/Windows cmd prompt.
That is why it is called TMaskWindows. The normal TMask behaves more
logically.
The "quirks" prove that Jose has tested it a lot.

About the speed: TMask can also be used without disk file operations. Then
the speed matters.
Disk operations are typically slow, yes.

I will look at the compatibility issues and possible bugs tomorrow.

Regards,
Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20211015/69960f70/attachment.html>


More information about the lazarus mailing list