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

  1. #ifndef __RWRSTREAM_H__
  2. #define __RWRSTREAM_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Includes either stream.h or iostream.h, depending
  7.  * on the compiler.
  8.  *
  9.  * $Header:   E:/vcs/rw/rstream.h_v   1.8   04 Mar 1992 10:20:22   KEFFER  $
  10.  *
  11.  ****************************************************************************
  12.  *
  13.  * Rogue Wave 
  14.  * P.O. Box 2328
  15.  * Corvallis, OR 97339
  16.  * Voice: (503) 754-3010    FAX: (503) 757-6650
  17.  *
  18.  * Copyright (C) 1989, 1990, 1991. This software is subject to copyright 
  19.  * protection under the laws of the United States and other countries.
  20.  *
  21.  ***************************************************************************
  22.  *
  23.  * $Log:   E:/vcs/rw/rstream.h_v  $
  24.  * 
  25.  *    Rev 1.8   04 Mar 1992 10:20:22   KEFFER
  26.  * Includes "rw/defs.h" instead of "rw/compiler.h"
  27.  * 
  28.  *    Rev 1.7   18 Feb 1992 09:54:36   KEFFER
  29.  * 
  30.  *    Rev 1.6   27 Oct 1991 17:39:06   keffer
  31.  * Corrected Glock inclusion of iostream.hxx
  32.  * 
  33.  *    Rev 1.5   17 Oct 1991 09:12:56   keffer
  34.  * Changed include path to <rw/xxx.h>
  35.  * 
  36.  *    Rev 1.3   24 Sep 1991 11:08:10   keffer
  37.  * Zortech now includes iostream.hpp; Glock iostream.hxx.
  38.  * 
  39.  *    Rev 1.2   08 Sep 1991 19:10:08   keffer
  40.  * Changed name of eatwhite() to rwEatwhite()
  41.  * 
  42.  *    Rev 1.1   24 Jul 1991 13:06:46   keffer
  43.  * Added pvcs keywords
  44.  *
  45.  */
  46.  
  47. #include "rw/defs.h"
  48.  
  49. #ifdef HAS_IOSTREAMS
  50. #  ifdef __ZTC__
  51. #    include <iostream.hpp>
  52. #  else
  53. #    ifdef __GLOCK__
  54. #      include <iostream.hxx>
  55. #    else
  56. #      include <iostream.h>
  57. #    endif
  58. #  endif
  59. #else
  60. #  ifdef __ZTC__
  61. #    include <stream.hpp>
  62. #    include <generic.hpp>
  63. #  else
  64. #    include <stream.h>
  65. #    include <generic.h>
  66. #  endif
  67. #endif
  68.  
  69. /*
  70.  * The macros OPENISTREAM and OPENOSTREAM are useful for opening a stream
  71.  * with either V1.2 or V2.X style streams.
  72.  *
  73.  * The function rwEatwhite(istream&) will eat whitespace for either V1.2 or
  74.  * V2.X style streams.
  75.  */
  76.  
  77. #ifdef HAS_IOSTREAMS
  78.  
  79. #  define OPENOSTREAM(filename, streamname)  ofstream streamname(filename);
  80. #  define OPENISTREAM(filename, streamname)  ifstream streamname(filename);
  81.    inline istream& rwEatwhite(istream& s) {return s >> ws;}
  82.  
  83. #else  /* Does not have iostreams */
  84.  
  85. #  define OPENOSTREAM(filename, streamname)    \
  86.    filebuf name2(fbuf,streamname);        \
  87.    name2(fbuf,streamname).open(filename,output);\
  88.    ostream streamname(&name2(fbuf,streamname));
  89. #  define OPENISTREAM(filename, streamname)    \
  90.    filebuf name2(fbuf,streamname);        \
  91.    name2(fbuf,streamname).open(filename,input);    \
  92.    istream streamname(&name2(fbuf,streamname));
  93.    inline istream& rwEatwhite(istream& s) {whitespace dumb; return s >> dumb;}
  94.  
  95. #endif    /* HAS_IOSTREAMS */
  96.  
  97. pragma pop_align_members();
  98. #endif /* __RWRSTREAM_H__ */
  99.