//
// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// fstream --
//
// Author           : Peter A. Buhr
// Created On       : Wed May 27 17:56:53 2015
// Last Modified By : Peter A. Buhr
// Last Modified On : Tue Jun  5 10:20:25 2018
// Update Count     : 131
//

#pragma once

#include "iostream"

enum { sepSize = 16 };
struct ofstream {
	void * file;
	_Bool sepDefault;
	_Bool sepOnOff;
	_Bool sawNL;
	const char * sepCur;
	char separator[sepSize];
	char tupleSeparator[sepSize];
}; // ofstream

// private
_Bool sepPrt( ofstream & );
void sepReset( ofstream & );
void sepReset( ofstream &, _Bool );
const char * sepGetCur( ofstream & );
void sepSetCur( ofstream &, const char * );
_Bool getNL( ofstream & );
void setNL( ofstream &, _Bool );

// public
void sepOn( ofstream & );
void sepOff( ofstream & );
_Bool sepDisable( ofstream & );
_Bool sepEnable( ofstream & );

const char * sepGet( ofstream & );
void sepSet( ofstream &, const char * );
const char * sepGetTuple( ofstream & );
void sepSetTuple( ofstream &, const char * );

int fail( ofstream & );
int flush( ofstream & );
void open( ofstream &, const char * name, const char * mode );
void open( ofstream &, const char * name );
void close( ofstream & );
ofstream & write( ofstream &, const char * data, size_t size );
int fmt( ofstream &, const char fmt[], ... );

void ?{}( ofstream & os );
void ?{}( ofstream & os, const char * name, const char * mode );
void ?{}( ofstream & os, const char * name );

extern ofstream & sout, & serr;


struct ifstream {
	void * file;
}; // ifstream

// public
int fail( ifstream & is );
int eof( ifstream & is );
void open( ifstream & is, const char * name, const char * mode );
void open( ifstream & is, const char * name );
void close( ifstream & is );
ifstream & read( ifstream & is, char * data, size_t size );
ifstream & ungetc( ifstream & is, char c );
int fmt( ifstream &, const char fmt[], ... );

void ?{}( ifstream & is );
void ?{}( ifstream & is, const char * name, const char * mode );
void ?{}( ifstream & is, const char * name );

extern ifstream & sin;

// Local Variables: //
// mode: c //
// tab-width: 4 //
// End: //
