1 /*****************************************************************
2 |
3 |   Neptune - Types
4 |
5 | Copyright (c) 2002-2008, Axiomatic Systems, LLC.
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |     * Redistributions of source code must retain the above copyright
11 |       notice, this list of conditions and the following disclaimer.
12 |     * Redistributions in binary form must reproduce the above copyright
13 |       notice, this list of conditions and the following disclaimer in the
14 |       documentation and/or other materials provided with the distribution.
15 |     * Neither the name of Axiomatic Systems nor the
16 |       names of its contributors may be used to endorse or promote products
17 |       derived from this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30  ****************************************************************/
31 
32 #ifndef _NPT_TYPES_H_
33 #define _NPT_TYPES_H_
34 
35 /*----------------------------------------------------------------------
36 |   includes
37 +---------------------------------------------------------------------*/
38 #include "NptConfig.h"
39 
40 /*----------------------------------------------------------------------
41 |   sized types (this assumes that ints are 32 bits)
42 +---------------------------------------------------------------------*/
43 typedef NPT_CONFIG_INT64_TYPE          NPT_Int64;
44 typedef unsigned NPT_CONFIG_INT64_TYPE NPT_UInt64;
45 typedef unsigned int                   NPT_UInt32;
46 typedef int                            NPT_Int32;
47 typedef unsigned short                 NPT_UInt16;
48 typedef short                          NPT_Int16;
49 typedef unsigned char                  NPT_UInt8;
50 typedef char                           NPT_Int8;
51 typedef float                          NPT_Float;
52 
53 /*----------------------------------------------------------------------
54 |   named types
55 +---------------------------------------------------------------------*/
56 typedef int           NPT_Result;
57 typedef unsigned int  NPT_Cardinal;
58 typedef unsigned int  NPT_Ordinal;
59 typedef NPT_UInt32    NPT_Size;
60 typedef NPT_UInt64    NPT_LargeSize;
61 typedef NPT_Int32     NPT_Offset;
62 typedef NPT_UInt64    NPT_Position;
63 typedef NPT_Int32     NPT_Timeout;
64 typedef void          NPT_Interface;
65 typedef NPT_UInt8     NPT_Byte;
66 typedef NPT_UInt32    NPT_Flags;
67 typedef void*         NPT_Any;
68 typedef const void*   NPT_AnyConst;
69 
70 /*----------------------------------------------------------------------
71 |   limits
72 +---------------------------------------------------------------------*/
73 #if defined(NPT_CONFIG_HAVE_LIMITS_H)
74 #include <limits.h>
75 #endif
76 
77 #if !defined(NPT_INT_MIN)
78 #if defined(NPT_CONFIG_HAVE_INT_MIN)
79 #define NPT_INT_MIN INT_MIN
80 #endif
81 #endif
82 
83 #if !defined(NPT_INT_MAX)
84 #if defined(NPT_CONFIG_HAVE_INT_MAX)
85 #define NPT_INT_MAX INT_MAX
86 #endif
87 #endif
88 
89 #if !defined(NPT_UINT_MAX)
90 #if defined(NPT_CONFIG_HAVE_UINT_MAX)
91 #define NPT_UINT_MAX UINT_MAX
92 #endif
93 #endif
94 
95 #if !defined(NPT_LONG_MIN)
96 #if defined(NPT_CONFIG_HAVE_LONG_MIN)
97 #define NPT_LONG_MIN LONG_MIN
98 #endif
99 #endif
100 
101 #if !defined(NPT_LONG_MAX)
102 #if defined(NPT_CONFIG_HAVE_LONG_MAX)
103 #define NPT_LONG_MAX LONG_MAX
104 #endif
105 #endif
106 
107 #if !defined(NPT_ULONG_MAX)
108 #if defined(NPT_CONFIG_HAVE_ULONG_MAX)
109 #define NPT_ULONG_MAX ULONG_MAX
110 #endif
111 #endif
112 
113 #if !defined(NPT_INT32_MAX)
114 #define NPT_INT32_MAX 0x7FFFFFFF
115 #endif
116 
117 #if !defined(NPT_INT32_MIN)
118 #define NPT_INT32_MIN (-NPT_INT32_MAX - 1)
119 #endif
120 
121 #if !defined(NPT_UINT32_MAX)
122 #define NPT_UINT32_MAX 0xFFFFFFFF
123 #endif
124 
125 #if !defined(NPT_INT64_MAX)
126 #if defined(NPT_CONFIG_HAVE_LLONG_MAX)
127 #define NPT_INT64_MAX LLONG_MAX
128 #else
129 #define NPT_INT64_MAX 0x7FFFFFFFFFFFFFFFLL
130 #endif
131 #endif
132 
133 #if !defined(NPT_INT64_MIN)
134 #if defined(NPT_CONFIG_HAVE_LLONG_MIN)
135 #define NPT_INT64_MIN LLONG_MIN
136 #else
137 #define NPT_INT64_MIN (-NPT_INT64_MAX - 1LL)
138 #endif
139 #endif
140 
141 #if !defined(NPT_UINT64_MAX)
142 #if defined(NPT_CONFIG_HAVE_ULLONG_MAX)
143 #define NPT_UINT64_MAX ULLONG_MAX
144 #else
145 #define NPT_UINT64_MAX 0xFFFFFFFFFFFFFFFFULL
146 #endif
147 #endif
148 
149 #endif // _NPT_TYPES_H_
150