| 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 : Wed Mar  2 15:08:14 2016 | 
|---|
| 13 | // Update Count     : 78 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #ifndef __FSTREAM_H__ | 
|---|
| 17 | #define __FSTREAM_H__ | 
|---|
| 18 |  | 
|---|
| 19 | #include "iostream" | 
|---|
| 20 |  | 
|---|
| 21 | enum { separateSize = 16 }; | 
|---|
| 22 | struct ofstream { void *file; int separate; char separator[separateSize]; }; | 
|---|
| 23 |  | 
|---|
| 24 | _Bool sepPrt( ofstream * ); | 
|---|
| 25 | void sepOn( ofstream * ); | 
|---|
| 26 | void sepOff( ofstream * ); | 
|---|
| 27 | void sepSet( ofstream *, const char * ); | 
|---|
| 28 | const char * sepGet( ofstream * ); | 
|---|
| 29 | void sepDisable( ofstream * ); | 
|---|
| 30 | void sepEnable( ofstream * ); | 
|---|
| 31 | int fail( ofstream * ); | 
|---|
| 32 | int flush( ofstream * ); | 
|---|
| 33 | void open( ofstream *, const char * name, const char * mode ); | 
|---|
| 34 | void close( ofstream * ); | 
|---|
| 35 | ofstream * write( ofstream *, const char * data, unsigned long int size ); | 
|---|
| 36 | int prtfmt( ofstream *, const char fmt[], ... ); | 
|---|
| 37 |  | 
|---|
| 38 | extern ofstream * sout, * serr; | 
|---|
| 39 |  | 
|---|
| 40 | // implement context istream | 
|---|
| 41 | struct ifstream { void *file; }; | 
|---|
| 42 |  | 
|---|
| 43 | int fail( ifstream * is ); | 
|---|
| 44 | int eof( ifstream * is ); | 
|---|
| 45 | void open( ifstream * is, const char * name, const char * mode ); | 
|---|
| 46 | void close( ifstream * is ); | 
|---|
| 47 | ifstream * read( ifstream * is, char * data, unsigned long int size ); | 
|---|
| 48 | ifstream * ungetc( ifstream * is, char c ); | 
|---|
| 49 | int scanfmt( ifstream *, const char fmt[], ... ); | 
|---|
| 50 |  | 
|---|
| 51 | extern ifstream *sin; | 
|---|
| 52 |  | 
|---|
| 53 | #endif // __FSTREAM_H__ | 
|---|
| 54 |  | 
|---|
| 55 | // Local Variables: // | 
|---|
| 56 | // mode: c // | 
|---|
| 57 | // tab-width: 4 // | 
|---|
| 58 | // End: // | 
|---|
| 59 |  | 
|---|