1 | /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. |
---|
2 | This file is part of the GNU C Library. |
---|
3 | |
---|
4 | The GNU C Library is free software; you can redistribute it and/or |
---|
5 | modify it under the terms of the GNU Lesser General Public |
---|
6 | License as published by the Free Software Foundation; either |
---|
7 | version 2.1 of the License, or (at your option) any later version. |
---|
8 | |
---|
9 | The GNU C Library is distributed in the hope that it will be useful, |
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | Lesser General Public License for more details. |
---|
13 | |
---|
14 | You should have received a copy of the GNU Lesser General Public |
---|
15 | License along with the GNU C Library; if not, write to the Free |
---|
16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
---|
17 | 02111-1307 USA. */ |
---|
18 | |
---|
19 | /* |
---|
20 | * ISO C99: 7.3 Complex arithmetic <complex.h> |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _COMPLEX_H |
---|
24 | #define _COMPLEX_H 1 |
---|
25 | |
---|
26 | #include <sys/types.h> |
---|
27 | #include <features.h> |
---|
28 | |
---|
29 | __BEGIN_DECLS |
---|
30 | |
---|
31 | #define __CONCAT(x,y) x ## y |
---|
32 | /* We might need to add support for more compilers here. But since ISO |
---|
33 | C99 is out hopefully all maintained compilers will soon provide the data |
---|
34 | types `float complex' and `double complex'. */ |
---|
35 | #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) |
---|
36 | # define _Complex __complex__ |
---|
37 | #endif |
---|
38 | |
---|
39 | #define complex _Complex |
---|
40 | |
---|
41 | /* Narrowest imaginary unit. This depends on the floating-point |
---|
42 | evaluation method. |
---|
43 | XXX This probably has to go into a gcc related file. */ |
---|
44 | #define _Complex_I (__extension__ 1.0iF) |
---|
45 | |
---|
46 | /* Another more descriptive name is `I'. |
---|
47 | XXX Once we have the imaginary support switch this to _Imaginary_I. */ |
---|
48 | #undef I |
---|
49 | #define I _Complex_I |
---|
50 | |
---|
51 | /* The file <bits/cmathcalls.h> contains the prototypes for all the |
---|
52 | actual math functions. These macros are used for those prototypes, |
---|
53 | so we can easily declare each function as both `name' and `__name', |
---|
54 | and can declare the float versions `namef' and `__namef'. */ |
---|
55 | |
---|
56 | #define __MATHCALL(function, args) \ |
---|
57 | __MATHDECL (_Mdouble_complex_,function, args) |
---|
58 | #define __MATHDECL(type, function, args) \ |
---|
59 | __MATHDECL_1(type, function, args); \ |
---|
60 | __MATHDECL_1(type, __CONCAT(__,function), args) |
---|
61 | #define __MATHDECL_1(type, function, args) \ |
---|
62 | extern type __MATH_PRECNAME(function) args __THROW |
---|
63 | |
---|
64 | #define _Mdouble_ double |
---|
65 | #define __MATH_PRECNAME(name) name |
---|
66 | #include <cmathcalls.h> |
---|
67 | #undef _Mdouble_ |
---|
68 | #undef __MATH_PRECNAME |
---|
69 | |
---|
70 | /* Now the float versions. */ |
---|
71 | #ifndef _Mfloat_ |
---|
72 | # define _Mfloat_ float |
---|
73 | #endif |
---|
74 | #define _Mdouble_ _Mfloat_ |
---|
75 | #ifdef __STDC__ |
---|
76 | # define __MATH_PRECNAME(name) name##f |
---|
77 | #else |
---|
78 | # define __MATH_PRECNAME(name) name/**/f |
---|
79 | #endif |
---|
80 | #include <cmathcalls.h> |
---|
81 | #undef _Mdouble_ |
---|
82 | #undef __MATH_PRECNAME |
---|
83 | |
---|
84 | #if 0 |
---|
85 | /* And the long double versions. It is non-critical to define them |
---|
86 | here unconditionally since `long double' is required in ISO C99. */ |
---|
87 | #if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH |
---|
88 | # ifndef _Mlong_double_ |
---|
89 | # define _Mlong_double_ long double |
---|
90 | # endif |
---|
91 | # define _Mdouble_ _Mlong_double_ |
---|
92 | # ifdef __STDC__ |
---|
93 | # define __MATH_PRECNAME(name) name##l |
---|
94 | # else |
---|
95 | # define __MATH_PRECNAME(name) name/**/l |
---|
96 | # endif |
---|
97 | # include <cmathcalls.h> |
---|
98 | #endif |
---|
99 | #endif |
---|
100 | #undef _Mdouble_ |
---|
101 | #undef __MATH_PRECNAME |
---|
102 | #undef __MATHDECL_1 |
---|
103 | #undef __MATHDECL |
---|
104 | #undef __MATHCALL |
---|
105 | |
---|
106 | __END_DECLS |
---|
107 | |
---|
108 | #endif /* complex.h */ |
---|