* 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']; Procedure fpc_AnsiStr_Decr_Ref (Var S : Pointer); [external name 'FPC_ANSISTR_DECR_REF'];
{$endif hascompilerproc} {$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 Begin
If S=Nil then If S=Nil then
exit; exit;
@ -146,7 +150,7 @@ end;
{$ifdef hascompilerproc} {$ifdef hascompilerproc}
{ also define alias which can be used inside the system unit } { 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} {$endif hascompilerproc}
Procedure fpc_AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer);[Public,Alias:'FPC_ANSISTR_ASSIGN']; {$ifdef hascompilerproc} compilerproc; {$endif} Procedure fpc_AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer);[Public,Alias:'FPC_ANSISTR_ASSIGN']; {$ifdef hascompilerproc} compilerproc; {$endif}
@ -797,7 +801,11 @@ end;
{ {
$Log$ $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) * fixed bug in fpc_char_to_ansistr when converting #0 (found by Peter)
Revision 1.22 2001/11/17 23:58:12 florian 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; function fpc_dynarray_high(p : pointer) : tdynarrayindex; compilerproc;
procedure fpc_dynarray_clear(var p : pointer;ti : pointer); 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_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; procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
dimcount : dword;dims : pdynarrayindex); compilerproc; dimcount : dword;dims : pdynarrayindex); compilerproc;
function fpc_dynarray_copy(var p : pointer;ti : pointer; 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; 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_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; Procedure fpc_AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
function fpc_AnsiStr_Concat (const S1,S2 : AnsiString): AnsiString; compilerproc; function fpc_AnsiStr_Concat (const S1,S2 : AnsiString): AnsiString; compilerproc;
{$ifdef EXTRAANSISHORT} {$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_ansistr_Unique(Var S : AnsiString); compilerproc;
Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); 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_WideStr_To_ShortStr (high_of_res: longint;const S2 : WideString): shortstring; compilerproc;
Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc; Function fpc_ShortStr_To_WideStr (Const S2 : ShortString): WideString; compilerproc;
Function fpc_WideStr_To_AnsiStr (const S2 : WideString): AnsiString; 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_is(aclass : tclass;aobject : tobject) : boolean; compilerproc;
function fpc_do_as(aclass : tclass;aobject : tobject): tobject; compilerproc; function fpc_do_as(aclass : tclass;aobject : tobject): tobject; compilerproc;
procedure fpc_intf_decr_ref(var i: pointer); 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_assign(var D: pointer; const S: pointer); compilerproc;
procedure fpc_intf_as(var D: pointer; const S: pointer; const iid: TGUID); 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$ $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 * fpc_finalize_array renamed
Revision 1.14 2002/04/21 18:56:59 peter 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']; procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer); [external name 'FPC_DYNARRAY_DECR_REF'];
{$endif} {$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 var
realp : pdynarray; realp : pdynarray;
begin begin
@ -115,7 +115,7 @@ procedure fpc_dynarray_incr_ref(var p : pointer);[Public,Alias:'FPC_DYNARRAY_INC
{$ifdef hascompilerproc} {$ifdef hascompilerproc}
{ provide local access to dynarr_decr_ref for dynarr_setlength } { 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} {$endif}
{ provide local access to dynarr_setlength } { provide local access to dynarr_setlength }
@ -261,7 +261,11 @@ function fpc_dynarray_copy(var p : pointer;ti : pointer;
{ {
$Log$ $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 * updated for dynarr:=nil
Revision 1.14 2001/12/29 15:51:11 jonas Revision 1.14 2001/12/29 15:51:11 jonas

View File

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

View File

@ -67,7 +67,7 @@
{$endif hascompilerproc} {$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 begin
if assigned(i) then if assigned(i) then
IUnknown(i)._AddRef; IUnknown(i)._AddRef;
@ -75,7 +75,7 @@
{$ifdef hascompilerproc} {$ifdef hascompilerproc}
{ local declaration of intf_incr_ref for local access } { 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} {$endif hascompilerproc}
procedure fpc_intf_assign(var D: pointer; const S: pointer);[public,alias: 'FPC_INTF_ASSIGN']; {$ifdef hascompilerproc} compilerproc; {$endif} procedure fpc_intf_assign(var D: pointer; const S: pointer);[public,alias: 'FPC_INTF_ASSIGN']; {$ifdef hascompilerproc} compilerproc; {$endif}
@ -696,7 +696,11 @@
{ {
$Log$ $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 * don't crash everything if the class allocation failed
Revision 1.18 2001/12/26 21:03:56 peter 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']; Procedure fpc_WideStr_Decr_Ref (Var S : Pointer);[external name 'FPC_WIDESTR_DECR_REF'];
{$endif compilerproc} {$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 Begin
If S=Nil then If S=Nil then
exit; exit;
@ -845,7 +849,11 @@ end;
{ {
$Log$ $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 * converted adding/comparing of strings to compileproc. Note that due
to the way the shortstring helpers for i386 are written, they are to the way the shortstring helpers for i386 are written, they are
still handled by the old code (reason: fpc_shortstr_compare returns still handled by the old code (reason: fpc_shortstr_compare returns