* updated compilerprocs

* incr ref count has now a value argument instead of var
This commit is contained in:
peter 2002-04-25 20:14:56 +00:00
parent 6fbae3273f
commit 0cdf327866
6 changed files with 72 additions and 41 deletions

View File

@ -135,7 +135,11 @@ end;
Procedure fpc_AnsiStr_Decr_Ref (Var S : Pointer); [external name 'FPC_ANSISTR_DECR_REF'];
{$endif hascompilerproc}
Procedure fpc_AnsiStr_Incr_Ref (Var S : Pointer);[Public,Alias:'FPC_ANSISTR_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
{$ifdef hascompilerproc}
Procedure fpc_AnsiStr_Incr_Ref (S : Pointer);[Public,Alias:'FPC_ANSISTR_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
{$else}
Procedure fpc_AnsiStr_Incr_Ref (Var S : Pointer);[Public,Alias:'FPC_ANSISTR_INCR_REF'];
{$endif}
Begin
If S=Nil then
exit;
@ -146,7 +150,7 @@ end;
{$ifdef hascompilerproc}
{ also define alias which can be used inside the system unit }
Procedure fpc_AnsiStr_Incr_Ref (Var S : Pointer); [external name 'FPC_ANSISTR_INCR_REF'];
Procedure fpc_AnsiStr_Incr_Ref (S : Pointer); [external name 'FPC_ANSISTR_INCR_REF'];
{$endif hascompilerproc}
Procedure fpc_AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer);[Public,Alias:'FPC_ANSISTR_ASSIGN']; {$ifdef hascompilerproc} compilerproc; {$endif}
@ -797,7 +801,11 @@ end;
{
$Log$
Revision 1.23 2002-01-07 13:23:53 jonas
Revision 1.24 2002-04-25 20:14:56 peter
* updated compilerprocs
* incr ref count has now a value argument instead of var
Revision 1.23 2002/01/07 13:23:53 jonas
* fixed bug in fpc_char_to_ansistr when converting #0 (found by Peter)
Revision 1.22 2001/11/17 23:58:12 florian

View File

@ -52,7 +52,7 @@ function fpc_dynarray_length(p : pointer) : tdynarrayindex; compilerproc;
function fpc_dynarray_high(p : pointer) : tdynarrayindex; compilerproc;
procedure fpc_dynarray_clear(var p : pointer;ti : pointer); compilerproc;
procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer); compilerproc;
procedure fpc_dynarray_incr_ref(var p : pointer); compilerproc;
procedure fpc_dynarray_incr_ref(p : pointer); compilerproc;
procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
dimcount : dword;dims : pdynarrayindex); compilerproc;
function fpc_dynarray_copy(var p : pointer;ti : pointer;
@ -66,7 +66,7 @@ Function fpc_Val_UInt_Shortstr(Const S: ShortString; var Code: ValSInt): ValUInt
Function fpc_Val_Real_ShortStr(const s : shortstring; var code : ValSInt): ValReal; compilerproc;
Procedure fpc_AnsiStr_Decr_Ref (Var S : Pointer); compilerproc;
Procedure fpc_AnsiStr_Incr_Ref (Var S : Pointer); compilerproc;
Procedure fpc_AnsiStr_Incr_Ref (S : Pointer); compilerproc;
Procedure fpc_AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
function fpc_AnsiStr_Concat (const S1,S2 : AnsiString): AnsiString; compilerproc;
{$ifdef EXTRAANSISHORT}
@ -88,7 +88,7 @@ Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString):
Procedure fpc_ansistr_Unique(Var S : AnsiString); compilerproc;
Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); compilerproc;
Procedure fpc_WideStr_Incr_Ref (Var S : Pointer); compilerproc;
Procedure fpc_WideStr_Incr_Ref (S : Pointer); compilerproc;
function fpc_WideStr_To_ShortStr (high_of_res: longint;const S2 : WideString): shortstring; compilerproc;
Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
Function fpc_WideStr_To_AnsiStr (const S2 : WideString): AnsiString; compilerproc;
@ -176,7 +176,7 @@ function fpc_mul_int64(f1,f2 : int64;checkoverflow : longbool) : int64; compiler
function fpc_do_is(aclass : tclass;aobject : tobject) : boolean; compilerproc;
function fpc_do_as(aclass : tclass;aobject : tobject): tobject; compilerproc;
procedure fpc_intf_decr_ref(var i: pointer); compilerproc;
procedure fpc_intf_incr_ref(const i: pointer); compilerproc;
procedure fpc_intf_incr_ref(i: pointer); compilerproc;
procedure fpc_intf_assign(var D: pointer; const S: pointer); compilerproc;
procedure fpc_intf_as(var D: pointer; const S: pointer; const iid: TGUID); compilerproc;
@ -256,7 +256,11 @@ Procedure fpc_typed_read(TypeSize : Longint;var f : TypedFile;var Buf); compiler
{
$Log$
Revision 1.15 2002-04-24 16:15:35 peter
Revision 1.16 2002-04-25 20:14:56 peter
* updated compilerprocs
* incr ref count has now a value argument instead of var
Revision 1.15 2002/04/24 16:15:35 peter
* fpc_finalize_array renamed
Revision 1.14 2002/04/21 18:56:59 peter

View File

@ -99,7 +99,7 @@ procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer);[Public,Alias:'FPC
procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer); [external name 'FPC_DYNARRAY_DECR_REF'];
{$endif}
procedure fpc_dynarray_incr_ref(var p : pointer);[Public,Alias:'FPC_DYNARRAY_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
procedure fpc_dynarray_incr_ref(p : pointer);[Public,Alias:'FPC_DYNARRAY_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
var
realp : pdynarray;
begin
@ -115,7 +115,7 @@ procedure fpc_dynarray_incr_ref(var p : pointer);[Public,Alias:'FPC_DYNARRAY_INC
{$ifdef hascompilerproc}
{ provide local access to dynarr_decr_ref for dynarr_setlength }
procedure fpc_dynarray_incr_ref(var p : pointer); [external name 'FPC_DYNARRAY_INCR_REF'];
procedure fpc_dynarray_incr_ref(p : pointer); [external name 'FPC_DYNARRAY_INCR_REF'];
{$endif}
{ provide local access to dynarr_setlength }
@ -261,7 +261,11 @@ function fpc_dynarray_copy(var p : pointer;ti : pointer;
{
$Log$
Revision 1.15 2002-01-21 20:16:08 peter
Revision 1.16 2002-04-25 20:14:56 peter
* updated compilerprocs
* incr ref count has now a value argument instead of var
Revision 1.15 2002/01/21 20:16:08 peter
* updated for dynarr:=nil
Revision 1.14 2001/12/29 15:51:11 jonas

View File

@ -139,34 +139,31 @@ Var Temp : PByte;
begin
Temp:=PByte(TypeInfo);
case temp^ of
{ In case of an ansistring, data is pushed as a var parameter. }
{ This means that if you look at data as a value parameter, it }
{ containst the address of the ansistring. AnsiStr_Incr_Ref also }
{ expects a var parameter, so to pass the address of the }
{ ansistring and not that of the data parameter on the stack, }
{ you have to dereference data (JM) }
tkAstring,tkWstring : fpc_AnsiStr_Incr_Ref(PPointer(Data)^);
tkAstring :
fpc_AnsiStr_Incr_Ref(PPointer(Data)^);
tkWstring :
fpc_WideStr_Incr_Ref(PPointer(Data)^);
tkArray :
begin
Temp:=Temp+1;
I:=temp^;
temp:=temp+(I+1); // skip name string;
Size:=PArrayRec(Temp)^.Size; // get element size
Count:=PArrayRec(Temp)^.Count; // get element Count
TInfo:=PArrayRec(Temp)^.Info; // Get element info
For I:=0 to Count-1 do
int_AddRef (Data+(I*size),TInfo);
Inc(Temp);
I:=temp^;
inc(temp,I+1); // skip name string;
Size:=PArrayRec(Temp)^.Size; // get element size
Count:=PArrayRec(Temp)^.Count; // get element Count
TInfo:=PArrayRec(Temp)^.Info; // Get element info
For I:=0 to Count-1 do
int_AddRef (Data+(I*size),TInfo);
end;
tkrecord :
begin
Temp:=Temp+1;
I:=Temp^;
temp:=temp+(I+1); // skip name string;
Size:=PRecRec(Temp)^.Size; // get record size; not needed.
Count:=PRecRec(Temp)^.Count; // get element Count
For I:=1 to count do
With PRecRec(Temp)^.elements[I] do
int_AddRef (Data+Offset,Info);
Inc(Temp);
I:=Temp^;
temp:=temp+(I+1); // skip name string;
Size:=PRecRec(Temp)^.Size; // get record size; not needed.
Count:=PRecRec(Temp)^.Count; // get element Count
For I:=1 to count do
With PRecRec(Temp)^.elements[I] do
int_AddRef (Data+Offset,Info);
end;
tkDynArray:
fpc_dynarray_incr_ref(PPointer(Data)^,TypeInfo);
@ -196,8 +193,10 @@ begin
Temp:=PByte(TypeInfo);
case temp^ of
{ see AddRef for comment about below construct (JM) }
tkAstring,tkWstring:
tkAstring:
fpc_AnsiStr_Decr_Ref(PPointer(Data)^);
tkWstring:
fpc_WideStr_Decr_Ref(PPointer(Data)^);
tkArray:
begin
inc(Temp);
@ -242,7 +241,11 @@ procedure fpc_finalize_array(data,typeinfo : pointer;count,size : longint); [Pub
{
$Log$
Revision 1.11 2002-04-24 16:15:35 peter
Revision 1.12 2002-04-25 20:14:57 peter
* updated compilerprocs
* incr ref count has now a value argument instead of var
Revision 1.11 2002/04/24 16:15:35 peter
* fpc_finalize_array renamed
Revision 1.10 2001/11/30 16:25:35 jonas

View File

@ -67,7 +67,7 @@
{$endif hascompilerproc}
procedure fpc_intf_incr_ref(const i: pointer);[public,alias: 'FPC_INTF_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
procedure fpc_intf_incr_ref(i: pointer);[public,alias: 'FPC_INTF_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
begin
if assigned(i) then
IUnknown(i)._AddRef;
@ -75,7 +75,7 @@
{$ifdef hascompilerproc}
{ local declaration of intf_incr_ref for local access }
procedure intf_incr_ref(const i: pointer); [external name 'FPC_INTF_INCR_REF'];
procedure intf_incr_ref(i: pointer); [external name 'FPC_INTF_INCR_REF'];
{$endif hascompilerproc}
procedure fpc_intf_assign(var D: pointer; const S: pointer);[public,alias: 'FPC_INTF_ASSIGN']; {$ifdef hascompilerproc} compilerproc; {$endif}
@ -696,7 +696,11 @@
{
$Log$
Revision 1.19 2002-03-30 14:52:59 carl
Revision 1.20 2002-04-25 20:14:57 peter
* updated compilerprocs
* incr ref count has now a value argument instead of var
Revision 1.19 2002/03/30 14:52:59 carl
* don't crash everything if the class allocation failed
Revision 1.18 2001/12/26 21:03:56 peter

View File

@ -190,7 +190,11 @@ end;
Procedure fpc_WideStr_Decr_Ref (Var S : Pointer);[external name 'FPC_WIDESTR_DECR_REF'];
{$endif compilerproc}
Procedure fpc_WideStr_Incr_Ref (Var S : Pointer);[Public,Alias:'FPC_WIDESTR_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
{$ifdef hascompilerproc}
Procedure fpc_WideStr_Incr_Ref (S : Pointer);[Public,Alias:'FPC_WIDESTR_INCR_REF']; {$ifdef hascompilerproc} compilerproc; {$endif}
{$else}
Procedure fpc_WideStr_Incr_Ref (Var S : Pointer);[Public,Alias:'FPC_WIDESTR_INCR_REF'];
{$endif compilerproc}
Begin
If S=Nil then
exit;
@ -845,7 +849,11 @@ end;
{
$Log$
Revision 1.15 2001-08-30 15:43:15 jonas
Revision 1.16 2002-04-25 20:14:57 peter
* updated compilerprocs
* incr ref count has now a value argument instead of var
Revision 1.15 2001/08/30 15:43:15 jonas
* converted adding/comparing of strings to compileproc. Note that due
to the way the shortstring helpers for i386 are written, they are
still handled by the old code (reason: fpc_shortstr_compare returns