Ignore:
Timestamp:
Jun 19, 2020, 5:46:38 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6c4bd02
Parents:
1d2314f
Message:

adjust / comments, change exception name from IO_OPEN_FAILURE to Open_Failure, add temporary Open_Failure tag in lieu of polymorphic exceptions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    r1d2314f r8d321f9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun 18 15:37:21 2020
    13 // Update Count     : 380
     12// Last Modified On : Fri Jun 19 16:24:54 2020
     13// Update Count     : 384
    1414//
    1515
     
    2626
    2727
    28 //*********************************** ofstream ***********************************
     28// *********************************** ofstream ***********************************
    2929
    3030
     
    123123        #ifdef __CFA_DEBUG__
    124124        if ( file == 0p ) {
    125                 throw (IO_OPEN_FAILURE){ os };
    126                 abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
     125                throw (Open_Failure){ os };
     126                // abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
    127127        } // if
    128128        #endif // __CFA_DEBUG__
     
    182182
    183183
    184 //*********************************** ifstream ***********************************
     184// *********************************** ifstream ***********************************
    185185
    186186
     
    222222        #ifdef __CFA_DEBUG__
    223223        if ( file == 0p ) {
    224                 throw (IO_OPEN_FAILURE){ is };
    225                 abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
     224                throw (Open_Failure){ is };
     225                // abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
    226226        } // if
    227227        #endif // __CFA_DEBUG__
     
    283283
    284284
    285 //*********************************** exceptions ***********************************
    286 
    287 
    288 void ?{}( IO_OPEN_FAILURE & this, ofstream & ostream ) {
    289         VTABLE_INIT(this, IO_OPEN_FAILURE);
     285// *********************************** exceptions ***********************************
     286
     287
     288void ?{}( Open_Failure & this, ofstream & ostream ) {
     289        VTABLE_INIT(this, Open_Failure);
    290290        this.ostream = &ostream;
    291 }
    292 void ?{}( IO_OPEN_FAILURE & this, ifstream & istream ) {
    293         VTABLE_INIT(this, IO_OPEN_FAILURE);
     291        this.tag = 1;
     292}
     293void ?{}( Open_Failure & this, ifstream & istream ) {
     294        VTABLE_INIT(this, Open_Failure);
    294295        this.istream = &istream;
    295 }
    296 const char * IO_OPEN_FAILURE_msg(IO_OPEN_FAILURE * this) {
    297         return "IO_OPEN_FAILURE";
    298 }
    299 VTABLE_INSTANCE(IO_OPEN_FAILURE)(IO_OPEN_FAILURE_msg);
    300 void throwIO_OPEN_FAILURE( ofstream & ostream ) {
    301         IO_OPEN_FAILURE exc = { ostream };
    302 }
    303 void throwIO_OPEN_FAILURE( ifstream & istream ) {
    304         IO_OPEN_FAILURE exc = { istream };
     296        this.tag = 0;
     297}
     298const char * Open_Failure_msg(Open_Failure * this) {
     299        return "Open_Failure";
     300}
     301VTABLE_INSTANCE(Open_Failure)(Open_Failure_msg);
     302void throwOpen_Failure( ofstream & ostream ) {
     303        Open_Failure exc = { ostream };
     304}
     305void throwOpen_Failure( ifstream & istream ) {
     306        Open_Failure exc = { istream };
    305307}
    306308
Note: See TracChangeset for help on using the changeset viewer.