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 | // |
---|
7 | // fstream -- |
---|
8 | // |
---|
9 | // Author : Peter A. Buhr |
---|
10 | // Created On : Wed May 27 17:56:53 2015 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Thu Apr 28 08:08:04 2016 |
---|
13 | // Update Count : 88 |
---|
14 | // |
---|
15 | |
---|
16 | #ifndef __FSTREAM_H__ |
---|
17 | #define __FSTREAM_H__ |
---|
18 | |
---|
19 | #include "iostream" |
---|
20 | |
---|
21 | enum { separateSize = 16 }; |
---|
22 | struct ofstream { |
---|
23 | void *file; |
---|
24 | _Bool sepDefault; |
---|
25 | int sepOnOff; // FIX ME: type should be _Bool |
---|
26 | char separator[separateSize]; |
---|
27 | }; // ofstream |
---|
28 | |
---|
29 | _Bool sepPrt( ofstream * ); |
---|
30 | void sepOn( ofstream * ); |
---|
31 | void sepOff( ofstream * ); |
---|
32 | void sepReset( ofstream * ); |
---|
33 | void sepReset( ofstream *, _Bool ); |
---|
34 | void sepSet( ofstream *, const char * ); |
---|
35 | const char * sepGet( ofstream * ); |
---|
36 | _Bool sepDisable( ofstream * ); |
---|
37 | _Bool sepEnable( ofstream * ); |
---|
38 | int fail( ofstream * ); |
---|
39 | int flush( ofstream * ); |
---|
40 | void open( ofstream *, const char * name, const char * mode ); |
---|
41 | void close( ofstream * ); |
---|
42 | ofstream * write( ofstream *, const char * data, unsigned long int size ); |
---|
43 | int prtfmt( ofstream *, const char fmt[], ... ); |
---|
44 | |
---|
45 | extern ofstream * sout, * serr; |
---|
46 | |
---|
47 | // implement context istream |
---|
48 | struct ifstream { |
---|
49 | void *file; |
---|
50 | }; // ifstream |
---|
51 | |
---|
52 | int fail( ifstream * is ); |
---|
53 | int eof( ifstream * is ); |
---|
54 | void open( ifstream * is, const char * name, const char * mode ); |
---|
55 | void close( ifstream * is ); |
---|
56 | ifstream * read( ifstream * is, char * data, unsigned long int size ); |
---|
57 | ifstream * ungetc( ifstream * is, char c ); |
---|
58 | int scanfmt( ifstream *, const char fmt[], ... ); |
---|
59 | |
---|
60 | extern ifstream *sin; |
---|
61 | |
---|
62 | #endif // __FSTREAM_H__ |
---|
63 | |
---|
64 | // Local Variables: // |
---|
65 | // mode: c // |
---|
66 | // tab-width: 4 // |
---|
67 | // End: // |
---|
68 | |
---|