| 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 : Sat Aug 11 13:54:27 2018
|
|---|
| 13 | // Update Count : 132
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #pragma once
|
|---|
| 17 |
|
|---|
| 18 | #include "iostream.hfa"
|
|---|
| 19 |
|
|---|
| 20 | enum { sepSize = 16 };
|
|---|
| 21 | struct ofstream {
|
|---|
| 22 | void * file;
|
|---|
| 23 | bool sepDefault;
|
|---|
| 24 | bool sepOnOff;
|
|---|
| 25 | bool sawNL;
|
|---|
| 26 | const char * sepCur;
|
|---|
| 27 | char separator[sepSize];
|
|---|
| 28 | char tupleSeparator[sepSize];
|
|---|
| 29 | }; // ofstream
|
|---|
| 30 |
|
|---|
| 31 | // private
|
|---|
| 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 );
|
|---|
| 39 |
|
|---|
| 40 | // public
|
|---|
| 41 | void sepOn( ofstream & );
|
|---|
| 42 | void sepOff( ofstream & );
|
|---|
| 43 | bool sepDisable( ofstream & );
|
|---|
| 44 | bool sepEnable( ofstream & );
|
|---|
| 45 |
|
|---|
| 46 | const char * sepGet( ofstream & );
|
|---|
| 47 | void sepSet( ofstream &, const char * );
|
|---|
| 48 | const char * sepGetTuple( ofstream & );
|
|---|
| 49 | void sepSetTuple( ofstream &, const char * );
|
|---|
| 50 |
|
|---|
| 51 | int fail( ofstream & );
|
|---|
| 52 | int flush( ofstream & );
|
|---|
| 53 | void open( ofstream &, const char * name, const char * mode );
|
|---|
| 54 | void open( ofstream &, const char * name );
|
|---|
| 55 | void close( ofstream & );
|
|---|
| 56 | ofstream & write( ofstream &, const char * data, size_t size );
|
|---|
| 57 | int fmt( ofstream &, const char fmt[], ... );
|
|---|
| 58 |
|
|---|
| 59 | void ?{}( ofstream & os );
|
|---|
| 60 | void ?{}( ofstream & os, const char * name, const char * mode );
|
|---|
| 61 | void ?{}( ofstream & os, const char * name );
|
|---|
| 62 |
|
|---|
| 63 | extern ofstream & sout, & serr;
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | struct ifstream {
|
|---|
| 67 | void * file;
|
|---|
| 68 | }; // ifstream
|
|---|
| 69 |
|
|---|
| 70 | // public
|
|---|
| 71 | int fail( ifstream & is );
|
|---|
| 72 | int eof( ifstream & is );
|
|---|
| 73 | void open( ifstream & is, const char * name, const char * mode );
|
|---|
| 74 | void open( ifstream & is, const char * name );
|
|---|
| 75 | void close( ifstream & is );
|
|---|
| 76 | ifstream & read( ifstream & is, char * data, size_t size );
|
|---|
| 77 | ifstream & ungetc( ifstream & is, char c );
|
|---|
| 78 | int fmt( ifstream &, const char fmt[], ... );
|
|---|
| 79 |
|
|---|
| 80 | void ?{}( ifstream & is );
|
|---|
| 81 | void ?{}( ifstream & is, const char * name, const char * mode );
|
|---|
| 82 | void ?{}( ifstream & is, const char * name );
|
|---|
| 83 |
|
|---|
| 84 | extern ifstream & sin;
|
|---|
| 85 |
|
|---|
| 86 | // Local Variables: //
|
|---|
| 87 | // mode: c //
|
|---|
| 88 | // tab-width: 4 //
|
|---|
| 89 | // End: //
|
|---|