Changeset 8e4aa05 for libcfa/src/iostream.cfa
- Timestamp:
- Mar 4, 2021, 7:40:25 PM (5 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r342af53 r8e4aa05 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 24 08:31:35 202013 // Update Count : 11 3012 // Last Modified On : Tue Mar 2 14:51:30 2021 13 // Update Count : 1151 14 14 // 15 15 … … 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 ) ); … … 266 266 } // ?|? 267 267 268 ostype & ?|?( ostype & os, const char s tr[] ) {268 ostype & ?|?( ostype & os, const char s[] ) { 269 269 enum { Open = 1, Close, OpenClose }; 270 270 static const unsigned char mask[256] @= { … … 282 282 }; // mask 283 283 284 if ( s tr[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator284 if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator 285 285 286 286 // first character IS NOT spacing or closing punctuation => add left separator 287 unsigned char ch = s tr[0]; // must make unsigned287 unsigned char ch = s[0]; // must make unsigned 288 288 if ( $sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) { 289 289 fmt( os, "%s", $sepGetCur( os ) ); … … 294 294 295 295 // last character IS spacing or opening punctuation => turn off separator for next item 296 size_t len = strlen( s tr);297 ch = s tr[len - 1]; // must make unsigned296 size_t len = strlen( s ); 297 ch = s[len - 1]; // must make unsigned 298 298 if ( $sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 299 299 sepOn( os ); … … 302 302 } // if 303 303 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 ) { 312 311 // if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); 313 // fmt( os, "%ls", s tr);312 // fmt( os, "%ls", s ); 314 313 // return os; 315 314 // } // ?|? 316 315 317 316 // #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous 318 // ostype & ?|?( ostype & os, const char32_t * s tr) {317 // ostype & ?|?( ostype & os, const char32_t * s ) { 319 318 // if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); 320 // fmt( os, "%ls", s tr);319 // fmt( os, "%ls", s ); 321 320 // return os; 322 321 // } // ?|? 323 322 // #endif // ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) 324 323 325 // ostype & ?|?( ostype & os, const wchar_t * s tr) {324 // ostype & ?|?( ostype & os, const wchar_t * s ) { 326 325 // if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); 327 // fmt( os, "%ls", s tr);326 // fmt( os, "%ls", s ); 328 327 // return os; 329 328 // } // ?|? … … 340 339 // manipulators 341 340 ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) { 342 (ostype &)(manip( os )); 343 return os; 341 return manip( os ); 344 342 } // ?|? 345 343 void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) { 346 (ostype &)(manip( os ));344 manip( os ); 347 345 if ( $getPrt( os ) ) ends( os ); // something printed ? 348 346 $setPrt( os, false ); // turn off … … 399 397 return os; 400 398 } // nlOff 399 400 ostype & acquire( ostype & os ) { 401 acquire( os ); // call void returning 402 return os; 403 } // acquire 401 404 } // distribution 402 405 403 406 // tuples 404 forall( dtype ostype, otype T, ttype Params| writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) {407 forall( ostype &, T, Params... | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) { 405 408 ostype & ?|?( ostype & os, T arg, Params rest ) { 406 409 (ostype &)(os | arg); // print first argument … … 421 424 422 425 // writes the range [begin, end) to the given stream 423 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otypeiterator_type | iterator( iterator_type, elt_type ) ) {426 forall( ostype &, elt_type | writeable( elt_type, ostype ), iterator_type | iterator( iterator_type, elt_type ) ) { 424 427 void write( iterator_type begin, iterator_type end, ostype & os ) { 425 428 void print( elt_type i ) { os | i; } … … 442 445 // Default prefix for non-decimal prints is 0b, 0, 0x. 443 446 #define IntegralFMTImpl( T, IFMTNP, IFMTP ) \ 444 forall( dtype ostype| ostream( ostype ) ) { \447 forall( ostype & | ostream( ostype ) ) { \ 445 448 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 446 449 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \ … … 517 520 return os; \ 518 521 } /* ?|? */ \ 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 } /* ?|? */ \ 520 525 } // distribution 521 526 … … 535 540 // Default prefix for non-decimal prints is 0b, 0, 0x. 536 541 #define IntegralFMTImpl128( T, SIGNED, CODE, IFMTNP, IFMTP ) \ 537 forall( dtype ostype| ostream( ostype ) ) \542 forall( ostype & | ostream( ostype ) ) \ 538 543 static void base10_128( ostype & os, _Ostream_Manip(T) f ) { \ 539 544 if ( f.val > UINT64_MAX ) { \ … … 552 557 } /* if */ \ 553 558 } /* base10_128 */ \ 554 forall( dtype ostype| ostream( ostype ) ) { \559 forall( ostype & | ostream( ostype ) ) { \ 555 560 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 556 561 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \ … … 654 659 #if defined( __SIZEOF_INT128__ ) 655 660 // Default prefix for non-decimal prints is 0b, 0, 0x. 656 forall( dtype ostype| ostream( ostype ) )661 forall( ostype & | ostream( ostype ) ) 657 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 ) { 658 663 int wd = 1; // f.wd is never 0 because 0 implies left-pad … … 719 724 720 725 #define IntegralFMTImpl128( T ) \ 721 forall( dtype ostype| ostream( ostype ) ) { \726 forall( ostype & | ostream( ostype ) ) { \ 722 727 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 723 728 _Ostream_Manip(uint64_t) fmt; \ … … 767 772 768 773 #define FloatingPointFMTImpl( T, DFMTNP, DFMTP ) \ 769 forall( dtype ostype| ostream( ostype ) ) { \774 forall( ostype & | ostream( ostype ) ) { \ 770 775 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 771 776 if ( $sepPrt( os ) ) fmt( os, "%s", $sepGetCur( os ) ); \ … … 801 806 // *********************************** character *********************************** 802 807 803 forall( dtype ostype| ostream( ostype ) ) {808 forall( ostype & | ostream( ostype ) ) { 804 809 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) { 805 810 if ( f.base != 'c' ) { // bespoke binary/octal/hex format … … 834 839 // *********************************** C string *********************************** 835 840 836 forall( dtype ostype| ostream( ostype ) ) {841 forall( ostype & | ostream( ostype ) ) { 837 842 ostype & ?|?( ostype & os, _Ostream_Manip(const char *) f ) { 838 843 if ( ! f.val ) return os; // null pointer ? … … 882 887 883 888 884 forall( dtype istype| istream( istype ) ) {889 forall( istype & | istream( istype ) ) { 885 890 istype & ?|?( istype & is, bool & b ) { 886 891 char val[6]; … … 894 899 return is; 895 900 } // ?|? 901 void ?|?( istype & is, bool & b ) { 902 (istype &)(is | b); ends( is ); 903 } // ?|? 896 904 897 905 istype & ?|?( istype & is, char & c ) { … … 905 913 return is; 906 914 } // ?|? 915 void ?|?( istype & is, char & c ) { 916 (istype &)(is | c); ends( is ); 917 } // ?|? 907 918 908 919 istype & ?|?( istype & is, signed char & sc ) { … … 910 921 return is; 911 922 } // ?|? 923 void ?|?( istype & is, signed char & sc ) { 924 (istype &)(is | sc); ends( is ); 925 } // ?|? 912 926 913 927 istype & ?|?( istype & is, unsigned char & usc ) { … … 915 929 return is; 916 930 } // ?|? 931 void ?|?( istype & is, unsigned char & usc ) { 932 (istype &)(is | usc); ends( is ); 933 } // ?|? 917 934 918 935 istype & ?|?( istype & is, short int & si ) { … … 920 937 return is; 921 938 } // ?|? 939 void ?|?( istype & is, short int & si ) { 940 (istype &)(is | si); ends( is ); 941 } // ?|? 922 942 923 943 istype & ?|?( istype & is, unsigned short int & usi ) { … … 925 945 return is; 926 946 } // ?|? 947 void ?|?( istype & is, unsigned short int & usi ) { 948 (istype &)(is | usi); ends( is ); 949 } // ?|? 927 950 928 951 istype & ?|?( istype & is, int & i ) { … … 930 953 return is; 931 954 } // ?|? 955 void ?|?( istype & is, int & i ) { 956 (istype &)(is | i); ends( is ); 957 } // ?|? 932 958 933 959 istype & ?|?( istype & is, unsigned int & ui ) { … … 935 961 return is; 936 962 } // ?|? 963 void ?|?( istype & is, unsigned int & ui ) { 964 (istype &)(is | ui); ends( is ); 965 } // ?|? 937 966 938 967 istype & ?|?( istype & is, long int & li ) { … … 940 969 return is; 941 970 } // ?|? 971 void ?|?( istype & is, long int & li ) { 972 (istype &)(is | li); ends( is ); 973 } // ?|? 942 974 943 975 istype & ?|?( istype & is, unsigned long int & ulli ) { … … 945 977 return is; 946 978 } // ?|? 979 void ?|?( istype & is, unsigned long int & ulli ) { 980 (istype &)(is | ulli); ends( is ); 981 } // ?|? 947 982 948 983 istype & ?|?( istype & is, long long int & lli ) { … … 950 985 return is; 951 986 } // ?|? 987 void ?|?( istype & is, long long int & lli ) { 988 (istype &)(is | lli); ends( is ); 989 } // ?|? 952 990 953 991 istype & ?|?( istype & is, unsigned long long int & ulli ) { … … 955 993 return is; 956 994 } // ?|? 995 void & ?|?( istype & is, unsigned long long int & ulli ) { 996 (istype &)(is | ulli); ends( is ); 997 } // ?|? 957 998 958 999 #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 ) { 964 1008 char s[40]; 965 1009 bool sign = false; … … 968 1012 // If the input is too large, the value returned is undefined. If there is no input, no value is returned 969 1013 if ( fmt( is, "%39[0-9]%*[0-9]", s ) == 1 ) { // take first 39 characters, ignore remaining 970 u i128= 0;1014 ullli = 0; 971 1015 for ( unsigned int i = 0; s[i] != '\0'; i += 1 ) { 972 u i128 = ui128* 10 + s[i] - '0';1016 ullli = ullli * 10 + s[i] - '0'; 973 1017 } // for 974 if ( sign ) u i128 = -ui128;1018 if ( sign ) ullli = -ullli; 975 1019 } else if ( sign ) ungetc( is, '-' ); // return minus when no digits 976 1020 return is; 1021 } // ?|? 1022 void ?|?( istype & is, unsigned int128 & ullli ) { 1023 (istype &)(is | ullli); ends( is ); 977 1024 } // ?|? 978 1025 #endif // __SIZEOF_INT128__ … … 982 1029 return is; 983 1030 } // ?|? 1031 void ?|?( istype & is, float & f ) { 1032 (istype &)(is | f); ends( is ); 1033 } // ?|? 984 1034 985 1035 istype & ?|?( istype & is, double & d ) { … … 987 1037 return is; 988 1038 } // ?|? 1039 void ?|?( istype & is, double & d ) { 1040 (istype &)(is | d); ends( is ); 1041 } // ?|? 989 1042 990 1043 istype & ?|?( istype & is, long double & ld ) { … … 992 1045 return is; 993 1046 } // ?|? 994 1047 void ?|?( istype & is, long double & ld ) { 1048 (istype &)(is | ld); ends( is ); 1049 } // ?|? 995 1050 996 1051 istype & ?|?( istype & is, float _Complex & fc ) { … … 1000 1055 return is; 1001 1056 } // ?|? 1057 void ?|?( istype & is, float _Complex & fc ) { 1058 (istype &)(is | fc); ends( is ); 1059 } // ?|? 1002 1060 1003 1061 istype & ?|?( istype & is, double _Complex & dc ) { … … 1007 1065 return is; 1008 1066 } // ?|? 1067 void ?|?( istype & is, double _Complex & dc ) { 1068 (istype &)(is | dc); ends( is ); 1069 } // ?|? 1009 1070 1010 1071 istype & ?|?( istype & is, long double _Complex & ldc ) { … … 1014 1075 return is; 1015 1076 } // ?|? 1077 void ?|?( istype & is, long double _Complex & ldc ) { 1078 (istype &)(is | ldc); ends( is ); 1079 } // ?|? 1016 1080 1017 1081 // istype & ?|?( istype & is, const char fmt[] ) { … … 1020 1084 // } // ?|? 1021 1085 1022 istype & ?|?( istype & is, char * s) {1086 istype & ?|?( istype & is, char s[] ) { 1023 1087 fmt( is, "%s", s ); 1024 1088 return is; 1089 } // ?|? 1090 void ?|?( istype & is, char s[] ) { 1091 (istype &)(is | s); ends( is ); 1025 1092 } // ?|? 1026 1093 … … 1029 1096 return manip( is ); 1030 1097 } // ?|? 1098 void ?|?( istype & is, istype & (* manip)( istype & ) ) { 1099 manip( is ); ends( is ); 1100 } // ?|? 1031 1101 1032 1102 istype & nl( istype & is ) { … … 1044 1114 return is; 1045 1115 } // nlOff 1116 1117 istype & acquire( istype & is ) { 1118 acquire( is ); // call void returning 1119 return is; 1120 } // acquire 1046 1121 } // distribution 1047 1122 1048 1123 // *********************************** manipulators *********************************** 1049 1124 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 ); 1125 forall( 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 ); 1070 1156 fmt( is, fmtstr, f.s ); 1071 1157 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 1090 1171 1091 1172 #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 } // ?|? 1173 forall( 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 1105 1190 1106 1191 InputFMTImpl( signed char, "hhi" ) … … 1119 1204 InputFMTImpl( long double, "Lf" ) 1120 1205 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 } // ?|? 1206 forall( 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 1153 1246 1154 1247 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.