Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.hfa

    r211def2 r63e129c  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  6 18:35:54 2024
    13 // Update Count     : 743
     12// Last Modified On : Sun Jan 28 11:56:29 2024
     13// Update Count     : 733
    1414//
    1515
     
    370370// *********************************** exceptions ***********************************
    371371
    372 ExceptionDecl( missing_data );                                                  // read finds no appropriate data
    373 ExceptionDecl( cstring_length );                                                // character string size exceeded
    374 ExceptionDecl( data_range );                                                    // value too large for numerical type
     372ExceptionDecl( cstring_length );
     373ExceptionDecl( missing_data );
    375374
    376375// *********************************** manipulators ***********************************
     
    407406        char * s;
    408407        inline _Istream_str_base;
    409 }; // _Istream_Cwidth
     408}; // _Istream_Cstr
    410409
    411410// Restrict nesting of input manipulators to those combinations that make sense.
     411
     412struct _Istream_Cstr {
     413        _Istream_Cwidth cstr;
     414}; // _Istream_Cstr
    412415
    413416struct _Istream_Cquoted {
     
    415418}; // _Istream_Cquoted
    416419
    417 struct _Istream_Cstr {
    418         _Istream_Cwidth cstr;
    419 }; // _Istream_Cstr
    420 
    421420static inline {
    422421        // width must include room for null terminator, (gcc) scanf does not allow a 0 width => wd > 1 (1 char and null) and rd > 0 (1 char);
    423422        _Istream_Cwidth wdi( unsigned int wd, char s[] ) {
    424                 if ( wd <= 1 ) throwResume ExceptionInst( cstring_length ); // minimum 1 character and null terminator
     423                if ( wd <= 1 ) throw (cstring_length){ &cstring_length_vt }; // minimum 1 character and null terminator
    425424                return (_Istream_Cwidth)@{ .s : s, { {.scanset : 0p}, .wd : wd, {.all : 0} } };
    426425        }
    427426        _Istream_Cwidth wdi( unsigned int wd, unsigned int rwd, char s[] ) {
    428                 if ( wd <= 1 || wd <= rwd ) throwResume ExceptionInst( cstring_length ); // minimum 1 character, null terminator, plus subset
     427                if ( wd <= 1 || wd <= rwd ) throw (cstring_length){ &cstring_length_vt }; // minimum 1 character, null terminator, plus subset
    429428                return (_Istream_Cwidth)@{ .s : s, { {.scanset : 0p}, .wd : rwd, {.flags.rwd : true} } };
    430         }
    431         _Istream_Cstr & getline( _Istream_Cwidth & f, const char delimiter = '\n' ) {
    432                 f.delimiters[0] = delimiter; f.delimiters[1] = '\0'; f.flags.delimiter = true; return (_Istream_Cstr &)f;
    433429        }
    434430        _Istream_Cquoted quoted( char & ch, const char Ldelimiter = '\'', const char Rdelimiter = '\0' ) {
     
    439435                return (_Istream_Cquoted &)f;
    440436        }
     437        _Istream_Cstr & getline( _Istream_Cwidth & f, const char delimiter = '\n' ) {
     438                f.delimiters[0] = delimiter; f.delimiters[1] = '\0'; f.flags.delimiter = true; return (_Istream_Cstr &)f;
     439        }
    441440        _Istream_Cstr & incl( const char scanset[], _Istream_Cwidth & f ) { f.scanset = scanset; f.flags.inex = false; return (_Istream_Cstr &)f; }
    442441        _Istream_Cstr & excl( const char scanset[], _Istream_Cwidth & f ) { f.scanset = scanset; f.flags.inex = true; return (_Istream_Cstr &)f; }
    443         _Istream_Cstr ignore( const char s[] ) { return (_Istream_Cstr)@{ { .s : (char *)s, { {.scanset : 0p}, .wd : -1, {.flags.ignore : true} } } }; }
     442        _Istream_Cstr ignore( const char s[] ) { return (_Istream_Cwidth)@{ .s : (char *)s, { {.scanset : 0p}, .wd : -1, {.flags.ignore : true} } }; }
    444443        _Istream_Cstr & ignore( _Istream_Cwidth & f ) { f.flags.ignore = true; return (_Istream_Cstr &)f; }
    445444        _Istream_Cquoted & ignore( _Istream_Cquoted & f ) { f.cstr.flags.ignore = true; return (_Istream_Cquoted &)f; }
     
    451450        istype & ?|?( istype & is, _Istream_Cquoted f );
    452451        istype & ?|?( istype & is, _Istream_Cstr f );
    453         static inline istype & ?|?( istype & is, _Istream_Cwidth f ) { return is | *(_Istream_Cstr *)&f; }
     452        static inline {
     453                istype & ?|?( istype & is, _Istream_Cwidth f ) { return is | *(_Istream_Cstr *)&f; }
     454        } // distribution
    454455} // distribution
    455456
Note: See TracChangeset for help on using the changeset viewer.