Browse Source

+ support for high(dynarray) using compilerproc (forgot to commit
previously)

Jonas Maebe 24 years ago
parent
commit
239d2d6fee
1 changed files with 19 additions and 13 deletions
  1. 19 13
      compiler/ninl.pas

+ 19 - 13
compiler/ninl.pas

@@ -1167,20 +1167,22 @@ implementation
                            else
                            else
                             if is_dynamic_array(left.resulttype.def) then
                             if is_dynamic_array(left.resulttype.def) then
                               begin
                               begin
-{
-                                Doesn't work because that procedure isn't in
-                                the interface of the system unit :( (JM)
-
-                                srsym:=searchsymonlyin(systemunit,'FPC_DYNARRAY_HIGH');
-                                if not assigned(srsym) then
-                                  internalerror(200104291);
-                                inserttypeconv(left,voidpointertype);
-                                hp:=ccallparanode.create(left,nil);
-                                hp:=ccallnode.create(hp,tprocsym(srsym),systemunit,nil);
+{$ifndef hascompilerproc}
+                                writeln('Error: high(dynamic_array) isn''t implemented yet');
+                                codegenerror := true;
+{$else hascompilerproc}
+                                { can't use inserttypeconv because we need }
+                                { an explicit type conversion (JM)         }
+                                hp := ctypeconvnode.create(left,voidpointertype);
+                                hp.toggleflag(nf_explizit);
+                                hp := ccallparanode.create(hp,nil);
+                                hp := ccallnode.createintern('fpc_dynarray_high',hp);
+                                { make sure the left node doesn't get disposed, since it's }
+                                { reused in the new node (JM)                              }
                                 left:=nil;
                                 left:=nil;
                                 resulttypepass(hp);
                                 resulttypepass(hp);
-                                result:=hp;}
-                                {$warning "high(dynamic_array)" isn't implemented yet }
+                                result:=hp;
+{$endif hascompilerproc}
                               end
                               end
                            else
                            else
                             begin
                             begin
@@ -1790,7 +1792,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.44  2001-07-09 21:15:40  peter
+  Revision 1.45  2001-08-06 09:44:10  jonas
+    + support for high(dynarray) using compilerproc (forgot to commit
+      previously)
+
+  Revision 1.44  2001/07/09 21:15:40  peter
     * Length made internal
     * Length made internal
     * Add array support for Length
     * Add array support for Length