Changeset 35d1de5
- Timestamp:
- Feb 5, 2023, 9:31:04 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 6d2af204, ccb29b4
- Parents:
- 21a2a7d
- Location:
- tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tests/.expect/forall.txt ¶
r21a2a7d r35d1de5 1 forall.cfa:244:25: warning: Compiled 1 1 2 f 3 97 4 f 5 g 6 f 7 f 8 g 9 fT 10 fT 11 fT 12 fTU 13 fTU 14 fTU 15 1 2 16 2 1 17 1, 2 18 @ 0 2 0 4 6.4 6.4 6.4 6.4+3.i 4 19 3. 3. 20 45 21 12 3 -
TabularUnified tests/Makefile.am ¶
r21a2a7d r35d1de5 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sat Jun 5 14:49:25 202114 ## Update Count : 9 213 ## Last Modified On : Fri Feb 3 23:06:44 2023 14 ## Update Count : 94 15 15 ############################################################################### 16 16 … … 89 89 meta/fork+exec.hfa \ 90 90 concurrent/unified_locking/mutex_test.hfa \ 91 91 concurrent/channels/parallel_harness.hfa 92 92 93 93 dist-hook: … … 183 183 CFACOMPILE_SYNTAX = $(CFACOMPILETEST) -Wno-unused-variable -Wno-unused-label -c -fsyntax-only -o $(abspath ${@}) 184 184 185 SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator forall\185 SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \ 186 186 init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment 187 187 $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN) -
TabularUnified tests/forall.cfa ¶
r21a2a7d r35d1de5 10 10 // Created On : Wed May 9 08:48:15 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 2 15:28:45 2023 13 // Update Count : 38 14 // 12 // Last Modified On : Sun Feb 5 07:54:43 2023 13 // Update Count : 90 14 // 15 16 #include <fstream.hfa> 15 17 16 18 void g1() { 17 forall( T ) T f( T ) {}; 18 void f( int ) {}; 19 void h( void (*p)(void) ) {}; 20 21 int x; 22 void (*y)(void); 23 char z; 24 float w; 19 forall( T ) T f( T p ) { sout | 'f'; return p; }; 20 void f( int p ) { sout | p; }; 21 void g( void ) { sout | 'g'; }; 22 void h( void (*p)(void) ) { p(); }; 23 24 int x = 1; 25 void (*y)(void) = g; 26 char z = 'a'; 27 float w = 3.5; 25 28 26 29 f( x ); … … 28 31 f( z ); 29 32 f( w ); 33 h( y ); 34 f( y ); 30 35 h( f( y ) ); 31 36 } 32 37 33 38 void g2() { 34 forall( T ) void f( T, T ) { }35 forall( T, U ) void f( T, U ) { }39 forall( T ) void f( T, T ) { sout | "fT"; } 40 forall( T, U ) void f( T, U ) { sout | "fTU"; } 36 41 37 42 int x; 38 43 float y; 39 int *z; 40 float *w; 41 44 int * z; 45 float * w; 46 47 f( x, x ); 48 f( y, y ); 49 f( w, w ); 42 50 f( x, y ); 43 51 f( z, w ); … … 50 58 51 59 forall( T ) 52 void swap( T left, T right ) { 53 T temp = left; 54 left = right; 55 right = temp; 60 void swap( T & left, T & right ) { // by reference 61 T temp = left; 62 left = right; 63 right = temp; 64 } 65 66 forall( T ) 67 [ T, T ] swap( T i, T j ) { // by value 68 return [ j, i ]; 56 69 } 57 70 … … 72 85 } // sum 73 86 74 forall( T | { T ?+?( T, T ); T ?++( T & ); [T] ?+=?( T &, T ); } )87 forall( T | { T ?+?( T, T ); T ?++( T & ); [T] ?+=?( T &, T ); } ) 75 88 T twice( T t ) { 76 89 return t + t; … … 82 95 } 83 96 84 intfred() {85 int x = 1, y = 2, a[10] ;97 void fred() { 98 int x = 1, y = 2, a[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; 86 99 float f; 87 100 101 sout | x | y; 88 102 swap( x, y ); 89 twice( x ); 103 sout | x | y | nl | swap( x, y ); 104 // [ x, y ] = swap( y, x ); 105 sout | twice( ' ' ) | ' ' | twice( 0hh ) | twice( 1h ) | twice( 0n ) | twice( 2 ) 106 | twice( 3.2f ) | twice( 3.2 ) | twice( 3.2d ) | twice( 3.2+1.5i ) | twice( x ); 90 107 f = min( 4.0, 3.0 ); 91 sum( 10, a ); 108 sout | f | min( 4.0, 3.0 ); 109 sout | sum( 10, a ); 92 110 } 93 111 … … 186 204 187 205 forall( T ) { 188 extern "C" {206 // extern "C" { 189 207 struct SS { T t; }; 190 T foo( T ) {}191 }208 T foo( T p ) { return p; } 209 // } 192 210 } 193 211 … … 195 213 W(int,int) w; 196 214 197 intjane() {215 void jane() { 198 216 // int j = bar( 3, 4 ); 199 217 int k = baz( 3, 4, 5 ); 200 218 int i = foo( 3 ); 219 sout | k | i; 201 220 } 202 221 … … 211 230 T t; 212 231 T t2 = t; 232 sout | &tr | tp; 213 233 } 214 234 … … 242 262 243 263 int main( void ) { 244 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 264 g1(); 265 g2(); 266 fred(); 267 jane(); 245 268 } 246 269
Note: See TracChangeset
for help on using the changeset viewer.