home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RWDEFS_H__
- #define __RWDEFS_H__
- pragma push_align_members(64);
-
- /*
- * Common definitions
- *
- * $Header: E:/vcs/rw/defs.h_v 1.9 18 Mar 1992 10:31:44 KEFFER $
- *
- ****************************************************************************
- *
- * Rogue Wave
- * P.O. Box 2328
- * Corvallis, OR 97339
- * Voice: (503) 754-3010 FAX: (503) 757-6650
- *
- * Copyright (C) 1989, 1990, 1991. This software is subject to copyright
- * protection under the laws of the United States and other countries.
- *
- ***************************************************************************
- *
- * $Log: E:/vcs/rw/defs.h_v $
- *
- * Rev 1.9 18 Mar 1992 10:31:44 KEFFER
- *
- * Rev 1.8 17 Mar 1992 19:21:10 KEFFER
- * Changed BOUNDS_CHECK to RWBOUNDS_CHECK
- *
- * Rev 1.7 17 Mar 1992 11:35:22 KEFFER
- * Introduced rwnil, RWPRECONDITION, RWPOSTCONDITION, RWDEBUG.
- * MS-DOS hacks now done here instead of compiler.h.
- *
- * Rev 1.6 21 Feb 1992 12:30:36 KEFFER
- * Debug flag is now "RWDEBUG" instead of "DEBUG".
- *
- * Rev 1.5 12 Nov 1991 13:14:14 keffer
- * Added _RWCLASSTYPE modifier.
- *
- * Rev 1.4 17 Oct 1991 09:12:44 keffer
- * Changed include path to <rw/xxx.h>
- *
- * Rev 1.2 27 Jul 1991 21:27:38 keffer
- * No longer includes <stddef.h>. Other changes allow it to be used in C files.
- *
- * Rev 1.1 24 Jul 1991 13:06:42 keffer
- * Added pvcs keywords
- *
- */
-
- /* Set compiler-specific flags: */
- #include "rw/compiler.h"
-
- /*
- * In rare instances, the following few lines may have to be reworked
- * to deal with naming conflicts.
- */
-
- #ifndef TRUE
- # define TRUE 1
- # define FALSE 0
- #endif
-
- typedef int RWBoolean;
- #define rwnil 0
- #define RWNIL -1L
-
- /* The following group of lines can be removed if they cause naming conflicts: */
- #define Boolean RWBoolean
- #define NIL RWNIL
- #define PRECONDITION(a) RWPRECONDITION(a) /* For backwards portability */
- #define POSTCONDITION(a) RWPOSTCONDITION(a)
- #if defined(BOUNDS_CHECK) && !defined(RWBOUNDS_CHECK)
- # define RWBOUNDS_CHECK 1 /* For backwards portability */
- #endif
-
- /*************************************************************************
- **************************************************************************
- ** **
- ** From here on, it's pretty much boilerplate **
- ** and rarely requires any tuning. **
- ** **
- **************************************************************************
- **************************************************************************/
-
- /*
- * D E B U G G I N G
- *
- * Use -DRWDEBUG to compile a version of the libraries to debug
- * the user's code. This will perform pre- and post-condition checks
- * upon entering routines, but will be larger and run more slowly.
- *
- * VERY IMPORTANT! *All* code must be compiled with the same flag.
- */
-
- #if defined(RDEBUG) && !defined(RWDEBUG)
- # define RWDEBUG 1
- #endif
-
- #if defined(RWDEBUG)
- # ifndef RWBOUNDS_CHECK
- # define RWBOUNDS_CHECK 1 /* Turn on bounds checking when debugging. */
- # endif
- STARTWRAP
- # include <assert.h>
- ENDWRAP
- # define RWPRECONDITION(a) assert(a) /* Check pre- and post-conditions */
- # define RWPOSTCONDITION(a) assert(a)
- # if defined(__ATT2__) || defined(__TURBOC__)
- # define Inline inline
- # else
- # define Inline static
- # endif
- #else
- # define RWPRECONDITION(a) ((void)0)
- # define RWPOSTCONDITION(a) ((void)0)
- # define Inline inline
- #endif
-
- /*
- * W I N D O W S - S P E C I F I C C O D E
- *
- * Enable or disable, as necessary, for Microsoft Windows
- */
- #if defined(_Windows) || defined(_WINDOWS)
- # include "rw/rwwind.h"
- #else
- /* Disable Windows hacks if we are not compiling for Windows: */
- # define RWExport
- # define rwexport
- # define _RWCLASSTYPE
- #endif
-
- /* No RCS for MS-DOS (it has enough memory problems already!): */
- #ifdef __MSDOS__
- #define RCSID(a)
- #else
- #define RCSID(a) static char rcsid[] = a
- #endif
-
- /* Disable near/far pointers if we are not using 8086 architecture: */
- #if !defined(__MSDOS__) && !defined(I8086)
- # define near
- # define far
- # define huge
- #endif
-
- typedef unsigned short ClassID; /* Class ID tag. */
- typedef unsigned char RWByte; /* Bitflag atomics. */
- typedef int fileDescTy; /* Type of file descriptors */
- typedef unsigned short RWErrNo; /* Error number */
-
- #ifdef __cplusplus
-
- /*
- * C + + S P E C I F I C D E F I N I T I O N S
- */
-
- enum RWSeverity {RWWARNING, RWDEFAULT, RWFATAL};
-
- #if defined(HAS_IOSTREAMS) && !defined(NL)
- # define NL endl
- #else
- # define NL "\n"
- #endif
-
- static const short STASHSIZE = 10; /* Small object pool size */
- static const unsigned RWDEFAULT_CAPACITY = 64; /* Default collection class capacity */
- static const unsigned RWDEFAULT_RESIZE = 64; /* Default collection class resize */
- static const RWErrNo RWSUCCESS = 0;
-
- inline double rwmax(double a, double b) {return a>b? a : b;}
- inline double rwmin(double a, double b) {return a<b? a : b;}
- inline int rwmax(int a, int b) {return a>b? a : b;}
- inline int rwmin(int a, int b) {return a<b? a : b;}
- inline unsigned rwmax(unsigned a, unsigned b) {return a>b? a : b;}
- inline unsigned rwmin(unsigned a, unsigned b) {return a<b? a : b;}
-
- class _RWCLASSTYPE istream;
- class _RWCLASSTYPE ostream;
- class RWExport RWvistream;
- class RWExport RWvostream;
- class RWExport RWFile;
- class RWExport RWErrObject;
- void rwexport RWThrow(RWErrObject a ...); /* Raise an exception/error */
- /* For backwards compatibility: */
- void RWError(RWSeverity, const char*, const char*);
-
- /*
- * Class ID definitions for Core.h++ classes:
- */
- #define __GLOBAL 0xf000
- #define __RWBISTREAM 0xf001
- #define __RWBOSTREAM 0xf002
- #define __RWCLIPSTREAMBUF 0xf003
- #define __RWDDESTREAMBUF 0xf004
- #define __RWERROBJECT 0xf005
- #define __RWFIXEDMEMORY 0xf006
- #define __RWPISTREAM 0xf007
- #define __RWPOSTREAM 0xf008
- #define __RWVISTREAM 0xf009
- #define __RWVOSTREAM 0xf00a
- /* For historical reasons: */
- #define __RWFILE 0x8020
-
- #endif /* if C++ */
-
- pragma pop_align_members();
- #endif /* __RWDEFS_H__ */
-