source: libcfa/src/fstream.hfa @ a87d40b

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since a87d40b was a87d40b, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago

add aliases stdin, stdout, stderr for sin, sout, serr

  • Property mode set to 100644
File size: 2.8 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 : Mon Jul 15 18:10:23 2019
13// Update Count     : 167
14//
15
16#pragma once
17
18#include "iostream.hfa"
19
20
21//*********************************** ofstream ***********************************
22
23
24enum { sepSize = 16 };
25struct ofstream {
26        void * file;
27        bool sepDefault;
28        bool sepOnOff;
29        bool nlOnOff;
30        bool prt;                                                                                       // print text
31        bool sawNL;
32        const char * sepCur;
33        char separator[sepSize];
34        char tupleSeparator[sepSize];
35}; // ofstream
36
37// private
38bool sepPrt( ofstream & );
39void sepReset( ofstream & );
40void sepReset( ofstream &, bool );
41const char * sepGetCur( ofstream & );
42void sepSetCur( ofstream &, const char * );
43bool getNL( ofstream & );
44void setNL( ofstream &, bool );
45bool getANL( ofstream & );
46bool getPrt( ofstream & );
47void setPrt( ofstream &, bool );
48
49// public
50void sepOn( ofstream & );
51void sepOff( ofstream & );
52bool sepDisable( ofstream & );
53bool sepEnable( ofstream & );
54void nlOn( ofstream & );
55void nlOff( ofstream & );
56
57const char * sepGet( ofstream & );
58void sepSet( ofstream &, const char * );
59const char * sepGetTuple( ofstream & );
60void sepSetTuple( ofstream &, const char * );
61
62void ends( ofstream & os );
63int fail( ofstream & );
64int flush( ofstream & );
65void open( ofstream &, const char * name, const char * mode );
66void open( ofstream &, const char * name );
67void close( ofstream & );
68ofstream & write( ofstream &, const char * data, size_t size );
69int fmt( ofstream &, const char format[], ... );
70
71void ?{}( ofstream & os );
72void ?{}( ofstream & os, const char * name, const char * mode );
73void ?{}( ofstream & os, const char * name );
74
75extern ofstream & sout, & stdout, & serr, & stderr;             // aliases
76extern ofstream & exit, & abort;
77
78
79//*********************************** ifstream ***********************************
80
81
82struct ifstream {
83        void * file;
84        bool nlOnOff;
85}; // ifstream
86
87// public
88void nlOn( ifstream & );
89void nlOff( ifstream & );
90bool getANL( ifstream & );
91int fail( ifstream & is );
92int eof( ifstream & is );
93void open( ifstream & is, const char * name, const char * mode );
94void open( ifstream & is, const char * name );
95void close( ifstream & is );
96ifstream & read( ifstream & is, char * data, size_t size );
97ifstream & ungetc( ifstream & is, char c );
98int fmt( ifstream &, const char format[], ... );
99
100void ?{}( ifstream & is );
101void ?{}( ifstream & is, const char * name, const char * mode );
102void ?{}( ifstream & is, const char * name );
103
104extern ifstream & sin, & stdin;                                                 // aliases
105
106// Local Variables: //
107// mode: c //
108// tab-width: 4 //
109// End: //
Note: See TracBrowser for help on using the repository browser.