Changes in / [6625727:432ce7a]


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r6625727 r432ce7a  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 12 15:00:31 2019
    13 // Update Count     : 819
     12// Last Modified On : Mon Jun 10 18:06:16 2019
     13// Update Count     : 809
    1414//
    1515
     
    740740        } // ?|?
    741741
    742         istype & ?|?( istype & is, const char * fmt ) {
    743                 fmt( is, fmt, "" );
    744                 return is;
    745         } // ?|?
    746 
    747         istype & ?|?( istype & is, char * s ) {
    748                 fmt( is, "%s", s );
    749                 return is;
    750         } // ?|?
    751 
    752742        // manipulators
    753743        istype & ?|?( istype & is, istype & (* manip)( istype & ) ) {
     
    777767        // skip xxx
    778768        if ( ! f.s ) {
    779                 //printf( "skip %s %d\n", f.scanset, f.wd );
    780                 if ( f.wd != -1 ) for ( f.wd ) fmt( is, "%*c" ); // no input arguments
    781                 else fmt( is, f.scanset, "" );
     769                // printf( "skip %s\n", f.scanset );
     770                fmt( is, f.scanset, "" );                                               // no input arguments
    782771                return is;
    783772        } // if
  • libcfa/src/iostream.hfa

    r6625727 r432ce7a  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 12 13:35:42 2019
    13 // Update Count     : 331
     12// Last Modified On : Mon Jun 10 18:05:13 2019
     13// Update Count     : 320
    1414//
    1515
     
    190190        _Ostream_Manip(T) sign( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, CODE, { .flags.sign : true } }; } \
    191191        _Ostream_Manip(T) & sign( _Ostream_Manip(T) & fmt ) { fmt.flags.sign = true; return fmt; } \
    192 } /* distribution */ \
     192} \
    193193forall( dtype ostype | ostream( ostype ) ) { \
    194194        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \
     
    227227        _Ostream_Manip(T) nodp( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'g', { .flags.nobsdp : true } }; } \
    228228        _Ostream_Manip(T) & nodp( _Ostream_Manip(T) & fmt ) { fmt.flags.nobsdp = true; return fmt; } \
    229 } /* distribution */ \
     229} \
    230230forall( dtype ostype | ostream( ostype ) ) { \
    231231        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ); \
     
    239239
    240240static inline {
    241         _Ostream_Manip(char) bin( char c ) { return (_Ostream_Manip(char))@{ c, 1, 0, 'b', { .all : 0 } }; }
    242         _Ostream_Manip(char) oct( char c ) { return (_Ostream_Manip(char))@{ c, 1, 0, 'o', { .all : 0 } }; }
    243         _Ostream_Manip(char) hex( char c ) { return (_Ostream_Manip(char))@{ c, 1, 0, 'x', { .all : 0 } }; }
    244         _Ostream_Manip(char) wd( unsigned int w, char c ) { return (_Ostream_Manip(char))@{ c, w, 0, 'c', { .all : 0 } }; }
     241        _Ostream_Manip(char) bin( char val ) { return (_Ostream_Manip(char))@{ val, 1, 0, 'b', { .all : 0 } }; }
     242        _Ostream_Manip(char) oct( char val ) { return (_Ostream_Manip(char))@{ val, 1, 0, 'o', { .all : 0 } }; }
     243        _Ostream_Manip(char) hex( char val ) { return (_Ostream_Manip(char))@{ val, 1, 0, 'x', { .all : 0 } }; }
     244        _Ostream_Manip(char) wd( unsigned int w, char val ) { return (_Ostream_Manip(char))@{ val, w, 0, 'c', { .all : 0 } }; }
    245245        _Ostream_Manip(char) & wd( unsigned int w, _Ostream_Manip(char) & fmt ) { fmt.wd = w; return fmt; }
    246246        _Ostream_Manip(char) & left( _Ostream_Manip(char) & fmt ) { fmt.flags.left = true; return fmt; }
     
    256256
    257257static inline {
    258         _Ostream_Manip(const char *) bin( const char * s ) { return (_Ostream_Manip(const char *))@{ s, 1, 0, 'b', { .all : 0 } }; }
    259         _Ostream_Manip(const char *) oct( const char * s ) { return (_Ostream_Manip(const char *))@{ s, 1, 0, 'o', { .all : 0 } }; }
    260         _Ostream_Manip(const char *) hex( const char * s ) { return (_Ostream_Manip(const char *))@{ s, 1, 0, 'x', { .all : 0 } }; }
    261         _Ostream_Manip(const char *) wd( unsigned int w, const char * s ) { return (_Ostream_Manip(const char *))@{ s, w, 0, 's', { .all : 0 } }; }
    262         _Ostream_Manip(const char *) wd( unsigned int w, unsigned char pc, const char * s ) { return (_Ostream_Manip(const char *))@{ s, w, pc, 's', { .flags.pc : true } }; }
     258        _Ostream_Manip(const char *) bin( const char * val ) { return (_Ostream_Manip(const char *))@{ val, 1, 0, 'b', { .all : 0 } }; }
     259        _Ostream_Manip(const char *) oct( const char * val ) { return (_Ostream_Manip(const char *))@{ val, 1, 0, 'o', { .all : 0 } }; }
     260        _Ostream_Manip(const char *) hex( const char * val ) { return (_Ostream_Manip(const char *))@{ val, 1, 0, 'x', { .all : 0 } }; }
     261        _Ostream_Manip(const char *) wd( unsigned int w, const char * val ) { return (_Ostream_Manip(const char *))@{ val, w, 0, 's', { .all : 0 } }; }
     262        _Ostream_Manip(const char *) wd( unsigned int w, unsigned char pc, const char * val ) { return (_Ostream_Manip(const char *))@{ val, w, pc, 's', { .flags.pc : true } }; }
    263263        _Ostream_Manip(const char *) & wd( unsigned int w, _Ostream_Manip(const char *) & fmt ) { fmt.wd = w; return fmt; }
    264264        _Ostream_Manip(const char *) & wd( unsigned int w, unsigned char pc, _Ostream_Manip(const char *) & fmt ) { fmt.wd = w; fmt.pc = pc; fmt.flags.pc = true; return fmt; }
     
    316316        istype & ?|?( istype &, long double _Complex & );
    317317
    318         istype & ?|?( istype &, const char * );
    319         istype & ?|?( istype &, char * );
     318        // Cannot have char & and char * => cstr manipulator
     319        // istype & ?|?( istype &, char * );
    320320
    321321        // manipulators
     
    341341}; // _Istream_Cstr
    342342
    343 static inline {
    344         _Istream_Cstr skip( unsigned int n ) { return (_Istream_Cstr){ 0p, 0p, n, { .all : 0 } }; }
    345         _Istream_Cstr skip( const char * scanset ) { return (_Istream_Cstr){ 0p, scanset, -1, { .all : 0 } }; }
    346         _Istream_Cstr incl( const char * scanset, char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : false } }; }
    347         _Istream_Cstr & incl( const char * scanset, _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = false; return fmt; }
    348         _Istream_Cstr excl( const char * scanset, char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : true } }; }
    349         _Istream_Cstr & excl( const char * scanset, _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; }
    350         _Istream_Cstr ignore( const char * s ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true } }; }
    351         _Istream_Cstr & ignore( _Istream_Cstr & fmt ) { fmt.flags.ignore = true; return fmt; }
    352         _Istream_Cstr wd( unsigned int w, char * s ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0 } }; }
    353         _Istream_Cstr & wd( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; }
    354 } // distribution
     343static inline _Istream_Cstr skip( const char * scanset ) { return (_Istream_Cstr){ 0p, scanset, -1, { .all : 0 } }; }
     344static inline _Istream_Cstr incl( const char * scanset, char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : false } }; }
     345static inline _Istream_Cstr incl( const char * scanset, _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = false; return fmt; }
     346static inline _Istream_Cstr excl( const char * scanset, char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : true } }; }
     347static inline _Istream_Cstr excl( const char * scanset, _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; }
     348static inline _Istream_Cstr cstr( char * s ) { return (_Istream_Cstr){ s, 0p, -1, { .all : 0 } }; }
     349static inline _Istream_Cstr ignore( const char * s ) { return (_Istream_Cstr)@{ 0p, 0p, -1, { .flags.ignore : true } }; }
     350static inline _Istream_Cstr ignore( _Istream_Cstr & fmt ) { fmt.flags.ignore = true; return fmt; }
     351static inline _Istream_Cstr wd( unsigned int w, char * s ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0 } }; }
     352static inline _Istream_Cstr wd( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; }
    355353forall( dtype istype | istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f );
    356354
     
    359357}; // _Istream_Char
    360358
    361 static inline {
    362         _Istream_Char ignore( const char c ) { return (_Istream_Char)@{ true }; }
    363         _Istream_Char & ignore( _Istream_Char & fmt ) { fmt.ignore = true; return fmt; }
    364 } // distribution
     359static inline _Istream_Char ignore( const char c ) { return (_Istream_Char)@{ true }; }
     360static inline _Istream_Char ignore( _Istream_Char & fmt ) { fmt.ignore = true; return fmt; }
    365361forall( dtype istype | istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f );
    366362
     
    373369
    374370#define InputFMTDecl( T ) \
    375 static inline { \
    376         _Istream_Manip(T) ignore( const T & val ) { return (_Istream_Manip(T))@{ (T &)val, -1, true }; } \
    377         _Istream_Manip(T) & ignore( _Istream_Manip(T) & fmt ) { fmt.ignore = true; return fmt; } \
    378         _Istream_Manip(T) wdi( unsigned int w, T & val ) { return (_Istream_Manip(T))@{ val, w, false }; } \
    379         _Istream_Manip(T) & wd( unsigned int w, _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \
    380 } /* distribution */ \
     371static inline _Istream_Manip(T) ignore( const T & val ) { return (_Istream_Manip(T))@{ (T &)val, -1, true }; } \
     372static inline _Istream_Manip(T) ignore( _Istream_Manip(T) & fmt ) { fmt.ignore = true; return fmt; } \
     373static inline _Istream_Manip(T) wdi( unsigned int w, T & val ) { return (_Istream_Manip(T))@{ val, w, false }; } \
    381374forall( dtype istype | istream( istype ) ) { \
    382375        istype & ?|?( istype & is, _Istream_Manip(T) f ); \
  • tests/.in/manipulatorsInput.txt

    r6625727 r432ce7a  
    1 abc
    2 abc
    3 xx
     1abc
    42abcxxx
    53abcyyy
    64aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwww
    7 abc
    8 abc
    9 xx
     5abc
    106abcxxx
    117abcyyy
Note: See TracChangeset for help on using the changeset viewer.