Annotation of researchv10no/cmd/cfront/libC/iostream/README, revision 1.1.1.1

1.1       root        1: 
                      2: 5/9/89: Have filebuf::sync() reset last_seek.  This will have the
                      3:         effect that if somebody else moves the file pointer
                      4:         after a sync() but before a seek(), the filebuf will behave
                      5:        sensibly.
                      6: 
                      7: 5/9/89: Fix define of "hardfail".
                      8: 
                      9: 5/5/89: Lots of stuff to improve buffering. New function 
                     10:        
                     11:        ostream::osfx()
                     12:                Perform "suffix" actions before returning from
                     13:                inserters.  This is called by all predefined
                     14:                inserters.  It isn't called by the binary output functions.
                     15:                And should be called by user inserters
                     16:                after any direct manipulation of the streambuf.
                     17: 
                     18:        There are two new format flags:
                     19: 
                     20:                unitbuf: when set a flush is performed by osfx() ;
                     21:                stdio: when set stdout and stderr are flushed by osfx() ;
                     22: 
                     23:        cerr is now unitbuf'ed rather than unbuffered.
                     24: 
                     25:        sync_with_stdio makes cout, cerr unit buffered rather than
                     26:        unbuffered.
                     27: 
                     28:        cin and cout now get the arrays they use dynamically. (Previously
                     29:        they were statically allocated.)  This change is prompted
                     30:        by people who complained about wasting 2K when they didn't
                     31:        use cin or cout.
                     32: 
                     33: 5/5/89: Add check in streambuf* insertor so that it sets failbit when
                     34:        given the null pointer.  (Right now it just core dumps).
                     35: 
                     36: 5/5/89: Change ios::clear to have an int argument
                     37: 
                     38: cycle 16
                     39: 
                     40: 5/4/89: Change all open_mode arguments to ints.
                     41: 
                     42: 5/3/89: Fix ws manipulator so that it will flushed tied ostream
                     43:        when required.
                     44: 
                     45: 5/2/89: More cleanup of open_mode arguments.  Add defaults for
                     46:        ifstream::open and ofstream::open.  Change all
                     47:        defaults to filebuf::openprot
                     48: 
                     49: cycle 15
                     50: 
                     51: 4/28/89. Add default open_mode arguments to ifstream and ofstream
                     52:         constructors.
                     53: 
                     54: cycle 14?
                     55: 
                     56: 4/18/89.  Fix bug is filebuf::seekoff that also caused problems
                     57:          for tellg and tellp.  
                     58: 
                     59: 4/13/89.  Change cstreams.c so it doesn't refer to skip (which is
                     60:        a stream compatibility function.
                     61: 
                     62: ------------------------------------------------
                     63: Cycle 13
                     64: 
                     65: Change typedef in strstream.c to avoid use of size_t.  (This is
                     66: because of header file compatibility problems.)
                     67: 
                     68: Change exit(10) to abort() in oldformat.c.
                     69: 
                     70: Cycle 12
                     71: 
                     72: Put in include of <iostream.h> in strstream.h
                     73: 
                     74: Change istream::get() so that it really gets expanded inline.
                     75: Previous definition was being outlined.
                     76: 
                     77: Reorder declarations so that ipfx comes before any operator>>. Not
                     78: just before the ones that have inline code refering to it. The old
                     79: ordering was resulting in a failure to expand ipfx where it should
                     80: have been.
                     81: 
                     82: Move declaration of ios_user_union higher in stream.c in order to
                     83: eliminate a new warning message.
                     84: 
                     85: Change values of O_CREAT O_TRUNC O_EXCL in cases where headers don't
                     86: define them (the only known such system is V9)
                     87: 
                     88: Fix ostream::out_waiting.  It was just returning non-zero when there was stuff
                     89: accumulated but not consumed.  It was supposed to return the number
                     90: (at least according to the man page.)
                     91: 
                     92: -----------------------------------------------------
                     93: Cycle 11
                     94: 
                     95: Change cstreams.c for change to way explicit placement works.
                     96: 
                     97: Implement bidirectional strstream. 
                     98: 
                     99: ----------------------------------------------------
                    100: Cycle 9 
                    101: 
                    102: Fix bug in void* inserter.  (Showbase should have been set
                    103: but wasn't)
                    104: 
                    105: 
                    106: --------------------------------------------------
                    107: Cycle 8
                    108: 
                    109: streambuf::snextc was not incrementing the get pointer before
                    110: it called underflow.  This had no effect because the streambuf
                    111: classes assume that when underflow is called there
                    112: was nothing in the buffer.  The man page said that although this
                    113: was "normally the case" but doesn't guarantee it.  I wrote a new
                    114: streambuf class that checked for the condition and it failed.
                    115: I've fixed snextc.  
                    116: 
                    117: ---------------------------------------------------
                    118: Cycle 7  
                    119: 
                    120: Fix bug in setstate.  
                    121: 
                    122: Change return type of filebuf::close to filebuf*
                    123: 
                    124: Add noreplace to open_mode 
                    125: 
                    126: Fixed bug in adjustment of floating fields
                    127: 
                    128: -----------------------------------------------------
                    129: 
                    130: Cycle 6.1 
                    131: 
                    132: Interpretation of justification fields was screwed up.
                    133: 
                    134: Fix for whitespace eating of character extractor of cycle 6  was
                    135: incomplete. (It might read characters when the stream was
                    136: in error status).
                    137: 
                    138: -----------------------------------------------------
                    139: Cycle 6
                    140: 
                    141: Make streambuf::xsgetn and streambuf::xsputn virtuals
                    142: 
                    143: ios::operator int changed to ios::operator void* in order to allow
                    144: detection of "cin << 5" without requiring any extractor or inserter
                    145: to be declared in class iostream.
                    146: 
                    147: sync is moved from ios to istream,  the corresponding action on
                    148: ostreams is flushing.
                    149: 
                    150: Reorder declarations in iostream.h to avoid forward enum tag
                    151: declarations.
                    152: 
                    153: Fixes to single character extractors to make sure they skip
                    154: whitespace when required.
                    155: 
                    156: Massive simplification of format control stuff
                    157: 
                    158:        struct fmtinfo goes away as do pushing and popping of it.
                    159: 
                    160:        several format state variables are consolodated into
                    161:        a single flag field and new flags are added to control
                    162:        more stuff.  Remaining state variables are fill, precision and
                    163:        width.  New statevariable "flags".
                    164: 
                    165:        Flags declared in an enum within ios:
                    166: 
                    167:        enum            { skipws=01,    
                    168:                                        /* skip whitespace on input */
                    169:                          left=02,  right=04, internal=010,
                    170:                                        /* padding location */
                    171:                          dec=020, oct=040, hex=0100, 
                    172:                                        /* conversion base */
                    173:                          showbase=0200, showpoint=0400, uppercase=01000,
                    174:                          showpos=02000, 
                    175:                                        /* modifiers */
                    176:                          scientific=04000, fixed=010000
                    177:                                        /* floating point notation */                                             } ;
                    178:        
                    179:        Functions to manipulate the flag field
                    180:                s.flags()       return current flag
                    181:                s.flags(b)      sets flags to b 
                    182:                s.setf(b)       turns on bits marked in f in flags
                    183:                s.setf(b,f)     assigns b to "field" specified by f
                    184:                                (i.e. bits that are on in f)
                    185: 
                    186:         static ios int members for convienent reference to fields
                    187:                 ios::basefield = hex|dec|oct ;
                    188:                 ios::adjustfield = left|right|internal ;
                    189:                 ios::floatfield = scientific|fixed ;
                    190: 
                    191: New manipulators
                    192: 
                    193:        s << setfill(f)         sets fill state variable
                    194:        s << setprecision(p)    sets precision state variable
                    195:        s << setiosflags(b)     does s.setf(b)
                    196:        s << resetiosflags(b)   does s.setf(0,b)
                    197: 
                    198: New user setable state variables
                    199: 
                    200:        flags are a long user code may use unassigned bits
                    201:        s.iword(x)              returns a long& 
                    202:        s.pword(s)              returns a void*& (sharing space with s.iword(x)
                    203:        
                    204: 
                    205:        ios::bitalloc()         returns a previously unallocated bit
                    206:        ios::xalloc()           returns a previously unused index
                    207:        
                    208: ---------------------------------------------
                    209: Cycle 5
                    210: 
                    211: Eliminated a lot of warnings about assigning longs to ints and
                    212: the like.
                    213: 
                    214: Put in some overflow detection on integer input (it is still very
                    215: incomplete). 
                    216: 
                    217: Change sync_with_stdio into a static member function
                    218: 
                    219: Add enum_mode, nocreate.  Causes failure of an open if file does not
                    220: previously exist. 
                    221: 
                    222: Changed popfmt to reset width to 0.  This is more consistent with the
                    223: normal use.
                    224: 
                    225: Fixed some bugs in interaction of EOF eating whitespace and "ignore"
                    226: 
                    227: ------------------------------------------
                    228: 
                    229: Multiple Inheritance Version.  
                    230: 
                    231: Changes from previous version:
                    232: 
                    233: MI structure in classes.  Mainly this is a lot of trivial changes.
                    234: But one substantive change arises.  Because ios is now inherited
                    235: as a virtual base class, a constructor with no arguments must
                    236: be used.  Therefore ios::init(streambuf*) is declared protected and
                    237: must be used to initialize in derived classes.
                    238: 
                    239: -------------------------------------------
                    240: 
                    241: The latest version of the iostream package incorporates a large
                    242: number of changes and bug fixes.  They are listed here in my
                    243: estimation of their importance.
                    244: 
                    245: In principle, istream, ostream, and iostream are now distinct
                    246: classes. istream only contains input operations and ostream only
                    247: contains output operations.  iostream is the "join" of the two. There
                    248: is a new class ios containing the common state information from which
                    249: all these are derived.
                    250: 
                    251: This means, for example, that cin should't be passed to a function
                    252: expecting an iostream.
                    253: 
                    254: In practice to do this would have required a good implementation of
                    255: multiple inheritance with virtual base classes. To avoid relying on
                    256: this feature of C++ all the stream classes are typedefed to ios.
                    257: 
                    258: As a consequence of this change several classes derived from
                    259: "istream" and "ostream" have been added.  Namely ifstream, ofstream,
                    260: istrstream and ostrstream.  These (rather than the bidrectional
                    261: fstream and strstream) should be used when a stream for only input or
                    262: only output is desired.
                    263: 
                    264: The kludge that used #defines and pointer variables to implement cin,
                    265: cour, cerr and cdebug has been eliminated. The standard streams are
                    266: now declared as extern variables in iostream.h. Their types are
                    267: classes derived from iostream with an assignment operator. So that it
                    268: is now permitted to assign streams to them.
                    269: 
                    270: Because cfront now distinguishes int from char in overload resolution
                    271: cout << 'a' now outputs the character 'a' rather than the decimal
                    272: value.  This is an incompatibility with the old stream package, but
                    273: is such a large improvement that I thought it was worth any
                    274: conversion problems it might cause.   This made the manipulator
                    275: "onec" redundant and it has been removed.
                    276: 
                    277: The name space has been cleaned up.  A lot of identifiers that were
                    278: previously part of the global name space have been made local to a
                    279: class. A table of the old and new names follows.  Probably the most
                    280: important is the renaming of open_modes.
                    281: 
                    282:        old name                new name
                    283:        --------                --------
                    284: 
                    285:        iocdebug                        // eliminated
                    286:        iocerr                          // eliminated
                    287:        iocin                           // eliminated
                    288:        iocout                          // eliminated
                    289:        
                    290:        cdebug                  clog    // Renamed because of
                    291:                                        // complaints about old name
                    292: 
                    293:        state_value             io_state
                    294:                                        // Renamed because state_value
                    295:                                        // was too unspecific
                    296: 
                    297:        _bad                    ios::badbit
                    298:        _eof                    ios::eofbit
                    299:        _fail                   ios::failbit
                    300:        _good                   ios::goodbit
                    301: 
                    302:        append                  ios::app
                    303:        atend                   ios::ate
                    304:        input                   ios::in
                    305:        output                  ios::out
                    306: 
                    307:        seek_beg                ios::beg
                    308:        seek_cur                ios::cur
                    309:        seek_end                ios::end
                    310: 
                    311: stream.h contains declarations of the names required for backward
                    312: compatibility with the stream package.
                    313: 
                    314: The macros for declaring manipulator classes (IOMANIP and  IOMANIP2)
                    315: have been replaced by a collection of macros that are more
                    316: "template-like". Two argument manipulators are not implemented.
                    317: (Users may follow the pattern in iomanip.h to implement them
                    318: themselves.)
                    319: 
                    320: filebuf and fstream operations no longer clear errno.
                    321: 
                    322: The virtual declaration of streambuf::setbuf now only has two
                    323: arguments. The three argument form exists in streambuf for
                    324: compatibility with the stream package, but the "official"
                    325: definition has only two arguments. Similarly the documented
                    326: constructor is now streambuf(char*,int).
                    327: 
                    328: The members of fstream (ifstream and ofstream) that used to return an
                    329: int as an error indication (namely open, attach, close) now return
                    330: void.  Errors are indicated by setting failbit in the error state.
                    331: There was some confusion here about whether an error was indicated by
                    332: returning 0 or EOF.  Declaraing these functions to return void
                    333: eliminates the possibility of confusion.
                    334: 
                    335: strstreambuf now allows setbuf in order to control sizes of
                    336: allocation in dynamic mode. (When character strings are being
                    337: automatically extended.)
                    338: 
                    339: More careful checks for whether flushes are required on streams that
                    340: are tied to other streams. (E.g. flushes on cout when characters are
                    341: extracted from cin.)
                    342: 
                    343: Tieing now works for insertion. E.g. cerr is tied to cout, so
                    344: insertion into cerr causes cout to be flushed.
                    345: 
                    346: Redundant calls to allocate have been removed from streambuf::xsgetn
                    347: and streambuf::xsputn.  (This means that the only calls to
                    348: streambuf::allocate from streambuf member functions are from the
                    349: virtuals that may be overriden in derived classes.)
                    350: 
                    351: open with ios::ate (the old atend) no longer implies ios::out (the
                    352: old output).  ios::app does.  (ate is a perfectly sensible mode
                    353: for input.)
                    354: 
                    355: eatwhite is defined for compatibility with stream package.

unix.superglobalmegacorp.com

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