Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-11

[patch] tBits

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dariusz Mazur
Hi
 Here is patch to tBits ans test program.
 Its repair FindnextBit.
 I also introduce FindNextRaw,
 based on it faster version FindNextBit can be done
I can add:
[code]
function  FindFirstBit;
begin
  result:=findNextRaw(-1, state);
end;
function  FindNextBit;
begin
  result:=findNextRaw(findIndex, findState);
end;
[/code]

and can be helpful in enumerator.

With this I have and question:
For me function FindNextRaw should be in protected section But then we cant use them in enumerator, except when something like friend classes can be used in FPC.
I only read about this concept, is it possible/plan in FPC.

Darek

Reply by email

Alexander Klenin
to Dariusz Mazur

2009/11/11 Dariusz Mazur :

Show quoted text 6 lines
 With this I have and question:  For me function FindNextRaw should be in protected section  But then we cant use them in enumerator, except when something like friend classes can be used in FPC.  I only read about this concept, is it possible/plan  in FPC.

If you place enumerators in the same unit as TBits, they will have access to the properted members of TBits.

Alexander S. Klenin

Reply by email

Dariusz Mazur
to Alexander Klenin

Alexander Klenin pisze:

Show quoted text 13 lines
2009/11/11 Dariusz Mazur : > With this I have and question: > For me function FindNextRaw should be in protected section > But then we cant use them in enumerator, except when something like friend > classes can be used in FPC. > I only read about this concept, is it possible/plan in FPC. > If you place enumerators in the same unit as TBits, they will have access to the properted members of TBits.

Ok thx.
But should those enumerators exists in classes ?
How exclude enumerators for older compilers?
What should be done, to submit it to trunk?

Darek

Reply by email

Paul Ishenin
to Dariusz Mazur
Dariusz Mazur wrote
But should those enumerators exists in classes ?

For the basic containers I added enumerators since delphi have them.

How exclude enumerators for older compilers?

?

What should be done, to submit it to trunk?

Usually using bug tracker. But submit what? New enumerators for TBits? Is yes then first let someone else decide (like Michael, Florian).

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 5 lines
Dariusz Mazur wrote: > But should those enumerators exists in classes ? For the basic containers I added enumerators since delphi have them. > How exclude enumerators for older compilers? ?

I think he means that the rtl has to be compilable by the previous release, so you have to exclude any enumerators you add during bootstrapping.

Jonas

Reply by email

Paul Ishenin
to Jonas Maebe
Jonas Maebe wrote
I think he means that the rtl has to be compilable by the previous release, so you have to exclude any enumerators you add during bootstrapping.

Enumerators added using GetEnumerator method can't add problems with compilation. operator Enumerator of course will not compiler.

How this is usually solved? By FPC_HAS_FEATURE_ENUMERATORS ?

Best regards,
Paul Ishenin.

Reply by email

Dariusz Mazur
to Paul Ishenin: For the basic containers I added enumerators since delphi have them. ? Usually using bug…
> What should be done, to submit it to trunk? Usually using bug tracker. But submit what? New enumerators for TBits? Is yes then first let someone else decide (like Michael, Florian).

Sorry for unclear ask.
I don't need submit myself. I want to prepare good patch, which can be submit, but to do this I need know what i'm doing wrong or what should be done more.

Darek

Reply by email

Jonas Maebe
to Paul Ishenin: Enumerators added using GetEnumerator method can't add problems with compilation.…
Paul Ishenin wrote 8 lines
Jonas Maebe wrote: > I think he means that the rtl has to be compilable by the previous > release, so you have to exclude any enumerators you add during > bootstrapping. Enumerators added using GetEnumerator method can't add problems with compilation. operator Enumerator of course will not compiler. How this is usually solved? By FPC_HAS_FEATURE_ENUMERATORS ?

FPC_HAS_FEATURE_* is mainly for things that can be enabled and disabled in the base RTL (such as IO, heap manager, ansistring support etc). Temporary defines for bootstrapping purposes can basically be any define starting with FPC_. Search for "settle" in compiler/ options.pas to see where these are defined.

Jonas

Reply by email

Paul Ishenin
to Jonas Maebe
Jonas Maebe wrote 6 lines
FPC_HAS_FEATURE_* is mainly for things that can be enabled and disabled in the base RTL (such as IO, heap manager, ansistring support etc). Temporary defines for bootstrapping purposes can basically be any define starting with FPC_. Search for "settle" in compiler/options.pas to see where these are defined.

Thanks for explanation. I've added FPC_HAS_OPERATOR_ENUMERATOR define. So RTL can have enumerators defined by operators inside the {$IFDEF FPC_HAS_OPERATOR_ENUMERATOR} blocks.

Best regards,
Paul Ishenin.

Reply by email