1 /*
2 * Helper functions for ntdll
3 *
4 * Copyright 2000 Juergen Schmied
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "config.h"
22
23 #include <time.h>
24 #include <math.h>
25 #ifdef HAVE_SYS_UTSNAME_H
26 #include <sys/utsname.h>
27 #endif
28
29 #include "wine/library.h"
30 #include "wine/debug.h"
31 #include "ntdll_misc.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
34
35 #if defined(__GNUC__) && defined(__i386__)
36 #define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
37 #define POP_FPU(x) DO_FPU("fstpl",x)
38 #endif
39
40 void dump_ObjectAttributes (const OBJECT_ATTRIBUTES *oa)
41 {
42 if (oa)
43 TRACE("%p:(name=%s, attr=0x%08x, hRoot=%p, sd=%p)\n",
44 oa, debugstr_us(oa->ObjectName),
45 oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor);
46 }
47
48 LPCSTR debugstr_us( const UNICODE_STRING *us )
49 {
50 if (!us) return "<null>";
51 return debugstr_wn(us->Buffer, us->Length / sizeof(WCHAR));
52 }
53
54 /*********************************************************************
55 * _ftol (NTDLL.@)
56 *
57 * VERSION
58 * [GNUC && i386]
59 */
60 #if defined(__GNUC__) && defined(__i386__)
61 LONGLONG CDECL NTDLL__ftol(void)
62 {
63 /* don't just do DO_FPU("fistp",retval), because the rounding
64 * mode must also be set to "round towards zero"... */
65 double fl;
66 POP_FPU(fl);
67 return (LONGLONG)fl;
68 }
69 #endif /* defined(__GNUC__) && defined(__i386__) */
70
71 /*********************************************************************
72 * _ftol (NTDLL.@)
73 *
74 * FIXME
75 * Should be register function
76 * VERSION
77 * [!GNUC && i386]
78 */
79 #if !defined(__GNUC__) && defined(__i386__)
80 LONGLONG CDECL NTDLL__ftol(double fl)
81 {
82 FIXME("should be register function\n");
83 return (LONGLONG)fl;
84 }
85 #endif /* !defined(__GNUC__) && defined(__i386__) */
86
87 /*********************************************************************
88 * _ftol (NTDLL.@)
89 * VERSION
90 * [!i386]
91 */
92 #ifndef __i386__
93 LONG CDECL NTDLL__ftol(double fl)
94 {
95 return (LONG) fl;
96 }
97 #endif /* !defined(__i386__) */
98
99 /*********************************************************************
100 * _CIpow (NTDLL.@)
101 * VERSION
102 * [GNUC && i386]
103 */
104 #if defined(__GNUC__) && defined(__i386__)
105 double CDECL NTDLL__CIpow(void)
106 {
107 double x,y;
108 POP_FPU(y);
109 POP_FPU(x);
110 return pow(x,y);
111 }
112 #endif /* defined(__GNUC__) && defined(__i386__) */
113
114
115 /*********************************************************************
116 * _CIpow (NTDLL.@)
117 *
118 * FIXME
119 * Should be register function
120 *
121 * VERSION
122 * [!GNUC && i386]
123 */
124 #if !defined(__GNUC__) && defined(__i386__)
125 double CDECL NTDLL__CIpow(double x,double y)
126 {
127 FIXME("should be register function\n");
128 return pow(x,y);
129 }
130 #endif /* !defined(__GNUC__) && defined(__i386__) */
131
132 /*********************************************************************
133 * _CIpow (NTDLL.@)
134 * VERSION
135 * [!i386]
136 */
137 #ifndef __i386__
138 double CDECL NTDLL__CIpow(double x,double y)
139 {
140 return pow(x,y);
141 }
142 #endif /* !defined(__i386__) */
143
144
145 /*********************************************************************
146 * wine_get_version (NTDLL.@)
147 */
148 const char * CDECL NTDLL_wine_get_version(void)
149 {
150 return wine_get_version();
151 }
152
153 /*********************************************************************
154 * wine_get_build_id (NTDLL.@)
155 */
156 const char * CDECL NTDLL_wine_get_build_id(void)
157 {
158 return wine_get_build_id();
159 }
160
161 /*********************************************************************
162 * wine_get_host_version (NTDLL.@)
163 */
164 void CDECL NTDLL_wine_get_host_version( const char **sysname, const char **release )
165 {
166 #ifdef HAVE_SYS_UTSNAME_H
167 static struct utsname buf;
168 static int init_done;
169
170 if (!init_done)
171 {
172 uname( &buf );
173 init_done = 1;
174 }
175 if (sysname) *sysname = buf.sysname;
176 if (release) *release = buf.release;
177 #else
178 if (sysname) *sysname = "";
179 if (release) *release = "";
180 #endif
181 }
182
183 /*********************************************************************
184 * abs (NTDLL.@)
185 */
186 int CDECL NTDLL_abs( int i )
187 {
188 return abs( i );
189 }
190
191 /*********************************************************************
192 * labs (NTDLL.@)
193 */
194 LONG CDECL NTDLL_labs( LONG i )
195 {
196 return labs( i );
197 }
198
199 /*********************************************************************
200 * atan (NTDLL.@)
201 */
202 double CDECL NTDLL_atan( double d )
203 {
204 return atan( d );
205 }
206
207 /*********************************************************************
208 * ceil (NTDLL.@)
209 */
210 double CDECL NTDLL_ceil( double d )
211 {
212 return ceil( d );
213 }
214
215 /*********************************************************************
216 * cos (NTDLL.@)
217 */
218 double CDECL NTDLL_cos( double d )
219 {
220 return cos( d );
221 }
222
223 /*********************************************************************
224 * fabs (NTDLL.@)
225 */
226 double CDECL NTDLL_fabs( double d )
227 {
228 return fabs( d );
229 }
230
231 /*********************************************************************
232 * floor (NTDLL.@)
233 */
234 double CDECL NTDLL_floor( double d )
235 {
236 return floor( d );
237 }
238
239 /*********************************************************************
240 * log (NTDLL.@)
241 */
242 double CDECL NTDLL_log( double d )
243 {
244 return log( d );
245 }
246
247 /*********************************************************************
248 * pow (NTDLL.@)
249 */
250 double CDECL NTDLL_pow( double x, double y )
251 {
252 return pow( x, y );
253 }
254
255 /*********************************************************************
256 * sin (NTDLL.@)
257 */
258 double CDECL NTDLL_sin( double d )
259 {
260 return sin( d );
261 }
262
263 /*********************************************************************
264 * sqrt (NTDLL.@)
265 */
266 double CDECL NTDLL_sqrt( double d )
267 {
268 return sqrt( d );
269 }
270
271 /*********************************************************************
272 * tan (NTDLL.@)
273 */
274 double CDECL NTDLL_tan( double d )
275 {
276 return tan( d );
277 }
278
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.