## 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 #ifndef PARAMS # if __STDC__ # ifndef NOPROTOS # define PARAMS(args) args # endif # endif # ifndef PARAMS # define PARAMS(args) () # endif #endif #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { # define END_C_DECLS } #else # define BEGIN_C_DECLS # define END_C_DECLS #endif #ifndef SIC_STMT_START # define SIC_STMT_START do # define SIC_STMT_END while (0) #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 typedef void* sic_ptr; #else #define STR(x) "x" #define CONC(x, y) x/**/y typedef char* sic_ptr; #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 #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) SIC_STMT_START { \ if (stale) { free ((sic_ptr) stale); stale = 0; } \ } SIC_STMT_END BEGIN_C_DECLS extern sic_ptr xcalloc PARAMS((size_t num, size_t size)); extern sic_ptr xmalloc PARAMS((size_t num)); extern sic_ptr xrealloc PARAMS((sic_ptr p, size_t num)); extern char *xstrdup PARAMS((const char *string)); END_C_DECLS #if WITH_DMALLOC # include #endif ## Local variables: ## mode: C ## End: