libsmbios_c library
|
00001 // (C) Copyright John Maddock 2001 - 2003. 00002 // (C) Copyright Bill Kempf 2001. 00003 // (C) Copyright Aleksey Gurtovoy 2003. 00004 // Use, modification and distribution are subject to the 00005 // Boost Software License, Version 1.0. (See accompanying file 00006 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00007 00008 // See http://www.boost.org for most recent version. 00009 00010 // Win32 specific config options: 00011 00012 #define LIBSMBIOS_PLATFORM "Win32" 00013 #define LIBSMBIOS_PLATFORM_WIN32 00014 00015 // Windows has a special platform-specific smbios table accessor method 00016 // that can be used if generic memory access fails. 00017 #define LIBSMBIOS_HAS_ARCH_TABLE_CLASS 00018 00019 // Enable 64-bit file access (changes off_t to 64-bit) 00020 #ifndef FSEEK 00021 #define FSEEK(fh, pos, whence) fseek(fh, static_cast<long>(pos), whence) 00022 #endif 00023 00024 #if defined(__GNUC__) && !defined(LIBSMBIOS_NO_SWPRINTF) 00025 # define LIBSMBIOS_NO_SWPRINTF 00026 #endif 00027 00028 #if !defined(__GNUC__) && !defined(LIBSMBIOS_HAS_DECLSPEC) 00029 # define LIBSMBIOS_HAS_DECLSPEC 00030 #endif 00031 00032 #if defined(__MINGW32__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2))) 00033 # define LIBSMBIOS_HAS_STDINT_H 00034 # define __STDC_LIMIT_MACROS 00035 #endif 00036 00037 // 00038 // Win32 will normally be using native Win32 threads, 00039 // but there is a pthread library available as an option, 00040 // we used to disable this when LIBSMBIOS_DISABLE_WIN32 was 00041 // defined but no longer - this should allow some 00042 // files to be compiled in strict mode - while maintaining 00043 // a consistent setting of LIBSMBIOS_HAS_THREADS across 00044 // all translation units (needed for shared_ptr etc). 00045 // 00046 #ifndef LIBSMBIOS_HAS_PTHREADS 00047 # define LIBSMBIOS_HAS_WINTHREADS 00048 #endif 00049 00050 #ifndef LIBSMBIOS_DISABLE_WIN32 00051 // WEK: Added 00052 #define LIBSMBIOS_HAS_FTIME 00053 00054 #endif 00055 00056 // 00057 // disable min/max macros: 00058 // 00059 #ifdef min 00060 # undef min 00061 #endif 00062 #ifdef max 00063 # undef max 00064 #endif 00065 #ifndef NOMINMAX 00066 # define NOMINMAX 00067 #endif 00068 00069 #ifdef LIBSMBIOS_MSVC 00070 #include <algorithm> // for existing std::min and std::max 00071 namespace std{ 00072 // Apparently, something in the Microsoft libraries requires the "long" 00073 // overload, because it calls the min/max functions with arguments of 00074 // slightly different type. (If this proves to be incorrect, this 00075 // whole "LIBSMBIOS_MSVC" section can be removed.) 00076 inline long min(long __a, long __b) { 00077 return __b < __a ? __b : __a; 00078 } 00079 inline long max(long __a, long __b) { 00080 return __a < __b ? __b : __a; 00081 } 00082 // The "long double" overload is required, otherwise user code calling 00083 // min/max for floating-point numbers will use the "long" overload. 00084 // (SourceForge bug #495495) 00085 inline long double min(long double __a, long double __b) { 00086 return __b < __a ? __b : __a; 00087 } 00088 inline long double max(long double __a, long double __b) { 00089 return __a < __b ? __b : __a; 00090 } 00091 } 00092 using std::min; 00093 using std::max; 00094 # endif 00095 00096