Re: [Lazarus] TMask revisited

2021-10-15 Thread DougC via lazarus
Shouldn't the mask "*.pas*" be used to match file.pas.bak ? If so, the old code 
and new code are ok.



Doug C.






 On Fri, 15 Oct 2021 17:09:03 -0400 Bart via lazarus 
 wrote 


On Fri, Oct 15, 2021 at 2:38 PM Maxim Ganetsky via lazarus
 wrote:

> Please try with, for example bla.pas and bla.pas.bak files.

Mask: *.pas;*.pp;*.inc
Filename: file.pas.bak
Result: does not match, both in the old code and the new code.

-- 
Bart
-- 
___
lazarus mailing list
mailto:lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Bart via lazarus
On Fri, Oct 15, 2021 at 1:55 AM Juha Manninen via lazarus
 wrote:

>
> On Thu, Oct 14, 2021 at 7:57 PM Bart via lazarus 
>  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.

Please do.
But, also feel free to deprecate them.

>> Noticable the ability to NOT interpret [] as a set in the mask has now
>> disappeared.
>
>
> How should a range / set [] be interpreted?

??
[az] is interpreted as either a or z by default
Diasbling use of sets would interpret this as literally [az] (4 chars).

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

OK.

>> 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.

I agree about the limited part.
Not many bugs were filed against asks unit, and I did not encounter
them, but my locale is Ducth and the ocaasional non-ascii I happen to
have in my filenames all process correctly.

> 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.

I'll have a look.


> 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]".

Why a define?
Shouldn't that better be configurable at runtime?


>> 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.

I tested it now, and by default it returns fals for those cases.

> Yes it is counter-intuitive but it matches with Windows' behavior.
> You can test it on a DOS/Windows cmd prompt.

file?.txt matches file.txt and file1.txt, but not file12.txt, so ? as
last char before . is treated as no or 1 character.

> 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.
Yes it can, but it was desigend for filemasks (see the original
parameter names).

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

Thank you.

I did not study th enre code at length, but it looks quite a bit more
complicated to me than the old one.
Not sure if I will be able to contribute to it anymore.


-- 
Bart
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Bart via lazarus
On Fri, Oct 15, 2021 at 2:38 PM Maxim Ganetsky via lazarus
 wrote:

> Please try with, for example bla.pas and bla.pas.bak files.

Mask: *.pas;*.pp;*.inc
Filename: file.pas.bak
Result: does not match, both in the old code and the new code.

-- 
Bart
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Juha Manninen via lazarus
On Fri, Oct 15, 2021 at 3:38 PM Maxim Ganetsky via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Please try with, for example bla.pas and bla.pas.bak files.
>

I did basically that. I copied a .pas file to .pas.bak.
Find in Files does not find extra entries with File mask
"*.pas;*.pp;*.inc;*.lpr;*.lfm"
With File mask "*.pas;*.pp;*.inc;*.lpr;*.lfm;*.bak" they are correctly
found in the .bak file.
Works as expected.

Is the bug you experience caused by my recent unit Masks changes?
Does it depend on OS / Platform?

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Juha Manninen via lazarus
On Fri, Oct 15, 2021 at 3:10 PM Sven Barth via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Non-static class methods *do* have a Self parameter, but it's the class
> type and not the class instance. They can also be virtual, which is a
> really great feature of the Object Pascal language (I often miss that at
> work where I use C++). They are also assignment compatible to method
> variables ("of object").
>
> Static methods on the other hand don't have a Self parameter, can't be
> virtual and are assignment compatible to normal procedure variables.
>

Ok, right.
I confess I never used "static" with class procedures/functions. Thanks for
the info.

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Maxim Ganetsky via lazarus

15.10.2021 02:07, Juha Manninen via lazarus пишет:
On Thu, Oct 14, 2021 at 12:53 AM Maxim Ganetsky via lazarus 
mailto:lazarus@lists.lazarus-ide.org>> 
wrote:


Don't know if it is related but just noticed that `Find in files`
dialog
now "ignores" file masks.

E. g. I have the following file mask: `*.pas;*.pp;*.inc;*.lpr;*.lfm`,
but it also finds (existing) entries in *.bak files, which is not
really
desired.


I cannot reproduce that. No matches in *.bak files here.


Please try with, for example bla.pas and bla.pas.bak files.

--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Sven Barth via lazarus
Juha Manninen via lazarus  schrieb am Fr.,
15. Okt. 2021, 14:03:

> This may be a dummy question but what does "static" do for a class
> procedure?
> José's mask code has for example:
>
>   class procedure Exception_IncompleteMask(); static;
>
> I thought class procedures are kind of static anyways, meaning they don't
> have a Self pointer.
>

Non-static class methods *do* have a Self parameter, but it's the class
type and not the class instance. They can also be virtual, which is a
really great feature of the Object Pascal language (I often miss that at
work where I use C++). They are also assignment compatible to method
variables ("of object").

Static methods on the other hand don't have a Self parameter, can't be
virtual and are assignment compatible to normal procedure variables.

Regards,
Sven

>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Juha Manninen via lazarus
This may be a dummy question but what does "static" do for a class
procedure?
José's mask code has for example:

  class procedure Exception_IncompleteMask(); static;

I thought class procedures are kind of static anyways, meaning they don't
have a Self pointer.

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TMask revisited

2021-10-15 Thread Juha Manninen via lazarus
I restored the backwards compatible TMaskOptions in 04b0a04a45.
Please test.

When ranges (sets) are disabled, [] is interpreted as literal []. Works
perfectly.
Next I will study the little syntax differences. There should be a backwards
compatible option for those, too.

Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus