[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 |
---|
[6152c81] | 12 | // Last Modified On : Tue Mar 7 14:48:08 2017 |
---|
| 13 | // Update Count : 91 |
---|
[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 { |
---|
| 23 | void *file; |
---|
[8bc4ef8] | 24 | _Bool sepDefault; |
---|
[6152c81] | 25 | _Bool sepOnOff; |
---|
[53ba273] | 26 | char separator[separateSize]; |
---|
| 27 | }; // ofstream |
---|
[90c3b1c] | 28 | |
---|
| 29 | _Bool sepPrt( ofstream * ); |
---|
| 30 | void sepOn( ofstream * ); |
---|
| 31 | void sepOff( ofstream * ); |
---|
[53ba273] | 32 | void sepReset( ofstream * ); |
---|
| 33 | void sepReset( ofstream *, _Bool ); |
---|
[90c3b1c] | 34 | const char * sepGet( ofstream * ); |
---|
[6152c81] | 35 | void sepSet( ofstream *, const char * ); |
---|
[53ba273] | 36 | _Bool sepDisable( ofstream * ); |
---|
| 37 | _Bool sepEnable( ofstream * ); |
---|
[6152c81] | 38 | |
---|
[90c3b1c] | 39 | int fail( ofstream * ); |
---|
| 40 | int flush( ofstream * ); |
---|
| 41 | void open( ofstream *, const char * name, const char * mode ); |
---|
| 42 | void close( ofstream * ); |
---|
| 43 | ofstream * write( ofstream *, const char * data, unsigned long int size ); |
---|
| 44 | int prtfmt( ofstream *, const char fmt[], ... ); |
---|
[51b7345] | 45 | |
---|
[6ba0659] | 46 | extern ofstream * sout, * serr; |
---|
[51b7345] | 47 | |
---|
[134b86a] | 48 | // implement context istream |
---|
[53ba273] | 49 | struct ifstream { |
---|
| 50 | void *file; |
---|
| 51 | }; // ifstream |
---|
[6ba0659] | 52 | |
---|
| 53 | int fail( ifstream * is ); |
---|
| 54 | int eof( ifstream * is ); |
---|
[90c3b1c] | 55 | void open( ifstream * is, const char * name, const char * mode ); |
---|
[6ba0659] | 56 | void close( ifstream * is ); |
---|
[90c3b1c] | 57 | ifstream * read( ifstream * is, char * data, unsigned long int size ); |
---|
[6ba0659] | 58 | ifstream * ungetc( ifstream * is, char c ); |
---|
[90c3b1c] | 59 | int scanfmt( ifstream *, const char fmt[], ... ); |
---|
[51b7345] | 60 | |
---|
[6ba0659] | 61 | extern ifstream *sin; |
---|
[51b7345] | 62 | |
---|
[42dcae7] | 63 | #endif // __FSTREAM_H__ |
---|
[86bd7c1f] | 64 | |
---|
| 65 | // Local Variables: // |
---|
[d3b7937] | 66 | // mode: c // |
---|
[86bd7c1f] | 67 | // tab-width: 4 // |
---|
| 68 | // End: // |
---|