|
|
|
|
|
|
|
#ifndef GLOBAL_H |
#define GLOBAL_H |
|
#if defined(__WINNT__) && !defined(__NT__) |
#define __NT__ |
#endif |
|
#ifndef _LARGEFILE_SOURCE |
# define _FILE_OFFSET_BITS 64 |
# define _LARGEFILE_SOURCE |
# define _LARGEFILE64_SOURCE 1 |
#endif |
|
|
#ifndef __STDC_EXT__ |
# define __STDC_EXT__ |
#endif /* !__STDC_EXT__ */ |
#ifndef _PROTOTYPES |
# define _PROTOTYPES |
#endif /* !_PROTOTYPES */ |
|
|
#ifndef _GNU_SOURCE |
#define _GNU_SOURCE |
#endif /* !_GNU_SOURCE */ |
|
#ifdef __NT__ |
|
* we need to define this one. |
*/ |
#ifndef WIN32_LEAN_AND_MEAN |
#define WIN32_LEAN_AND_MEAN |
#endif |
|
|
#ifndef WIN32 |
#define WIN32 100 /* WinNT 1.0 */ |
#endif |
#endif /* __NT__ */ |
|
|
|
|
#ifndef __BUILTIN_VA_ARG_INCR |
#define __BUILTIN_VA_ARG_INCR 1 |
#endif /* !__BUILTIN_VA_ARG_INCR */ |
|
|
|
|
|
|
#ifdef MALLOC_REPLACED |
#define NO_FIX_MALLOC |
#endif |
|
#ifndef STRUCT_PROGRAM_DECLARED |
#define STRUCT_PROGRAM_DECLARED |
struct program; |
#endif |
|
struct function; |
#ifndef STRUCT_SVALUE_DECLARED |
#define STRUCT_SVALUE_DECLARED |
struct svalue; |
#endif |
struct sockaddr; |
struct object; |
struct array; |
struct svalue; |
|
#ifndef STRUCT_TIMEVAL_DECLARED |
#define STRUCT_TIMEVAL_DECLARED |
struct timeval; |
#endif |
|
#ifndef CONFIGURE_TEST |
|
* program. In that case these defines will already be included. */ |
#include "machine.h" |
#endif |
|
|
|
|
|
#define MAX_LOCAL 256 |
|
|
|
|
#ifndef NO_GC |
#define GC2 |
#endif |
|
#if defined(i386) |
#ifndef HANDLES_UNALIGNED_MEMORY_ACCESS |
#define HANDLES_UNALIGNED_MEMORY_ACCESS |
#endif |
#endif |
|
|
#if HAVE_ALLOCA_H |
# include <alloca.h> |
# ifdef __GNUC__ |
# ifdef alloca |
# undef alloca |
# endif |
# define alloca __builtin_alloca |
# endif |
#else |
# ifdef __GNUC__ |
# ifdef alloca |
# undef alloca |
# endif |
# define alloca __builtin_alloca |
# else |
# ifdef _AIX |
#pragma alloca |
# else |
# ifndef alloca /* predefined by HP cc +Olibcalls */ |
void *alloca(); |
# endif |
# endif |
# endif |
#endif |
|
#ifdef __NT__ |
|
#undef FD_SETSIZE |
#define FD_SETSIZE MAX_OPEN_FILEDESCRIPTORS |
#endif |
|
#include <stdio.h> |
|
#ifdef HAVE_STDLIB_H |
#include <stdlib.h> |
#undef HAVE_STDLIB_H |
#endif |
|
#ifdef HAVE_STDDEF_H |
#include <stddef.h> |
#undef HAVE_STDDEF_H |
#endif |
|
#ifdef HAVE_MALLOC_H |
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) |
|
#include <malloc.h> |
#endif /* !__FreeBSD__ && !__OpenBSD */ |
#undef HAVE_MALLOC_H |
#endif |
|
#ifdef HAVE_UNISTD_H |
#include <unistd.h> |
#undef HAVE_UNISTD_H |
#endif |
|
#ifdef HAVE_STRING_H |
#include <string.h> |
#undef HAVE_STRING_H |
#endif |
|
#ifdef HAVE_LIMITS_H |
#include <limits.h> |
#undef HAVE_LIMITS_H |
#endif |
|
#ifdef HAVE_SYS_TYPES_H |
#include <sys/types.h> |
#undef HAVE_SYS_TYPES_H |
#endif |
|
#ifdef HAVE_MEMORY_H |
#include <memory.h> |
#undef HAVE_MEMORY_H |
#endif |
|
#ifdef HAVE_WINDOWS_H |
#include <windows.h> |
#undef HAVE_WINDOWS_H |
#endif |
|
|
#include "pike_int_types.h" |
|
#define SIZE_T unsigned INT32 |
|
#define TYPE_T unsigned int |
#define TYPE_FIELD unsigned INT16 |
|
#define B1_T char |
|
#if SIZEOF_SHORT == 2 |
#define B2_T short |
#elif SIZEOF_INT == 2 |
#define B2_T int |
#endif |
|
#if SIZEOF_SHORT == 4 |
#define B4_T short |
#elif SIZEOF_INT == 4 |
#define B4_T int |
#elif SIZEOF_LONG == 4 |
#define B4_T long |
#endif |
|
#if SIZEOF_INT == 8 |
#define B8_T int |
#elif SIZEOF_LONG == 8 |
#define B8_T long |
#elif (SIZEOF_LONG_LONG - 0) == 8 |
#define B8_T long long |
#elif (SIZEOF___INT64 - 0) == 8 |
#define B8_T __int64 |
#elif SIZEOF_CHAR_P == 8 |
#define B8_T char * |
#elif defined(B4_T) |
struct b8_t_s { B4_T x,y; }; |
#define B8_T struct b8_t_s |
#endif |
|
#if defined(B8_T) |
struct b16_t_s { B8_T x,y; }; |
#define B16_T struct b16_t_s |
#endif |
|
|
#ifndef MAX_INT_TYPE |
# if defined (WITH_SHORT_INT) |
|
# define MAX_INT_TYPE SHRT_MAX |
# define MIN_INT_TYPE SHRT_MIN |
# define PRINTPIKEINT "h" |
|
# elif defined (WITH_INT_INT) |
|
# define MAX_INT_TYPE INT_MAX |
# define MIN_INT_TYPE INT_MIN |
# define PRINTPIKEINT "" |
|
# elif defined (WITH_LONG_INT) |
|
# define MAX_INT_TYPE LONG_MAX |
# define MIN_INT_TYPE LONG_MIN |
# define PRINTPIKEINT "l" |
|
# elif defined (WITH_LONG_LONG_INT) |
|
# ifdef LLONG_MAX |
# define MAX_INT_TYPE LLONG_MAX |
# define MIN_INT_TYPE LLONG_MIN |
# else |
# define MAX_INT_TYPE LONG_LONG_MAX |
# define MIN_INT_TYPE LONG_LONG_MIN |
# endif |
# define PRINTPIKEINT "ll" |
|
# endif |
#endif |
|
#if SIZEOF_INT_TYPE - 0 == 0 |
# error Unsupported type chosen for native pike integers. |
#endif |
|
#if SIZEOF_INT_TYPE != 4 |
# define INT_TYPE_INT32_CONVERSION |
#endif |
|
|
#if defined (WITH_LONG_DOUBLE_PRECISION_SVALUE) |
#define PRINTPIKEFLOAT "L" |
#elif defined (WITH_DOUBLE_PRECISION_SVALUE) |
#define PRINTPIKEFLOAT "" |
#else |
#define PRINTPIKEFLOAT "" |
#endif |
|
#if SIZEOF_FLOAT_TYPE - 0 == 0 |
#error Unsupported type chosen for pike floats. |
#endif |
|
typedef unsigned char p_wchar0; |
typedef unsigned INT16 p_wchar1; |
typedef unsigned INT32 p_wchar2; |
|
typedef struct p_wchar_p |
{ |
p_wchar0 *ptr; |
int shift; |
} PCHARP; |
|
#ifndef CONFIGURE_TEST |
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) |
#define RCSID(X) \ |
static char *rcsid __attribute__ ((unused)) =X |
#elif __GNUC__ == 2 |
#define RCSID(X) \ |
static char *rcsid = X; \ |
static void *use_rcsid=(&use_rcsid, (void *)&rcsid) |
#else |
#define RCSID(X) \ |
static char *rcsid = X |
#endif |
#else |
#define RCSID(X) |
#endif |
|
#ifdef PIKE_DEBUG |
#define DO_IF_DEBUG(X) X |
#else |
#define DO_IF_DEBUG(X) |
#define NDEBUG |
#endif |
|
#ifdef INTERNAL_PROFILING |
#define DO_IF_INTERNAL_PROFILING(X) X |
#else |
#define DO_IF_INTERNAL_PROFILING(X) |
#endif |
|
#if defined(__GNUC__) && !defined(PIKE_DEBUG) && !defined(lint) |
#define INLINE inline |
#else |
#define INLINE |
#endif |
|
|
|
|
#ifndef PMOD_EXPORT |
#ifdef __NT__ |
#ifdef DYNAMIC_MODULE |
#ifdef _M_IA64 |
|
#define PMOD_EXPORT __declspec(dllimport) |
#endif /* _M_IA64 */ |
#else /* !DYNAMIC_MODULE */ |
|
#endif /* DYNAMIC_MODULE */ |
#endif /* __NT__ */ |
#ifndef PMOD_EXPORT |
#define PMOD_EXPORT |
#endif /* !PMOD_EXPORT */ |
#endif /* !PMOD_EXPORT */ |
|
|
|
|
|
#ifndef PMOD_PROTO |
#define PMOD_PROTO |
#endif |
|
#if defined(PURIFY) || defined(__CHECKER__) || \ |
defined(DEBUG_MALLOC) || defined(USE_VALGRIND) |
#define DO_PIKE_CLEANUP |
#endif |
|
#ifdef PIKE_SECURITY |
#define DO_IF_SECURITY(X) X |
#else |
#define DO_IF_SECURITY(X) |
#endif |
|
|
#define DO_NOT_WARN(X) (X) |
|
|
#ifdef __ECL |
static inline long PTRDIFF_T_TO_LONG(ptrdiff_t x) |
{ |
return DO_NOT_WARN((long)x); |
} |
#else /* !__ECL */ |
#define PTRDIFF_T_TO_LONG(x) ((long)(x)) |
#endif /* __ECL */ |
|
#include "port.h" |
#include "dmalloc.h" |
#include "pike_cpulib.h" |
|
#ifdef BUFSIZ |
#define PROT_STDIO(x) PROT(x) |
#else |
#define PROT_STDIO(x) () |
#endif |
|
#ifdef __STDC__ |
#define PROT(x) x |
#else |
#define PROT(x) () |
#endif |
|
#ifdef MALLOC_DECL_MISSING |
char *malloc PROT((int)); |
char *realloc PROT((char *,int)); |
void free PROT((char *)); |
char *calloc PROT((int,int)); |
#endif |
|
#ifdef GETPEERNAME_DECL_MISSING |
int getpeername PROT((int, struct sockaddr *, int *)); |
#endif |
|
#ifdef GETHOSTNAME_DECL_MISSING |
void gethostname PROT((char *,int)); |
#endif |
|
#ifdef POPEN_DECL_MISSING |
FILE *popen PROT((char *,char *)); |
#endif |
|
#ifdef GETENV_DECL_MISSING |
char *getenv PROT((char *)); |
#endif |
|
#ifdef USE_CRYPT_C |
char *crypt(char *, char *); |
#endif /* USE_CRYPT_C */ |
|
|
|
|
|
#define Pike_error_present |
|
|
#define USE_PIKE_TYPE 2 |
|
#ifdef PIKE_RUN_UNLOCKED |
#define DO_IF_RUN_UNLOCKED(X) X |
#else |
#define DO_IF_RUN_UNLOCKED(X) |
#endif |
|
|
|
#if defined(PROFILING) && defined(HAVE_GETHRTIME) |
#define DO_IF_PROFILING(X) X |
#else |
#define DO_IF_PROFILING(X) |
#endif |
|
|
|
#endif |
|
|