SMBIOS Library
win32.hpp
Go to the documentation of this file.
1 // (C) Copyright John Maddock 2001 - 2003.
2 // (C) Copyright Bill Kempf 2001.
3 // (C) Copyright Aleksey Gurtovoy 2003.
4 // Use, modification and distribution are subject to the
5 // Boost Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 
8 // See http://www.boost.org for most recent version.
9 
10 // Win32 specific config options:
11 
12 #define LIBSMBIOS_PLATFORM "Win32"
13 #define LIBSMBIOS_PLATFORM_WIN32
14 
15 // Windows has a special platform-specific smbios table accessor method
16 // that can be used if generic memory access fails.
17 #define LIBSMBIOS_HAS_ARCH_TABLE_CLASS
18 
19 // Enable 64-bit file access (changes off_t to 64-bit)
20 #define FSEEK(fh, pos, whence) fseek(fh, static_cast<long>(pos), whence)
21 
22 #if defined(__GNUC__) && !defined(LIBSMBIOS_NO_SWPRINTF)
23 # define LIBSMBIOS_NO_SWPRINTF
24 #endif
25 
26 #if !defined(__GNUC__) && !defined(LIBSMBIOS_HAS_DECLSPEC)
27 # define LIBSMBIOS_HAS_DECLSPEC
28 #endif
29 
30 #if defined(__MINGW32__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
31 # define LIBSMBIOS_HAS_STDINT_H
32 # define __STDC_LIMIT_MACROS
33 #endif
34 
35 //
36 // Win32 will normally be using native Win32 threads,
37 // but there is a pthread library available as an option,
38 // we used to disable this when LIBSMBIOS_DISABLE_WIN32 was
39 // defined but no longer - this should allow some
40 // files to be compiled in strict mode - while maintaining
41 // a consistent setting of LIBSMBIOS_HAS_THREADS across
42 // all translation units (needed for shared_ptr etc).
43 //
44 #ifndef LIBSMBIOS_HAS_PTHREADS
45 # define LIBSMBIOS_HAS_WINTHREADS
46 #endif
47 
48 #ifndef LIBSMBIOS_DISABLE_WIN32
49 // WEK: Added
50 #define LIBSMBIOS_HAS_FTIME
51 
52 #endif
53 
54 //
55 // disable min/max macros:
56 //
57 #ifdef min
58 # undef min
59 #endif
60 #ifdef max
61 # undef max
62 #endif
63 #ifndef NOMINMAX
64 # define NOMINMAX
65 #endif
66 
67 #ifdef LIBSMBIOS_MSVC
68 #include <algorithm> // for existing std::min and std::max
69 namespace std{
70  // Apparently, something in the Microsoft libraries requires the "long"
71  // overload, because it calls the min/max functions with arguments of
72  // slightly different type. (If this proves to be incorrect, this
73  // whole "LIBSMBIOS_MSVC" section can be removed.)
74  inline long min(long __a, long __b) {
75  return __b < __a ? __b : __a;
76  }
77  inline long max(long __a, long __b) {
78  return __a < __b ? __b : __a;
79  }
80  // The "long double" overload is required, otherwise user code calling
81  // min/max for floating-point numbers will use the "long" overload.
82  // (SourceForge bug #495495)
83  inline long double min(long double __a, long double __b) {
84  return __b < __a ? __b : __a;
85  }
86  inline long double max(long double __a, long double __b) {
87  return __a < __b ? __b : __a;
88  }
89 }
90 using std::min;
91 using std::max;
92 # endif
93 
94