Commit a5e91ec3d6630074b91f35583107592c3056deb3

Removed _STLP_UINT32_T, in preferance to uint32_t

Definition of _STLP_UINT32_T as 'unsigned long'
is suspicious, because assume it 32-bit.

Instead used uint32_t from stdint.h.

stdint.h for MS VC compilers family used from
http://code.google.com/p/msinttypes/ (Alexander Chemeris).

[Thanks to Dirk Opfer for idea].
  
1/*
2 * Copyright (c) 2009
3 * Petr Ovtchenkov
4 *
5 * Licensed under the Academic Free License version 3.0
6 *
7 */
8
9#ifndef _STLP_OUTERMOST_HEADER_ID
10# define _STLP_OUTERMOST_HEADER_ID 0x263
11# include <stl/_cprolog.h>
12#elif (_STLP_OUTERMOST_HEADER_ID == 0x263) && !defined(_STLP_DONT_POP_HEADER_ID)
13# define _STLP_DONT_POP_HEADER_ID
14#endif
15
16#ifdef _MSC_VER
17# include "stl/msc_stdint.h"
18#else /* _MSC_VER */
19# ifdef _STLP_HAS_INCLUDE_NEXT
20# include_next <stdint.h>
21# else
22# include _STLP_NATIVE_C_HEADER(stdint.h)
23# endif
24#endif /* _MSC_VER */
25
26#if (_STLP_OUTERMOST_HEADER_ID == 0x263)
27# ifndef _STLP_DONT_POP_HEADER_ID
28# include <stl/_epilog.h>
29# undef _STLP_OUTERMOST_HEADER_ID
30# else
31# undef _STLP_DONT_POP_HEADER_ID
32# endif
33#endif
  
4646 memset((char*)__result, __shred_byte, __real_n * sizeof(value_type));
4747 __result->__magic = __magic;
4848 __result->__type_size = sizeof(value_type);
49 __result->_M_size = (_STLP_UINT32_T)__n;
49 __result->_M_size = (uint32_t)__n;
5050 return ((char*)__result) + (long)__extra_before;
5151}
5252
  
2727#ifndef _STLP_INTERNAL_ALLOC_H
2828#define _STLP_INTERNAL_ALLOC_H
2929
30#include <stdint.h>
31
3032#ifndef _STLP_INTERNAL_CSTDDEF
3133# include <stl/_cstddef.h>
3234#endif
304304 private:
305305 struct __alloc_header
306306 {
307 size_t __magic: 16;
308 size_t __type_size:16;
309 _STLP_UINT32_T _M_size;
307 uint32_t __magic:16;
308 uint32_t __type_size:16;
309 uint32_t _M_size;
310310 }; // that is 8 bytes for sure
311311
312312 // Sunpro CC has bug on enums, so extra_before/after set explicitly
  
3030#ifndef _STLP_INTERNAL_FUNCTION_H
3131#define _STLP_INTERNAL_FUNCTION_H
3232
33#include <stdint.h>
34
3335#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
3436# include <stl/_function_base.h>
3537#endif
356356
357357// subtractive_rng is an extension: it is not part of the standard.
358358// Note: this code assumes that int is 32 bits.
359class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> {
360private:
361 _STLP_UINT32_T _M_table[55];
362 _STLP_UINT32_T _M_index1;
363 _STLP_UINT32_T _M_index2;
364public:
365 _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) {
366 _M_index1 = (_M_index1 + 1) % 55;
367 _M_index2 = (_M_index2 + 1) % 55;
368 _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
369 return _M_table[_M_index1] % __limit;
370 }
359class subtractive_rng :
360 public unary_function<uint32_t,uint32_t>
361{
362 private:
363 uint32_t _M_table[55];
364 int _M_index1;
365 int _M_index2;
366 public:
367 uint32_t operator()( uint32_t __limit )
368 {
369 _M_index1 = (_M_index1 + 1) % 55;
370 _M_index2 = (_M_index2 + 1) % 55;
371 _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
372 return _M_table[_M_index1] % __limit;
373 }
371374
372 void _M_initialize(_STLP_UINT32_T __seed) {
373 _STLP_UINT32_T __k = 1;
374 _M_table[54] = __seed;
375 _STLP_UINT32_T __i;
376 for (__i = 0; __i < 54; __i++) {
377 _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1;
378 _M_table[__ii] = __k;
379 __k = __seed - __k;
380 __seed = _M_table[__ii];
381 }
382 for (int __loop = 0; __loop < 4; __loop++) {
383 for (__i = 0; __i < 55; __i++)
375 void _M_initialize( uint32_t __seed )
376 {
377 uint32_t __k = 1;
378 _M_table[54] = __seed;
379 int __ii;
380 for ( int __i = 0; __i < 54; ++__i ) {
381 __ii = (21 * (__i + 1) % 55) - 1;
382 _M_table[__ii] = __k;
383 __k = __seed - __k;
384 __seed = _M_table[__ii];
385 }
386 for ( int __loop = 0; __loop < 4; ++__loop ) {
387 for ( int __i = 0; __i < 55; ++__i ) {
384388 _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
385 }
386 _M_index1 = 0;
387 _M_index2 = 31;
388 }
389 }
390 }
391 _M_index1 = 0;
392 _M_index2 = 31;
393 }
389394
390 subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
391 subtractive_rng() { _M_initialize(161803398ul); }
395 subtractive_rng( unsigned int __seed )
396 { _M_initialize(__seed); }
397 subtractive_rng()
398 { _M_initialize( 161803398UL ); }
392399};
393400
394401#endif /* _STLP_NO_EXTENSIONS */
  
3434# include <Types.h>
3535#endif
3636
37#define _STLP_UINT32_T UInt32
3837typedef int wint_t;
3938
4039#ifndef TYPE_BOOL
  
66
77#include <stl/config/_native_headers.h>
88
9#define _STLP_UINT32_T unsigned int
10
119#define _STLP_HAS_NO_NEW_C_HEADERS
1210// #define _STLP_VENDOR_GLOBAL_EXCEPT_STD
1311#define _STLP_LONG_LONG long long
  
1818
1919#define _STLP_COMPILER "CC"
2020
21// Mostly correct guess, change it for Alpha (and other environments
22// that has 64-bit "long")
23# define _STLP_UINT32_T unsigned long
24
2521// Uncomment if long long is available
2622# define _STLP_LONG_LONG long long
2723
  
9595# define _STLP_LONG_LONG long long
9696# endif
9797
98/* unsigned 32-bit integer type */
99# define _STLP_UINT32_T unsigned int
10098#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
10199# define _STLP_RAND48 1
102100#endif
  
7676# define _STLP_LONG_LONG long long
7777# endif
7878
79// unsigned 32-bit integer type
80# define _STLP_UINT32_T unsigned int
8179#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
8280# define _STLP_RAND48 1
8381#endif
  
22#define _STLP_COMPILER "Fujitsu"
33
44#define _STLP_NATIVE_INCLUDE_PATH ../std
5#define _STLP_UINT32_T unsigned int
65#define _STLP_LONG_LONG long long
76#define _STLP_WCHAR_SUNPRO_EXCLUDE 1
  
135135# define _STLP_USE_EXCEPTIONS 1
136136# define _STLP_STATIC_CONST_INIT_BUG 1
137137/* #pragma report(disable,CPPC1500029)
138 * unsigned 32-bit integer type
139138 */
140# define _STLP_UINT32_T unsigned int
141139# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
142140# define _STLP_RAND48 1
143141# endif
  
168168 * final workaround tuning based on given flags
169169 * ========================================================== */
170170
171#ifndef _STLP_UINT32_T
172# define _STLP_UINT32_T unsigned long
173#endif
174171#ifndef _STLP_ABORT
175172# define _STLP_ABORT() abort()
176173#endif
  
3737// the values choosen here as defaults try to give
3838// maximum functionality on the most conservative settings
3939
40// Mostly correct guess, change it for Alpha (and other environments
41// that has 64-bit "long")
42// # define _STLP_UINT32_T unsigned long
43
4440// Disables wchar_t functionality
4541// # define _STLP_NO_WCHAR_T 1
4642
  
1/*
2 * Derived from: http://code.google.com/p/msinttypes/
3 *
4 * ISO C9x compliant stdint.h for Microsoft Visual Studio
5 * Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
6 *
7 * Copyright (c) 2006-2008 Alexander Chemeris
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * 3. The name of the author may be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35/* Don't include <stl/msc_stdint.h> (this file) directly! */
36
37#ifndef _MSC_VER
38#error "Use this header only with Microsoft Visual C++ compilers!"
39#endif
40
41/*
42#ifndef _MSC_STDINT_H_
43#define _MSC_STDINT_H_
44*/
45
46#if _MSC_VER > 1000
47#pragma once
48#endif
49
50#include <limits.h>
51
52/*
53For Visual Studio 6 in C++ mode and for many Visual Studio versions when
54compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
55or compiler give many errors like this:
56error C2733: second C linkage of overloaded function 'wmemchr' not allowed
57*/
58#ifdef __cplusplus
59extern "C" {
60#endif
61# include <wchar.h>
62#ifdef __cplusplus
63}
64#endif
65
66/* Define _W64 macros to mark types changing their size, like intptr_t. */
67
68#ifndef _W64
69# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
70# define _W64 __w64
71# else
72# define _W64
73# endif
74#endif
75
76
77/* 7.18.1 Integer types */
78
79/* 7.18.1.1 Exact-width integer types */
80
81/*
82Visual Studio 6 and Embedded Visual C++ 4 doesn't
83realize that, e.g. char has the same size as __int8
84so we give up on __intX for them.
85*/
86
87#if (_MSC_VER < 1300)
88 typedef char int8_t;
89 typedef short int16_t;
90 typedef int int32_t;
91 typedef unsigned char uint8_t;
92 typedef unsigned short uint16_t;
93 typedef unsigned int uint32_t;
94#else
95 typedef __int8 int8_t;
96 typedef __int16 int16_t;
97 typedef __int32 int32_t;
98 typedef unsigned __int8 uint8_t;
99 typedef unsigned __int16 uint16_t;
100 typedef unsigned __int32 uint32_t;
101#endif
102typedef __int64 int64_t;
103typedef unsigned __int64 uint64_t;
104
105
106/* 7.18.1.2 Minimum-width integer types */
107
108typedef int8_t int_least8_t;
109typedef int16_t int_least16_t;
110typedef int32_t int_least32_t;
111typedef int64_t int_least64_t;
112typedef uint8_t uint_least8_t;
113typedef uint16_t uint_least16_t;
114typedef uint32_t uint_least32_t;
115typedef uint64_t uint_least64_t;
116
117/* 7.18.1.3 Fastest minimum-width integer types */
118
119typedef int8_t int_fast8_t;
120typedef int16_t int_fast16_t;
121typedef int32_t int_fast32_t;
122typedef int64_t int_fast64_t;
123typedef uint8_t uint_fast8_t;
124typedef uint16_t uint_fast16_t;
125typedef uint32_t uint_fast32_t;
126typedef uint64_t uint_fast64_t;
127
128/* 7.18.1.4 Integer types capable of holding object pointers */
129
130#ifdef _WIN64
131 typedef __int64 intptr_t;
132 typedef unsigned __int64 uintptr_t;
133#else
134 typedef _W64 int intptr_t;
135 typedef _W64 unsigned int uintptr_t;
136#endif
137
138/* 7.18.1.5 Greatest-width integer types */
139
140typedef int64_t intmax_t;
141typedef uint64_t uintmax_t;
142
143
144/* 7.18.2 Limits of specified-width integer types */
145
146#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) /* See footnote 220 at page 257 and footnote 221 at page 259 */
147
148/* 7.18.2.1 Limits of exact-width integer types */
149
150#define INT8_MIN ((int8_t)_I8_MIN)
151#define INT8_MAX _I8_MAX
152#define INT16_MIN ((int16_t)_I16_MIN)
153#define INT16_MAX _I16_MAX
154#define INT32_MIN ((int32_t)_I32_MIN)
155#define INT32_MAX _I32_MAX
156#define INT64_MIN ((int64_t)_I64_MIN)
157#define INT64_MAX _I64_MAX
158#define UINT8_MAX _UI8_MAX
159#define UINT16_MAX _UI16_MAX
160#define UINT32_MAX _UI32_MAX
161#define UINT64_MAX _UI64_MAX
162
163/* 7.18.2.2 Limits of minimum-width integer types */
164
165#define INT_LEAST8_MIN INT8_MIN
166#define INT_LEAST8_MAX INT8_MAX
167#define INT_LEAST16_MIN INT16_MIN
168#define INT_LEAST16_MAX INT16_MAX
169#define INT_LEAST32_MIN INT32_MIN
170#define INT_LEAST32_MAX INT32_MAX
171#define INT_LEAST64_MIN INT64_MIN
172#define INT_LEAST64_MAX INT64_MAX
173#define UINT_LEAST8_MAX UINT8_MAX
174#define UINT_LEAST16_MAX UINT16_MAX
175#define UINT_LEAST32_MAX UINT32_MAX
176#define UINT_LEAST64_MAX UINT64_MAX
177
178/* 7.18.2.3 Limits of fastest minimum-width integer types */
179
180#define INT_FAST8_MIN INT8_MIN
181#define INT_FAST8_MAX INT8_MAX
182#define INT_FAST16_MIN INT16_MIN
183#define INT_FAST16_MAX INT16_MAX
184#define INT_FAST32_MIN INT32_MIN
185#define INT_FAST32_MAX INT32_MAX
186#define INT_FAST64_MIN INT64_MIN
187#define INT_FAST64_MAX INT64_MAX
188#define UINT_FAST8_MAX UINT8_MAX
189#define UINT_FAST16_MAX UINT16_MAX
190#define UINT_FAST32_MAX UINT32_MAX
191#define UINT_FAST64_MAX UINT64_MAX
192
193/* 7.18.2.4 Limits of integer types capable of holding object pointers */
194
195#ifdef _WIN64
196# define INTPTR_MIN INT64_MIN
197# define INTPTR_MAX INT64_MAX
198# define UINTPTR_MAX UINT64_MAX
199#else
200# define INTPTR_MIN INT32_MIN
201# define INTPTR_MAX INT32_MAX
202# define UINTPTR_MAX UINT32_MAX
203#endif
204
205/* 7.18.2.5 Limits of greatest-width integer types */
206
207#define INTMAX_MIN INT64_MIN
208#define INTMAX_MAX INT64_MAX
209#define UINTMAX_MAX UINT64_MAX
210
211/* 7.18.3 Limits of other integer types */
212
213#ifdef _WIN64
214# define PTRDIFF_MIN _I64_MIN
215# define PTRDIFF_MAX _I64_MAX
216#else
217# define PTRDIFF_MIN _I32_MIN
218# define PTRDIFF_MAX _I32_MAX
219#endif
220
221#define SIG_ATOMIC_MIN INT_MIN
222#define SIG_ATOMIC_MAX INT_MAX
223
224#ifndef SIZE_MAX
225# ifdef _WIN64
226# define SIZE_MAX _UI64_MAX
227# else
228# define SIZE_MAX _UI32_MAX
229# endif
230#endif
231
232/* WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> */
233#ifndef WCHAR_MIN
234# define WCHAR_MIN 0
235#endif
236#ifndef WCHAR_MAX
237# define WCHAR_MAX _UI16_MAX
238#endif
239
240#define WINT_MIN 0
241#define WINT_MAX _UI16_MAX
242
243#endif /* __STDC_LIMIT_MACROS */
244
245
246/* 7.18.4 Limits of other integer types */
247
248#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* See footnote 224 at page 260 */
249
250/* 7.18.4.1 Macros for minimum-width integer constants */
251
252#define INT8_C(val) val##i8
253#define INT16_C(val) val##i16
254#define INT32_C(val) val##i32
255#define INT64_C(val) val##i64
256
257#define UINT8_C(val) val##ui8
258#define UINT16_C(val) val##ui16
259#define UINT32_C(val) val##ui32
260#define UINT64_C(val) val##ui64
261
262/* 7.18.4.2 Macros for greatest-width integer constants */
263#define INTMAX_C INT64_C
264#define UINTMAX_C UINT64_C
265
266#endif /* __STDC_CONSTANT_MACROS */
267
268
269/* #endif */ /* _MSC_STDINT_H_ */