Changeset fce4e31 for libcfa/src/fstream.cfa
- Timestamp:
- Jul 12, 2019, 1:50:44 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8fd52e90
- Parents:
- ef5b828 (diff), 302d84c2 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.cfa
ref5b828 rfce4e31 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 16 08:33:28201913 // Update Count : 3 2812 // Last Modified On : Fri Jul 12 12:03:53 2019 13 // Update Count : 344 14 14 // 15 15 … … 24 24 #include <assert.h> 25 25 #include <errno.h> // errno 26 27 28 //*********************************** ofstream *********************************** 29 26 30 27 31 #define IO_MSG "I/O error: " … … 37 41 sepSetCur( os, sepGet( os ) ); 38 42 sepSetTuple( os, ", " ); 39 } 43 } // ?{} 40 44 41 45 // private … … 56 60 void ?{}( ofstream & os, const char * name, const char * mode ) { 57 61 open( os, name, mode ); 58 } 62 } // ?{} 63 59 64 void ?{}( ofstream & os, const char * name ) { 60 65 open( os, name, "w" ); 61 } 66 } // ?{} 62 67 63 68 void sepOn( ofstream & os ) { os.sepOnOff = ! getNL( os ); } … … 94 99 os.tupleSeparator[sepSize - 1] = '\0'; 95 100 } // sepSet 101 102 void ends( ofstream & os ) { 103 if ( getANL( os ) ) nl( os ); 104 else setPrt( os, false ); // turn off 105 if ( &os == &exit ) exit( EXIT_FAILURE ); 106 if ( &os == &abort ) abort(); 107 } // ends 96 108 97 109 int fail( ofstream & os ) { … … 157 169 ofstream & serr = serrFile; 158 170 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 } 168 169 //--------------------------------------- 171 static ofstream exitFile = { (FILE *)(&_IO_2_1_stdout_) }; 172 ofstream & exit = exitFile; 173 static ofstream abortFile = { (FILE *)(&_IO_2_1_stderr_) }; 174 ofstream & abort = abortFile; 175 176 177 //*********************************** ifstream *********************************** 178 170 179 171 180 // private … … 173 182 is.file = file; 174 183 is.nlOnOff = false; 175 } 184 } // ?{} 176 185 177 186 // public … … 180 189 void ?{}( ifstream & is, const char * name, const char * mode ) { 181 190 open( is, name, mode ); 182 } 191 } // ?{} 192 183 193 void ?{}( ifstream & is, const char * name ) { 184 194 open( is, name, "r" ); 185 } 195 } // ?{} 186 196 187 197 void nlOn( ifstream & os ) { os.nlOnOff = true; }
Note: See TracChangeset
for help on using the changeset viewer.