Print this page
10882 math headers should stop supporting K&R C
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/fenv.h
+++ new/usr/src/head/fenv.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 23 */
24 24 /*
25 25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 */
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
28 28
29 29 #ifndef _FENV_H
30 30 #define _FENV_H
31 31
32 32 #include <sys/feature_tests.h>
33 33
34 34 #ifdef __cplusplus
35 35 extern "C" {
36 36 #endif
37 37
38 -#ifndef __P
39 -#ifdef __STDC__
40 -#define __P(p) p
41 -#else
42 -#define __P(p) ()
43 -#endif
44 -#endif /* !defined(__P) */
45 -
46 38 /*
47 39 * Rounding modes
48 40 */
49 41 #if defined(__sparc)
50 42
51 43 #define FE_TONEAREST 0
52 44 #define FE_TOWARDZERO 1
53 45 #define FE_UPWARD 2
54 46 #define FE_DOWNWARD 3
55 47
56 48 #elif defined(__i386) || defined(__amd64)
57 49
58 50 #define FE_TONEAREST 0
59 51 #define FE_DOWNWARD 1
60 52 #define FE_UPWARD 2
61 53 #define FE_TOWARDZERO 3
62 54
63 55 #endif
64 56
65 -extern int fegetround __P((void));
66 -extern int fesetround __P((int));
57 +extern int fegetround(void);
58 +extern int fesetround(int);
67 59
68 60 #if (defined(__i386) || defined(__amd64)) && \
69 61 (!defined(_STRICT_STDC) || defined(__EXTENSIONS__))
70 62
71 63 #define FE_FLTPREC 0
72 64 #define FE_DBLPREC 2
73 65 #define FE_LDBLPREC 3
74 66
75 -extern int fegetprec __P((void));
76 -extern int fesetprec __P((int));
67 +extern int fegetprec(void);
68 +extern int fesetprec(int);
77 69
78 70 #endif
79 71
80 72 /*
81 73 * Exception flags
82 74 */
83 75 #if defined(__sparc)
84 76
85 77 #define FE_INEXACT 0x01
86 78 #define FE_DIVBYZERO 0x02
87 79 #define FE_UNDERFLOW 0x04
88 80 #define FE_OVERFLOW 0x08
89 81 #define FE_INVALID 0x10
90 82 #define FE_ALL_EXCEPT 0x1f
91 83
92 84 #elif defined(__i386) || defined(__amd64)
93 85
94 86 #define FE_INVALID 0x01
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
95 87 #define FE_DIVBYZERO 0x04
96 88 #define FE_OVERFLOW 0x08
97 89 #define FE_UNDERFLOW 0x10
98 90 #define FE_INEXACT 0x20
99 91 #define FE_ALL_EXCEPT 0x3d
100 92
101 93 #endif
102 94
103 95 typedef int fexcept_t;
104 96
105 -extern int feclearexcept __P((int));
106 -extern int feraiseexcept __P((int));
107 -extern int fetestexcept __P((int));
108 -extern int fegetexceptflag __P((fexcept_t *, int));
109 -extern int fesetexceptflag __P((const fexcept_t *, int));
97 +extern int feclearexcept(int);
98 +extern int feraiseexcept(int);
99 +extern int fetestexcept(int);
100 +extern int fegetexceptflag(fexcept_t *, int);
101 +extern int fesetexceptflag(const fexcept_t *, int);
110 102
111 103 #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
112 104
113 105 /*
114 106 * Exception handling extensions
115 107 */
116 108 #define FEX_NOHANDLER -1
117 109 #define FEX_NONSTOP 0
118 110 #define FEX_ABORT 1
119 111 #define FEX_SIGNAL 2
120 112 #define FEX_CUSTOM 3
121 113
122 114 #define FEX_INEXACT 0x001
123 115 #define FEX_DIVBYZERO 0x002
124 116 #define FEX_UNDERFLOW 0x004
125 117 #define FEX_OVERFLOW 0x008
126 118 #define FEX_INV_ZDZ 0x010
127 119 #define FEX_INV_IDI 0x020
128 120 #define FEX_INV_ISI 0x040
129 121 #define FEX_INV_ZMI 0x080
130 122 #define FEX_INV_SQRT 0x100
131 123 #define FEX_INV_SNAN 0x200
132 124 #define FEX_INV_INT 0x400
133 125 #define FEX_INV_CMP 0x800
134 126 #define FEX_INVALID 0xff0
135 127 #define FEX_COMMON (FEX_INVALID | FEX_DIVBYZERO | FEX_OVERFLOW)
136 128 #define FEX_ALL (FEX_COMMON | FEX_UNDERFLOW | FEX_INEXACT)
137 129 #define FEX_NONE 0
138 130
139 131 #define FEX_NUM_EXC 12
140 132
141 133 /* structure to hold a numeric value in any format used by the FPU */
142 134 typedef struct {
143 135 enum fex_nt {
144 136 fex_nodata = 0,
145 137 fex_int = 1,
146 138 fex_llong = 2,
147 139 fex_float = 3,
148 140 fex_double = 4,
149 141 fex_ldouble = 5
150 142 } type;
151 143 union {
152 144 int i;
153 145 #if !defined(_STRICT_STDC) && !defined(_NO_LONGLONG) || defined(_STDC_C99) || \
154 146 defined(__C99FEATURES__)
155 147 long long l;
156 148 #else
157 149 struct {
158 150 int l[2];
159 151 } l;
160 152 #endif
161 153 float f;
162 154 double d;
163 155 long double q;
164 156 } val;
165 157 } fex_numeric_t;
166 158
167 159 /* structure to supply information about an exception to a custom handler */
168 160 typedef struct {
169 161 enum fex_op {
170 162 fex_add = 0,
171 163 fex_sub = 1,
172 164 fex_mul = 2,
173 165 fex_div = 3,
174 166 fex_sqrt = 4,
175 167 fex_cnvt = 5,
176 168 fex_cmp = 6,
177 169 fex_other = 7
↓ open down ↓ |
58 lines elided |
↑ open up ↑ |
178 170 } op; /* operation that caused the exception */
179 171 int flags; /* flags to be set */
180 172 fex_numeric_t op1, op2, res; /* operands and result */
181 173 } fex_info_t;
182 174
183 175 typedef struct fex_handler_data {
184 176 int __mode;
185 177 void (*__handler)();
186 178 } fex_handler_t[FEX_NUM_EXC];
187 179
188 -extern int fex_get_handling __P((int));
189 -extern int fex_set_handling __P((int, int, void (*)()));
180 +extern int fex_get_handling(int);
181 +extern int fex_set_handling(int, int, void (*)());
190 182
191 -extern void fex_getexcepthandler __P((fex_handler_t *, int));
192 -extern void fex_setexcepthandler __P((const fex_handler_t *, int));
183 +extern void fex_getexcepthandler(fex_handler_t *, int);
184 +extern void fex_setexcepthandler(const fex_handler_t *, int);
193 185
194 186 #ifdef __STDC__
195 187 #include <stdio_tag.h>
196 188 #ifndef _FILEDEFED
197 189 #define _FILEDEFED
198 190 typedef __FILE FILE;
199 191 #endif
200 192 #endif
201 -extern FILE *fex_get_log __P((void));
202 -extern int fex_set_log __P((FILE *));
203 -extern int fex_get_log_depth __P((void));
204 -extern int fex_set_log_depth __P((int));
205 -extern void fex_log_entry __P((const char *));
193 +extern FILE *fex_get_log(void);
194 +extern int fex_set_log(FILE *);
195 +extern int fex_get_log_depth(void);
196 +extern int fex_set_log_depth(int);
197 +extern void fex_log_entry(const char *);
206 198
207 199 #define __fex_handler_t fex_handler_t
208 200
209 201 #else
210 202
211 203 typedef struct {
212 204 int __mode;
213 205 void (*__handler)();
214 206 } __fex_handler_t[12];
215 207
216 208 #endif /* !defined(_STRICT_STDC) || defined(__EXTENSIONS__) */
217 209
218 210 /*
219 211 * Environment as a whole
220 212 */
221 213 typedef struct {
222 214 __fex_handler_t __handlers;
223 215 unsigned long __fsr;
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
224 216 } fenv_t;
225 217
226 218 #ifdef __STDC__
227 219 extern const fenv_t __fenv_dfl_env;
228 220 #else
229 221 extern fenv_t __fenv_dfl_env;
230 222 #endif
231 223
232 224 #define FE_DFL_ENV (&__fenv_dfl_env)
233 225
234 -extern int fegetenv __P((fenv_t *));
235 -extern int fesetenv __P((const fenv_t *));
236 -extern int feholdexcept __P((fenv_t *));
237 -extern int feupdateenv __P((const fenv_t *));
226 +extern int fegetenv(fenv_t *);
227 +extern int fesetenv(const fenv_t *);
228 +extern int feholdexcept(fenv_t *);
229 +extern int feupdateenv(const fenv_t *);
238 230
239 231 #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
240 -extern void fex_merge_flags __P((const fenv_t *));
232 +extern void fex_merge_flags(const fenv_t *);
241 233 #endif
242 234
243 235 #ifdef __cplusplus
244 236 }
245 237 #endif
246 238
247 239 #endif /* _FENV_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX