| [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 | 
|---|
| [8da74119] | 12 | // Last Modified On : Thu Dec  7 15:17:26 2017 | 
|---|
|  | 13 | // Update Count     : 130 | 
|---|
| [86bd7c1f] | 14 | // | 
|---|
|  | 15 |  | 
|---|
| [53a6c2a] | 16 | #pragma once | 
|---|
| [51b73452] | 17 |  | 
|---|
| [d3b7937] | 18 | #include "iostream" | 
|---|
| [51b73452] | 19 |  | 
|---|
| [53a6c2a] | 20 | enum { sepSize = 16 }; | 
|---|
| [53ba273] | 21 | struct ofstream { | 
|---|
| [829c907] | 22 | void * file; | 
|---|
| [8bc4ef8] | 23 | _Bool sepDefault; | 
|---|
| [6152c81] | 24 | _Bool sepOnOff; | 
|---|
| [53a6c2a] | 25 | _Bool sawNL; | 
|---|
| [829c907] | 26 | const char * sepCur; | 
|---|
| [53a6c2a] | 27 | char separator[sepSize]; | 
|---|
|  | 28 | char tupleSeparator[sepSize]; | 
|---|
| [53ba273] | 29 | }; // ofstream | 
|---|
| [90c3b1c] | 30 |  | 
|---|
| [9ebd778] | 31 | // private | 
|---|
| [09687aa] | 32 | _Bool sepPrt( ofstream & ); | 
|---|
|  | 33 | void sepReset( ofstream & ); | 
|---|
|  | 34 | void sepReset( ofstream &, _Bool ); | 
|---|
|  | 35 | const char * sepGetCur( ofstream & ); | 
|---|
|  | 36 | void sepSetCur( ofstream &, const char * ); | 
|---|
|  | 37 | _Bool getNL( ofstream & ); | 
|---|
|  | 38 | void setNL( ofstream &, _Bool ); | 
|---|
| [9ebd778] | 39 |  | 
|---|
|  | 40 | // public | 
|---|
| [09687aa] | 41 | void sepOn( ofstream & ); | 
|---|
|  | 42 | void sepOff( ofstream & ); | 
|---|
|  | 43 | _Bool sepDisable( ofstream & ); | 
|---|
|  | 44 | _Bool sepEnable( ofstream & ); | 
|---|
| [9ebd778] | 45 |  | 
|---|
| [09687aa] | 46 | const char * sepGet( ofstream & ); | 
|---|
|  | 47 | void sepSet( ofstream &, const char * ); | 
|---|
|  | 48 | const char * sepGetTuple( ofstream & ); | 
|---|
|  | 49 | void sepSetTuple( ofstream &, const char * ); | 
|---|
| [6152c81] | 50 |  | 
|---|
| [09687aa] | 51 | int fail( ofstream & ); | 
|---|
|  | 52 | int flush( ofstream & ); | 
|---|
|  | 53 | void open( ofstream &, const char * name, const char * mode ); | 
|---|
| [8da74119] | 54 | void open( ofstream &, const char * name ); | 
|---|
| [09687aa] | 55 | void close( ofstream & ); | 
|---|
|  | 56 | ofstream & write( ofstream &, const char * data, unsigned long int size ); | 
|---|
|  | 57 | int fmt( ofstream &, const char fmt[], ... ); | 
|---|
| [829c907] | 58 |  | 
|---|
| [09687aa] | 59 | void ?{}( ofstream & os ); | 
|---|
|  | 60 | void ?{}( ofstream & os, const char * name, const char * mode ); | 
|---|
| [8da74119] | 61 | void ?{}( ofstream & os, const char * name ); | 
|---|
| [09687aa] | 62 |  | 
|---|
|  | 63 | extern ofstream & sout, & serr; | 
|---|
| [51b73452] | 64 |  | 
|---|
|  | 65 |  | 
|---|
| [53ba273] | 66 | struct ifstream { | 
|---|
| [829c907] | 67 | void * file; | 
|---|
| [53ba273] | 68 | }; // ifstream | 
|---|
| [6ba0659] | 69 |  | 
|---|
| [09687aa] | 70 | // public | 
|---|
|  | 71 | int fail( ifstream & is ); | 
|---|
|  | 72 | int eof( ifstream & is ); | 
|---|
| [8da74119] | 73 | void open( ifstream & is, const char * name, const char * mode ); | 
|---|
| [09687aa] | 74 | void open( ifstream & is, const char * name ); | 
|---|
|  | 75 | void close( ifstream & is ); | 
|---|
|  | 76 | ifstream & read( ifstream & is, char * data, unsigned long int size ); | 
|---|
|  | 77 | ifstream & ungetc( ifstream & is, char c ); | 
|---|
|  | 78 | int fmt( ifstream &, const char fmt[], ... ); | 
|---|
|  | 79 |  | 
|---|
|  | 80 | void ?{}( ifstream & is ); | 
|---|
| [8da74119] | 81 | void ?{}( ifstream & is, const char * name, const char * mode ); | 
|---|
| [09687aa] | 82 | void ?{}( ifstream & is, const char * name ); | 
|---|
| [51b73452] | 83 |  | 
|---|
| [09687aa] | 84 | extern ifstream & sin; | 
|---|
| [51b73452] | 85 |  | 
|---|
| [86bd7c1f] | 86 | // Local Variables: // | 
|---|
| [d3b7937] | 87 | // mode: c // | 
|---|
| [86bd7c1f] | 88 | // tab-width: 4 // | 
|---|
|  | 89 | // End: // | 
|---|