home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iostream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-16  |  34.3 KB  |  858 lines

  1. #pragma info( none )
  2. #ifndef __CHKHDR__
  3.    #pragma info( none )
  4. #endif
  5. #pragma info( restore )
  6.  
  7. #ifndef __iostream_h
  8.    #define __iostream_h
  9.  
  10.    /********************************************************************/
  11.    /*  <iostream.h> header file                                        */
  12.    /*                                                                  */
  13.    /*  VisualAge for C++ for Windows, Version 3.5                      */
  14.    /*    Licensed Material - Property of IBM                           */
  15.    /*                                                                  */
  16.    /*  5801-ARR and Other Materials                                    */
  17.    /*                                                                  */
  18.    /*  (c) Copyright IBM Corp 1991, 1996. All rights reserved.         */
  19.    /*                                                                  */
  20.    /*                                                                  */
  21.    /*                                                                  */
  22.    /*  Licensed Materials - Property of USL                            */
  23.    /*                                                                  */
  24.    /*  Standard Class Library Version 3.0                              */
  25.    /*  Copyright (C) Unix System Laboratories Inc. 1991.               */
  26.    /*  All rights reserved                                             */
  27.    /*                                                                  */
  28.    /********************************************************************/
  29.  
  30.    /**************************************************************************/
  31.    /*  C++ source for the C++ Language System, Release 3.0.  This product    */
  32.    /*  is a new release of the original cfront developed in the computer     */
  33.    /*  science research center of AT&T Bell Laboratories.                    */
  34.    /*                                                                        */
  35.    /*  Copyright (c) 1991 AT&T and UNIX System Laboratories, Inc.            */
  36.    /*  Copyright (c) 1984, 1989, 1990 AT&T.  All Rights Reserved.            */
  37.    /*                                                                        */
  38.    /*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of AT&T and UNIX System   */
  39.    /*  Laboratories, Inc.  The copyright notice above does not evidence      */
  40.    /*  any actual or intended publication of such source code.               */
  41.    /*                                                                        */
  42.    /*  UNIX is a registered trademark of UNIX System Laboratories, Inc.      */
  43.    /*                                                                        */
  44.    /*  ident "@(#)ctrans:incl-master/const-headers/iostream.h        1.11"   */
  45.    /**************************************************************************/
  46.  
  47.    #ifndef _IMPORT
  48.       #ifdef __IMPORTLIB__
  49.          #define _IMPORT _Import
  50.       #else
  51.          #define _IMPORT
  52.       #endif
  53.    #endif
  54.  
  55.    #include <string.h>
  56.                    /* Some inlines use memcpy */
  57.  
  58.    #pragma pack(4)
  59.  
  60.    /* If EOF is defined already verify that it is -1.  Otherwise
  61.     * define it.
  62.     */
  63.  
  64.    #ifdef EOF
  65.    #       if EOF!=-1
  66.    #               define EOF (-1)
  67.    #       endif
  68.    #else
  69.    #       define EOF (-1)
  70.    #endif
  71.  
  72.    /* Don't worry about NULL not being 0 */
  73.    #ifndef NULL
  74.    #       define NULL 0
  75.    #endif
  76.  
  77.    #define zapeof(c) ((unsigned char)(c))
  78.                /* extracts char from c. The critical requirement is
  79.                 *      zapeof(EOF)!=EOF
  80.                 * ((c)&0377) and ((unsigned char)(c)) are alternative definitions
  81.                 * whose efficiency depends on compiler environment.
  82.                 */
  83.  
  84.    typedef long streampos ;
  85.    typedef long streamoff ;
  86.  
  87.    class _IMPORT streambuf ;
  88.    class _IMPORT ostream ;
  89.    union ios_user_union;
  90.  
  91.  
  92.    class _IMPORT ios {
  93.    public: /* Some enums are declared in ios to avoid pollution of
  94.             * global namespace
  95.             */
  96.            enum io_state   { goodbit=0, eofbit=1, failbit=2, badbit=4,
  97.                                    hardfail=0200};
  98.                                    /* hard fail can be set and reset internally,
  99.                                     * but not via public function */
  100.            enum open_mode  { in=1, out=2, ate=4, app=010, trunc=020,
  101.                                    nocreate=040, noreplace=0100, bin=0200,
  102.                                    binary=bin   /* OS2 specific */
  103.                                    } ;
  104.            enum seek_dir   { beg=0, cur=1, end=2 } ;
  105.  
  106.            /* flags for controlling format */
  107.            enum            { skipws=01,
  108.                                            /* skip whitespace on input */
  109.                              left=02,  right=04, internal=010,
  110.                                            /* padding location */
  111.                              dec=020, oct=040, hex=0100,
  112.                                            /* conversion base */
  113.                              showbase=0200, showpoint=0400, uppercase=01000,
  114.                              showpos=02000,
  115.                                            /* modifiers */
  116.                              scientific=04000, fixed=010000,
  117.                                            /* floating point notation */
  118.                              unitbuf=020000, stdio=040000
  119.                                            /* stuff to control flushing */
  120.                              } ;
  121.            static const long
  122.                            basefield ; /* dec|oct|hex */
  123.            static const long
  124.                            adjustfield ; /* left|right|internal */
  125.            static const long
  126.                            floatfield ; /* scientific|fixed */
  127.    public:
  128.                            ios(streambuf*) ;
  129.            virtual         ~ios() ;
  130.  
  131.            long            flags() const   { return x_flags ; }
  132.            long            flags(long f);
  133.  
  134.            long            setf(long setbits, long field);
  135.            long            setf(long) ;
  136.            long            unsetf(long) ;
  137.  
  138.            int             width() const   { return x_width ; }
  139.            int             width(int w)
  140.            {
  141.                            int i = x_width ; x_width = w ; return i ;
  142.            }
  143.  
  144.            ostream*        tie(ostream* s);
  145.            ostream*        tie()           { return x_tie ; }
  146.            char            fill(char) ;
  147.            char            fill() const    { return x_fill ; }
  148.            int             precision(int) ;
  149.            int             precision() const       { return x_precision ; }
  150.  
  151.            int             rdstate() const { return state ; }
  152.                            operator void*()
  153.                                    {
  154.                                    if (state&(failbit|badbit|hardfail)) return 0 ;
  155.                                    else return this ;
  156.                                    }
  157.                            operator const void*() const
  158.                                    {
  159.                                    if (state&(failbit|badbit|hardfail)) return 0 ;
  160.                                    else return this ;
  161.                                    }
  162.  
  163.            int             operator!() const
  164.                                    { return state&(failbit|badbit|hardfail); }
  165.            int             eof() const     { return state&eofbit; }
  166.            int             fail() const    { return state&(failbit|badbit|hardfail); }
  167.            int             bad() const     { return state&badbit ; }
  168.            int             good() const    { return state==0 ; }
  169.            void            clear(int i =0)
  170.                                    {
  171.                                    state =  (i&0377) | (state&hardfail) ;
  172.                                    ispecial = (ispecial&~0377) | state ;
  173.                                    ospecial = (ospecial&~0377) | state ;
  174.                                    }
  175.            streambuf*      rdbuf() { return bp ;}
  176.  
  177.    public: /* Members related to user allocated bits and words */
  178.            long &          iword(int) ;
  179.            void* &         pword(int) ;
  180.            static long     bitalloc() ;
  181.            static int      xalloc() ;
  182.  
  183.    private: /*** privates for implemting allocated bits and words */
  184.            static long     nextbit ;
  185.            static long     nextword ;
  186.  
  187.            int             nuser ;
  188.            union ios_user_union*
  189.                            x_user ;
  190.            int     uresize(int) ;
  191.    public: /* static member functions */
  192.            static void     sync_with_stdio() ;
  193.    protected:
  194.            enum            { skipping=01000, tied=02000 } ;
  195.                            /*** bits 0377 are reserved for userbits ***/
  196.            streambuf*      bp;
  197.            void            setstate(int b)
  198.                            {       state |= (b&0377) ;
  199.                                    ispecial |= b&~skipping ;
  200.                                    ispecial |= b ;
  201.                            }
  202.            int             state;
  203.            int             ispecial;
  204.            int             ospecial;
  205.            int             isfx_special;
  206.            int             osfx_special;
  207.            int             delbuf;
  208.            ostream*        x_tie;
  209.            long            x_flags;
  210.            short           x_precision;
  211.            char            x_fill;
  212.            short           x_width;
  213.  
  214.            static void     (*stdioflush)() ;
  215.  
  216.            void            init(streambuf*) ;
  217.                                    /* Does the real work of a constructor */
  218.                            ios() ; /* No initialization at all. Needed by
  219.                                     * multiple inheritance versions */
  220.            int             assign_private ;
  221.                                    /* needed by with_assgn classes */
  222.    private:
  223.                            ios(ios&) ;
  224.            void            operator=(ios&) ;
  225.    public:   /* old stream package compatibility */
  226.            int             skip(int i) ;
  227.    };
  228.  
  229.    class _IMPORT streambuf {
  230.            short           alloc;
  231.            short           x_unbuf;
  232.            char*           x_base;
  233.            char*           x_pbase;
  234.            char*           x_pptr;
  235.            char*           x_epptr;
  236.            char*           x_gptr;
  237.            char*           x_egptr;
  238.            char*           x_eback;
  239.            int             x_blen;
  240.        private:
  241.                            streambuf(streambuf&); /* Declared but not defined */
  242.            void            operator=(streambuf&); /* Declared but not defined */
  243.        public:
  244.            void            dbp();
  245.        protected:
  246.            char*           base()          { return x_base ; }
  247.            char*           pbase()         { return x_pbase ; }
  248.            char*           pptr()          { return x_pptr ; }
  249.            char*           epptr()         { return x_epptr ; }
  250.            char*           gptr()          { return x_gptr ; }
  251.            char*           egptr()         { return x_egptr ; }
  252.            char*           eback()         { return x_eback ; }
  253.            char*           ebuf()          { return x_base+x_blen ; }
  254.            int             blen() const    { return x_blen; }
  255.            void            setp(char*  p, char*  ep)
  256.            {
  257.                    x_pbase=x_pptr=p ; x_epptr=ep ;
  258.            }
  259.            void            setg(char*  eb,char*  g, char*  eg)
  260.            {
  261.                    x_eback=eb; x_gptr=g ; x_egptr=eg ;
  262.            }
  263.            void            pbump(int n)
  264.            {
  265.                    x_pptr+=n ;
  266.            }
  267.  
  268.            void            gbump(int n)
  269.            {
  270.                    x_gptr+=n ;
  271.                    }
  272.  
  273.            void            setb(char* b, char* eb, int a = 0 )
  274.            {
  275.                    if ( alloc && x_base ) delete x_base ;
  276.                    x_base = b ;
  277.                    x_blen= (eb>b) ? (eb-b) : 0 ;
  278.                    alloc = a ;
  279.                    }
  280.            int             unbuffered() const      { return x_unbuf; }
  281.            void            unbuffered(int unb) { x_unbuf = (unb!=0)  ; }
  282.            int             allocate()
  283.            {
  284.                    if ( x_base== 0 && !unbuffered() ) return doallocate() ;
  285.                    else                             return 0 ;
  286.            }
  287.            virtual int     doallocate();
  288.        public :
  289.            virtual int     overflow(int c=EOF);
  290.            virtual int     underflow();
  291.            virtual int     pbackfail(int c);
  292.            virtual int     sync();
  293.            virtual streampos
  294.                            seekoff(streamoff,ios::seek_dir,int =ios::in|ios::out);
  295.            virtual streampos
  296.                            seekpos(streampos, int =ios::in|ios::out) ;
  297.            virtual int     xsputn(const char*  s,int n);
  298.            virtual int     xsgetn(char*  s,int n);
  299.  
  300.            int             in_avail()
  301.            {
  302.                    return x_gptr<x_egptr ? x_egptr-x_gptr : 0 ;
  303.            }
  304.  
  305.            int             out_waiting()
  306.            {
  307.                    if ( x_pptr ) return x_pptr-x_pbase ;
  308.                    else          return 0 ;
  309.            }
  310.  
  311.            int             sgetc()
  312.            {
  313.                    /***WARNING: sgetc does not bump the pointer ***/
  314.                    return (x_gptr>=x_egptr) ? underflow() : zapeof(*x_gptr);
  315.            }
  316.            int             snextc()
  317.            {
  318.                    return (++x_gptr>=x_egptr)
  319.                                    ? x_snextc()
  320.                                    : zapeof(*x_gptr);
  321.            }
  322.            int             sbumpc()
  323.            {
  324.                    return  ( x_gptr>=x_egptr && underflow()==EOF )
  325.                                    ? EOF
  326.                                    : zapeof(*x_gptr++) ;
  327.            }
  328.            int             optim_in_avail()
  329.            {
  330.                    return x_gptr<x_egptr ;
  331.            }
  332.            int             optim_sbumpc()
  333.            {
  334.                    return  zapeof(*x_gptr++) ;
  335.            }
  336.            void            stossc()
  337.            {
  338.                    if ( x_gptr < x_egptr ||
  339.                         ( x_gptr >= x_egptr && underflow() != EOF ) )
  340.                      x_gptr++;
  341.            }
  342.  
  343.            int             sputbackc(char c)
  344.            {
  345.                    if (x_gptr > x_eback ) {
  346.                            if ( *--x_gptr == c ) return zapeof(c) ;
  347.                            else                  return zapeof(*x_gptr=c) ;
  348.                    } else {
  349.                            return pbackfail(c) ;
  350.                    }
  351.            }
  352.  
  353.            int             sputc(int c)
  354.            {
  355.                    return (x_pptr>=x_epptr) ? overflow(zapeof(c))
  356.                                          : zapeof(*x_pptr++=c);
  357.            }
  358.            int             sputn(const char*  s,int n)
  359.             {
  360.                    if ( n <= (x_epptr-x_pptr) ) {
  361.                            memcpy(x_pptr,s,n) ;
  362.                            pbump(n);
  363.                            return n ;
  364.                    } else {
  365.                            return xsputn(s,n) ;
  366.                    }
  367.            }
  368.            int             sgetn(char*  s,int n)
  369.            {
  370.                    if ( n <= (x_egptr-x_gptr) ) {
  371.                            memcpy(s,x_gptr,n) ;
  372.                            gbump(n);
  373.                            return n ;
  374.                    } else {
  375.                            return xsgetn(s,n) ;
  376.                    }
  377.            }
  378.            virtual streambuf*
  379.                            setbuf(char*  p, int len) ;
  380.            streambuf*      setbuf(unsigned char*  p, int len) ;
  381.  
  382.            streambuf*      setbuf(char*  p, int len, int count) ;
  383.                                    /* obsolete third argument */
  384.                            /*** Constructors -- should be protected ***/
  385.                            streambuf() ;
  386.                            streambuf(char*  p, int l) ;
  387.  
  388.                            streambuf(char*  p, int l,int c) ;
  389.                            /* 3 argument form is obsolete.
  390.                             * Use strstreambuf.
  391.                             */
  392.            virtual         ~streambuf() ;
  393.            /*
  394.               The function:
  395.                  int streambuf::pptr_non_null()
  396.               was added by IBM to fix a problem in which a number of member
  397.               functions in class istream needed to check that the "pptr()"
  398.               was non-null. You are advised NOT to use this function in your
  399.               code.
  400.            */
  401.            int             pptr_non_null() { return x_pptr != 0; }
  402.    private:
  403.            int             x_snextc() ;
  404.    };
  405.  
  406.    class _IMPORT istream : virtual public ios {
  407.    public: /* Constructor */
  408.                            istream(streambuf*) ;
  409.            virtual         ~istream() ;
  410.    public:
  411.            int             ipfx(int noskipws=0)
  412.                            {       if ( noskipws?(ispecial&~skipping):ispecial) {
  413.                                            return do_ipfx(noskipws) ;
  414.                                    } else return 1 ;
  415.                            }
  416.  
  417.            /*
  418.              FUNCTION void isfx() IS INTERNAL AND SHOULD NOT BE USED.
  419.            */
  420.            void            isfx() { }
  421.  
  422.            istream&        seekg(streampos p) ;
  423.            istream&        seekg(streamoff o, ios::seek_dir d) ;
  424.            streampos       tellg() ;
  425.            istream&        operator>> (istream& (*f)(istream&))
  426.                            {       return (*f)(*this) ; }
  427.            istream&        operator>> (ios& (*f)(ios&) ) ;
  428.            istream&        operator>>(char*);
  429.            istream&        operator>>(signed char*);
  430.            istream&        operator>>(unsigned char*);
  431.            istream&        operator>>(char& c)
  432.                            {       if ( !ispecial && bp->optim_in_avail() &&
  433.                                         bp->pptr_non_null() ) {
  434.                                            c = bp->optim_sbumpc() ;
  435.                                            return *this;
  436.                                    }
  437.                                    else {
  438.                                            return (rs_complicated(c));
  439.                                    }
  440.                            }
  441.            istream&        operator>>(signed char& c)
  442.                            {       if ( !ispecial && bp->optim_in_avail() &&
  443.                                         bp->pptr_non_null() ) {
  444.                                            c = bp->optim_sbumpc() ;
  445.                                            return *this;
  446.                                    }
  447.                                    else {
  448.                                            return (rs_complicated(c));
  449.                                    }
  450.                            }
  451.            istream&        operator>>(unsigned char& c)
  452.                            {       if ( !ispecial && bp->optim_in_avail() &&
  453.                                         bp->pptr_non_null() ) {
  454.                                            c = bp->optim_sbumpc() ;
  455.                                            return *this;
  456.                                    }
  457.                                    else {
  458.                                            return (rs_complicated(c));
  459.                                    }
  460.                            }
  461.  
  462.            /*
  463.              FUNCTION istream &rs_complicated(char &) IS INTERNAL AND SHOULD
  464.              NOT BE USED.
  465.            */
  466.            istream&        rs_complicated(char& c);
  467.  
  468.            /*
  469.              FUNCTION istream &rs_complicated(signed char &) IS INTERNAL
  470.              AND SHOULD NOT BE USED.
  471.            */
  472.            istream&        rs_complicated(signed char& c);
  473.  
  474.            /*
  475.              FUNCTION istream &rs_complicated(unsigned char &) IS INTERNAL
  476.              AND SHOULD NOT BE USED.
  477.            */
  478.            istream&        rs_complicated(unsigned char& c);
  479.  
  480.            istream&        operator>>(short&);
  481.            istream&        operator>>(int&);
  482.            istream&        operator>>(long&);
  483.          #if _LONG_LONG
  484.            istream&        operator>>(long long&);
  485.          #endif
  486.            istream&        operator>>(unsigned short&);
  487.            istream&        operator>>(unsigned int&);
  488.            istream&        operator>>(unsigned long&);
  489.          #if _LONG_LONG
  490.            istream&        operator>>(unsigned long long&);
  491.          #endif
  492.            istream&        operator>>(float&);
  493.            istream&        operator>>(double&);
  494.            istream&        operator>>(long double&);
  495.            istream&        operator>>(streambuf*);
  496.            istream&        operator>>(wchar_t*);
  497.            istream&        operator>>(wchar_t&);
  498.            istream&        get(char* , int lim, char delim='\n');
  499.            istream&        get(signed char* b,int lim, char delim='\n');
  500.            istream&        get(unsigned char* b,int lim, char delim='\n');
  501.            istream&        getline(char* b, int lim, char delim='\n');
  502.            istream&        getline(signed char* b, int lim, char delim='\n');
  503.            istream&        getline(unsigned char* b, int lim, char delim='\n');
  504.            istream&        get(streambuf& sb, char delim ='\n');
  505.            istream&        get(wchar_t&);
  506.  
  507.            /*
  508.              FUNCTION istream &get_complicated(char &) IS INTERNAL AND SHOULD
  509.              NOT BE USED.
  510.            */
  511.            istream&        get_complicated(char& c);
  512.  
  513.            /*
  514.              FUNCTION istream &get_complicated(signed char &) IS INTERNAL
  515.              AND SHOULD NOT BE USED.
  516.            */
  517.            istream&        get_complicated(signed char& c);
  518.  
  519.            /*
  520.              FUNCTION istream &get_complicated(unsigned char &) IS INTERNAL
  521.              AND SHOULD NOT BE USED.
  522.            */
  523.            istream&        get_complicated(unsigned char& c);
  524.  
  525.            istream&        get(char& c)
  526.                            {
  527.                                    if ( !(ispecial & ~skipping) && bp->optim_in_avail() &&
  528.                                         bp->pptr_non_null() ) {
  529.                                            x_gcount = 1 ;
  530.                                            c = bp->sbumpc() ;
  531.                                            return *this;
  532.                                    } else {
  533.                                            return (get_complicated(c));
  534.                                    }
  535.                            }
  536.            istream&        get(signed char& c)
  537.                            {
  538.                                    if ( !(ispecial & ~skipping) && bp->optim_in_avail() &&
  539.                                         bp->pptr_non_null() ) {
  540.                                            x_gcount = 1 ;
  541.                                            c = bp->sbumpc() ;
  542.                                            return *this;
  543.                                    } else {
  544.                                            return (get_complicated(c));
  545.                                    }
  546.                            }
  547.            istream&        get(unsigned char& c)
  548.                            {
  549.                                    if ( !(ispecial & ~skipping) && bp->optim_in_avail() &&
  550.                                         bp->pptr_non_null() ) {
  551.                                            x_gcount = 1 ;
  552.                                            c = bp->sbumpc() ;
  553.                                            return *this;
  554.                                    } else {
  555.                                            return (get_complicated(c));
  556.                                    }
  557.                            }
  558.            int             get()
  559.                            {
  560.                                    int c ;
  561.                                    if ( !ipfx(1) ) return EOF ;
  562.                                    else {
  563.                                            c = bp->sbumpc() ;
  564.                                            if ( c == EOF ) setstate(eofbit) ;
  565.                                            return c ;
  566.                                            }
  567.                            }
  568.            int             peek()
  569.                            {
  570.                                    if ( ipfx(-1) ) return bp->sgetc() ;
  571.                                    else            return EOF ;
  572.  
  573.                            }
  574.            istream&        ignore(int n=1,int delim=EOF) ;
  575.            istream&        read(char*  s,int n);
  576.            istream&        read(signed char* s,int n)
  577.                            {
  578.                                    return read((char*)s,n) ;
  579.                            }
  580.            istream&        read(unsigned char* s,int n)
  581.                            {
  582.                                    return read((char*)s,n) ;
  583.                            }
  584.            int             gcount() ;
  585.            istream&        putback(char c);
  586.            int             sync()  { return bp->sync() ; }
  587.    protected:
  588.  
  589.            /*
  590.              FUNCTION int do_ipfx(int) IS INTERNAL AND SHOULD NOT BE USED.
  591.            */
  592.            int             do_ipfx(int noskipws) ;
  593.  
  594.            /*
  595.              FUNCTION void eatwhite() IS INTERNAL AND SHOULD NOT BE USED.
  596.            */
  597.            void            eatwhite() ;
  598.  
  599.                            istream() ;
  600.    private:
  601.            int             x_gcount ;
  602.            void            xget(char*  c) ;
  603.  
  604.            int             inf_special_in(streambuf * nbp);
  605.            int             nan_special_in(streambuf * nbp);
  606.  
  607.    public: /*** Obsolete constructors, carried over from stream package ***/
  608.            /*
  609.              YOU ARE ADVISED NOT TO USE THE OBSOLETE FUNCTIONS SINCE THEY
  610.              MAY BE REMOVED IN A FUTURE VERSION.
  611.            */
  612.                            istream(streambuf*, int sk, ostream* t=0) ;
  613.                                    /* obsolete, set sk and tie
  614.                                     * via format state variables */
  615.                            istream(int size ,char*,int sk=1) ;
  616.                                    /* obsolete, use strstream */
  617.                            istream(int fd,int sk=1, ostream* t=0) ;
  618.                                    /* obsolete use fstream */
  619.    };
  620.  
  621.    class _IMPORT ostream : virtual public ios {
  622.    public: /* Constructor */
  623.                            ostream(streambuf*) ;
  624.            virtual         ~ostream();
  625.    public:
  626.            int             opfx()  /* Output prefix */
  627.                            {       if ( ospecial ) return do_opfx() ;
  628.                                    else            return 1 ;
  629.                            }
  630.  
  631.            void            osfx()
  632.                            {       if ( osfx_special ) do_osfx() ; }
  633.  
  634.            ostream&        flush() ;
  635.            ostream&        seekp(streampos p) ;
  636.            ostream&        seekp(streamoff o, ios::seek_dir d) ;
  637.            streampos       tellp() ;
  638.  
  639.            ostream&        put(char c)
  640.            {
  641.                    if (ospecial || osfx_special) {
  642.                            return complicated_put(c);
  643.                    }
  644.                    else {
  645.                            if (  bp->sputc(c) == EOF )  {
  646.                                    setstate(eofbit|failbit) ;
  647.                            }
  648.                            return *this ;
  649.                    }
  650.            }
  651.  
  652.            /*
  653.              FUNCTION ostream &complicated_put(char) IS INTERNAL AND SHOULD
  654.              NOT BE USED.
  655.            */
  656.            ostream&        complicated_put(char c);
  657.  
  658.            ostream&        operator<<(char c)
  659.            {
  660.                    if (ospecial || osfx_special) {
  661.                            return ls_complicated(c);
  662.                    }
  663.                    else {
  664.                            if (  bp->sputc(c) == EOF )  {
  665.                                    setstate(eofbit|failbit) ;
  666.                            }
  667.                            return *this ;
  668.                    }
  669.            }
  670.  
  671.            ostream&        operator<<(signed char c)
  672.            {
  673.                    if (ospecial || osfx_special) {
  674.                            return ls_complicated(c);
  675.                    }
  676.                    else {
  677.                            if (  bp->sputc(c) == EOF )  {
  678.                                    setstate(eofbit|failbit) ;
  679.                            }
  680.                            return *this ;
  681.                    }
  682.            }
  683.  
  684.            ostream&        operator<<(unsigned char c)
  685.            {
  686.                    if (ospecial || osfx_special) {
  687.                            return ls_complicated(c);
  688.                    }
  689.                    else {
  690.                            if (  bp->sputc(c) == EOF )  {
  691.                                    setstate(eofbit|failbit) ;
  692.                            }
  693.                            return *this ;
  694.                    }
  695.            }
  696.  
  697.            /*
  698.              FUNCTION ostream &ls_complicated(char) IS INTERNAL AND SHOULD
  699.              NOT BE USED.
  700.            */
  701.            ostream&        ls_complicated(char);
  702.  
  703.            /*
  704.              FUNCTION ostream &ls_complicated(signed char) IS INTERNAL AND
  705.              SHOULD NOT BE USED.
  706.            */
  707.            ostream&        ls_complicated(signed char);
  708.  
  709.            /*
  710.              FUNCTION ostream &ls_complicated(unsigned char) IS INTERNAL AND
  711.              SHOULD NOT BE USED.
  712.            */
  713.            ostream&        ls_complicated(unsigned char);
  714.  
  715.            ostream&        operator<<(wchar_t c);
  716.            ostream&        operator<<(const wchar_t *);
  717.            ostream&        operator<<(const char*);
  718.            ostream&        operator<<(const signed char*);
  719.            ostream&        operator<<(const unsigned char*);
  720.            ostream&        operator<<(int a);
  721.            ostream&        operator<<(long);
  722.          #if _LONG_LONG
  723.            ostream&        operator<<(long long);
  724.          #endif
  725.            ostream&        operator<<(double);
  726.            ostream&        operator<<(long double);
  727.            ostream&        operator<<(float);
  728.            ostream&        operator<<(unsigned int a);
  729.            ostream&        operator<<(unsigned long);
  730.          #if _LONG_LONG
  731.            ostream&        operator<<(unsigned long long);
  732.          #endif
  733.            ostream&        operator<<(const void*);
  734.            ostream&        operator<<(streambuf*);
  735.            ostream&        operator<<(short i) { return *this << (int)i ; }
  736.            ostream&        operator<<(unsigned short i)
  737.                            { return *this << (int)i  ; }
  738.  
  739.            ostream&        operator<< (ostream& (*f)(ostream&))
  740.                            { return (*f)(*this) ; }
  741.            ostream&        operator<< (ios& (*f)(ios&) ) ;
  742.  
  743.            ostream&        write(const char*  s,int n)
  744.            {
  745.                    if ( !state ) {
  746.                            if ( bp->sputn(s,n) != n ) setstate(eofbit|failbit);
  747.                            }
  748.                    return *this ;
  749.            }
  750.            ostream&        write(const signed char* s, int n)
  751.            {
  752.                    return write((const char*)s,n);
  753.            }
  754.            ostream&        write(const unsigned char* s, int n)
  755.            {
  756.                    return write((const char*)s,n);
  757.            }
  758.    protected: /* More ostream members */
  759.  
  760.            /*
  761.              FUNCTION int do_opfx() IS INTERNAL AND SHOULD NOT BE USED.
  762.            */
  763.            int             do_opfx() ;
  764.  
  765.            /*
  766.              FUNCTION void do_osfx() IS INTERNAL AND SHOULD NOT BE USED.
  767.            */
  768.            void            do_osfx() ;
  769.  
  770.                            ostream() ;
  771.  
  772.    public: /*** Obsolete constructors, carried over from stream package ***/
  773.            /*
  774.              YOU ARE ADVISED NOT TO USE THE OBSOLETE FUNCTIONS SINCE THEY
  775.              MAY BE REMOVED IN A FUTURE VERSION.
  776.            */
  777.                            ostream(int fd) ;
  778.                                    /* obsolete use fstream */
  779.                            ostream(int size ,char*) ;
  780.                                    /* obsolete, use strstream */
  781.    /*
  782.       Functions:
  783.  
  784.            int             wchar_out(int, char *, int) ;
  785.  
  786.       has been added by IBM to support wchar_t.
  787.    */
  788.    private:
  789.            int             wchar_out(int, char *, int) ;
  790.    } ;
  791.  
  792.    class _IMPORT iostream : public istream, public ostream {
  793.    public:
  794.                            iostream(streambuf*) ;
  795.            virtual         ~iostream() ;
  796.    protected:
  797.                            iostream() ;
  798.            } ;
  799.  
  800.    class _IMPORT istream_withassign : public istream {
  801.    public:
  802.                            istream_withassign() ;
  803.            virtual         ~istream_withassign() ;
  804.            istream_withassign&     operator=(istream&) ;
  805.            istream_withassign&     operator=(streambuf*) ;
  806.    } ;
  807.  
  808.    class _IMPORT ostream_withassign : public ostream {
  809.    public:
  810.                            ostream_withassign() ;
  811.            virtual         ~ostream_withassign() ;
  812.            ostream_withassign&     operator=(ostream&) ;
  813.            ostream_withassign&     operator=(streambuf*) ;
  814.    } ;
  815.  
  816.    class _IMPORT iostream_withassign : public iostream {
  817.    public:
  818.                            iostream_withassign() ;
  819.            virtual         ~iostream_withassign() ;
  820.            iostream_withassign&    operator=(ios&) ;
  821.            iostream_withassign&    operator=(streambuf*) ;
  822.    } ;
  823.  
  824. #if _WIN32S
  825.    extern istream_withassign * _IMPORT _cin() ;
  826.    extern ostream_withassign * _IMPORT _cout() ;
  827.    extern ostream_withassign * _IMPORT _cerr() ;
  828.    extern ostream_withassign * _IMPORT _clog() ;
  829.    #define cin (*_cin())
  830.    #define cout (*_cout())
  831.    #define cerr (*_cerr())
  832.    #define clog (*_clog())
  833. #else
  834.    extern istream_withassign _IMPORT cin ;
  835.    extern ostream_withassign _IMPORT cout ;
  836.    extern ostream_withassign _IMPORT cerr ;
  837.    extern ostream_withassign _IMPORT clog ;
  838. #endif
  839.  
  840.    ios&       _IMPORT     dec(ios&) ;
  841.    ostream&   _IMPORT     endl(ostream& i) ;
  842.    ostream&   _IMPORT     ends(ostream& i) ;
  843.    ostream&   _IMPORT     flush(ostream&) ;
  844.    ios&       _IMPORT     hex(ios&) ;
  845.    ios&       _IMPORT     oct(ios&) ;
  846.    istream&   _IMPORT     ws(istream&) ;
  847.  
  848.    #pragma pack()
  849.  
  850. #endif
  851.  
  852. #pragma info( none )
  853. #ifndef __CHKHDR__
  854.    #pragma info( restore )
  855. #endif
  856. #pragma info( restore )
  857.  
  858.