[86bd7c1f] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[bb82c03] | 7 | // fstream -- |
---|
[86bd7c1f] | 8 | // |
---|
[90c3b1c] | 9 | // Author : Peter A. Buhr |
---|
[86bd7c1f] | 10 | // Created On : Wed May 27 17:56:53 2015 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[829c907] | 12 | // Last Modified On : Tue Mar 21 15:57:24 2017 |
---|
| 13 | // Update Count : 102 |
---|
[86bd7c1f] | 14 | // |
---|
| 15 | |
---|
[42dcae7] | 16 | #ifndef __FSTREAM_H__ |
---|
| 17 | #define __FSTREAM_H__ |
---|
[51b7345] | 18 | |
---|
[d3b7937] | 19 | #include "iostream" |
---|
[51b7345] | 20 | |
---|
[90c3b1c] | 21 | enum { separateSize = 16 }; |
---|
[53ba273] | 22 | struct ofstream { |
---|
[829c907] | 23 | void * file; |
---|
[8bc4ef8] | 24 | _Bool sepDefault; |
---|
[6152c81] | 25 | _Bool sepOnOff; |
---|
[829c907] | 26 | const char * sepCur; |
---|
[53ba273] | 27 | char separator[separateSize]; |
---|
[829c907] | 28 | char tupleSeparator[separateSize]; |
---|
[53ba273] | 29 | }; // ofstream |
---|
[90c3b1c] | 30 | |
---|
| 31 | _Bool sepPrt( ofstream * ); |
---|
| 32 | void sepOn( ofstream * ); |
---|
| 33 | void sepOff( ofstream * ); |
---|
[53ba273] | 34 | void sepReset( ofstream * ); |
---|
| 35 | void sepReset( ofstream *, _Bool ); |
---|
[829c907] | 36 | const char * sepGetCur( ofstream * ); |
---|
| 37 | void sepSetCur( ofstream *, const char * ); |
---|
[90c3b1c] | 38 | const char * sepGet( ofstream * ); |
---|
[6152c81] | 39 | void sepSet( ofstream *, const char * ); |
---|
[829c907] | 40 | const char * sepGetTuple( ofstream * ); |
---|
| 41 | void sepSetTuple( ofstream *, const char * ); |
---|
[53ba273] | 42 | _Bool sepDisable( ofstream * ); |
---|
| 43 | _Bool sepEnable( ofstream * ); |
---|
[6152c81] | 44 | |
---|
[90c3b1c] | 45 | int fail( ofstream * ); |
---|
| 46 | int flush( ofstream * ); |
---|
| 47 | void open( ofstream *, const char * name, const char * mode ); |
---|
| 48 | void close( ofstream * ); |
---|
| 49 | ofstream * write( ofstream *, const char * data, unsigned long int size ); |
---|
[829c907] | 50 | int fmt( ofstream *, const char fmt[], ... ); |
---|
| 51 | |
---|
| 52 | void ?{}( ofstream * ); |
---|
[51b7345] | 53 | |
---|
[6ba0659] | 54 | extern ofstream * sout, * serr; |
---|
[51b7345] | 55 | |
---|
[134b86a] | 56 | // implement context istream |
---|
[53ba273] | 57 | struct ifstream { |
---|
[829c907] | 58 | void * file; |
---|
[53ba273] | 59 | }; // ifstream |
---|
[6ba0659] | 60 | |
---|
| 61 | int fail( ifstream * is ); |
---|
| 62 | int eof( ifstream * is ); |
---|
[90c3b1c] | 63 | void open( ifstream * is, const char * name, const char * mode ); |
---|
[6ba0659] | 64 | void close( ifstream * is ); |
---|
[90c3b1c] | 65 | ifstream * read( ifstream * is, char * data, unsigned long int size ); |
---|
[6ba0659] | 66 | ifstream * ungetc( ifstream * is, char c ); |
---|
[829c907] | 67 | int fmt( ifstream *, const char fmt[], ... ); |
---|
[51b7345] | 68 | |
---|
[829c907] | 69 | extern ifstream * sin; |
---|
[51b7345] | 70 | |
---|
[42dcae7] | 71 | #endif // __FSTREAM_H__ |
---|
[86bd7c1f] | 72 | |
---|
| 73 | // Local Variables: // |
---|
[d3b7937] | 74 | // mode: c // |
---|
[86bd7c1f] | 75 | // tab-width: 4 // |
---|
| 76 | // End: // |
---|