Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r9d362a0 rad72c8b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec 24 18:33:40 2018
    13 // Update Count     : 589
     12// Last Modified On : Thu Dec 13 14:13:22 2018
     13// Update Count     : 548
    1414//
    1515
     
    3333        } // ?|?
    3434        void ?|?( ostype & os, bool b ) {
    35                 (ostype &)(os | b); nl( os );
     35                (ostype)(os | b); if ( getANL( os ) ) nl( os );
    3636        } // ?|?
    3737
     
    4242        } // ?|?
    4343        void ?|?( ostype & os, char c ) {
    44                 (ostype &)(os | c); nl( os );
     44                (ostype)(os | c); if ( getANL( os ) ) nl( os );
    4545        } // ?|?
    4646
     
    5151        } // ?|?
    5252        void ?|?( ostype & os, signed char sc ) {
    53                 (ostype &)(os | sc); nl( os );
     53                (ostype)(os | sc); if ( getANL( os ) ) nl( os );
    5454        } // ?|?
    5555
     
    6060        } // ?|?
    6161        void ?|?( ostype & os, unsigned char usc ) {
    62                 (ostype &)(os | usc); nl( os );
     62                (ostype)(os | usc); if ( getANL( os ) ) nl( os );
    6363        } // ?|?
    6464
     
    6969        } // ?|?
    7070        void & ?|?( ostype & os, short int si ) {
    71                 (ostype &)(os | si); nl( os );
     71                (ostype)(os | si); if ( getANL( os ) ) nl( os );
    7272        } // ?|?
    7373
     
    7878        } // ?|?
    7979        void & ?|?( ostype & os, unsigned short int usi ) {
    80                 (ostype &)(os | usi); nl( os );
     80                (ostype)(os | usi); if ( getANL( os ) ) nl( os );
    8181        } // ?|?
    8282
     
    8787        } // ?|?
    8888        void & ?|?( ostype & os, int i ) {
    89                 (ostype &)(os | i); nl( os );
     89                (ostype)(os | i); if ( getANL( os ) ) nl( os );
    9090        } // ?|?
    9191
     
    9696        } // ?|?
    9797        void & ?|?( ostype & os, unsigned int ui ) {
    98                 (ostype &)(os | ui); nl( os );
     98                (ostype)(os | ui); if ( getANL( os ) ) nl( os );
    9999        } // ?|?
    100100
     
    105105        } // ?|?
    106106        void & ?|?( ostype & os, long int li ) {
    107                 (ostype &)(os | li); nl( os );
     107                (ostype)(os | li); if ( getANL( os ) ) nl( os );
    108108        } // ?|?
    109109
     
    114114        } // ?|?
    115115        void & ?|?( ostype & os, unsigned long int uli ) {
    116                 (ostype &)(os | uli); nl( os );
     116                (ostype)(os | uli); if ( getANL( os ) ) nl( os );
    117117        } // ?|?
    118118
     
    123123        } // ?|?
    124124        void & ?|?( ostype & os, long long int lli ) {
    125                 (ostype &)(os | lli); nl( os );
     125                (ostype)(os | lli); if ( getANL( os ) ) nl( os );
    126126        } // ?|?
    127127
     
    132132        } // ?|?
    133133        void & ?|?( ostype & os, unsigned long long int ulli ) {
    134                 (ostype &)(os | ulli); nl( os );
     134                (ostype)(os | ulli); if ( getANL( os ) ) nl( os );
    135135        } // ?|?
    136136
     
    141141        } // ?|?
    142142        void & ?|?( ostype & os, float f ) {
    143                 (ostype &)(os | f); nl( os );
     143                (ostype)(os | f); if ( getANL( os ) ) nl( os );
    144144        } // ?|?
    145145
     
    150150        } // ?|?
    151151        void & ?|?( ostype & os, double d ) {
    152                 (ostype &)(os | d); nl( os );
     152                (ostype)(os | d); if ( getANL( os ) ) nl( os );
    153153        } // ?|?
    154154
     
    159159        } // ?|?
    160160        void & ?|?( ostype & os, long double ld ) {
    161                 (ostype &)(os | ld); nl( os );
     161                (ostype)(os | ld); if ( getANL( os ) ) nl( os );
    162162        } // ?|?
    163163
     
    168168        } // ?|?
    169169        void & ?|?( ostype & os, float _Complex fc ) {
    170                 (ostype &)(os | fc); nl( os );
     170                (ostype)(os | fc); if ( getANL( os ) ) nl( os );
    171171        } // ?|?
    172172
     
    177177        } // ?|?
    178178        void & ?|?( ostype & os, double _Complex dc ) {
    179                 (ostype &)(os | dc); nl( os );
     179                (ostype)(os | dc); if ( getANL( os ) ) nl( os );
    180180        } // ?|?
    181181
     
    186186        } // ?|?
    187187        void & ?|?( ostype & os, long double _Complex ldc ) {
    188                 (ostype &)(os | ldc); nl( os );
     188                (ostype)(os | ldc); if ( getANL( os ) ) nl( os );
    189189        } // ?|?
    190190
     
    228228        } // ?|?
    229229        void ?|?( ostype & os, const char * str ) {
    230                 (ostype &)(os | str); nl( os );
     230                (ostype)(os | str); if ( getANL( os ) ) nl( os );
    231231        } // ?|?
    232232
     
    257257        } // ?|?
    258258        void ?|?( ostype & os, const void * p ) {
    259                 (ostype &)(os | p); nl( os );
     259                (ostype)(os | p); if ( getANL( os ) ) nl( os );
    260260        } // ?|?
    261261
    262262        // manipulators
    263263        ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    264                 (ostype &)(manip( os ));
     264                (ostype)(manip( os ));
     265                setNonl( os, false );                                                   // ignore nonl in middle
    265266                return os;
    266267        } // ?|?
    267268        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    268                 (ostype &)(manip( os ));
    269                 if ( getPrt( os ) ) nl( os );                                   // something printed ?
    270                 setPrt( os, false );                                                    // turn off
     269                (ostype)(manip( os ));
     270                if ( getANL( os ) && ! getNonl( os ) ) nl( os ); // ignore nl if nonl at end
     271                setNonl( os, false );
    271272        } // ?|?
    272273
    273274        ostype & sep( ostype & os ) {
    274                 return (ostype &)(os | sepGet( os ));
     275                return (ostype)(os | sepGet( os ));
    275276        } // sep
    276277
     
    280281
    281282        ostype & nl( ostype & os ) {
    282                 (ostype &)(os | '\n');
    283                 setPrt( os, false );                                                    // turn off
     283                (ostype)(os | '\n');
    284284                setNL( os, true );
    285285                flush( os );
     
    287287        } // nl
    288288
    289         void nl( ostype & os ) {
    290                 if ( getANL( os ) ) (ostype &)(nl( os ));               // implementation only
    291                 else setPrt( os, false );                                               // turn off
    292         } // nl
    293 
    294289        ostype & nonl( ostype & os ) {
    295                 setPrt( os, false );                                                    // turn off
     290                setNonl( os, true );                                                    // indicate nonl manipulator
    296291                return os;
    297292        } // nonl
     
    331326forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
    332327        ostype & ?|?( ostype & os, T arg, Params rest ) {
    333                 (ostype &)(os | arg);                                                   // print first argument
     328                (ostype)(os | arg);                                                             // print first argument
    334329                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
    335                 (ostype &)(os | rest);                                                  // print remaining arguments
     330                (ostype)(os | rest);                                                    // print remaining arguments
    336331                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
    337332                return os;
    338333        } // ?|?
    339334        void ?|?( ostype & os, T arg, Params rest ) {
    340                 // (ostype &)(?|?( os, arg, rest )); nl( os );
    341                 (ostype &)(os | arg);                                                   // print first argument
     335//              (ostype)(?|?( os, arg, rest )); if ( getANL( os ) ) nl( os );
     336                (ostype)(os | arg);                                                             // print first argument
    342337                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
    343                 (ostype &)(os | rest);                                                  // print remaining arguments
     338                (ostype)(os | rest);                                                    // print remaining arguments
    344339                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
    345                 nl( os );
     340                if ( getANL( os ) ) nl( os );
    346341        } // ?|?
    347342} // distribution
Note: See TracChangeset for help on using the changeset viewer.