michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* michael@0: * Copyright (c) 1991, 1993 michael@0: * The Regents of the University of California. All rights reserved. michael@0: * michael@0: * This code is derived from software contributed to Berkeley by michael@0: * Berkeley Software Design, Inc. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions michael@0: * are met: michael@0: * 1. Redistributions of source code must retain the above copyright michael@0: * notice, this list of conditions and the following disclaimer. michael@0: * 2. Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in the michael@0: * documentation and/or other materials provided with the distribution. michael@0: * 3. ***REMOVED*** - see michael@0: * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change michael@0: * 4. Neither the name of the University nor the names of its contributors michael@0: * may be used to endorse or promote products derived from this software michael@0: * without specific prior written permission. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND michael@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE michael@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL michael@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS michael@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) michael@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT michael@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY michael@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@0: * SUCH DAMAGE. michael@0: * michael@0: * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 michael@0: */ michael@0: michael@0: #ifndef _CDEFS_H_ michael@0: #define _CDEFS_H_ michael@0: michael@0: #if defined(__cplusplus) michael@0: #define __BEGIN_DECLS extern "C" { michael@0: #define __END_DECLS } michael@0: #else michael@0: #define __BEGIN_DECLS michael@0: #define __END_DECLS michael@0: #endif michael@0: michael@0: /* michael@0: * The __CONCAT macro is used to concatenate parts of symbol names, e.g. michael@0: * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. michael@0: * The __CONCAT macro is a bit tricky -- make sure you don't put spaces michael@0: * in between its arguments. __CONCAT can also concatenate double-quoted michael@0: * strings produced by the __STRING macro, but this only works with ANSI C. michael@0: */ michael@0: #if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2) michael@0: #define __P(protos) protos /* full-blown ANSI C */ michael@0: #define __CONCAT(x,y) x ## y michael@0: #define __STRING(x) #x michael@0: michael@0: /* On HP-UX 11.00, defines __const. */ michael@0: #ifndef __const michael@0: #define __const const /* define reserved names to standard */ michael@0: #endif /* __const */ michael@0: #define __signed signed michael@0: #define __volatile volatile michael@0: #ifndef _WINDOWS michael@0: #if defined(__cplusplus) michael@0: #define __inline inline /* convert to C++ keyword */ michael@0: #else michael@0: #if !defined(__GNUC__) && !defined(__MWERKS__) michael@0: #define __inline /* delete GCC keyword */ michael@0: #endif /* !__GNUC__ */ michael@0: #endif /* !__cplusplus */ michael@0: #endif /* !_WINDOWS */ michael@0: michael@0: #else /* !(__STDC__ || __cplusplus) */ michael@0: #define __P(protos) () /* traditional C preprocessor */ michael@0: #define __CONCAT(x,y) x/**/y michael@0: #define __STRING(x) "x" michael@0: michael@0: #ifndef __GNUC__ michael@0: #define __const /* delete pseudo-ANSI C keywords */ michael@0: #define __inline michael@0: #define __signed michael@0: #define __volatile michael@0: /* michael@0: * In non-ANSI C environments, new programs will want ANSI-only C keywords michael@0: * deleted from the program and old programs will want them left alone. michael@0: * When using a compiler other than gcc, programs using the ANSI C keywords michael@0: * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. michael@0: * When using "gcc -traditional", we assume that this is the intent; if michael@0: * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. michael@0: */ michael@0: #ifndef NO_ANSI_KEYWORDS michael@0: #define const /* delete ANSI C keywords */ michael@0: #define inline michael@0: #define signed michael@0: #define volatile michael@0: #endif michael@0: #endif /* !__GNUC__ */ michael@0: #endif /* !(__STDC__ || __cplusplus) */ michael@0: michael@0: /* michael@0: * GCC1 and some versions of GCC2 declare dead (non-returning) and michael@0: * pure (no side effects) functions using "volatile" and "const"; michael@0: * unfortunately, these then cause warnings under "-ansi -pedantic". michael@0: * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of michael@0: * these work for GNU C++ (modulo a slight glitch in the C++ grammar michael@0: * in the distribution version of 2.5.5). michael@0: */ michael@0: #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5 michael@0: #define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ michael@0: #if defined(__GNUC__) && !defined(__STRICT_ANSI__) michael@0: #define __dead __volatile michael@0: #define __pure __const michael@0: #endif michael@0: #endif michael@0: michael@0: /* Delete pseudo-keywords wherever they are not available or needed. */ michael@0: #ifndef __dead michael@0: #define __dead michael@0: #define __pure michael@0: #endif michael@0: michael@0: #endif /* !_CDEFS_H_ */