Browse Source

Move EqualsValue/LessThanValue/GreaterThanValue to unit Types, refer to them in the Math unit

Ondrej Pokorny 1 year ago
parent
commit
617d56f23a
2 changed files with 22 additions and 7 deletions
  1. 16 7
      rtl/objpas/math.pp
  2. 6 0
      rtl/objpas/types.pp

+ 16 - 7
rtl/objpas/math.pp

@@ -56,10 +56,10 @@ interface
 {$ifndef FPUNONE}
 {$IFDEF FPC_DOTTEDUNITS}
     uses
-       System.SysUtils;
+       System.SysUtils, System.Types;
 {$ELSE FPC_DOTTEDUNITS}
     uses
-       sysutils;
+       sysutils, types;
 {$ENDIF FPC_DOTTEDUNITS}
 
 {$IFDEF FPDOC_MATH}
@@ -144,13 +144,22 @@ Const
 
        EInvalidArgument = class(ematherror);
 
-       TValueRelationship = -1..1;
+{$IFDEF FPC_DOTTEDUNITS}
+       TValueRelationship = System.Types.TValueRelationship;
+{$ELSE FPC_DOTTEDUNITS}
+       TValueRelationship = types.TValueRelationship;
+{$ENDIF FPC_DOTTEDUNITS}
 
     const
-       EqualsValue = 0;
-       LessThanValue = Low(TValueRelationship);
-       GreaterThanValue = High(TValueRelationship);
-       
+{$IFDEF FPC_DOTTEDUNITS}
+       EqualsValue = System.Types.EqualsValue;
+       LessThanValue = System.Types.LessThanValue;
+       GreaterThanValue = System.Types.GreaterThanValue;
+{$ELSE FPC_DOTTEDUNITS}
+       EqualsValue = types.EqualsValue;
+       LessThanValue = types.LessThanValue;
+       GreaterThanValue = types.GreaterThanValue;
+{$ENDIF FPC_DOTTEDUNITS}
 
        
 {$push}

+ 6 - 0
rtl/objpas/types.pp

@@ -47,6 +47,12 @@ type
   TDirection = (FromBeginning, FromEnd);
   TValueRelationship = -1..1;
 
+const
+  LessThanValue = Low(TValueRelationship);
+  EqualsValue = 0;
+  GreaterThanValue = High(TValueRelationship);
+
+type
   DWORD = LongWord;
 
   PLongint = System.PLongint;