cb22561995-10-11Fredrik Hübinette (Hubbe) /*\
06983f1996-09-22Fredrik Hübinette (Hubbe) ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License)
cb22561995-10-11Fredrik Hübinette (Hubbe) ||| See the files COPYING and DISCLAIMER for more information. \*/
5267b71995-08-09Fredrik Hübinette (Hubbe) #ifndef GLOBAL_H #define GLOBAL_H
cb22561995-10-11Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) /* * Some structure forward declarations are needed. */ /* This is needed for linux */ #ifdef MALLOC_REPLACED #define NO_FIX_MALLOC #endif
211d6b1996-12-05Fredrik Hübinette (Hubbe) #ifndef STRUCT_PROGRAM_DECLARED #define STRUCT_PROGRAM_DECLARED
5267b71995-08-09Fredrik Hübinette (Hubbe) struct program;
211d6b1996-12-05Fredrik Hübinette (Hubbe) #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) struct function;
211d6b1996-12-05Fredrik Hübinette (Hubbe) #ifndef STRUCT_SVALUE_DECLARED #define STRUCT_SVALUE_DECLARED
5267b71995-08-09Fredrik Hübinette (Hubbe) struct svalue;
211d6b1996-12-05Fredrik Hübinette (Hubbe) #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) struct sockaddr; struct object; struct array; struct svalue;
cb22561995-10-11Fredrik Hübinette (Hubbe) #include "machine.h"
189fd01997-01-28Fredrik Hübinette (Hubbe)  /* * Max number of local variables in a function. * Currently there is no support for more than 256 */ #define MAX_LOCAL 256 /* * define NO_GC to get rid of garbage collection */ #ifndef NO_GC #define GC2 #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) 
75920f1997-12-28Fredrik Hübinette (Hubbe) #if defined(i386) #ifndef HANDLES_UNALIGNED_MEMORY_ACCESS #define HANDLES_UNALIGNED_MEMORY_ACCESS #endif #endif
cb22561995-10-11Fredrik Hübinette (Hubbe) /* AIX requires this to be the first thing in the file. */ #ifdef __GNUC__ # ifdef alloca # undef alloca # endif # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include <alloca.h> # else # ifdef _AIX
5c8e891995-10-29Fredrik Hübinette (Hubbe)  #pragma alloca
cb22561995-10-11Fredrik Hübinette (Hubbe) # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) #include <stdio.h> #ifdef HAVE_STDLIB_H #include <stdlib.h>
a4e1c41996-08-06Fredrik Hübinette (Hubbe) #undef HAVE_STDLIB_H
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif
75920f1997-12-28Fredrik Hübinette (Hubbe) #ifdef HAVE_MALLOC_H #include <malloc.h> #undef HAVE_MALLOC_H #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) #ifdef HAVE_UNISTD_H #include <unistd.h>
a4e1c41996-08-06Fredrik Hübinette (Hubbe) #undef HAVE_UNISTD_H
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif #ifdef HAVE_STRING_H #include <string.h>
a4e1c41996-08-06Fredrik Hübinette (Hubbe) #undef HAVE_STRING_H
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif
9aa6fa1997-05-19Fredrik Hübinette (Hubbe) #ifdef HAVE_LIMITS_H #include <limits.h> #undef HAVE_LIMITS_H
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif
9aa6fa1997-05-19Fredrik Hübinette (Hubbe) #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #undef HAVE_SYS_TYPES_H
419ede1996-11-13Fredrik Hübinette (Hubbe) #endif
9aa6fa1997-05-19Fredrik Hübinette (Hubbe) #ifdef HAVE_MEMORY_H #include <memory.h> #undef HAVE_MEMORY_H
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif
bed9601997-05-19Fredrik Hübinette (Hubbe) 
9aa6fa1997-05-19Fredrik Hübinette (Hubbe) /* we here define a few types with more defined values */
bed9601997-05-19Fredrik Hübinette (Hubbe)  #define INT64 long long #if SIZEOF_SHORT >= 4 #define INT32 short #else #if SIZEOF_INT >= 4 #define INT32 int #else #define INT32 long #endif #endif #define INT16 short #define INT8 char #define SIZE_T unsigned INT32 #define TYPE_T unsigned INT8 #define TYPE_FIELD unsigned INT16
673b2c1997-08-12Per Hedbor #define FLOAT_TYPE float
bed9601997-05-19Fredrik Hübinette (Hubbe) 
6d22541998-01-28Fredrik Hübinette (Hubbe) #define B1_T char
bed9601997-05-19Fredrik Hübinette (Hubbe) 
6d22541998-01-28Fredrik Hübinette (Hubbe) #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_CHAR_P == 8 #define B8_T char * #elif SIZEOF_DOUBLE == 8 #define B8_T double #elif defined(B4_T) struct b8_t_s { B4_T x,y; }; #define B8_T struct b8_t #endif #if SIZEOF_DOUBLE == 16 #define B16_T double #elif defined(B8_T) struct b16_t { B8_T x,y; }; #define B16_T struct b16_t #endif
9aa6fa1997-05-19Fredrik Hübinette (Hubbe)  #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
bed9601997-05-19Fredrik Hübinette (Hubbe) #endif
9aa6fa1997-05-19Fredrik Hübinette (Hubbe) #if defined(__GNUC__) && !defined(DEBUG) && !defined(lint) #define INLINE inline #else #define INLINE #endif
bed9601997-05-19Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) #include "port.h"
61e9a01998-01-25Fredrik Hübinette (Hubbe) #include "dmalloc.h"
5267b71995-08-09Fredrik Hübinette (Hubbe)  #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 #endif