Changeset 4f37255 for libcfa/src/iostream.cfa
- Timestamp:
- Jul 14, 2019, 11:46:01 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 7dc2e57b
- Parents:
- ec72861
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
rec72861 r4f37255 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:04:13201913 // Update Count : 8 1912 // Last Modified On : Sat Jul 13 08:07:59 2019 13 // Update Count : 821 14 14 // 15 15 … … 499 499 if ( ! f.flags.left ) { \ 500 500 buf[i] = '.'; buf[i + 1] = '\0'; \ 501 if ( buf[0] == ' ' ) bufbeg = 1; 501 if ( buf[0] == ' ' ) bufbeg = 1; /* decimal point within width */ \ 502 502 } else { \ 503 503 for ( i = 0; i < len && buf[i] != ' '; i += 1 ); /* trailing blank ? */ \ … … 546 546 forall( dtype ostype | ostream( ostype ) ) { 547 547 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) { 548 if ( f.base != 'c' ) { 548 if ( f.base != 'c' ) { // bespoke binary/octal/hex format 549 549 _Ostream_Manip(unsigned char) fmtuc @= { f.val, f.wd, f.pc, f.base, {'\0'} }; 550 550 fmtuc.flags.pc = f.flags.pc; … … 558 558 559 559 #define CFMTNP "% * " 560 char fmtstr[sizeof(CFMTNP)]; 560 char fmtstr[sizeof(CFMTNP)]; // sizeof includes '\0' 561 561 memcpy( &fmtstr, CFMTNP, sizeof(CFMTNP) ); 562 int star = 1; 562 int star = 1; // position before first '*' 563 563 564 564 // Insert flags into spaces before '*', from right to left. … … 566 566 fmtstr[star] = '%'; 567 567 568 fmtstr[sizeof(CFMTNP)-2] = f.base; 568 fmtstr[sizeof(CFMTNP)-2] = f.base; // sizeof includes '\0' 569 569 // printf( "%d %s\n", f.wd, &fmtstr[star] ); 570 570 fmt( os, &fmtstr[star], f.wd, f.val ); … … 631 631 else { 632 632 fprintf( stderr, "invalid Boolean constant\n" ); 633 abort(); 633 abort(); // cannot use abort stream 634 634 } // if 635 635 return is; … … 639 639 char temp; 640 640 for () { 641 fmt( is, "%c", &temp ); 641 fmt( is, "%c", &temp ); // must pass pointer through varg to fmt 642 642 // do not overwrite parameter with newline unless appropriate 643 643 if ( temp != '\n' || getANL( is ) ) { c = temp; break; } … … 773 773 if ( ! f.s ) { 774 774 // printf( "skip %s %d\n", f.scanset, f.wd ); 775 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); 775 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); // no input arguments 776 776 else for ( f.wd ) fmt( is, "%*c" ); 777 777 return is;
Note: See TracChangeset
for help on using the changeset viewer.