openalbridge/winstdint.h
author koda
Mon, 29 Jun 2009 03:47:39 +0000
changeset 2210 1cb7118a77dd
parent 2209 2573d4ff78f9
permissions -rw-r--r--
initial bugfix for volume setup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     1
/*  A portable stdint.h
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     2
 ****************************************************************************
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     3
 *  BSD License:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     4
 ****************************************************************************
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     5
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     6
 *  Copyright (c) 2005-2007 Paul Hsieh
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     7
 *  All rights reserved.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     8
 *  
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
     9
 *  Redistribution and use in source and binary forms, with or without
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    10
 *  modification, are permitted provided that the following conditions
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    11
 *  are met:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    12
 *  
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    13
 *  1. Redistributions of source code must retain the above copyright
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    14
 *     notice, this list of conditions and the following disclaimer.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    15
 *  2. Redistributions in binary form must reproduce the above copyright
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    16
 *     notice, this list of conditions and the following disclaimer in the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    17
 *     documentation and/or other materials provided with the distribution.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    18
 *  3. The name of the author may not be used to endorse or promote products
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    19
 *     derived from this software without specific prior written permission.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    20
 *  
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    21
 *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    22
 *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    23
 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    24
 *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    25
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    26
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    27
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    28
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    29
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    30
 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    31
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    32
 ****************************************************************************
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    33
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    34
 *  Version 0.1.11
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    35
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    36
 *  The ANSI C standard committee, for the C99 standard, specified the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    37
 *  inclusion of a new standard include file called stdint.h.  This is
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    38
 *  a very useful and long desired include file which contains several
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    39
 *  very precise definitions for integer scalar types that is
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    40
 *  critically important for making portable several classes of
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    41
 *  applications including cryptography, hashing, variable length
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    42
 *  integer libraries and so on.  But for most developers its likely
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    43
 *  useful just for programming sanity.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    44
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    45
 *  The problem is that most compiler vendors have decided not to
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    46
 *  implement the C99 standard, and the next C++ language standard
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    47
 *  (which has a lot more mindshare these days) will be a long time in
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    48
 *  coming and its unknown whether or not it will include stdint.h or
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    49
 *  how much adoption it will have.  Either way, it will be a long time
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    50
 *  before all compilers come with a stdint.h and it also does nothing
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    51
 *  for the extremely large number of compilers available today which
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    52
 *  do not include this file, or anything comparable to it.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    53
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    54
 *  So that's what this file is all about.  Its an attempt to build a
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    55
 *  single universal include file that works on as many platforms as
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    56
 *  possible to deliver what stdint.h is supposed to.  A few things
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    57
 *  that should be noted about this file:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    58
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    59
 *    1) It is not guaranteed to be portable and/or present an identical
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    60
 *       interface on all platforms.  The extreme variability of the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    61
 *       ANSI C standard makes this an impossibility right from the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    62
 *       very get go. Its really only meant to be useful for the vast
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    63
 *       majority of platforms that possess the capability of
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    64
 *       implementing usefully and precisely defined, standard sized
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    65
 *       integer scalars.  Systems which are not intrinsically 2s
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    66
 *       complement may produce invalid constants.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    67
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    68
 *    2) There is an unavoidable use of non-reserved symbols.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    69
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    70
 *    3) Other standard include files are invoked.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    71
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    72
 *    4) This file may come in conflict with future platforms that do
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    73
 *       include stdint.h.  The hope is that one or the other can be
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    74
 *       used with no real difference.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    75
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    76
 *    5) In the current verison, if your platform can't represent
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    77
 *       int32_t, int16_t and int8_t, it just dumps out with a compiler
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    78
 *       error.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    79
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    80
 *    6) 64 bit integers may or may not be defined.  Test for their
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    81
 *       presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    82
 *       Note that this is different from the C99 specification which
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    83
 *       requires the existence of 64 bit support in the compiler.  If
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    84
 *       this is not defined for your platform, yet it is capable of
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    85
 *       dealing with 64 bits then it is because this file has not yet
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    86
 *       been extended to cover all of your system's capabilities.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    87
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    88
 *    7) (u)intptr_t may or may not be defined.  Test for its presence
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    89
 *       with the test: #ifdef PTRDIFF_MAX.  If this is not defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    90
 *       for your platform, then it is because this file has not yet
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    91
 *       been extended to cover all of your system's capabilities, not
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    92
 *       because its optional.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    93
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    94
 *    8) The following might not been defined even if your platform is
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    95
 *       capable of defining it:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    96
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    97
 *       WCHAR_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    98
 *       WCHAR_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
    99
 *       (u)int64_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   100
 *       PTRDIFF_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   101
 *       PTRDIFF_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   102
 *       (u)intptr_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   103
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   104
 *    9) The following have not been defined:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   105
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   106
 *       WINT_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   107
 *       WINT_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   108
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   109
 *   10) The criteria for defining (u)int_least(*)_t isn't clear,
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   110
 *       except for systems which don't have a type that precisely
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   111
 *       defined 8, 16, or 32 bit types (which this include file does
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   112
 *       not support anyways). Default definitions have been given.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   113
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   114
 *   11) The criteria for defining (u)int_fast(*)_t isn't something I
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   115
 *       would trust to any particular compiler vendor or the ANSI C
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   116
 *       committee.  It is well known that "compatible systems" are
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   117
 *       commonly created that have very different performance
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   118
 *       characteristics from the systems they are compatible with,
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   119
 *       especially those whose vendors make both the compiler and the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   120
 *       system.  Default definitions have been given, but its strongly
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   121
 *       recommended that users never use these definitions for any
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   122
 *       reason (they do *NOT* deliver any serious guarantee of
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   123
 *       improved performance -- not in this file, nor any vendor's
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   124
 *       stdint.h).
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   125
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   126
 *   12) The following macros:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   127
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   128
 *       PRINTF_INTMAX_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   129
 *       PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   130
 *       PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   131
 *       PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   132
 *       PRINTF_LEAST64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   133
 *       PRINTF_LEAST32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   134
 *       PRINTF_LEAST16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   135
 *       PRINTF_INTPTR_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   136
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   137
 *       are strings which have been defined as the modifiers required
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   138
 *       for the "d", "u" and "x" printf formats to correctly output
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   139
 *       (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   140
 *       (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   141
 *       PRINTF_INTPTR_MODIFIER is not defined for some systems which
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   142
 *       provide their own stdint.h.  PRINTF_INT64_MODIFIER is not
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   143
 *       defined if INT64_MAX is not defined.  These are an extension
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   144
 *       beyond what C99 specifies must be in stdint.h.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   145
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   146
 *       In addition, the following macros are defined:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   147
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   148
 *       PRINTF_INTMAX_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   149
 *       PRINTF_INT64_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   150
 *       PRINTF_INT32_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   151
 *       PRINTF_INT16_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   152
 *       PRINTF_INT8_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   153
 *       PRINTF_INTMAX_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   154
 *       PRINTF_INT64_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   155
 *       PRINTF_INT32_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   156
 *       PRINTF_INT16_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   157
 *       PRINTF_INT8_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   158
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   159
 *       Which specifies the maximum number of characters required to
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   160
 *       print the number of that type in either hexadecimal or decimal.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   161
 *       These are an extension beyond what C99 specifies must be in
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   162
 *       stdint.h.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   163
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   164
 *  Compilers tested (all with 0 warnings at their highest respective
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   165
 *  settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   166
 *  bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   167
 *  .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   168
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   169
 *  This file should be considered a work in progress.  Suggestions for
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   170
 *  improvements, especially those which increase coverage are strongly
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   171
 *  encouraged.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   172
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   173
 *  Acknowledgements
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   174
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   175
 *  The following people have made significant contributions to the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   176
 *  development and testing of this file:
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   177
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   178
 *  Chris Howie
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   179
 *  John Steele Scott
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   180
 *  Dave Thorup
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   181
 *
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   182
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   183
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   184
#include <stddef.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   185
#include <limits.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   186
#include <signal.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   187
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   188
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   189
 *  For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   190
 *  do nothing else.  On the Mac OS X version of gcc this is _STDINT_H_.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   191
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   192
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   193
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) )) && !defined (_PSTDINT_H_INCLUDED)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   194
#include <stdint.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   195
#define _PSTDINT_H_INCLUDED
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   196
# ifndef PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   197
#  define PRINTF_INT64_MODIFIER "ll"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   198
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   199
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   200
#  define PRINTF_INT32_MODIFIER "l"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   201
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   202
# ifndef PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   203
#  define PRINTF_INT16_MODIFIER "h"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   204
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   205
# ifndef PRINTF_INTMAX_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   206
#  define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   207
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   208
# ifndef PRINTF_INT64_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   209
#  define PRINTF_INT64_HEX_WIDTH "16"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   210
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   211
# ifndef PRINTF_INT32_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   212
#  define PRINTF_INT32_HEX_WIDTH "8"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   213
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   214
# ifndef PRINTF_INT16_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   215
#  define PRINTF_INT16_HEX_WIDTH "4"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   216
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   217
# ifndef PRINTF_INT8_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   218
#  define PRINTF_INT8_HEX_WIDTH "2"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   219
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   220
# ifndef PRINTF_INT64_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   221
#  define PRINTF_INT64_DEC_WIDTH "20"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   222
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   223
# ifndef PRINTF_INT32_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   224
#  define PRINTF_INT32_DEC_WIDTH "10"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   225
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   226
# ifndef PRINTF_INT16_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   227
#  define PRINTF_INT16_DEC_WIDTH "5"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   228
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   229
# ifndef PRINTF_INT8_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   230
#  define PRINTF_INT8_DEC_WIDTH "3"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   231
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   232
# ifndef PRINTF_INTMAX_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   233
#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   234
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   235
# ifndef PRINTF_INTMAX_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   236
#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   237
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   238
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   239
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   240
 *  Something really weird is going on with Open Watcom.  Just pull some of
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   241
 *  these duplicated definitions from Open Watcom's stdint.h file for now.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   242
 */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   243
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   244
# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   245
#  if !defined (INT64_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   246
#   define INT64_C(x)   (x + (INT64_MAX - INT64_MAX))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   247
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   248
#  if !defined (UINT64_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   249
#   define UINT64_C(x)  (x + (UINT64_MAX - UINT64_MAX))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   250
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   251
#  if !defined (INT32_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   252
#   define INT32_C(x)   (x + (INT32_MAX - INT32_MAX))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   253
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   254
#  if !defined (UINT32_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   255
#   define UINT32_C(x)  (x + (UINT32_MAX - UINT32_MAX))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   256
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   257
#  if !defined (INT16_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   258
#   define INT16_C(x)   (x)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   259
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   260
#  if !defined (UINT16_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   261
#   define UINT16_C(x)  (x)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   262
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   263
#  if !defined (INT8_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   264
#   define INT8_C(x)   (x)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   265
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   266
#  if !defined (UINT8_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   267
#   define UINT8_C(x)  (x)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   268
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   269
#  if !defined (UINT64_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   270
#   define UINT64_MAX  18446744073709551615ULL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   271
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   272
#  if !defined (INT64_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   273
#   define INT64_MAX  9223372036854775807LL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   274
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   275
#  if !defined (UINT32_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   276
#   define UINT32_MAX  4294967295UL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   277
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   278
#  if !defined (INT32_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   279
#   define INT32_MAX  2147483647L
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   280
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   281
#  if !defined (INTMAX_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   282
#   define INTMAX_MAX INT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   283
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   284
#  if !defined (INTMAX_MIN)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   285
#   define INTMAX_MIN INT64_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   286
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   287
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   288
#endif
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   289
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   290
#ifndef _PSTDINT_H_INCLUDED
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   291
#define _PSTDINT_H_INCLUDED
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   292
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   293
#ifndef SIZE_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   294
# define SIZE_MAX (~(size_t)0)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   295
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   296
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   297
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   298
 *  Deduce the type assignments from limits.h under the assumption that
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   299
 *  integer sizes in bits are powers of 2, and follow the ANSI
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   300
 *  definitions.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   301
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   302
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   303
#ifndef UINT8_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   304
# define UINT8_MAX 0xff
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   305
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   306
#ifndef uint8_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   307
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   308
    typedef unsigned char uint8_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   309
#   define UINT8_C(v) ((uint8_t) v)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   310
# else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   311
#   error "Platform not supported"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   312
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   313
#endif
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   314
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   315
#ifndef INT8_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   316
# define INT8_MAX 0x7f
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   317
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   318
#ifndef INT8_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   319
# define INT8_MIN INT8_C(0x80)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   320
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   321
#ifndef int8_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   322
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   323
    typedef signed char int8_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   324
#   define INT8_C(v) ((int8_t) v)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   325
# else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   326
#   error "Platform not supported"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   327
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   328
#endif
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   329
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   330
#ifndef UINT16_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   331
# define UINT16_MAX 0xffff
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   332
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   333
#ifndef uint16_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   334
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   335
  typedef unsigned int uint16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   336
# ifndef PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   337
#  define PRINTF_INT16_MODIFIER ""
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   338
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   339
# define UINT16_C(v) ((uint16_t) (v))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   340
#elif (USHRT_MAX == UINT16_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   341
  typedef unsigned short uint16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   342
# define UINT16_C(v) ((uint16_t) (v))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   343
# ifndef PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   344
#  define PRINTF_INT16_MODIFIER "h"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   345
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   346
#else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   347
#error "Platform not supported"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   348
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   349
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   350
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   351
#ifndef INT16_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   352
# define INT16_MAX 0x7fff
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   353
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   354
#ifndef INT16_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   355
# define INT16_MIN INT16_C(0x8000)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   356
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   357
#ifndef int16_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   358
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   359
  typedef signed int int16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   360
# define INT16_C(v) ((int16_t) (v))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   361
# ifndef PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   362
#  define PRINTF_INT16_MODIFIER ""
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   363
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   364
#elif (SHRT_MAX == INT16_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   365
  typedef signed short int16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   366
# define INT16_C(v) ((int16_t) (v))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   367
# ifndef PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   368
#  define PRINTF_INT16_MODIFIER "h"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   369
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   370
#else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   371
#error "Platform not supported"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   372
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   373
#endif
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   374
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   375
#ifndef UINT32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   376
# define UINT32_MAX (0xffffffffUL)
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   377
#endif
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   378
#ifndef uint32_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   379
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   380
  typedef unsigned long uint32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   381
# define UINT32_C(v) v ## UL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   382
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   383
#  define PRINTF_INT32_MODIFIER "l"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   384
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   385
#elif (UINT_MAX == UINT32_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   386
  typedef unsigned int uint32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   387
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   388
#  define PRINTF_INT32_MODIFIER ""
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   389
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   390
# define UINT32_C(v) v ## U
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   391
#elif (USHRT_MAX == UINT32_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   392
  typedef unsigned short uint32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   393
# define UINT32_C(v) ((unsigned short) (v))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   394
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   395
#  define PRINTF_INT32_MODIFIER ""
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   396
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   397
#else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   398
#error "Platform not supported"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   399
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   400
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   401
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   402
#ifndef INT32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   403
# define INT32_MAX (0x7fffffffL)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   404
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   405
#ifndef INT32_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   406
# define INT32_MIN INT32_C(0x80000000)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   407
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   408
#ifndef int32_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   409
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   410
  typedef signed long int32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   411
# define INT32_C(v) v ## L
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   412
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   413
#  define PRINTF_INT32_MODIFIER "l"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   414
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   415
#elif (INT_MAX == INT32_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   416
  typedef signed int int32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   417
# define INT32_C(v) v
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   418
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   419
#  define PRINTF_INT32_MODIFIER ""
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   420
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   421
#elif (SHRT_MAX == INT32_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   422
  typedef signed short int32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   423
# define INT32_C(v) ((short) (v))
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   424
# ifndef PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   425
#  define PRINTF_INT32_MODIFIER ""
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   426
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   427
#else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   428
#error "Platform not supported"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   429
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   430
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   431
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   432
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   433
 *  The macro stdint_int64_defined is temporarily used to record
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   434
 *  whether or not 64 integer support is available.  It must be
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   435
 *  defined for any 64 integer extensions for new platforms that are
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   436
 *  added.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   437
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   438
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   439
#undef stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   440
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   441
# if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   442
#  define stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   443
   typedef long long int64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   444
   typedef unsigned long long uint64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   445
#  define UINT64_C(v) v ## ULL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   446
#  define  INT64_C(v) v ## LL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   447
#  ifndef PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   448
#   define PRINTF_INT64_MODIFIER "ll"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   449
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   450
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   451
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   452
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   453
#if !defined (stdint_int64_defined)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   454
# if defined(__GNUC__)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   455
#  define stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   456
   __extension__ typedef long long int64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   457
   __extension__ typedef unsigned long long uint64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   458
#  define UINT64_C(v) v ## ULL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   459
#  define  INT64_C(v) v ## LL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   460
#  ifndef PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   461
#   define PRINTF_INT64_MODIFIER "ll"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   462
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   463
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   464
#  define stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   465
   typedef long long int64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   466
   typedef unsigned long long uint64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   467
#  define UINT64_C(v) v ## ULL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   468
#  define  INT64_C(v) v ## LL
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   469
#  ifndef PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   470
#   define PRINTF_INT64_MODIFIER "ll"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   471
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   472
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   473
#  define stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   474
   typedef __int64 int64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   475
   typedef unsigned __int64 uint64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   476
#  define UINT64_C(v) v ## UI64
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   477
#  define  INT64_C(v) v ## I64
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   478
#  ifndef PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   479
#   define PRINTF_INT64_MODIFIER "I64"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   480
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   481
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   482
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   483
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   484
#if !defined (LONG_LONG_MAX) && defined (INT64_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   485
# define LONG_LONG_MAX INT64_C (9223372036854775807)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   486
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   487
#ifndef ULONG_LONG_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   488
# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   489
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   490
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   491
#if !defined (INT64_MAX) && defined (INT64_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   492
# define INT64_MAX INT64_C (9223372036854775807)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   493
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   494
#if !defined (INT64_MIN) && defined (INT64_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   495
# define INT64_MIN INT64_C (-9223372036854775808)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   496
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   497
#if !defined (UINT64_MAX) && defined (INT64_C)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   498
# define UINT64_MAX UINT64_C (18446744073709551615)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   499
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   500
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   501
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   502
 *  Width of hexadecimal for number field.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   503
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   504
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   505
#ifndef PRINTF_INT64_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   506
# define PRINTF_INT64_HEX_WIDTH "16"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   507
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   508
#ifndef PRINTF_INT32_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   509
# define PRINTF_INT32_HEX_WIDTH "8"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   510
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   511
#ifndef PRINTF_INT16_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   512
# define PRINTF_INT16_HEX_WIDTH "4"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   513
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   514
#ifndef PRINTF_INT8_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   515
# define PRINTF_INT8_HEX_WIDTH "2"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   516
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   517
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   518
#ifndef PRINTF_INT64_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   519
# define PRINTF_INT64_DEC_WIDTH "20"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   520
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   521
#ifndef PRINTF_INT32_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   522
# define PRINTF_INT32_DEC_WIDTH "10"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   523
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   524
#ifndef PRINTF_INT16_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   525
# define PRINTF_INT16_DEC_WIDTH "5"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   526
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   527
#ifndef PRINTF_INT8_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   528
# define PRINTF_INT8_DEC_WIDTH "3"
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   529
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   530
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   531
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   532
 *  Ok, lets not worry about 128 bit integers for now.  Moore's law says
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   533
 *  we don't need to worry about that until about 2040 at which point
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   534
 *  we'll have bigger things to worry about.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   535
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   536
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   537
#ifdef stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   538
  typedef int64_t intmax_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   539
  typedef uint64_t uintmax_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   540
# define  INTMAX_MAX   INT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   541
# define  INTMAX_MIN   INT64_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   542
# define UINTMAX_MAX  UINT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   543
# define UINTMAX_C(v) UINT64_C(v)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   544
# define  INTMAX_C(v)  INT64_C(v)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   545
# ifndef PRINTF_INTMAX_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   546
#   define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   547
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   548
# ifndef PRINTF_INTMAX_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   549
#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   550
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   551
# ifndef PRINTF_INTMAX_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   552
#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   553
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   554
#else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   555
  typedef int32_t intmax_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   556
  typedef uint32_t uintmax_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   557
# define  INTMAX_MAX   INT32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   558
# define UINTMAX_MAX  UINT32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   559
# define UINTMAX_C(v) UINT32_C(v)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   560
# define  INTMAX_C(v)  INT32_C(v)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   561
# ifndef PRINTF_INTMAX_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   562
#   define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   563
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   564
# ifndef PRINTF_INTMAX_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   565
#  define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   566
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   567
# ifndef PRINTF_INTMAX_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   568
#  define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   569
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   570
#endif
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   571
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   572
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   573
 *  Because this file currently only supports platforms which have
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   574
 *  precise powers of 2 as bit sizes for the default integers, the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   575
 *  least definitions are all trivial.  Its possible that a future
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   576
 *  version of this file could have different definitions.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   577
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   578
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   579
#ifndef stdint_least_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   580
  typedef   int8_t   int_least8_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   581
  typedef  uint8_t  uint_least8_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   582
  typedef  int16_t  int_least16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   583
  typedef uint16_t uint_least16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   584
  typedef  int32_t  int_least32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   585
  typedef uint32_t uint_least32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   586
# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   587
# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   588
# define  UINT_LEAST8_MAX  UINT8_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   589
# define   INT_LEAST8_MAX   INT8_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   590
# define UINT_LEAST16_MAX UINT16_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   591
# define  INT_LEAST16_MAX  INT16_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   592
# define UINT_LEAST32_MAX UINT32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   593
# define  INT_LEAST32_MAX  INT32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   594
# define   INT_LEAST8_MIN   INT8_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   595
# define  INT_LEAST16_MIN  INT16_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   596
# define  INT_LEAST32_MIN  INT32_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   597
# ifdef stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   598
    typedef  int64_t  int_least64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   599
    typedef uint64_t uint_least64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   600
#   define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   601
#   define UINT_LEAST64_MAX UINT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   602
#   define  INT_LEAST64_MAX  INT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   603
#   define  INT_LEAST64_MIN  INT64_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   604
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   605
#endif
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   606
#undef stdint_least_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   607
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   608
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   609
 *  The ANSI C committee pretending to know or specify anything about
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   610
 *  performance is the epitome of misguided arrogance.  The mandate of
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   611
 *  this file is to *ONLY* ever support that absolute minimum
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   612
 *  definition of the fast integer types, for compatibility purposes.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   613
 *  No extensions, and no attempt to suggest what may or may not be a
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   614
 *  faster integer type will ever be made in this file.  Developers are
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   615
 *  warned to stay away from these types when using this or any other
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   616
 *  stdint.h.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   617
 */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   618
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   619
typedef   int_least8_t   int_fast8_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   620
typedef  uint_least8_t  uint_fast8_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   621
typedef  int_least16_t  int_fast16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   622
typedef uint_least16_t uint_fast16_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   623
typedef  int_least32_t  int_fast32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   624
typedef uint_least32_t uint_fast32_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   625
#define  UINT_FAST8_MAX  UINT_LEAST8_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   626
#define   INT_FAST8_MAX   INT_LEAST8_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   627
#define UINT_FAST16_MAX UINT_LEAST16_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   628
#define  INT_FAST16_MAX  INT_LEAST16_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   629
#define UINT_FAST32_MAX UINT_LEAST32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   630
#define  INT_FAST32_MAX  INT_LEAST32_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   631
#define   INT_FAST8_MIN   INT_LEAST8_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   632
#define  INT_FAST16_MIN  INT_LEAST16_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   633
#define  INT_FAST32_MIN  INT_LEAST32_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   634
#ifdef stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   635
  typedef  int_least64_t  int_fast64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   636
  typedef uint_least64_t uint_fast64_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   637
# define UINT_FAST64_MAX UINT_LEAST64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   638
# define  INT_FAST64_MAX  INT_LEAST64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   639
# define  INT_FAST64_MIN  INT_LEAST64_MIN
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   640
#endif
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   641
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   642
#undef stdint_int64_defined
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   643
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   644
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   645
 *  Whatever piecemeal, per compiler thing we can do about the wchar_t
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   646
 *  type limits.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   647
 */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   648
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   649
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   650
# include <wchar.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   651
# ifndef WCHAR_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   652
#  define WCHAR_MIN 0
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   653
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   654
# ifndef WCHAR_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   655
#  define WCHAR_MAX ((wchar_t)-1)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   656
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   657
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   658
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   659
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   660
 *  Whatever piecemeal, per compiler/platform thing we can do about the
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   661
 *  (u)intptr_t types and limits.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   662
 */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   663
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   664
#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   665
# define STDINT_H_UINTPTR_T_DEFINED
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   666
#endif
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   667
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   668
#ifndef STDINT_H_UINTPTR_T_DEFINED
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   669
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   670
#  define stdint_intptr_bits 64
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   671
# elif defined (__WATCOMC__) || defined (__TURBOC__)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   672
#  if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   673
#    define stdint_intptr_bits 16
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   674
#  else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   675
#    define stdint_intptr_bits 32
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   676
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   677
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   678
#  define stdint_intptr_bits 32
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   679
# elif defined (__INTEL_COMPILER)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   680
/* TODO -- what will Intel do about x86-64? */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   681
# endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   682
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   683
# ifdef stdint_intptr_bits
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   684
#  define stdint_intptr_glue3_i(a,b,c)  a##b##c
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   685
#  define stdint_intptr_glue3(a,b,c)    stdint_intptr_glue3_i(a,b,c)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   686
#  ifndef PRINTF_INTPTR_MODIFIER
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   687
#    define PRINTF_INTPTR_MODIFIER      stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   688
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   689
#  ifndef PTRDIFF_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   690
#    define PTRDIFF_MAX                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   691
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   692
#  ifndef PTRDIFF_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   693
#    define PTRDIFF_MIN                 stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   694
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   695
#  ifndef UINTPTR_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   696
#    define UINTPTR_MAX                 stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   697
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   698
#  ifndef INTPTR_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   699
#    define INTPTR_MAX                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   700
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   701
#  ifndef INTPTR_MIN
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   702
#    define INTPTR_MIN                  stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   703
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   704
#  ifndef INTPTR_C
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   705
#    define INTPTR_C(x)                 stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   706
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   707
#  ifndef UINTPTR_C
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   708
#    define UINTPTR_C(x)                stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   709
#  endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   710
  typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   711
  typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t)  intptr_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   712
# else
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   713
/* TODO -- This following is likely wrong for some platforms, and does
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   714
   nothing for the definition of uintptr_t. */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   715
  typedef ptrdiff_t intptr_t;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   716
# endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   717
# define STDINT_H_UINTPTR_T_DEFINED
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   718
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   719
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   720
/*
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   721
 *  Assumes sig_atomic_t is signed and we have a 2s complement machine.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   722
 */
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   723
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   724
#ifndef SIG_ATOMIC_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   725
# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   726
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   727
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   728
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   729
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   730
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   731
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   732
/* 
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   733
 *  Please compile with the maximum warning settings to make sure macros are not
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   734
 *  defined more than once.
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   735
 */
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   736
 
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   737
#include <stdlib.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   738
#include <stdio.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   739
#include <string.h>
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   740
 
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   741
#define glue3_aux(x,y,z) x ## y ## z
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   742
#define glue3(x,y,z) glue3_aux(x,y,z)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   743
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   744
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   745
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   746
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   747
#define DECL(us,bits) glue3(DECL,us,) (bits)
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   748
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   749
#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   750
 
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   751
int main () {
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   752
	DECL(I,8)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   753
	DECL(U,8)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   754
	DECL(I,16)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   755
	DECL(U,16)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   756
	DECL(I,32)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   757
	DECL(U,32)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   758
#ifdef INT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   759
	DECL(I,64)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   760
	DECL(U,64)
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   761
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   762
	intmax_t imax = INTMAX_C(0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   763
	uintmax_t umax = UINTMAX_C(0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   764
	char str0[256], str1[256];
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   765
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   766
	sprintf (str0, "%d %x\n", 0, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   767
	
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   768
	sprintf (str1, "%d %x\n",  i8, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   769
	if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   770
	sprintf (str1, "%u %x\n",  u8, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   771
	if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   772
	sprintf (str1, "%d %x\n",  i16, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   773
	if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   774
	sprintf (str1, "%u %x\n",  u16, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   775
	if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);	
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   776
	sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n",  i32, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   777
	if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   778
	sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n",  u32, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   779
	if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   780
#ifdef INT64_MAX	
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   781
	sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n",  i64, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   782
	if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   783
#endif
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   784
	sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n",  imax, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   785
	if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   786
	sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n",  umax, ~0);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   787
	if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);	
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   788
	
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   789
	TESTUMAX(8);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   790
	TESTUMAX(16);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   791
	TESTUMAX(32);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   792
#ifdef INT64_MAX
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   793
	TESTUMAX(64);
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   794
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   795
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   796
	return EXIT_SUCCESS;
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   797
}
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   798
2209
2573d4ff78f9 - bugfix for segfault on fades
koda
parents: 2200
diff changeset
   799
#endif
2200
8192be6e3aef koda/Smaxx changes to openal for crossplatform building
nemo
parents:
diff changeset
   800