y := yptr^+miny;
//prevx := x;
//prevy := y;
- {$IF DEFINED(D2F_DEBUG)}
- if hopt then
- begin
- if (y <> ay0) then raise Exception.Create('htrace fatal internal error');
- end
- else
- begin
- if (x <> ax0) then raise Exception.Create('vtrace fatal internal error');
- end;
- {$ENDIF}
while (wklen > 0) do
begin
{$IF DEFINED(D2F_DEBUG)}
if dbgShowTraceLog then e_LogWritefln('optimized htrace; wklen=%d', [wklen]);
{$ENDIF}
ga := (yptr^ div tsize)*gw+(xptr^ div tsize);
- {$IF DEFINED(D2F_DEBUG)}
- if hopt then
- begin
- if (yptr^ <> ay0) then raise Exception.Create('htrace fatal internal error');
- end
- else
- begin
- if (xptr^ <> ax0) then raise Exception.Create('vtrace fatal internal error');
- end;
- {$ENDIF}
while (wklen > 0) do
begin
{$IF DEFINED(D2F_DEBUG)}
mEntries: TEntryArray;
mFirstEntry, mLastEntry, cur: Integer;
public
- constructor Create (aents: TEntryArray; afirst, alast: Integer);
+ constructor Create (const aents: TEntryArray; afirst, alast: Integer);
function MoveNext (): Boolean; inline;
function getCurrent (): ValueT; inline;
property Current: ValueT read getCurrent;
mEntries: TEntryArray;
mFirstEntry, mLastEntry, cur: Integer;
public
- constructor Create (aents: TEntryArray; afirst, alast: Integer);
+ constructor Create (const aents: TEntryArray; afirst, alast: Integer);
function MoveNext (): Boolean; inline;
function getCurrent (): KeyT; inline;
property Current: KeyT read getCurrent;
mEntries: TEntryArray;
mFirstEntry, mLastEntry, cur: Integer;
public
- constructor Create (aents: TEntryArray; afirst, alast: Integer);
+ constructor Create (const aents: TEntryArray; afirst, alast: Integer);
function MoveNext (): Boolean; inline;
function getCurrent (): PEntry; inline;
property Current: PEntry read getCurrent;
// ////////////////////////////////////////////////////////////////////////// //
-constructor THashBase.TValEnumerator.Create (aents: TEntryArray; afirst, alast: Integer);
+constructor THashBase.TValEnumerator.Create (const aents: TEntryArray; afirst, alast: Integer);
begin
mEntries := aents;
mFirstEntry := afirst;
// ////////////////////////////////////////////////////////////////////////// //
-constructor THashBase.TKeyEnumerator.Create (aents: TEntryArray; afirst, alast: Integer);
+constructor THashBase.TKeyEnumerator.Create (const aents: TEntryArray; afirst, alast: Integer);
begin
mEntries := aents;
mFirstEntry := afirst;
// ////////////////////////////////////////////////////////////////////////// //
-constructor THashBase.TKeyValEnumerator.Create (aents: TEntryArray; afirst, alast: Integer);
+constructor THashBase.TKeyValEnumerator.Create (const aents: TEntryArray; afirst, alast: Integer);
begin
mEntries := aents;
mFirstEntry := afirst;
generic TSimpleList<ItemT> = class
private
type PItemT = ^ItemT;
+ type TItemArr = array of ItemT;
public
type
TEnumerator = record
private
- mItems: PItemT;
+ mItems: TItemArr;
mCount: Integer;
mCurrent: Integer;
public
- constructor Create (aitems: PItemT; acount: Integer);
+ constructor Create (const aitems: TItemArr; acount: Integer);
function MoveNext: Boolean;
function getCurrent (): ItemT;
property Current: ItemT read getCurrent;
end;
private
- mItems: array of ItemT;
+ mItems: TItemArr;
mCount: Integer; // can be less than `mItems` size
private
// ////////////////////////////////////////////////////////////////////////// //
-constructor TSimpleList.TEnumerator.Create (aitems: PItemT; acount: Integer);
+constructor TSimpleList.TEnumerator.Create (const aitems: TItemArr; acount: Integer);
begin
mItems := aitems;
- mCount := acount;
mCurrent := -1;
+ mCount := acount;
end;
function TSimpleList.TEnumerator.MoveNext: Boolean;
function TSimpleList.GetEnumerator (): TEnumerator;
begin
- if (Length(mItems) > 0) then result := TEnumerator.Create(@mItems[0], mCount)
+ if (Length(mItems) > 0) then result := TEnumerator.Create(mItems, mCount)
else result := TEnumerator.Create(nil, -1);
end;