Changeset cbef27b for libcfa/src
- Timestamp:
- Apr 26, 2019, 4:56:16 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8d63649
- Parents:
- 3898392 (diff), bd405fa (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:
-
- 6 edited
-
fstream.cfa (modified) (4 diffs)
-
fstream.hfa (modified) (2 diffs)
-
gmp.hfa (modified) (2 diffs)
-
iostream.cfa (modified) (3 diffs)
-
iostream.hfa (modified) (3 diffs)
-
stdlib.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.cfa
r3898392 rcbef27b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 28 17:39:53 201913 // Update Count : 3 0712 // Last Modified On : Sat Apr 20 12:03:43 2019 13 // Update Count : 311 14 14 // 15 15 … … 33 33 os.nlOnOff = nlOnOff; 34 34 os.prt = prt; 35 os.sawNL = false; 35 36 sepSet( os, separator ); 36 37 sepSetCur( os, sepGet( os ) ); … … 162 163 void ?{}( ifstream & is, void * file ) { 163 164 is.file = file; 165 is.nlOnOff = false; 164 166 } 165 167 … … 173 175 open( is, name, "r" ); 174 176 } 177 178 void nlOn( ifstream & os ) { os.nlOnOff = true; } 179 void nlOff( ifstream & os ) { os.nlOnOff = false; } 180 bool getANL( ifstream & os ) { return os.nlOnOff; } 175 181 176 182 int fail( ifstream & is ) { -
libcfa/src/fstream.hfa
r3898392 rcbef27b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 24 18:33:41 201813 // Update Count : 1 4912 // Last Modified On : Sat Apr 20 12:03:58 2019 13 // Update Count : 151 14 14 // 15 15 … … 73 73 struct ifstream { 74 74 void * file; 75 bool nlOnOff; 75 76 }; // ifstream 76 77 77 78 // public 79 void nlOn( ifstream & ); 80 void nlOff( ifstream & ); 81 bool getANL( ifstream & ); 78 82 int fail( ifstream & is ); 79 83 int eof( ifstream & is ); -
libcfa/src/gmp.hfa
r3898392 rcbef27b 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 4 23:25:51 201813 // Update Count : 2 212 // Last Modified On : Sat Apr 20 09:01:52 2019 13 // Update Count : 24 14 14 // 15 15 … … 271 271 272 272 void ?|?( ostype & os, Int mp ) { 273 (ostype)(os | mp); if ( getANL( os ) )nl( os );273 (ostype)(os | mp); nl( os ); 274 274 } // ?|? 275 275 } // distribution -
libcfa/src/iostream.cfa
r3898392 rcbef27b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 4 20:57:24201913 // Update Count : 59312 // Last Modified On : Sat Apr 20 14:02:43 2019 13 // Update Count : 617 14 14 // 15 15 … … 396 396 397 397 istype & ?|?( istype & is, char & c ) { 398 fmt( is, "%c", &c ); // must pass pointer through varg to fmt 398 char temp; 399 for () { 400 fmt( is, "%c", &temp ); // must pass pointer through varg to fmt 401 // do not overwrite parameter with newline unless appropriate 402 if ( temp != '\n' || getANL( is ) ) { c = temp; break; } 403 if ( eof( is ) ) break; 404 } // for 399 405 return is; 400 406 } // ?|? … … 498 504 return is; 499 505 } // nl 506 507 istype & nlOn( istype & is ) { 508 nlOn( is ); // call void returning 509 return is; 510 } // nlOn 511 512 istype & nlOff( istype & is ) { 513 nlOff( is ); // call void returning 514 return is; 515 } // nlOff 500 516 } // distribution 501 517 -
libcfa/src/iostream.hfa
r3898392 rcbef27b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 26 16:57:22201913 // Update Count : 22 112 // Last Modified On : Sat Apr 20 12:04:07 2019 13 // Update Count : 226 14 14 // 15 15 … … 149 149 150 150 trait istream( dtype istype ) { 151 void nlOn( istype & ); // read newline 152 void nlOff( istype & ); // scan newline 153 bool getANL( istype & ); // get scan newline (on/off) 151 154 int fail( istype & ); 152 155 int eof( istype & ); … … 187 190 188 191 // manipulators 192 istype & nlOn( istype & ); 193 istype & nlOff( istype & ); 189 194 istype & ?|?( istype &, istype & (*)( istype & ) ); 190 195 istype & nl( istype & is ); -
libcfa/src/stdlib.hfa
r3898392 rcbef27b 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 17 15:37:45 201813 // Update Count : 3 4612 // Last Modified On : Wed Apr 24 17:35:43 2019 13 // Update Count : 352 14 14 // 15 15 … … 40 40 } // malloc 41 41 42 // T & malloc( void ) {43 // int & p = *(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc44 // printf( "& malloc %p\n", &p );45 // return p;46 // // return (T &)*(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc47 // } // malloc48 49 42 T * calloc( size_t dim ) { 50 43 return (T *)(void *)calloc( dim, sizeof(T) ); // C calloc … … 76 69 T * alloc( char fill ) { 77 70 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 78 return (T *)memset( ptr, (int)fill, sizeof(T) ); // initialwith fill value71 return (T *)memset( ptr, (int)fill, sizeof(T) ); // initialize with fill value 79 72 } // alloc 80 73 … … 84 77 85 78 T * alloc( size_t dim, char fill ) { 86 T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc87 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); // initialwith fill value79 T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C calloc 80 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); // initialize with fill value 88 81 } // alloc 89 82
Note:
See TracChangeset
for help on using the changeset viewer.