浏览代码

New: rtl/inc/genmathh.inc source file, to provide a unique position
for the interface definition of float64 and float32 records,
available to all systems if FPUNONE is not defined.

rtl/inc/genmath.inc: Remove float64/float32, as they are now in rtl/inc/genmathh.inc
rtl/inc/softfpu.pp: Use provided definitions of float32 and float64
if available (by checking presence of FPC_SYSTEM_HAS_floatXX macro)

rtl/inc/systemh.inc: include genmathh.inc if FPUNONE is not defined.
rtl/java/jsystemh_types.inc: Likewise.

git-svn-id: trunk@45821 -

pierre 5 年之前
父节点
当前提交
adf064cbb4
共有 6 个文件被更改,包括 108 次插入30 次删除
  1. 1 0
      .gitattributes
  2. 3 30
      rtl/inc/genmath.inc
  3. 95 0
      rtl/inc/genmathh.inc
  4. 6 0
      rtl/inc/softfpu.pp
  5. 2 0
      rtl/inc/systemh.inc
  6. 1 0
      rtl/java/jsystemh_types.inc

+ 1 - 0
.gitattributes

@@ -10960,6 +10960,7 @@ rtl/inc/fpintres.pp svneol=native#text/plain
 rtl/inc/gencurr.inc svneol=native#text/plain
 rtl/inc/gencurr.inc svneol=native#text/plain
 rtl/inc/generic.inc svneol=native#text/plain
 rtl/inc/generic.inc svneol=native#text/plain
 rtl/inc/genmath.inc svneol=native#text/plain
 rtl/inc/genmath.inc svneol=native#text/plain
+rtl/inc/genmathh.inc svneol=native#text/plain
 rtl/inc/genset.inc svneol=native#text/plain
 rtl/inc/genset.inc svneol=native#text/plain
 rtl/inc/genstr.inc svneol=native#text/plain
 rtl/inc/genstr.inc svneol=native#text/plain
 rtl/inc/genstrs.inc svneol=native#text/plain
 rtl/inc/genstrs.inc svneol=native#text/plain

+ 3 - 30
rtl/inc/genmath.inc

@@ -61,32 +61,9 @@
 
 
 type
 type
   PReal = ^Real;
   PReal = ^Real;
-{ also necessary for Int() on systems with 64bit floats (JM) }
-{ union required to get correct alignement for floating point type }
-{$ifndef FPC_SYSTEM_HAS_float64}
-{$ifdef ENDIAN_LITTLE}
-  float64 = record
-    case byte of
-      1: (dummy : double);
- {$ifndef FPC_DOUBLE_HILO_SWAPPED}
-      2: (low,high: longint);
-{$else}
-      2: (high,low: longint);
-{$endif FPC_DOUBLE_HILO_SWAPPED}
-  end;
-{$else}
-  float64 = record
-    case byte of
-      1: (dummy : double);
-{$ifndef FPC_DOUBLE_HILO_SWAPPED}
-      2: (high,low: longint);
-{$else}
-      2: (low,high: longint);
-{$endif FPC_DOUBLE_HILO_SWAPPED}
-  end;
-{$endif}
-{$endif FPC_SYSTEM_HAS_float64}
-
+{ float64 definition is now in genmathh.inc,
+  to ensure that float64 will always be in
+  the system interface symbol table. }
 
 
 const
 const
       PIO4   =  7.85398163397448309616E-1;    {  pi/4        }
       PIO4   =  7.85398163397448309616E-1;    {  pi/4        }
@@ -202,10 +179,6 @@ end;
 
 
 
 
 {$ifndef FPC_SYSTEM_HAS_TRUNC}
 {$ifndef FPC_SYSTEM_HAS_TRUNC}
-{$ifndef FPC_SYSTEM_HAS_float32}
-type
-  float32 = longint;
-{$endif FPC_SYSTEM_HAS_float32}
 
 
 {$ifdef SUPPORT_DOUBLE}
 {$ifdef SUPPORT_DOUBLE}
    { based on softfloat float64_to_int64_round_to_zero }
    { based on softfloat float64_to_int64_round_to_zero }

+ 95 - 0
rtl/inc/genmathh.inc

@@ -0,0 +1,95 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2007 by Several contributors
+
+    Generic mathematical routines (on type real)
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{*************************************************************************}
+{  Credits                                                                }
+{*************************************************************************}
+{       Copyright Abandoned, 1987, Fred Fish                              }
+{                                                                         }
+{       This previously copyrighted work has been placed into the         }
+{       public domain by the author (Fred Fish) and may be freely used    }
+{       for any purpose, private or commercial.  I would appreciate       }
+{       it, as a courtesy, if this notice is left in all copies and       }
+{       derivative works.  Thank you, and enjoy...                        }
+{                                                                         }
+{       The author makes no warranty of any kind with respect to this     }
+{       product and explicitly disclaims any implied warranties of        }
+{       merchantability or fitness for any particular purpose.            }
+{-------------------------------------------------------------------------}
+{       Copyright (c) 1992 Odent Jean Philippe                            }
+{                                                                         }
+{       The source can be modified as long as my name appears and some    }
+{       notes explaining the modifications done are included in the file. }
+{-------------------------------------------------------------------------}
+{       Copyright (c) 1997 Carl Eric Codere                               }
+{-------------------------------------------------------------------------}
+{-------------------------------------------------------------------------
+ Using functions from AMath/DAMath libraries, which are covered by the
+ following license:
+
+ (C) Copyright 2009-2013 Wolfgang Ehrhardt
+
+ This software is provided 'as-is', without any express or implied warranty.
+ In no event will the authors be held liable for any damages arising from
+ the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+    claim that you wrote the original software. If you use this software in
+    a product, an acknowledgment in the product documentation would be
+    appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+    misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+----------------------------------------------------------------------------}
+
+{$ifndef FPC_SYSTEM_HAS_float64}
+type
+{ also necessary for Int() on systems with 64bit floats (JM) }
+{ case record required to get correct alignement for floating point type }
+{$ifdef ENDIAN_LITTLE}
+  float64 = record
+    case byte of
+      1: (dummy : double);
+ {$ifndef FPC_DOUBLE_HILO_SWAPPED}
+      2: (low,high: longword);
+{$else}
+      2: (high,low: longword);
+{$endif FPC_DOUBLE_HILO_SWAPPED}
+  end;
+{$else}
+  float64 = record
+    case byte of
+      1: (dummy : double);
+{$ifndef FPC_DOUBLE_HILO_SWAPPED}
+      2: (high,low: longword);
+{$else}
+      2: (low,high: longword);
+{$endif FPC_DOUBLE_HILO_SWAPPED}
+  end;
+{$endif}
+{$define FPC_SYSTEM_HAS_float64}
+{$endif FPC_SYSTEM_HAS_float64}
+
+{$ifndef FPC_SYSTEM_HAS_float32}
+type
+  float32 = longword;
+{$define FPC_SYSTEM_HAS_float32}
+{$endif FPC_SYSTEM_HAS_float32}
+

+ 6 - 0
rtl/inc/softfpu.pp

@@ -97,8 +97,10 @@ Software IEC/IEEE floating-point types.
 -------------------------------------------------------------------------------
 -------------------------------------------------------------------------------
 }
 }
 TYPE
 TYPE
+{$ifndef FPC_SYSTEM_HAS_float32}
   float32 = longword;
   float32 = longword;
 {$define FPC_SYSTEM_HAS_float32}
 {$define FPC_SYSTEM_HAS_float32}
+{$endif ndef FPC_SYSTEM_HAS_float32}
   { we use here a record in the function header because
   { we use here a record in the function header because
     the record allows bitwise conversion to single }
     the record allows bitwise conversion to single }
   float32rec = record
   float32rec = record
@@ -123,6 +125,7 @@ TYPE
   sbits64 = int64;
   sbits64 = int64;
 
 
 {$ifdef ENDIAN_LITTLE}
 {$ifdef ENDIAN_LITTLE}
+{$ifndef FPC_SYSTEM_HAS_float64}
   float64 = record
   float64 = record
     case byte of
     case byte of
       // force the record to be aligned like a double
       // force the record to be aligned like a double
@@ -131,6 +134,7 @@ TYPE
       1: (dummy : double);
       1: (dummy : double);
       2: (low,high : bits32);
       2: (low,high : bits32);
   end;
   end;
+{$endif ndef FPC_SYSTEM_HAS_float64}
 
 
   floatx80 = record
   floatx80 = record
     case byte of
     case byte of
@@ -150,6 +154,7 @@ TYPE
       2: (low,high : qword);
       2: (low,high : qword);
   end;
   end;
 {$else}
 {$else}
+{$ifndef FPC_SYSTEM_HAS_float64}
   float64 = record
   float64 = record
       case byte of
       case byte of
         // force the record to be aligned like a double
         // force the record to be aligned like a double
@@ -157,6 +162,7 @@ TYPE
         1: (dummy : double);
         1: (dummy : double);
         2: (high,low : bits32);
         2: (high,low : bits32);
   end;
   end;
+{$endif ndef FPC_SYSTEM_HAS_float64}
 
 
   floatx80 = record
   floatx80 = record
     case byte of
     case byte of

+ 2 - 0
rtl/inc/systemh.inc

@@ -115,6 +115,8 @@ Type
     on Real <-> Double, so use type here, see also tw7425.pp (FK) }
     on Real <-> Double, so use type here, see also tw7425.pp (FK) }
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
   Real = type Double;
   Real = type Double;
+{ Include generic version of float64 record }
+{$I genmathh.inc}
 {$endif}
 {$endif}
 
 
 {$ifdef CPUI386}
 {$ifdef CPUI386}

+ 1 - 0
rtl/java/jsystemh_types.inc

@@ -84,6 +84,7 @@ Type
     on Real <-> Double, so use type here, see also tw7425.pp (FK) }
     on Real <-> Double, so use type here, see also tw7425.pp (FK) }
 {$ifndef FPUNONE}
 {$ifndef FPUNONE}
   Real = type Double;
   Real = type Double;
+{$i genmathh.inc}
 {$endif}
 {$endif}
 
 
 {$ifdef CPUI386}
 {$ifdef CPUI386}