Changeset 5ea5b28 for libcfa/src


Ignore:
Timestamp:
Dec 22, 2018, 11:19:24 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
bd07b15
Parents:
760235a
Message:

update iostream

Location:
libcfa/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    r760235a r5ea5b28  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 08:34:28 2018
    13 // Update Count     : 298
     12// Last Modified On : Sat Dec 22 17:01:54 2018
     13// Update Count     : 302
    1414//
    1515
     
    2626#define IO_MSG "I/O error: "
    2727
    28 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool nonlManip, const char * separator, const char * tupleSeparator ) {
     28void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool prt, const char * separator, const char * tupleSeparator ) {
    2929        os.file = file;
    3030        os.sepDefault = sepDefault;
    3131        os.sepOnOff = sepOnOff;
    3232        os.nlOnOff = nlOnOff;
    33         os.nonlManip = nonlManip;
     33        os.prt = prt;
    3434        sepSet( os, separator );
    3535        sepSetCur( os, sepGet( os ) );
     
    4646void setNL( ofstream & os, bool state ) { os.sawNL = state; }
    4747bool getANL( ofstream & os ) { return os.nlOnOff; }
    48 bool getNonl( ofstream & os ) { return os.nonlManip; }
    49 void setNonl( ofstream & os, bool state ) { os.nonlManip = state; }
     48bool getPrt( ofstream & os ) { return os.prt; }
     49void setPrt( ofstream & os, bool state ) { os.prt = state; }
    5050
    5151// public
     
    150150        va_end( args );
    151151
     152        setPrt( os, true );
    152153        sepReset( os );                                                                         // reset separator
    153154        return len;
  • libcfa/src/fstream.hfa

    r760235a r5ea5b28  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 12 07:52:41 2018
    13 // Update Count     : 143
     12// Last Modified On : Sat Dec 22 17:55:37 2018
     13// Update Count     : 148
    1414//
    1515
     
    2424        bool sepOnOff;
    2525        bool nlOnOff;
    26         bool nonlManip;
     26        bool prt;                                                                                       // print text
    2727        bool sawNL;
    2828        const char * sepCur;
     
    4040void setNL( ofstream &, bool );
    4141bool getANL( ofstream & );
    42 bool getNonl( ofstream & );
    43 void setNonl( ofstream &, bool );
     42bool getPrt( ofstream & );
     43void setPrt( ofstream &, bool );
    4444
    4545// public
  • libcfa/src/iostream.cfa

    r760235a r5ea5b28  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec 13 14:13:22 2018
    13 // Update Count     : 548
     12// Last Modified On : Sat Dec 22 23:09:56 2018
     13// Update Count     : 569
    1414//
    1515
     
    3434        void ?|?( ostype & os, bool b ) {
    3535                (ostype)(os | b); if ( getANL( os ) ) nl( os );
     36                setPrt( os, false );                                                    // turn off
    3637        } // ?|?
    3738
     
    4344        void ?|?( ostype & os, char c ) {
    4445                (ostype)(os | c); if ( getANL( os ) ) nl( os );
     46                setPrt( os, false );                                                    // turn off
    4547        } // ?|?
    4648
     
    5254        void ?|?( ostype & os, signed char sc ) {
    5355                (ostype)(os | sc); if ( getANL( os ) ) nl( os );
     56                setPrt( os, false );                                                    // turn off
    5457        } // ?|?
    5558
     
    6164        void ?|?( ostype & os, unsigned char usc ) {
    6265                (ostype)(os | usc); if ( getANL( os ) ) nl( os );
     66                setPrt( os, false );                                                    // turn off
    6367        } // ?|?
    6468
     
    7074        void & ?|?( ostype & os, short int si ) {
    7175                (ostype)(os | si); if ( getANL( os ) ) nl( os );
     76                setPrt( os, false );                                                    // turn off
    7277        } // ?|?
    7378
     
    7984        void & ?|?( ostype & os, unsigned short int usi ) {
    8085                (ostype)(os | usi); if ( getANL( os ) ) nl( os );
     86                setPrt( os, false );                                                    // turn off
    8187        } // ?|?
    8288
     
    8894        void & ?|?( ostype & os, int i ) {
    8995                (ostype)(os | i); if ( getANL( os ) ) nl( os );
     96                setPrt( os, false );                                                    // turn off
    9097        } // ?|?
    9198
     
    97104        void & ?|?( ostype & os, unsigned int ui ) {
    98105                (ostype)(os | ui); if ( getANL( os ) ) nl( os );
     106                setPrt( os, false );                                                    // turn off
    99107        } // ?|?
    100108
     
    106114        void & ?|?( ostype & os, long int li ) {
    107115                (ostype)(os | li); if ( getANL( os ) ) nl( os );
     116                setPrt( os, false );                                                    // turn off
    108117        } // ?|?
    109118
     
    115124        void & ?|?( ostype & os, unsigned long int uli ) {
    116125                (ostype)(os | uli); if ( getANL( os ) ) nl( os );
     126                setPrt( os, false );                                                    // turn off
    117127        } // ?|?
    118128
     
    124134        void & ?|?( ostype & os, long long int lli ) {
    125135                (ostype)(os | lli); if ( getANL( os ) ) nl( os );
     136                setPrt( os, false );                                                    // turn off
    126137        } // ?|?
    127138
     
    133144        void & ?|?( ostype & os, unsigned long long int ulli ) {
    134145                (ostype)(os | ulli); if ( getANL( os ) ) nl( os );
     146                setPrt( os, false );                                                    // turn off
    135147        } // ?|?
    136148
     
    142154        void & ?|?( ostype & os, float f ) {
    143155                (ostype)(os | f); if ( getANL( os ) ) nl( os );
     156                setPrt( os, false );                                                    // turn off
    144157        } // ?|?
    145158
     
    151164        void & ?|?( ostype & os, double d ) {
    152165                (ostype)(os | d); if ( getANL( os ) ) nl( os );
     166                setPrt( os, false );                                                    // turn off
    153167        } // ?|?
    154168
     
    160174        void & ?|?( ostype & os, long double ld ) {
    161175                (ostype)(os | ld); if ( getANL( os ) ) nl( os );
     176                setPrt( os, false );                                                    // turn off
    162177        } // ?|?
    163178
     
    169184        void & ?|?( ostype & os, float _Complex fc ) {
    170185                (ostype)(os | fc); if ( getANL( os ) ) nl( os );
     186                setPrt( os, false );                                                    // turn off
    171187        } // ?|?
    172188
     
    178194        void & ?|?( ostype & os, double _Complex dc ) {
    179195                (ostype)(os | dc); if ( getANL( os ) ) nl( os );
     196                setPrt( os, false );                                                    // turn off
    180197        } // ?|?
    181198
     
    187204        void & ?|?( ostype & os, long double _Complex ldc ) {
    188205                (ostype)(os | ldc); if ( getANL( os ) ) nl( os );
     206                setPrt( os, false );                                                    // turn off
    189207        } // ?|?
    190208
     
    229247        void ?|?( ostype & os, const char * str ) {
    230248                (ostype)(os | str); if ( getANL( os ) ) nl( os );
     249                setPrt( os, false );                                                    // turn off
    231250        } // ?|?
    232251
     
    258277        void ?|?( ostype & os, const void * p ) {
    259278                (ostype)(os | p); if ( getANL( os ) ) nl( os );
     279                setPrt( os, false );                                                    // turn off
    260280        } // ?|?
    261281
     
    263283        ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    264284                (ostype)(manip( os ));
    265                 setNonl( os, false );                                                   // ignore nonl in middle
    266285                return os;
    267286        } // ?|?
    268287        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    269288                (ostype)(manip( os ));
    270                 if ( getANL( os ) && ! getNonl( os ) ) nl( os ); // ignore nl if nonl at end
    271                 setNonl( os, false );
     289                if ( getANL( os ) && getPrt( os ) ) nl( os );   // ignore auto nl?
     290                setPrt( os, false );                                                    // turn off
    272291        } // ?|?
    273292
     
    282301        ostype & nl( ostype & os ) {
    283302                (ostype)(os | '\n');
     303                setPrt( os, false );                                                    // turn off
    284304                setNL( os, true );
    285305                flush( os );
     
    288308
    289309        ostype & nonl( ostype & os ) {
    290                 setNonl( os, true );                                                    // indicate nonl manipulator
     310                setPrt( os, false );                                                    // turn off
    291311                return os;
    292312        } // nonl
     
    339359                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
    340360                if ( getANL( os ) ) nl( os );
     361                setPrt( os, false );                                                    // turn off
    341362        } // ?|?
    342363} // distribution
  • libcfa/src/iostream.hfa

    r760235a r5ea5b28  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 11 22:01:31 2018
    13 // Update Count     : 213
     12// Last Modified On : Sat Dec 22 17:00:39 2018
     13// Update Count     : 218
    1414//
    1515
     
    2828        void setNL( ostype &, bool );                                           // saw newline
    2929        bool getANL( ostype & );                                                        // check auto newline
    30         bool getNonl( ostype & );                                                       // check nonnl manipulator
    31         void setNonl( ostype &, bool );                                         // set nonnl manipulator
     30        bool getPrt( ostype & );                                                        // check ignore auto NL
     31        void setPrt( ostype &, bool );                                          // set ignore auto NL
    3232        // public
    3333        void sepOn( ostype & );                                                         // turn separator state on
     
    6363forall( dtype ostype | ostream( ostype ) ) {
    6464        ostype & ?|?( ostype &, bool );
    65         void & ?|?( ostype &, bool );
     65        void ?|?( ostype &, bool );
    6666
    6767        ostype & ?|?( ostype &, char );
    68         void & ?|?( ostype &, char );
     68        void ?|?( ostype &, char );
    6969        ostype & ?|?( ostype &, signed char );
    70         void & ?|?( ostype &, signed char );
     70        void ?|?( ostype &, signed char );
    7171        ostype & ?|?( ostype &, unsigned char );
    72         void & ?|?( ostype &, unsigned char );
     72        void ?|?( ostype &, unsigned char );
    7373
    7474        ostype & ?|?( ostype &, short int );
    75         void & ?|?( ostype &, short int );
     75        void ?|?( ostype &, short int );
    7676        ostype & ?|?( ostype &, unsigned short int );
    77         void & ?|?( ostype &, unsigned short int );
     77        void ?|?( ostype &, unsigned short int );
    7878        ostype & ?|?( ostype &, int );
    79         void & ?|?( ostype &, int );
     79        void ?|?( ostype &, int );
    8080        ostype & ?|?( ostype &, unsigned int );
    81         void & ?|?( ostype &, unsigned int );
     81        void ?|?( ostype &, unsigned int );
    8282        ostype & ?|?( ostype &, long int );
    83         void & ?|?( ostype &, long int );
     83        void ?|?( ostype &, long int );
    8484        ostype & ?|?( ostype &, long long int );
    85         void & ?|?( ostype &, long long int );
     85        void ?|?( ostype &, long long int );
    8686        ostype & ?|?( ostype &, unsigned long int );
    87         void & ?|?( ostype &, unsigned long int );
     87        void ?|?( ostype &, unsigned long int );
    8888        ostype & ?|?( ostype &, unsigned long long int );
    89         void & ?|?( ostype &, unsigned long long int );
     89        void ?|?( ostype &, unsigned long long int );
    9090
    9191        ostype & ?|?( ostype &, float ); // FIX ME: should not be required
    92         void & ?|?( ostype &, float ); // FIX ME: should not be required
     92        void ?|?( ostype &, float ); // FIX ME: should not be required
    9393        ostype & ?|?( ostype &, double );
    94         void & ?|?( ostype &, double );
     94        void ?|?( ostype &, double );
    9595        ostype & ?|?( ostype &, long double );
    96         void & ?|?( ostype &, long double );
     96        void ?|?( ostype &, long double );
    9797
    9898        ostype & ?|?( ostype &, float _Complex );
    99         void & ?|?( ostype &, float _Complex );
     99        void ?|?( ostype &, float _Complex );
    100100        ostype & ?|?( ostype &, double _Complex );
    101         void & ?|?( ostype &, double _Complex );
     101        void ?|?( ostype &, double _Complex );
    102102        ostype & ?|?( ostype &, long double _Complex );
    103         void & ?|?( ostype &, long double _Complex );
     103        void ?|?( ostype &, long double _Complex );
    104104
    105105        ostype & ?|?( ostype &, const char * );
    106         void & ?|?( ostype &, const char * );
     106        void ?|?( ostype &, const char * );
    107107        // ostype & ?|?( ostype &, const char16_t * );
    108108#if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
     
    111111        // ostype & ?|?( ostype &, const wchar_t * );
    112112        ostype & ?|?( ostype &, const void * );
    113         void & ?|?( ostype &, const void * );
     113        void ?|?( ostype &, const void * );
    114114
    115115        // manipulators
  • libcfa/src/stdlib.hfa

    r760235a r5ea5b28  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 27 07:21:36 2018
    13 // Update Count     : 345
     12// Last Modified On : Mon Dec 17 15:37:45 2018
     13// Update Count     : 346
    1414//
    1515
     
    178178
    179179static inline {
    180         int ato( const char * sptr ) {return (int)strtol( sptr, 0, 10 ); }
     180        int ato( const char * sptr ) { return (int)strtol( sptr, 0, 10 ); }
    181181        unsigned int ato( const char * sptr ) { return (unsigned int)strtoul( sptr, 0, 10 ); }
    182182        long int ato( const char * sptr ) { return strtol( sptr, 0, 10 ); }
Note: See TracChangeset for help on using the changeset viewer.