Changes in / [097c8d0:b67b632]
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r097c8d0 rb67b632 960 960 istype & ?|?( istype & is, _Istream_Cskip f ) { 961 961 // printf( "skip %s %d\n", f.scanset, f.wd ); 962 if ( f.scanset ) fmt( is, f.scanset, "" ); // no input arguments 962 if ( f.scanset ) { 963 int nscanset = strlen(f.scanset); 964 char fmtstr[ sizeof("%*[]") + nscanset ]; 965 int pos = 0; 966 fmtstr[pos] = '%'; pos += 1; 967 fmtstr[pos] = '*'; pos += 1; 968 fmtstr[pos] = '['; pos += 1; 969 strcpy( &fmtstr[pos], f.scanset ); pos += nscanset; 970 fmtstr[pos] = ']'; pos += 1; 971 fmtstr[pos] = '\0'; 972 fmt( is, fmtstr, (void*)0 ); // last arg is dummy: suppress gcc warning 973 } 963 974 else for ( f.wd ) fmt( is, "%*c" ); 964 975 return is; … … 1000 1011 1001 1012 int check = f.wd - 2; 1002 if ( ! f.flags.rwd ) f.s[check] = '\0'; // insert sentinel 1013 if (! f.flags.ignore ) { 1014 f.s[0] = '\0'; 1015 if ( ! f.flags.rwd ) f.s[check] = '\0'; // insert sentinel 1016 } 1003 1017 len = fmt( is, fmtstr, f.s ); 1004 1018 //fprintf( stderr, "KK %s %zd %d %c %s\n", fmtstr, len, check, f.s[check], f.s ); 1005 1019 1006 if ( ! f.flags.rwd && f.s[check] != '\0' )// sentinel overwritten ?1020 if (! f.flags.ignore && ! f.flags.rwd && f.s[check] != '\0' ) // sentinel overwritten ? 1007 1021 throw (cstring_length){ &cstring_length_vt }; 1008 1022 -
tests/collections/.expect/string-istream-manip.txt
r097c8d0 rb67b632 12 12 12 wwwwwwww 13 13 13 wwwwwwww 14 14 cccc 15 15 14 16 1 yyyyyyyyyyyyyyyyyyyy 15 17 2 abcxxx … … 25 27 12 wwwwwwww 26 28 13 wwwwwwww 29 14 cccc 30 15 -
tests/collections/.in/string-istream-manip.txt
r097c8d0 rb67b632 1 1 abc 2 abc2 cccccb 3 3 xx 4 4 abcxxx 5 5 abcyyy 6 6 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww 7 uuuuuccccuuuuu 7 8 abc 8 abc9 cccccb 9 10 xx 10 11 abcxxx 11 12 abcyyy 12 13 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww 14 uuuuuccccuuuuu -
tests/collections/string-istream-manip.cfa
r097c8d0 rb67b632 23 23 sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; 24 24 sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; 25 } 25 26 s = "q"; 27 sin | incl( "abc", s ); sout | "14" | s; 28 s = "q"; 29 sin | excl( "u", s ); sout | "15" | s; 30 sin | skip( "u" ); 31 sin | "\n"; 32 } 26 33 { 27 34 string_res s = "yyyyyyyyyyyyyyyyyyyy"; … … 41 48 sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; 42 49 sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; 50 51 s = "q"; 52 sin | incl( "abc", s ); sout | "14" | s; 53 s = "q"; 54 sin | excl( "u", s ); sout | "15" | s; 55 sin | skip( "u" ); 56 sin | "\n"; 43 57 } 44 58 } -
tests/io/.expect/manipulatorsInput.arm64.txt
r097c8d0 rb67b632 15 15 12 wwwwwwww 16 16 13 wwwwwwww 17 14 rc=1, cccc 18 15 rc=0, q 17 19 1 yyyyyyyyyyyyyyyyyyyy 18 20 2 abcxxx … … 28 30 12 wwwwwwww 29 31 13 wwwwwwww 32 14 cccc 33 15 30 34 a 31 35 a -
tests/io/.expect/manipulatorsInput.x64.txt
r097c8d0 rb67b632 15 15 12 wwwwwwww 16 16 13 wwwwwwww 17 14 rc=1, cccc 18 15 rc=0, q 17 19 1 yyyyyyyyyyyyyyyyyyyy 18 20 2 abcxxx … … 28 30 12 wwwwwwww 29 31 13 wwwwwwww 32 14 cccc 33 15 30 34 a 31 35 a -
tests/io/.expect/manipulatorsInput.x86.txt
r097c8d0 rb67b632 15 15 12 wwwwwwww 16 16 13 wwwwwwww 17 14 rc=1, cccc 18 15 rc=0, q 17 19 1 yyyyyyyyyyyyyyyyyyyy 18 20 2 abcxxx … … 28 30 12 wwwwwwww 29 31 13 wwwwwwww 32 14 cccc 33 15 30 34 a 31 35 a -
tests/io/.in/manipulatorsInput.txt
r097c8d0 rb67b632 2 2 123456789 3 3 abc 4 abc4 cccccb 5 5 xx 6 6 abcxxx 7 7 abcyyy 8 8 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww 9 uuuuuccccuuuuu 9 10 abc 10 abc11 cccccb 11 12 xx 12 13 abcxxx 13 14 abcyyy 14 15 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww 16 uuuuuccccuuuuu 15 17 ab 16 18 0xff 017 15-15 -
tests/io/manipulatorsInput.cfa
r097c8d0 rb67b632 52 52 { 53 53 char s[] = "yyyyyyyyyyyyyyyyyyyy"; 54 const char sk [] = "abc";55 scanf( "abc " ); scanf( sk ); for ( 5 ) scanf( "%*c" );printf( "1 %s\n", s );54 const char sk_fmt[] = "%*[abc]"; 55 scanf( "abc " ); scanf( sk_fmt ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s ); 56 56 scanf( "%s", s ); printf( "2 %s\n", s ); 57 57 scanf( "%*s" ); printf( "3 %s\n", s ); … … 67 67 scanf( "%*8[abc]" ); printf( "12 %s\n", s ); 68 68 scanf( "%*8[^abc]" ); printf( "13 %s\n", s ); 69 70 int rc; 71 s[0] = 'q'; s[1] = '\0'; rc = 99; 72 rc = scanf( "%[abc]", s ); printf( "14 rc=%d, %s\n", rc, s ); 73 s[0] = 'q'; s[1] = '\0'; rc = 99; 74 rc = scanf( "%[^u]", s ); printf( "15 rc=%d, %s\n", rc, s ); 75 scanf( "%*[u]" ); 76 scanf("\n"); 69 77 } 70 78 { … … 85 93 sin | ignore( incl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "12" | s; 86 94 sin | ignore( excl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "13" | s; 95 96 s[0] = 'q'; s[1] = '\0'; 97 sin | incl( "abc", wdi( sizeof(s), s ) ); sout | "14" | s; 98 s[0] = 'q'; s[1] = '\0'; 99 sin | excl( "u", wdi( sizeof(s), s ) ); sout | "15" | s; 100 sin | skip( "u" ); 101 sin | "\n"; 87 102 } 88 103 /* Keep harmonized with collections/string-istream-manip */
Note: See TracChangeset
for help on using the changeset viewer.