w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

defines.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  * ---------------------------------------------------------------------------
25  *
26  * Modified (butchered) 2006 by Martin Schröder for pdfTeX
27  *
28  */
29 
30 #ifndef _DEFINES_H
31 #define _DEFINES_H
32 
33 /* $Id: defines.h,v 1.130 2005/12/17 11:04:09 dtucker Exp $ */
34 
35 
36 /* Constants */
37 
38 #ifndef STDIN_FILENO
39 # define STDIN_FILENO 0
40 #endif
41 #ifndef STDOUT_FILENO
42 # define STDOUT_FILENO 1
43 #endif
44 #ifndef STDERR_FILENO
45 # define STDERR_FILENO 2
46 #endif
47 
48 #ifndef __unused
49 #define __unused
50 #endif
51 
52 /* Types */
53 
54 /* If sys/types.h does not supply intXX_t, supply them ourselves */
55 /* (or die trying) */
56 
57 
58 #ifndef HAVE_U_INT
59 typedef unsigned int u_int;
60 #endif
61 
62 #ifndef HAVE_INTXX_T
63 # if (SIZEOF_CHAR == 1)
64 typedef char int8_t;
65 # else
66 # error "8 bit int type not found."
67 # endif
68 # if (SIZEOF_SHORT_INT == 2)
69 typedef short int int16_t;
70 # else
71 # ifdef _UNICOS
72 # if (SIZEOF_SHORT_INT == 4)
73 typedef short int16_t;
74 # else
75 typedef long int16_t;
76 # endif
77 # else
78 # error "16 bit int type not found."
79 # endif /* _UNICOS */
80 # endif
81 # if (SIZEOF_INT == 4)
82 typedef int int32_t;
83 # else
84 # ifdef _UNICOS
85 typedef long int32_t;
86 # else
87 # error "32 bit int type not found."
88 # endif /* _UNICOS */
89 # endif
90 #endif
91 
92 /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
93 #ifndef HAVE_U_INTXX_T
94 # ifdef HAVE_UINTXX_T
95 typedef uint8_t u_int8_t;
96 typedef uint16_t u_int16_t;
97 typedef uint32_t u_int32_t;
98 # define HAVE_U_INTXX_T 1
99 # else
100 # if (SIZEOF_CHAR == 1)
101 typedef unsigned char u_int8_t;
102 # else
103 # error "8 bit int type not found."
104 # endif
105 # if (SIZEOF_SHORT_INT == 2)
106 typedef unsigned short int u_int16_t;
107 # else
108 # ifdef _UNICOS
109 # if (SIZEOF_SHORT_INT == 4)
110 typedef unsigned short u_int16_t;
111 # else
112 typedef unsigned long u_int16_t;
113 # endif
114 # else
115 # error "16 bit int type not found."
116 # endif
117 # endif
118 # if (SIZEOF_INT == 4)
119 typedef unsigned int u_int32_t;
120 # else
121 # ifdef _UNICOS
122 typedef unsigned long u_int32_t;
123 # else
124 # error "32 bit int type not found."
125 # endif
126 # endif
127 # endif
128 #define __BIT_TYPES_DEFINED__
129 #endif
130 
131 /* 64-bit types */
132 #ifndef HAVE_INT64_T
133 typedef __int64 int64_t;
134 #endif
135 #ifndef HAVE_U_INT64_T
136 typedef unsigned __int64 u_int64_t;
137 #endif
138 
139 #ifndef HAVE_U_CHAR
140 typedef unsigned char u_char;
141 # define HAVE_U_CHAR
142 #endif /* HAVE_U_CHAR */
143 
144 #ifndef SIZE_T_MAX
145 #define SIZE_T_MAX ULONG_MAX
146 #endif /* SIZE_T_MAX */
147 
148 #ifndef HAVE_SIZE_T
149 typedef unsigned int size_t;
150 # define HAVE_SIZE_T
151 # define SIZE_T_MAX UINT_MAX
152 #endif /* HAVE_SIZE_T */
153 
154 #ifndef HAVE_SSIZE_T
155 typedef int ssize_t;
156 # define HAVE_SSIZE_T
157 #endif /* HAVE_SSIZE_T */
158 
159 /* Macros */
160 
161 #ifndef MAX
162 # define MAX(a,b) (((a)>(b))?(a):(b))
163 # define MIN(a,b) (((a)<(b))?(a):(b))
164 #endif
165 
166 #ifndef roundup
167 # define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
168 #endif
169 
170 #ifndef __P
171 # define __P(x) x
172 #endif
173 
174 #if !defined(__GNUC__) || (__GNUC__ < 2)
175 # define __attribute__(x)
176 #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
177 
178 #ifndef __dead
179 # define __dead __attribute__((noreturn))
180 #endif
181 
182 #if !defined(HAVE_ATTRIBUTE__SENTINEL__) && !defined(__sentinel__)
183 # define __sentinel__
184 #endif
185 
186 #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
187 # define __bounded__(x, y, z)
188 #endif
189 
190 /* Function replacement / compatibility hacks */
191 
192 #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
193 # define __func__ __FUNCTION__
194 #elif !defined(HAVE___func__)
195 # define __func__ ""
196 #endif
197 
198 #if defined(__Lynx__)
199  /*
200  * LynxOS defines these in param.h which we do not want to include since
201  * it will also pull in a bunch of kernel definitions.
202  */
203  /* Missing prototypes on LynxOS */
204  int snprintf (char *, size_t, const char *, ...);
205 #endif
206 
207 /* some system headers on HP-UX define YES/NO */
208 #ifdef YES
209 # undef YES
210 #endif
211 #ifdef NO
212 # undef NO
213 #endif
214 
215 #endif /* _DEFINES_H */
__int64 int64_t
Definition: defines.h:133
unsigned int size_t
Definition: defines.h:149
unsigned __int64 u_int64_t
Definition: defines.h:136
unsigned int u_int
Definition: defines.h:59
unsigned char u_char
Definition: defines.h:140
int ssize_t
Definition: defines.h:155
unsigned short uint16_t
Definition: stdint.h:79
unsigned int uint32_t
Definition: stdint.h:80
unsigned char uint8_t
Definition: stdint.h:78
#define snprintf
Definition: snprintf.c:41
#define int32_t
Definition: stdint.in.h:167
#define int8_t
Definition: stdint.in.h:153
#define int16_t
Definition: stdint.in.h:160