- Timestamp:
- Jun 5, 2023, 10:33:25 PM (21 months ago)
- Branches:
- ast-experimental, master
- Children:
- 6a93e4d
- Parents:
- 134e6d9
- Location:
- libcfa/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.cfa
r134e6d9 r874b16e 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 9 14:55:54 202213 // Update Count : 51 512 // Last Modified On : Mon Jun 5 22:00:23 2023 13 // Update Count : 518 14 14 // 15 15 … … 117 117 } // for 118 118 if ( file == 0p ) { 119 throw ( Open_Failure){ os };119 throw (open_failure){ os }; 120 120 // abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno ); 121 121 } // if … … 137 137 } // for 138 138 if ( ret == EOF ) { 139 throw ( Close_Failure){ os };139 throw (close_failure){ os }; 140 140 // abort | IO_MSG "close output" | nl | strerror( errno ); 141 141 } // if … … 145 145 ofstream & write( ofstream & os, const char data[], size_t size ) { 146 146 if ( fail( os ) ) { 147 throw ( Write_Failure){ os };147 throw (write_failure){ os }; 148 148 // abort | IO_MSG "attempt write I/O on failed stream"; 149 149 } // if 150 150 151 151 if ( fwrite( data, 1, size, (FILE *)(os.file$) ) != size ) { 152 throw ( Write_Failure){ os };152 throw (write_failure){ os }; 153 153 // abort | IO_MSG "write" | nl | strerror( errno ); 154 154 } // if … … 240 240 } // for 241 241 if ( file == 0p ) { 242 throw ( Open_Failure){ is };242 throw (open_failure){ is }; 243 243 // abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno ); 244 244 } // if … … 260 260 } // for 261 261 if ( ret == EOF ) { 262 throw ( Close_Failure){ is };262 throw (close_failure){ is }; 263 263 // abort | IO_MSG "close input" | nl | strerror( errno ); 264 264 } // if … … 268 268 ifstream & read( ifstream & is, char data[], size_t size ) { 269 269 if ( fail( is ) ) { 270 throw ( Read_Failure){ is };270 throw (read_failure){ is }; 271 271 // abort | IO_MSG "attempt read I/O on failed stream"; 272 272 } // if 273 273 274 274 if ( fread( data, size, 1, (FILE *)(is.file$) ) == 0 ) { 275 throw ( Read_Failure){ is };275 throw (read_failure){ is }; 276 276 // abort | IO_MSG "read" | nl | strerror( errno ); 277 277 } // if … … 318 318 319 319 320 static vtable( Open_Failure) Open_Failure_vt;320 static vtable(open_failure) open_failure_vt; 321 321 322 322 // exception I/O constructors 323 void ?{}( Open_Failure & ex, ofstream & ostream ) with(ex) {324 virtual_table = & Open_Failure_vt;323 void ?{}( open_failure & ex, ofstream & ostream ) with(ex) { 324 virtual_table = &open_failure_vt; 325 325 ostream = &ostream; 326 326 tag = 1; 327 327 } // ?{} 328 328 329 void ?{}( Open_Failure & ex, ifstream & istream ) with(ex) {330 virtual_table = & Open_Failure_vt;329 void ?{}( open_failure & ex, ifstream & istream ) with(ex) { 330 virtual_table = &open_failure_vt; 331 331 istream = &istream; 332 332 tag = 0; … … 334 334 335 335 336 static vtable( Close_Failure) Close_Failure_vt;336 static vtable(close_failure) close_failure_vt; 337 337 338 338 // exception I/O constructors 339 void ?{}( Close_Failure & ex, ofstream & ostream ) with(ex) {340 virtual_table = & Close_Failure_vt;339 void ?{}( close_failure & ex, ofstream & ostream ) with(ex) { 340 virtual_table = &close_failure_vt; 341 341 ostream = &ostream; 342 342 tag = 1; 343 343 } // ?{} 344 344 345 void ?{}( Close_Failure & ex, ifstream & istream ) with(ex) {346 virtual_table = & Close_Failure_vt;345 void ?{}( close_failure & ex, ifstream & istream ) with(ex) { 346 virtual_table = &close_failure_vt; 347 347 istream = &istream; 348 348 tag = 0; … … 350 350 351 351 352 static vtable( Write_Failure) Write_Failure_vt;352 static vtable(write_failure) write_failure_vt; 353 353 354 354 // exception I/O constructors 355 void ?{}( Write_Failure & ex, ofstream & ostream ) with(ex) {356 virtual_table = & Write_Failure_vt;355 void ?{}( write_failure & ex, ofstream & ostream ) with(ex) { 356 virtual_table = &write_failure_vt; 357 357 ostream = &ostream; 358 358 tag = 1; 359 359 } // ?{} 360 360 361 void ?{}( Write_Failure & ex, ifstream & istream ) with(ex) {362 virtual_table = & Write_Failure_vt;361 void ?{}( write_failure & ex, ifstream & istream ) with(ex) { 362 virtual_table = &write_failure_vt; 363 363 istream = &istream; 364 364 tag = 0; … … 366 366 367 367 368 static vtable( Read_Failure) Read_Failure_vt;368 static vtable(read_failure) read_failure_vt; 369 369 370 370 // exception I/O constructors 371 void ?{}( Read_Failure & ex, ofstream & ostream ) with(ex) {372 virtual_table = & Read_Failure_vt;371 void ?{}( read_failure & ex, ofstream & ostream ) with(ex) { 372 virtual_table = &read_failure_vt; 373 373 ostream = &ostream; 374 374 tag = 1; 375 375 } // ?{} 376 376 377 void ?{}( Read_Failure & ex, ifstream & istream ) with(ex) {378 virtual_table = & Read_Failure_vt;377 void ?{}( read_failure & ex, ifstream & istream ) with(ex) { 378 virtual_table = &read_failure_vt; 379 379 istream = &istream; 380 380 tag = 0; 381 381 } // ?{} 382 382 383 // void throw Open_Failure( ofstream & ostream ) {384 // Open_Failure exc = { ostream };383 // void throwopen_failure( ofstream & ostream ) { 384 // open_failure exc = { ostream }; 385 385 // } 386 386 387 // void throw Open_Failure( ifstream & istream ) {388 // Open_Failure exc = { istream };387 // void throwopen_failure( ifstream & istream ) { 388 // open_failure exc = { istream }; 389 389 // } 390 390 -
libcfa/src/fstream.hfa
r134e6d9 r874b16e 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 10 09:37:32 202113 // Update Count : 24 312 // Last Modified On : Mon Jun 5 22:00:20 2023 13 // Update Count : 246 14 14 // 15 15 … … 137 137 138 138 139 exception Open_Failure {139 exception open_failure { 140 140 union { 141 141 ofstream * ostream; … … 146 146 }; 147 147 148 void ?{}( Open_Failure & this, ofstream & );149 void ?{}( Open_Failure & this, ifstream & );148 void ?{}( open_failure & this, ofstream & ); 149 void ?{}( open_failure & this, ifstream & ); 150 150 151 exception Close_Failure {151 exception close_failure { 152 152 union { 153 153 ofstream * ostream; … … 158 158 }; 159 159 160 void ?{}( Close_Failure & this, ofstream & );161 void ?{}( Close_Failure & this, ifstream & );160 void ?{}( close_failure & this, ofstream & ); 161 void ?{}( close_failure & this, ifstream & ); 162 162 163 exception Write_Failure {163 exception write_failure { 164 164 union { 165 165 ofstream * ostream; … … 170 170 }; 171 171 172 void ?{}( Write_Failure & this, ofstream & );173 void ?{}( Write_Failure & this, ifstream & );172 void ?{}( write_failure & this, ofstream & ); 173 void ?{}( write_failure & this, ifstream & ); 174 174 175 exception Read_Failure {175 exception read_failure { 176 176 union { 177 177 ofstream * ostream; … … 182 182 }; 183 183 184 void ?{}( Read_Failure & this, ofstream & );185 void ?{}( Read_Failure & this, ifstream & );184 void ?{}( read_failure & this, ofstream & ); 185 void ?{}( read_failure & this, ifstream & ); 186 186 187 187 // Local Variables: // -
libcfa/src/parseconfig.cfa
r134e6d9 r874b16e 144 144 in | nl; // ignore remainder of line 145 145 } // for 146 } catch( Open_Failure * ex; ex->istream == &in ) {146 } catch( open_failure * ex; ex->istream == &in ) { 147 147 delete( kv_pairs ); 148 148 throw *ex;
Note: See TracChangeset
for help on using the changeset viewer.