File: prelude-inttypes.h.in

package info (click to toggle)
libprelude 1.0.0-11.9
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 24,456 kB
  • ctags: 17,851
  • sloc: ansic: 190,841; cpp: 38,769; xml: 30,141; sh: 11,668; makefile: 692; python: 481; awk: 341; yacc: 238; lex: 186; perl: 5
file content (214 lines) | stat: -rw-r--r-- 5,325 bytes parent folder | download | duplicates (5)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/*****
*
* Copyright (C) 2004, 2005 PreludeIDS Technologies. All Rights Reserved.
* Author: Yoann Vandoorselaere <yoann.v@prelude-ids.com>
*
* This file is part of the Prelude library.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.  If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****/

#ifndef _LIBPRELUDE_INTTYPES_H
#define _LIBPRELUDE_INTTYPES_H

#ifdef __cplusplus
 extern "C" {
#endif

/*
 * Defined by ax_create_prelude_inttypes_h.m4
 */
@__PRELUDE_HAVE_STDINT_H@
@__PRELUDE_HAVE_INTTYPES_H@
@__PRELUDE_HAVE_64BIT_LONG@
@__PRELUDE_STDINT_HAVE_UINT8@
@__PRELUDE_STDINT_HAVE_UINT16@
@__PRELUDE_STDINT_HAVE_UINT32@
@__PRELUDE_STDINT_HAVE_UINT64@
@__PRELUDE_64BIT_FORMAT_PREFIX@

#ifdef __PRELUDE_HAVE_64BIT_LONG
 #define __PRELUDE_INT64_SUFFIX(x) x ## L
 #define __PRELUDE_UINT64_SUFFIX(x) x ## UL
#else
 #define __PRELUDE_INT64_SUFFIX(x) x ## LL
 #define __PRELUDE_UINT64_SUFFIX(x) x ##ULL
#endif

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#ifdef __PRELUDE_HAVE_STDINT_H
# include <stdint.h>
#endif

#ifdef __PRELUDE_HAVE_INTTYPES_H
# include <inttypes.h>
#endif

#include <limits.h>

#ifndef TRUE
# define TRUE 1
#endif

#ifndef FALSE
# define FALSE 0
#endif



/*
 * Minimum of signed integral types.
 */
#define PRELUDE_INT8_MIN               (-128)
#define PRELUDE_INT16_MIN              (-32767 - 1)
#define PRELUDE_INT32_MIN              (-2147483647 - 1)
#define PRELUDE_INT64_MIN              (-__PRELUDE_INT64_SUFFIX(9223372036854775807) - 1)



/*
 * Maximum of signed integral types.
 */
#define PRELUDE_INT8_MAX               (127)
#define PRELUDE_INT16_MAX              (32767)
#define PRELUDE_INT32_MAX              (2147483647)
#define PRELUDE_INT64_MAX              (__PRELUDE_INT64_SUFFIX(9223372036854775807))


/*
 * Maximum of unsigned integral types.
 */
#define PRELUDE_UINT8_MAX              (255)
#define PRELUDE_UINT16_MAX             (65535)
#define PRELUDE_UINT32_MAX             (4294967295U)
#define PRELUDE_UINT64_MAX             (__PRELUDE_UINT64_SUFFIX(18446744073709551615))


/*
 * Other
 */
#define PRELUDE_INTMAX_MIN             INT64_MIN
#define PRELUDE_INTMAX_MAX             INT64_MAX
#define PRELUDE_UINTMAX_MAX            UINT64_MAX


/* 
 * Tandem NonStop R series and compatible platforms released before
 * July 2005 support %Ld but not %lld.  
 */
# if defined _TNS_R_TARGET
#  define _LONG_LONG_FORMAT_PREFIX "L"
# else
#  define _LONG_LONG_FORMAT_PREFIX "ll"
# endif

#if PRELUDE_INT64_MAX == LONG_MAX
# define __PRELUDE_64BIT_FORMAT_PREFIX "l"
#elif defined _MSC_VER || defined __MINGW32__
# define __PRELUDE_64BIT_FORMAT_PREFIX "I64"
#elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define __PRELUDE_64BIT_FORMAT_PREFIX _LONG_LONG_FORMAT_PREFIX
#endif



/*
 * format specifier
 */
#define PRELUDE_PRId64      __PRELUDE_64BIT_FORMAT_PREFIX "d"
#define PRELUDE_PRIi64      __PRELUDE_64BIT_FORMAT_PREFIX "i"
#define PRELUDE_PRIo64      __PRELUDE_64BIT_FORMAT_PREFIX "o"
#define PRELUDE_PRIx64      __PRELUDE_64BIT_FORMAT_PREFIX "x"
#define PRELUDE_PRIX64      __PRELUDE_64BIT_FORMAT_PREFIX "X"
#define PRELUDE_PRIu64      __PRELUDE_64BIT_FORMAT_PREFIX "u"

#define PRELUDE_PRId32      "d"
#define PRELUDE_PRIi32      "i"
#define PRELUDE_PRIo32      "o"
#define PRELUDE_PRIx32      "x"
#define PRELUDE_PRIX32      "X"
#define PRELUDE_PRIu32      "u"

#define PRELUDE_PRId16      "d"
#define PRELUDE_PRIi16      "i"
#define PRELUDE_PRIo16      "o"
#define PRELUDE_PRIx16      "x"
#define PRELUDE_PRIX16      "X"
#define PRELUDE_PRIu16      "u"

#define PRELUDE_PRId8       "d"
#define PRELUDE_PRIi8       "i"
#define PRELUDE_PRIo8       "o"
#define PRELUDE_PRIx8       "x"
#define PRELUDE_PRIX8       "X"
#define PRELUDE_PRIu8       "u"

#define PRELUDE_SCNd64      __PRELUDE_64BIT_FORMAT_PREFIX "d"
#define PRELUDE_SCNi64      __PRELUDE_64BIT_FORMAT_PREFIX "i"
#define PRELUDE_SCNo64      __PRELUDE_64BIT_FORMAT_PREFIX "o"
#define PRELUDE_SCNx64      __PRELUDE_64BIT_FORMAT_PREFIX "x"
#define PRELUDE_SCNu64      __PRELUDE_64BIT_FORMAT_PREFIX "u"




/*
 * Type definition
 */
typedef enum { 
	PRELUDE_BOOL_TRUE = TRUE, 
	PRELUDE_BOOL_FALSE = FALSE 
} prelude_bool_t;


#ifndef __PRELUDE_STDINT_HAVE_UINT8
 typedef signed char int8_t;
 typedef unsigned char uint8_t;
#endif


#ifndef __PRELUDE_STDINT_HAVE_UINT16
 typedef short int16_t;
 typedef unsigned short uint16_t;
#endif

#ifndef __PRELUDE_STDINT_HAVE_UINT32
 typedef int int32_t;
 typedef unsigned int uint32_t;
#endif

#ifndef __PRELUDE_STDINT_HAVE_UINT64
# ifdef __PRELUDE_HAVE_64BIT_LONG

  typedef long int64_t;
  typedef unsigned long uint64_t;

# else

  typedef long long int64_t;
  typedef unsigned long long uint64_t;

# endif
#endif

#ifdef __cplusplus
 }
#endif

#endif /* _LIBPRELUDE_INTTYPES_H */