|
@@ -362,8 +362,12 @@ type
|
|
btShortInt, // shortint -128..127
|
|
btShortInt, // shortint -128..127
|
|
btWord, // word unsigned 2 bytes
|
|
btWord, // word unsigned 2 bytes
|
|
btSmallInt, // smallint signed 2 bytes
|
|
btSmallInt, // smallint signed 2 bytes
|
|
|
|
+ btUIntSingle, // unsigned integer range of single 22bit
|
|
|
|
+ btIntSingle, // integer range of single 23bit
|
|
btLongWord, // longword unsigned 4 bytes
|
|
btLongWord, // longword unsigned 4 bytes
|
|
btLongint, // longint signed 4 bytes
|
|
btLongint, // longint signed 4 bytes
|
|
|
|
+ btUIntDouble, // unsigned integer range of double 52bit
|
|
|
|
+ btIntDouble, // integer range of double 53bit
|
|
btQWord, // qword 0..18446744073709551615, bytes 8
|
|
btQWord, // qword 0..18446744073709551615, bytes 8
|
|
btInt64, // int64 -9223372036854775808..9223372036854775807, bytes 8
|
|
btInt64, // int64 -9223372036854775808..9223372036854775807, bytes 8
|
|
btComp, // comp -2E64+1..2E63-1, digits 19-20, bytes 8
|
|
btComp, // comp -2E64+1..2E63-1, digits 19-20, bytes 8
|
|
@@ -379,13 +383,13 @@ type
|
|
);
|
|
);
|
|
TResolveBaseTypes = set of TResolverBaseType;
|
|
TResolveBaseTypes = set of TResolverBaseType;
|
|
const
|
|
const
|
|
- btAllInteger = [btByte,btShortInt,btWord,btSmallInt,
|
|
|
|
- btLongWord,btLongint,btQWord,btInt64,btComp];
|
|
|
|
|
|
+ btAllInteger = [btByte,btShortInt,btWord,btSmallInt,btIntSingle,btUIntSingle,
|
|
|
|
+ btLongWord,btLongint,btIntDouble,btUIntDouble,btQWord,btInt64];
|
|
btAllChars = [btChar,btAnsiChar,btWideChar];
|
|
btAllChars = [btChar,btAnsiChar,btWideChar];
|
|
btAllStrings = [btString,btAnsiString,btShortString,
|
|
btAllStrings = [btString,btAnsiString,btShortString,
|
|
btWideString,btUnicodeString,btRawByteString];
|
|
btWideString,btUnicodeString,btRawByteString];
|
|
btAllStringAndChars = btAllStrings+btAllChars;
|
|
btAllStringAndChars = btAllStrings+btAllChars;
|
|
- btAllFloats = [btSingle,btDouble,btExtended,btCExtended,btCurrency];
|
|
|
|
|
|
+ btAllFloats = [btSingle,btDouble,btExtended,btCExtended,btCurrency,btComp];
|
|
btAllBooleans = [btBoolean,btByteBool,btWordBool,btLongBool,btQWordBool];
|
|
btAllBooleans = [btBoolean,btByteBool,btWordBool,btLongBool,btQWordBool];
|
|
btAllStandardTypes = [
|
|
btAllStandardTypes = [
|
|
btChar,
|
|
btChar,
|
|
@@ -452,8 +456,12 @@ const
|
|
'ShortInt',
|
|
'ShortInt',
|
|
'Word',
|
|
'Word',
|
|
'SmallInt',
|
|
'SmallInt',
|
|
|
|
+ 'UIntSingle',
|
|
|
|
+ 'IntSingle',
|
|
'LongWord',
|
|
'LongWord',
|
|
'Longint',
|
|
'Longint',
|
|
|
|
+ 'UIntDouble',
|
|
|
|
+ 'IntDouble',
|
|
'QWord',
|
|
'QWord',
|
|
'Int64',
|
|
'Int64',
|
|
'Comp',
|
|
'Comp',
|
|
@@ -999,6 +1007,7 @@ type
|
|
FAnonymousElTypePostfix: String;
|
|
FAnonymousElTypePostfix: String;
|
|
FBaseTypeChar: TResolverBaseType;
|
|
FBaseTypeChar: TResolverBaseType;
|
|
FBaseTypeExtended: TResolverBaseType;
|
|
FBaseTypeExtended: TResolverBaseType;
|
|
|
|
+ FBaseTypeLength: TResolverBaseType;
|
|
FBaseTypes: array[TResolverBaseType] of TPasUnresolvedSymbolRef;
|
|
FBaseTypes: array[TResolverBaseType] of TPasUnresolvedSymbolRef;
|
|
FBaseTypeString: TResolverBaseType;
|
|
FBaseTypeString: TResolverBaseType;
|
|
FDefaultScope: TPasDefaultScope;
|
|
FDefaultScope: TPasDefaultScope;
|
|
@@ -1440,6 +1449,7 @@ type
|
|
property BaseTypeChar: TResolverBaseType read FBaseTypeChar write FBaseTypeChar;
|
|
property BaseTypeChar: TResolverBaseType read FBaseTypeChar write FBaseTypeChar;
|
|
property BaseTypeExtended: TResolverBaseType read FBaseTypeExtended write FBaseTypeExtended;
|
|
property BaseTypeExtended: TResolverBaseType read FBaseTypeExtended write FBaseTypeExtended;
|
|
property BaseTypeString: TResolverBaseType read FBaseTypeString write FBaseTypeString;
|
|
property BaseTypeString: TResolverBaseType read FBaseTypeString write FBaseTypeString;
|
|
|
|
+ property BaseTypeLength: TResolverBaseType read FBaseTypeLength write FBaseTypeLength;
|
|
property LastElement: TPasElement read FLastElement;
|
|
property LastElement: TPasElement read FLastElement;
|
|
property StoreSrcColumns: boolean read FStoreSrcColumns write FStoreSrcColumns; {
|
|
property StoreSrcColumns: boolean read FStoreSrcColumns write FStoreSrcColumns; {
|
|
If true Line and Column is mangled together in TPasElement.SourceLineNumber.
|
|
If true Line and Column is mangled together in TPasElement.SourceLineNumber.
|
|
@@ -7171,7 +7181,8 @@ procedure TPasResolver.BI_Length_OnGetCallResult(Proc: TResElDataBuiltInProc;
|
|
Params: TParamsExpr; out ResolvedEl: TPasResolverResult);
|
|
Params: TParamsExpr; out ResolvedEl: TPasResolverResult);
|
|
begin
|
|
begin
|
|
if Params=nil then ;
|
|
if Params=nil then ;
|
|
- SetResolverIdentifier(ResolvedEl,btInt64,Proc.Proc,FBaseTypes[btInt64],[rrfReadable]);
|
|
|
|
|
|
+ SetResolverIdentifier(ResolvedEl,BaseTypeLength,Proc.Proc,
|
|
|
|
+ FBaseTypes[BaseTypeLength],[rrfReadable]);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPasResolver.BI_SetLength_OnGetCallCompatibility(
|
|
function TPasResolver.BI_SetLength_OnGetCallCompatibility(
|
|
@@ -7605,7 +7616,8 @@ begin
|
|
// array: result type is type of first dimension
|
|
// array: result type is type of first dimension
|
|
ArrayEl:=TPasArrayType(TypeEl);
|
|
ArrayEl:=TPasArrayType(TypeEl);
|
|
if length(ArrayEl.Ranges)=0 then
|
|
if length(ArrayEl.Ranges)=0 then
|
|
- SetResolverIdentifier(ResolvedEl,btInt64,Proc.Proc,FBaseTypes[btInt64],[rrfReadable])
|
|
|
|
|
|
+ SetResolverIdentifier(ResolvedEl,BaseTypeLength,Proc.Proc,
|
|
|
|
+ FBaseTypes[BaseTypeLength],[rrfReadable])
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
ComputeElement(ArrayEl.Ranges[0],ResolvedEl,[rcConstant]);
|
|
ComputeElement(ArrayEl.Ranges[0],ResolvedEl,[rcConstant]);
|
|
@@ -8074,6 +8086,7 @@ begin
|
|
FBaseTypeChar:=btAnsiChar;
|
|
FBaseTypeChar:=btAnsiChar;
|
|
FBaseTypeString:=btAnsiString;
|
|
FBaseTypeString:=btAnsiString;
|
|
FBaseTypeExtended:=btDouble;
|
|
FBaseTypeExtended:=btDouble;
|
|
|
|
+ FBaseTypeLength:=btInt64;
|
|
FScopeClass_Class:=TPasClassScope;
|
|
FScopeClass_Class:=TPasClassScope;
|
|
FScopeClass_WithExpr:=TPasWithExprScope;
|
|
FScopeClass_WithExpr:=TPasWithExprScope;
|
|
PushScope(FDefaultScope);
|
|
PushScope(FDefaultScope);
|
|
@@ -9731,18 +9744,31 @@ begin
|
|
case LBT of
|
|
case LBT of
|
|
btByte,
|
|
btByte,
|
|
btShortInt: inc(Result,cLossyConversion);
|
|
btShortInt: inc(Result,cLossyConversion);
|
|
- btWord,btSmallInt:
|
|
|
|
|
|
+ btWord,
|
|
|
|
+ btSmallInt:
|
|
if not (RBT in [btByte,btShortInt]) then
|
|
if not (RBT in [btByte,btShortInt]) then
|
|
inc(Result,cLossyConversion);
|
|
inc(Result,cLossyConversion);
|
|
|
|
+ btUIntSingle:
|
|
|
|
+ if not (RBT in [btByte,btShortInt,btWord,btSmallInt]) then
|
|
|
|
+ inc(Result,cLossyConversion);
|
|
|
|
+ btIntSingle:
|
|
|
|
+ if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btUIntSingle]) then
|
|
|
|
+ inc(Result,cLossyConversion);
|
|
btLongWord,
|
|
btLongWord,
|
|
btLongint:
|
|
btLongint:
|
|
- if not (RBT in [btByte,btShortInt,btWord,btSmallInt]) then
|
|
|
|
|
|
+ if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btUIntSingle,btIntSingle]) then
|
|
inc(Result,cLossyConversion);
|
|
inc(Result,cLossyConversion);
|
|
- btQWord,
|
|
|
|
- btInt64,
|
|
|
|
- btComp:
|
|
|
|
|
|
+ btUIntDouble:
|
|
if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btLongWord,btLongint]) then
|
|
if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btLongWord,btLongint]) then
|
|
inc(Result,cLossyConversion);
|
|
inc(Result,cLossyConversion);
|
|
|
|
+ btIntDouble:
|
|
|
|
+ if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btLongWord,btLongint,btUIntDouble]) then
|
|
|
|
+ inc(Result,cLossyConversion);
|
|
|
|
+ btQWord,
|
|
|
|
+ btInt64:
|
|
|
|
+ if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btUIntSingle,btIntSingle,
|
|
|
|
+ btLongWord,btLongint,btUIntDouble,btIntDouble]) then
|
|
|
|
+ inc(Result,cLossyConversion);
|
|
else
|
|
else
|
|
RaiseNotYetImplemented(20170417205301,ErrorEl,BaseTypeNames[LBT]);
|
|
RaiseNotYetImplemented(20170417205301,ErrorEl,BaseTypeNames[LBT]);
|
|
end;
|
|
end;
|
|
@@ -9767,6 +9793,10 @@ begin
|
|
if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btLongWord,
|
|
if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btLongWord,
|
|
btLongint,btSingle]) then
|
|
btLongint,btSingle]) then
|
|
inc(Result,cLossyConversion);
|
|
inc(Result,cLossyConversion);
|
|
|
|
+ btComp:
|
|
|
|
+ if not (RBT in [btByte,btShortInt,btWord,btSmallInt,btLongWord,
|
|
|
|
+ btLongint,btSingle]) then
|
|
|
|
+ inc(Result,cLossyConversion);
|
|
else
|
|
else
|
|
RaiseNotYetImplemented(20170417205910,ErrorEl,BaseTypeNames[LBT]);
|
|
RaiseNotYetImplemented(20170417205910,ErrorEl,BaseTypeNames[LBT]);
|
|
end;
|
|
end;
|
|
@@ -11840,8 +11870,12 @@ begin
|
|
btShortInt: begin Precision:=8; Signed:=true; end;
|
|
btShortInt: begin Precision:=8; Signed:=true; end;
|
|
btWord: begin Precision:=16; Signed:=false; end;
|
|
btWord: begin Precision:=16; Signed:=false; end;
|
|
btSmallInt: begin Precision:=16; Signed:=true; end;
|
|
btSmallInt: begin Precision:=16; Signed:=true; end;
|
|
|
|
+ btIntSingle: begin Precision:=23; Signed:=true; end;
|
|
|
|
+ btUIntSingle: begin Precision:=22; Signed:=false; end;
|
|
btLongWord: begin Precision:=32; Signed:=false; end;
|
|
btLongWord: begin Precision:=32; Signed:=false; end;
|
|
btLongint: begin Precision:=32; Signed:=true; end;
|
|
btLongint: begin Precision:=32; Signed:=true; end;
|
|
|
|
+ btIntDouble: begin Precision:=53; Signed:=true; end;
|
|
|
|
+ btUIntDouble: begin Precision:=52; Signed:=false; end;
|
|
btQWord: begin Precision:=64; Signed:=false; end;
|
|
btQWord: begin Precision:=64; Signed:=false; end;
|
|
btInt64: begin Precision:=64; Signed:=true; end;
|
|
btInt64: begin Precision:=64; Signed:=true; end;
|
|
else
|
|
else
|
|
@@ -11868,6 +11902,10 @@ begin
|
|
Result:=btWord;
|
|
Result:=btWord;
|
|
if BaseTypes[Result]<>nil then exit;
|
|
if BaseTypes[Result]<>nil then exit;
|
|
end;
|
|
end;
|
|
|
|
+ if (Precision<=22) and (not Signed) and (BaseTypes[btUIntSingle]<>nil) then
|
|
|
|
+ exit(btUIntSingle);
|
|
|
|
+ if (Precision<=23) and Signed and (BaseTypes[btIntSingle]<>nil) then
|
|
|
|
+ exit(btIntSingle);
|
|
if Precision<=32 then
|
|
if Precision<=32 then
|
|
begin
|
|
begin
|
|
if Signed then
|
|
if Signed then
|
|
@@ -11876,6 +11914,10 @@ begin
|
|
Result:=btLongWord;
|
|
Result:=btLongWord;
|
|
if BaseTypes[Result]<>nil then exit;
|
|
if BaseTypes[Result]<>nil then exit;
|
|
end;
|
|
end;
|
|
|
|
+ if (Precision<=52) and (not Signed) and (BaseTypes[btUIntDouble]<>nil) then
|
|
|
|
+ exit(btUIntDouble);
|
|
|
|
+ if (Precision<=53) and Signed and (BaseTypes[btIntDouble]<>nil) then
|
|
|
|
+ exit(btIntDouble);
|
|
if Precision<=64 then
|
|
if Precision<=64 then
|
|
begin
|
|
begin
|
|
if Signed then
|
|
if Signed then
|