mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-08 01:39:31 +01:00
* specify the packenum setting to use when creating a tenumdef
git-svn-id: trunk@33942 -
This commit is contained in:
parent
d5e5ca0531
commit
f55a403270
@ -910,7 +910,7 @@ interface
|
|||||||
procedure deref;override;
|
procedure deref;override;
|
||||||
function GetTypeName:string;override;
|
function GetTypeName:string;override;
|
||||||
function is_publishable : boolean;override;
|
function is_publishable : boolean;override;
|
||||||
procedure calcsavesize;
|
procedure calcsavesize(packenum: shortint);
|
||||||
function packedbitsize: asizeint; override;
|
function packedbitsize: asizeint; override;
|
||||||
procedure setmax(_max:asizeint);
|
procedure setmax(_max:asizeint);
|
||||||
procedure setmin(_min:asizeint);
|
procedure setmin(_min:asizeint);
|
||||||
@ -2501,7 +2501,7 @@ implementation
|
|||||||
inherited create(enumdef,true);
|
inherited create(enumdef,true);
|
||||||
minval:=0;
|
minval:=0;
|
||||||
maxval:=0;
|
maxval:=0;
|
||||||
calcsavesize;
|
calcsavesize(current_settings.packenum);
|
||||||
has_jumps:=false;
|
has_jumps:=false;
|
||||||
basedef:=nil;
|
basedef:=nil;
|
||||||
symtable:=tenumsymtable.create(self);
|
symtable:=tenumsymtable.create(self);
|
||||||
@ -2514,7 +2514,7 @@ implementation
|
|||||||
minval:=_min;
|
minval:=_min;
|
||||||
maxval:=_max;
|
maxval:=_max;
|
||||||
basedef:=_basedef;
|
basedef:=_basedef;
|
||||||
calcsavesize;
|
calcsavesize(current_settings.packenum);
|
||||||
has_jumps:=false;
|
has_jumps:=false;
|
||||||
symtable:=basedef.symtable.getcopy;
|
symtable:=basedef.symtable.getcopy;
|
||||||
include(defoptions, df_copied_def);
|
include(defoptions, df_copied_def);
|
||||||
@ -2571,19 +2571,19 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tenumdef.calcsavesize;
|
procedure tenumdef.calcsavesize(packenum: shortint);
|
||||||
begin
|
begin
|
||||||
{$IFNDEF cpu64bitaddr} {$push}{$warnings off} {$ENDIF} //comparison always false warning
|
{$IFNDEF cpu64bitaddr} {$push}{$warnings off} {$ENDIF} //comparison always false warning
|
||||||
if (current_settings.packenum=8) or (min<low(longint)) or (int64(max)>high(cardinal)) then
|
if (packenum=8) or (min<low(longint)) or (int64(max)>high(cardinal)) then
|
||||||
savesize:=8
|
savesize:=8
|
||||||
{$IFNDEF cpu64bitaddr} {$pop} {$ENDIF}
|
{$IFNDEF cpu64bitaddr} {$pop} {$ENDIF}
|
||||||
else
|
else
|
||||||
{$IFDEF cpu16bitaddr} {$push}{$warnings off} {$ENDIF} //comparison always false warning
|
{$IFDEF cpu16bitaddr} {$push}{$warnings off} {$ENDIF} //comparison always false warning
|
||||||
if (current_settings.packenum=4) or (min<low(smallint)) or (max>high(word)) then
|
if (packenum=4) or (min<low(smallint)) or (max>high(word)) then
|
||||||
savesize:=4
|
savesize:=4
|
||||||
{$IFDEF cpu16bitaddr} {$pop} {$ENDIF}
|
{$IFDEF cpu16bitaddr} {$pop} {$ENDIF}
|
||||||
else
|
else
|
||||||
if (current_settings.packenum=2) or (min<low(shortint)) or (max>high(byte)) then
|
if (packenum=2) or (min<low(shortint)) or (max>high(byte)) then
|
||||||
savesize:=2
|
savesize:=2
|
||||||
else
|
else
|
||||||
savesize:=1;
|
savesize:=1;
|
||||||
@ -2616,14 +2616,14 @@ implementation
|
|||||||
procedure tenumdef.setmax(_max:asizeint);
|
procedure tenumdef.setmax(_max:asizeint);
|
||||||
begin
|
begin
|
||||||
maxval:=_max;
|
maxval:=_max;
|
||||||
calcsavesize;
|
calcsavesize(current_settings.packenum);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tenumdef.setmin(_min:asizeint);
|
procedure tenumdef.setmin(_min:asizeint);
|
||||||
begin
|
begin
|
||||||
minval:=_min;
|
minval:=_min;
|
||||||
calcsavesize;
|
calcsavesize(current_settings.packenum);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user