- Timestamp:
- Mar 23, 2017, 10:39:30 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 6013bd7, 7895d46
- Parents:
- 89e1b16
- Location:
- src/libcfa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/fstream.c
r89e1b16 r0583064b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 22 16:17:21 201713 // Update Count : 22 112 // Last Modified On : Thu Mar 23 08:20:41 2017 13 // Update Count : 226 14 14 // 15 15 … … 29 29 #define IO_MSG "I/O error: " 30 30 31 void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) { 32 this->file = file; 33 this->sepDefault = sepDefault; 34 this->sepOnOff = sepOnOff; 35 sepSet( this, separator ); 36 sepSetCur( this, sepGet( this ) ); 37 sepSetTuple( this, tupleSeparator ); 38 } 39 31 40 _Bool sepPrt( ofstream * os ) { return os->sepOnOff; } 32 41 void sepOn( ofstream * os ) { os->sepOnOff = 1; } … … 83 92 exit( EXIT_FAILURE ); 84 93 } // if 85 os->file = file; 86 sepOff( os ); 87 sepSet( os, " " ); 94 ?{}( os, file, 1, 0, " ", ", " ); 88 95 } // open 89 96 … … 125 132 } // fmt 126 133 127 void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) {128 this->file = file;129 this->sepDefault = sepDefault;130 this->sepOnOff = sepOnOff;131 sepSet( this, separator );132 sepSetCur( this, sepGet( this ) );133 sepSetTuple( this, tupleSeparator );134 }135 136 134 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " }; 137 135 ofstream *sout = &soutFile; -
src/libcfa/iostream.c
r89e1b16 r0583064b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 22 17:46:06201713 // Update Count : 3 5912 // Last Modified On : Thu Mar 23 08:20:40 2017 13 // Update Count : 367 14 14 // 15 15 … … 201 201 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } ) 202 202 ostype * ?|?( ostype * os, T arg, Params rest ) { 203 forall( ttype Params ) ostype * prtTuple( T arg, Params rest ) {204 os | arg; // print first argument205 os | rest; // print remaining arguments206 return os;207 } // prtTuple208 203 sepSetCur( os, sepGetTuple( os ) ); // switch to tuple separator 209 prtTuple( arg, rest ); // recursively print tuple 204 os | arg; // print first argument 205 os | rest; // print remaining arguments 210 206 sepSetCur( os, sepGet( os ) ); // switch to regular separator 211 207 return os; … … 223 219 os | '\n'; 224 220 flush( os ); 225 sepOff( os ); 221 sepOff( os ); // prepare for next line 226 222 return os; 227 223 } // endl
Note: See TracChangeset
for help on using the changeset viewer.