Ignore:
Timestamp:
Mar 4, 2021, 7:40:25 PM (5 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:
77d601f
Parents:
342af53 (diff), a5040fe (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

    r342af53 r8e4aa05  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 24 08:31:35 2020
    13 // Update Count     : 1130
     12// Last Modified On : Tue Mar  2 14:51:30 2021
     13// Update Count     : 1151
    1414//
    1515
     
    3636
    3737
    38 forall( dtype ostype | ostream( ostype ) ) {
     38forall( ostype & | ostream( ostype ) ) {
    3939        ostype & ?|?( ostype & os, bool b ) {
    4040                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
     
    266266        } // ?|?
    267267
    268         ostype & ?|?( ostype & os, const char str[] ) {
     268        ostype & ?|?( ostype & os, const char s[] ) {
    269269                enum { Open = 1, Close, OpenClose };
    270270                static const unsigned char mask[256] @= {
     
    282282                }; // mask
    283283
    284           if ( str[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator
     284          if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator
    285285
    286286                // first character IS NOT spacing or closing punctuation => add left separator
    287                 unsigned char ch = str[0];                                              // must make unsigned
     287                unsigned char ch = s[0];                                                // must make unsigned
    288288                if ( $sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
    289289                        fmt( os, "%s", $sepGetCur( os ) );
     
    294294
    295295                // last character IS spacing or opening punctuation => turn off separator for next item
    296                 size_t len = strlen( str );
    297                 ch = str[len - 1];                                                              // must make unsigned
     296                size_t len = strlen( s );
     297                ch = s[len - 1];                                                                // must make unsigned
    298298                if ( $sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
    299299                        sepOn( os );
     
    302302                } // if
    303303                if ( ch == '\n' ) $setNL( os, true );                   // check *AFTER* $sepPrt call above as it resets NL flag
    304                 return write( os, str, len );
    305         } // ?|?
    306 
    307         void ?|?( ostype & os, const char str[] ) {
    308                 (ostype &)(os | str); ends( os );
    309         } // ?|?
    310 
    311 //      ostype & ?|?( ostype & os, const char16_t * str ) {
     304                return write( os, s, len );
     305        } // ?|?
     306        void ?|?( ostype & os, const char s[] ) {
     307                (ostype &)(os | s); ends( os );
     308        } // ?|?
     309
     310//      ostype & ?|?( ostype & os, const char16_t * s ) {
    312311//              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    313 //              fmt( os, "%ls", str );
     312//              fmt( os, "%ls", s );
    314313//              return os;
    315314//      } // ?|?
    316315
    317316// #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
    318 //      ostype & ?|?( ostype & os, const char32_t * str ) {
     317//      ostype & ?|?( ostype & os, const char32_t * s ) {
    319318//              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    320 //              fmt( os, "%ls", str );
     319//              fmt( os, "%ls", s );
    321320//              return os;
    322321//      } // ?|?
    323322// #endif // ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 )
    324323
    325 //      ostype & ?|?( ostype & os, const wchar_t * str ) {
     324//      ostype & ?|?( ostype & os, const wchar_t * s ) {
    326325//              if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) );
    327 //              fmt( os, "%ls", str );
     326//              fmt( os, "%ls", s );
    328327//              return os;
    329328//      } // ?|?
     
    340339        // manipulators
    341340        ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    342                 (ostype &)(manip( os ));
    343                 return os;
     341                return manip( os );
    344342        } // ?|?
    345343        void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) {
    346                 (ostype &)(manip( os ));
     344                manip( os );
    347345                if ( $getPrt( os ) ) ends( os );                                // something printed ?
    348346                $setPrt( os, false );                                                   // turn off
     
    399397                return os;
    400398        } // nlOff
     399
     400        ostype & acquire( ostype & os ) {
     401                acquire( os );                                                                  // call void returning
     402                return os;
     403        } // acquire
    401404} // distribution
    402405
    403406// tuples
    404 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
     407forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {
    405408        ostype & ?|?( ostype & os, T arg, Params rest ) {
    406409                (ostype &)(os | arg);                                                   // print first argument
     
    421424
    422425// writes the range [begin, end) to the given stream
    423 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) ) {
     426forall( ostype &, elt_type | writeable( elt_type, ostype ), iterator_type | iterator( iterator_type, elt_type ) ) {
    424427        void write( iterator_type begin, iterator_type end, ostype & os ) {
    425428                void print( elt_type i ) { os | i; }
     
    442445// Default prefix for non-decimal prints is 0b, 0, 0x.
    443446#define IntegralFMTImpl( T, IFMTNP, IFMTP ) \
    444 forall( dtype ostype | ostream( ostype ) ) { \
     447forall( ostype & | ostream( ostype ) ) { \
    445448        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    446449                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     
    517520                return os; \
    518521        } /* ?|? */ \
    519         void ?|?( ostype & os, _Ostream_Manip(T) f ) { (ostype &)(os | f); ends( os ); } \
     522        void ?|?( ostype & os, _Ostream_Manip(T) f ) { \
     523                (ostype &)(os | f); ends( os ); \
     524        } /* ?|? */ \
    520525} // distribution
    521526
     
    535540// Default prefix for non-decimal prints is 0b, 0, 0x.
    536541#define IntegralFMTImpl128( T, SIGNED, CODE, IFMTNP, IFMTP ) \
    537 forall( dtype ostype | ostream( ostype ) ) \
     542forall( ostype & | ostream( ostype ) ) \
    538543static void base10_128( ostype & os, _Ostream_Manip(T) f ) { \
    539544        if ( f.val > UINT64_MAX ) { \
     
    552557        } /* if */ \
    553558} /* base10_128 */ \
    554 forall( dtype ostype | ostream( ostype ) ) { \
     559forall( ostype & | ostream( ostype ) ) { \
    555560        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    556561                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     
    654659#if defined( __SIZEOF_INT128__ )
    655660// Default prefix for non-decimal prints is 0b, 0, 0x.
    656 forall( dtype ostype | ostream( ostype ) )
     661forall( ostype & | ostream( ostype ) )
    657662static 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 ) {
    658663        int wd = 1;                                                                                     // f.wd is never 0 because 0 implies left-pad
     
    719724
    720725#define IntegralFMTImpl128( T ) \
    721 forall( dtype ostype | ostream( ostype ) ) { \
     726forall( ostype & | ostream( ostype ) ) { \
    722727        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    723728                _Ostream_Manip(uint64_t) fmt; \
     
    767772
    768773#define FloatingPointFMTImpl( T, DFMTNP, DFMTP ) \
    769 forall( dtype ostype | ostream( ostype ) ) { \
     774forall( ostype & | ostream( ostype ) ) { \
    770775        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
    771776                if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \
     
    801806// *********************************** character ***********************************
    802807
    803 forall( dtype ostype | ostream( ostype ) ) {
     808forall( ostype & | ostream( ostype ) ) {
    804809        ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) {
    805810                if ( f.base != 'c' ) {                                                  // bespoke binary/octal/hex format
     
    834839// *********************************** C string ***********************************
    835840
    836 forall( dtype ostype | ostream( ostype ) ) {
     841forall( ostype & | ostream( ostype ) ) {
    837842        ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ) {
    838843                if ( ! f.val ) return os;                                               // null pointer ?
     
    882887
    883888
    884 forall( dtype istype | istream( istype ) ) {
     889forall( istype & | istream( istype ) ) {
    885890        istype & ?|?( istype & is, bool & b ) {
    886891                char val[6];
     
    894899                return is;
    895900        } // ?|?
     901        void ?|?( istype & is, bool & b ) {
     902                (istype &)(is | b); ends( is );
     903        } // ?|?
    896904
    897905        istype & ?|?( istype & is, char & c ) {
     
    905913                return is;
    906914        } // ?|?
     915        void ?|?( istype & is, char & c ) {
     916                (istype &)(is | c); ends( is );
     917        } // ?|?
    907918
    908919        istype & ?|?( istype & is, signed char & sc ) {
     
    910921                return is;
    911922        } // ?|?
     923        void ?|?( istype & is, signed char & sc ) {
     924                (istype &)(is | sc); ends( is );
     925        } // ?|?
    912926
    913927        istype & ?|?( istype & is, unsigned char & usc ) {
     
    915929                return is;
    916930        } // ?|?
     931        void ?|?( istype & is, unsigned char & usc ) {
     932                (istype &)(is | usc); ends( is );
     933        } // ?|?
    917934
    918935        istype & ?|?( istype & is, short int & si ) {
     
    920937                return is;
    921938        } // ?|?
     939        void ?|?( istype & is, short int & si ) {
     940                (istype &)(is | si); ends( is );
     941        } // ?|?
    922942
    923943        istype & ?|?( istype & is, unsigned short int & usi ) {
     
    925945                return is;
    926946        } // ?|?
     947        void ?|?( istype & is, unsigned short int & usi ) {
     948                (istype &)(is | usi); ends( is );
     949        } // ?|?
    927950
    928951        istype & ?|?( istype & is, int & i ) {
     
    930953                return is;
    931954        } // ?|?
     955        void ?|?( istype & is, int & i ) {
     956                (istype &)(is | i); ends( is );
     957        } // ?|?
    932958
    933959        istype & ?|?( istype & is, unsigned int & ui ) {
     
    935961                return is;
    936962        } // ?|?
     963        void ?|?( istype & is, unsigned int & ui ) {
     964                (istype &)(is | ui); ends( is );
     965        } // ?|?
    937966
    938967        istype & ?|?( istype & is, long int & li ) {
     
    940969                return is;
    941970        } // ?|?
     971        void ?|?( istype & is, long int & li ) {
     972                (istype &)(is | li); ends( is );
     973        } // ?|?
    942974
    943975        istype & ?|?( istype & is, unsigned long int & ulli ) {
     
    945977                return is;
    946978        } // ?|?
     979        void ?|?( istype & is, unsigned long int & ulli ) {
     980                (istype &)(is | ulli); ends( is );
     981        } // ?|?
    947982
    948983        istype & ?|?( istype & is, long long int & lli ) {
     
    950985                return is;
    951986        } // ?|?
     987        void ?|?( istype & is, long long int & lli ) {
     988                (istype &)(is | lli); ends( is );
     989        } // ?|?
    952990
    953991        istype & ?|?( istype & is, unsigned long long int & ulli ) {
     
    955993                return is;
    956994        } // ?|?
     995        void & ?|?( istype & is, unsigned long long int & ulli ) {
     996                (istype &)(is | ulli); ends( is );
     997        } // ?|?
    957998
    958999#if defined( __SIZEOF_INT128__ )
    959         istype & ?|?( istype & is, int128 & i128 ) {
    960                 return (istype &)(is | (unsigned int128 &)i128);
    961         } // ?|?
    962 
    963         istype & ?|?( istype & is, unsigned int128 & ui128 ) {
     1000        istype & ?|?( istype & is, int128 & llli ) {
     1001                return (istype &)(is | (unsigned int128 &)llli);
     1002        } // ?|?
     1003        void ?|?( istype & is, int128 & llli ) {
     1004                (istype &)(is | llli); ends( is );
     1005        } // ?|?
     1006
     1007        istype & ?|?( istype & is, unsigned int128 & ullli ) {
    9641008                char s[40];
    9651009                bool sign = false;
     
    9681012                // If the input is too large, the value returned is undefined. If there is no input, no value is returned
    9691013                if ( fmt( is, "%39[0-9]%*[0-9]", s ) == 1 ) {   // take first 39 characters, ignore remaining
    970                         ui128 = 0;
     1014                        ullli = 0;
    9711015                        for ( unsigned int i = 0; s[i] != '\0'; i += 1 ) {
    972                                 ui128 = ui128 * 10 + s[i] - '0';
     1016                                ullli = ullli * 10 + s[i] - '0';
    9731017                        } // for
    974                         if ( sign ) ui128 = -ui128;
     1018                        if ( sign ) ullli = -ullli;
    9751019                } else if ( sign ) ungetc( is, '-' );                   // return minus when no digits
    9761020                return is;
     1021        } // ?|?
     1022        void ?|?( istype & is, unsigned int128 & ullli ) {
     1023                (istype &)(is | ullli); ends( is );
    9771024        } // ?|?
    9781025#endif // __SIZEOF_INT128__
     
    9821029                return is;
    9831030        } // ?|?
     1031        void ?|?( istype & is, float & f ) {
     1032                (istype &)(is | f); ends( is );
     1033        } // ?|?
    9841034
    9851035        istype & ?|?( istype & is, double & d ) {
     
    9871037                return is;
    9881038        } // ?|?
     1039        void ?|?( istype & is, double & d ) {
     1040                (istype &)(is | d); ends( is );
     1041        } // ?|?
    9891042
    9901043        istype & ?|?( istype & is, long double & ld ) {
     
    9921045                return is;
    9931046        } // ?|?
    994 
     1047        void ?|?( istype & is, long double & ld ) {
     1048                (istype &)(is | ld); ends( is );
     1049        } // ?|?
    9951050
    9961051        istype & ?|?( istype & is, float _Complex & fc ) {
     
    10001055                return is;
    10011056        } // ?|?
     1057        void ?|?( istype & is, float _Complex & fc ) {
     1058                (istype &)(is | fc); ends( is );
     1059        } // ?|?
    10021060
    10031061        istype & ?|?( istype & is, double _Complex & dc ) {
     
    10071065                return is;
    10081066        } // ?|?
     1067        void ?|?( istype & is, double _Complex & dc ) {
     1068                (istype &)(is | dc); ends( is );
     1069        } // ?|?
    10091070
    10101071        istype & ?|?( istype & is, long double _Complex & ldc ) {
     
    10141075                return is;
    10151076        } // ?|?
     1077        void ?|?( istype & is, long double _Complex & ldc ) {
     1078                (istype &)(is | ldc); ends( is );
     1079        } // ?|?
    10161080
    10171081        // istype & ?|?( istype & is, const char fmt[] ) {
     
    10201084        // } // ?|?
    10211085
    1022         istype & ?|?( istype & is, char * s ) {
     1086        istype & ?|?( istype & is, char s[] ) {
    10231087                fmt( is, "%s", s );
    10241088                return is;
     1089        } // ?|?
     1090        void ?|?( istype & is, char s[] ) {
     1091                (istype &)(is | s); ends( is );
    10251092        } // ?|?
    10261093
     
    10291096                return manip( is );
    10301097        } // ?|?
     1098        void ?|?( istype & is, istype & (* manip)( istype & ) ) {
     1099                manip( is ); ends( is );
     1100        } // ?|?
    10311101
    10321102        istype & nl( istype & is ) {
     
    10441114                return is;
    10451115        } // nlOff
     1116
     1117        istype & acquire( istype & is ) {
     1118                acquire( is );                                                                  // call void returning
     1119                return is;
     1120        } // acquire
    10461121} // distribution
    10471122
    10481123// *********************************** manipulators ***********************************
    10491124
    1050 forall( dtype istype | istream( istype ) )
    1051 istype & ?|?( istype & is, _Istream_Cstr f ) {
    1052         // skip xxx
    1053         if ( ! f.s ) {
    1054                 // printf( "skip %s %d\n", f.scanset, f.wd );
    1055                 if ( f.wd == -1 ) fmt( is, f.scanset, "" );             // no input arguments
    1056                 else for ( f.wd ) fmt( is, "%*c" );
    1057                 return is;
    1058         } // if
    1059         size_t len = 0;
    1060         if ( f.scanset ) len = strlen( f.scanset );
    1061         char fmtstr[len + 16];
    1062         int start = 1;
    1063         fmtstr[0] = '%';
    1064         if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; }
    1065         if ( f.wd != -1 ) { start += sprintf( &fmtstr[start], "%d", f.wd ); }
    1066         // cstr %s, %*s, %ws, %*ws
    1067         if ( ! f.scanset ) {
    1068                 fmtstr[start] = 's'; fmtstr[start + 1] = '\0';
    1069                 // printf( "cstr %s\n", fmtstr );
     1125forall( istype & | istream( istype ) ) {
     1126        istype & ?|?( istype & is, _Istream_Cstr f ) {
     1127                // skip xxx
     1128                if ( ! f.s ) {
     1129                        // printf( "skip %s %d\n", f.scanset, f.wd );
     1130                        if ( f.wd == -1 ) fmt( is, f.scanset, "" );             // no input arguments
     1131                        else for ( f.wd ) fmt( is, "%*c" );
     1132                        return is;
     1133                } // if
     1134                size_t len = 0;
     1135                if ( f.scanset ) len = strlen( f.scanset );
     1136                char fmtstr[len + 16];
     1137                int start = 1;
     1138                fmtstr[0] = '%';
     1139                if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; }
     1140                if ( f.wd != -1 ) { start += sprintf( &fmtstr[start], "%d", f.wd ); }
     1141                // cstr %s, %*s, %ws, %*ws
     1142                if ( ! f.scanset ) {
     1143                        fmtstr[start] = 's'; fmtstr[start + 1] = '\0';
     1144                        // printf( "cstr %s\n", fmtstr );
     1145                        fmt( is, fmtstr, f.s );
     1146                        return is;
     1147                } // if
     1148                // incl %[xxx],  %*[xxx],  %w[xxx],  %*w[xxx]
     1149                // excl %[^xxx], %*[^xxx], %w[^xxx], %*w[^xxx]
     1150                fmtstr[start] = '['; start += 1;
     1151                if ( f.flags.inex ) { fmtstr[start] = '^'; start += 1; }
     1152                strcpy( &fmtstr[start], f.scanset );                            // copy includes '\0'
     1153                len += start;
     1154                fmtstr[len] = ']'; fmtstr[len + 1] = '\0';
     1155                // printf( "incl/excl %s\n", fmtstr );
    10701156                fmt( is, fmtstr, f.s );
    10711157                return is;
    1072         } // if
    1073         // incl %[xxx],  %*[xxx],  %w[xxx],  %*w[xxx]
    1074         // excl %[^xxx], %*[^xxx], %w[^xxx], %*w[^xxx]
    1075         fmtstr[start] = '['; start += 1;
    1076         if ( f.flags.inex ) { fmtstr[start] = '^'; start += 1; }
    1077         strcpy( &fmtstr[start], f.scanset );                            // copy includes '\0'
    1078         len += start;
    1079         fmtstr[len] = ']'; fmtstr[len + 1] = '\0';
    1080         // printf( "incl/excl %s\n", fmtstr );
    1081         fmt( is, fmtstr, f.s );
    1082         return is;
    1083 } // ?|?
    1084 
    1085 forall( dtype istype | istream( istype ) )
    1086 istype & ?|?( istype & is, _Istream_Char f ) {
    1087         fmt( is, "%*c" );                                                                       // argument variable unused
    1088         return is;
    1089 } // ?|?
     1158        } // ?|?
     1159        void ?|?( istype & is, _Istream_Cstr f ) {
     1160                (istype &)(is | f); ends( is );
     1161        } // ?|?
     1162
     1163        istype & ?|?( istype & is, _Istream_Char f ) {
     1164                fmt( is, "%*c" );                                                                       // argument variable unused
     1165                return is;
     1166        } // ?|?
     1167        void ?|?( istype & is, _Istream_Char f ) {
     1168                (istype &)(is | f); ends( is );
     1169        } // ?|?
     1170} // distribution
    10901171
    10911172#define InputFMTImpl( T, CODE ) \
    1092 forall( dtype istype | istream( istype ) ) \
    1093 istype & ?|?( istype & is, _Istream_Manip(T) f ) { \
    1094         enum { size = 16 }; \
    1095         char fmtstr[size]; \
    1096         if ( f.wd == -1 ) { \
    1097                 snprintf( fmtstr, size, "%%%s%s", f.ignore ? "*" : "", CODE ); \
    1098         } else { \
    1099                 snprintf( fmtstr, size, "%%%s%d%s", f.ignore ? "*" : "", f.wd, CODE ); \
    1100         } /* if */ \
    1101         /* printf( "%d %s %p\n", f.wd, fmtstr, &f.val ); */ \
    1102         fmt( is, fmtstr, &f.val ); \
    1103         return is; \
    1104 } // ?|?
     1173forall( istype & | istream( istype ) ) { \
     1174        istype & ?|?( istype & is, _Istream_Manip(T) f ) { \
     1175                enum { size = 16 }; \
     1176                char fmtstr[size]; \
     1177                if ( f.wd == -1 ) { \
     1178                        snprintf( fmtstr, size, "%%%s%s", f.ignore ? "*" : "", CODE ); \
     1179                } else { \
     1180                        snprintf( fmtstr, size, "%%%s%d%s", f.ignore ? "*" : "", f.wd, CODE ); \
     1181                } /* if */ \
     1182                /* printf( "%d %s %p\n", f.wd, fmtstr, &f.val ); */ \
     1183                fmt( is, fmtstr, &f.val ); \
     1184                return is; \
     1185        } /* ?|? */ \
     1186        void ?|?( istype & is, _Istream_Manip(T) f ) { \
     1187                (istype &)(is | f); ends( is ); \
     1188        } /* ?|? */ \
     1189} // distribution
    11051190
    11061191InputFMTImpl( signed char, "hhi" )
     
    11191204InputFMTImpl( long double, "Lf" )
    11201205
    1121 forall( dtype istype | istream( istype ) )
    1122 istype & ?|?( istype & is, _Istream_Manip(float _Complex) fc ) {
    1123         float re, im;
    1124         _Istream_Manip(float) fmtuc @= { re, fc.wd, fc.ignore };
    1125         is | fmtuc;
    1126         &fmtuc.val = &im;
    1127         is | fmtuc;
    1128         if ( ! fc.ignore ) fc.val = re + im * _Complex_I;       // re/im are uninitialized for ignore
    1129         return is;
    1130 } // ?|?
    1131 
    1132 forall( dtype istype | istream( istype ) )
    1133 istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
    1134         double re, im;
    1135         _Istream_Manip(double) fmtuc @= { re, dc.wd, dc.ignore };
    1136         is | fmtuc;
    1137         &fmtuc.val = &im;
    1138         is | fmtuc;
    1139         if ( ! dc.ignore ) dc.val = re + im * _Complex_I;       // re/im are uninitialized for ignore
    1140         return is;
    1141 } // ?|?
    1142 
    1143 forall( dtype istype | istream( istype ) )
    1144 istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
    1145         long double re, im;
    1146         _Istream_Manip(long double) fmtuc @= { re, ldc.wd, ldc.ignore };
    1147         is | fmtuc;
    1148         &fmtuc.val = &im;
    1149         is | fmtuc;
    1150         if ( ! ldc.ignore ) ldc.val = re + im * _Complex_I;     // re/im are uninitialized for ignore
    1151         return is;
    1152 } // ?|?
     1206forall( istype & | istream( istype ) ) {
     1207        istype & ?|?( istype & is, _Istream_Manip(float _Complex) fc ) {
     1208                float re, im;
     1209                _Istream_Manip(float) fmtuc @= { re, fc.wd, fc.ignore };
     1210                is | fmtuc;
     1211                &fmtuc.val = &im;
     1212                is | fmtuc;
     1213                if ( ! fc.ignore ) fc.val = re + im * _Complex_I; // re/im are uninitialized for ignore
     1214                return is;
     1215        } // ?|?
     1216        void ?|?( istype & is, _Istream_Manip(float _Complex) fc ) {
     1217                (istype &)(is | fc); ends( is );
     1218        } // ?|?
     1219
     1220        istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
     1221                double re, im;
     1222                _Istream_Manip(double) fmtuc @= { re, dc.wd, dc.ignore };
     1223                is | fmtuc;
     1224                &fmtuc.val = &im;
     1225                is | fmtuc;
     1226                if ( ! dc.ignore ) dc.val = re + im * _Complex_I; // re/im are uninitialized for ignore
     1227                return is;
     1228        } // ?|?
     1229        void ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
     1230                (istype &)(is | dc); ends( is );
     1231        } // ?|?
     1232
     1233        istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
     1234                long double re, im;
     1235                _Istream_Manip(long double) fmtuc @= { re, ldc.wd, ldc.ignore };
     1236                is | fmtuc;
     1237                &fmtuc.val = &im;
     1238                is | fmtuc;
     1239                if ( ! ldc.ignore ) ldc.val = re + im * _Complex_I;     // re/im are uninitialized for ignore
     1240                return is;
     1241        } // ?|?
     1242        void ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
     1243                (istype &)(is | ldc); ends( is );
     1244        } // ?|?
     1245} // distribution
    11531246
    11541247// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.