source: src/libcfa/fstream @ d395012

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since d395012 was d395012, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

support separator at end of line

  • Property mode set to 100644
File size: 2.0 KB
Line 
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 Jul  1 16:37:53 2017
13// Update Count     : 112
14//
15
16#ifndef __FSTREAM_H__
17#define __FSTREAM_H__
18
19#include "iostream"
20
21enum { separateSize = 16 };
22struct ofstream {
23        void * file;
24        _Bool sepDefault;
25        _Bool sepOnOff;
26        _Bool lastSepOn;
27        const char * sepCur;
28        char separator[separateSize];
29        char tupleSeparator[separateSize];
30}; // ofstream
31
32// private
33_Bool sepPrt( ofstream * );
34void sepReset( ofstream * );
35void sepReset( ofstream *, _Bool );
36const char * sepGetCur( ofstream * );
37void sepSetCur( ofstream *, const char * );
38_Bool lastSepOn( ofstream * );
39
40// public
41void sepOn( ofstream * );
42void sepOff( ofstream * );
43_Bool sepDisable( ofstream * );
44_Bool sepEnable( ofstream * );
45
46const char * sepGet( ofstream * );
47void sepSet( ofstream *, const char * );
48const char * sepGetTuple( ofstream * );
49void sepSetTuple( ofstream *, const char * );
50
51int fail( ofstream * );
52int flush( ofstream * );
53void open( ofstream *, const char * name, const char * mode );
54void close( ofstream * );
55ofstream * write( ofstream *, const char * data, unsigned long int size );
56int fmt( ofstream *, const char fmt[], ... );
57
58void ?{}( ofstream * );
59
60extern ofstream * sout, * serr;
61
62// implement context istream
63struct ifstream {
64        void * file;
65}; // ifstream
66
67int fail( ifstream * is );
68int eof( ifstream * is );
69void open( ifstream * is, const char * name, const char * mode );
70void close( ifstream * is );
71ifstream * read( ifstream * is, char * data, unsigned long int size );
72ifstream * ungetc( ifstream * is, char c );
73int fmt( ifstream *, const char fmt[], ... );
74
75extern ifstream * sin;
76
77#endif // __FSTREAM_H__
78
79// Local Variables: //
80// mode: c //
81// tab-width: 4 //
82// End: //
Note: See TracBrowser for help on using the repository browser.