/usr/include/pike8.0/pike/port.h is in pike8.0-dev 8.0.164-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | /*
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
*/
#ifndef PORT_H
#define PORT_H
#include "global.h"
#include <math.h>
#ifdef __MINGW32__
/******************************************************/
/* First we must ensure that all defines are in mingw */
/******************************************************/
#ifndef PROCESSOR_PPC_601
#define PROCESSOR_PPC_601 601
#endif
#ifndef PROCESSOR_PPC_604
#define PROCESSOR_PPC_603 603
#endif
#ifndef PROCESSOR_PPC_604
#define PROCESSOR_PPC_604 604
#endif
#ifndef PROCESSOR_PPC_620
#define PROCESSOR_PPC_620 620
#endif
#ifndef PROCESSOR_OPTIL
#define PROCESSOR_OPTIL 0x494f /* MSIL */
#endif
#ifndef PROCESSOR_ARCHITECTURE_MSIL
#define PROCESSOR_ARCHITECTURE_MSIL 8
#endif
#ifndef PROCESSOR_ARCHITECTURE_AMD64
#define PROCESSOR_ARCHITECTURE_AMD64 9
#endif
#ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
#endif
#ifndef PROCESSOR_HITACHI_SH3
#define PROCESSOR_HITACHI_SH3 10003 /* Windows CE */
#endif
#ifndef PROCESSOR_HITACHI_SH3E
#define PROCESSOR_HITACHI_SH3E 10004 /* Windows CE */
#endif
#ifndef PROCESSOR_HITACHI_SH4
#define PROCESSOR_HITACHI_SH4 10005 /* Windows CE */
#endif
#ifndef PROCESSOR_SHx_SH3
#define PROCESSOR_SHx_SH3 103 /* Windows CE */
#endif
#ifndef PROCESSOR_SHx_SH4
#define PROCESSOR_SHx_SH4 104 /* Windows CE */
#endif
#ifndef PROCESSOR_STRONGARM
#define PROCESSOR_STRONGARM 2577 /* Windows CE - 0xA11 */
#endif
#ifndef PROCESSOR_ARM720
#define PROCESSOR_ARM720 1824 /* Windows CE - 0x720 */
#endif
#ifndef PROCESSOR_ARM820
#define PROCESSOR_ARM820 2080 /* Windows CE - 0x820 */
#endif
#ifndef PROCESSOR_ARM920
#define PROCESSOR_ARM920 2336 /* Windows CE - 0x920 */
#endif
#ifndef PROCESSOR_ARM_7TDMI
#define PROCESSOR_ARM_7TDMI 70001 /* Windows CE */
#endif
#ifndef LOGON32_LOGON_NETWORK
#define LOGON32_LOGON_NETWORK 3
#endif
/* FP_CLASS compleation */
/* Now for some functions */
#define Emulate_GetLongPathName GetLongPathNameA
#endif /* __MINGW32__ */
#ifndef STRUCT_TIMEVAL_DECLARED
#define STRUCT_TIMEVAL_DECLARED
struct timeval;
#endif
#ifndef HAVE_GETTIMEOFDAY
PMOD_EXPORT void GETTIMEOFDAY(struct timeval *t);
#else
# ifdef GETTIMEOFDAY_TAKES_TWO_ARGS
# define GETTIMEOFDAY(X) gettimeofday((X),NULL)
# else
# define GETTIMEOFDAY gettimeofday
# endif
#endif
#ifndef HAVE_SNPRINTF
#ifdef HAVE__SNPRINTF
/* In WIN32 snprintf is known as _snprintf... */
#define snprintf _snprintf
#define HAVE_SNPRINTF 1
#endif
#endif
#ifndef HAVE_RINT
#define rintf(X) floorf ((X) + 0.5)
#define rint(X) floor( (X) + 0.5 )
#define rintl(X) floorl ((X) + 0.5)
#endif
#ifndef HAVE_STRCASECMP
PMOD_EXPORT int STRCASECMP(const char *a,const char *b);
#else
# define STRCASECMP strcasecmp
#endif
#ifndef HAVE_VSNPRINTF
PMOD_EXPORT int VSNPRINTF(char *buf, size_t size, const char *fmt, va_list args);
#else
# define VSNPRINTF vsnprintf
#endif
#ifndef HAVE_SNPRINTF
PMOD_EXPORT int SNPRINTF(char *buf, size_t size, const char *fmt, ...);
#else
# define SNPRINTF snprintf
#endif
/* Compat. */
#define RINTF rintf
#define RINT rint
#define RINTL rintl
#define HAVE_STRCHR 1
#define STRCHR strchr
#ifdef STRCHR_DECL_MISSING
char *strchr(const char *s,int c);
#endif
#define HAVE_ISSPACE 1
#define ISSPACE(X) isspace(X)
#define HAVE_TIME 1
#define TIME(X) time(X)
#define HAVE_STRTOL 1
#define STRTOL(X,Y,Z) strtol(X,Y,Z)
#define HAVE_STRTOD 1
#define STRTOD(X,Y) strtod(X,Y)
#define HAVE_STRCSPN 1
#define STRCSPN(X,Y) strcspn(X,Y)
#define HAVE_STRNLEN 1
#define STRNLEN(X,Y) strnlen(X,Y)
#define HAVE_STRNCMP 1
#define STRNCMP(X,Y,Z) strncmp(X,Y,Z)
#define HAVE_MEMSET 1
#define MEMSET(X,Y,Z) memset(X,Y,Z)
#define HAVE_MEMCPY 1
#define MEMCPY(X,Y,Z) memcpy(X,Y,Z)
#define HAVE_MEMMOVE 1
#define MEMMOVE(X,Y,Z) memmove(X,Y,Z)
#define HAVE_MEMCMP 1
#define MEMCMP(X,Y,Z) memcmp(X,Y,Z)
#define HAVE_MEMCHR 1
#define MEMCHR(X,Y,Z) memchr(X,Y,Z)
#define HAVE_VFPRINTF 1
#define VFPRINTF(X,Y,Z) vfprintf(X,Y,Z)
#define HAVE_VSPRINTF 1
#define VSPRINTF(X,Y,Z) vsprintf(X,Y,Z)
#define HAVE_FREXP 1
#define FREXP(X,Y) frexp(X,Y)
#define HAVE_LDEXP 1
#define LDEXP(X,Y) ldexp(X,Y)
#ifdef EXTRACT_UCHAR_BY_CAST
# define EXTRACT_UCHAR(p) (*(const unsigned char *)(p))
#else
# define EXTRACT_UCHAR(p) (0xff & (int)*(p))
#endif
#ifdef EXTRACT_CHAR_BY_CAST
# define EXTRACT_CHAR(p) (*(const signed char *)(p))
#else
static INLINE int EXTRACT_CHAR(const char *p) { return *p > 0x7f ? *p - 0x100 : *p; }
#endif
#ifdef HANDLES_UNALIGNED_MEMORY_ACCESS
# define EXTRACT_UWORD(p) (*(unsigned INT16 *)(p))
# define EXTRACT_WORD(p) (*(INT16 *)(p))
# define EXTRACT_INT(p) (*(INT32 *)(p))
#else
#ifdef PIKE_DEBUG
PMOD_EXPORT unsigned INT16 EXTRACT_UWORD_(unsigned char *p);
PMOD_EXPORT INT16 EXTRACT_WORD_(unsigned char *p);
PMOD_EXPORT INT32 EXTRACT_INT_(unsigned char *p);
#else
/*@unused@*/ static INLINE unsigned EXTRACT_UWORD_(unsigned char *p)
{
unsigned INT16 a;
memcpy(&a,p,sizeof(a));
return a;
}
/*@unused@*/ static INLINE int EXTRACT_WORD_(unsigned char *p)
{
INT16 a;
memcpy(&a,p,sizeof(a));
return a;
}
/*@unused@*/ static INLINE INT32 EXTRACT_INT_(unsigned char *p)
{
INT32 a;
memcpy(&a,p,sizeof(a));
return a;
}
#endif
#define EXTRACT_UWORD(p) EXTRACT_UWORD_((unsigned char *)(p))
#define EXTRACT_WORD(p) EXTRACT_WORD_((unsigned char *)(p))
#define EXTRACT_INT(p) EXTRACT_INT_((unsigned char *)(p))
#endif
PMOD_EXPORT unsigned INT32 my_rand(void);
PMOD_EXPORT void my_srand(INT32 seed);
PMOD_EXPORT void sysleep(double left);
PMOD_EXPORT /*@null@*/ void *pike_realloc(void *ptr, size_t sz);
#ifdef OWN_GETHRTIME
void own_gethrtime_init(void);
void own_gethrtime_update(struct timeval *ptr);
long long gethrtime(void);
#define hrtime_t long long
#endif
#ifdef HAVE_UNION_INIT
#define INFNAN_INDEX 0
#define INFNAN_DATATYPE union
#define INFNAN_INIT
#else
#define INFNAN_INDEX -1
#define INFNAN_DATATYPE struct
#define INFNAN_INIT , {0.0}
#endif
#ifdef DOUBLE_IS_IEEE_BIG
#define DECLARE_INF static const INFNAN_DATATYPE { unsigned char c[8]; double d[1]; } \
inf_ = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } INFNAN_INIT };
#define DECLARE_NAN static const INFNAN_DATATYPE { unsigned char c[8]; double d[1]; } \
nan_ = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } INFNAN_INIT };
#define MAKE_INF(s) ((s)*inf_.d[INFNAN_INDEX])
#define MAKE_NAN() (nan_.d[INFNAN_INDEX])
#else
#ifdef DOUBLE_IS_IEEE_LITTLE
#define DECLARE_INF static const INFNAN_DATATYPE { unsigned char c[8]; double d[1]; } \
inf_ = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } INFNAN_INIT };
#define DECLARE_NAN static const INFNAN_DATATYPE { unsigned char c[8]; double d[1]; } \
nan_ = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } INFNAN_INIT };
#define MAKE_INF(s) ((s)*inf_.d[INFNAN_INDEX])
#define MAKE_NAN() (nan_.d[INFNAN_INDEX])
#else
#ifdef FLOAT_IS_IEEE_BIG
#define DECLARE_INF static const INFNAN_DATATYPE { unsigned char c[4]; float f[1]; } \
inf_ = { { 0x7f, 0x80, 0, 0 } INFNAN_INIT };
#define DECLARE_NAN static const INFNAN_DATATYPE { unsigned char c[4]; float f[1]; } \
nan_ = { { 0x7f, 0xc0, 0, 0 } INFNAN_INIT };
#define MAKE_INF(s) ((s)*inf_.f[INFNAN_INDEX])
#define MAKE_NAN() (nan_.f[INFNAN_INDEX])
#else
#ifdef FLOAT_IS_IEEE_LITTLE
#define DECLARE_INF static const INFNAN_DATATYPE { unsigned char c[4]; float f[1]; } \
inf_ = { { 0, 0, 0x80, 0x7f } INFNAN_INIT };
#define DECLARE_NAN static const INFNAN_DATATYPE { unsigned char c[4]; float f[1]; } \
nan_ = { { 0, 0, 0xc0, 0x7f } INFNAN_INIT };
#define MAKE_INF(s) ((s)*inf_.f[INFNAN_INDEX])
#define MAKE_NAN() (nan_.f[INFNAN_INDEX])
#else
#undef INFNAN_INDEX
#undef INFNAN_DATATYPE
#undef INFNAN_INIT
#define DECLARE_INF
#define DECLARE_NAN
#ifdef HAVE_INFNAN
#define MAKE_INF(s) (infnan((s)*ERANGE))
#else
#ifdef HUGE_VAL
#define MAKE_INF(s) ((s)*HUGE_VAL)
#else
#ifdef PORT_DO_WARN
/* Only warn when compiling port.c; might get here when using
* --disable-binary. */
#warning Don´t know how to create Inf on the system!
#endif
#define MAKE_INF(s) ((s)*LDEXP(1.0, 1024))
#endif /* HUGE_VAL */
#endif /* HAVE_INFNAN */
#ifdef HAVE_INFNAN
#define MAKE_NAN() (infnan(EDOM))
#else
#ifdef HAVE_NAN
/* C99 provides a portable way of generating NaN */
#define MAKE_NAN() (nan(""))
#else
#ifdef NAN
#define MAKE_NAN() (NAN)
#else
#ifdef PORT_DO_WARN
#warning Don´t know how to create NaN on this system!
#endif
#define MAKE_NAN() (0.0)
#endif /* NAN */
#endif /* HAVE_NAN */
#endif /* HAVE_INFNAN */
#endif /* FLOAT_IS_IEEE_LITTLE */
#endif /* FLOAT_IS_IEEE_BIG */
#endif /* DOUBLE_IS_IEEE_LITTLE */
#endif /* DOUBLE_IS_IEEE_BIG */
#ifdef __MINGW32__
#ifndef HAVE__DOSMAPERR
void _dosmaperr(int x);
#endif
#endif
#ifdef __clang__
#define PIKE_CLANG_FEATURE(x) __has_feature(x)
#define PIKE_CLANG_BUILTIN(x) __has_builtin(x)
#else
#define PIKE_CLANG_FEATURE(x) (0)
#define PIKE_CLANG_BUILTIN(x) (0)
#endif
#endif
|