Ignore:
Timestamp:
Jan 7, 2021, 2:55:57 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
58fe85a
Parents:
bdfc032 (diff), 44e37ef (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into dkobets-vector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.hfa

    rbdfc032 reef8dfb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 29 06:56:02 2019
    13 // Update Count     : 168
     12// Last Modified On : Fri Jun 19 16:29:17 2020
     13// Update Count     : 189
    1414//
    1515
     
    1717
    1818#include "iostream.hfa"
     19#include <exception.hfa>
    1920
    2021
    21 //*********************************** ofstream ***********************************
     22// *********************************** ofstream ***********************************
    2223
    2324
    2425enum { sepSize = 16 };
    2526struct 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];
     27        void * $file;
     28        bool $sepDefault;
     29        bool $sepOnOff;
     30        bool $nlOnOff;
     31        bool $prt;                                                                                      // print text
     32        bool $sawNL;
     33        const char * $sepCur;
     34        char $separator[sepSize];
     35        char $tupleSeparator[sepSize];
    3536}; // ofstream
    3637
    3738// private
    38 bool sepPrt( ofstream & );
    39 void sepReset( ofstream & );
    40 void sepReset( ofstream &, bool );
    41 const char * sepGetCur( ofstream & );
    42 void sepSetCur( ofstream &, const char * );
    43 bool getNL( ofstream & );
    44 void setNL( ofstream &, bool );
    45 bool getANL( ofstream & );
    46 bool getPrt( ofstream & );
    47 void setPrt( ofstream &, bool );
     39bool $sepPrt( ofstream & );
     40void $sepReset( ofstream & );
     41void $sepReset( ofstream &, bool );
     42const char * $sepGetCur( ofstream & );
     43void $sepSetCur( ofstream &, const char [] );
     44bool $getNL( ofstream & );
     45void $setNL( ofstream &, bool );
     46bool $getANL( ofstream & );
     47bool $getPrt( ofstream & );
     48void $setPrt( ofstream &, bool );
    4849
    4950// public
     
    5657
    5758const char * sepGet( ofstream & );
    58 void sepSet( ofstream &, const char * );
     59void sepSet( ofstream &, const char [] );
    5960const char * sepGetTuple( ofstream & );
    60 void sepSetTuple( ofstream &, const char * );
     61void sepSetTuple( ofstream &, const char [] );
    6162
    6263void ends( ofstream & os );
    6364int fail( ofstream & );
    6465int flush( ofstream & );
    65 void open( ofstream &, const char * name, const char * mode );
    66 void open( ofstream &, const char * name );
     66void open( ofstream &, const char name[], const char mode[] );
     67void open( ofstream &, const char name[] );
    6768void close( ofstream & );
    68 ofstream & write( ofstream &, const char * data, size_t size );
    69 int fmt( ofstream &, const char format[], ... );
     69ofstream & write( ofstream &, const char data[], size_t size );
     70int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
    7071
    7172void ?{}( ofstream & os );
    72 void ?{}( ofstream & os, const char * name, const char * mode );
    73 void ?{}( ofstream & os, const char * name );
     73void ?{}( ofstream & os, const char name[], const char mode[] );
     74void ?{}( ofstream & os, const char name[] );
    7475void ^?{}( ofstream & os );
    7576
     
    7879
    7980
    80 //*********************************** ifstream ***********************************
     81// *********************************** ifstream ***********************************
    8182
    8283
    8384struct ifstream {
    84         void * file;
    85         bool nlOnOff;
     85        void * $file;
     86        bool $nlOnOff;
    8687}; // ifstream
    8788
     
    9293int fail( ifstream & is );
    9394int eof( ifstream & is );
    94 void open( ifstream & is, const char * name, const char * mode );
    95 void open( ifstream & is, const char * name );
     95void open( ifstream & is, const char name[], const char mode[] );
     96void open( ifstream & is, const char name[] );
    9697void close( ifstream & is );
    9798ifstream & read( ifstream & is, char * data, size_t size );
    9899ifstream & ungetc( ifstream & is, char c );
    99 int fmt( ifstream &, const char format[], ... );
     100int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
    100101
    101102void ?{}( ifstream & is );
    102 void ?{}( ifstream & is, const char * name, const char * mode );
    103 void ?{}( ifstream & is, const char * name );
     103void ?{}( ifstream & is, const char name[], const char mode[] );
     104void ?{}( ifstream & is, const char name[] );
    104105void ^?{}( ifstream & is );
    105106
    106107extern ifstream & sin, & stdin;                                                 // aliases
     108
     109
     110// *********************************** exceptions ***********************************
     111
     112
     113DATA_EXCEPTION(Open_Failure)(
     114        union {
     115                ofstream * ostream;
     116                ifstream * istream;
     117        };
     118        // TEMPORARY: need polymorphic exceptions
     119        int tag;                                                                                        // 1 => ostream; 0 => istream
     120);
     121
     122void ?{}( Open_Failure & this, ofstream & ostream );
     123void ?{}( Open_Failure & this, ifstream & istream );
    107124
    108125// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.