1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Cross platform types |
|
15 |
|
16 #ifndef PSU_PLATFORMTYPES_H |
|
17 #define PSU_PLATFORMTYPES_H |
|
18 |
|
19 #include <limits.h> |
|
20 |
|
21 |
|
22 #ifdef WIN32 |
|
23 #define DllExport __declspec( dllexport ) |
|
24 #else // LINUX |
|
25 #define DllExport |
|
26 #endif |
|
27 |
|
28 |
|
29 #ifdef WIN32 |
|
30 |
|
31 #if !defined(__STDC_CONSTANT_MACROS) && !defined(HAVE_STDINT_H) |
|
32 #define __STDC_CONSTANT_MACROS |
|
33 /* MSVC++ does not have the standard header <stdint.h>, so we need to |
|
34 write here all the declarations that <stdint.h> shall contain */ |
|
35 #ifndef HAVE_INT8_T |
|
36 #define HAVE_INT8_T 1 |
|
37 typedef signed __int8 int8_t; |
|
38 #endif |
|
39 #ifndef HAVE_INT16_T |
|
40 #define HAVE_INT16_T 1 |
|
41 typedef signed __int16 int16_t; |
|
42 #endif |
|
43 #ifndef HAVE_INT32_T |
|
44 #define HAVE_INT32_T 1 |
|
45 typedef signed __int32 int32_t; |
|
46 #endif |
|
47 #ifndef HAVE_INT64_T |
|
48 #define HAVE_INT64_T 1 |
|
49 typedef signed __int64 int64_t; |
|
50 #endif |
|
51 #ifndef HAVE_U_INT8_T |
|
52 #define HAVE_U_INT8_T 1 |
|
53 typedef unsigned __int8 uint8_t; |
|
54 typedef unsigned __int8 u_int8_t; |
|
55 #endif |
|
56 #ifndef HAVE_U_INT16_T |
|
57 #define HAVE_U_INT16_T 1 |
|
58 typedef unsigned __int16 uint16_t; |
|
59 typedef unsigned __int16 u_int16_t; |
|
60 #endif |
|
61 #ifndef HAVE_U_INT32_T |
|
62 #define HAVE_U_INT32_T 1 |
|
63 typedef unsigned __int32 uint32_t; |
|
64 typedef unsigned __int32 u_int32_t; |
|
65 #endif |
|
66 #ifndef HAVE_U_INT64_T |
|
67 #define HAVE_U_INT64_T 1 |
|
68 typedef unsigned __int64 uint64_t; |
|
69 typedef unsigned __int64 u_int64_t; |
|
70 #endif |
|
71 |
|
72 |
|
73 |
|
74 // on both Linux and Windows platforms, size_t is a 4-bytes unsigned integer |
|
75 // on Linux, ssize_t is a 4 bytes signed integer |
|
76 // Windows does not seem to have a ssize_t |
|
77 typedef int32_t ssize_t; |
|
78 |
|
79 #endif // __STDC_CONSTANT_MACROS |
|
80 #else |
|
81 #include <stdint.h> |
|
82 #include <sys/types.h> |
|
83 #endif |
|
84 |
|
85 |
|
86 // a byte will be an unsigned char, i.e. an unsigned int8_t |
|
87 // this typedef works fine on both Linux and Windows |
|
88 typedef unsigned char byte_t; |
|
89 |
|
90 #endif |
|