source: libcfa/src/fstream.hfa @ 6047b00

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 6047b00 was d0502a3, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Fixing function bodies in bits/containers and bits/sequence so they can coexist with declarations in vector Fixes #237?

libcfa/src/bits/* the fixes
libcfa/src/fstream.hfa adding the desired include, which wasn't possible under #237
tests/includes/* adding tests for these problematic combinations

  • Property mode set to 100644
File size: 3.4 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 : Fri Jun 19 16:29:17 2020
13// Update Count     : 189
14//
15
16#pragma once
17
18#include "bits/weakso_locks.hfa"
19#include "iostream.hfa"
20#include <exception.hfa>
21
22
23// *********************************** ofstream ***********************************
24
25
26enum { sepSize = 16 };
27struct ofstream {
28        void * $file;
29        bool $sepDefault;
30        bool $sepOnOff;
31        bool $nlOnOff;
32        bool $prt;                                                                                      // print text
33        bool $sawNL;
34        const char * $sepCur;
35        char $separator[sepSize];
36        char $tupleSeparator[sepSize];
37//      multiple_acquisition_lock lock;
38}; // ofstream
39
40// private
41bool $sepPrt( ofstream & );
42void $sepReset( ofstream & );
43void $sepReset( ofstream &, bool );
44const char * $sepGetCur( ofstream & );
45void $sepSetCur( ofstream &, const char [] );
46bool $getNL( ofstream & );
47void $setNL( ofstream &, bool );
48bool $getANL( ofstream & );
49bool $getPrt( ofstream & );
50void $setPrt( ofstream &, bool );
51
52// public
53void sepOn( ofstream & );
54void sepOff( ofstream & );
55bool sepDisable( ofstream & );
56bool sepEnable( ofstream & );
57void nlOn( ofstream & );
58void nlOff( ofstream & );
59
60const char * sepGet( ofstream & );
61void sepSet( ofstream &, const char [] );
62const char * sepGetTuple( ofstream & );
63void sepSetTuple( ofstream &, const char [] );
64
65void ends( ofstream & os );
66int fail( ofstream & );
67int flush( ofstream & );
68void open( ofstream &, const char name[], const char mode[] );
69void open( ofstream &, const char name[] );
70void close( ofstream & );
71ofstream & write( ofstream &, const char data[], size_t size );
72int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
73
74void ?{}( ofstream & os );
75void ?{}( ofstream & os, const char name[], const char mode[] );
76void ?{}( ofstream & os, const char name[] );
77void ^?{}( ofstream & os );
78
79extern ofstream & sout, & stdout, & serr, & stderr;             // aliases
80extern ofstream & exit, & abort;
81
82
83// *********************************** ifstream ***********************************
84
85
86struct ifstream {
87        void * $file;
88        bool $nlOnOff;
89}; // ifstream
90
91// public
92void nlOn( ifstream & );
93void nlOff( ifstream & );
94bool getANL( ifstream & );
95int fail( ifstream & is );
96int eof( ifstream & is );
97void open( ifstream & is, const char name[], const char mode[] );
98void open( ifstream & is, const char name[] );
99void close( ifstream & is );
100ifstream & read( ifstream & is, char * data, size_t size );
101ifstream & ungetc( ifstream & is, char c );
102int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
103
104void ?{}( ifstream & is );
105void ?{}( ifstream & is, const char name[], const char mode[] );
106void ?{}( ifstream & is, const char name[] );
107void ^?{}( ifstream & is );
108
109extern ifstream & sin, & stdin;                                                 // aliases
110
111
112// *********************************** exceptions ***********************************
113
114
115DATA_EXCEPTION(Open_Failure)(
116        union {
117                ofstream * ostream;
118                ifstream * istream;
119        };
120        // TEMPORARY: need polymorphic exceptions
121        int tag;                                                                                        // 1 => ostream; 0 => istream
122);
123
124void ?{}( Open_Failure & this, ofstream & ostream );
125void ?{}( Open_Failure & this, ifstream & istream );
126
127// Local Variables: //
128// mode: c //
129// tab-width: 4 //
130// End: //
Note: See TracBrowser for help on using the repository browser.