Changeset c08c3cf for libcfa/src/iostream.cfa
- Timestamp:
- Jan 20, 2021, 8:46:31 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 481cf3a
- Parents:
- 467c8b7 (diff), 9db2c92 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r467c8b7 rc08c3cf 36 36 37 37 38 forall( dtype ostype| ostream( ostype ) ) {38 forall( ostype & | ostream( ostype ) ) { 39 39 ostype & ?|?( ostype & os, bool b ) { 40 40 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); … … 407 407 408 408 // tuples 409 forall( dtype ostype, otype T, ttype Params| writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {409 forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) { 410 410 ostype & ?|?( ostype & os, T arg, Params rest ) { 411 411 (ostype &)(os | arg); // print first argument … … 426 426 427 427 // writes the range [begin, end) to the given stream 428 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otypeiterator_type | iterator( iterator_type, elt_type ) ) {428 forall( ostype &, elt_type | writeable( elt_type, ostype ), iterator_type | iterator( iterator_type, elt_type ) ) { 429 429 void write( iterator_type begin, iterator_type end, ostype & os ) { 430 430 void print( elt_type i ) { os | i; } … … 447 447 // Default prefix for non-decimal prints is 0b, 0, 0x. 448 448 #define IntegralFMTImpl( T, IFMTNP, IFMTP ) \ 449 forall( dtype ostype| ostream( ostype ) ) { \449 forall( ostype & | ostream( ostype ) ) { \ 450 450 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 451 451 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \ … … 540 540 // Default prefix for non-decimal prints is 0b, 0, 0x. 541 541 #define IntegralFMTImpl128( T, SIGNED, CODE, IFMTNP, IFMTP ) \ 542 forall( dtype ostype| ostream( ostype ) ) \542 forall( ostype & | ostream( ostype ) ) \ 543 543 static void base10_128( ostype & os, _Ostream_Manip(T) f ) { \ 544 544 if ( f.val > UINT64_MAX ) { \ … … 557 557 } /* if */ \ 558 558 } /* base10_128 */ \ 559 forall( dtype ostype| ostream( ostype ) ) { \559 forall( ostype & | ostream( ostype ) ) { \ 560 560 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 561 561 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \ … … 659 659 #if defined( __SIZEOF_INT128__ ) 660 660 // Default prefix for non-decimal prints is 0b, 0, 0x. 661 forall( dtype ostype| ostream( ostype ) )661 forall( ostype & | ostream( ostype ) ) 662 662 static inline void base_128( ostype & os, unsigned int128 val, unsigned int128 power, _Ostream_Manip(uint64_t) & f, unsigned int maxdig, unsigned int bits, unsigned int cnt = 0 ) { 663 663 int wd = 1; // f.wd is never 0 because 0 implies left-pad … … 724 724 725 725 #define IntegralFMTImpl128( T ) \ 726 forall( dtype ostype| ostream( ostype ) ) { \726 forall( ostype & | ostream( ostype ) ) { \ 727 727 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 728 728 _Ostream_Manip(uint64_t) fmt; \ … … 772 772 773 773 #define FloatingPointFMTImpl( T, DFMTNP, DFMTP ) \ 774 forall( dtype ostype| ostream( ostype ) ) { \774 forall( ostype & | ostream( ostype ) ) { \ 775 775 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 776 776 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \ … … 806 806 // *********************************** character *********************************** 807 807 808 forall( dtype ostype| ostream( ostype ) ) {808 forall( ostype & | ostream( ostype ) ) { 809 809 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) { 810 810 if ( f.base != 'c' ) { // bespoke binary/octal/hex format … … 839 839 // *********************************** C string *********************************** 840 840 841 forall( dtype ostype| ostream( ostype ) ) {841 forall( ostype & | ostream( ostype ) ) { 842 842 ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ) { 843 843 if ( ! f.val ) return os; // null pointer ? … … 887 887 888 888 889 forall( dtype istype| istream( istype ) ) {889 forall( istype & | istream( istype ) ) { 890 890 istype & ?|?( istype & is, bool & b ) { 891 891 char val[6]; … … 1053 1053 // *********************************** manipulators *********************************** 1054 1054 1055 forall( dtype istype| istream( istype ) )1055 forall( istype & | istream( istype ) ) 1056 1056 istype & ?|?( istype & is, _Istream_Cstr f ) { 1057 1057 // skip xxx … … 1088 1088 } // ?|? 1089 1089 1090 forall( dtype istype| istream( istype ) )1090 forall( istype & | istream( istype ) ) 1091 1091 istype & ?|?( istype & is, _Istream_Char f ) { 1092 1092 fmt( is, "%*c" ); // argument variable unused … … 1095 1095 1096 1096 #define InputFMTImpl( T, CODE ) \ 1097 forall( dtype istype| istream( istype ) ) \1097 forall( istype & | istream( istype ) ) \ 1098 1098 istype & ?|?( istype & is, _Istream_Manip(T) f ) { \ 1099 1099 enum { size = 16 }; \ … … 1124 1124 InputFMTImpl( long double, "Lf" ) 1125 1125 1126 forall( dtype istype| istream( istype ) )1126 forall( istype & | istream( istype ) ) 1127 1127 istype & ?|?( istype & is, _Istream_Manip(float _Complex) fc ) { 1128 1128 float re, im; … … 1135 1135 } // ?|? 1136 1136 1137 forall( dtype istype| istream( istype ) )1137 forall( istype & | istream( istype ) ) 1138 1138 istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) { 1139 1139 double re, im; … … 1146 1146 } // ?|? 1147 1147 1148 forall( dtype istype| istream( istype ) )1148 forall( istype & | istream( istype ) ) 1149 1149 istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) { 1150 1150 long double re, im;
Note: See TracChangeset
for help on using the changeset viewer.