Ignore:
Timestamp:
Aug 14, 2018, 1:20:59 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
7b3a6e6
Parents:
0c827019 (diff), 26f4dbe (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.cfa

    r0c827019 r0e0f128  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun  5 17:02:56 2018
    13 // Update Count     : 281
     12// Last Modified On : Fri Aug 10 18:19:40 2018
     13// Update Count     : 284
    1414//
    1515
     
    2727#define IO_MSG "I/O error: "
    2828
    29 void ?{}( ofstream & os, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) {
     29void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, const char * separator, const char * tupleSeparator ) {
    3030        os.file = file;
    3131        os.sepDefault = sepDefault;
     
    3737
    3838// private
    39 _Bool sepPrt( ofstream & os ) { setNL( os, false ); return os.sepOnOff; }
     39bool sepPrt( ofstream & os ) { setNL( os, false ); return os.sepOnOff; }
    4040void sepReset( ofstream & os ) { os.sepOnOff = os.sepDefault; }
    41 void sepReset( ofstream & os, _Bool reset ) { os.sepDefault = reset; os.sepOnOff = os.sepDefault; }
     41void sepReset( ofstream & os, bool reset ) { os.sepDefault = reset; os.sepOnOff = os.sepDefault; }
    4242const char * sepGetCur( ofstream & os ) { return os.sepCur; }
    4343void sepSetCur( ofstream & os, const char * sepCur ) { os.sepCur = sepCur; }
    44 _Bool getNL( ofstream & os ) { return os.sawNL; }
    45 void setNL( ofstream & os, _Bool state ) { os.sawNL = state; }
     44bool getNL( ofstream & os ) { return os.sawNL; }
     45void setNL( ofstream & os, bool state ) { os.sawNL = state; }
    4646
    4747// public
     
    5858void sepOff( ofstream & os ) { os.sepOnOff = false; }
    5959
    60 _Bool sepDisable( ofstream & os ) {
    61         _Bool temp = os.sepDefault;
     60bool sepDisable( ofstream & os ) {
     61        bool temp = os.sepDefault;
    6262        os.sepDefault = false;
    6363        sepReset( os );
     
    6565} // sepDisable
    6666
    67 _Bool sepEnable( ofstream & os ) {
    68         _Bool temp = os.sepDefault;
     67bool sepEnable( ofstream & os ) {
     68        bool temp = os.sepDefault;
    6969        os.sepDefault = true;
    7070        if ( os.sepOnOff ) sepReset( os );                                      // start of line ?
     
    9696void open( ofstream & os, const char * name, const char * mode ) {
    9797        FILE *file = fopen( name, mode );
    98         // if ( file == 0 ) {                                                                   // do not change unless successful
    99         //      fprintf( stderr, IO_MSG "open output file \"%s\", ", name );
    100         //      perror( 0 );
    101         //      exit( EXIT_FAILURE );
    102         // } // if
     98        #ifdef __CFA_DEBUG__
     99        if ( file == 0 ) {
     100                fprintf( stderr, IO_MSG "open output file \"%s\", ", name );
     101                perror( 0 );
     102                exit( EXIT_FAILURE );
     103        } // if
     104        #endif // __CFA_DEBUG__
    103105        (os){ file, true, false, " ", ", " };
    104106} // open
     
    178180void open( ifstream & is, const char * name, const char * mode ) {
    179181        FILE *file = fopen( name, mode );
    180         // if ( file == 0 ) {                                                                   // do not change unless successful
    181         //      fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
    182         //      perror( 0 );
    183         //      exit( EXIT_FAILURE );
    184         // } // if
     182        #ifdef __CFA_DEBUG__
     183        if ( file == 0 ) {
     184                fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
     185                perror( 0 );
     186                exit( EXIT_FAILURE );
     187        } // if
     188        #endif // __CFA_DEBUG__
    185189        is.file = file;
    186190} // open
Note: See TracChangeset for help on using the changeset viewer.