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