Hi, I successfully ran some MSE-gui test-programs on my arm-board. To do this I used a patched fpc 2.2.0-fixes. The patch involved backporting a fix from fpc-2.3.1 for TBinaryObjectReader : the arm processor has no (AFAIK) extended type. I needed 2.2.1 because 2.3.1 breaks MSE-gui. I still have problems concerning floating points. When I put a real-value in a component at design-time , it's not displayed OK, e.g. 1.0 is displayed as 5.29980882362664E-0315. When I put some real into it at run-time it's fine. Also 0 is displayed fine if entered at design-time. I also think that this problem breaks another component I would like to use. I would like to make certain that patch works, any suggestions how to do this ? Enclosed a diff to show what I did to rtl/objpas/classes/reader.inc. Remember that this is on arm-linux, i386-linux is fine.
Regards, Koenraad Lelong.
16a17,62 > {$IFNDEF FPC_HAS_TYPE_EXTENDED} > function ExtendedToDouble(e : pointer) : double; > var mant : qword; > exp : smallint; > sign : boolean; > d : qword; > begin > move(pbyte(e)[0],mant,8); //mantissa : bytes 0..7 > move(pbyte(e)[8],exp,2); //exponent and sign: bytes 8..9 > mant:=LEtoN(mant); > exp:=LEtoN(word(exp)); > sign:=(exp and $8000)<>0; > if sign then exp:=exp and $7FFF; > case exp of > 0 : mant:=0; //if denormalized, value is too small for double, > //so it's always zero > $7FFF : exp:=2047 //either infinity or NaN > else > begin > dec(exp,16383-1023); > if (exp>=-51) and (exp<=0) then //can be denormalized > begin > mant:=mant shr (-exp); > exp:=0; > end > else > if (exp<-51) or (exp>2046) then //exponent too large. > begin > Result:=0; > exit; > end > else //normalized value > mant:=mant shl 1; //hide most significant bit > end; > end; > d:=word(exp); > d:=d shl 52; > > mant:=mant shr 12; > d:=d or mant; > if sign then d:=d or $8000000000000000; > Result:=pdouble(@d)^; > end; > {$ENDIF} > > 110,111c156,165 < begin < Read(Result, SizeOf(Extended)) --- > {$IFNDEF FPC_HAS_TYPE_EXTENDED} > var ext : array[0..9] of byte; > {$ENDIF} > begin > {$IFNDEF FPC_HAS_TYPE_EXTENDED} > Read(ext[0],10); > Result:=ExtendedToDouble(@(ext[0])); > {$ELSE} > Read(Result,sizeof(Result)); > {$ENDIF} 1023d1076 <
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal