소스 검색

* fixed copy(dyn. array,...);

florian 20 년 전
부모
커밋
eeaded577a
6개의 변경된 파일48개의 추가작업 그리고 21개의 파일을 삭제
  1. 2 2
      compiler/msg/errord.msg
  2. 5 1
      compiler/options.pas
  3. 5 1
      compiler/pexpr.pas
  4. 6 15
      compiler/pinline.pas
  5. 9 1
      rtl/inc/compproc.inc
  6. 21 1
      rtl/inc/dynarr.inc

+ 2 - 2
compiler/msg/errord.msg

@@ -1120,7 +1120,7 @@ type_e_wrong_math_argument=04027_E_Unzul
 type_e_no_addr_of_constant=04028_E_Von Konstanten kann keine Adresse bestimmt werden
 % It's not possible to get the address of a constant, because they
 % aren't stored in memory, you can try making it a typed constant.
-type_e_argument_cant_be_assigned=04029_E_Auf das Argument kann nichts zugewiesen werden
+type_e_argument_cant_be_assigned=04029_E_An das Argument kann nichts zugewiesen werden
 % Only expressions which can be on the left side of an
 % assignment can be passed as call by reference argument
 % Remark: Properties can be only
@@ -2464,4 +2464,4 @@ option_help_pages=11025_[
 % parsing the interface part of the unit
 %%% unit_u_start_parse_implementation=10035_U_Parse Implementation-Abschnitt von "$1"
 % When you use the \var{-vu} flag, the compiler warns that it starts
-% parsing the implementation part of the unit
+% parsing the implementation part of the unit

+ 5 - 1
compiler/options.pas

@@ -1782,6 +1782,7 @@ begin
   def_system_macro('SHORTSTRCOMPAREINREG');
   def_system_macro('HASGETHEAPSTATUS');
   def_system_macro('HASGETFPCHEAPSTATUS');
+  def_system_macro('HASFUNCTIONCOPYDYNARR');
 
 { using a case is pretty useless here (FK) }
 { some stuff for TP compatibility }
@@ -2102,7 +2103,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.169  2005-03-04 16:49:22  peter
+  Revision 1.170  2005-03-05 16:37:42  florian
+    * fixed copy(dyn. array,...);
+
+  Revision 1.169  2005/03/04 16:49:22  peter
     * getheapstatus fixes
 
   Revision 1.168  2005/02/26 15:43:09  florian

+ 5 - 1
compiler/pexpr.pas

@@ -1575,6 +1575,7 @@ implementation
            begin
              { we need the resulttype }
              do_resulttypepass(p1);
+
              if codegenerror then
               begin
                 recoverconsume_postfixops;
@@ -2535,7 +2536,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.184  2005-03-04 09:56:35  jonas
+  Revision 1.185  2005-03-05 16:37:42  florian
+    * fixed copy(dyn. array,...);
+
+  Revision 1.184  2005/03/04 09:56:35  jonas
     * fixed Lazarus compilation
 
   Revision 1.183  2005/03/04 07:46:36  jonas

+ 6 - 15
compiler/pinline.pas

@@ -704,7 +704,6 @@ implementation
              end;
 
             { create statements with call }
-            copynode:=internalstatements(newstatement);
 
             if (counter=3) then
              begin
@@ -718,25 +717,14 @@ implementation
                lowppn:=cordconstnode.create(-1,s32inttype,false);
              end;
 
-            { create typed temp for result so the temp is finalized }
-            temp := ctempcreatenode.create(ppn.left.resulttype,ppn.left.resulttype.def.size,tt_persistent,false);
-            addstatement(newstatement,temp);
-
             { create call to fpc_dynarray_copy }
             npara:=ccallparanode.create(highppn,
                    ccallparanode.create(lowppn,
                    ccallparanode.create(caddrnode.create_internal
                       (crttinode.create(tstoreddef(ppn.left.resulttype.def),initrtti)),
                    ccallparanode.create
-                      (ctypeconvnode.create_internal(ppn.left,voidpointertype),
-                   ccallparanode.create
-                      (ctypeconvnode.create_internal(ctemprefnode.create(temp),voidpointertype),nil)))));
-            addstatement(newstatement,ccallnode.createintern('fpc_dynarray_copy',npara));
-
-            { convert the temp to normal and return the reference to the
-              created temp, and convert the type of the temp to the dynarray type }
-            addstatement(newstatement,ctempdeletenode.create_normal_temp(temp));
-            addstatement(newstatement,ctemprefnode.create(temp));
+                      (ctypeconvnode.create_internal(ppn.left,voidpointertype),nil))));
+            copynode:=ccallnode.createinternres('fpc_dynarray_copy',npara,ppn.left.resulttype);
 
             ppn.left:=nil;
             paras.free;
@@ -755,7 +743,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.40  2005-03-03 19:36:42  jonas
+  Revision 1.41  2005-03-05 16:37:42  florian
+    * fixed copy(dyn. array,...);
+
+  Revision 1.40  2005/03/03 19:36:42  jonas
     * fixed web bug 3740
 
   Revision 1.39  2005/02/14 17:13:07  peter

+ 9 - 1
rtl/inc/compproc.inc

@@ -58,7 +58,12 @@ Function  fpc_shortstr_Copy(const s:shortstring;index:SizeInt;count:SizeInt):sho
 Function  fpc_ansistr_Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiString;compilerproc;
 Function  fpc_widestr_Copy (Const S : WideString; Index,Size : SizeInt) : WideString;compilerproc;
 function  fpc_char_copy(c:char;index : SizeInt;count : SizeInt): shortstring;compilerproc;
+{$ifdef HASFUNCTIONCOPYDYNARR}
+function fpc_dynarray_copy(psrc : pointer;ti : pointer;
+    lowidx,count:tdynarrayindex) : pointer;compilerproc;
+{$else HASFUNCTIONCOPYDYNARR}
 procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;lowidx,count:tdynarrayindex);compilerproc;
+{$endif HASFUNCTIONCOPYDYNARR}
 
 function  fpc_dynarray_length(p : pointer) : tdynarrayindex; compilerproc;
 function  fpc_dynarray_high(p : pointer) : tdynarrayindex; compilerproc;
@@ -358,7 +363,10 @@ function fpc_qword_to_double(q: qword): double; compilerproc;
 
 {
   $Log$
-  Revision 1.65  2005-02-14 17:13:22  peter
+  Revision 1.66  2005-03-05 16:37:28  florian
+    * fixed copy(dyn. array,...);
+
+  Revision 1.65  2005/02/14 17:13:22  peter
     * truncate log
 
   Revision 1.64  2005/01/07 21:15:46  florian

+ 21 - 1
rtl/inc/dynarr.inc

@@ -297,12 +297,20 @@ procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
   end;
 
 
+{$ifdef HASFUNCTIONCOPYDYNARR}
 { provide local access to dynarr_copy }
+function int_dynarray_copy(psrc : pointer;ti : pointer;
+    lowidx,count:tdynarrayindex) : pointer;[external name 'FPC_DYNARR_COPY'];
+
+function fpc_dynarray_copy(psrc : pointer;ti : pointer;
+    lowidx,count:tdynarrayindex) : pointer;[Public,Alias:'FPC_DYNARR_COPY'];{$ifdef hascompilerproc} compilerproc; {$endif}
+{$else HASFUNCTIONCOPYDYNARR}
 procedure int_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;
     lowidx,count:tdynarrayindex);[external name 'FPC_DYNARR_COPY'];
 
 procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;
     lowidx,count:tdynarrayindex);[Public,Alias:'FPC_DYNARR_COPY'];{$ifdef hascompilerproc} compilerproc; {$endif}
+{$endif HASFUNCTIONCOPYDYNARR}
   var
     realpdest,
     realpsrc : pdynarray;
@@ -311,9 +319,15 @@ procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;
     highidx : tdynarrayindex;
     elesize : sizeint;
     eletype : pdynarraytypeinfo;
+{$ifdef HASFUNCTIONCOPYDYNARR}
+    pdest : pointer;
+{$endif HASFUNCTIONCOPYDYNARR}
   begin
      highidx:=lowidx+count-1;
      pdest:=nil;
+{$ifdef HASFUNCTIONCOPYDYNARR}
+     result:=pdest;
+{$endif HASFUNCTIONCOPYDYNARR}
      if psrc=nil then
        exit;
      realpsrc:=pdynarray(psrc-sizeof(tdynarray));
@@ -350,12 +364,18 @@ procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;
      { increment ref. count of members }
      for i:= 0 to cnt-1 do
        int_addref(pointer(pdest+elesize*i),eletype);
+{$ifdef HASFUNCTIONCOPYDYNARR}
+     result:=pdest;
+{$endif HASFUNCTIONCOPYDYNARR}
   end;
 
 
 {
   $Log$
-  Revision 1.36  2005-02-14 17:13:22  peter
+  Revision 1.37  2005-03-05 16:37:28  florian
+    * fixed copy(dyn. array,...);
+
+  Revision 1.36  2005/02/14 17:13:22  peter
     * truncate log
 
   Revision 1.35  2005/01/24 21:32:48  florian