]> pd.if.org Git - pdclib.old/blob - platform/gandr/includes/_PDCLIB_config.h
[gandr] s/__lp64__/__LP64__/ to match GCC define
[pdclib.old] / platform / gandr / includes / _PDCLIB_config.h
1 #ifndef _PDCLIB_CONFIG_H
2 #define _PDCLIB_CONFIG_H
3 /* Internal PDCLib configuration <_PDCLIB_config.h>
4    (Gandr platform)
5
6    This file is part of the Public Domain C Library (PDCLib).
7    Permission is granted to use, modify, and / or redistribute at will.
8 */
9
10
11
12 /* end of line */
13 #define _PDCLIB_endl "\n"
14
15 /* exit() */
16 #define _PDCLIB_SUCCESS 0
17 #define _PDCLIB_FAILURE -1
18
19 /* trivial memswp */
20 #define _PDCLIB_memswp( i, j, size ) char tmp; do { tmp = *i; *i++ = *j; *j++ = tmp; } while ( --size );
21
22
23 #if defined(__arm__)
24   #define _PDCLIB_CHAR_SIGNED 0
25 #else
26   #define _PDCLIB_CHAR_SIGNED 1
27 #endif
28
29 /* Width of the integer types short, int, long, and long long, in bytes.      */
30 /* SHRT == 2, INT >= SHRT, LONG >= INT >= 4, LLONG >= LONG - check your       */
31 /* compiler manuals.                                                          */
32 #define _PDCLIB_SHRT_BYTES  2
33 #define _PDCLIB_INT_BYTES 4
34 #if defined(__LP64__)
35   #define _PDCLIB_LONG_BYTES 8
36 #else
37   #define _PDCLIB_LONG_BYTES 4
38 #endif
39 #define _PDCLIB_LLONG_BYTES 8
40
41 /* layout of div_t, ldiv_t, lldiv_t */
42 struct _PDCLIB_div_t   { int quot;            int rem; };
43 struct _PDCLIB_ldiv_t  { long int quot;       long int rem; };
44 struct _PDCLIB_lldiv_t { long long int quot;  long long int rem; };
45
46 /* fast* datatypes. This is a bit of a blunt instrument. */
47 #define _PDCLIB_FAST8 CHAR
48 #define _PDCLIB_fast8 char
49 #define _PDCLIB_FAST8_CONV hh
50
51 #define _PDCLIB_FAST16 SHRT
52 #define _PDCLIB_fast16 short
53 #define _PDCLIB_FAST16_CONV h
54
55 #define _PDCLIB_FAST32 INT
56 #define _PDCLIB_fast32 int
57 #define _PDCLIB_FAST32_CONV
58
59 #define _PDCLIB_FAST64 LLONG
60 #define _PDCLIB_fast64 long long
61 #define _PDCLIB_FAST64_CONV ll
62
63 /* ptrdiff_t */
64 #define _PDCLIB_ptrdiff long
65 #define _PDCLIB_PTRDIFF LONG
66 #define _PDCLIB_PTR_CONV l
67
68 /* Result type of the 'sizeof' operator (must be unsigned) */
69 #define _PDCLIB_size unsigned long
70 #define _PDCLIB_SIZE ULONG
71
72 /* intptr_t */
73 #define _PDCLIB_intptr long
74 #define _PDCLIB_INTPTR LONG
75
76 /* sig_atomic_t */
77 #define _PDCLIB_sig_atomic char
78 #define _PDCLIB_SIG_ATOMIC CHAR
79
80 /* wint_t, wchar_t */
81 #define _PDCLIB_wint  signed int
82 #define _PDCLIB_wchar unsigned int
83 #define _PDCLIB_WCHAR UINT
84
85
86 /* Largest supported integer type */
87 #define _PDCLIB_intmax long long int
88 #define _PDCLIB_INTMAX LLONG
89 #define _PDCLIB_MAX_CONV ll
90 #define _PDCLIB_INTMAX_LITERAL ll
91
92 struct _PDCLIB_imaxdiv_t { _PDCLIB_intmax quot; _PDCLIB_intmax rem; };
93
94 /* time_t */
95 #define _PDCLIB_time  unsigned long long
96
97 /* clock_t */
98 #define _PDCLIB_clock unsigned
99 #define _PDCLIB_CLOCKS_PER_SEC 1000000
100
101 /* timespec_get */
102 #define _PDCLIB_TIME_UTC 1
103
104 /* -------------------------------------------------------------------------- */
105 /* Floating Point                                                             */
106 /* -------------------------------------------------------------------------- */
107
108 /* Whether the implementation rounds toward zero (0), to nearest (1), toward
109    positive infinity (2), or toward negative infinity (3). (-1) signifies
110    indeterminable rounding, any other value implementation-specific rounding.
111 */
112 #define _PDCLIB_FLT_ROUNDS -1
113
114 /* Whether the implementation uses exact-width precision (0), promotes float
115    to double (1), or promotes float and double to long double (2). (-1)
116    signifies indeterminable behaviour, any other value implementation-specific
117    behaviour.
118 */
119 #define _PDCLIB_FLT_EVAL_METHOD -1
120
121 /* "Number of the decimal digits (n), such that any floating-point number in the
122    widest supported floating type with p(max) radix (b) digits can be rounded to
123    a floating-point number with (n) decimal digits and back again without change
124    to the value p(max) log(10)b if (b) is a power of 10, [1 + p(max) log(10)b]
125    otherwise."
126    64bit IEC 60559 double format (53bit mantissa) is DECIMAL_DIG 17.
127    80bit IEC 60559 double-extended format (64bit mantissa) is DECIMAL_DIG 21.
128 */
129 #define _PDCLIB_DECIMAL_DIG 17
130
131 /* Floating point types
132  *
133  * PDCLib (at present) assumes IEEE 754 floating point formats
134  * The following names are used:
135  *    SINGLE:   IEEE 754 single precision (32-bit)
136  *    DOUBLE:   IEEE 754 double precision (64-bit)
137  *    EXTENDED: IEEE 754 extended precision (80-bit, as x87)
138  */
139 #define _PDCLIB_FLOAT_TYPE   SINGLE
140 #define _PDCLIB_DOUBLE_TYPE  DOUBLE
141 #if defined(__i386__) || defined(__amd64__)
142   #define _PDCLIB_LDOUBLE_TYPE EXTENDED
143 #else
144   #define _PDCLIB_LDOUBLE_TYPE DOUBLE
145 #endif
146
147 /* -------------------------------------------------------------------------- */
148 /* Platform-dependent macros defined by the standard headers.                 */
149 /* -------------------------------------------------------------------------- */
150
151 /* offsetof */
152 #define _PDCLIB_offsetof( type, member ) __builtin_offsetof( type, member )
153
154 /* stdarg.h */
155 typedef __builtin_va_list _PDCLIB_va_list;
156 #define _PDCLIB_va_arg( ap, type ) (__builtin_va_arg( (ap), type ))
157 #define _PDCLIB_va_copy( dest, src ) (__builtin_va_copy( (dest), (src) ))
158 #define _PDCLIB_va_end( ap ) (__builtin_va_end( ap ) )
159 #define _PDCLIB_va_start( ap, parmN ) (__builtin_va_start( (ap), (parmN) ))
160
161 /* "OS glue" */
162
163 /* Memory management -------------------------------------------------------- */
164
165 #define _PDCLIB_MALLOC_PAGESIZE 4096
166 #define _PDCLIB_MALLOC_ALIGN 16
167 #define _PDCLIB_MALLOC_GRANULARITY 4096
168 #define _PDCLIB_MALLOC_TRIM_THRESHOLD 2*1024*1024
169 #define _PDCLIB_MALLOC_MMAP_THRESHOLD 256*1024
170 #define _PDCLIB_MALLOC_RELEASE_CHECK_RATE 4095
171
172 /* Locale --------------------------------------------------------------------*/
173
174 /* Locale method. See _PDCLIB_locale.h. If undefined, POSIX per-thread locales
175  * will be disabled
176  */
177 /* #define _PDCLIB_LOCALE_METHOD _PDCLIB_LOCALE_METHOD_TSS */
178
179 /* wchar_t encoding */
180 #define _PDCLIB_WCHAR_ENCODING _PDCLIB_WCHAR_ENCODING_UCS4
181
182 /* I/O ---------------------------------------------------------------------- */
183
184 /* The default size for file buffers. Must be at least 256. */
185 #define _PDCLIB_BUFSIZ 1024
186
187 /* We need \n -> \r\n translation for text files */
188 #define _PDCLIB_NEED_EOL_TRANSLATION 1
189
190 /* Minimum number of files we can open simultaneously. C says this must be >= 8,
191  * so we say that. May actually be a lie in some cases...
192  */
193 #define _PDCLIB_FOPEN_MAX 8
194
195 /* Length of the longest filename the implementation guarantees to support. */
196 #define _PDCLIB_FILENAME_MAX 260
197
198 /* Maximum length of filenames generated by tmpnam(). (See tmpfile.c.) */
199 #define _PDCLIB_L_tmpnam 260
200
201 /* Number of distinct file names that can be generated by tmpnam(). */
202 #define _PDCLIB_TMP_MAX 50
203
204 /* SEEK_SET, CUR, END */
205 #define _PDCLIB_SEEK_SET 0
206 #define _PDCLIB_SEEK_CUR 1
207 #define _PDCLIB_SEEK_END 2
208
209 /* How much can you ungetc? Not much, thankfully */
210 #define _PDCLIB_UNGETCBUFSIZE 1
211
212 /* errno -------------------------------------------------------------------- */
213
214 /* errno values as per C++11 */
215 #define _PDCLIB_ERANGE 1
216 #define _PDCLIB_EDOM   2
217 #define _PDCLIB_EILSEQ 3
218 #define _PDCLIB_E2BIG 4
219 #define _PDCLIB_ECONNRESET 5
220 #define _PDCLIB_EISCONN 6
221 #define _PDCLIB_ENOENT 7
222 #define _PDCLIB_ENOTRECOVERABLE 8
223 #define _PDCLIB_EROFS 9
224 #define _PDCLIB_EACCES 10
225 #define _PDCLIB_EDEADLK 11
226 #define _PDCLIB_EISDIR 12
227 #define _PDCLIB_ENOEXEC 13
228 #define _PDCLIB_ENOTSOCK 14
229 #define _PDCLIB_ESPIPE 15
230 #define _PDCLIB_EADDRINUSE 16
231 #define _PDCLIB_EDESTADDRREQ 17
232 #define _PDCLIB_ELOOP 18
233 #define _PDCLIB_ENOLCK 19
234 #define _PDCLIB_ENOTSUPP 20
235 #define _PDCLIB_ESRCH 21
236 #define _PDCLIB_EADDRNOTAVAIL 22
237 #define _PDCLIB_EMFILE 23
238 #define _PDCLIB_ENOLINK 24
239 #define _PDCLIB_ENOTTY 25
240 #define _PDCLIB_ETIME 26
241 #define _PDCLIB_EAFNOSUPPORT 27
242 #define _PDCLIB_EEXIST 28
243 #define _PDCLIB_EMLINK 29
244 #define _PDCLIB_ENOMEM 30
245 #define _PDCLIB_ENXIO 31
246 #define _PDCLIB_ETIMEDOUT 32
247 #define _PDCLIB_EAGAIN 33
248 #define _PDCLIB_EFAULT 34
249 #define _PDCLIB_EMSGSIZE 35
250 #define _PDCLIB_ENOMSG 36
251 #define _PDCLIB_EOPNOTSUPP 37
252 #define _PDCLIB_ETXTBSY 38
253 #define _PDCLIB_EALREADY 39
254 #define _PDCLIB_EFBIG 40
255 #define _PDCLIB_ENAMETOOLONG 41
256 #define _PDCLIB_ENOPROTOOPT 42
257 #define _PDCLIB_EOVERFLOW 43
258 #define _PDCLIB_EWOULDBLOCK _PDCLIB_EAGAIN
259 #define _PDCLIB_EBADF 44
260 #define _PDCLIB_EHOSTUNREACH 45
261 #define _PDCLIB_ENETDOWN 46
262 #define _PDCLIB_ENOSPC 47
263 #define _PDCLIB_EOWNERDEAD 48
264 #define _PDCLIB_EXDEV 49
265 #define _PDCLIB_EBADMSG 50
266 #define _PDCLIB_EIDRM 51
267 #define _PDCLIB_ENETRESET 52
268 #define _PDCLIB_ENOSR 53
269 #define _PDCLIB_EPERM 54
270 #define _PDCLIB_EBUSY 55
271 #define _PDCLIB_ENETUNREACH 56
272 #define _PDCLIB_ENOSTR 57
273 #define _PDCLIB_EPIPE 58
274 #define _PDCLIB_ECANCELED 59
275 #define _PDCLIB_EINPROGRESS 60
276 #define _PDCLIB_ENFILE 61
277 #define _PDCLIB_ENOSYS 62
278 #define _PDCLIB_EPROTO 63
279 #define _PDCLIB_ECHILD 64
280 #define _PDCLIB_EINTR 65
281 #define _PDCLIB_ENOBUFS 66
282 #define _PDCLIB_ENOTCONN 67
283 #define _PDCLIB_EPROTONOSUPPORT 68
284 #define _PDCLIB_ECONNABORTED 69
285 #define _PDCLIB_EINVAL 70
286 #define _PDCLIB_ENODATA 71
287 #define _PDCLIB_ENOTDIR 72
288 #define _PDCLIB_EPROTOTYPE 73
289 #define _PDCLIB_EIO 74
290
291 #define _PDCLIB_ERRNO_MAX 74
292
293 #endif