Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Release 1.0
[palacios.git] / misc / decoder_test / XED2 / include / xed-portability.h
1 /*BEGIN_LEGAL 
2 Intel Open Source License 
3
4 Copyright (c) 2002-2007 Intel Corporation 
5 All rights reserved. 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9
10 Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.  Redistributions
12 in binary form must reproduce the above copyright notice, this list of
13 conditions and the following disclaimer in the documentation and/or
14 other materials provided with the distribution.  Neither the name of
15 the Intel Corporation nor the names of its contributors may be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
18  
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
23 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 END_LEGAL */
31 /// @file xed-portability.h
32 /// @author Mark Charney   <mark.charney@intel.com>
33
34 #ifndef _XED_PORTABILITY_H_
35 # define _XED_PORTABILITY_H_
36 # include "xed-types.h"
37
38 #define STATIC_CAST(x,y) ((x) (y))
39 #define REINTERPRET_CAST(x,y) ((x) (y))
40
41 XED_DLL_EXPORT xed_uint_t xed_strlen(const char* s);
42 XED_DLL_EXPORT void xed_strcat(char* dst, const char* src);
43 XED_DLL_EXPORT void xed_strcpy(char* dst, const char* src);
44 /// returns the number of bytes remaining for the next use of #xed_strncpy() or #xed_strncat() .
45 XED_DLL_EXPORT int xed_strncpy(char* dst, const char* src,  int len);
46 /// returns the number of bytes remaining for the next use of #xed_strncpy() or #xed_strncat() .
47 XED_DLL_EXPORT int xed_strncat(char* dst, const char* src,  int len);
48
49
50 /* recognize VC98 */
51 #if !defined(__INTEL_COMPILER)
52 # if defined(_WIN32) && defined(_MSC_VER)
53 #   if _MSC_VER == 1200
54 #     define XED_MSVC6 1
55 #   endif
56 # endif
57 # if defined(_WIN32) && defined(_MSC_VER)
58 #   if _MSC_VER == 1310
59 #     define XED_MSVC7 1
60 #   endif
61 # endif
62 # if defined(_WIN32) && defined(_MSC_VER)
63 #   if _MSC_VER == 1400
64 #     define XED_MSVC8 1
65 #   endif
66 # endif
67 #endif
68
69 /* I've had compatibilty problems here so I'm using a trivial indirection */
70 #if defined(__GNUC__)
71 #  if defined(__CYGWIN__)
72       /* cygwin's gcc 3.4.4 on windows  complains */
73 #    define XED_FMT_X "%lx"
74 #    define XED_FMT_08X "%08lx"
75 #    define XED_FMT_D "%ld"
76 #    define XED_FMT_U "%lu"
77 #    define XED_FMT_9U "%9lu"
78 #  else
79 #    define XED_FMT_X "%x"
80 #    define XED_FMT_08X "%08x"
81 #    define XED_FMT_D "%d"
82 #    define XED_FMT_U "%u"
83 #    define XED_FMT_9U "%9u"
84 #  endif
85 #else
86 #  define XED_FMT_X "%x"
87 #  define XED_FMT_08X "%08x"
88 #  define XED_FMT_D "%d"
89 #  define XED_FMT_U "%u"
90 #  define XED_FMT_9U "%9u"
91 #endif
92
93 #if defined(__GNUC__) && defined(__LP64__) && !defined(__APPLE__)
94 # define XED_FMT_LX "%lx"
95 # define XED_FMT_LU "%lu"
96 # define XED_FMT_LD "%ld"
97 # define XED_FMT_LX16 "%016lx"
98 #else
99 # define XED_FMT_LX "%llx"
100 # define XED_FMT_LU "%llu"
101 # define XED_FMT_LD "%lld"
102 # define XED_FMT_LX16 "%016llx"
103 #endif
104
105 #if defined(_M_IA64)
106 # define XED_IPF
107 # define XED_FMT_SIZET "%ld"
108 #else
109 # define XED_FMT_SIZET "%d"
110 #endif
111
112 #if defined(__GNUC__) 
113 # define XED_INLINE inline
114 # define XED_NORETURN __attribute__ ((noreturn))
115 # if __GNUC__ == 2
116 #   define XED_NOINLINE 
117 # else
118 #   define XED_NOINLINE __attribute__ ((noinline))
119 # endif
120 #else
121 # define XED_INLINE __inline
122 # if defined(XED_MSVC6)
123 #   define XED_NOINLINE 
124 # else
125 #   define XED_NOINLINE __declspec(noinline)
126 # endif
127 # define XED_NORETURN __declspec(noreturn)
128 #endif
129
130 #endif  // _XED_PORTABILITY_H_
131
132 ////////////////////////////////////////////////////////////////////////////
133 //Local Variables:
134 //pref: "../../xed-portability.c"
135 //End: