Browse Source

Merged revisions 629-631 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@685 -

peter 20 years ago
parent
commit
258e321825
4 changed files with 104 additions and 29 deletions
  1. 90 17
      compiler/symdef.pas
  2. 1 0
      compiler/symtype.pas
  3. 1 9
      rtl/inc/dynarr.inc
  4. 12 3
      rtl/inc/dynarrh.inc

+ 90 - 17
compiler/symdef.pas

@@ -1,8 +1,8 @@
 {
 {
-    Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
-
     Symbol table implementation for the definitions
     Symbol table implementation for the definitions
 
 
+    Copyright (c) 1998-2005 by Florian Klaempfl, Pierre Muller
+
     This program is free software; you can redistribute it and/or modify
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     the Free Software Foundation; either version 2 of the License, or
@@ -78,6 +78,7 @@ interface
           procedure deref;override;
           procedure deref;override;
           procedure derefimpl;override;
           procedure derefimpl;override;
           function  size:aint;override;
           function  size:aint;override;
+          function  getvartype:longint;override;
           function  alignment:longint;override;
           function  alignment:longint;override;
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
           function  needs_inittable : boolean;override;
           function  needs_inittable : boolean;override;
@@ -422,6 +423,7 @@ interface
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
           function  gettypename:string;override;
           function  gettypename:string;override;
           procedure setsize;
           procedure setsize;
+          function getvartype : longint;override;
           { debug }
           { debug }
 {$ifdef GDB}
 {$ifdef GDB}
           function  stabstring : pchar;override;
           function  stabstring : pchar;override;
@@ -439,6 +441,7 @@ interface
           function  gettypename:string;override;
           function  gettypename:string;override;
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
           procedure setsize;
           procedure setsize;
+          function  getvartype:longint;override;
           { debug }
           { debug }
 {$ifdef GDB}
 {$ifdef GDB}
           function stabstring : pchar;override;
           function stabstring : pchar;override;
@@ -844,23 +847,58 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-       strings,
-       { global }
-       verbose,
-       { target }
-       systems,aasmcpu,paramgr,
-       { symtable }
-       symsym,symtable,symutil,defutil,
-       { module }
+      strings,
+      { global }
+      verbose,
+      { target }
+      systems,aasmcpu,paramgr,
+      { symtable }
+      symsym,symtable,symutil,defutil,
+      { module }
 {$ifdef GDB}
 {$ifdef GDB}
-       gdb,
+      gdb,
 {$endif GDB}
 {$endif GDB}
-       fmodule,
-       { other }
-       gendef,
-       crc
-       ;
+      fmodule,
+      { other }
+      gendef,
+      crc
+      ;
+
+{****************************************************************************
+                                  Constants
+****************************************************************************}
 
 
+    const
+      varempty = 0;
+      varnull = 1;
+      varsmallint = 2;
+      varinteger = 3;
+      varsingle = 4;
+      vardouble = 5;
+      varcurrency = 6;
+      vardate = 7;
+      varolestr = 8;
+      vardispatch = 9;
+      varerror = 10;
+      varboolean = 11;
+      varvariant = 12;
+      varunknown = 13;
+      vardecimal = 14;
+      varshortint = 16;
+      varbyte = 17;
+      varword = 18;
+      varlongword = 19;
+      varint64 = 20;
+      varqword = 21;
+
+      varUndefined = -1;
+
+      varstrarg = $48;
+      varstring = $100;
+      varany = $101;
+      vartypemask = $fff;
+      vararray = $2000;
+      varbyref = $4000;
 
 
 {****************************************************************************
 {****************************************************************************
                                   Helpers
                                   Helpers
@@ -1074,6 +1112,12 @@ implementation
       end;
       end;
 
 
 
 
+    function tstoreddef.getvartype:longint;
+      begin
+        result:=varUndefined;
+      end;
+
+
     function tstoreddef.alignment : longint;
     function tstoreddef.alignment : longint;
       begin
       begin
          { natural alignment by default }
          { natural alignment by default }
@@ -1981,6 +2025,19 @@ implementation
       end;
       end;
 
 
 
 
+    function torddef.getvartype : longint;
+      const
+        basetype2vartype : array[tbasetype] of longint = (
+          varUndefined,
+          varbyte,varqword,varlongword,varqword,
+          varshortint,varsmallint,varinteger,varint64,
+          varboolean,varUndefined,varUndefined,
+          varUndefined,varUndefined,varCurrency);
+      begin
+        result:=basetype2vartype[typ];
+      end;
+
+
     procedure torddef.ppuwrite(ppufile:tcompilerppufile);
     procedure torddef.ppuwrite(ppufile:tcompilerppufile);
       begin
       begin
          inherited ppuwritedef(ppufile);
          inherited ppuwritedef(ppufile);
@@ -2184,6 +2241,22 @@ implementation
       end;
       end;
 
 
 
 
+    function tfloatdef.getvartype : longint;
+      const
+        floattype2vartype : array[tfloattype] of longint = (
+          varSingle,varDouble,varUndefined,
+          varUndefined,varCurrency,varUndefined);
+      begin
+        if (upper(typename)='TDATETIME') and
+          assigned(owner) and
+          assigned(owner.name) and
+          (owner.name^='SYSTEM') then
+          result:=varDate
+        else
+          result:=floattype2vartype[typ];
+      end;
+
+
     procedure tfloatdef.ppuwrite(ppufile:tcompilerppufile);
     procedure tfloatdef.ppuwrite(ppufile:tcompilerppufile);
       begin
       begin
          inherited ppuwritedef(ppufile);
          inherited ppuwritedef(ppufile);
@@ -3142,7 +3215,7 @@ implementation
          { element type }
          { element type }
          rttiList.concat(Tai_const.Create_sym(tstoreddef(elementtype.def).get_rtti_label(rt)));
          rttiList.concat(Tai_const.Create_sym(tstoreddef(elementtype.def).get_rtti_label(rt)));
          { variant type }
          { variant type }
-         // !!!!!!!!!!!!!!!!
+         rttilist.concat(Tai_const.Create_32bit(tstoreddef(elementtype.def).getvartype));
       end;
       end;
 
 
 
 

+ 1 - 0
compiler/symtype.pas

@@ -81,6 +81,7 @@ interface
          function  getmangledparaname:string;virtual;
          function  getmangledparaname:string;virtual;
          function  size:aint;virtual;abstract;
          function  size:aint;virtual;abstract;
          function  alignment:longint;virtual;abstract;
          function  alignment:longint;virtual;abstract;
+         function  getvartype:longint;virtual;abstract;
          function  getparentdef:tdef;virtual;
          function  getparentdef:tdef;virtual;
          function  getsymtable(t:tgetsymtable):tsymtable;virtual;
          function  getsymtable(t:tgetsymtable):tsymtable;virtual;
          function  is_publishable:boolean;virtual;abstract;
          function  is_publishable:boolean;virtual;abstract;

+ 1 - 9
rtl/inc/dynarr.inc

@@ -24,16 +24,8 @@ type
       high : tdynarrayindex;
       high : tdynarrayindex;
    end;
    end;
 
 
-   pdynarraytypeinfo = ^tdynarraytypeinfo;
-   tdynarraytypeinfo = packed record
-      kind : byte;
-      namelen : byte;
-      { here the chars follow, we've to skip them }
-      elesize : sizeint;
-      eletype : pdynarraytypeinfo;
-   end;
 
 
-function aligntoptr(p : pointer) : pointer;
+function aligntoptr(p : pointer) : pointer;inline;
   begin
   begin
 {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
 {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
     if (ptrint(p) mod sizeof(ptrint))<>0 then
     if (ptrint(p) mod sizeof(ptrint))<>0 then

+ 12 - 3
rtl/inc/dynarrh.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the Free Pascal Run time library.
     This file is part of the Free Pascal Run time library.
-    Copyright (c) 1999-2000 by the Free Pascal development team
+    Copyright (c) 1999-2005 by the Free Pascal development team
 
 
     This file contains type declarations necessary for the dynamic
     This file contains type declarations necessary for the dynamic
     array routine helpers in syshelp.inc
     array routine helpers in syshelp.inc
@@ -16,6 +16,15 @@
 **********************************************************************}
 **********************************************************************}
 
 
 type
 type
-   tdynarrayindex = sizeint;
-   pdynarrayindex = ^tdynarrayindex;
+  tdynarrayindex = sizeint;
+  pdynarrayindex = ^tdynarrayindex;
 
 
+  pdynarraytypeinfo = ^tdynarraytypeinfo;
+  tdynarraytypeinfo = packed record
+    kind : byte;
+    namelen : byte;
+    { here the chars follow, we've to skip them }
+    elesize : sizeint;
+    eletype : pdynarraytypeinfo;
+    vartype : longint;
+  end;