- Timestamp:
- May 16, 2019, 10:59:00 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3d8d7a7, aa00626
- Parents:
- 8a5530c (diff), 7a54d67 (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. - Location:
- libcfa/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.cfa
r8a5530c rf2e482cb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 20 12:03:43201913 // Update Count : 3 1112 // Last Modified On : Thu May 16 08:33:28 2019 13 // Update Count : 328 14 14 // 15 15 … … 27 27 #define IO_MSG "I/O error: " 28 28 29 void ?{}( ofstream & os, void * file , bool sepDefault, bool sepOnOff, bool nlOnOff, bool prt, const char * separator, const char * tupleSeparator) {29 void ?{}( ofstream & os, void * file ) { 30 30 os.file = file; 31 os.sepDefault = sepDefault;32 os.sepOnOff = sepOnOff;33 os.nlOnOff = nlOnOff;34 os.prt = prt;31 os.sepDefault = true; 32 os.sepOnOff = false; 33 os.nlOnOff = true; 34 os.prt = false; 35 35 os.sawNL = false; 36 sepSet( os, separator);36 sepSet( os, " " ); 37 37 sepSetCur( os, sepGet( os ) ); 38 sepSetTuple( os, tupleSeparator);38 sepSetTuple( os, ", " ); 39 39 } 40 40 … … 104 104 105 105 void open( ofstream & os, const char * name, const char * mode ) { 106 FILE * file = fopen( name, mode );106 FILE * file = fopen( name, mode ); 107 107 #ifdef __CFA_DEBUG__ 108 108 if ( file == 0 ) { … … 110 110 } // if 111 111 #endif // __CFA_DEBUG__ 112 (os){ file , true, false, true, false, " ", ", "};112 (os){ file }; 113 113 } // open 114 114 … … 152 152 } // fmt 153 153 154 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_) , true, false, true, false, " ", ", "};154 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_) }; 155 155 ofstream & sout = soutFile; 156 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_) , true, false, true, false, " ", ", "};156 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_) }; 157 157 ofstream & serr = serrFile; 158 158 159 // static ofstream sexitFile = { (FILE *)(&_IO_2_1_stdout_) }; 160 // ofstream & sexit = sexitFile; 161 // static ofstream sabortFile = { (FILE *)(&_IO_2_1_stderr_) }; 162 // ofstream & sabort = sabortFile; 163 164 void nl( ofstream & os ) { 165 if ( getANL( os ) ) (ofstream &)(nl( os )); // implementation only 166 else setPrt( os, false ); // turn off 167 } 159 168 160 169 //--------------------------------------- -
libcfa/src/fstream.hfa
r8a5530c rf2e482cb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 20 12:03:58201913 // Update Count : 15 112 // Last Modified On : Thu May 16 08:34:10 2019 13 // Update Count : 157 14 14 // 15 15 … … 70 70 extern ofstream & sout, & serr; 71 71 72 // extern ofstream & sout, & serr, & sexit, & sabort; 73 // void nl( ofstream & os ); 74 72 75 73 76 struct ifstream { -
libcfa/src/iostream.cfa
r8a5530c rf2e482cb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 20 14:02:43201913 // Update Count : 6 1712 // Last Modified On : Mon May 13 12:46:45 2019 13 // Update Count : 650 14 14 // 15 15 … … 23 23 extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); 24 24 #include <float.h> // DBL_DIG, LDBL_DIG 25 #include <math.h> // modff, modf, modlf 25 26 #include <complex.h> // creal, cimag 26 27 } … … 156 157 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 157 158 fmt( os, "%g", f ); 159 float tempi; 160 if ( isfinite( f ) && modff( f, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 158 161 return os; 159 162 } // ?|? … … 165 168 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 166 169 fmt( os, "%.*lg", DBL_DIG, d ); 170 // fmt( os, "%lg", d ); 171 double tempi; 172 if ( isfinite( d ) && modf( d, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 167 173 return os; 168 174 } // ?|? … … 174 180 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 175 181 fmt( os, "%.*Lg", LDBL_DIG, ld ); 182 // fmt( os, "%Lg", ld ); 183 long double tempi; 184 if ( isfinite( ld ) && modfl( ld, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 176 185 return os; 177 186 } // ?|? … … 182 191 ostype & ?|?( ostype & os, float _Complex fc ) { 183 192 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 184 fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) ); 193 float temp = crealf( fc ), tempi; 194 fmt( os, "%g", temp ); 195 if ( isfinite( temp ) && modff( temp, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 196 temp = cimagf( fc ); 197 fmt( os, "%+g", temp ); 198 if ( isfinite( temp ) && modff( temp, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 199 fmt( os, "i" ); 185 200 return os; 186 201 } // ?|? … … 191 206 ostype & ?|?( ostype & os, double _Complex dc ) { 192 207 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 193 fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) ); 208 double temp = creal( dc ), tempi; 209 fmt( os, "%.*lg", DBL_DIG, temp ); 210 if ( isfinite( temp ) && modf( temp, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 211 temp = cimag( dc ); 212 fmt( os, "%+.*lg", DBL_DIG, temp ); 213 if ( isfinite( temp ) && modf( temp, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 214 fmt( os, "i" ); 215 // fmt( os, "%lg%+lgi", creal( dc ), cimag( dc ) ); 194 216 return os; 195 217 } // ?|? … … 200 222 ostype & ?|?( ostype & os, long double _Complex ldc ) { 201 223 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 202 fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) ); 224 long double temp = creall( ldc ), tempi; 225 fmt( os, "%.*Lg", LDBL_DIG, temp ); 226 if ( isfinite( temp ) && modfl( temp, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 227 temp = cimagl( ldc ); 228 fmt( os, "%+.*Lg", LDBL_DIG, cimagl( ldc ) ); 229 if ( isfinite( temp ) && modfl( temp, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 230 fmt( os, "i" ); 231 // fmt( os, "%Lg%+Lgi", creall( ldc ), cimagl( ldc ) ); 203 232 return os; 204 233 } // ?|? … … 494 523 } // ?|? 495 524 496 497 525 // manipulators 498 526 istype & ?|?( istype & is, istype & (* manip)( istype & ) ) { … … 501 529 502 530 istype & nl( istype & is ) { 503 fmt( is, "%*[ \t\f\n\r\v]" ); // ignore whitespace531 fmt( is, "%*[^\n]" ); // ignore characters to newline 504 532 return is; 505 533 } // nl -
libcfa/src/iostream.hfa
r8a5530c rf2e482cb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri May 3 22:55:04201913 // Update Count : 23 012 // Last Modified On : Sat May 11 10:31:27 2019 13 // Update Count : 232 14 14 // 15 15 … … 190 190 191 191 // manipulators 192 istype & ?|?( istype &, istype & (*)( istype & ) ); 193 istype & nl( istype & is ); 192 194 istype & nlOn( istype & ); 193 195 istype & nlOff( istype & ); 194 istype & ?|?( istype &, istype & (*)( istype & ) );195 istype & nl( istype & is );196 196 } // distribution 197 197 … … 215 215 216 216 // Local Variables: // 217 // mode: c //218 217 // tab-width: 4 // 219 218 // End: //
Note: See TracChangeset
for help on using the changeset viewer.