Changeset 44574f2
- Timestamp:
- Jan 25, 2018, 10:27:41 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 728df66
- Parents:
- b2052f7
- Location:
- src/libcfa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/iostream
rb2052f7 r44574f2 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 21 13:55:41 201713 // Update Count : 14 512 // Last Modified On : Thu Jan 25 13:08:39 2018 13 // Update Count : 149 14 14 // 15 15 … … 124 124 }; // readable 125 125 126 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, _Bool & ); 127 126 128 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, char & ); 127 129 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, signed char & ); … … 145 147 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, long double _Complex & ); 146 148 149 // manipulators 150 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, istype & (*)( istype & ) ); 151 forall( dtype istype | istream( istype ) ) istype & endl( istype & is ); 152 147 153 struct _Istream_cstrUC { char * s; }; 148 154 _Istream_cstrUC cstr( char * ); -
src/libcfa/iostream.c
rb2052f7 r44574f2 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 21 13:55:09 201713 // Update Count : 4 2712 // Last Modified On : Thu Jan 25 13:09:28 2018 13 // Update Count : 467 14 14 // 15 15 … … 19 19 #include <stdio.h> 20 20 #include <stdbool.h> // true/false 21 #include <string.h> // strlen 21 //#include <string.h> // strlen, strcmp 22 extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2))); 23 extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); 22 24 #include <float.h> // DBL_DIG, LDBL_DIG 23 25 #include <complex.h> // creal, cimag … … 301 303 302 304 forall( dtype istype | istream( istype ) ) 305 istype & ?|?( istype & is, _Bool & b ) { 306 char val[6]; 307 fmt( is, "%5s", val ); 308 if ( strcmp( val, "true" ) == 0 ) b = true; 309 else if ( strcmp( val, "false" ) == 0 ) b = false; 310 else { 311 fprintf( stderr, "invalid _Bool constant\n" ); 312 abort(); 313 } // if 314 return is; 315 } // ?|? 316 317 forall( dtype istype | istream( istype ) ) 303 318 istype & ?|?( istype & is, char & c ) { 304 319 fmt( is, "%c", &c ); // must pass pointer through varg to fmt … … 410 425 } // ?|? 411 426 427 forall( dtype istype | istream( istype ) ) 428 istype & ?|?( istype & is, istype & (* manip)( istype & ) ) { 429 return manip( is ); 430 } // ?|? 431 432 forall( dtype istype | istream( istype ) ) 433 istype & endl( istype & is ) { 434 fmt( is, "%*[ \t\f\n\r\v]" ); // ignore whitespace 435 return is; 436 } // endl 437 412 438 _Istream_cstrUC cstr( char * str ) { return (_Istream_cstrUC){ str }; } 413 439 forall( dtype istype | istream( istype ) )
Note: See TracChangeset
for help on using the changeset viewer.