![]() ![]() Nodes describing the path from the tree root to the current node. not necessarily an integer).įor example, in the case of tree traversal, the index might return an array of Note that index could be designed to return an arbitrary type (i. Create ( A ) end var s : UTF8String ch : UTF8Char i : Integer begin // Inefficient, as discussed above for i := 1 to Length ( s ) do Writeln ( i, ': ', ch ) // Ok, but ugly i := 1 for ch in s do begin Writeln ( i, ': ', ch ) Inc ( i ) end // Proposed extension for ch in s index i do Writeln ( i, ': ', ch ) // Proposed extension for traversing backwards (equivalent to downto) for ch in reverse s do Writeln ( i, ': ', ch ) // With proposed index extension for ch in reverse s index i do Writeln ( i, ': ', ch ) end. On FPC we recently got a bug report about Delphi-compatible code not compiling correctly due to the types Graphics.TColor (or more precisely GraphTypes.Color) and being different from. Type TUTF8StringEnumerator = class private FByteIndex : Integer FCharIndex : Integer public constructor Create ( const A : UTF8String ) function Current : UTF8Char function CurrentIndex : Integer function MoveNext : Boolean end operator GetEnumerator ( A : UTF8String ) : TUTF8StringEnumerator begin Result := TUTF8String. This is enabled by the use of the enumerator modifier, with the syntax 'enumerator MoveNext ' and 'enumerator Current ' modifiers. ![]() With FPC you can choose whatever names you wish. some graphics.pas functions are bug traps, always because of semantics: they are called function xxxRGByyyy(R, G, B: Byte): TThis, eg function RGBToColor(R, G, B: Byte): TColor (the naming \ order of parameters is also a trap). In Delphi you must use a function with the name 'MoveNext' and a property with the name 'Current' in enumerators. the TColor type could have a synonym named TBGRColor for exemple (but it's falsely clever, right). FormCreate ( Sender : TObject ) var s, ch : UTF8String i : SizeInt begin s := 'mäßig' // using UTF8Length and UTF8Copy this way is slow, requiring O(n)^2 for i := 1 to UTF8Length ( s ) do writeln ( 'ch=', UTF8Copy ( s, i, 1 )) // using the above enumerator is shorter and quite fast, requiring O(n) for ch in s do writeln ( 'ch=', ch ) end Using any identifiers instead of builtin MoveNext and Current The following code gives this: Solution I. Color : not Pen.Color ( Delphi and Free Pascal also support a direct field syntax - property Color: TColor read FColor write SetColor or property. I suggest to merge this to Lazarus 2.2.0 as well as in my opinion this is a bugfix.Program tempcopy procedure TForm1. So my read of tcolorbox is that it is more sophisticated and respects heading settings. I've since solved the TColor issue in System.UITypes for both 3.3.1 and 3.2.3 thus Lazarus can now safely alias the types as well for 3.2.4 and newer which I did in this merge request (I've not picked 3.2.3 as well cause I don't know your stance regarding the fixes version for FPC only the latest 3.2.3 commit is considered “supported”). However with the System.UITypes unit provided by FPC 3.2.0 and 3.2.2 this is not possible to use, because TColor was declared as an alias of LongInt which is different from how TColor is declared in Lazarus (and Delphi) - most importantly of which is that the later is distinct from LongInt. Nu mc Compile/Destination (ni t chng trnh ch, tc l chng trnh c dch ghi trong tp cng tn vi chng trnh ngun nhng c phn m rn. In Delphi Graphics.TColor is an alias of which solves this problem. ![]() On FPC we recently got a bug report about Delphi-compatible code not compiling correctly due to the types Graphics.TColor (or more precisely GraphTypes.Color) and being different from one another ( /fpc/source#39432 (closed) ).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |