1. with Ada.Strings.Unbounded;             use Ada.Strings.Unbounded; 
  2. with Interfaces;                        use Interfaces; 
  3.  
  4. package Support is 
  5.  
  6.     function "*"( i : Integer; f : Float ) return Float; 
  7.  
  8.     function "*"( f : Float; i : Integer ) return Float; 
  9.  
  10.     function "/"( i : Integer; f : Float ) return Float; 
  11.  
  12.     function "/"( f : Float; i : Integer ) return Float; 
  13.  
  14.     function "-"( f : Float; i : Integer ) return Float; 
  15.  
  16.     function "-"( i : Integer; f : Float ) return Float; 
  17.  
  18.     function "+"( f : Float; i : Integer ) return Float; 
  19.  
  20.     function "+"( i : Integer; f : Float ) return Float; 
  21.  
  22.     function "**"( l, r : Long_Float ) return Long_Float; 
  23.  
  24.     function Constrain( val, min, max : Float ) return Float; 
  25.  
  26.     function Constrain( val, min, max : Integer ) return Integer; 
  27.  
  28.     function Div_Ceil( a, b : Integer ) return Integer; 
  29.  
  30.     function Floor( x : Float ) return Integer; 
  31.  
  32.     function Max( a, b : Integer ) return Integer; 
  33.  
  34.     function Max( a, b : Float ) return Float; 
  35.  
  36.     function Min( a, b : Integer ) return Integer; 
  37.  
  38.     function Min( a, b : Float ) return Float; 
  39.  
  40.     ---------------------------------------------------------------------------- 
  41.  
  42.     function "&"( l : String; r : Unbounded_String ) return String; 
  43.  
  44.     function "&"( l : Unbounded_String; r : String ) return String; 
  45.  
  46.     -- Capitalizes the words in the string using a set of delimiters. 
  47.     function Capitalize( str : String ) return String; 
  48.     pragma Postcondition( Capitalize'Result'Length = str'Length ); 
  49.  
  50.     function Case_Eq( l, r : String ) return Boolean; 
  51.  
  52.     function Case_Eq( l, r : Unbounded_String ) return Boolean; 
  53.  
  54.     function Case_Eq( l : Unbounded_String; r : String ) return Boolean; 
  55.  
  56.     function Case_Eq( l : String; r : Unbounded_String ) return Boolean; 
  57.  
  58.     -- Returns True if 'str' ends with 'ending'. Comparison is case sensitive. 
  59.     function Ends_With( str : String; ending : String ) return Boolean; 
  60.  
  61.     -- Iterate over words in a string separated by whitespace. 
  62.     procedure Iterate_Words( phrase  : String; 
  63.                              examine : access procedure( word : String ) ); 
  64.  
  65.     ---------------------------------------------------------------------------- 
  66.  
  67.     -- Returns -1 if the file does not exist. 
  68.     function File_Length( path : String ) return Long_Integer; 
  69.     pragma Postcondition( File_Length'Result >= -1 ); 
  70.  
  71.     ---------------------------------------------------------------------------- 
  72.  
  73.     -- Extracts a readable Ada unit name from a source reference line. If the 
  74.     -- source reference doesn't contain symbols then an empty string will be 
  75.     -- returned because the unit name can't be determined. 
  76.     function Source_Ref_To_Unit_Name( ref : String ) return String; 
  77.  
  78.     ---------------------------------------------------------------------------- 
  79.  
  80.     -- Returns True if rectangle A contains point B. 
  81.     function Contains( ax1, ay1, ax2, ay2, bx, by : Integer ) return Boolean; 
  82.  
  83.     -- Returns the value of 'point' as it would be snapped to a grid of size 
  84.     -- 'gridSize'. If 'centered' is True, the snap will occur in the middle of 
  85.     -- the grid lines instead of on them. 
  86.     function Grid_Snap( point    : Integer; 
  87.                         gridSize : Positive; 
  88.                         centered : Boolean := False ) return Integer; 
  89.  
  90.     -- Returns True if rectangles A and B intersect. 
  91.     function Intersect( ax1, ay1, ax2, ay2, bx1, by1, bx2, by2 : Integer ) return Boolean; 
  92.  
  93.     ---------------------------------------------------------------------------- 
  94.  
  95.     function Image( i : Integer ) return String; 
  96.     pragma Postcondition( Image'Result'Length > 0 ); 
  97.  
  98.     function Image( u : Unsigned_32 ) return String; 
  99.     pragma Postcondition( Image'Result'Length > 0 ); 
  100.  
  101.     -- Returns a string image of a floating point number, where 'precision' is 
  102.     -- the number of places after the decimal to render. 
  103.     function Image( f : Float; precision : Natural := 3 ) return String; 
  104.     pragma Postcondition( Image'Result'Length > 0 ); 
  105.  
  106. private 
  107.  
  108.     package OS is 
  109.  
  110.         -- Returns the file extension for executable files, not including a dot. 
  111.         function Executable_Extension return String; 
  112.  
  113.         -- Returns the absolute path of the current executable file. 
  114.         function Executable_Path return String; 
  115.  
  116.         -- Returns the home directory. 
  117.         function Home_Directory return String; 
  118.  
  119.         -- Returns the directory for system fonts on the local machine. 
  120.         function System_Font_Directory return String; 
  121.  
  122.     end OS; 
  123.  
  124.     pragma Import( C, "**", "pow" ); 
  125.  
  126. end Support;