|
@@ -2,11 +2,6 @@ program testobj3;
|
|
uses
|
|
uses
|
|
Objects;
|
|
Objects;
|
|
|
|
|
|
-function GetRefCount(const S: RawByteString): SizeInt;
|
|
|
|
-begin
|
|
|
|
- GetRefCount:=PSizeInt(PByte(S)-2*SizeOf(SizeInt))^;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure Error(ErrNo: Integer);
|
|
procedure Error(ErrNo: Integer);
|
|
begin
|
|
begin
|
|
Writeln('Error! ', ErrNo);
|
|
Writeln('Error! ', ErrNo);
|
|
@@ -25,21 +20,22 @@ begin
|
|
S[3] := 'l';
|
|
S[3] := 'l';
|
|
S[4] := 'l';
|
|
S[4] := 'l';
|
|
S[5] := 'o';
|
|
S[5] := 'o';
|
|
- if GetRefCount(S)<>1 then
|
|
|
|
|
|
+ writeln(stringrefcount(s));
|
|
|
|
+ if stringrefcount(S)<>1 then
|
|
Error(1);
|
|
Error(1);
|
|
coll := New(PRawByteStringCollection, Init(100, 100));
|
|
coll := New(PRawByteStringCollection, Init(100, 100));
|
|
coll^.AtInsert(0, S);
|
|
coll^.AtInsert(0, S);
|
|
- if GetRefCount(S)<>2 then
|
|
|
|
|
|
+ if stringrefcount(S)<>2 then
|
|
Error(2);
|
|
Error(2);
|
|
S2 := RawByteString(coll^.At(0));
|
|
S2 := RawByteString(coll^.At(0));
|
|
- if GetRefCount(S)<>3 then
|
|
|
|
|
|
+ if stringrefcount(S)<>3 then
|
|
Error(3);
|
|
Error(3);
|
|
if S2<>'Hello' then
|
|
if S2<>'Hello' then
|
|
Error(4);
|
|
Error(4);
|
|
if RawByteString(coll^.At(0))<>'Hello' then
|
|
if RawByteString(coll^.At(0))<>'Hello' then
|
|
Error(5);
|
|
Error(5);
|
|
Dispose(coll, Done);
|
|
Dispose(coll, Done);
|
|
- if GetRefCount(S)<>2 then
|
|
|
|
|
|
+ if stringrefcount(S)<>2 then
|
|
Error(6);
|
|
Error(6);
|
|
end;
|
|
end;
|
|
|
|
|