[Lazarus] unit Masks vs. unit FPMasks

José Mejuto joshyfun at gmail.com
Wed Feb 24 14:22:17 CET 2021

El 24/02/2021 a las 13:31, Juha Manninen via lazarus escribió:


>     I was thinking in import the NTFS (the filesystem) case comparison
>     tables which are 128 KB "only".
> That is not necessary.
> LazUTF8 has functions like UTF8CompareText(), UTF8CompareTextP() and the 

The code was originally designed to be fpc only, not Lazarus libs (even 
when compatibles with console apps).

> Your code does not compile when RANGES_AUTOREVERSE is not defined.
> cMask is not found.
> The reverse logic can be enabled by default. It does not break anybody's 
> masks as I understand it. Earlier it was an error, now it does something 
> sensible.

Probably cMask falls by error inside one $IFDEF, I'll check but must be 
a trivial error.

>     Also there is the support (also can be disabled) for the mask "[?]"
>     which is the counterpart for "*" but with one char position.
> Where did you get this "[?]" syntax? There must be a reference 
> documentation somewhere but I have not seen it.
> What is the difference between "?" and "[?]" ?

Wildcards except "*" and "?" do not have any kind of standard reference, 
some use "[]" others "{}", some negate with "!", others with "^", some 
ranges using "-" others "<", there is a jungle of widcards.

In the develop of the Windows matching I found that there is no option 
for zero or one char which is needed in the Windows matching, so started 
to googling about and find some that uses the "?" inside brackets to 
notate the zero or one and it is compatible with the idea of ranges and 
charsets, so used it.

The difference is:

?   = 1 char
[?] = 1 or 0 chars.

??   = 2 chars
[??] = 0,1 or 2 chars

In the DOS/Windows world (behaviour, not syntax) it is used like:

File name: "test.txta"
DOS mask: "test.txt?"
Match: True

File name: "test.txt"
DOS mask: "test.txt?"
Match: True

Also in the code I have added the escape character "\" (also selectable 
use or not) to allow string matching of stars, question mark, brackets, 
etc. characters. As other wildcards there is no standard character 
and/or behaviour.

Have a nice day.


More information about the lazarus mailing list