home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 6.ddi / MWHC.006 / Z0 < prev    next >
Encoding:
Text File  |  1992-06-07  |  6.1 KB  |  209 lines

  1. #ifndef __RWDEFS_H__
  2. #define __RWDEFS_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Common definitions
  7.  *
  8.  * $Header:   E:/vcs/rw/defs.h_v   1.9   18 Mar 1992 10:31:44   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave 
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  * Voice: (503) 754-3010    FAX: (503) 757-6650
  16.  *
  17.  * Copyright (C) 1989, 1990, 1991. This software is subject to copyright 
  18.  * protection under the laws of the United States and other countries.
  19.  *
  20.  ***************************************************************************
  21.  *
  22.  * $Log:   E:/vcs/rw/defs.h_v  $
  23.  * 
  24.  *    Rev 1.9   18 Mar 1992 10:31:44   KEFFER
  25.  * 
  26.  *    Rev 1.8   17 Mar 1992 19:21:10   KEFFER
  27.  * Changed BOUNDS_CHECK to RWBOUNDS_CHECK
  28.  * 
  29.  *    Rev 1.7   17 Mar 1992 11:35:22   KEFFER
  30.  * Introduced rwnil, RWPRECONDITION, RWPOSTCONDITION, RWDEBUG.
  31.  * MS-DOS hacks now done here instead of compiler.h.
  32.  * 
  33.  *    Rev 1.6   21 Feb 1992 12:30:36   KEFFER
  34.  * Debug flag is now "RWDEBUG" instead of "DEBUG".
  35.  * 
  36.  *    Rev 1.5   12 Nov 1991 13:14:14   keffer
  37.  * Added _RWCLASSTYPE modifier.
  38.  * 
  39.  *    Rev 1.4   17 Oct 1991 09:12:44   keffer
  40.  * Changed include path to <rw/xxx.h>
  41.  * 
  42.  *    Rev 1.2   27 Jul 1991 21:27:38   keffer
  43.  * No longer includes <stddef.h>.  Other changes allow it to be used in C files.
  44.  * 
  45.  *    Rev 1.1   24 Jul 1991 13:06:42   keffer
  46.  * Added pvcs keywords
  47.  *
  48.  */
  49.  
  50. /* Set compiler-specific flags: */
  51. #include "rw/compiler.h"
  52.  
  53. /*
  54.  * In rare instances, the following few lines may have to be reworked
  55.  * to deal with naming conflicts.
  56.  */
  57.  
  58. #ifndef TRUE
  59. #  define TRUE  1
  60. #  define FALSE 0
  61. #endif
  62.  
  63. typedef int RWBoolean;
  64. #define rwnil    0
  65. #define    RWNIL    -1L
  66.  
  67. /* The following group of lines can be removed if they cause naming conflicts: */
  68. #define Boolean    RWBoolean
  69. #define NIL    RWNIL
  70. #define PRECONDITION(a) RWPRECONDITION(a)    /* For backwards portability */
  71. #define POSTCONDITION(a) RWPOSTCONDITION(a)
  72. #if defined(BOUNDS_CHECK) && !defined(RWBOUNDS_CHECK)
  73. #  define RWBOUNDS_CHECK 1            /* For backwards portability */
  74. #endif
  75.  
  76. /*************************************************************************
  77. **************************************************************************
  78. **                                    **
  79. **        From here on, it's pretty much boilerplate        **
  80. **        and rarely requires any tuning.                **
  81. **                                    **
  82. **************************************************************************
  83. **************************************************************************/
  84.  
  85. /*
  86.  *     D E B U G G I N G
  87.  *
  88.  * Use -DRWDEBUG to compile a version of the libraries to debug
  89.  * the user's code.  This will perform pre- and post-condition checks
  90.  * upon entering routines, but will be larger and run more slowly.
  91.  *
  92.  * VERY IMPORTANT!  *All* code must be compiled with the same flag.
  93.  */
  94.  
  95. #if defined(RDEBUG) && !defined(RWDEBUG)
  96. #  define RWDEBUG 1
  97. #endif
  98.  
  99. #if defined(RWDEBUG)
  100. #  ifndef RWBOUNDS_CHECK
  101. #    define RWBOUNDS_CHECK 1    /* Turn on bounds checking when debugging. */
  102. #  endif
  103. STARTWRAP
  104. #  include <assert.h>
  105. ENDWRAP
  106. #  define RWPRECONDITION(a)  assert(a)    /* Check pre- and post-conditions */
  107. #  define RWPOSTCONDITION(a) assert(a)
  108. #  if defined(__ATT2__) || defined(__TURBOC__)
  109. #    define Inline inline
  110. #  else
  111. #    define Inline static
  112. #  endif
  113. #else
  114. #  define RWPRECONDITION(a)  ((void)0)
  115. #  define RWPOSTCONDITION(a) ((void)0)
  116. #  define Inline inline
  117. #endif
  118.  
  119. /*
  120.  *     W I N D O W S - S P E C I F I C   C O D E
  121.  *
  122.  * Enable or disable, as necessary, for Microsoft Windows
  123.  */
  124. #if defined(_Windows) || defined(_WINDOWS)
  125. #  include "rw/rwwind.h"
  126. #else
  127.    /* Disable Windows hacks if we are not compiling for Windows: */
  128. #  define RWExport
  129. #  define rwexport
  130. #  define _RWCLASSTYPE
  131. #endif
  132.  
  133. /* No RCS for MS-DOS (it has enough memory problems already!): */
  134. #ifdef __MSDOS__
  135. #define RCSID(a)
  136. #else
  137. #define RCSID(a) static char rcsid[] = a
  138. #endif
  139.  
  140. /* Disable near/far pointers if we are not using 8086 architecture: */
  141. #if !defined(__MSDOS__) && !defined(I8086)
  142. #  define near
  143. #  define far
  144. #  define huge
  145. #endif
  146.  
  147. typedef unsigned short    ClassID;    /* Class ID tag. */
  148. typedef unsigned char    RWByte;        /* Bitflag atomics. */
  149. typedef int        fileDescTy;    /* Type of file descriptors */
  150. typedef unsigned short    RWErrNo;    /* Error number */
  151.  
  152. #ifdef __cplusplus
  153.  
  154. /*
  155.  *   C + +   S P E C I F I C   D E F I N I T I O N S
  156.  */
  157.  
  158. enum RWSeverity {RWWARNING, RWDEFAULT, RWFATAL};
  159.  
  160. #if defined(HAS_IOSTREAMS) && !defined(NL)
  161. #  define NL        endl
  162. #else
  163. #  define NL        "\n"
  164. #endif
  165.  
  166. static const short    STASHSIZE          = 10;    /* Small object pool size */
  167. static const unsigned RWDEFAULT_CAPACITY = 64;    /* Default collection class capacity */
  168. static const unsigned RWDEFAULT_RESIZE   = 64;    /* Default collection class resize */
  169. static const RWErrNo  RWSUCCESS             = 0;
  170.  
  171. inline double    rwmax(double a, double b)    {return a>b? a : b;}
  172. inline double    rwmin(double a, double b)     {return a<b? a : b;}
  173. inline int    rwmax(int a, int b)        {return a>b? a : b;}
  174. inline int    rwmin(int a, int b)        {return a<b? a : b;}
  175. inline unsigned    rwmax(unsigned a, unsigned b)    {return a>b? a : b;}
  176. inline unsigned    rwmin(unsigned a, unsigned b)    {return a<b? a : b;}
  177.  
  178. class _RWCLASSTYPE istream;
  179. class _RWCLASSTYPE ostream;
  180. class RWExport RWvistream;
  181. class RWExport RWvostream;
  182. class RWExport RWFile;
  183. class RWExport RWErrObject;
  184. void rwexport RWThrow(RWErrObject a ...);    /* Raise an exception/error */
  185. /*  For backwards compatibility: */
  186. void RWError(RWSeverity, const char*, const char*);
  187.  
  188. /*
  189.  * Class ID definitions for Core.h++ classes:
  190.  */
  191. #define __GLOBAL                        0xf000
  192. #define __RWBISTREAM            0xf001
  193. #define __RWBOSTREAM            0xf002
  194. #define __RWCLIPSTREAMBUF        0xf003
  195. #define __RWDDESTREAMBUF        0xf004
  196. #define __RWERROBJECT            0xf005
  197. #define __RWFIXEDMEMORY            0xf006
  198. #define __RWPISTREAM                    0xf007
  199. #define __RWPOSTREAM                    0xf008
  200. #define __RWVISTREAM            0xf009
  201. #define __RWVOSTREAM            0xf00a
  202. /* For historical reasons: */
  203. #define __RWFILE                        0x8020
  204.  
  205. #endif /* if C++ */
  206.  
  207. pragma pop_align_members();
  208. #endif /* __RWDEFS_H__ */
  209.