+ writing of vartype for dyn. array rtti

git-svn-id: trunk@629 -
This commit is contained in:
florian 2005-07-15 21:04:50 +00:00
parent 196bc349c7
commit fddf556098
2 changed files with 91 additions and 17 deletions

View File

@ -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;
@ -867,6 +870,41 @@ implementation
crc 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
@ -1080,6 +1118,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 }
@ -1987,6 +2031,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);
@ -2190,6 +2247,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);
@ -3158,7 +3231,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;

View File

@ -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;