OSDN Git Service

Add Fariborz to my last change.
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-ngcoty.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --   A D A . N U M E R I C S . G E N E R I C _ C O M P L E X _ T Y P E S    --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-1997 Free Software Foundation, Inc.          --
10 --                                                                          --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the  contents of the part following the private keyword. --
14 --                                                                          --
15 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
16 -- terms of the  GNU General Public License as published  by the Free Soft- --
17 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
18 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
21 -- for  more details.  You should have  received  a copy of the GNU General --
22 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
23 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
24 -- MA 02111-1307, USA.                                                      --
25 --                                                                          --
26 -- As a special exception,  if other files  instantiate  generics from this --
27 -- unit, or you link  this unit with other files  to produce an executable, --
28 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
29 -- covered  by the  GNU  General  Public  License.  This exception does not --
30 -- however invalidate  any other reasons why  the executable file  might be --
31 -- covered by the  GNU Public License.                                      --
32 --                                                                          --
33 -- GNAT was originally developed  by the GNAT team at  New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
35 --                                                                          --
36 ------------------------------------------------------------------------------
37
38 generic
39    type Real is digits <>;
40
41 package Ada.Numerics.Generic_Complex_Types is
42
43 pragma Pure (Generic_Complex_Types);
44
45    type Complex is record
46       Re, Im : Real'Base;
47    end record;
48
49    pragma Complex_Representation (Complex);
50
51    type Imaginary is private;
52
53    i : constant Imaginary;
54    j : constant Imaginary;
55
56    function Re (X : Complex)   return Real'Base;
57    function Im (X : Complex)   return Real'Base;
58    function Im (X : Imaginary) return Real'Base;
59
60    procedure Set_Re (X  : in out Complex;   Re : in Real'Base);
61    procedure Set_Im (X  : in out Complex;   Im : in Real'Base);
62    procedure Set_Im (X  :    out Imaginary; Im : in Real'Base);
63
64    function Compose_From_Cartesian (Re, Im : Real'Base) return Complex;
65    function Compose_From_Cartesian (Re     : Real'Base) return Complex;
66    function Compose_From_Cartesian (Im     : Imaginary) return Complex;
67
68    function Modulus (X     : Complex) return Real'Base;
69    function "abs"   (Right : Complex) return Real'Base renames Modulus;
70
71    function Argument (X : Complex)                    return Real'Base;
72    function Argument (X : Complex; Cycle : Real'Base) return Real'Base;
73
74    function Compose_From_Polar (
75      Modulus, Argument : Real'Base)
76      return Complex;
77
78    function Compose_From_Polar (
79      Modulus, Argument, Cycle : Real'Base)
80      return Complex;
81
82    function "+"       (Right : Complex) return Complex;
83    function "-"       (Right : Complex) return Complex;
84    function Conjugate (X     : Complex) return Complex;
85
86    function "+"       (Left, Right : Complex) return Complex;
87    function "-"       (Left, Right : Complex) return Complex;
88    function "*"       (Left, Right : Complex) return Complex;
89    function "/"       (Left, Right : Complex) return Complex;
90
91    function "**"      (Left : Complex; Right : Integer) return Complex;
92
93    function "+"       (Right : Imaginary) return Imaginary;
94    function "-"       (Right : Imaginary) return Imaginary;
95    function Conjugate (X     : Imaginary) return Imaginary renames "-";
96    function "abs"     (Right : Imaginary) return Real'Base;
97
98    function "+"       (Left, Right : Imaginary) return Imaginary;
99    function "-"       (Left, Right : Imaginary) return Imaginary;
100    function "*"       (Left, Right : Imaginary) return Real'Base;
101    function "/"       (Left, Right : Imaginary) return Real'Base;
102
103    function "**"      (Left : Imaginary; Right : Integer) return Complex;
104
105    function "<"       (Left, Right : Imaginary) return Boolean;
106    function "<="      (Left, Right : Imaginary) return Boolean;
107    function ">"       (Left, Right : Imaginary) return Boolean;
108    function ">="      (Left, Right : Imaginary) return Boolean;
109
110    function "+"       (Left : Complex;   Right : Real'Base) return Complex;
111    function "+"       (Left : Real'Base; Right : Complex)   return Complex;
112    function "-"       (Left : Complex;   Right : Real'Base) return Complex;
113    function "-"       (Left : Real'Base; Right : Complex)   return Complex;
114    function "*"       (Left : Complex;   Right : Real'Base) return Complex;
115    function "*"       (Left : Real'Base; Right : Complex)   return Complex;
116    function "/"       (Left : Complex;   Right : Real'Base) return Complex;
117    function "/"       (Left : Real'Base; Right : Complex)   return Complex;
118
119    function "+"       (Left : Complex;   Right : Imaginary) return Complex;
120    function "+"       (Left : Imaginary; Right : Complex)   return Complex;
121    function "-"       (Left : Complex;   Right : Imaginary) return Complex;
122    function "-"       (Left : Imaginary; Right : Complex)   return Complex;
123    function "*"       (Left : Complex;   Right : Imaginary) return Complex;
124    function "*"       (Left : Imaginary; Right : Complex)   return Complex;
125    function "/"       (Left : Complex;   Right : Imaginary) return Complex;
126    function "/"       (Left : Imaginary; Right : Complex)   return Complex;
127
128    function "+"       (Left : Imaginary; Right : Real'Base) return Complex;
129    function "+"       (Left : Real'Base; Right : Imaginary) return Complex;
130    function "-"       (Left : Imaginary; Right : Real'Base) return Complex;
131    function "-"       (Left : Real'Base; Right : Imaginary) return Complex;
132
133    function "*"       (Left : Imaginary; Right : Real'Base) return Imaginary;
134    function "*"       (Left : Real'Base; Right : Imaginary) return Imaginary;
135    function "/"       (Left : Imaginary; Right : Real'Base) return Imaginary;
136    function "/"       (Left : Real'Base; Right : Imaginary) return Imaginary;
137
138 private
139    type Imaginary is new Real'Base;
140
141    i : constant Imaginary := 1.0;
142    j : constant Imaginary := 1.0;
143
144    pragma Inline ("+");
145    pragma Inline ("-");
146    pragma Inline ("*");
147    pragma Inline ("<");
148    pragma Inline ("<=");
149    pragma Inline (">");
150    pragma Inline (">=");
151    pragma Inline ("abs");
152    pragma Inline (Compose_From_Cartesian);
153    pragma Inline (Conjugate);
154    pragma Inline (Im);
155    pragma Inline (Re);
156    pragma Inline (Set_Im);
157    pragma Inline (Set_Re);
158
159 end Ada.Numerics.Generic_Complex_Types;