- Timestamp:
- Jan 8, 2019, 11:31:21 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 08222c7, 274da98
- Parents:
- 84b4d607 (diff), d5b2ac8 (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. - Location:
- libcfa/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.cfa
r84b4d607 r25cdca5 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 12 08:34:28 201813 // Update Count : 29812 // Last Modified On : Mon Dec 24 18:33:38 2018 13 // Update Count : 304 14 14 // 15 15 … … 26 26 #define IO_MSG "I/O error: " 27 27 28 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool nonlManip, const char * separator, const char * tupleSeparator ) {28 void ?{}( ofstream & os, void * file, bool sepDefault, bool sepOnOff, bool nlOnOff, bool prt, const char * separator, const char * tupleSeparator ) { 29 29 os.file = file; 30 30 os.sepDefault = sepDefault; 31 31 os.sepOnOff = sepOnOff; 32 32 os.nlOnOff = nlOnOff; 33 os. nonlManip = nonlManip;33 os.prt = prt; 34 34 sepSet( os, separator ); 35 35 sepSetCur( os, sepGet( os ) ); … … 46 46 void setNL( ofstream & os, bool state ) { os.sawNL = state; } 47 47 bool getANL( ofstream & os ) { return os.nlOnOff; } 48 bool get Nonl( ofstream & os ) { return os.nonlManip; }49 void set Nonl( ofstream & os, bool state ) { os.nonlManip= state; }48 bool getPrt( ofstream & os ) { return os.prt; } 49 void setPrt( ofstream & os, bool state ) { os.prt = state; } 50 50 51 51 // public … … 150 150 va_end( args ); 151 151 152 setPrt( os, true ); // called in output cascade 152 153 sepReset( os ); // reset separator 153 154 return len; -
libcfa/src/fstream.hfa
r84b4d607 r25cdca5 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 12 07:52:41 201813 // Update Count : 14 312 // Last Modified On : Mon Dec 24 18:33:41 2018 13 // Update Count : 149 14 14 // 15 15 … … 24 24 bool sepOnOff; 25 25 bool nlOnOff; 26 bool nonlManip;26 bool prt; // print text 27 27 bool sawNL; 28 28 const char * sepCur; … … 40 40 void setNL( ofstream &, bool ); 41 41 bool getANL( ofstream & ); 42 bool get Nonl( ofstream & );43 void set Nonl( ofstream &, bool );42 bool getPrt( ofstream & ); 43 void setPrt( ofstream &, bool ); 44 44 45 45 // public … … 62 62 void close( ofstream & ); 63 63 ofstream & write( ofstream &, const char * data, size_t size ); 64 int fmt( ofstream &, const char f mt[], ... );64 int fmt( ofstream &, const char format[], ... ); 65 65 66 66 void ?{}( ofstream & os ); … … 83 83 ifstream & read( ifstream & is, char * data, size_t size ); 84 84 ifstream & ungetc( ifstream & is, char c ); 85 int fmt( ifstream &, const char f mt[], ... );85 int fmt( ifstream &, const char format[], ... ); 86 86 87 87 void ?{}( ifstream & is ); -
libcfa/src/iostream.cfa
r84b4d607 r25cdca5 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 13 14:13:22201813 // Update Count : 5 4812 // Last Modified On : Mon Dec 24 18:33:40 2018 13 // Update Count : 589 14 14 // 15 15 … … 33 33 } // ?|? 34 34 void ?|?( ostype & os, bool b ) { 35 (ostype )(os | b); if ( getANL( os ) )nl( os );35 (ostype &)(os | b); nl( os ); 36 36 } // ?|? 37 37 … … 42 42 } // ?|? 43 43 void ?|?( ostype & os, char c ) { 44 (ostype )(os | c); if ( getANL( os ) )nl( os );44 (ostype &)(os | c); nl( os ); 45 45 } // ?|? 46 46 … … 51 51 } // ?|? 52 52 void ?|?( ostype & os, signed char sc ) { 53 (ostype )(os | sc); if ( getANL( os ) )nl( os );53 (ostype &)(os | sc); nl( os ); 54 54 } // ?|? 55 55 … … 60 60 } // ?|? 61 61 void ?|?( ostype & os, unsigned char usc ) { 62 (ostype )(os | usc); if ( getANL( os ) )nl( os );62 (ostype &)(os | usc); nl( os ); 63 63 } // ?|? 64 64 … … 69 69 } // ?|? 70 70 void & ?|?( ostype & os, short int si ) { 71 (ostype )(os | si); if ( getANL( os ) )nl( os );71 (ostype &)(os | si); nl( os ); 72 72 } // ?|? 73 73 … … 78 78 } // ?|? 79 79 void & ?|?( ostype & os, unsigned short int usi ) { 80 (ostype )(os | usi); if ( getANL( os ) )nl( os );80 (ostype &)(os | usi); nl( os ); 81 81 } // ?|? 82 82 … … 87 87 } // ?|? 88 88 void & ?|?( ostype & os, int i ) { 89 (ostype )(os | i); if ( getANL( os ) )nl( os );89 (ostype &)(os | i); nl( os ); 90 90 } // ?|? 91 91 … … 96 96 } // ?|? 97 97 void & ?|?( ostype & os, unsigned int ui ) { 98 (ostype )(os | ui); if ( getANL( os ) )nl( os );98 (ostype &)(os | ui); nl( os ); 99 99 } // ?|? 100 100 … … 105 105 } // ?|? 106 106 void & ?|?( ostype & os, long int li ) { 107 (ostype )(os | li); if ( getANL( os ) )nl( os );107 (ostype &)(os | li); nl( os ); 108 108 } // ?|? 109 109 … … 114 114 } // ?|? 115 115 void & ?|?( ostype & os, unsigned long int uli ) { 116 (ostype )(os | uli); if ( getANL( os ) )nl( os );116 (ostype &)(os | uli); nl( os ); 117 117 } // ?|? 118 118 … … 123 123 } // ?|? 124 124 void & ?|?( ostype & os, long long int lli ) { 125 (ostype )(os | lli); if ( getANL( os ) )nl( os );125 (ostype &)(os | lli); nl( os ); 126 126 } // ?|? 127 127 … … 132 132 } // ?|? 133 133 void & ?|?( ostype & os, unsigned long long int ulli ) { 134 (ostype )(os | ulli); if ( getANL( os ) )nl( os );134 (ostype &)(os | ulli); nl( os ); 135 135 } // ?|? 136 136 … … 141 141 } // ?|? 142 142 void & ?|?( ostype & os, float f ) { 143 (ostype )(os | f); if ( getANL( os ) )nl( os );143 (ostype &)(os | f); nl( os ); 144 144 } // ?|? 145 145 … … 150 150 } // ?|? 151 151 void & ?|?( ostype & os, double d ) { 152 (ostype )(os | d); if ( getANL( os ) )nl( os );152 (ostype &)(os | d); nl( os ); 153 153 } // ?|? 154 154 … … 159 159 } // ?|? 160 160 void & ?|?( ostype & os, long double ld ) { 161 (ostype )(os | ld); if ( getANL( os ) )nl( os );161 (ostype &)(os | ld); nl( os ); 162 162 } // ?|? 163 163 … … 168 168 } // ?|? 169 169 void & ?|?( ostype & os, float _Complex fc ) { 170 (ostype )(os | fc); if ( getANL( os ) )nl( os );170 (ostype &)(os | fc); nl( os ); 171 171 } // ?|? 172 172 … … 177 177 } // ?|? 178 178 void & ?|?( ostype & os, double _Complex dc ) { 179 (ostype )(os | dc); if ( getANL( os ) )nl( os );179 (ostype &)(os | dc); nl( os ); 180 180 } // ?|? 181 181 … … 186 186 } // ?|? 187 187 void & ?|?( ostype & os, long double _Complex ldc ) { 188 (ostype )(os | ldc); if ( getANL( os ) )nl( os );188 (ostype &)(os | ldc); nl( os ); 189 189 } // ?|? 190 190 … … 228 228 } // ?|? 229 229 void ?|?( ostype & os, const char * str ) { 230 (ostype )(os | str); if ( getANL( os ) )nl( os );230 (ostype &)(os | str); nl( os ); 231 231 } // ?|? 232 232 … … 257 257 } // ?|? 258 258 void ?|?( ostype & os, const void * p ) { 259 (ostype )(os | p); if ( getANL( os ) )nl( os );259 (ostype &)(os | p); nl( os ); 260 260 } // ?|? 261 261 262 262 // manipulators 263 263 ostype & ?|?( ostype & os, ostype & (* manip)( ostype & ) ) { 264 (ostype)(manip( os )); 265 setNonl( os, false ); // ignore nonl in middle 264 (ostype &)(manip( os )); 266 265 return os; 267 266 } // ?|? 268 267 void ?|?( ostype & os, ostype & (* manip)( ostype & ) ) { 269 (ostype )(manip( os ));270 if ( get ANL( os ) && ! getNonl( os ) ) nl( os ); // ignore nl if nonl at end271 set Nonl( os, false );268 (ostype &)(manip( os )); 269 if ( getPrt( os ) ) nl( os ); // something printed ? 270 setPrt( os, false ); // turn off 272 271 } // ?|? 273 272 274 273 ostype & sep( ostype & os ) { 275 return (ostype )(os | sepGet( os ));274 return (ostype &)(os | sepGet( os )); 276 275 } // sep 277 276 … … 281 280 282 281 ostype & nl( ostype & os ) { 283 (ostype)(os | '\n'); 282 (ostype &)(os | '\n'); 283 setPrt( os, false ); // turn off 284 284 setNL( os, true ); 285 285 flush( os ); … … 287 287 } // nl 288 288 289 void nl( ostype & os ) { 290 if ( getANL( os ) ) (ostype &)(nl( os )); // implementation only 291 else setPrt( os, false ); // turn off 292 } // nl 293 289 294 ostype & nonl( ostype & os ) { 290 set Nonl( os, true ); // indicate nonl manipulator295 setPrt( os, false ); // turn off 291 296 return os; 292 297 } // nonl … … 326 331 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype & ?|?( ostype &, Params ); } ) { 327 332 ostype & ?|?( ostype & os, T arg, Params rest ) { 328 (ostype )(os | arg);// print first argument333 (ostype &)(os | arg); // print first argument 329 334 sepSetCur( os, sepGetTuple( os ) ); // switch to tuple separator 330 (ostype )(os | rest); // print remaining arguments335 (ostype &)(os | rest); // print remaining arguments 331 336 sepSetCur( os, sepGet( os ) ); // switch to regular separator 332 337 return os; 333 338 } // ?|? 334 339 void ?|?( ostype & os, T arg, Params rest ) { 335 // (ostype)(?|?( os, arg, rest )); if ( getANL( os ) )nl( os );336 (ostype )(os | arg);// print first argument340 // (ostype &)(?|?( os, arg, rest )); nl( os ); 341 (ostype &)(os | arg); // print first argument 337 342 sepSetCur( os, sepGetTuple( os ) ); // switch to tuple separator 338 (ostype )(os | rest); // print remaining arguments343 (ostype &)(os | rest); // print remaining arguments 339 344 sepSetCur( os, sepGet( os ) ); // switch to regular separator 340 if ( getANL( os ) )nl( os );345 nl( os ); 341 346 } // ?|? 342 347 } // distribution -
libcfa/src/iostream.hfa
r84b4d607 r25cdca5 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 22:01:31201813 // Update Count : 2 1312 // Last Modified On : Mon Dec 24 18:33:40 2018 13 // Update Count : 220 14 14 // 15 15 … … 20 20 trait ostream( dtype ostype ) { 21 21 // private 22 bool sepPrt( ostype & ); // returnseparator state (on/off)22 bool sepPrt( ostype & ); // get separator state (on/off) 23 23 void sepReset( ostype & ); // set separator state to default state 24 24 void sepReset( ostype &, bool ); // set separator and default state … … 27 27 bool getNL( ostype & ); // check newline 28 28 void setNL( ostype &, bool ); // saw newline 29 bool getANL( ostype & ); // check auto newline30 bool get Nonl( ostype & ); // check nonnl manipulator31 void set Nonl( ostype &, bool ); // set nonnl manipulator29 bool getANL( ostype & ); // get auto newline (on/off) 30 bool getPrt( ostype & ); // get fmt called in output cascade 31 void setPrt( ostype &, bool ); // set fmt called in output cascade 32 32 // public 33 33 void sepOn( ostype & ); // turn separator state on … … 48 48 void close( ostype & os ); 49 49 ostype & write( ostype &, const char *, size_t ); 50 int fmt( ostype &, const char f mt[], ... );50 int fmt( ostype &, const char format[], ... ); 51 51 }; // ostream 52 52 … … 63 63 forall( dtype ostype | ostream( ostype ) ) { 64 64 ostype & ?|?( ostype &, bool ); 65 void &?|?( ostype &, bool );65 void ?|?( ostype &, bool ); 66 66 67 67 ostype & ?|?( ostype &, char ); 68 void &?|?( ostype &, char );68 void ?|?( ostype &, char ); 69 69 ostype & ?|?( ostype &, signed char ); 70 void &?|?( ostype &, signed char );70 void ?|?( ostype &, signed char ); 71 71 ostype & ?|?( ostype &, unsigned char ); 72 void &?|?( ostype &, unsigned char );72 void ?|?( ostype &, unsigned char ); 73 73 74 74 ostype & ?|?( ostype &, short int ); 75 void &?|?( ostype &, short int );75 void ?|?( ostype &, short int ); 76 76 ostype & ?|?( ostype &, unsigned short int ); 77 void &?|?( ostype &, unsigned short int );77 void ?|?( ostype &, unsigned short int ); 78 78 ostype & ?|?( ostype &, int ); 79 void &?|?( ostype &, int );79 void ?|?( ostype &, int ); 80 80 ostype & ?|?( ostype &, unsigned int ); 81 void &?|?( ostype &, unsigned int );81 void ?|?( ostype &, unsigned int ); 82 82 ostype & ?|?( ostype &, long int ); 83 void &?|?( ostype &, long int );83 void ?|?( ostype &, long int ); 84 84 ostype & ?|?( ostype &, long long int ); 85 void &?|?( ostype &, long long int );85 void ?|?( ostype &, long long int ); 86 86 ostype & ?|?( ostype &, unsigned long int ); 87 void &?|?( ostype &, unsigned long int );87 void ?|?( ostype &, unsigned long int ); 88 88 ostype & ?|?( ostype &, unsigned long long int ); 89 void &?|?( ostype &, unsigned long long int );89 void ?|?( ostype &, unsigned long long int ); 90 90 91 91 ostype & ?|?( ostype &, float ); // FIX ME: should not be required 92 void &?|?( ostype &, float ); // FIX ME: should not be required92 void ?|?( ostype &, float ); // FIX ME: should not be required 93 93 ostype & ?|?( ostype &, double ); 94 void &?|?( ostype &, double );94 void ?|?( ostype &, double ); 95 95 ostype & ?|?( ostype &, long double ); 96 void &?|?( ostype &, long double );96 void ?|?( ostype &, long double ); 97 97 98 98 ostype & ?|?( ostype &, float _Complex ); 99 void &?|?( ostype &, float _Complex );99 void ?|?( ostype &, float _Complex ); 100 100 ostype & ?|?( ostype &, double _Complex ); 101 void &?|?( ostype &, double _Complex );101 void ?|?( ostype &, double _Complex ); 102 102 ostype & ?|?( ostype &, long double _Complex ); 103 void &?|?( ostype &, long double _Complex );103 void ?|?( ostype &, long double _Complex ); 104 104 105 105 ostype & ?|?( ostype &, const char * ); 106 void &?|?( ostype &, const char * );106 void ?|?( ostype &, const char * ); 107 107 // ostype & ?|?( ostype &, const char16_t * ); 108 108 #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous … … 111 111 // ostype & ?|?( ostype &, const wchar_t * ); 112 112 ostype & ?|?( ostype &, const void * ); 113 void &?|?( ostype &, const void * );113 void ?|?( ostype &, const void * ); 114 114 115 115 // manipulators … … 117 117 void ?|?( ostype &, ostype & (*)( ostype & ) ); 118 118 ostype & nl( ostype & ); 119 void nl( ostype & ); 119 120 ostype & nonl( ostype & ); 120 121 ostype & sep( ostype & ); … … 149 150 istype & read( istype &, char *, size_t ); 150 151 istype & ungetc( istype &, char ); 151 int fmt( istype &, const char f mt[], ... );152 int fmt( istype &, const char format[], ... ); 152 153 }; // istream 153 154 -
libcfa/src/rational.cfa
r84b4d607 r25cdca5 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 22:02:29 201813 // Update Count : 1 6812 // Last Modified On : Sun Dec 23 22:56:49 2018 13 // Update Count : 170 14 14 // 15 15 … … 181 181 182 182 void ?|?( ostype & os, Rational(RationalImpl) r ) { 183 (ostype )(os | r); if ( getANL( os ) )nl( os );183 (ostype &)(os | r); nl( os ); 184 184 } // ?|? 185 185 } // distribution -
libcfa/src/stdlib.hfa
r84b4d607 r25cdca5 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 27 07:21:36201813 // Update Count : 34 512 // Last Modified On : Mon Dec 17 15:37:45 2018 13 // Update Count : 346 14 14 // 15 15 … … 178 178 179 179 static inline { 180 int ato( const char * sptr ) { return (int)strtol( sptr, 0, 10 ); }180 int ato( const char * sptr ) { return (int)strtol( sptr, 0, 10 ); } 181 181 unsigned int ato( const char * sptr ) { return (unsigned int)strtoul( sptr, 0, 10 ); } 182 182 long int ato( const char * sptr ) { return strtol( sptr, 0, 10 ); } -
libcfa/src/time.cfa
r84b4d607 r25cdca5 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 21:32:15201813 // Update Count : 5 312 // Last Modified On : Sun Dec 23 22:57:48 2018 13 // Update Count : 57 14 14 // 15 15 … … 33 33 forall( dtype ostype | ostream( ostype ) ) { 34 34 ostype & ?|?( ostype & os, Duration dur ) with( dur ) { 35 (ostype )(os | tv / TIMEGRAN); // print seconds35 (ostype &)(os | tv / TIMEGRAN); // print seconds 36 36 long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds 37 37 if ( ns != 0 ) { // some ? 38 38 char buf[16]; 39 (ostype )(os | nanomsd( ns, buf )); // print nanoseconds39 (ostype &)(os | nanomsd( ns, buf )); // print nanoseconds 40 40 } // if 41 41 return os; … … 43 43 44 44 void ?|?( ostype & os, Duration dur ) with( dur ) { 45 (ostype )(os | dur); if ( getANL( os ) )nl( os );45 (ostype &)(os | dur); nl( os ); 46 46 } // ?|? 47 47 } // distribution … … 150 150 long int ns = (tv < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds 151 151 if ( ns == 0 ) { // none ? 152 (ostype )(os | buf); // print date/time/year152 (ostype &)(os | buf); // print date/time/year 153 153 } else { 154 154 buf[19] = '\0'; // truncate to "Wed Jun 30 21:49:08" 155 155 char buf2[16]; 156 156 nanomsd( ns, buf2 ); // compute nanoseconds 157 (ostype )(os | buf | buf2 | ' ' | &buf[20]); // print date/time, nanoseconds and year157 (ostype &)(os | buf | buf2 | ' ' | &buf[20]); // print date/time, nanoseconds and year 158 158 } // if 159 159 return os; … … 161 161 162 162 void ?|?( ostype & os, Time time ) with( time ) { 163 (ostype )(os | time); if ( getANL( os ) )nl( os );163 (ostype &)(os | time); nl( os ); 164 164 } // ?|? 165 165 } // distribution
Note: See TracChangeset
for help on using the changeset viewer.