Ignore:
Timestamp:
Jan 27, 2024, 11:29:57 PM (8 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
63e129c
Parents:
765ee42
Message:

update testing for manipulators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r765ee42 rbaa1d5d  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 25 08:39:31 2024
    13 // Update Count     : 1901
     12// Last Modified On : Sat Jan 27 18:02:40 2024
     13// Update Count     : 1909
    1414//
    1515
     
    10021002                        return is | *(_Istream_Cstr *)&f;
    10031003                } // fini
    1004                 if ( ! flags.ignore && args == 0 ) s[0] = '\0'; // read failed => no pattern match => set string to null
     1004                // read failed => no pattern match => set string to null
     1005                if ( ! flags.ignore && s != 0p && args == 0 ) s[0] = '\0';
    10051006                if ( args == 1 && eof( is ) ) {                                 // data but scan ended at EOF
    10061007                        clear( is );                                                            // => reset EOF => detect again on next read
     
    10551056                        if ( flags.delimiter ) {                                        // getline
    10561057                                int len = 0;                                                    // may not be set in fmt
    1057                                 sprintf( &fmtstr[pos], "[^%c]%%n", delimiters[0] );
     1058                                if ( delimiters[2] != '\0' ) {                  // read single character ?
     1059                                        sprintf( &fmtstr[pos], "c%%n" );
     1060                                } else {
     1061                                        sprintf( &fmtstr[pos], "[^%c]%%n", delimiters[0] );
     1062                                } // if
    10581063                                if ( flags.ignore ) args = fmt( is, fmtstr, &len ); // no string argument for '*'
    10591064                                else args = fmt( is, fmtstr, s, &len );
     
    10971102        } // ?|?
    10981103
    1099         istype & ?|?( istype & is, _Istream_Char f ) with(f) {
    1100                 if ( ignore ) {
    1101                         fmt( is, "%*c" );                                                       // argument variable unused
    1102                 } else {
    1103                         int len = -1, args = fmt( is, fmt, &c, &len );
    1104                         if ( args != -1 && len == -1 ) throwResume ExceptionInst( missing_data );
    1105                 } // if
    1106                 return is;
    1107         } // ?|?
     1104        // istype & ?|?( istype & is, _Istream_Char f ) with(f) {
     1105        //      if ( ignore ) {
     1106        //              fmt( is, "%*c" );                                                       // argument variable unused
     1107        //      } else {
     1108        //              int len = -1, args = fmt( is, fmt, &c, &len );
     1109        //              if ( args != -1 && len == -1 ) throwResume ExceptionInst( missing_data );
     1110        //      } // if
     1111        //      return is;
     1112        // } // ?|?
    11081113} // distribution
    11091114
     
    11241129} // distribution
    11251130
     1131INPUT_FMT_IMPL( char, "c" )
    11261132INPUT_FMT_IMPL( signed char, "hhi" )
    11271133INPUT_FMT_IMPL( unsigned char, "hhi" )
Note: See TracChangeset for help on using the changeset viewer.