| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef _ASN_SYSTEM_H_ |
| 10 |
#define _ASN_SYSTEM_H_ |
| 11 |
|
| 12 |
#ifdef HAVE_CONFIG_H |
| 13 |
#include "config.h" |
| 14 |
#endif |
| 15 |
|
| 16 |
#include <stdio.h> |
| 17 |
#include <stdlib.h> |
| 18 |
#include <string.h> |
| 19 |
#include <sys/types.h> |
| 20 |
#include <limits.h> |
| 21 |
#include <stdarg.h> |
| 22 |
#include <stddef.h> |
| 23 |
|
| 24 |
#ifdef WIN32 |
| 25 |
|
| 26 |
#include <malloc.h> |
| 27 |
#define snprintf _snprintf |
| 28 |
#define vsnprintf _vsnprintf |
| 29 |
|
| 30 |
|
| 31 |
#define sys_ntohl(l) ((((l) << 24) & 0xff000000) \ |
| 32 |
| (((l) << 16) & 0xff0000) \ |
| 33 |
| (((l) << 8) & 0xff00) \ |
| 34 |
| ((l) & 0xff)) |
| 35 |
|
| 36 |
#ifdef _MSC_VER |
| 37 |
#ifndef __cplusplus |
| 38 |
#define inline __inline |
| 39 |
#endif |
| 40 |
#ifndef ASSUMESTDTYPES |
| 41 |
#define ssize_t SSIZE_T |
| 42 |
typedef char int8_t; |
| 43 |
typedef short int16_t; |
| 44 |
typedef int int32_t; |
| 45 |
typedef unsigned char uint8_t; |
| 46 |
typedef unsigned short uint16_t; |
| 47 |
typedef unsigned int uint32_t; |
| 48 |
#endif |
| 49 |
#define WIN32_LEAN_AND_MEAN |
| 50 |
#include <windows.h> |
| 51 |
#include <float.h> |
| 52 |
#define isnan _isnan |
| 53 |
#define finite _finite |
| 54 |
#define copysign _copysign |
| 55 |
#define ilogb _logb |
| 56 |
#else |
| 57 |
#include <stdint.h> |
| 58 |
#endif |
| 59 |
|
| 60 |
#else |
| 61 |
|
| 62 |
#if defined(__vxworks) |
| 63 |
#include <types/vxTypes.h> |
| 64 |
#else |
| 65 |
|
| 66 |
#include <inttypes.h> |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
#if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_)) |
| 74 |
#if defined(sun) |
| 75 |
#include <alloca.h> |
| 76 |
#include <ieeefp.h> |
| 77 |
#elif defined(__hpux) |
| 78 |
#ifdef __GNUC__ |
| 79 |
#include <alloca.h> |
| 80 |
#else |
| 81 |
#define inline |
| 82 |
#endif |
| 83 |
#else |
| 84 |
#include <stdint.h> |
| 85 |
#endif |
| 86 |
#endif |
| 87 |
|
| 88 |
#include <netinet/in.h> |
| 89 |
#define sys_ntohl(foo) ntohl(foo) |
| 90 |
|
| 91 |
#endif |
| 92 |
|
| 93 |
#endif |
| 94 |
|
| 95 |
#if __GNUC__ >= 3 |
| 96 |
#ifndef GCC_PRINTFLIKE |
| 97 |
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) |
| 98 |
#endif |
| 99 |
#ifndef GCC_NOTUSED |
| 100 |
#define GCC_NOTUSED __attribute__((unused)) |
| 101 |
#endif |
| 102 |
#else |
| 103 |
#ifndef GCC_PRINTFLIKE |
| 104 |
#define GCC_PRINTFLIKE(fmt,var) |
| 105 |
#endif |
| 106 |
#ifndef GCC_NOTUSED |
| 107 |
#define GCC_NOTUSED |
| 108 |
#endif |
| 109 |
#endif |
| 110 |
|
| 111 |
|
| 112 |
#if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT)) |
| 113 |
#define ASN_THREAD_SAFE |
| 114 |
#endif |
| 115 |
|
| 116 |
#ifndef offsetof |
| 117 |
#define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0)) |
| 118 |
#endif |
| 119 |
|
| 120 |
#ifndef MIN |
| 121 |
#if defined(__GNUC__) |
| 122 |
#define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \ |
| 123 |
((_a)<(_b)?(_a):(_b)); }) |
| 124 |
#else |
| 125 |
#define MIN(a,b) ((a)<(b)?(a):(b)) |
| 126 |
#endif |
| 127 |
#endif |
| 128 |
|
| 129 |
#endif |