source: libcfa/src/fstream.hfa @ 18a7594

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 18a7594 was d0502a3, checked in by Michael Brooks <mlbrooks@…>, 3 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
RevLine 
[86bd7c1f]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//
[bb82c03]7// fstream --
[86bd7c1f]8//
[90c3b1c]9// Author           : Peter A. Buhr
[86bd7c1f]10// Created On       : Wed May 27 17:56:53 2015
11// Last Modified By : Peter A. Buhr
[8d321f9]12// Last Modified On : Fri Jun 19 16:29:17 2020
13// Update Count     : 189
[86bd7c1f]14//
15
[53a6c2a]16#pragma once
[51b7345]17
[d0502a3]18#include "bits/weakso_locks.hfa"
[58b6d1b]19#include "iostream.hfa"
[91e52be]20#include <exception.hfa>
[51b7345]21
[65240bb]22
[8d321f9]23// *********************************** ofstream ***********************************
[65240bb]24
25
[53a6c2a]26enum { sepSize = 16 };
[53ba273]27struct ofstream {
[d1a9ff5]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];
[d0502a3]37//      multiple_acquisition_lock lock;
[53ba273]38}; // ofstream
[90c3b1c]39
[9ebd778]40// private
[d1a9ff5]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 );
[9ebd778]51
52// public
[09687aa]53void sepOn( ofstream & );
54void sepOff( ofstream & );
[93c2e0a]55bool sepDisable( ofstream & );
56bool sepEnable( ofstream & );
[200fcb3]57void nlOn( ofstream & );
58void nlOff( ofstream & );
[9ebd778]59
[09687aa]60const char * sepGet( ofstream & );
[e3fea42]61void sepSet( ofstream &, const char [] );
[09687aa]62const char * sepGetTuple( ofstream & );
[e3fea42]63void sepSetTuple( ofstream &, const char [] );
[6152c81]64
[65240bb]65void ends( ofstream & os );
[09687aa]66int fail( ofstream & );
67int flush( ofstream & );
[e3fea42]68void open( ofstream &, const char name[], const char mode[] );
69void open( ofstream &, const char name[] );
[09687aa]70void close( ofstream & );
[e3fea42]71ofstream & write( ofstream &, const char data[], size_t size );
[40cac90]72int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
[829c907]73
[09687aa]74void ?{}( ofstream & os );
[e3fea42]75void ?{}( ofstream & os, const char name[], const char mode[] );
76void ?{}( ofstream & os, const char name[] );
[4cae032]77void ^?{}( ofstream & os );
[09687aa]78
[a87d40b]79extern ofstream & sout, & stdout, & serr, & stderr;             // aliases
[65240bb]80extern ofstream & exit, & abort;
81
[51b7345]82
[8d321f9]83// *********************************** ifstream ***********************************
[5cb2b8c]84
[51b7345]85
[53ba273]86struct ifstream {
[d1a9ff5]87        void * $file;
88        bool $nlOnOff;
[53ba273]89}; // ifstream
[6ba0659]90
[09687aa]91// public
[0efb269]92void nlOn( ifstream & );
93void nlOff( ifstream & );
94bool getANL( ifstream & );
[09687aa]95int fail( ifstream & is );
96int eof( ifstream & is );
[e3fea42]97void open( ifstream & is, const char name[], const char mode[] );
98void open( ifstream & is, const char name[] );
[09687aa]99void close( ifstream & is );
[91d766d]100ifstream & read( ifstream & is, char * data, size_t size );
[09687aa]101ifstream & ungetc( ifstream & is, char c );
[40cac90]102int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
[09687aa]103
104void ?{}( ifstream & is );
[e3fea42]105void ?{}( ifstream & is, const char name[], const char mode[] );
106void ?{}( ifstream & is, const char name[] );
[4cae032]107void ^?{}( ifstream & is );
[51b7345]108
[a87d40b]109extern ifstream & sin, & stdin;                                                 // aliases
[51b7345]110
[91e52be]111
[8d321f9]112// *********************************** exceptions ***********************************
[91e52be]113
114
[8d321f9]115DATA_EXCEPTION(Open_Failure)(
[91e52be]116        union {
117                ofstream * ostream;
118                ifstream * istream;
119        };
[8d321f9]120        // TEMPORARY: need polymorphic exceptions
121        int tag;                                                                                        // 1 => ostream; 0 => istream
[91e52be]122);
123
[8d321f9]124void ?{}( Open_Failure & this, ofstream & ostream );
125void ?{}( Open_Failure & this, ifstream & istream );
[91e52be]126
[86bd7c1f]127// Local Variables: //
[d3b7937]128// mode: c //
[86bd7c1f]129// tab-width: 4 //
130// End: //
Note: See TracBrowser for help on using the repository browser.