comparison dmd/port.h @ 1:c53b6e3fe49a trunk

[svn r5] Initial commit. Most things are very rough.
author lindquist
date Sat, 01 Sep 2007 21:43:27 +0200
parents
children
comparison
equal deleted inserted replaced
0:a9e71648e74d 1:c53b6e3fe49a
1
2 // Copyright (c) 1999-2002 by Digital Mars
3 // All Rights Reserved
4 // written by Walter Bright
5 // www.digitalmars.com
6
7 #ifndef PORT_H
8 #define PORT_H
9
10 // Portable wrapper around compiler/system specific things.
11 // The idea is to minimize #ifdef's in the app code.
12
13 #ifndef TYPEDEFS
14 #define TYPEDEFS
15
16 #include <wchar.h>
17
18 #if _MSC_VER
19 typedef __int64 longlong;
20 typedef unsigned __int64 ulonglong;
21 #else
22 typedef long long longlong;
23 typedef unsigned long long ulonglong;
24 #endif
25
26 #endif
27
28 typedef double d_time;
29
30 struct Port
31 {
32 static double nan;
33 static double infinity;
34 static double dbl_max;
35 static double dbl_min;
36
37 #if __GNUC__
38 // These conflict with macros in math.h, should rename them
39 #undef isnan
40 #undef isfinite
41 #undef isinfinity
42 #undef signbit
43 #endif
44 static int isNan(double);
45 static int isFinite(double);
46 static int isInfinity(double);
47 static int Signbit(double);
48
49 static double floor(double);
50 static double pow(double x, double y);
51
52 static ulonglong strtoull(const char *p, char **pend, int base);
53
54 static char *ull_to_string(char *buffer, ulonglong ull);
55 static wchar_t *ull_to_string(wchar_t *buffer, ulonglong ull);
56
57 // Convert ulonglong to double
58 static double ull_to_double(ulonglong ull);
59
60 // Get locale-dependent list separator
61 static char *list_separator();
62 static wchar_t *wlist_separator();
63 };
64
65 #endif