comparison druntime/import/stdc/fenv.d @ 760:6f33b427bfd1

Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 12 Nov 2008 00:19:18 +0100
parents
children
comparison
equal deleted inserted replaced
759:d3eb054172f9 760:6f33b427bfd1
1 /**
2 * D header file for C99.
3 *
4 * Copyright: Public Domain
5 * License: Public Domain
6 * Authors: Sean Kelly, Walter Bright
7 * Standards: ISO/IEC 9899:1999 (E)
8 */
9 module stdc.fenv;
10
11 extern (C):
12
13 version( Windows )
14 {
15 struct fenv_t
16 {
17 ushort status;
18 ushort control;
19 ushort round;
20 ushort[2] reserved;
21 }
22
23 alias int fexcept_t;
24 }
25 else version( linux )
26 {
27 struct fenv_t
28 {
29 ushort __control_word;
30 ushort __unused1;
31 ushort __status_word;
32 ushort __unused2;
33 ushort __tags;
34 ushort __unused3;
35 uint __eip;
36 ushort __cs_selector;
37 ushort __opcode;
38 uint __data_offset;
39 ushort __data_selector;
40 ushort __unused5;
41 }
42
43 alias int fexcept_t;
44 }
45 else version ( darwin )
46 {
47 version ( BigEndian )
48 {
49 alias uint fenv_t;
50 alias uint fexcept_t;
51 }
52 version ( LittleEndian )
53 {
54 struct fenv_t
55 {
56 ushort __control;
57 ushort __status;
58 uint __mxcsr;
59 byte[8] __reserved;
60 }
61
62 alias ushort fexcept_t;
63 }
64 }
65 else version ( freebsd )
66 {
67 struct fenv_t
68 {
69 ushort __control;
70 ushort __mxcsr_hi;
71 ushort __status;
72 ushort __mxcsr_lo;
73 uint __tag;
74 byte[16] __other;
75 }
76
77 alias ushort fexcept_t;
78 }
79 else
80 {
81 static assert( false );
82 }
83
84 enum
85 {
86 FE_INVALID = 1,
87 FE_DENORMAL = 2, // non-standard
88 FE_DIVBYZERO = 4,
89 FE_OVERFLOW = 8,
90 FE_UNDERFLOW = 0x10,
91 FE_INEXACT = 0x20,
92 FE_ALL_EXCEPT = 0x3F,
93 FE_TONEAREST = 0,
94 FE_UPWARD = 0x800,
95 FE_DOWNWARD = 0x400,
96 FE_TOWARDZERO = 0xC00,
97 }
98
99 version( Windows )
100 {
101 private extern fenv_t _FE_DFL_ENV;
102 fenv_t* FE_DFL_ENV = &_FE_DFL_ENV;
103 }
104 else version( linux )
105 {
106 fenv_t* FE_DFL_ENV = cast(fenv_t*)(-1);
107 }
108 else version( darwin )
109 {
110 private extern fenv_t _FE_DFL_ENV;
111 fenv_t* FE_DFL_ENV = &_FE_DFL_ENV;
112 }
113 else version( freebsd )
114 {
115 private extern fenv_t __fe_dfl_env;
116 fenv_t* FE_DFL_ENV = &__fe_dfl_env;
117 }
118 else
119 {
120 static assert( false );
121 }
122
123 void feraiseexcept(int excepts);
124 void feclearexcept(int excepts);
125
126 int fetestexcept(int excepts);
127 int feholdexcept(fenv_t* envp);
128
129 void fegetexceptflag(fexcept_t* flagp, int excepts);
130 void fesetexceptflag(in fexcept_t* flagp, int excepts);
131
132 int fegetround();
133 int fesetround(int round);
134
135 void fegetenv(fenv_t* envp);
136 void fesetenv(in fenv_t* envp);
137 void feupdateenv(in fenv_t* envp);