## common-h.in -- Process this file with configure to produce common.h ## Copyright (C) 2000 Gary V. Vaughan ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #if defined __CYGWIN32__ && !defined __CYGWIN__ # define __CYGWIN__ __CYGWIN32__ #endif #if defined __CYGWIN__ && !defined WIN32 # define WIN32 #endif #ifndef WIFEXITED # define WIFEXITED(stat) (((stat) & 0xff) == 0) #endif #ifndef WEXITSTATUS # define WEXITSTATUS(stat) ((unsigned)(stat) >> 8) #endif #ifndef WIFSTOPPED # define WIFSTOPPED(stat) (((stat) & 0xff) == 0x7f) #endif #ifndef WSTOPSIG # define WSTOPSIG(stat) WEXITSTATUS(stat) #endif #ifndef WIFSIGNALED # define WIFSIGNALED(stat) (!WIFEXITED(stat) && !WIFSTOPPED(stat)) #endif #ifndef WTERMSIG # define WTERMSIG(stat) ((stat) & 0x7f) #endif #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { # define END_C_DECLS } #else # define BEGIN_C_DECLS # define END_C_DECLS #endif #ifdef __GNUC__ # ifndef const # define const __const # endif # ifndef signed # define signed __signed # endif # ifndef volatile # define volatile __volatile # endif #else # ifdef __STDC__ # undef signed # define signed # undef volatile # define volatile # endif #endif #ifdef __STDC__ #define STR(x) #x #define CONC(x, y) x##y #else #define STR(x) "x" #define CONC(x, y) x/**/y #endif /* If FALSE is defined, we presume TRUE is defined too. In this case, merely typedef boolean as being int. Or else, define these all. */ #ifndef FALSE /* Do not use `enum boolean': this tag is used in SVR4 . */ typedef enum { FALSE = 0, TRUE = 1 } myboolean; #else typedef int myboolean; #endif #ifndef boolean # define boolean myboolean #endif #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # define EXIT_FAILURE 1 #endif ## @start 1 BEGIN_C_DECLS #define XCALLOC(type, num) \ ((type *) xcalloc ((num), sizeof(type))) #define XMALLOC(type, num) \ ((type *) xmalloc ((num) * sizeof(type))) #define XREALLOC(type, p, num) \ ((type *) xrealloc ((p), (num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) extern void *xcalloc (size_t num, size_t size); extern void *xmalloc (size_t num); extern void *xrealloc (void *p, size_t num); extern char *xstrdup (const char *string); END_C_DECLS #if WITH_DMALLOC # include #endif ## @end 1 ## Local variables: ## mode: C ## End: