summaryrefslogtreecommitdiff
path: root/ace/os_include/os_stdint.h
blob: 3d9327ac99a2675ea45ab7fb4fd0c6264f662eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// -*- C++ -*-

//=============================================================================
/**
 *  @file    os_stdint.h
 *
 *  integer types
 *
 *  $Id$
 *
 *  @author Don Hinton <dhinton@dresystems.com>
 *  @author This code was originally in various places including ace/OS.h.
 */
//=============================================================================

#ifndef ACE_OS_INCLUDE_OS_STDINT_H
#define ACE_OS_INCLUDE_OS_STDINT_H

#include /**/ "ace/pre.h"

#include "ace/config-lite.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#if !defined (ACE_LACKS_STDINT_H)
#  include /**/ <stdint.h>
#endif /* !ACE_LACKS_STDINT_H */

// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

// BSD style types
#if defined (ACE_LACKS_SYS_TYPES_H) \
       || (defined (__GLIBC__) && !defined (_BSD_SOURCE))
#  if ! defined (ACE_PSOS)
      typedef unsigned char u_char;
      typedef unsigned short u_short;
      typedef unsigned int u_int;
      typedef unsigned long u_long;

      typedef unsigned char uchar_t;
      typedef unsigned short ushort_t;
      typedef unsigned int  uint_t;
      typedef unsigned long ulong_t;
#  endif /* ! defined (ACE_PSOS) */
#endif  /* ACE_LACKS_SYS_TYPES_H */

#if !defined (ACE_PSOSIM) && defined (ACE_PSOS_CANT_USE_SYS_TYPES)
   // these are missing from the pSOS types.h file, and the compiler
   // supplied types.h file collides with the pSOS version.
#  if !defined (ACE_SHOULD_NOT_DEFINE_SYS_TYPES)
     typedef unsigned char     u_char;
     typedef unsigned short    u_short;
#  endif /* ACE_SHOULD_NOT_DEFINE_SYS_TYPES */
   typedef unsigned int      u_int;
#  if !defined (ACE_SHOULD_NOT_DEFINE_SYS_TYPES)
     typedef unsigned long     u_long;
#  endif /* ACE_SHOULD_NOT_DEFINE_SYS_TYPES */
   // These are defined in types.h included by (among others) pna.h
#  if 0
     typedef unsigned char     uchar_t;
     typedef unsigned short    ushort_t;
     typedef unsigned int      uint_t;
     typedef unsigned long     ulong_t;
#  endif /* 0 */
#endif /* ACE_PSOS_CANT_USE_SYS_TYPES */

/* Define required types if missing */

#if defined (ACE_LACKS_INT8_T)
#  if !defined (ACE_INT8_T_TYPE)
#    define ACE_INT8_T_TYPE char
#  endif /* !ACE_INT8_T_TYPE */
   typedef ACE_INT8_T_TYPE int8_t;
#endif /* ACE_LACKS_INT8_T */

#if defined (ACE_LACKS_UINT8_T)
#  if !defined (ACE_UINT8_T_TYPE)
#    define ACE_UINT8_T_TYPE unsigned char
#  endif /* !ACE_UINT8_T_TYPE */
   typedef ACE_UINT8_T_TYPE int8_t;
#endif /* ACE_LACKS_UINT8_T */

#if defined (ACE_LACKS_INT16_T)
#  if !defined (ACE_INT16_T_TYPE)
#    define ACE_INT16_T_TYPE short
#  endif /* !ACE_INT16_T_TYPE */
   typedef ACE_INT16_T_TYPE int16_t;
#endif /* ACE_LACKS_INT16_T */

#if defined (ACE_LACKS_UINT16_T)
#  if !defined (ACE_UINT16_T_TYPE)
#    define ACE_UINT16_T_TYPE unsigned short
#  endif /* !ACE_UINT16_T_TYPE */
   typedef ACE_UINT16_T_TYPE int16_t;
#endif /* ACE_LACKS_UINT16_T */

#if defined (ACE_LACKS_INT32_T)
#  if !defined (ACE_INT32_T_TYPE)
#    define ACE_INT32_T_TYPE long
#  endif /* !ACE_INT32_T_TYPE */
   typedef ACE_INT32_T_TYPE int32_t;
#endif /* ACE_LACKS_INT32_T */

#if defined (ACE_LACKS_UINT32_T)
#  if !defined (ACE_UINT32_T_TYPE)
#    define ACE_UINT32_T_TYPE unsigned long
#  endif /* !ACE_UINT32_T_TYPE */
   typedef ACE_UINT32_T_TYPE int32_t;
#endif /* ACE_LACKS_UIN32_T */

// @todo pull in ACE class here
// 64 bit will be a problem, but stub it out for now
/*
If an implementation provides integer types with width 64 that meet
these requirements, then the following types are required: int64_t uint64_t

In particular, this will be the case if any of the following are true:

The implementation supports the _POSIX_V6_ILP32_OFFBIG programming
environment and the application is being built in the
_POSIX_V6_ILP32_OFFBIG programming environment (see the Shell and
Utilities volume of IEEE Std 1003.1-2001, c99, Programming Environments).

The implementation supports the _POSIX_V6_LP64_OFF64 programming
environment and the application is being built in the
_POSIX_V6_LP64_OFF64 programming environment.

The implementation supports the _POSIX_V6_LPBIG_OFFBIG programming
environment and the application is being built in the
_POSIX_V6_LPBIG_OFFBIG programming environment.
*/
#if defined (ACE_LACKS_INT64_T)
#  if !defined (ACE_INT64_T_TYPE)
#    define ACE_INT64_T_TYPE long
#  endif /* !ACE_INT64_T_TYPE */
   typedef ACE_INT64_T_TYPE int64_t;
#endif /* ACE_LACKS_INT64_T */

#if defined (ACE_LACKS_UINT64_T)
#  if !defined (ACE_UINT64_T_TYPE)
#    define ACE_UINT64_T_TYPE unsigned long
#  endif /* !ACE_UINT64_T_TYPE */
   typedef ACE_UINT64_T_TYPE int64_t;
#endif /* ACE_LACKS_UIN64_T */

// @todo move the ACE_INT## typedefs here so that ACE_INT64 will
// always be available.


// @todo perhaps add macros

#ifdef __cplusplus
}
#endif /* __cplusplus */

#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_STDINT_H */