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 // Win64 specific config options: 00011 00012 #define LIBSMBIOS_PLATFORM "Win64" 00013 #define LIBSMBIOS_PLATFORM_WIN64 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 // workaround for broken namespace on win64 compiler 00038 #define LIBSMBIOS_NO_STDC_NAMESPACE 00039 00040 // 00041 // Win64 will normally be using native Win64 threads, 00042 // but there is a pthread library available as an option, 00043 // we used to disable this when LIBSMBIOS_DISABLE_WIN64 was 00044 // defined but no longer - this should allow some 00045 // files to be compiled in strict mode - while maintaining 00046 // a consistent setting of LIBSMBIOS_HAS_THREADS across 00047 // all translation units (needed for shared_ptr etc). 00048 // 00049 #ifndef LIBSMBIOS_HAS_PTHREADS 00050 # define LIBSMBIOS_HAS_WINTHREADS 00051 #endif 00052 00053 #ifndef LIBSMBIOS_DISABLE_WIN64 00054 // WEK: Added 00055 #define LIBSMBIOS_HAS_FTIME 00056 00057 #endif 00058 00059 // 00060 // disable min/max macros: 00061 // 00062 #ifdef min 00063 # undef min 00064 #endif 00065 #ifdef max 00066 # undef max 00067 #endif 00068 #ifndef NOMINMAX 00069 # define NOMINMAX 00070 #endif 00071 00072 #ifdef LIBSMBIOS_MSVC 00073 #include <algorithm> // for existing std::min and std::max 00074 namespace std{ 00075 // Apparently, something in the Microsoft libraries requires the "long" 00076 // overload, because it calls the min/max functions with arguments of 00077 // slightly different type. (If this proves to be incorrect, this 00078 // whole "LIBSMBIOS_MSVC" section can be removed.) 00079 inline long min(long __a, long __b) { 00080 return __b < __a ? __b : __a; 00081 } 00082 inline long max(long __a, long __b) { 00083 return __a < __b ? __b : __a; 00084 } 00085 // The "long double" overload is required, otherwise user code calling 00086 // min/max for floating-point numbers will use the "long" overload. 00087 // (SourceForge bug #495495) 00088 inline long double min(long double __a, long double __b) { 00089 return __b < __a ? __b : __a; 00090 } 00091 inline long double max(long double __a, long double __b) { 00092 return __a < __b ? __b : __a; 00093 } 00094 } 00095 using std::min; 00096 using std::max; 00097 # endif 00098 00099