Ignore:
Timestamp:
Apr 21, 2021, 12:42:23 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
1d5deea
Parents:
341aa39 (diff), e638266 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r341aa39 rc41c2dbe  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 13 13:05:24 2021
    13 // Update Count     : 1324
     12// Last Modified On : Tue Apr 20 19:09:41 2021
     13// Update Count     : 1325
    1414//
    1515
     
    3838forall( ostype & | ostream( ostype ) ) {
    3939        ostype & ?|?( ostype & os, bool b ) {
    40                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     40                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    4141                fmt( os, "%s", b ? "true" : "false" );
    4242                return os;
     
    4848        ostype & ?|?( ostype & os, char c ) {
    4949                fmt( os, "%c", c );
    50                 if ( c == '\n' ) $setNL( os, true );
     50                if ( c == '\n' ) setNL$( os, true );
    5151                return sepOff( os );
    5252        } // ?|?
     
    5656
    5757        ostype & ?|?( ostype & os, signed char sc ) {
    58                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     58                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    5959                fmt( os, "%hhd", sc );
    6060                return os;
     
    6565
    6666        ostype & ?|?( ostype & os, unsigned char usc ) {
    67                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     67                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    6868                fmt( os, "%hhu", usc );
    6969                return os;
     
    7474
    7575        ostype & ?|?( ostype & os, short int si ) {
    76                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     76                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    7777                fmt( os, "%hd", si );
    7878                return os;
     
    8383
    8484        ostype & ?|?( ostype & os, unsigned short int usi ) {
    85                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     85                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    8686                fmt( os, "%hu", usi );
    8787                return os;
     
    9292
    9393        ostype & ?|?( ostype & os, int i ) {
    94                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     94                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    9595                fmt( os, "%d", i );
    9696                return os;
     
    101101
    102102        ostype & ?|?( ostype & os, unsigned int ui ) {
    103                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     103                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    104104                fmt( os, "%u", ui );
    105105                return os;
     
    110110
    111111        ostype & ?|?( ostype & os, long int li ) {
    112                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     112                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    113113                fmt( os, "%ld", li );
    114114                return os;
     
    119119
    120120        ostype & ?|?( ostype & os, unsigned long int uli ) {
    121                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     121                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    122122                fmt( os, "%lu", uli );
    123123                return os;
     
    128128
    129129        ostype & ?|?( ostype & os, long long int lli ) {
    130                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     130                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    131131                fmt( os, "%lld", lli );
    132132                return os;
     
    137137
    138138        ostype & ?|?( ostype & os, unsigned long long int ulli ) {
    139                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     139                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    140140                fmt( os, "%llu", ulli );
    141141                return os;
     
    171171
    172172        ostype & ?|?( ostype & os, int128 llli ) {
    173                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     173                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    174174                base10_128( os, llli );
    175175                return os;
     
    180180
    181181        ostype & ?|?( ostype & os, unsigned int128 ullli ) {
    182                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     182                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    183183                base10_128( os, ullli );
    184184                return os;
     
    204204
    205205        ostype & ?|?( ostype & os, float f ) {
    206                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     206                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    207207                PrintWithDP( os, "%g", f );
    208208                return os;
     
    213213
    214214        ostype & ?|?( ostype & os, double d ) {
    215                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     215                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    216216                PrintWithDP( os, "%.*lg", d, DBL_DIG );
    217217                return os;
     
    222222
    223223        ostype & ?|?( ostype & os, long double ld ) {
    224                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     224                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    225225                PrintWithDP( os, "%.*Lg", ld, LDBL_DIG );
    226226                return os;
     
    231231
    232232        ostype & ?|?( ostype & os, float _Complex fc ) {
    233                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     233                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    234234//              os | crealf( fc ) | nonl;
    235235                PrintWithDP( os, "%g", crealf( fc ) );
     
    243243
    244244        ostype & ?|?( ostype & os, double _Complex dc ) {
    245                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     245                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    246246//              os | creal( dc ) | nonl;
    247247                PrintWithDP( os, "%.*lg", creal( dc ), DBL_DIG );
     
    255255
    256256        ostype & ?|?( ostype & os, long double _Complex ldc ) {
    257                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     257                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    258258//              os | creall( ldc ) || nonl;
    259259                PrintWithDP( os, "%.*Lg", creall( ldc ), LDBL_DIG );
     
    286286                // first character IS NOT spacing or closing punctuation => add left separator
    287287                unsigned char ch = s[0];                                                // must make unsigned
    288                 if ( $sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
    289                         fmt( os, "%s", $sepGetCur( os ) );
     288                if ( sepPrt$( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
     289                        fmt( os, "%s", sepGetCur$( os ) );
    290290                } // if
    291291
    292292                // if string starts line, must reset to determine open state because separator is off
    293                 $sepReset( os );                                                                // reset separator
     293                sepReset$( os );                                                                // reset separator
    294294
    295295                // last character IS spacing or opening punctuation => turn off separator for next item
    296296                size_t len = strlen( s );
    297297                ch = s[len - 1];                                                                // must make unsigned
    298                 if ( $sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
     298                if ( sepPrt$( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
    299299                        sepOn( os );
    300300                } else {
    301301                        sepOff( os );
    302302                } // if
    303                 if ( ch == '\n' ) $setNL( os, true );                   // check *AFTER* $sepPrt call above as it resets NL flag
     303                if ( ch == '\n' ) setNL$( os, true );                   // check *AFTER* sepPrt$ call above as it resets NL flag
    304304                return write( os, s, len );
    305305        } // ?|?
     
    309309
    310310//      ostype & ?|?( ostype & os, const char16_t * s ) {
    311 //              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     311//              if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    312312//              fmt( os, "%ls", s );
    313313//              return os;
     
    316316// #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
    317317//      ostype & ?|?( ostype & os, const char32_t * s ) {
    318 //              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     318//              if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    319319//              fmt( os, "%ls", s );
    320320//              return os;
     
    323323
    324324//      ostype & ?|?( ostype & os, const wchar_t * s ) {
    325 //              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     325//              if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    326326//              fmt( os, "%ls", s );
    327327//              return os;
     
    329329
    330330        ostype & ?|?( ostype & os, const void * p ) {
    331                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     331                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    332332                fmt( os, "%p", p );
    333333                return os;
     
    343343        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    344344                manip( os );
    345                 if ( $getPrt( os ) ) ends( os );                                // something printed ?
    346                 $setPrt( os, false );                                                   // turn off
     345                if ( getPrt$( os ) ) ends( os );                                // something printed ?
     346                setPrt$( os, false );                                                   // turn off
    347347        } // ?|?
    348348
     
    357357        ostype & nl( ostype & os ) {
    358358                (ostype &)(os | '\n');
    359                 $setPrt( os, false );                                                   // turn off
    360                 $setNL( os, true );
     359                setPrt$( os, false );                                                   // turn off
     360                setNL$( os, true );
    361361                flush( os );
    362362                return sepOff( os );                                                    // prepare for next line
     
    364364
    365365        ostype & nonl( ostype & os ) {
    366                 $setPrt( os, false );                                                   // turn off
     366                setPrt$( os, false );                                                   // turn off
    367367                return os;
    368368        } // nonl
     
    408408        ostype & ?|?( ostype & os, T arg, Params rest ) {
    409409                (ostype &)(os | arg);                                                   // print first argument
    410                 $sepSetCur( os, sepGetTuple( os ) );                    // switch to tuple separator
     410                sepSetCur$( os, sepGetTuple( os ) );                    // switch to tuple separator
    411411                (ostype &)(os | rest);                                                  // print remaining arguments
    412                 $sepSetCur( os, sepGet( os ) );                                 // switch to regular separator
     412                sepSetCur$( os, sepGet( os ) );                                 // switch to regular separator
    413413                return os;
    414414        } // ?|?
     
    416416                // (ostype &)(?|?( os, arg, rest )); ends( os );
    417417                (ostype &)(os | arg);                                                   // print first argument
    418                 $sepSetCur( os, sepGetTuple( os ) );                    // switch to tuple separator
     418                sepSetCur$( os, sepGetTuple( os ) );                    // switch to tuple separator
    419419                (ostype &)(os | rest);                                                  // print remaining arguments
    420                 $sepSetCur( os, sepGet( os ) );                                 // switch to regular separator
     420                sepSetCur$( os, sepGet( os ) );                                 // switch to regular separator
    421421                ends( os );
    422422        } // ?|?
     
    447447forall( ostype & | ostream( ostype ) ) { \
    448448        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    449                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     449                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); \
    450450\
    451451                if ( f.base == 'b' || f.base == 'B' ) {                 /* bespoke binary format */ \
     
    691691                int bufbeg = 0, i, len; \
    692692\
    693                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     693                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); \
    694694                char fmtstr[sizeof(DFMTP) + 8];                                 /* sizeof includes '\0' */ \
    695695                if ( ! f.flags.pc ) memcpy( &fmtstr, DFMTNP, sizeof(DFMTNP) ); \
     
    734734                } // if
    735735
    736                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     736                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    737737
    738738                #define CFMTNP "% * "
     
    772772                } // if
    773773
    774                 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     774                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    775775
    776776                #define SFMTNP "% * "
Note: See TracChangeset for help on using the changeset viewer.