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

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