Changeset d1a9ff5


Ignore:
Timestamp:
Feb 8, 2020, 7:41:33 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3e274ab
Parents:
095ac99
Message:

change private names to start with $, change NULL to 0p

Location:
libcfa/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    r095ac99 rd1a9ff5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 11:55:29 2020
    13 // Update Count     : 356
     12// Last Modified On : Fri Feb  7 19:01:01 2020
     13// Update Count     : 363
    1414//
    1515
     
    3232
    3333void ?{}( ofstream & os, void * file ) {
    34         os.file = file;
    35         os.sepDefault = true;
    36         os.sepOnOff = false;
    37         os.nlOnOff = true;
    38         os.prt = false;
    39         os.sawNL = false;
     34        os.$file = file;
     35        os.$sepDefault = true;
     36        os.$sepOnOff = false;
     37        os.$nlOnOff = true;
     38        os.$prt = false;
     39        os.$sawNL = false;
     40        $sepSetCur( os, sepGet( os ) );
    4041        sepSet( os, " " );
    41         sepSetCur( os, sepGet( os ) );
    4242        sepSetTuple( os, ", " );
    4343} // ?{}
    4444
    4545// private
    46 bool sepPrt( ofstream & os ) { setNL( os, false ); return os.sepOnOff; }
    47 void sepReset( ofstream & os ) { os.sepOnOff = os.sepDefault; }
    48 void sepReset( ofstream & os, bool reset ) { os.sepDefault = reset; os.sepOnOff = os.sepDefault; }
    49 const char * sepGetCur( ofstream & os ) { return os.sepCur; }
    50 void sepSetCur( ofstream & os, const char sepCur[] ) { os.sepCur = sepCur; }
    51 bool getNL( ofstream & os ) { return os.sawNL; }
    52 void setNL( ofstream & os, bool state ) { os.sawNL = state; }
    53 bool getANL( ofstream & os ) { return os.nlOnOff; }
    54 bool getPrt( ofstream & os ) { return os.prt; }
    55 void setPrt( ofstream & os, bool state ) { os.prt = state; }
     46bool $sepPrt( ofstream & os ) { $setNL( os, false ); return os.$sepOnOff; }
     47void $sepReset( ofstream & os ) { os.$sepOnOff = os.$sepDefault; }
     48void $sepReset( ofstream & os, bool reset ) { os.$sepDefault = reset; os.$sepOnOff = os.$sepDefault; }
     49const char * $sepGetCur( ofstream & os ) { return os.$sepCur; }
     50void $sepSetCur( ofstream & os, const char sepCur[] ) { os.$sepCur = sepCur; }
     51bool $getNL( ofstream & os ) { return os.$sawNL; }
     52void $setNL( ofstream & os, bool state ) { os.$sawNL = state; }
     53bool $getANL( ofstream & os ) { return os.$nlOnOff; }
     54bool $getPrt( ofstream & os ) { return os.$prt; }
     55void $setPrt( ofstream & os, bool state ) { os.$prt = state; }
    5656
    5757// public
    58 void ?{}( ofstream & os ) { os.file = 0; }
     58void ?{}( ofstream & os ) { os.$file = 0p; }
    5959
    6060void ?{}( ofstream & os, const char name[], const char mode[] ) {
     
    7070} // ^?{}
    7171
    72 void sepOn( ofstream & os ) { os.sepOnOff = ! getNL( os ); }
    73 void sepOff( ofstream & os ) { os.sepOnOff = false; }
     72void sepOn( ofstream & os ) { os.$sepOnOff = ! $getNL( os ); }
     73void sepOff( ofstream & os ) { os.$sepOnOff = false; }
    7474
    7575bool sepDisable( ofstream & os ) {
    76         bool temp = os.sepDefault;
    77         os.sepDefault = false;
    78         sepReset( os );
     76        bool temp = os.$sepDefault;
     77        os.$sepDefault = false;
     78        $sepReset( os );
    7979        return temp;
    8080} // sepDisable
    8181
    8282bool sepEnable( ofstream & os ) {
    83         bool temp = os.sepDefault;
    84         os.sepDefault = true;
    85         if ( os.sepOnOff ) sepReset( os );                                      // start of line ?
     83        bool temp = os.$sepDefault;
     84        os.$sepDefault = true;
     85        if ( os.$sepOnOff ) $sepReset( os );                            // start of line ?
    8686        return temp;
    8787} // sepEnable
    8888
    89 void nlOn( ofstream & os ) { os.nlOnOff = true; }
    90 void nlOff( ofstream & os ) { os.nlOnOff = false; }
    91 
    92 const char * sepGet( ofstream & os ) { return os.separator; }
     89void nlOn( ofstream & os ) { os.$nlOnOff = true; }
     90void nlOff( ofstream & os ) { os.$nlOnOff = false; }
     91
     92const char * sepGet( ofstream & os ) { return os.$separator; }
    9393void sepSet( ofstream & os, const char s[] ) {
    9494        assert( s );
    95         strncpy( os.separator, s, sepSize - 1 );
    96         os.separator[sepSize - 1] = '\0';
     95        strncpy( os.$separator, s, sepSize - 1 );
     96        os.$separator[sepSize - 1] = '\0';
    9797} // sepSet
    9898
    99 const char * sepGetTuple( ofstream & os ) { return os.tupleSeparator; }
     99const char * sepGetTuple( ofstream & os ) { return os.$tupleSeparator; }
    100100void sepSetTuple( ofstream & os, const char s[] ) {
    101101        assert( s );
    102         strncpy( os.tupleSeparator, s, sepSize - 1 );
    103         os.tupleSeparator[sepSize - 1] = '\0';
     102        strncpy( os.$tupleSeparator, s, sepSize - 1 );
     103        os.$tupleSeparator[sepSize - 1] = '\0';
    104104} // sepSet
    105105
    106106void ends( ofstream & os ) {
    107         if ( getANL( os ) ) nl( os );
    108         else setPrt( os, false );                                                       // turn off
     107        if ( $getANL( os ) ) nl( os );
     108        else $setPrt( os, false );                                                      // turn off
    109109        if ( &os == &exit ) exit( EXIT_FAILURE );
    110110        if ( &os == &abort ) abort();
     
    112112
    113113int fail( ofstream & os ) {
    114         return os.file == 0 || ferror( (FILE *)(os.file) );
     114        return os.$file == 0 || ferror( (FILE *)(os.$file) );
    115115} // fail
    116116
    117117int flush( ofstream & os ) {
    118         return fflush( (FILE *)(os.file) );
     118        return fflush( (FILE *)(os.$file) );
    119119} // flush
    120120
     
    122122        FILE * file = fopen( name, mode );
    123123        #ifdef __CFA_DEBUG__
    124         if ( file == 0 ) {
     124        if ( file == 0p ) {
    125125                abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
    126126        } // if
     
    134134
    135135void close( ofstream & os ) {
    136         if ( (FILE *)(os.file) == stdout || (FILE *)(os.file) == stderr ) return;
    137 
    138         if ( fclose( (FILE *)(os.file) ) == EOF ) {
     136        if ( (FILE *)(os.$file) == stdout || (FILE *)(os.$file) == stderr ) return;
     137
     138        if ( fclose( (FILE *)(os.$file) ) == EOF ) {
    139139                abort | IO_MSG "close output" | nl | strerror( errno );
    140140        } // if
     
    146146        } // if
    147147
    148         if ( fwrite( data, 1, size, (FILE *)(os.file) ) != size ) {
     148        if ( fwrite( data, 1, size, (FILE *)(os.$file) ) != size ) {
    149149                abort | IO_MSG "write" | nl | strerror( errno );
    150150        } // if
     
    155155        va_list args;
    156156        va_start( args, format );
    157         int len = vfprintf( (FILE *)(os.file), format, args );
     157        int len = vfprintf( (FILE *)(os.$file), format, args );
    158158        if ( len == EOF ) {
    159                 if ( ferror( (FILE *)(os.file) ) ) {
     159                if ( ferror( (FILE *)(os.$file) ) ) {
    160160                        abort | IO_MSG "invalid write";
    161161                } // if
     
    163163        va_end( args );
    164164
    165         setPrt( os, true );                                                                     // called in output cascade
    166         sepReset( os );                                                                         // reset separator
     165        $setPrt( os, true );                                                            // called in output cascade
     166        $sepReset( os );                                                                        // reset separator
    167167        return len;
    168168} // fmt
     
    184184// private
    185185void ?{}( ifstream & is, void * file ) {
    186         is.file = file;
    187         is.nlOnOff = false;
     186        is.$file = file;
     187        is.$nlOnOff = false;
    188188} // ?{}
    189189
    190190// public
    191 void ?{}( ifstream & is ) {     is.file = 0; }
     191void ?{}( ifstream & is ) { is.$file = 0p; }
    192192
    193193void ?{}( ifstream & is, const char name[], const char mode[] ) {
     
    203203} // ^?{}
    204204
    205 void nlOn( ifstream & os ) { os.nlOnOff = true; }
    206 void nlOff( ifstream & os ) { os.nlOnOff = false; }
    207 bool getANL( ifstream & os ) { return os.nlOnOff; }
     205void nlOn( ifstream & os ) { os.$nlOnOff = true; }
     206void nlOff( ifstream & os ) { os.$nlOnOff = false; }
     207bool getANL( ifstream & os ) { return os.$nlOnOff; }
    208208
    209209int fail( ifstream & is ) {
    210         return is.file == 0 || ferror( (FILE *)(is.file) );
     210        return is.$file == 0p || ferror( (FILE *)(is.$file) );
    211211} // fail
    212212
    213213int eof( ifstream & is ) {
    214         return feof( (FILE *)(is.file) );
     214        return feof( (FILE *)(is.$file) );
    215215} // eof
    216216
     
    218218        FILE * file = fopen( name, mode );
    219219        #ifdef __CFA_DEBUG__
    220         if ( file == 0 ) {
     220        if ( file == 0p ) {
    221221                abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
    222222        } // if
    223223        #endif // __CFA_DEBUG__
    224         is.file = file;
     224        is.$file = file;
    225225} // open
    226226
     
    230230
    231231void close( ifstream & is ) {
    232         if ( (FILE *)(is.file) == stdin ) return;
    233 
    234         if ( fclose( (FILE *)(is.file) ) == EOF ) {
     232        if ( (FILE *)(is.$file) == stdin ) return;
     233
     234        if ( fclose( (FILE *)(is.$file) ) == EOF ) {
    235235                abort | IO_MSG "close input" | nl | strerror( errno );
    236236        } // if
     
    242242        } // if
    243243
    244         if ( fread( data, size, 1, (FILE *)(is.file) ) == 0 ) {
     244        if ( fread( data, size, 1, (FILE *)(is.$file) ) == 0 ) {
    245245                abort | IO_MSG "read" | nl | strerror( errno );
    246246        } // if
     
    253253        } // if
    254254
    255         if ( ungetc( c, (FILE *)(is.file) ) == EOF ) {
     255        if ( ungetc( c, (FILE *)(is.$file) ) == EOF ) {
    256256                abort | IO_MSG "ungetc" | nl | strerror( errno );
    257257        } // if
     
    263263
    264264        va_start( args, format );
    265         int len = vfscanf( (FILE *)(is.file), format, args );
     265        int len = vfscanf( (FILE *)(is.$file), format, args );
    266266        if ( len == EOF ) {
    267                 if ( ferror( (FILE *)(is.file) ) ) {
     267                if ( ferror( (FILE *)(is.$file) ) ) {
    268268                        abort | IO_MSG "invalid read";
    269269                } // if
  • libcfa/src/fstream.hfa

    r095ac99 rd1a9ff5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 13:03:17 2020
    13 // Update Count     : 172
     12// Last Modified On : Fri Feb  7 19:00:51 2020
     13// Update Count     : 174
    1414//
    1515
     
    2424enum { sepSize = 16 };
    2525struct ofstream {
    26         void * file;
    27         bool sepDefault;
    28         bool sepOnOff;
    29         bool nlOnOff;
    30         bool prt;                                                                                       // print text
    31         bool sawNL;
    32         const char * sepCur;
    33         char separator[sepSize];
    34         char tupleSeparator[sepSize];
     26        void * $file;
     27        bool $sepDefault;
     28        bool $sepOnOff;
     29        bool $nlOnOff;
     30        bool $prt;                                                                                      // print text
     31        bool $sawNL;
     32        const char * $sepCur;
     33        char $separator[sepSize];
     34        char $tupleSeparator[sepSize];
    3535}; // ofstream
    3636
    3737// private
    38 bool sepPrt( ofstream & );
    39 void sepReset( ofstream & );
    40 void sepReset( ofstream &, bool );
    41 const char * sepGetCur( ofstream & );
    42 void sepSetCur( ofstream &, const char [] );
    43 bool getNL( ofstream & );
    44 void setNL( ofstream &, bool );
    45 bool getANL( ofstream & );
    46 bool getPrt( ofstream & );
    47 void setPrt( ofstream &, bool );
     38bool $sepPrt( ofstream & );
     39void $sepReset( ofstream & );
     40void $sepReset( ofstream &, bool );
     41const char * $sepGetCur( ofstream & );
     42void $sepSetCur( ofstream &, const char [] );
     43bool $getNL( ofstream & );
     44void $setNL( ofstream &, bool );
     45bool $getANL( ofstream & );
     46bool $getPrt( ofstream & );
     47void $setPrt( ofstream &, bool );
    4848
    4949// public
     
    8282
    8383struct ifstream {
    84         void * file;
    85         bool nlOnOff;
     84        void * $file;
     85        bool $nlOnOff;
    8686}; // ifstream
    8787
  • libcfa/src/gmp.hfa

    r095ac99 rd1a9ff5  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 11:55:07 2020
    13 // Update Count     : 28
     12// Last Modified On : Fri Feb  7 22:10:30 2020
     13// Update Count     : 29
    1414//
    1515
     
    265265        forall( dtype ostype | ostream( ostype ) ) {
    266266                ostype & ?|?( ostype & os, Int mp ) {
    267                         if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     267                        if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    268268                        gmp_printf( "%Zd", mp.mpz );
    269269                        sepOn( os );
  • libcfa/src/iostream.cfa

    r095ac99 rd1a9ff5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 10:07:17 2020
    13 // Update Count     : 822
     12// Last Modified On : Fri Feb  7 18:48:38 2020
     13// Update Count     : 825
    1414//
    1515
     
    3535forall( dtype ostype | ostream( ostype ) ) {
    3636        ostype & ?|?( ostype & os, zero_t ) {
    37                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     37                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    3838                fmt( os, "%d", 0n );
    3939                return os;
     
    4444
    4545        ostype & ?|?( ostype & os, one_t ) {
    46                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     46                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    4747                fmt( os, "%d", 1n );
    4848                return os;
     
    5353
    5454        ostype & ?|?( ostype & os, bool b ) {
    55                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     55                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    5656                fmt( os, "%s", b ? "true" : "false" );
    5757                return os;
     
    6363        ostype & ?|?( ostype & os, char c ) {
    6464                fmt( os, "%c", c );
    65                 if ( c == '\n' ) setNL( os, true );
     65                if ( c == '\n' ) $setNL( os, true );
    6666                return sepOff( os );
    6767        } // ?|?
     
    7171
    7272        ostype & ?|?( ostype & os, signed char sc ) {
    73                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     73                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    7474                fmt( os, "%hhd", sc );
    7575                return os;
     
    8080
    8181        ostype & ?|?( ostype & os, unsigned char usc ) {
    82                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     82                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    8383                fmt( os, "%hhu", usc );
    8484                return os;
     
    8989
    9090        ostype & ?|?( ostype & os, short int si ) {
    91                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     91                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    9292                fmt( os, "%hd", si );
    9393                return os;
     
    9898
    9999        ostype & ?|?( ostype & os, unsigned short int usi ) {
    100                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     100                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    101101                fmt( os, "%hu", usi );
    102102                return os;
     
    107107
    108108        ostype & ?|?( ostype & os, int i ) {
    109                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     109                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    110110                fmt( os, "%d", i );
    111111                return os;
     
    116116
    117117        ostype & ?|?( ostype & os, unsigned int ui ) {
    118                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     118                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    119119                fmt( os, "%u", ui );
    120120                return os;
     
    125125
    126126        ostype & ?|?( ostype & os, long int li ) {
    127                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     127                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    128128                fmt( os, "%ld", li );
    129129                return os;
     
    134134
    135135        ostype & ?|?( ostype & os, unsigned long int uli ) {
    136                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     136                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    137137                fmt( os, "%lu", uli );
    138138                return os;
     
    143143
    144144        ostype & ?|?( ostype & os, long long int lli ) {
    145                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     145                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    146146                fmt( os, "%lld", lli );
    147147                return os;
     
    152152
    153153        ostype & ?|?( ostype & os, unsigned long long int ulli ) {
    154                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     154                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    155155                fmt( os, "%llu", ulli );
    156156                return os;
     
    175175
    176176        ostype & ?|?( ostype & os, float f ) {
    177                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     177                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    178178                PrintWithDP( os, "%g", f );
    179179                return os;
     
    184184
    185185        ostype & ?|?( ostype & os, double d ) {
    186                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     186                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    187187                PrintWithDP( os, "%.*lg", d, DBL_DIG );
    188188                return os;
     
    193193
    194194        ostype & ?|?( ostype & os, long double ld ) {
    195                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     195                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    196196                PrintWithDP( os, "%.*Lg", ld, LDBL_DIG );
    197197                return os;
     
    202202
    203203        ostype & ?|?( ostype & os, float _Complex fc ) {
    204                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     204                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    205205//              os | crealf( fc ) | nonl;
    206206                PrintWithDP( os, "%g", crealf( fc ) );
     
    214214
    215215        ostype & ?|?( ostype & os, double _Complex dc ) {
    216                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     216                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    217217//              os | creal( dc ) | nonl;
    218218                PrintWithDP( os, "%.*lg", creal( dc ), DBL_DIG );
     
    226226
    227227        ostype & ?|?( ostype & os, long double _Complex ldc ) {
    228                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     228                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    229229//              os | creall( ldc ) || nonl;
    230230                PrintWithDP( os, "%.*Lg", creall( ldc ), LDBL_DIG );
     
    257257                // first character IS NOT spacing or closing punctuation => add left separator
    258258                unsigned char ch = str[0];                                              // must make unsigned
    259                 if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
    260                         fmt( os, "%s", sepGetCur( os ) );
     259                if ( $sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
     260                        fmt( os, "%s", $sepGetCur( os ) );
    261261                } // if
    262262
    263263                // if string starts line, must reset to determine open state because separator is off
    264                 sepReset( os );                                                                 // reset separator
     264                $sepReset( os );                                                                // reset separator
    265265
    266266                // last character IS spacing or opening punctuation => turn off separator for next item
    267267                size_t len = strlen( str );
    268268                ch = str[len - 1];                                                              // must make unsigned
    269                 if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
     269                if ( $sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
    270270                        sepOn( os );
    271271                } else {
    272272                        sepOff( os );
    273273                } // if
    274                 if ( ch == '\n' ) setNL( os, true );                    // check *AFTER* sepPrt call above as it resets NL flag
     274                if ( ch == '\n' ) $setNL( os, true );                   // check *AFTER* $sepPrt call above as it resets NL flag
    275275                return write( os, str, len );
    276276        } // ?|?
     
    281281
    282282//      ostype & ?|?( ostype & os, const char16_t * str ) {
    283 //              if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     283//              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    284284//              fmt( os, "%ls", str );
    285285//              return os;
     
    288288// #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
    289289//      ostype & ?|?( ostype & os, const char32_t * str ) {
    290 //              if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     290//              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    291291//              fmt( os, "%ls", str );
    292292//              return os;
     
    295295
    296296//      ostype & ?|?( ostype & os, const wchar_t * str ) {
    297 //              if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     297//              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    298298//              fmt( os, "%ls", str );
    299299//              return os;
     
    301301
    302302        ostype & ?|?( ostype & os, const void * p ) {
    303                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     303                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    304304                fmt( os, "%p", p );
    305305                return os;
     
    316316        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    317317                (ostype &)(manip( os ));
    318                 if ( getPrt( os ) ) ends( os );                                 // something printed ?
    319                 setPrt( os, false );                                                    // turn off
     318                if ( $getPrt( os ) ) ends( os );                                // something printed ?
     319                $setPrt( os, false );                                                   // turn off
    320320        } // ?|?
    321321
     
    330330        ostype & nl( ostype & os ) {
    331331                (ostype &)(os | '\n');
    332                 setPrt( os, false );                                                    // turn off
    333                 setNL( os, true );
     332                $setPrt( os, false );                                                   // turn off
     333                $setNL( os, true );
    334334                flush( os );
    335335                return sepOff( os );                                                    // prepare for next line
     
    337337
    338338        ostype & nonl( ostype & os ) {
    339                 setPrt( os, false );                                                    // turn off
     339                $setPrt( os, false );                                                   // turn off
    340340                return os;
    341341        } // nonl
     
    376376        ostype & ?|?( ostype & os, T arg, Params rest ) {
    377377                (ostype &)(os | arg);                                                   // print first argument
    378                 sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     378                $sepSetCur( os, sepGetTuple( os ) );                    // switch to tuple separator
    379379                (ostype &)(os | rest);                                                  // print remaining arguments
    380                 sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     380                $sepSetCur( os, sepGet( os ) );                                 // switch to regular separator
    381381                return os;
    382382        } // ?|?
     
    384384                // (ostype &)(?|?( os, arg, rest )); ends( os );
    385385                (ostype &)(os | arg);                                                   // print first argument
    386                 sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     386                $sepSetCur( os, sepGetTuple( os ) );                    // switch to tuple separator
    387387                (ostype &)(os | rest);                                                  // print remaining arguments
    388                 sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     388                $sepSetCur( os, sepGet( os ) );                                 // switch to regular separator
    389389                ends( os );
    390390        } // ?|?
     
    415415forall( dtype ostype | ostream( ostype ) ) { \
    416416        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    417                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); \
     417                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
    418418\
    419419                if ( f.base == 'b' || f.base == 'B' ) {                 /* bespoke binary format */ \
     
    514514forall( dtype ostype | ostream( ostype ) ) { \
    515515        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    516                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); \
     516                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
    517517                char fmtstr[sizeof(DFMTP)];                                             /* sizeof includes '\0' */ \
    518518                if ( ! f.flags.pc ) memcpy( &fmtstr, DFMTNP, sizeof(DFMTNP) ); \
     
    557557                } // if
    558558
    559                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     559                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    560560
    561561                #define CFMTNP "% * "
     
    595595                } // if
    596596
    597                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     597                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    598598
    599599                #define SFMTNP "% * "
  • libcfa/src/iostream.hfa

    r095ac99 rd1a9ff5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  4 11:55:28 2020
    13 // Update Count     : 335
     12// Last Modified On : Fri Feb  7 17:53:52 2020
     13// Update Count     : 336
    1414//
    1515
     
    2424trait ostream( dtype ostype ) {
    2525        // private
    26         bool sepPrt( ostype & );                                                        // get separator state (on/off)
    27         void sepReset( ostype & );                                                      // set separator state to default state
    28         void sepReset( ostype &, bool );                                        // set separator and default state
    29         const char * sepGetCur( ostype & );                                     // get current separator string
    30         void sepSetCur( ostype &, const char [] );                      // set current separator string
    31         bool getNL( ostype & );                                                         // check newline
    32         void setNL( ostype &, bool );                                           // saw newline
    33         bool getANL( ostype & );                                                        // get auto newline (on/off)
    34         bool getPrt( ostype & );                                                        // get fmt called in output cascade
    35         void setPrt( ostype &, bool );                                          // set fmt called in output cascade
     26        bool $sepPrt( ostype & );                                                       // get separator state (on/off)
     27        void $sepReset( ostype & );                                                     // set separator state to default state
     28        void $sepReset( ostype &, bool );                                       // set separator and default state
     29        const char * $sepGetCur( ostype & );                            // get current separator string
     30        void $sepSetCur( ostype &, const char [] );                     // set current separator string
     31        bool $getNL( ostype & );                                                        // check newline
     32        void $setNL( ostype &, bool );                                          // saw newline
     33        bool $getANL( ostype & );                                                       // get auto newline (on/off)
     34        bool $getPrt( ostype & );                                                       // get fmt called in output cascade
     35        void $setPrt( ostype &, bool );                                         // set fmt called in output cascade
    3636        // public
    3737        void sepOn( ostype & );                                                         // turn separator state on
Note: See TracChangeset for help on using the changeset viewer.