Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/fstream.hfa

    r8d321f9 r4cae032  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 19 16:29:17 2020
    13 // Update Count     : 189
     12// Last Modified On : Fri Nov 29 06:56:02 2019
     13// Update Count     : 168
    1414//
    1515
     
    1717
    1818#include "iostream.hfa"
    19 #include <exception.hfa>
    2019
    2120
    22 // *********************************** ofstream ***********************************
     21//*********************************** ofstream ***********************************
    2322
    2423
    2524enum { sepSize = 16 };
    2625struct ofstream {
    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];
     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];
    3635}; // ofstream
    3736
    3837// private
    39 bool $sepPrt( ofstream & );
    40 void $sepReset( ofstream & );
    41 void $sepReset( ofstream &, bool );
    42 const char * $sepGetCur( ofstream & );
    43 void $sepSetCur( ofstream &, const char [] );
    44 bool $getNL( ofstream & );
    45 void $setNL( ofstream &, bool );
    46 bool $getANL( ofstream & );
    47 bool $getPrt( ofstream & );
    48 void $setPrt( ofstream &, bool );
     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 );
    4948
    5049// public
     
    5756
    5857const char * sepGet( ofstream & );
    59 void sepSet( ofstream &, const char [] );
     58void sepSet( ofstream &, const char * );
    6059const char * sepGetTuple( ofstream & );
    61 void sepSetTuple( ofstream &, const char [] );
     60void sepSetTuple( ofstream &, const char * );
    6261
    6362void ends( ofstream & os );
    6463int fail( ofstream & );
    6564int flush( ofstream & );
    66 void open( ofstream &, const char name[], const char mode[] );
    67 void open( ofstream &, const char name[] );
     65void open( ofstream &, const char * name, const char * mode );
     66void open( ofstream &, const char * name );
    6867void close( ofstream & );
    69 ofstream & write( ofstream &, const char data[], size_t size );
    70 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
     68ofstream & write( ofstream &, const char * data, size_t size );
     69int fmt( ofstream &, const char format[], ... );
    7170
    7271void ?{}( ofstream & os );
    73 void ?{}( ofstream & os, const char name[], const char mode[] );
    74 void ?{}( ofstream & os, const char name[] );
     72void ?{}( ofstream & os, const char * name, const char * mode );
     73void ?{}( ofstream & os, const char * name );
    7574void ^?{}( ofstream & os );
    7675
     
    7978
    8079
    81 // *********************************** ifstream ***********************************
     80//*********************************** ifstream ***********************************
    8281
    8382
    8483struct ifstream {
    85         void * $file;
    86         bool $nlOnOff;
     84        void * file;
     85        bool nlOnOff;
    8786}; // ifstream
    8887
     
    9392int fail( ifstream & is );
    9493int eof( ifstream & is );
    95 void open( ifstream & is, const char name[], const char mode[] );
    96 void open( ifstream & is, const char name[] );
     94void open( ifstream & is, const char * name, const char * mode );
     95void open( ifstream & is, const char * name );
    9796void close( ifstream & is );
    9897ifstream & read( ifstream & is, char * data, size_t size );
    9998ifstream & ungetc( ifstream & is, char c );
    100 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
     99int fmt( ifstream &, const char format[], ... );
    101100
    102101void ?{}( ifstream & is );
    103 void ?{}( ifstream & is, const char name[], const char mode[] );
    104 void ?{}( ifstream & is, const char name[] );
     102void ?{}( ifstream & is, const char * name, const char * mode );
     103void ?{}( ifstream & is, const char * name );
    105104void ^?{}( ifstream & is );
    106105
    107106extern ifstream & sin, & stdin;                                                 // aliases
    108 
    109 
    110 // *********************************** exceptions ***********************************
    111 
    112 
    113 DATA_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 
    122 void ?{}( Open_Failure & this, ofstream & ostream );
    123 void ?{}( Open_Failure & this, ifstream & istream );
    124107
    125108// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.