Back to index

lightning-sunbird  0.9+nobinonly
cdefs.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Netscape Public License
00006  * Version 1.1 (the "License"); you may not use this file except in
00007  * compliance with the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/NPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is 
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the NPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the NPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 /*
00040  * Copyright (c) 1991, 1993
00041  *     The Regents of the University of California.  All rights reserved.
00042  *
00043  * This code is derived from software contributed to Berkeley by
00044  * Berkeley Software Design, Inc.
00045  *
00046  * Redistribution and use in source and binary forms, with or without
00047  * modification, are permitted provided that the following conditions
00048  * are met:
00049  * 1. Redistributions of source code must retain the above copyright
00050  *    notice, this list of conditions and the following disclaimer.
00051  * 2. Redistributions in binary form must reproduce the above copyright
00052  *    notice, this list of conditions and the following disclaimer in the
00053  *    documentation and/or other materials provided with the distribution.
00054  * 3. All advertising materials mentioning features or use of this software
00055  *    must display the following acknowledgement:
00056  *     This product includes software developed by the University of
00057  *     California, Berkeley and its contributors.
00058  * 4. Neither the name of the University nor the names of its contributors
00059  *    may be used to endorse or promote products derived from this software
00060  *    without specific prior written permission.
00061  *
00062  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00063  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00064  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00065  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00066  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00067  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00068  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00069  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00070  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00071  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00072  * SUCH DAMAGE.
00073  *
00074  *     @(#)cdefs.h   8.7 (Berkeley) 1/21/94
00075  */
00076 
00077 #ifndef       _CDEFS_H_
00078 #define       _CDEFS_H_
00079 
00080 #if defined(__cplusplus)
00081 #define       __BEGIN_DECLS extern "C" {
00082 #define       __END_DECLS   }
00083 #else
00084 #define       __BEGIN_DECLS
00085 #define       __END_DECLS
00086 #endif
00087 
00088 /*
00089  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
00090  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
00091  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
00092  * in between its arguments.  __CONCAT can also concatenate double-quoted
00093  * strings produced by the __STRING macro, but this only works with ANSI C.
00094  */
00095 #if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2)
00096 #define       __P(protos)   protos        /* full-blown ANSI C */
00097 #define       __CONCAT(x,y) x ## y
00098 #define       __STRING(x)   #x
00099 
00100 /* On HP-UX 11.00, <sys/stdsyms.h> defines __const. */
00101 #ifndef __const
00102 #define       __const              const         /* define reserved names to standard */
00103 #endif  /* __const */
00104 #define       __signed      signed
00105 #define       __volatile    volatile
00106 #ifndef _WINDOWS
00107 #if defined(__cplusplus)
00108 #define       __inline      inline        /* convert to C++ keyword */
00109 #else
00110 #if !defined(__GNUC__) && !defined(__MWERKS__)
00111 #define       __inline                    /* delete GCC keyword */
00112 #endif /* !__GNUC__ */
00113 #endif /* !__cplusplus */
00114 #endif /* !_WINDOWS */
00115 
00116 #else  /* !(__STDC__ || __cplusplus) */
00117 #define       __P(protos)   ()            /* traditional C preprocessor */
00118 #define       __CONCAT(x,y) xy
00119 #define       __STRING(x)   "x"
00120 
00121 #ifndef __GNUC__
00122 #define       __const                            /* delete pseudo-ANSI C keywords */
00123 #define       __inline
00124 #define       __signed
00125 #define       __volatile
00126 /*
00127  * In non-ANSI C environments, new programs will want ANSI-only C keywords
00128  * deleted from the program and old programs will want them left alone.
00129  * When using a compiler other than gcc, programs using the ANSI C keywords
00130  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
00131  * When using "gcc -traditional", we assume that this is the intent; if
00132  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
00133  */
00134 #ifndef       NO_ANSI_KEYWORDS
00135 #define       const                       /* delete ANSI C keywords */
00136 #define       inline
00137 #define       signed
00138 #define       volatile
00139 #endif
00140 #endif /* !__GNUC__ */
00141 #endif /* !(__STDC__ || __cplusplus) */
00142 
00143 /*
00144  * GCC1 and some versions of GCC2 declare dead (non-returning) and
00145  * pure (no side effects) functions using "volatile" and "const";
00146  * unfortunately, these then cause warnings under "-ansi -pedantic".
00147  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
00148  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
00149  * in the distribution version of 2.5.5).
00150  */
00151 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
00152 #define       __attribute__(x)     /* delete __attribute__ if non-gcc or gcc1 */
00153 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
00154 #define       __dead        __volatile
00155 #define       __pure        __const
00156 #endif
00157 #endif
00158 
00159 /* Delete pseudo-keywords wherever they are not available or needed. */
00160 #ifndef __dead
00161 #define       __dead
00162 #define       __pure
00163 #endif
00164 
00165 #endif /* !_CDEFS_H_ */