xed-portability.h

Go to the documentation of this file.
00001 /*BEGIN_LEGAL 
00002 Copyright (c) 2007, Intel Corp.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are
00007 met:
00008 
00009     * Redistributions of source code must retain the above copyright
00010       notice, this list of conditions and the following disclaimer.
00011 
00012     * Redistributions in binary form must reproduce the above
00013       copyright notice, this list of conditions and the following
00014       disclaimer in the documentation and/or other materials provided
00015       with the distribution.
00016 
00017     * Neither the name of Intel Corporation nor the names of its
00018       contributors may be used to endorse or promote products derived
00019       from this software without specific prior written permission.
00020 
00021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00024 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00025 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00026 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00027 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00028 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00029 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00031 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00032 END_LEGAL */
00035 
00036 #ifndef _XED_PORTABILITY_H_
00037 # define _XED_PORTABILITY_H_
00038 # include "xed-types.h"
00039 
00040 #define STATIC_CAST(x,y) ((x) (y))
00041 #define REINTERPRET_CAST(x,y) ((x) (y))
00042 
00043 XED_DLL_EXPORT xed_uint_t xed_strlen(const char* s);
00044 XED_DLL_EXPORT void xed_strcat(char* dst, const char* src);
00045 XED_DLL_EXPORT void xed_strcpy(char* dst, const char* src);
00047 XED_DLL_EXPORT int xed_strncpy(char* dst, const char* src,  int len);
00049 XED_DLL_EXPORT int xed_strncat(char* dst, const char* src,  int len);
00050 
00051 
00052 /* recognize VC98 */
00053 #if !defined(__INTEL_COMPILER)
00054 # if defined(_WIN32) && defined(_MSC_VER)
00055 #   if _MSC_VER == 1200
00056 #     define XED_MSVC6 1
00057 #   endif
00058 # endif
00059 # if defined(_WIN32) && defined(_MSC_VER)
00060 #   if _MSC_VER == 1310
00061 #     define XED_MSVC7 1
00062 #   endif
00063 # endif
00064 # if defined(_WIN32) && defined(_MSC_VER)
00065 #   if _MSC_VER == 1400
00066 #     define XED_MSVC8 1
00067 #   endif
00068 # endif
00069 #endif
00070 
00071 /* I've had compatibilty problems here so I'm using a trivial indirection */
00072 #if defined(__GNUC__)
00073 #  if defined(__CYGWIN__)
00074       /* cygwin's gcc 3.4.4 on windows  complains */
00075 #    define XED_FMT_X "%lx"
00076 #    define XED_FMT_08X "%08lx"
00077 #    define XED_FMT_D "%ld"
00078 #    define XED_FMT_U "%lu"
00079 #    define XED_FMT_9U "%9lu"
00080 #  else
00081 #    define XED_FMT_X "%x"
00082 #    define XED_FMT_08X "%08x"
00083 #    define XED_FMT_D "%d"
00084 #    define XED_FMT_U "%u"
00085 #    define XED_FMT_9U "%9u"
00086 #  endif
00087 #else
00088 #  define XED_FMT_X "%x"
00089 #  define XED_FMT_08X "%08x"
00090 #  define XED_FMT_D "%d"
00091 #  define XED_FMT_U "%u"
00092 #  define XED_FMT_9U "%9u"
00093 #endif
00094 
00095 #if defined(__GNUC__) && defined(__LP64__) && !defined(__APPLE__)
00096 # define XED_FMT_LX "%lx"
00097 # define XED_FMT_LU "%lu"
00098 # define XED_FMT_LD "%ld"
00099 # define XED_FMT_LX16 "%016lx"
00100 #else
00101 # define XED_FMT_LX "%llx"
00102 # define XED_FMT_LU "%llu"
00103 # define XED_FMT_LD "%lld"
00104 # define XED_FMT_LX16 "%016llx"
00105 #endif
00106 
00107 #if defined(_M_IA64)
00108 # define XED_IPF
00109 # define XED_FMT_SIZET "%ld"
00110 #else
00111 # define XED_FMT_SIZET "%d"
00112 #endif
00113 
00114 #if defined(__GNUC__) 
00115 # define XED_INLINE inline
00116 # define XED_NORETURN __attribute__ ((noreturn))
00117 # if __GNUC__ == 2
00118 #   define XED_NOINLINE 
00119 # else
00120 #   define XED_NOINLINE __attribute__ ((noinline))
00121 # endif
00122 #else
00123 # define XED_INLINE __inline
00124 # if defined(XED_MSVC6)
00125 #   define XED_NOINLINE 
00126 # else
00127 #   define XED_NOINLINE __declspec(noinline)
00128 # endif
00129 # define XED_NORETURN __declspec(noreturn)
00130 #endif
00131 
00132 #endif  // _XED_PORTABILITY_H_
00133 
00135 //Local Variables:
00136 //pref: "../../xed-portability.c"
00137 //End:

Generated on Thu May 15 03:15:09 2008 for XED2 by  doxygen 1.4.6