Annotation of researchv10no/cmd/cfront/libC/iostream/cstreams.c, revision 1.1

1.1     ! root        1: /*ident        "@(#)ctrans:lib/stream/cstreams.c       1.1.4.1" */
        !             2: /**************************************************************************
        !             3:                         Copyright (c) 1984 AT&T
        !             4:                           All Rights Reserved   
        !             5: 
        !             6:         THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
        !             7:         
        !             8:         The copyright notice above does not evidence any        
        !             9:         actual or intended publication of such source code.
        !            10: 
        !            11: cstreams.c:
        !            12: 
        !            13: *****************************************************************************/
        !            14: 
        !            15: #include <iostream.h>
        !            16: #include <fstream.h>
        !            17: #include <new.h>
        !            18: #include "streamdefs.h"
        !            19: 
        !            20: int Iostream_init::stdstatus = 0 ;
        !            21: int Iostream_init::initcount = 0 ;
        !            22: 
        !            23: istream_withassign cin ;
        !            24: ostream_withassign cout ;
        !            25: ostream_withassign cerr ;
        !            26: ostream_withassign clog ;
        !            27: 
        !            28:        // The value of Iostream_init::stdstatus describes the
        !            29:        // The std stream variables
        !            30: 
        !            31:        // 0 means istream::stdin, ostream::stdout, ostream::stderr, and
        !            32:        //      ostream::stdlog are unitialized
        !            33:        // 1 means they are initialized to filebufs
        !            34:        // 2 means they are initialized to stdiobufs
        !            35: 
        !            36: Iostream_init::Iostream_init() 
        !            37: {
        !            38:        ++initcount ;
        !            39:        if ( initcount > 1 ) return ;
        !            40: 
        !            41:        // Be careful.  Initialization occurs before constructors
        !            42:        // of the standard streams are called.
        !            43:        new (&cin) istream_withassign ;
        !            44:        new (&cout) ostream_withassign ;
        !            45:        new (&cerr) ostream_withassign ;
        !            46:        new (&clog) ostream_withassign ;
        !            47:        cin = new filebuf(0) ;
        !            48:        cout = new filebuf(1) ;
        !            49:        cerr = new filebuf(2) ;
        !            50:        clog = new filebuf(2) ;
        !            51: 
        !            52:        cin.setf(~0L,ios::skipws) ;
        !            53:        cerr.setf(~0L,ios::unitbuf) ;
        !            54:        cin.tie(&cout) ;
        !            55:        cerr.tie(&cout) ;
        !            56:        clog.tie(&cout) ;
        !            57:        stdstatus = 1 ;
        !            58:        }
        !            59: 
        !            60: Iostream_init::~Iostream_init()
        !            61: {
        !            62:        --initcount ;
        !            63:        if ( initcount > 0 ) return ;
        !            64:        cout.flush() ;
        !            65:        cerr.flush() ;
        !            66:        clog.flush() ;
        !            67:        }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.