home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / cdefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.8 KB  |  160 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /*
  20.  * Copyright (c) 1991, 1993
  21.  *    The Regents of the University of California.  All rights reserved.
  22.  *
  23.  * This code is derived from software contributed to Berkeley by
  24.  * Berkeley Software Design, Inc.
  25.  *
  26.  * Redistribution and use in source and binary forms, with or without
  27.  * modification, are permitted provided that the following conditions
  28.  * are met:
  29.  * 1. Redistributions of source code must retain the above copyright
  30.  *    notice, this list of conditions and the following disclaimer.
  31.  * 2. Redistributions in binary form must reproduce the above copyright
  32.  *    notice, this list of conditions and the following disclaimer in the
  33.  *    documentation and/or other materials provided with the distribution.
  34.  * 3. All advertising materials mentioning features or use of this software
  35.  *    must display the following acknowledgement:
  36.  *    This product includes software developed by the University of
  37.  *    California, Berkeley and its contributors.
  38.  * 4. Neither the name of the University nor the names of its contributors
  39.  *    may be used to endorse or promote products derived from this software
  40.  *    without specific prior written permission.
  41.  *
  42.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  43.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  44.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  45.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  46.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  47.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  48.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  49.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  50.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  51.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  52.  * SUCH DAMAGE.
  53.  *
  54.  *    @(#)cdefs.h    8.7 (Berkeley) 1/21/94
  55.  */
  56.  
  57. #ifndef    _CDEFS_H_
  58. #define    _CDEFS_H_
  59.  
  60. #ifdef __BEGIN_DECLS
  61. #undef __BEGIN_DECLS
  62. #endif
  63. #ifdef __END_DECLS
  64. #undef __END_DECLS
  65. #endif
  66.  
  67. #if defined(__cplusplus)
  68. #define    __BEGIN_DECLS    extern "C" {
  69. #define    __END_DECLS    }
  70. #else
  71. #define    __BEGIN_DECLS
  72. #define    __END_DECLS
  73. #endif
  74.  
  75. /*
  76.  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
  77.  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
  78.  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
  79.  * in between its arguments.  __CONCAT can also concatenate double-quoted
  80.  * strings produced by the __STRING macro, but this only works with ANSI C.
  81.  */
  82. #undef __P
  83. #undef __CONCAT
  84. #undef __STRING
  85.  
  86. #if defined(__STDC__) || defined(__cplusplus) || defined(_WINDOWS) || defined(XP_OS2)
  87. #define    __P(protos)    protos        /* full-blown ANSI C */
  88. #define    __CONCAT(x,y)    x ## y
  89. #define    __STRING(x)    #x
  90.  
  91. #define    __const        const        /* define reserved names to standard */
  92. #define    __signed    signed
  93. #define    __volatile    volatile
  94. #ifndef _WINDOWS
  95. #if defined(__cplusplus)
  96. #define    __inline    inline        /* convert to C++ keyword */
  97. #else
  98. #ifndef __GNUC__
  99. #define    __inline            /* delete GCC keyword */
  100. #endif /* !__GNUC__ */
  101. #endif /* !__cplusplus */
  102. #endif /* !_WINDOWS */
  103.  
  104. #else    /* !(__STDC__ || __cplusplus) */
  105. #define    __P(protos)    ()        /* traditional C preprocessor */
  106. #define    __CONCAT(x,y)    x/**/y
  107. #define    __STRING(x)    "x"
  108.  
  109. #ifndef __GNUC__
  110. #define    __const                /* delete pseudo-ANSI C keywords */
  111. #define    __inline
  112. #define    __signed
  113. #define    __volatile
  114. /*
  115.  * In non-ANSI C environments, new programs will want ANSI-only C keywords
  116.  * deleted from the program and old programs will want them left alone.
  117.  * When using a compiler other than gcc, programs using the ANSI C keywords
  118.  * inline, signed etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
  119.  * When using "gcc -traditional", we assume that this is the intent; if
  120.  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
  121.  */
  122. #ifndef    NO_ANSI_KEYWORDS
  123. #define    inline                /* delete ANSI C keywords */
  124. #define    signed
  125. #define    volatile
  126. #endif
  127. #endif    /* !__GNUC__ */
  128. #endif    /* !(__STDC__ || __cplusplus) */
  129.  
  130. /*
  131.  * GCC1 and some versions of GCC2 declare dead (non-returning) and
  132.  * pure (no side effects) functions using "volatile" and "const";
  133.  * unfortunately, these then cause warnings under "-ansi -pedantic".
  134.  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
  135.  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
  136.  * in the distribution version of 2.5.5).
  137.  */
  138. #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
  139. #define    __attribute__(x)    /* delete __attribute__ if non-gcc or gcc1 */
  140. #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  141. #define    __dead        __volatile
  142. #define    __pure        __const
  143. #endif
  144. #endif
  145.  
  146. /* Delete pseudo-keywords wherever they are not available or needed. */
  147. #ifndef __dead
  148. #define    __dead
  149. #define    __pure
  150. #endif
  151.  
  152. #ifdef AIXV3
  153. /* Wont compile without const. Need a cleaner way to handle this. */
  154. #ifdef const
  155. #undef const
  156. #endif
  157. #endif
  158.  
  159. #endif /* !_CDEFS_H_ */
  160.