Changeset dc5072f
- Timestamp:
- Jun 13, 2019, 8:39:28 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:
- 6a1dfda
- Parents:
- d60780c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
rd60780c rdc5072f 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 12 15:00:31201913 // Update Count : 81 912 // Last Modified On : Thu Jun 13 17:21:10 2019 13 // Update Count : 812 14 14 // 15 15 … … 740 740 } // ?|? 741 741 742 istype & ?|?( istype & is, const char * fmt ) {743 fmt( is, fmt, "" );744 return is;745 } // ?|?742 // istype & ?|?( istype & is, const char * fmt ) { 743 // fmt( is, fmt, "" ); 744 // return is; 745 // } // ?|? 746 746 747 747 istype & ?|?( istype & is, char * s ) { … … 777 777 // skip xxx 778 778 if ( ! f.s ) { 779 // printf( "skip %s %d\n", f.scanset, f.wd );780 if ( f.wd != -1 ) for ( f.wd ) fmt( is, "%*c" ); // no input arguments781 else f mt( is, f.scanset, "" );779 // printf( "skip %s %d\n", f.scanset, f.wd ); 780 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); // no input arguments 781 else for ( f.wd ) fmt( is, "%*c" ); 782 782 return is; 783 783 } // if -
libcfa/src/iostream.hfa
rd60780c rdc5072f 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 12 13:35:42201913 // Update Count : 3 3112 // Last Modified On : Thu Jun 13 17:20:21 2019 13 // Update Count : 325 14 14 // 15 15 … … 316 316 istype & ?|?( istype &, long double _Complex & ); 317 317 318 istype & ?|?( istype &, const char * );318 // istype & ?|?( istype &, const char * ); 319 319 istype & ?|?( istype &, char * ); 320 320 … … 350 350 _Istream_Cstr ignore( const char * s ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true } }; } 351 351 _Istream_Cstr & ignore( _Istream_Cstr & fmt ) { fmt.flags.ignore = true; return fmt; } 352 _Istream_Cstr wd ( unsigned int w, char * s ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0 } }; }353 _Istream_Cstr & wd ( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; }352 _Istream_Cstr wdi( unsigned int w, char * s ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0 } }; } 353 _Istream_Cstr & wdi( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; } 354 354 } // distribution 355 355 forall( dtype istype | istream( istype ) ) istype & ?|?( istype & is, _Istream_Cstr f ); … … 377 377 _Istream_Manip(T) & ignore( _Istream_Manip(T) & fmt ) { fmt.ignore = true; return fmt; } \ 378 378 _Istream_Manip(T) wdi( unsigned int w, T & val ) { return (_Istream_Manip(T))@{ val, w, false }; } \ 379 _Istream_Manip(T) & wd ( unsigned int w, _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \379 _Istream_Manip(T) & wdi( unsigned int w, _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \ 380 380 } /* distribution */ \ 381 381 forall( dtype istype | istream( istype ) ) { \ -
tests/io2.cfa
rd60780c rdc5072f 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jun 9 08:07:42201913 // Update Count : 1 1712 // Last Modified On : Thu Jun 13 16:43:14 2019 13 // Update Count : 120 14 14 // 15 15 … … 49 49 in | f | d | ld; // floating point 50 50 in | fc | dc | ldc; // floating-point complex 51 in | cstr( s1 ) | wd( size, cstr( s2 ) );// C string, length unchecked and checked51 in | s1 | wdi( size, s2 ); // C string, length unchecked and checked 52 52 sout | nl; 53 53 -
tests/manipulatorsInput.cfa
rd60780c rdc5072f 7 7 // Created On : Sat Jun 8 17:58:54 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Mon Jun 10 18:38:35201910 // Update Count : 89 // Last Modified On : Thu Jun 13 17:41:43 2019 10 // Update Count : 37 11 11 // 12 12 … … 17 17 { 18 18 char s[] = "yyyyyyyyyyyyyyyyyyyy"; 19 scanf( "abc" ); printf( "1 %s\n", s ); 20 scanf( "%s", s ); printf( "2 %s\n", s ); 21 scanf( "%*s" ); printf( "3 %s\n", s ); 22 scanf( "%8s", s ); printf( "4 %s\n", s ); 23 scanf( "%*8s" ); printf( "5 %s\n", s ); 19 const char sk[] = "abc"; 20 scanf( "abc " ); scanf( sk ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s ); 21 scanf( "%s", s ); printf( "2 %s\n", s ); 22 scanf( "%*s" ); printf( "3 %s\n", s ); 23 scanf( "%8s", s ); printf( "4 %s\n", s ); 24 scanf( "%*8s" ); printf( "5 %s\n", s ); 24 25 25 scanf( "%[abc]", s ); printf( "6 %s\n", s );26 scanf( "%[^abc]", s ); printf( "7 %s\n", s );27 scanf( "%*[abc]" ); printf( "8 %s\n", s );28 scanf( "%*[^abc]" ); printf( "9 %s\n", s );29 scanf( "%8[abc]", s ); printf( "10 %s\n", s );30 scanf( "%8[^abc]", s ); printf( "11 %s\n", s );31 scanf( "%*8[abc]" ); printf( "12 %s\n", s );32 scanf( "%*8[^abc]" ); printf( "13 %s\n", s );26 scanf( "%[abc]", s ); printf( "6 %s\n", s ); 27 scanf( "%[^abc]", s ); printf( "7 %s\n", s ); 28 scanf( "%*[abc]" ); printf( "8 %s\n", s ); 29 scanf( "%*[^abc]" ); printf( "9 %s\n", s ); 30 scanf( "%8[abc]", s ); printf( "10 %s\n", s ); 31 scanf( "%8[^abc]", s ); printf( "11 %s\n", s ); 32 scanf( "%*8[abc]" ); printf( "12 %s\n", s ); 33 scanf( "%*8[^abc]" ); printf( "13 %s\n", s ); 33 34 } 34 35 { 35 36 char s[] = "yyyyyyyyyyyyyyyyyyyy"; 36 sin | skip( "abc" ); sout | "1" | s; 37 sin | cstr( s ); sout | "2" | s; 38 sin | ignore( cstr( s ) ); sout | "3" | s; 39 sin | wd( 8, cstr( s ) ); sout | "4" | s; 40 sin | ignore( wd( 8, cstr( s ) ) ); sout | "5" | s; 37 char sk[] = "abc"; 38 sin /*| "abc "*/ | skip( sk ) | skip( 5 ); sout | "1" | s; 39 sin | s; sout | "2" | s; 40 sin | ignore( s ); sout | "3" | s; 41 sin | wdi( 8, s ); sout | "4" | s; 42 sin | ignore( wdi( 8, s ) ); sout | "5" | s; 41 43 42 44 sin | incl( "abc", s ); sout | "6" | s; … … 44 46 sin | ignore( incl( "abc", s ) ); sout | "8" | s; 45 47 sin | ignore( excl( "abc", s ) ); sout | "9" | s; 46 sin | wd ( 8, incl( "abc", s ) ); sout | "10" | s;47 sin | wd ( 8, excl( "abc", s ) ); sout | "11" | s;48 sin | ignore( wd ( 8, incl( "abc", s ) ) ); sout | "12" | s;49 sin | ignore( wd ( 8, excl( "abc", s ) ) ); sout | "13" | s;48 sin | wdi( 8, incl( "abc", s ) ); sout | "10" | s; 49 sin | wdi( 8, excl( "abc", s ) ); sout | "11" | s; 50 sin | ignore( wdi( 8, incl( "abc", s ) ) ); sout | "12" | s; 51 sin | ignore( wdi( 8, excl( "abc", s ) ) ); sout | "13" | s; 50 52 } 51 53 { 52 54 char c; 53 sin | c; sout | c;54 sin | ignore( c ); sout | c;55 sin | c; sout | c; 56 sin | ignore( c ); sout | c; 55 57 56 58 signed char sc; 57 sin | sc; sout | sc;58 sin | wdi( 3, sc ); sout | sc;59 sin | ignore( sc ); sout | sc;60 sin | ignore( wdi( 3, sc ) ); sout | sc;59 sin | sc; sout | sc; 60 sin | wdi( 3, sc ); sout | sc; 61 sin | ignore( sc ); sout | sc; 62 sin | ignore( wdi( 3, sc ) ); sout | sc; 61 63 62 64 unsigned char usc; 63 sin | usc; sout | usc;64 sin | wdi( 3, usc ); sout | usc;65 sin | ignore( usc ); sout | usc;66 sin | ignore( wdi( 3, usc ) ); sout | usc;65 sin | usc; sout | usc; 66 sin | wdi( 3, usc ); sout | usc; 67 sin | ignore( usc ); sout | usc; 68 sin | ignore( wdi( 3, usc ) ); sout | usc; 67 69 68 70 signed short int ssi; 69 sin | ssi; sout | ssi;70 sin | wdi( 3, ssi ); sout | ssi;71 sin | ignore( ssi ); sout | ssi;72 sin | ignore( wdi( 3, ssi ) ); sout | ssi;71 sin | ssi; sout | ssi; 72 sin | wdi( 3, ssi ); sout | ssi; 73 sin | ignore( ssi ); sout | ssi; 74 sin | ignore( wdi( 3, ssi ) ); sout | ssi; 73 75 74 76 unsigned short int usi; 75 sin | usi; sout | usi;76 sin | wdi( 3, usi ); sout | usi;77 sin | ignore( usi ); sout | usi;78 sin | ignore( wdi( 3, usi ) ); sout | usi;77 sin | usi; sout | usi; 78 sin | wdi( 3, usi ); sout | usi; 79 sin | ignore( usi ); sout | usi; 80 sin | ignore( wdi( 3, usi ) ); sout | usi; 79 81 80 82 signed int si; 81 sin | si; sout | si;82 sin | wdi( 3, si ); sout | si;83 sin | ignore( si ); sout | si;84 sin | ignore( wdi( 3, si ) ); sout | si;83 sin | si; sout | si; 84 sin | wdi( 3, si ); sout | si; 85 sin | ignore( si ); sout | si; 86 sin | ignore( wdi( 3, si ) ); sout | si; 85 87 86 88 unsigned int ui; 87 sin | ui; sout | ui;88 sin | wdi( 3, ui ); sout | ui;89 sin | ignore( ui ); sout | ui;90 sin | ignore( wdi( 3, ui ) ); sout | ui;89 sin | ui; sout | ui; 90 sin | wdi( 3, ui ); sout | ui; 91 sin | ignore( ui ); sout | ui; 92 sin | ignore( wdi( 3, ui ) ); sout | ui; 91 93 92 94 signed long int sli; 93 sin | sli; sout | sli;94 sin | wdi( 3, sli ); sout | sli;95 sin | ignore( sli ); sout | sli;96 sin | ignore( wdi( 3, sli ) ); sout | sli;95 sin | sli; sout | sli; 96 sin | wdi( 3, sli ); sout | sli; 97 sin | ignore( sli ); sout | sli; 98 sin | ignore( wdi( 3, sli ) ); sout | sli; 97 99 98 100 unsigned long int uli; 99 sin | uli; sout | uli;100 sin | wdi( 3, uli ); sout | uli;101 sin | ignore( uli ); sout | uli;102 sin | ignore( wdi( 3, uli ) ); sout | uli;101 sin | uli; sout | uli; 102 sin | wdi( 3, uli ); sout | uli; 103 sin | ignore( uli ); sout | uli; 104 sin | ignore( wdi( 3, uli ) ); sout | uli; 103 105 104 106 signed long long int slli; 105 sin | slli; sout | slli;106 sin | wdi( 3, slli ); sout | slli;107 sin | ignore( slli ); sout | slli;108 sin | ignore( wdi( 3, slli ) ); sout | slli;107 sin | slli; sout | slli; 108 sin | wdi( 3, slli ); sout | slli; 109 sin | ignore( slli ); sout | slli; 110 sin | ignore( wdi( 3, slli ) ); sout | slli; 109 111 110 112 unsigned long long int ulli; 111 sin | ulli; sout | ulli;112 sin | wdi( 3, ulli ); sout | ulli;113 sin | ignore( ulli ); sout | ulli;114 sin | ignore( wdi( 3, ulli ) ); sout | ulli;113 sin | ulli; sout | ulli; 114 sin | wdi( 3, ulli ); sout | ulli; 115 sin | ignore( ulli ); sout | ulli; 116 sin | ignore( wdi( 3, ulli ) ); sout | ulli; 115 117 116 118 float f; 117 sin | f; sout | f;118 sin | wdi( 8, f ); sout | f;119 sin | ignore( f ); sout | f;120 sin | ignore( wdi( 8, f ) ); sout | f;119 sin | f; sout | f; 120 sin | wdi( 8, f ); sout | f; 121 sin | ignore( f ); sout | f; 122 sin | ignore( wdi( 8, f ) ); sout | f; 121 123 122 124 double d; 123 sin | d; sout | d;124 sin | wdi( 8, d ); sout | d;125 sin | ignore( d ); sout | d;126 sin | ignore( wdi( 8, d ) ); sout | d;125 sin | d; sout | d; 126 sin | wdi( 8, d ); sout | d; 127 sin | ignore( d ); sout | d; 128 sin | ignore( wdi( 8, d ) ); sout | d; 127 129 128 130 long double ld; 129 sin | ld; sout | ld;130 sin | wdi( 8, ld ); sout | ld;131 sin | ignore( ld ); sout | ld;132 sin | ignore( wdi( 8, ld ) ); sout | ld;131 sin | ld; sout | ld; 132 sin | wdi( 8, ld ); sout | ld; 133 sin | ignore( ld ); sout | ld; 134 sin | ignore( wdi( 8, ld ) ); sout | ld; 133 135 134 136 float _Complex fc; 135 sin | fc; sout | fc;136 sin | wdi( 8, fc ); sout | fc;137 sin | ignore( fc ); sout | fc;138 sin | ignore( wdi( 8, fc ) ); sout | fc;137 sin | fc; sout | fc; 138 sin | wdi( 8, fc ); sout | fc; 139 sin | ignore( fc ); sout | fc; 140 sin | ignore( wdi( 8, fc ) ); sout | fc; 139 141 140 142 double _Complex dc; 141 sin | dc; sout | dc;142 sin | wdi( 8, dc ); sout | dc;143 sin | ignore( dc ); sout | dc;144 sin | ignore( wdi( 8, dc ) ); sout | dc;143 sin | dc; sout | dc; 144 sin | wdi( 8, dc ); sout | dc; 145 sin | ignore( dc ); sout | dc; 146 sin | ignore( wdi( 8, dc ) ); sout | dc; 145 147 146 148 long double _Complex ldc; 147 sin | ldc; sout | ldc;148 sin | wdi( 8, ldc ); sout | ldc;149 sin | ignore( ldc ); sout | ldc;150 sin | ignore( wdi( 8, ldc ) ); sout | ldc;149 sin | ldc; sout | ldc; 150 sin | wdi( 8, ldc ); sout | ldc; 151 sin | ignore( ldc ); sout | ldc; 152 sin | ignore( wdi( 8, ldc ) ); sout | ldc; 151 153 } 152 154 } // main … … 154 156 // Local Variables: // 155 157 // tab-width: 4 // 156 // compile-command: "cfa manipulatorsInput.cfa" //158 // compile-command: "cfa -Wall -Wextra manipulatorsInput.cfa" // 157 159 // End: //
Note: See TracChangeset
for help on using the changeset viewer.