/* @(#)Copyright (c), 1987, 1996 StatSci, Inc.  All rights reserved. */
/* @(#)ansi_things.h version 3.5 created 6/13/96 */
/***
   NAME ansi_things
   PURPOSE
     Define some macros to give ANSI features when using an ANSI C &
     disable them otherwise.
   NOTES
     After including this, some macros to use:

     S_UsePrototypes - defined if we are allowed to specify ANSI C
         prototypes for function declarations.
     S_ANSI_LibC - defined if we have an ANSI-standard libc & support .h
         files (e.g. stdlib.h).     
     S_ANSI_Syntax - defined if we are allowed to use ANSI C syntactic
         items (e.g. the cpp # string-izing and ## token-pasting
         operators).
     S_begin_extern_c - to conditionally add 'extern "C" {' to the
         beginning of a block of extern declarations to tell C++ compilers
         that the externs are straight "C".
     S_end_extern_c - end the S_begin_extern_c block.
     PARAMS() - macro to conditionally include prototype args in a
         function declaration (e.g.
             extern int open PARAMS((char *filename, int mode));
         NOTE the double parens).

     LibImport - used to qualify declarations where the symbol is to be
         imported from a different DLL/library.
     LibExport - used to qualify declarations and definitions where the
         symbol is to be exported from the DLL/library containing the
         symbol.
***/
#ifndef ansi_thingsINCLUDED
#define ansi_thingsINCLUDED 1

#if (defined(_NO_PROTO) || defined(NoPrototypes)) && !defined(S_NoPrototypes) /*(*/
#define S_NoPrototypes
#endif /* ) _NO_PROTO */

#if defined(__STDC__) || defined(_MSC_VER) /*(*/
#ifndef S_ANSI_LibC    /*(*/
#define S_ANSI_LibC
#endif /* ) S_ANSI_LibC */

#ifndef S_ANSI_Syntax    /*(*/
#define S_ANSI_Syntax
#endif /* ) S_ANSI_Syntax */
#endif /* ) defined(__STDC__) || defined(_MSC_VER) */

#if defined(S_ANSI_LibC) /*(*/
/* NOTE: MS VC++ 4.0 (at least) gives you EITHER __STDC__ or the MS
   "extensions" like __cdecl, __declspec, et al.  We want BOTH. */
#include <stddef.h>
#include <stdlib.h>

#ifdef S_NoPrototypes  /*(*/
#undef S_UsePrototypes
#elif !defined(S_UsePrototypes) /*)(*/
#define S_UsePrototypes
#endif /* ) S_NoPrototypes */

#ifndef S_ANSI_Syntax
#define S_ANSI_Syntax
#endif
#endif /* ) S_ANSI_LibC */

#if defined(__cplusplus) || defined(c_plusplus)
#define S_begin_extern_c extern "C" {
#define S_end_extern_c }
#else
#define S_begin_extern_c
#define S_end_extern_c
#endif

#ifdef S_UsePrototypes /* ( */

/* Include a prototype in a function declaration:
 *    extern int foobar PARAMS((int, char *));
 *    extern int bloop  PARAMS((void));
 */
#define PARAMS(p) p

#define CONST const

#else /*)(*/

/* No prototypes available version. */
#define PARAMS(p) ()
#define CONST
#endif /*)*/

/* Allow for probable misspellings... */
#define PARMS PARAMS

/* Some Windows-y things. NOTE: This used to use WIN386 define, but
   cdefs.h (where that is defined) isn't necessarily included before this
   file. */
#if defined(__WINDOWS_386__) || defined(__NT__) || defined(_WIN32) /*(*/
#if defined(_MSC_VER) /*(*/
/* Microsoft Visual C++ */
#define LibImport __declspec(dllimport)
#define LibExport __declspec(dllexport)
#elif defined(__WATCOMC__) /*)(*/
/* Watcom C ??? */
#ifndef WINAPI
#define WINAPI FAR PASCAL
#endif
#define LibImport WINAPI
#define LibExport __export WINAPI
#endif /*) _MSC_VER / __WATCOMC__ */
#endif /* Windows */

#ifndef LibImport /*(*/
#define LibImport
#define LibExport
#endif /*)*/

#include <sccs.h>
SCCS_ID_C(ansi_thingsDotH,@(#)ansi_things.h 3.5 last edit 6/13/96 StatSci)

#endif /* ansi_thingsINCLUDED */
