Changes in libcfa/src/iostream.hfa [211def2:63e129c]
- File:
-
- 1 edited
-
libcfa/src/iostream.hfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.hfa
r211def2 r63e129c 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 6 18:35:54202413 // Update Count : 7 4312 // Last Modified On : Sun Jan 28 11:56:29 2024 13 // Update Count : 733 14 14 // 15 15 … … 370 370 // *********************************** exceptions *********************************** 371 371 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 372 ExceptionDecl( cstring_length ); 373 ExceptionDecl( missing_data ); 375 374 376 375 // *********************************** manipulators *********************************** … … 407 406 char * s; 408 407 inline _Istream_str_base; 409 }; // _Istream_C width408 }; // _Istream_Cstr 410 409 411 410 // Restrict nesting of input manipulators to those combinations that make sense. 411 412 struct _Istream_Cstr { 413 _Istream_Cwidth cstr; 414 }; // _Istream_Cstr 412 415 413 416 struct _Istream_Cquoted { … … 415 418 }; // _Istream_Cquoted 416 419 417 struct _Istream_Cstr {418 _Istream_Cwidth cstr;419 }; // _Istream_Cstr420 421 420 static inline { 422 421 // 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); 423 422 _Istream_Cwidth wdi( unsigned int wd, char s[] ) { 424 if ( wd <= 1 ) throw Resume ExceptionInst( cstring_length ); // minimum 1 character and null terminator423 if ( wd <= 1 ) throw (cstring_length){ &cstring_length_vt }; // minimum 1 character and null terminator 425 424 return (_Istream_Cwidth)@{ .s : s, { {.scanset : 0p}, .wd : wd, {.all : 0} } }; 426 425 } 427 426 _Istream_Cwidth wdi( unsigned int wd, unsigned int rwd, char s[] ) { 428 if ( wd <= 1 || wd <= rwd ) throw Resume ExceptionInst( cstring_length ); // minimum 1 character, null terminator, plus subset427 if ( wd <= 1 || wd <= rwd ) throw (cstring_length){ &cstring_length_vt }; // minimum 1 character, null terminator, plus subset 429 428 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;433 429 } 434 430 _Istream_Cquoted quoted( char & ch, const char Ldelimiter = '\'', const char Rdelimiter = '\0' ) { … … 439 435 return (_Istream_Cquoted &)f; 440 436 } 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 } 441 440 _Istream_Cstr & incl( const char scanset[], _Istream_Cwidth & f ) { f.scanset = scanset; f.flags.inex = false; return (_Istream_Cstr &)f; } 442 441 _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_C str)@{ { .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} } }; } 444 443 _Istream_Cstr & ignore( _Istream_Cwidth & f ) { f.flags.ignore = true; return (_Istream_Cstr &)f; } 445 444 _Istream_Cquoted & ignore( _Istream_Cquoted & f ) { f.cstr.flags.ignore = true; return (_Istream_Cquoted &)f; } … … 451 450 istype & ?|?( istype & is, _Istream_Cquoted f ); 452 451 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 454 455 } // distribution 455 456
Note:
See TracChangeset
for help on using the changeset viewer.