Changes in / [097c8d0:b67b632]


Ignore:
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r097c8d0 rb67b632  
    960960        istype & ?|?( istype & is, _Istream_Cskip f ) {
    961961                // 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                }
    963974                else for ( f.wd ) fmt( is, "%*c" );
    964975                return is;
     
    10001011
    10011012                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                }
    10031017                len = fmt( is, fmtstr, f.s );
    10041018                //fprintf( stderr, "KK %s %zd %d %c %s\n", fmtstr, len, check, f.s[check], f.s );
    10051019
    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 ?
    10071021                        throw (cstring_length){ &cstring_length_vt };
    10081022
  • tests/collections/.expect/string-istream-manip.txt

    r097c8d0 rb67b632  
    121212 wwwwwwww
    131313 wwwwwwww
     1414 cccc
     1515
    14161 yyyyyyyyyyyyyyyyyyyy
    15172 abcxxx
     
    252712 wwwwwwww
    262813 wwwwwwww
     2914 cccc
     3015
  • tests/collections/.in/string-istream-manip.txt

    r097c8d0 rb67b632  
    11abc
    2 abc
     2cccccb
    33xx
    44abcxxx
    55abcyyy
    66aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     7uuuuuccccuuuuu
    78abc
    8 abc
     9cccccb
    910xx
    1011abcxxx
    1112abcyyy
    1213aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     14uuuuuccccuuuuu
  • tests/collections/string-istream-manip.cfa

    r097c8d0 rb67b632  
    2323        sin | ignore( incl( "abc", wdi( 8, s ) ) );     sout | "12" | s;
    2424        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        }
    2633    {
    2734        string_res s = "yyyyyyyyyyyyyyyyyyyy";
     
    4148        sin | ignore( incl( "abc", wdi( 8, s ) ) );     sout | "12" | s;
    4249        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";
    4357    }
    4458}
  • tests/io/.expect/manipulatorsInput.arm64.txt

    r097c8d0 rb67b632  
    151512 wwwwwwww
    161613 wwwwwwww
     1714 rc=1, cccc
     1815 rc=0, q
    17191 yyyyyyyyyyyyyyyyyyyy
    18202 abcxxx
     
    283012 wwwwwwww
    293113 wwwwwwww
     3214 cccc
     3315
    3034a
    3135a
  • tests/io/.expect/manipulatorsInput.x64.txt

    r097c8d0 rb67b632  
    151512 wwwwwwww
    161613 wwwwwwww
     1714 rc=1, cccc
     1815 rc=0, q
    17191 yyyyyyyyyyyyyyyyyyyy
    18202 abcxxx
     
    283012 wwwwwwww
    293113 wwwwwwww
     3214 cccc
     3315
    3034a
    3135a
  • tests/io/.expect/manipulatorsInput.x86.txt

    r097c8d0 rb67b632  
    151512 wwwwwwww
    161613 wwwwwwww
     1714 rc=1, cccc
     1815 rc=0, q
    17191 yyyyyyyyyyyyyyyyyyyy
    18202 abcxxx
     
    283012 wwwwwwww
    293113 wwwwwwww
     3214 cccc
     3315
    3034a
    3135a
  • tests/io/.in/manipulatorsInput.txt

    r097c8d0 rb67b632  
    22123456789
    33abc
    4 abc
     4cccccb
    55xx
    66abcxxx
    77abcyyy
    88aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     9uuuuuccccuuuuu
    910abc
    10 abc
     11cccccb
    1112xx
    1213abcxxx
    1314abcyyy
    1415aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
     16uuuuuccccuuuuu
    1517ab
    16180xff 017 15-15
  • tests/io/manipulatorsInput.cfa

    r097c8d0 rb67b632  
    5252        {
    5353                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 );
    5656                scanf( "%s", s );                                                               printf( "2 %s\n", s );
    5757                scanf( "%*s" );                                                                 printf( "3 %s\n", s );
     
    6767                scanf( "%*8[abc]" );                                                    printf( "12 %s\n", s );
    6868                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");
    6977        }
    7078        {
     
    8593                sin | ignore( incl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "12" | s;
    8694                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";
    87102        }
    88103    /* Keep harmonized with collections/string-istream-manip */
Note: See TracChangeset for help on using the changeset viewer.