Changeset eef8dfb for libcfa/src/fstream.hfa
- Timestamp:
- Jan 7, 2021, 2:55:57 PM (5 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.hfa
rbdfc032 reef8dfb 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Nov 29 06:56:02 201913 // Update Count : 1 6812 // Last Modified On : Fri Jun 19 16:29:17 2020 13 // Update Count : 189 14 14 // 15 15 … … 17 17 18 18 #include "iostream.hfa" 19 #include <exception.hfa> 19 20 20 21 21 // *********************************** ofstream ***********************************22 // *********************************** ofstream *********************************** 22 23 23 24 24 25 enum { sepSize = 16 }; 25 26 struct ofstream { 26 void * file;27 bool sepDefault;28 bool sepOnOff;29 bool nlOnOff;30 bool prt; // print text31 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]; 35 36 }; // ofstream 36 37 37 38 // 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 );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 ); 48 49 49 50 // public … … 56 57 57 58 const char * sepGet( ofstream & ); 58 void sepSet( ofstream &, const char *);59 void sepSet( ofstream &, const char [] ); 59 60 const char * sepGetTuple( ofstream & ); 60 void sepSetTuple( ofstream &, const char *);61 void sepSetTuple( ofstream &, const char [] ); 61 62 62 63 void ends( ofstream & os ); 63 64 int fail( ofstream & ); 64 65 int flush( ofstream & ); 65 void open( ofstream &, const char * name, const char * mode);66 void open( ofstream &, const char * name);66 void open( ofstream &, const char name[], const char mode[] ); 67 void open( ofstream &, const char name[] ); 67 68 void close( ofstream & ); 68 ofstream & write( ofstream &, const char * data, size_t size );69 int fmt( ofstream &, const char format[], ... ) ;69 ofstream & write( ofstream &, const char data[], size_t size ); 70 int fmt( ofstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) )); 70 71 71 72 void ?{}( ofstream & os ); 72 void ?{}( ofstream & os, const char * name, const char * mode);73 void ?{}( ofstream & os, const char * name);73 void ?{}( ofstream & os, const char name[], const char mode[] ); 74 void ?{}( ofstream & os, const char name[] ); 74 75 void ^?{}( ofstream & os ); 75 76 … … 78 79 79 80 80 // *********************************** ifstream ***********************************81 // *********************************** ifstream *********************************** 81 82 82 83 83 84 struct ifstream { 84 void * file;85 bool nlOnOff;85 void * $file; 86 bool $nlOnOff; 86 87 }; // ifstream 87 88 … … 92 93 int fail( ifstream & is ); 93 94 int eof( ifstream & is ); 94 void open( ifstream & is, const char * name, const char * mode);95 void open( ifstream & is, const char * name);95 void open( ifstream & is, const char name[], const char mode[] ); 96 void open( ifstream & is, const char name[] ); 96 97 void close( ifstream & is ); 97 98 ifstream & read( ifstream & is, char * data, size_t size ); 98 99 ifstream & ungetc( ifstream & is, char c ); 99 int fmt( ifstream &, const char format[], ... ) ;100 int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) )); 100 101 101 102 void ?{}( ifstream & is ); 102 void ?{}( ifstream & is, const char * name, const char * mode);103 void ?{}( ifstream & is, const char * name);103 void ?{}( ifstream & is, const char name[], const char mode[] ); 104 void ?{}( ifstream & is, const char name[] ); 104 105 void ^?{}( ifstream & is ); 105 106 106 107 extern 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 ); 107 124 108 125 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.