home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adav313.zip / gnat-3_13p-os2-bin-20010916.zip / emx / gnat / examples / tgef.adb < prev    next >
Text File  |  2000-07-19  |  1KB  |  41 lines

  1. --  tgef.adb
  2. --  a simple test to instantiate GEF and call the sin function.
  3.  
  4. with Ada.Numerics.Generic_Elementary_Functions;
  5. with Ada.Numerics; use Ada.Numerics;
  6. with Text_IO;
  7. procedure Tgef is
  8.    package Flt_Io is new Text_IO.Float_Io (Float);
  9.  
  10.    package Elementary_Functions is new
  11.                   Ada.Numerics.Generic_Elementary_Functions (Float);
  12.    Y : Float;
  13.    P : Integer;
  14.    subtype Line is String (1 .. 80);
  15.    Filler  : Line := (others => ' ');
  16.    Display : array (0 .. 21) of Line;
  17. begin
  18.    Text_IO.Set_Page_Length (Text_IO.Current_Output, 0);
  19.  
  20.    for I in Display'range loop
  21.       Display (I) := Filler;
  22.    end loop;
  23.  
  24.    Display (10) := (1 .. 80 => '-');
  25.  
  26.    for I in 1 .. 20 loop
  27.       Y := Elementary_Functions.Sin (Float (I) * Pi / 10.0);
  28.       Flt_Io.Put (Y);
  29.       Text_IO.Put (" <==");
  30.       Text_IO.Put_Line (Integer'Image (I));
  31.       P := Integer (10.0 * Y) + 10;
  32.       Display (P)(4 * I) := '*';
  33.    end loop;
  34.  
  35.    for I in  Display'range loop
  36.       Text_IO.Put_Line (Display (I));
  37.    end loop;
  38.  
  39.    Text_IO.Put_Line ("Tgef exiting");
  40. end Tgef;
  41.