Changeset 515a037 for libcfa


Ignore:
Timestamp:
Dec 12, 2018, 3:52:19 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
1b8f13f0
Parents:
cdc02f2 (diff), 85acec94 (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' into shared_library

Location:
libcfa/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    rcdc02f2 r515a037  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 10 18:19:40 2018
    13 // Update Count     : 284
     12// Last Modified On : Wed Dec 12 08:34:28 2018
     13// Update Count     : 298
    1414//
    1515
     
    2020#include <stdarg.h>                                                                             // varargs
    2121#include <string.h>                                                                             // strlen
    22 #include <stdbool.h>                                                                    // true/false
    2322#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    2423#include <complex.h>                                                                    // creal, cimag
     
    2726#define IO_MSG "I/O error: "
    2827
    29 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, const char * separator, const char * tupleSeparator ) {
     28void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool nonlManip, const char * separator, const char * tupleSeparator ) {
    3029        os.file = file;
    3130        os.sepDefault = sepDefault;
    3231        os.sepOnOff = sepOnOff;
     32        os.nlOnOff = nlOnOff;
     33        os.nonlManip = nonlManip;
    3334        sepSet( os, separator );
    3435        sepSetCur( os, sepGet( os ) );
     
    4445bool getNL( ofstream & os ) { return os.sawNL; }
    4546void setNL( ofstream & os, bool state ) { os.sawNL = state; }
     47bool getANL( ofstream & os ) { return os.nlOnOff; }
     48bool getNonl( ofstream & os ) { return os.nonlManip; }
     49void setNonl( ofstream & os, bool state ) { os.nonlManip = state; }
    4650
    4751// public
     
    7276} // sepEnable
    7377
     78void nlOn( ofstream & os ) { os.nlOnOff = true; }
     79void nlOff( ofstream & os ) { os.nlOnOff = false; }
     80
    7481const char * sepGet( ofstream & os ) { return os.separator; }
    7582void sepSet( ofstream & os, const char * s ) {
     
    103110        } // if
    104111        #endif // __CFA_DEBUG__
    105         (os){ file, true, false, " ", ", " };
     112        (os){ file, true, false, true, false, " ", ", " };
    106113} // open
    107114
     
    147154} // fmt
    148155
    149 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };
     156static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, true, false, " ", ", " };
    150157ofstream & sout = soutFile;
    151 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };
     158static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, true, false, " ", ", " };
    152159ofstream & serr = serrFile;
    153160
  • libcfa/src/fstream.hfa

    rcdc02f2 r515a037  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 13:54:27 2018
    13 // Update Count     : 132
     12// Last Modified On : Wed Dec 12 07:52:41 2018
     13// Update Count     : 143
    1414//
    1515
     
    2323        bool sepDefault;
    2424        bool sepOnOff;
     25        bool nlOnOff;
     26        bool nonlManip;
    2527        bool sawNL;
    2628        const char * sepCur;
     
    3739bool getNL( ofstream & );
    3840void setNL( ofstream &, bool );
     41bool getANL( ofstream & );
     42bool getNonl( ofstream & );
     43void setNonl( ofstream &, bool );
    3944
    4045// public
     
    4348bool sepDisable( ofstream & );
    4449bool sepEnable( ofstream & );
     50void nlOn( ofstream & );
     51void nlOff( ofstream & );
    4552
    4653const char * sepGet( ofstream & );
  • libcfa/src/gmp.hfa

    rcdc02f2 r515a037  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec  7 09:10:41 2017
    13 // Update Count     : 21
     12// Last Modified On : Tue Dec  4 23:25:51 2018
     13// Update Count     : 22
    1414//
    1515
     
    262262} // ?|?
    263263
    264 static inline forall( dtype ostype | ostream( ostype ) )
    265 ostype & ?|?( ostype & os, Int mp ) {
    266         if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    267         gmp_printf( "%Zd", mp.mpz );
    268         sepOn( os );
    269         return os;
    270 } // ?|?
     264static inline forall( dtype ostype | ostream( ostype ) ) {
     265        ostype & ?|?( ostype & os, Int mp ) {
     266                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     267                gmp_printf( "%Zd", mp.mpz );
     268                sepOn( os );
     269                return os;
     270        } // ?|?
     271
     272        void ?|?( ostype & os, Int mp ) {
     273                (ostype)(os | mp); if ( getANL( os ) ) nl( os );
     274        } // ?|?
     275} // distribution
    271276
    272277// Local Variables: //
  • libcfa/src/iostream.cfa

    rcdc02f2 r515a037  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 26 18:22:57 2018
    13 // Update Count     : 474
     12// Last Modified On : Tue Dec 11 22:02:03 2018
     13// Update Count     : 546
    1414//
    1515
     
    1919#include <stdio.h>
    2020#include <stdbool.h>                                                                    // true/false
    21 //#include <string.h>                                                                           // strlen, strcmp
     21//#include <string.h>                                                                   // strlen, strcmp
    2222extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
    2323extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
     
    3232                return os;
    3333        } // ?|?
    34 
    35         ostype & ?|?( ostype & os, char ch ) {
    36                 fmt( os, "%c", ch );
    37                 if ( ch == '\n' ) setNL( os, true );
    38                 sepOff( os );
    39                 return os;
    40         } // ?|?
    41 
    42         ostype & ?|?( ostype & os, signed char c ) {
    43                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    44                 fmt( os, "%hhd", c );
    45                 return os;
    46         } // ?|?
    47 
    48         ostype & ?|?( ostype & os, unsigned char c ) {
    49                 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    50                 fmt( os, "%hhu", c );
    51                 return os;
     34        void ?|?( ostype & os, bool b ) {
     35                (ostype)(os | b); if ( getANL( os ) ) nl( os );
     36        } // ?|?
     37
     38        ostype & ?|?( ostype & os, char c ) {
     39                fmt( os, "%c", c );
     40                if ( c == '\n' ) setNL( os, true );
     41                return sepOff( os );
     42        } // ?|?
     43        void ?|?( ostype & os, char c ) {
     44                (ostype)(os | c); if ( getANL( os ) ) nl( os );
     45        } // ?|?
     46
     47        ostype & ?|?( ostype & os, signed char sc ) {
     48                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     49                fmt( os, "%hhd", sc );
     50                return os;
     51        } // ?|?
     52        void ?|?( ostype & os, signed char sc ) {
     53                (ostype)(os | sc); if ( getANL( os ) ) nl( os );
     54        } // ?|?
     55
     56        ostype & ?|?( ostype & os, unsigned char usc ) {
     57                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     58                fmt( os, "%hhu", usc );
     59                return os;
     60        } // ?|?
     61        void ?|?( ostype & os, unsigned char usc ) {
     62                (ostype)(os | usc); if ( getANL( os ) ) nl( os );
    5263        } // ?|?
    5364
     
    5768                return os;
    5869        } // ?|?
     70        void & ?|?( ostype & os, short int si ) {
     71                (ostype)(os | si); if ( getANL( os ) ) nl( os );
     72        } // ?|?
    5973
    6074        ostype & ?|?( ostype & os, unsigned short int usi ) {
     
    6377                return os;
    6478        } // ?|?
     79        void & ?|?( ostype & os, unsigned short int usi ) {
     80                (ostype)(os | usi); if ( getANL( os ) ) nl( os );
     81        } // ?|?
    6582
    6683        ostype & ?|?( ostype & os, int i ) {
     
    6986                return os;
    7087        } // ?|?
     88        void & ?|?( ostype & os, int i ) {
     89                (ostype)(os | i); if ( getANL( os ) ) nl( os );
     90        } // ?|?
    7191
    7292        ostype & ?|?( ostype & os, unsigned int ui ) {
     
    7595                return os;
    7696        } // ?|?
     97        void & ?|?( ostype & os, unsigned int ui ) {
     98                (ostype)(os | ui); if ( getANL( os ) ) nl( os );
     99        } // ?|?
    77100
    78101        ostype & ?|?( ostype & os, long int li ) {
     
    81104                return os;
    82105        } // ?|?
     106        void & ?|?( ostype & os, long int li ) {
     107                (ostype)(os | li); if ( getANL( os ) ) nl( os );
     108        } // ?|?
    83109
    84110        ostype & ?|?( ostype & os, unsigned long int uli ) {
     
    87113                return os;
    88114        } // ?|?
     115        void & ?|?( ostype & os, unsigned long int uli ) {
     116                (ostype)(os | uli); if ( getANL( os ) ) nl( os );
     117        } // ?|?
    89118
    90119        ostype & ?|?( ostype & os, long long int lli ) {
     
    93122                return os;
    94123        } // ?|?
     124        void & ?|?( ostype & os, long long int lli ) {
     125                (ostype)(os | lli); if ( getANL( os ) ) nl( os );
     126        } // ?|?
    95127
    96128        ostype & ?|?( ostype & os, unsigned long long int ulli ) {
     
    99131                return os;
    100132        } // ?|?
     133        void & ?|?( ostype & os, unsigned long long int ulli ) {
     134                (ostype)(os | ulli); if ( getANL( os ) ) nl( os );
     135        } // ?|?
    101136
    102137        ostype & ?|?( ostype & os, float f ) {
     
    105140                return os;
    106141        } // ?|?
     142        void & ?|?( ostype & os, float f ) {
     143                (ostype)(os | f); if ( getANL( os ) ) nl( os );
     144        } // ?|?
    107145
    108146        ostype & ?|?( ostype & os, double d ) {
     
    111149                return os;
    112150        } // ?|?
     151        void & ?|?( ostype & os, double d ) {
     152                (ostype)(os | d); if ( getANL( os ) ) nl( os );
     153        } // ?|?
    113154
    114155        ostype & ?|?( ostype & os, long double ld ) {
     
    117158                return os;
    118159        } // ?|?
     160        void & ?|?( ostype & os, long double ld ) {
     161                (ostype)(os | ld); if ( getANL( os ) ) nl( os );
     162        } // ?|?
    119163
    120164        ostype & ?|?( ostype & os, float _Complex fc ) {
     
    123167                return os;
    124168        } // ?|?
     169        void & ?|?( ostype & os, float _Complex fc ) {
     170                (ostype)(os | fc); if ( getANL( os ) ) nl( os );
     171        } // ?|?
    125172
    126173        ostype & ?|?( ostype & os, double _Complex dc ) {
     
    129176                return os;
    130177        } // ?|?
     178        void & ?|?( ostype & os, double _Complex dc ) {
     179                (ostype)(os | dc); if ( getANL( os ) ) nl( os );
     180        } // ?|?
    131181
    132182        ostype & ?|?( ostype & os, long double _Complex ldc ) {
     
    134184                fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
    135185                return os;
     186        } // ?|?
     187        void & ?|?( ostype & os, long double _Complex ldc ) {
     188                (ostype)(os | ldc); if ( getANL( os ) ) nl( os );
    136189        } // ?|?
    137190
     
    141194                        // opening delimiters, no space after
    142195                        ['('] : Open, ['['] : Open, ['{'] : Open,
    143                         ['='] : Open, ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,
    144                         [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
     196                        ['='] : Open, ['$'] : Open, [(unsigned char)'�'] : Open, [(unsigned char)'�'] : Open,
     197                        [(unsigned char)'�'] : Open, [(unsigned char)'�'] : Open, [(unsigned char)'�'] : Open,
    145198                        // closing delimiters, no space before
    146199                        [','] : Close, ['.'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
    147                         ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
     200                        ['%'] : Close, [(unsigned char)'�'] : Close, [(unsigned char)'�'] : Close,
    148201                        [')'] : Close, [']'] : Close, ['}'] : Close,
    149202                        // opening-closing delimiters, no space before or after
     
    174227                return write( os, str, len );
    175228        } // ?|?
     229        void ?|?( ostype & os, const char * str ) {
     230                (ostype)(os | str); if ( getANL( os ) ) nl( os );
     231        } // ?|?
    176232
    177233//      ostype & ?|?( ostype & os, const char16_t * str ) {
     
    200256                return os;
    201257        } // ?|?
    202 
     258        void ?|?( ostype & os, const void * p ) {
     259                (ostype)(os | p); if ( getANL( os ) ) nl( os );
     260        } // ?|?
    203261
    204262        // manipulators
    205263        ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    206                 return manip( os );
     264                (ostype)(manip( os ));
     265                setNonl( os, false );                                                   // ignore nonl in middle
     266                return os;
     267        } // ?|?
     268        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
     269                (ostype)(manip( os ));
     270                if ( getANL( os ) && ! getNonl( os ) ) nl( os ); // ignore nl if nonl at end
     271                setNonl( os, false );
    207272        } // ?|?
    208273
    209274        ostype & sep( ostype & os ) {
    210                 os | sepGet( os );
    211                 return os;
     275                return (ostype)(os | sepGet( os ));
    212276        } // sep
    213277
    214278        ostype & sepTuple( ostype & os ) {
    215                 os | sepGetTuple( os );
    216                 return os;
     279                return os | sepGetTuple( os );
    217280        } // sepTuple
    218281
    219         ostype & endl( ostype & os ) {
    220                 os | '\n';
     282        ostype & nl( ostype & os ) {
     283                (ostype)(os | '\n');
    221284                setNL( os, true );
    222285                flush( os );
    223                 sepOff( os );                                                                   // prepare for next line
    224                 return os;
    225         } // endl
     286                return sepOff( os );                                                    // prepare for next line
     287        } // nl
     288
     289        ostype & nonl( ostype & os ) {
     290                setNonl( os, true );                                                    // indicate nonl manipulator
     291                return os;
     292        } // nonl
    226293
    227294        ostype & sepOn( ostype & os ) {
    228                 sepOn( os );
     295                sepOn( os );                                                                    // call void returning
    229296                return os;
    230297        } // sepOn
    231298
    232299        ostype & sepOff( ostype & os ) {
    233                 sepOff( os );
     300                sepOff( os );                                                                   // call void returning
    234301                return os;
    235302        } // sepOff
    236303
    237304        ostype & sepEnable( ostype & os ) {
    238                 sepEnable( os );
     305                sepEnable( os );                                                                // call void returning
    239306                return os;
    240307        } // sepEnable
    241308
    242309        ostype & sepDisable( ostype & os ) {
    243                 sepDisable( os );
     310                sepDisable( os );                                                               // call void returning
    244311                return os;
    245312        } // sepDisable
     313
     314        ostype & nlOn( ostype & os ) {
     315                nlOn( os );                                                                             // call void returning
     316                return os;
     317        } // nlOn
     318
     319        ostype & nlOff( ostype & os ) {
     320                nlOff( os );                                                                    // call void returning
     321                return os;
     322        } // nlOff
    246323} // distribution
    247324
    248 
    249325// tuples
    250 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } )
    251 ostype & ?|?( ostype & os, T arg, Params rest ) {
    252         os | arg;                                                                                       // print first argument
    253         sepSetCur( os, sepGetTuple( os ) );                                     // switch to tuple separator
    254         os | rest;                                                                                      // print remaining arguments
    255         sepSetCur( os, sepGet( os ) );                                          // switch to regular separator
    256         return os;
    257 } // ?|?
     326forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     327        ostype & ?|?( ostype & os, T arg, Params rest ) {
     328                (ostype)(os | arg);                                                             // print first argument
     329                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     330                (ostype)(os | rest);                                                    // print remaining arguments
     331                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     332                return os;
     333        } // ?|?
     334        void ?|?( ostype & os, T arg, Params rest ) {
     335//              (ostype)(?|?( os, arg, rest )); if ( getANL( os ) ) nl( os );
     336                (ostype)(os | arg);                                                             // print first argument
     337                sepSetCur( os, sepGetTuple( os ) );                             // switch to tuple separator
     338                (ostype)(os | rest);                                                    // print remaining arguments
     339                sepSetCur( os, sepGet( os ) );                                  // switch to regular separator
     340                if ( getANL( os ) ) nl( os );
     341        } // ?|?
     342} // distribution
    258343
    259344//---------------------------------------
    260345
    261346// writes the range [begin, end) to the given stream
    262 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    263 void write( iterator_type begin, iterator_type end, ostype & os ) {
    264         void print( elt_type i ) { os | i; }
    265         for_each( begin, end, print );
    266 } // ?|?
    267 
    268 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    269 void write_reverse( iterator_type begin, iterator_type end, ostype & os ) {
    270         void print( elt_type i ) { os | i; }
    271         for_each_reverse( begin, end, print );
    272 } // ?|?
     347forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     348        void write( iterator_type begin, iterator_type end, ostype & os ) {
     349                void print( elt_type i ) { os | i; }
     350                for_each( begin, end, print );
     351        } // ?|?
     352
     353        void write_reverse( iterator_type begin, iterator_type end, ostype & os ) {
     354                void print( elt_type i ) { os | i; }
     355                for_each_reverse( begin, end, print );
     356        } // ?|?
     357} // distribution
    273358
    274359//---------------------------------------
     
    386471        } // ?|?
    387472
    388         istype & endl( istype & is ) {
     473        istype & nl( istype & is ) {
    389474                fmt( is, "%*[ \t\f\n\r\v]" );                                   // ignore whitespace
    390475                return is;
    391         } // endl
     476        } // nl
    392477} // distribution
    393478
  • libcfa/src/iostream.hfa

    rcdc02f2 r515a037  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 08:22:49 2018
    13 // Update Count     : 156
     12// Last Modified On : Tue Dec 11 22:01:31 2018
     13// Update Count     : 213
    1414//
    1515
     
    2525        const char * sepGetCur( ostype & );                                     // get current separator string
    2626        void sepSetCur( ostype &, const char * );                       // set current separator string
    27         bool getNL( ostype & );                                                 // check newline
     27        bool getNL( ostype & );                                                         // check newline
    2828        void setNL( ostype &, bool );                                           // saw newline
     29        bool getANL( ostype & );                                                        // check auto newline
     30        bool getNonl( ostype & );                                                       // check nonnl manipulator
     31        void setNonl( ostype &, bool );                                         // set nonnl manipulator
    2932        // public
    3033        void sepOn( ostype & );                                                         // turn separator state on
    3134        void sepOff( ostype & );                                                        // turn separator state off
    3235        bool sepDisable( ostype & );                                            // set default state to off, and return previous state
    33         bool sepEnable( ostype & );                                             // set default state to on, and return previous state
     36        bool sepEnable( ostype & );                                                     // set default state to on, and return previous state
     37        void nlOn( ostype & );                                                          // turn auto-newline state on
     38        void nlOff( ostype & );                                                         // turn auto-newline state off
    3439
    3540        const char * sepGet( ostype & );                                        // get separator string
     
    5863forall( dtype ostype | ostream( ostype ) ) {
    5964        ostype & ?|?( ostype &, bool );
     65        void & ?|?( ostype &, bool );
    6066
    6167        ostype & ?|?( ostype &, char );
     68        void & ?|?( ostype &, char );
    6269        ostype & ?|?( ostype &, signed char );
     70        void & ?|?( ostype &, signed char );
    6371        ostype & ?|?( ostype &, unsigned char );
     72        void & ?|?( ostype &, unsigned char );
    6473
    6574        ostype & ?|?( ostype &, short int );
     75        void & ?|?( ostype &, short int );
    6676        ostype & ?|?( ostype &, unsigned short int );
     77        void & ?|?( ostype &, unsigned short int );
    6778        ostype & ?|?( ostype &, int );
     79        void & ?|?( ostype &, int );
    6880        ostype & ?|?( ostype &, unsigned int );
     81        void & ?|?( ostype &, unsigned int );
    6982        ostype & ?|?( ostype &, long int );
     83        void & ?|?( ostype &, long int );
    7084        ostype & ?|?( ostype &, long long int );
     85        void & ?|?( ostype &, long long int );
    7186        ostype & ?|?( ostype &, unsigned long int );
     87        void & ?|?( ostype &, unsigned long int );
    7288        ostype & ?|?( ostype &, unsigned long long int );
     89        void & ?|?( ostype &, unsigned long long int );
    7390
    7491        ostype & ?|?( ostype &, float ); // FIX ME: should not be required
     92        void & ?|?( ostype &, float ); // FIX ME: should not be required
    7593        ostype & ?|?( ostype &, double );
     94        void & ?|?( ostype &, double );
    7695        ostype & ?|?( ostype &, long double );
     96        void & ?|?( ostype &, long double );
    7797
    7898        ostype & ?|?( ostype &, float _Complex );
     99        void & ?|?( ostype &, float _Complex );
    79100        ostype & ?|?( ostype &, double _Complex );
     101        void & ?|?( ostype &, double _Complex );
    80102        ostype & ?|?( ostype &, long double _Complex );
     103        void & ?|?( ostype &, long double _Complex );
    81104
    82105        ostype & ?|?( ostype &, const char * );
     106        void & ?|?( ostype &, const char * );
    83107        // ostype & ?|?( ostype &, const char16_t * );
    84108#if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
     
    87111        // ostype & ?|?( ostype &, const wchar_t * );
    88112        ostype & ?|?( ostype &, const void * );
     113        void & ?|?( ostype &, const void * );
    89114
    90115        // manipulators
    91116        ostype & ?|?( ostype &, ostype & (*)( ostype & ) );
    92         ostype & endl( ostype & );
     117        void ?|?( ostype &, ostype & (*)( ostype & ) );
     118        ostype & nl( ostype & );
     119        ostype & nonl( ostype & );
    93120        ostype & sep( ostype & );
    94121        ostype & sepTuple( ostype & );
     
    97124        ostype & sepDisable( ostype & );
    98125        ostype & sepEnable( ostype & );
     126        ostype & nlOn( ostype & );
     127        ostype & nlOff( ostype & );
    99128} // distribution
    100129
    101130// tuples
    102 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } )
    103 ostype & ?|?( ostype & os, T arg, Params rest );
     131forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     132        ostype & ?|?( ostype & os, T arg, Params rest );
     133        void ?|?( ostype & os, T arg, Params rest );
     134} // distribution
    104135
    105136// writes the range [begin, end) to the given stream
    106 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    107 void write( iterator_type begin, iterator_type end, ostype & os );
    108 
    109 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
    110 void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     137forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     138        void write( iterator_type begin, iterator_type end, ostype & os );
     139        void write_reverse( iterator_type begin, iterator_type end, ostype & os );
     140} // distribution
    111141
    112142//---------------------------------------
     
    152182        // manipulators
    153183        istype & ?|?( istype &, istype & (*)( istype & ) );
    154         istype & endl( istype & is );
     184        istype & nl( istype & is );
    155185} // distribution
    156186
     
    164194
    165195
    166 #include <time_t.hfa>                                                                           // Duration (constructors) / Time (constructors)
    167 
    168 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Duration dur );
    169 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Time time );
    170 
     196#include <time_t.hfa>                                                                   // Duration (constructors) / Time (constructors)
     197
     198forall( dtype ostype | ostream( ostype ) ) {
     199        ostype & ?|?( ostype & os, Duration dur );
     200        void ?|?( ostype & os, Duration dur );
     201        ostype & ?|?( ostype & os, Time time );
     202        void ?|?( ostype & os, Time time );
     203} // distribution
    171204
    172205// Local Variables: //
  • libcfa/src/iterator.cfa

    rcdc02f2 r515a037  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 26 18:23:10 2018
     12// Last Modified On : Fri Nov  2 07:17:37 2018
    1313// Update Count     : 29
    1414//
  • libcfa/src/rational.cfa

    rcdc02f2 r515a037  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun  2 09:24:33 2018
    13 // Update Count     : 162
     12// Last Modified On : Tue Dec 11 22:02:29 2018
     13// Update Count     : 168
    1414//
    1515
     
    3535        static RationalImpl simplify( RationalImpl & n, RationalImpl & d ) {
    3636                if ( d == (RationalImpl){0} ) {
    37                         serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl;
     37                        serr | "Invalid rational number construction: denominator cannot be equal to 0.";
    3838                        exit( EXIT_FAILURE );
    3939                } // exit
     
    175175        } // ?|?
    176176
    177         forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } )
    178         ostype & ?|?( ostype & os, Rational(RationalImpl ) r ) {
    179                 return os | r.numerator | '/' | r.denominator;
    180         } // ?|?
     177        forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } ) {
     178                ostype & ?|?( ostype & os, Rational(RationalImpl) r ) {
     179                        return os | r.numerator | '/' | r.denominator;
     180                } // ?|?
     181
     182                void ?|?( ostype & os, Rational(RationalImpl) r ) {
     183                        (ostype)(os | r); if ( getANL( os ) ) nl( os );
     184                } // ?|?
     185        } // distribution
    181186} // distribution
    182187
  • libcfa/src/rational.hfa

    rcdc02f2 r515a037  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Sat Jun  2 09:10:01 2018
    15 // Update Count     : 105
     14// Last Modified On : Tue Dec  4 23:07:46 2018
     15// Update Count     : 106
    1616//
    1717
     
    9292        istype & ?|?( istype &, Rational(RationalImpl) & );
    9393
    94         forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } )
    95         ostype & ?|?( ostype &, Rational(RationalImpl ) );
     94        forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } ) {
     95                ostype & ?|?( ostype &, Rational(RationalImpl) );
     96                void ?|?( ostype &, Rational(RationalImpl) );
     97        } // distribution
    9698} // distribution
    9799
  • libcfa/src/time.cfa

    rcdc02f2 r515a037  
    1010// Created On       : Tue Mar 27 13:33:14 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May  6 22:26:00 2018
    13 // Update Count     : 37
     12// Last Modified On : Tue Dec 11 21:32:15 2018
     13// Update Count     : 53
    1414//
    1515
     
    3131
    3232
    33 forall( dtype ostype | ostream( ostype ) )
    34 ostype & ?|?( ostype & os, Duration dur ) with( dur ) {
    35         os | tv / TIMEGRAN;                                                                     // print seconds
    36         long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;           // compute nanoseconds
    37         if ( ns != 0 ) {                                                                        // some ?
    38                 char buf[16];
    39                 os | nanomsd( ns, buf );                                                // print nanoseconds
    40         } // if
    41         return os;
    42 } // ?|?
     33forall( dtype ostype | ostream( ostype ) ) {
     34        ostype & ?|?( ostype & os, Duration dur ) with( dur ) {
     35                (ostype)(os | tv / TIMEGRAN);                                   // print seconds
     36                long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;   // compute nanoseconds
     37                if ( ns != 0 ) {                                                                // some ?
     38                        char buf[16];
     39                        (ostype)(os | nanomsd( ns, buf ));                      // print nanoseconds
     40                } // if
     41                return os;
     42        } // ?|?
     43
     44        void ?|?( ostype & os, Duration dur ) with( dur ) {
     45                (ostype)(os | dur); if ( getANL( os ) ) nl( os );
     46        } // ?|?
     47} // distribution
    4348
    4449
     
    137142} // strftime
    138143
    139 forall( dtype ostype | ostream( ostype ) )
    140 ostype & ?|?( ostype & os, Time time ) with( time ) {
    141         char buf[32];                                                                           // at least 26
    142         time_t s = tv / TIMEGRAN;
    143     ctime_r( &s, (char *)&buf );                                                // 26 characters: "Wed Jun 30 21:49:08 1993\n"
    144         buf[24] = '\0';                                                                         // remove trailing '\n'
    145         long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;           // compute nanoseconds
    146         if ( ns == 0 ) {                                                                        // none ?
    147                 os | buf;                                                                               // print date/time/year
    148         } else {
    149                 buf[19] = '\0';                                                                 // truncate to "Wed Jun 30 21:49:08"
    150                 os | buf;                                                                               // print date/time
    151                 char buf2[16];
    152                 nanomsd( ns, buf2 );                                                    // compute nanoseconds
    153                 os | buf2 | ' ' | &buf[20];                                             // print nanoseconds and year
    154         } // if
    155         return os;
    156 } // ?|?
     144forall( dtype ostype | ostream( ostype ) ) {
     145        ostype & ?|?( ostype & os, Time time ) with( time ) {
     146                char buf[32];                                                                   // at least 26
     147                time_t s = tv / TIMEGRAN;
     148                ctime_r( &s, (char *)&buf );                                    // 26 characters: "Wed Jun 30 21:49:08 1993\n"
     149                buf[24] = '\0';                                                                 // remove trailing '\n'
     150                long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN;   // compute nanoseconds
     151                if ( ns == 0 ) {                                                                // none ?
     152                        (ostype)(os | buf);                                                     // print date/time/year
     153                } else {
     154                        buf[19] = '\0';                                                         // truncate to "Wed Jun 30 21:49:08"
     155                        char buf2[16];
     156                        nanomsd( ns, buf2 );                                            // compute nanoseconds
     157                        (ostype)(os | buf | buf2 | ' ' | &buf[20]);     // print date/time, nanoseconds and year
     158                } // if
     159                return os;
     160        } // ?|?
     161
     162        void ?|?( ostype & os, Time time ) with( time ) {
     163                (ostype)(os | time); if ( getANL( os ) ) nl( os );
     164        } // ?|?
     165} // distribution
    157166
    158167// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.