2 * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
6 * Miscellaneous system-dependent types.
15 #include <stdio.h> /* For snprintf(3) */
16 #include <stdlib.h> /* For *alloc(3) */
17 #include <string.h> /* For memcpy(3) */
18 #include <sys/types.h> /* For size_t */
19 #include <stdarg.h> /* For va_start */
20 #include <stddef.h> /* for offsetof and ptrdiff_t */
26 #define snprintf _snprintf
27 #define vsnprintf _vsnprintf
29 #ifdef _MSC_VER /* MSVS.Net */
31 #define inline __inline
33 #define ssize_t SSIZE_T
35 typedef short int16_t;
37 typedef unsigned char uint8_t;
38 typedef unsigned short uint16_t;
39 typedef unsigned int uint32_t;
40 #define WIN32_LEAN_AND_MEAN
44 #define finite _finite
45 #define copysign _copysign
51 #if defined(__vxworks)
52 #include <types/vxTypes.h>
53 #else /* !defined(__vxworks) */
55 #include <inttypes.h> /* C99 specifies this file */
57 * 1. Earlier FreeBSD version didn't have <stdint.h>,
58 * but <inttypes.h> was present.
59 * 2. Sun Solaris requires <alloca.h> for alloca(3),
60 * but does not have <stdint.h>.
62 #if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_))
64 #include <alloca.h> /* For alloca(3) */
65 #include <ieeefp.h> /* for finite(3) */
68 #include <alloca.h> /* For alloca(3) */
73 #include <stdint.h> /* SUSv2+ and C99 specify this file, for uintXX_t */
74 #endif /* defined(sun) */
77 #endif /* defined(__vxworks) */
82 #ifndef GCC_PRINTFLIKE
83 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
86 #ifndef GCC_PRINTFLIKE
87 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
91 #ifndef offsetof /* If not defined by <stddef.h> */
92 #define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0))
95 #ifndef MIN /* Suitable for comparing primitive types (integers) */
97 #define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \
98 ((_a)<(_b)?(_a):(_b)); })
100 #define MIN(a,b) ((a)<(b)?(a):(b)) /* Unsafe variant */
101 #endif /* __GNUC__ */
104 #endif /* _ASN_SYSTEM_H_ */