Changeset 8d321f9


Ignore:
Timestamp:
Jun 19, 2020, 5:46:38 PM (15 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
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

Location:
libcfa/src
Files:
4 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
  • libcfa/src/fstream.hfa

    r1d2314f r8d321f9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 16 20:41:21 2020
    13 // Update Count     : 184
     12// Last Modified On : Fri Jun 19 16:29:17 2020
     13// Update Count     : 189
    1414//
    1515
     
    2020
    2121
    22 //*********************************** ofstream ***********************************
     22// *********************************** ofstream ***********************************
    2323
    2424
     
    7979
    8080
    81 //*********************************** ifstream ***********************************
     81// *********************************** ifstream ***********************************
    8282
    8383
     
    108108
    109109
    110 //*********************************** exceptions ***********************************
     110// *********************************** exceptions ***********************************
    111111
    112112
    113 DATA_EXCEPTION(IO_OPEN_FAILURE)(
     113DATA_EXCEPTION(Open_Failure)(
    114114        union {
    115115                ofstream * ostream;
    116116                ifstream * istream;
    117117        };
     118        // TEMPORARY: need polymorphic exceptions
     119        int tag;                                                                                        // 1 => ostream; 0 => istream
    118120);
    119121
    120 void ?{}( IO_OPEN_FAILURE & this, ofstream & ostream );
    121 void ?{}( IO_OPEN_FAILURE & this, ifstream & istream );
     122void ?{}( Open_Failure & this, ofstream & ostream );
     123void ?{}( Open_Failure & this, ifstream & istream );
    122124
    123125// Local Variables: //
  • libcfa/src/iostream.cfa

    r1d2314f r8d321f9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 17 08:48:53 2020
    13 // Update Count     : 1018
     12// Last Modified On : Fri Jun 19 16:15:34 2020
     13// Update Count     : 1019
    1414//
    1515
     
    3333
    3434
    35 //*********************************** ostream ***********************************
     35// *********************************** ostream ***********************************
    3636
    3737
     
    447447} // distribution
    448448
    449 //*********************************** manipulators ***********************************
    450 
    451 //*********************************** integral ***********************************
     449// *********************************** manipulators ***********************************
     450
     451// *********************************** integral ***********************************
    452452
    453453static const char * shortbin[] = { "0", "1", "10", "11", "100", "101", "110", "111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" };
     
    664664#endif // __SIZEOF_INT128__
    665665
    666 //*********************************** floating point ***********************************
     666// *********************************** floating point ***********************************
    667667
    668668#define PrintWithDP2( os, format, val, ... ) \
     
    720720FloatingPointFMTImpl( long double, "%    *L ", "%    *.*L " )
    721721
    722 //*********************************** character ***********************************
     722// *********************************** character ***********************************
    723723
    724724forall( dtype ostype | ostream( ostype ) ) {
     
    753753} // distribution
    754754
    755 //*********************************** C string ***********************************
     755// *********************************** C string ***********************************
    756756
    757757forall( dtype ostype | ostream( ostype ) ) {
     
    800800
    801801
    802 //*********************************** istream ***********************************
     802// *********************************** istream ***********************************
    803803
    804804
     
    946946} // distribution
    947947
    948 //*********************************** manipulators ***********************************
     948// *********************************** manipulators ***********************************
    949949
    950950forall( dtype istype | istream( istype ) )
  • libcfa/src/iostream.hfa

    r1d2314f r8d321f9  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 20 15:30:56 2020
    13 // Update Count     : 337
     12// Last Modified On : Fri Jun 19 16:15:56 2020
     13// Update Count     : 338
    1414//
    1515
     
    1919
    2020
    21 //*********************************** ostream ***********************************
     21// *********************************** ostream ***********************************
    2222
    2323
     
    156156} // distribution
    157157
    158 //*********************************** manipulators ***********************************
     158// *********************************** manipulators ***********************************
    159159
    160160forall( otype T )
     
    175175}; // _Ostream_Manip
    176176
    177 //*********************************** integral ***********************************
     177// *********************************** integral ***********************************
    178178
    179179// See 6.7.9. 19) The initialization shall occur in initializer list order, each initializer provided for a particular
     
    217217#endif
    218218
    219 //*********************************** floating point ***********************************
     219// *********************************** floating point ***********************************
    220220
    221221// Default suffix for values with no fraction is "."
     
    246246FloatingPointFMTDecl( long double )
    247247
    248 //*********************************** character ***********************************
     248// *********************************** character ***********************************
    249249
    250250static inline {
     
    263263} // ?|?
    264264
    265 //*********************************** C string ***********************************
     265// *********************************** C string ***********************************
    266266
    267267static inline {
     
    282282
    283283
    284 //*********************************** istream ***********************************
     284// *********************************** istream ***********************************
    285285
    286286
     
    336336} // distribution
    337337
    338 //*********************************** manipulators ***********************************
     338// *********************************** manipulators ***********************************
    339339
    340340struct _Istream_Cstr {
     
    413413
    414414
    415 //*********************************** time ***********************************
     415// *********************************** time ***********************************
    416416
    417417
Note: See TracChangeset for help on using the changeset viewer.