Jelajahi Sumber

* Initialize() added

peter 22 tahun lalu
induk
melakukan
90a0c832e4
5 mengubah file dengan 69 tambahan dan 10 penghapusan
  1. 5 1
      compiler/compinnr.inc
  2. 7 6
      compiler/ninl.pas
  3. 9 1
      compiler/pexpr.pas
  4. 43 1
      compiler/pinline.pas
  5. 5 1
      compiler/psystem.pas

+ 5 - 1
compiler/compinnr.inc

@@ -59,6 +59,7 @@ const
    in_dispose_x         = 47;
    in_exit              = 48;
    in_copy_x            = 49;
+   in_initialize_x      = 50;
 
 { Internal constant functions }
    in_const_trunc      = 100;
@@ -107,7 +108,10 @@ const
 
 {
   $Log$
-  Revision 1.10  2002-11-18 18:35:01  peter
+  Revision 1.11  2003-11-29 16:19:54  peter
+    * Initialize() added
+
+  Revision 1.10  2002/11/18 18:35:01  peter
     * Swap(QWord) constant support
 
   Revision 1.9  2002/10/02 18:20:52  peter

+ 7 - 6
compiler/ninl.pas

@@ -1659,6 +1659,7 @@ implementation
                     end;
                 end;
 
+              in_initialize_x,
               in_finalize_x,
               in_setlength_x:
                 begin
@@ -2097,11 +2098,8 @@ implementation
               expectloc:=LOC_REGISTER;
             end;
 
-          in_setlength_x:
-            begin
-              expectloc:=LOC_VOID;
-            end;
-
+          in_setlength_x,
+          in_initialize_x,
           in_finalize_x:
             begin
               expectloc:=LOC_VOID;
@@ -2358,7 +2356,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.122  2003-11-10 22:02:52  peter
+  Revision 1.123  2003-11-29 16:19:54  peter
+    * Initialize() added
+
+  Revision 1.122  2003/11/10 22:02:52  peter
     * cross unit inlining fixed
 
   Revision 1.121  2003/10/21 15:15:36  peter

+ 9 - 1
compiler/pexpr.pas

@@ -597,6 +597,11 @@ implementation
               consume(_RKLAMMER);
             end;
 
+          in_initialize_x:
+            begin
+              statement_syssym:=inline_initialize;
+            end;
+
           in_finalize_x:
             begin
               statement_syssym:=inline_finalize;
@@ -2492,7 +2497,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.142  2003-11-29 14:49:46  peter
+  Revision 1.143  2003-11-29 16:19:54  peter
+    * Initialize() added
+
+  Revision 1.142  2003/11/29 14:49:46  peter
     * fix crash with exit() in a procedure
 
   Revision 1.141  2003/11/29 14:33:13  peter

+ 43 - 1
compiler/pinline.pas

@@ -36,6 +36,7 @@ interface
     function new_function : tnode;
 
     function inline_setlength : tnode;
+    function inline_initialize : tnode;
     function inline_finalize : tnode;
     function inline_copy : tnode;
 
@@ -524,6 +525,44 @@ implementation
       end;
 
 
+    function inline_initialize : tnode;
+      var
+        newblock,
+        paras   : tnode;
+        npara,
+        destppn,
+        ppn     : tcallparanode;
+      begin
+        { for easy exiting if something goes wrong }
+        result := cerrornode.create;
+
+        consume(_LKLAMMER);
+        paras:=parse_paras(false,false);
+        consume(_RKLAMMER);
+        if not assigned(paras) then
+         begin
+           CGMessage(parser_e_wrong_parameter_size);
+           exit;
+         end;
+
+        ppn:=tcallparanode(paras);
+        { 2 arguments? }
+        if assigned(ppn.right) then
+         begin
+           CGMessage(parser_e_wrong_parameter_size);
+           paras.free;
+           exit;
+         end;
+
+        newblock:=initialize_data_node(ppn.left);
+        ppn.left:=nil;
+
+        paras.free;
+        result.free;
+        result:=newblock;
+      end;
+
+
     function inline_finalize : tnode;
       var
         newblock,
@@ -693,7 +732,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.24  2003-11-10 22:02:52  peter
+  Revision 1.25  2003-11-29 16:19:54  peter
+    * Initialize() added
+
+  Revision 1.24  2003/11/10 22:02:52  peter
     * cross unit inlining fixed
 
   Revision 1.23  2003/11/04 19:05:03  peter

+ 5 - 1
compiler/psystem.pas

@@ -90,6 +90,7 @@ implementation
         p.insert(tsyssym.create('TypeInfo',in_typeinfo_x));
         p.insert(tsyssym.create('SetLength',in_setlength_x));
         p.insert(tsyssym.create('Copy',in_copy_x));
+        p.insert(tsyssym.create('Initialize',in_initialize_x));
         p.insert(tsyssym.create('Finalize',in_finalize_x));
         p.insert(tsyssym.create('Length',in_length_x));
         p.insert(tsyssym.create('New',in_new_x));
@@ -509,7 +510,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.57  2003-10-06 22:23:41  florian
+  Revision 1.58  2003-11-29 16:19:54  peter
+    * Initialize() added
+
+  Revision 1.57  2003/10/06 22:23:41  florian
     + added basic olevariant support
 
   Revision 1.56  2003/09/28 17:55:04  peter