- Timestamp:
- Jan 11, 2019, 3:36:48 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- e1f7eef
- Parents:
- ff5caaf (diff), 52ffa30 (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:
- tests
- Files:
-
- 12 added
- 15 deleted
- 25 edited
- 126 moved
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/alloc-ERROR.txt
rff5caaf r95b8aa7 1 alloc.c :265:1 error: No reasonable alternatives for expression Applying untyped:1 alloc.cfa:265:1 error: No reasonable alternatives for expression Applying untyped: 2 2 Name: ?=? 3 3 ...to: … … 19 19 20 20 21 alloc.c :266:1 error: No reasonable alternatives for expression Applying untyped:21 alloc.cfa:266:1 error: No reasonable alternatives for expression Applying untyped: 22 22 Name: ?=? 23 23 ...to: … … 39 39 40 40 41 alloc.c :267:1 error: No reasonable alternatives for expression Applying untyped:41 alloc.cfa:267:1 error: No reasonable alternatives for expression Applying untyped: 42 42 Name: ?=? 43 43 ...to: … … 50 50 51 51 52 alloc.c :268:1 error: No reasonable alternatives for expression Applying untyped:52 alloc.cfa:268:1 error: No reasonable alternatives for expression Applying untyped: 53 53 Name: ?=? 54 54 ...to: -
tests/.expect/castError.txt
rff5caaf r95b8aa7 1 castError.c :7:1 error: Cannot choose between 3 alternatives for expression1 castError.cfa:7:1 error: Cannot choose between 3 alternatives for expression 2 2 Cast of: 3 3 Name: f … … 7 7 Variable Expression: f: function 8 8 accepting unspecified arguments 9 ... returning nothing 9 ... returning nothing 10 10 11 11 ... to: … … 14 14 char 15 15 ) 16 Environment: 16 Environment: 17 17 18 18 Cost ( 1, 0, 0, 0, 0, 0 ): Cast of: … … 23 23 char 24 24 ) 25 Environment: 25 Environment: 26 26 27 27 Cost ( 1, 0, 0, 0, 0, 0 ): Cast of: … … 32 32 char 33 33 ) 34 Environment: 34 Environment: 35 35 36 36 -
tests/.expect/completeTypeError.txt
rff5caaf r95b8aa7 1 completeTypeError.c :33:1 error: No reasonable alternatives for expression Applying untyped:1 completeTypeError.cfa:33:1 error: No reasonable alternatives for expression Applying untyped: 2 2 Name: *? 3 3 ...to: 4 4 Name: v 5 5 6 completeTypeError.c :34:1 error: No reasonable alternatives for expression Applying untyped:6 completeTypeError.cfa:34:1 error: No reasonable alternatives for expression Applying untyped: 7 7 Name: *? 8 8 ...to: 9 9 Name: y 10 10 11 completeTypeError.c :35:1 error: No reasonable alternatives for expression Applying untyped:11 completeTypeError.cfa:35:1 error: No reasonable alternatives for expression Applying untyped: 12 12 Name: foo 13 13 ...to: 14 14 Name: v 15 15 16 completeTypeError.c :36:1 error: No reasonable alternatives for expression Applying untyped:16 completeTypeError.cfa:36:1 error: No reasonable alternatives for expression Applying untyped: 17 17 Name: baz 18 18 ...to: 19 19 Name: v 20 20 21 completeTypeError.c :37:1 error: No reasonable alternatives for expression Applying untyped:21 completeTypeError.cfa:37:1 error: No reasonable alternatives for expression Applying untyped: 22 22 Name: quux 23 23 ...to: 24 24 Name: v 25 25 26 completeTypeError.c :58:1 error: No reasonable alternatives for expression Applying untyped:26 completeTypeError.cfa:58:1 error: No reasonable alternatives for expression Applying untyped: 27 27 Name: baz 28 28 ...to: 29 29 Name: y 30 30 31 completeTypeError.c :59:1 error: No reasonable alternatives for expression Applying untyped:31 completeTypeError.cfa:59:1 error: No reasonable alternatives for expression Applying untyped: 32 32 Name: quux 33 33 ...to: 34 34 Name: y 35 35 36 completeTypeError.c :60:1 error: No reasonable alternatives for expression Applying untyped:36 completeTypeError.cfa:60:1 error: No reasonable alternatives for expression Applying untyped: 37 37 Name: *? 38 38 ...to: 39 39 Name: y 40 40 41 completeTypeError.c :72:1 error: No resolvable alternatives for expression Applying untyped:41 completeTypeError.cfa:72:1 error: No resolvable alternatives for expression Applying untyped: 42 42 Name: baz 43 43 ...to: … … 45 45 46 46 Alternatives with failing assertions are: 47 Cost ( 0, 1, 1, -5, 0, 0 ): Application of47 Cost ( 0, 1, 0, 1, -5, 0 ): Application of 48 48 Variable Expression: baz: forall 49 49 T: sized object type … … 53 53 reference to instance of type T (not function type) 54 54 instance of type T (not function type) 55 ... returning 55 ... returning 56 56 _retval__operator_assign: instance of type T (not function type) 57 ... with attributes: 57 ... with attributes: 58 58 Attribute with name: unused 59 59 … … 62 62 ... with parameters 63 63 reference to instance of type T (not function type) 64 ... returning nothing 64 ... returning nothing 65 65 66 66 ?{}: pointer to function … … 68 68 reference to instance of type T (not function type) 69 69 instance of type T (not function type) 70 ... returning nothing 70 ... returning nothing 71 71 72 72 ^?{}: pointer to function 73 73 ... with parameters 74 74 reference to instance of type T (not function type) 75 ... returning nothing 75 ... returning nothing 76 76 77 77 … … 79 79 ... with parameters 80 80 pointer to instance of type T (not function type) 81 ... returning nothing 81 ... returning nothing 82 82 83 83 ... to arguments … … 87 87 void 88 88 ) 89 Environment: 89 Environment:( _73_0_T ) -> instance of type T (not function type) (no widening) 90 90 91 91 -
tests/.expect/declarationErrors.txt
rff5caaf r95b8aa7 1 declarationErrors.c :16:1 error: duplicate static in declaration of x1: static const volatile short int1 declarationErrors.cfa:16:1 error: duplicate static in declaration of x1: static const volatile short int 2 2 3 declarationErrors.c :17:1 error: conflicting extern & static in declaration of x2: extern const volatile short int3 declarationErrors.cfa:17:1 error: conflicting extern & static in declaration of x2: extern const volatile short int 4 4 5 declarationErrors.c :18:1 error: conflicting extern & auto, conflicting extern & static, conflicting extern & static, duplicate extern in declaration of x3: extern const volatile short int5 declarationErrors.cfa:18:1 error: conflicting extern & auto, conflicting extern & static, conflicting extern & static, duplicate extern in declaration of x3: extern const volatile short int 6 6 7 declarationErrors.c :19:1 error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous07 declarationErrors.cfa:19:1 error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0 8 8 with members 9 9 i: int … … 11 11 12 12 13 declarationErrors.c :20:1 error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous113 declarationErrors.cfa:20:1 error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1 14 14 with members 15 15 i: int … … 17 17 18 18 19 declarationErrors.c :22:1 error: duplicate static in declaration of x6: static const volatile Int19 declarationErrors.cfa:22:1 error: duplicate static in declaration of x6: static const volatile Int 20 20 21 declarationErrors.c :24:1 error: duplicate const in declaration of f01: static inline function21 declarationErrors.cfa:24:1 error: duplicate const in declaration of f01: static inline function 22 22 with no parameters 23 23 returning const volatile int 24 24 25 25 26 declarationErrors.c :25:1 error: duplicate volatile in declaration of f02: static inline function26 declarationErrors.cfa:25:1 error: duplicate volatile in declaration of f02: static inline function 27 27 with no parameters 28 28 returning const volatile int 29 29 30 30 31 declarationErrors.c :26:1 error: duplicate const in declaration of f03: static inline function31 declarationErrors.cfa:26:1 error: duplicate const in declaration of f03: static inline function 32 32 with no parameters 33 33 returning const volatile int 34 34 35 35 36 declarationErrors.c :27:1 error: duplicate volatile in declaration of f04: static inline function36 declarationErrors.cfa:27:1 error: duplicate volatile in declaration of f04: static inline function 37 37 with no parameters 38 38 returning const volatile int 39 39 40 40 41 declarationErrors.c :28:1 error: duplicate const in declaration of f05: static inline function41 declarationErrors.cfa:28:1 error: duplicate const in declaration of f05: static inline function 42 42 with no parameters 43 43 returning const volatile int 44 44 45 45 46 declarationErrors.c :29:1 error: duplicate volatile in declaration of f06: static inline function46 declarationErrors.cfa:29:1 error: duplicate volatile in declaration of f06: static inline function 47 47 with no parameters 48 48 returning const volatile int 49 49 50 50 51 declarationErrors.c :30:1 error: duplicate const in declaration of f07: static inline function51 declarationErrors.cfa:30:1 error: duplicate const in declaration of f07: static inline function 52 52 with no parameters 53 53 returning const volatile int 54 54 55 55 56 declarationErrors.c :31:1 error: duplicate const, duplicate volatile in declaration of f08: static inline function56 declarationErrors.cfa:31:1 error: duplicate const, duplicate volatile in declaration of f08: static inline function 57 57 with no parameters 58 58 returning const volatile int 59 59 60 60 61 declarationErrors.c :33:1 error: duplicate const, duplicate volatile in declaration of f09: static inline function61 declarationErrors.cfa:33:1 error: duplicate const, duplicate volatile in declaration of f09: static inline function 62 62 with no parameters 63 63 returning const volatile int 64 64 65 65 66 declarationErrors.c :34:1 error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function66 declarationErrors.cfa:34:1 error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function 67 67 with no parameters 68 68 returning const restrict volatile _Atomic int -
tests/.expect/loopctrl.txt
rff5caaf r95b8aa7 3 3 empty 4 4 5 zero 5 6 A 6 A A7 7 A A A A A A A A A A 8 8 B B B B B … … 10 10 D D D D D 11 11 E E E E E 12 0 1 2 3 4 5 6 7 8 9 12 13 13 0 1 2 3 4 5 6 7 8 9 14 14 1 3 5 7 9 … … 18 18 2 4 6 8 10 19 19 10 8 6 4 2 20 21 22 N N N N N N N N N N 23 0 1 2 3 4 5 6 7 8 9 24 10 9 8 7 6 5 4 3 2 1 25 26 20 27 3 6 9 28 29 21 30 (0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9) 22 31 (0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9) 32 23 33 (0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9) 24 34 (0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9) 35 (0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)(10 10) 36 (0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)(10 10) 37 38 (10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1) 39 (10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1) 40 (10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)(0 0) 41 (10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)(0 0) -
tests/.expect/nested-types-ERR1.txt
rff5caaf r95b8aa7 1 nested-types.c :70:1 error: Use of undefined type T1 nested-types.cfa:70:1 error: Use of undefined type T -
tests/.expect/nested-types-ERR2.txt
rff5caaf r95b8aa7 1 nested-types.c :73:1 error: Use of undefined global type Z2 nested-types.c :74:1 error: Qualified type requires an aggregate on the left, but has: signed int3 nested-types.c :75:1 error: Undefined type in qualified type: Qualified Type:4 instance of struct S with body 1 1 nested-types.cfa:73:1 error: Use of undefined global type Z 2 nested-types.cfa:74:1 error: Qualified type requires an aggregate on the left, but has: signed int 3 nested-types.cfa:75:1 error: Undefined type in qualified type: Qualified Type: 4 instance of struct S with body 1 5 5 instance of type Z (not function type) 6 6 -
tests/.expect/scopeErrors.txt
rff5caaf r95b8aa7 1 scopeErrors.c :2:1 error: duplicate object definition for thisIsAnError: signed int2 scopeErrors.c :20:1 error: duplicate function definition for butThisIsAnError: function1 scopeErrors.cfa:2:1 error: duplicate object definition for thisIsAnError: signed int 2 scopeErrors.cfa:20:1 error: duplicate function definition for butThisIsAnError: function 3 3 ... with parameters 4 4 double 5 ... returning 5 ... returning 6 6 _retval_butThisIsAnError: double 7 ... with attributes: 7 ... with attributes: 8 8 Attribute with name: unused 9 9 10 ... with body 10 ... with body 11 11 CompoundStmt 12 12 -
tests/.expect/typedefRedef-ERR1.txt
rff5caaf r95b8aa7 1 typedefRedef.c :4:1 error: Cannot redefine typedef: Foo2 typedefRedef.c :60:1 error: Cannot redefine typedef: ARR1 typedefRedef.cfa:4:1 error: Cannot redefine typedef: Foo 2 typedefRedef.cfa:60:1 error: Cannot redefine typedef: ARR -
tests/KRfunctions.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // KRfunctions.c --7 // KRfunctions.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Feb 16 15:23:17 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 20 07:34:17 201713 // Update Count : 712 // Last Modified On : Tue Nov 6 17:50:34 2018 13 // Update Count : 9 14 14 // 15 15 … … 49 49 // Local Variables: // 50 50 // tab-width: 4 // 51 // compile-command: "cfa KRfunctions.c " //51 // compile-command: "cfa KRfunctions.cfa" // 52 52 // End: // -
tests/Makefile.am
rff5caaf r95b8aa7 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Wed Jun 6 16:42:20201814 ## Update Count : 4913 ## Last Modified On : Tue Nov 20 11:18:51 2018 14 ## Update Count : 68 15 15 ############################################################################### 16 16 17 17 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 18 ACLOCAL_AMFLAGS = -I automake 19 20 include $(top_srcdir)/src/cfa.make 18 21 19 22 debug=yes … … 36 39 37 40 AM_CFLAGS += ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS} 38 39 41 CC = @CFACC@ 40 42 … … 42 44 43 45 .PHONY: list .validate 44 .INTERMEDIATE: .validate .validate.c 45 EXTRA_PROGRAMS = fstream_test avl_test# build but do not install46 .INTERMEDIATE: .validate .validate.cfa 47 EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install 46 48 47 fstream_test_SOURCES = fstream_test.c 48 49 avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c49 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa 50 # automake doesn't know we still need C rules so pretend like we have a C program 51 _dummy_hack_SOURCES = .dummy_hack.c 50 52 51 53 #---------------------------------------------------------------------------------------------------------------- … … 62 64 @+${TEST_PY} --list ${concurrent} 63 65 64 .validate: .validate.c 65 $(C OMPILE) .validate.c-fsyntax-only -Wall -Wextra -Werror66 .validate: .validate.cfa 67 $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror 66 68 67 .validate.c: 69 .validate.cfa: 70 @echo "int main() { return 0; }" > ${@} 71 72 # automake doesn't know we still need C rules so pretend like we have a C program 73 .dummy_hack.c: 68 74 @echo "int main() { return 0; }" > ${@} 69 75 … … 72 78 73 79 #---------------------------------------------------------------------------------------------------------------- 80 74 81 # implicit rule so not all test require a rule 75 % : %.c $(CC)76 $(PRETTY_PATH) $(C OMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})82 % : %.cfa $(CFACC) 83 $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 77 84 78 declarationSpecifier: declarationSpecifier.c $(CC)79 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})85 declarationSpecifier: declarationSpecifier.cfa $(CFACC) 86 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 80 87 81 gccExtensions : gccExtensions.c $(CC)82 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})88 gccExtensions : gccExtensions.cfa $(CFACC) 89 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 83 90 84 extension : extension.c $(CC)85 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})91 extension : extension.cfa $(CFACC) 92 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 86 93 87 attributes : attributes.c $(CC)88 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})94 attributes : attributes.cfa $(CFACC) 95 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 89 96 90 functions: functions.c $(CC)91 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})97 functions: functions.cfa $(CFACC) 98 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 92 99 93 KRfunctions : KRfunctions.c $(CC)94 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})100 KRfunctions : KRfunctions.cfa $(CFACC) 101 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 95 102 96 sched-ext-parse : sched-ext-parse.c $(C C)97 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})103 sched-ext-parse : sched-ext-parse.c $(CFACC) 104 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 98 105 99 gmp : gmp.c $(CC)100 $(PRETTY_PATH) $(C OMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})106 gmp : gmp.cfa $(CFACC) 107 $(PRETTY_PATH) $(CFACOMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 101 108 102 109 #builtins 103 builtins/sync: builtins/sync.c $(CC)104 $(PRETTY_PATH) $(C OMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only110 builtins/sync: builtins/sync.cfa $(CFACC) 111 $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only 105 112 106 113 #------------------------------------------------------------------------------ 114 107 115 #To make errors path independent we need to cd into the correct directories 108 completeTypeError : completeTypeError.c $(CC)109 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})116 completeTypeError : completeTypeError.cfa $(CFACC) 117 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 110 118 111 typedefRedef-ERR1: typedefRedef.c $(CC)112 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})119 typedefRedef-ERR1: typedefRedef.cfa $(CFACC) 120 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 113 121 114 alloc-ERROR: alloc.c $(CC)115 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})122 alloc-ERROR: alloc.cfa $(CFACC) 123 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 116 124 117 fallthrough-ERROR: fallthrough.c $(CC)118 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})125 fallthrough-ERROR: fallthrough.cfa $(CFACC) 126 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 119 127 120 nested-types-ERR1: nested-types.c $(CC)121 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})128 nested-types-ERR1: nested-types.cfa $(CFACC) 129 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 122 130 123 nested-types-ERR2: nested-types.c $(CC)124 $(PRETTY_PATH) $(C OMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})131 nested-types-ERR2: nested-types.cfa $(CFACC) 132 $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 125 133 126 134 # Constructor/destructor tests 127 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c $(CC)128 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})135 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC) 136 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 129 137 130 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.c $(CC)131 $(PRETTY_PATH) $(C OMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})138 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC) 139 $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 132 140 133 raii/memberCtors-ERR1: raii/memberCtors.c $(CC)134 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})141 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC) 142 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 135 143 136 raii/ctor-autogen-ERR1: raii/ctor-autogen.c $(CC)137 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})144 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC) 145 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 138 146 139 147 # Warnings 140 warnings/self-assignment: warnings/self-assignment.c $(CC)141 $(PRETTY_PATH) $(C OMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only148 warnings/self-assignment: warnings/self-assignment.cfa $(CFACC) 149 $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only -
tests/Makefile.in
rff5caaf r95b8aa7 91 91 build_triplet = @build@ 92 92 host_triplet = @host@ 93 EXTRA_PROGRAMS = fstream_test$(EXEEXT) avl_test$(EXEEXT)93 EXTRA_PROGRAMS = avl_test$(EXEEXT) .dummy_hack$(EXEEXT) 94 94 subdir = tests 95 95 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 96 am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \ 97 $(top_srcdir)/configure.ac 96 am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \ 97 $(top_srcdir)/automake/ltoptions.m4 \ 98 $(top_srcdir)/automake/ltsugar.m4 \ 99 $(top_srcdir)/automake/ltversion.m4 \ 100 $(top_srcdir)/automake/lt~obsolete.m4 \ 101 $(top_srcdir)/automake/cfa.m4 $(top_srcdir)/configure.ac 98 102 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 99 103 $(ACLOCAL_M4) … … 103 107 CONFIG_CLEAN_FILES = config.py 104 108 CONFIG_CLEAN_VPATH_FILES = test.py 109 am__dummy_hack_OBJECTS = .dummy_hack.$(OBJEXT) 110 _dummy_hack_OBJECTS = $(am__dummy_hack_OBJECTS) 111 _dummy_hack_LDADD = $(LDADD) 112 AM_V_lt = $(am__v_lt_@AM_V@) 113 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) 114 am__v_lt_0 = --silent 115 am__v_lt_1 = 105 116 am__dirstamp = $(am__leading_dot)dirstamp 106 117 am_avl_test_OBJECTS = avltree/avl_test.$(OBJEXT) \ … … 110 121 avl_test_OBJECTS = $(am_avl_test_OBJECTS) 111 122 avl_test_LDADD = $(LDADD) 112 am_fstream_test_OBJECTS = fstream_test.$(OBJEXT)113 fstream_test_OBJECTS = $(am_fstream_test_OBJECTS)114 fstream_test_LDADD = $(LDADD)115 123 AM_V_P = $(am__v_P_@AM_V@) 116 124 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) … … 131 139 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 132 140 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 141 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 142 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ 143 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 144 $(AM_CFLAGS) $(CFLAGS) 133 145 AM_V_CC = $(am__v_CC_@AM_V@) 134 146 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) … … 136 148 am__v_CC_1 = 137 149 CCLD = $(CC) 138 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 150 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 151 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 152 $(AM_LDFLAGS) $(LDFLAGS) -o $@ 139 153 AM_V_CCLD = $(am__v_CCLD_@AM_V@) 140 154 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) 141 155 am__v_CCLD_0 = @echo " CCLD " $@; 142 156 am__v_CCLD_1 = 143 SOURCES = $( avl_test_SOURCES) $(fstream_test_SOURCES)144 DIST_SOURCES = $( avl_test_SOURCES) $(fstream_test_SOURCES)157 SOURCES = $(_dummy_hack_SOURCES) $(avl_test_SOURCES) 158 DIST_SOURCES = $(_dummy_hack_SOURCES) $(avl_test_SOURCES) 145 159 am__can_run_installinfo = \ 146 160 case $$AM_UPDATE_INFO_DIR in \ … … 168 182 CTAGS = ctags 169 183 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.py.in \ 170 $(srcdir)/test.py $(top_srcdir)/automake/depcomp 184 $(srcdir)/test.py $(top_srcdir)/automake/depcomp \ 185 $(top_srcdir)/src/cfa.make 171 186 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 172 187 ACLOCAL = @ACLOCAL@ … … 174 189 AMTAR = @AMTAR@ 175 190 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 191 AR = @AR@ 176 192 AUTOCONF = @AUTOCONF@ 177 193 AUTOHEADER = @AUTOHEADER@ 178 194 AUTOMAKE = @AUTOMAKE@ 179 195 AWK = @AWK@ 180 BACKEND_CC = @BACKEND_CC@181 196 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@ 182 197 CC = @CFACC@ … … 198 213 CPPFLAGS = @CPPFLAGS@ 199 214 CXX = @CXX@ 215 CXXCPP = @CXXCPP@ 200 216 CXXDEPMODE = @CXXDEPMODE@ 201 217 CXXFLAGS = @CXXFLAGS@ … … 203 219 DEFS = @DEFS@ 204 220 DEPDIR = @DEPDIR@ 221 DLLTOOL = @DLLTOOL@ 205 222 DRIVER_DIR = @DRIVER_DIR@ 223 DSYMUTIL = @DSYMUTIL@ 224 DUMPBIN = @DUMPBIN@ 206 225 ECHO_C = @ECHO_C@ 207 226 ECHO_N = @ECHO_N@ … … 209 228 EGREP = @EGREP@ 210 229 EXEEXT = @EXEEXT@ 230 FGREP = @FGREP@ 211 231 GREP = @GREP@ 212 232 HOST_FLAGS = @HOST_FLAGS@ … … 216 236 INSTALL_SCRIPT = @INSTALL_SCRIPT@ 217 237 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 238 LD = @LD@ 218 239 LDFLAGS = @LDFLAGS@ 219 240 LEX = @LEX@ … … 224 245 LIBOBJS = @LIBOBJS@ 225 246 LIBS = @LIBS@ 247 LIBTOOL = @LIBTOOL@ 248 LIPO = @LIPO@ 249 LN_S = @LN_S@ 226 250 LTLIBOBJS = @LTLIBOBJS@ 251 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 227 252 MAKEINFO = @MAKEINFO@ 253 MANIFEST_TOOL = @MANIFEST_TOOL@ 228 254 MKDIR_P = @MKDIR_P@ 255 NM = @NM@ 256 NMEDIT = @NMEDIT@ 257 OBJDUMP = @OBJDUMP@ 229 258 OBJEXT = @OBJEXT@ 259 OTOOL = @OTOOL@ 260 OTOOL64 = @OTOOL64@ 230 261 PACKAGE = @PACKAGE@ 231 262 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ … … 237 268 PATH_SEPARATOR = @PATH_SEPARATOR@ 238 269 RANLIB = @RANLIB@ 270 SED = @SED@ 239 271 SET_MAKE = @SET_MAKE@ 240 272 SHELL = @SHELL@ … … 248 280 abs_top_builddir = @abs_top_builddir@ 249 281 abs_top_srcdir = @abs_top_srcdir@ 282 ac_ct_AR = @ac_ct_AR@ 250 283 ac_ct_CC = @ac_ct_CC@ 251 284 ac_ct_CXX = @ac_ct_CXX@ 285 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 252 286 am__include = @am__include@ 253 287 am__leading_dot = @am__leading_dot@ … … 297 331 top_srcdir = @top_srcdir@ 298 332 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 333 ACLOCAL_AMFLAGS = -I automake 334 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS) 335 LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 336 $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \ 337 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) \ 338 $(AM_CFLAGS) $(CFLAGS) 339 340 AM_V_CFA = $(am__v_CFA_@AM_V@) 341 am__v_CFA_ = $(am__v_CFA_@AM_DEFAULT_V@) 342 am__v_CFA_0 = @echo " CFA " $@; 343 am__v_CFA_1 = 344 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 345 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 346 am__v_JAVAC_0 = @echo " JAVAC " $@; 347 am__v_JAVAC_1 = 348 AM_V_GOC = $(am__v_GOC_@AM_V@) 349 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 350 am__v_GOC_0 = @echo " GOC " $@; 351 am__v_GOC_1 = 352 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) 353 AM_V_UPP = $(am__v_UPP_@AM_V@) 354 am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@) 355 am__v_UPP_0 = @echo " UPP " $@; 356 am__v_UPP_1 = 299 357 debug = yes 300 358 installed = no … … 309 367 ${INSTALL_FLAGS} ${ARCH_FLAGS} 310 368 PRETTY_PATH = cd ${srcdir} && 311 fstream_test_SOURCES = fstream_test.c 312 avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c 369 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa 370 # automake doesn't know we still need C rules so pretend like we have a C program 371 _dummy_hack_SOURCES = .dummy_hack.c 313 372 all: all-am 314 373 315 374 .SUFFIXES: 316 .SUFFIXES: .c . o .obj .validate317 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)375 .SUFFIXES: .c .cfa .dummy_hack .lo .o .obj .validate 376 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/src/cfa.make $(am__configure_deps) 318 377 @for dep in $?; do \ 319 378 case '$(am__configure_deps)' in \ … … 335 394 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 336 395 esac; 396 $(top_srcdir)/src/cfa.make $(am__empty): 337 397 338 398 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) … … 346 406 config.py: $(top_builddir)/config.status $(srcdir)/config.py.in 347 407 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 408 409 .dummy_hack$(EXEEXT): $(_dummy_hack_OBJECTS) $(_dummy_hack_DEPENDENCIES) $(EXTRA__dummy_hack_DEPENDENCIES) 410 @rm -f .dummy_hack$(EXEEXT) 411 $(AM_V_CCLD)$(LINK) $(_dummy_hack_OBJECTS) $(_dummy_hack_LDADD) $(LIBS) 348 412 avltree/$(am__dirstamp): 349 413 @$(MKDIR_P) avltree … … 371 435 $(AM_V_CCLD)$(LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS) 372 436 373 fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES)374 @rm -f fstream_test$(EXEEXT)375 $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)376 377 437 mostlyclean-compile: 378 438 -rm -f *.$(OBJEXT) … … 382 442 -rm -f *.tab.c 383 443 384 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@ 385 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl-private.Po@am__quote@ 386 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl0.Po@am__quote@ 387 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl1.Po@am__quote@ 388 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl2.Po@am__quote@ 389 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl3.Po@am__quote@ 390 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl4.Po@am__quote@ 391 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test.Po@am__quote@ 444 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/.dummy_hack.Po@am__quote@ 392 445 393 446 .c.o: … … 406 459 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 407 460 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 461 462 .c.lo: 463 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 464 @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 465 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo 466 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 467 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 468 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< 469 470 mostlyclean-libtool: 471 -rm -f *.lo 472 473 clean-libtool: 474 -rm -rf .libs _libs 408 475 409 476 ID: $(am__tagged_files) … … 527 594 clean: clean-am 528 595 529 clean-am: clean-generic clean-l ocal mostlyclean-am596 clean-am: clean-generic clean-libtool clean-local mostlyclean-am 530 597 531 598 distclean: distclean-am 532 -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)599 -rm -rf ./$(DEPDIR) 533 600 -rm -f Makefile 534 601 distclean-am: clean-am distclean-compile distclean-generic \ … … 576 643 577 644 maintainer-clean: maintainer-clean-am 578 -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)645 -rm -rf ./$(DEPDIR) 579 646 -rm -f Makefile 580 647 maintainer-clean-am: distclean-am maintainer-clean-generic … … 582 649 mostlyclean: mostlyclean-am 583 650 584 mostlyclean-am: mostlyclean-compile mostlyclean-generic 651 mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 652 mostlyclean-libtool 585 653 586 654 pdf: pdf-am … … 597 665 598 666 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ 599 clean-generic clean-local cscopelist-am ctags ctags-am \ 600 distclean distclean-compile distclean-generic distclean-tags \ 601 distdir dvi dvi-am html html-am info info-am install \ 602 install-am install-data install-data-am install-dvi \ 603 install-dvi-am install-exec install-exec-am install-html \ 604 install-html-am install-info install-info-am install-man \ 605 install-pdf install-pdf-am install-ps install-ps-am \ 606 install-strip installcheck installcheck-am installdirs \ 607 maintainer-clean maintainer-clean-generic mostlyclean \ 608 mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ 667 clean-generic clean-libtool clean-local cscopelist-am ctags \ 668 ctags-am distclean distclean-compile distclean-generic \ 669 distclean-libtool distclean-tags distdir dvi dvi-am html \ 670 html-am info info-am install install-am install-data \ 671 install-data-am install-dvi install-dvi-am install-exec \ 672 install-exec-am install-html install-html-am install-info \ 673 install-info-am install-man install-pdf install-pdf-am \ 674 install-ps install-ps-am install-strip installcheck \ 675 installcheck-am installdirs maintainer-clean \ 676 maintainer-clean-generic mostlyclean mostlyclean-compile \ 677 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 609 678 tags tags-am uninstall uninstall-am 610 679 … … 612 681 613 682 683 .cfa.o: 684 $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ 685 $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 686 $(am__mv) $$depbase.Tpo $$depbase.Po 687 688 .cfa.lo: 689 $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 690 $(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 691 $(am__mv) $$depbase.Tpo $$depbase.Plo 692 614 693 .PHONY: list .validate 615 .INTERMEDIATE: .validate .validate.c 694 .INTERMEDIATE: .validate .validate.cfa 616 695 617 696 #---------------------------------------------------------------------------------------------------------------- … … 628 707 @+${TEST_PY} --list ${concurrent} 629 708 630 .validate: .validate.c 631 $(COMPILE) .validate.c -fsyntax-only -Wall -Wextra -Werror 632 633 .validate.c: 709 .validate: .validate.cfa 710 $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror 711 712 .validate.cfa: 713 @echo "int main() { return 0; }" > ${@} 714 715 # automake doesn't know we still need C rules so pretend like we have a C program 716 .dummy_hack.c: 634 717 @echo "int main() { return 0; }" > ${@} 635 718 … … 638 721 639 722 #---------------------------------------------------------------------------------------------------------------- 723 640 724 # implicit rule so not all test require a rule 641 % : %.c $(CC)642 $(PRETTY_PATH) $(C OMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})643 644 declarationSpecifier: declarationSpecifier.c $(CC)645 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})646 647 gccExtensions : gccExtensions.c $(CC)648 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})649 650 extension : extension.c $(CC)651 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})652 653 attributes : attributes.c $(CC)654 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})655 656 functions: functions.c $(CC)657 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})658 659 KRfunctions : KRfunctions.c $(CC)660 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})661 662 sched-ext-parse : sched-ext-parse.c $(C C)663 $(PRETTY_PATH) $(C OMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})664 665 gmp : gmp.c $(CC)666 $(PRETTY_PATH) $(C OMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})725 % : %.cfa $(CFACC) 726 $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 727 728 declarationSpecifier: declarationSpecifier.cfa $(CFACC) 729 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 730 731 gccExtensions : gccExtensions.cfa $(CFACC) 732 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 733 734 extension : extension.cfa $(CFACC) 735 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 736 737 attributes : attributes.cfa $(CFACC) 738 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 739 740 functions: functions.cfa $(CFACC) 741 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 742 743 KRfunctions : KRfunctions.cfa $(CFACC) 744 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 745 746 sched-ext-parse : sched-ext-parse.c $(CFACC) 747 $(PRETTY_PATH) $(CFACOMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 748 749 gmp : gmp.cfa $(CFACC) 750 $(PRETTY_PATH) $(CFACOMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 667 751 668 752 #builtins 669 builtins/sync: builtins/sync.c $(CC)670 $(PRETTY_PATH) $(C OMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only753 builtins/sync: builtins/sync.cfa $(CFACC) 754 $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only 671 755 672 756 #------------------------------------------------------------------------------ 757 673 758 #To make errors path independent we need to cd into the correct directories 674 completeTypeError : completeTypeError.c $(CC)675 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})676 677 typedefRedef-ERR1: typedefRedef.c $(CC)678 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})679 680 alloc-ERROR: alloc.c $(CC)681 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})682 683 fallthrough-ERROR: fallthrough.c $(CC)684 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})685 686 nested-types-ERR1: nested-types.c $(CC)687 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})688 689 nested-types-ERR2: nested-types.c $(CC)690 $(PRETTY_PATH) $(C OMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})759 completeTypeError : completeTypeError.cfa $(CFACC) 760 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 761 762 typedefRedef-ERR1: typedefRedef.cfa $(CFACC) 763 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 764 765 alloc-ERROR: alloc.cfa $(CFACC) 766 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 767 768 fallthrough-ERROR: fallthrough.cfa $(CFACC) 769 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 770 771 nested-types-ERR1: nested-types.cfa $(CFACC) 772 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 773 774 nested-types-ERR2: nested-types.cfa $(CFACC) 775 $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 691 776 692 777 # Constructor/destructor tests 693 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c $(CC)694 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})695 696 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.c $(CC)697 $(PRETTY_PATH) $(C OMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})698 699 raii/memberCtors-ERR1: raii/memberCtors.c $(CC)700 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})701 702 raii/ctor-autogen-ERR1: raii/ctor-autogen.c $(CC)703 $(PRETTY_PATH) $(C OMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})778 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC) 779 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 780 781 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC) 782 $(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 783 784 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC) 785 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 786 787 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC) 788 $(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 704 789 705 790 # Warnings 706 warnings/self-assignment: warnings/self-assignment.c $(CC)707 $(PRETTY_PATH) $(C OMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only791 warnings/self-assignment: warnings/self-assignment.cfa $(CFACC) 792 $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only 708 793 709 794 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
tests/abs.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // abs.c --7 // abs.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Jan 28 18:26:16 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 22 22:31:03 201713 // Update Count : 5 212 // Last Modified On : Tue Dec 4 21:33:15 2018 13 // Update Count : 55 14 14 // 15 15 … … 19 19 int main( void ) { 20 20 signed char ch = -65; 21 sout | "char\t\t\t" | ch | "\tabs " | abs( ch ) | endl;22 sout | "signed int\t\t" | -65 | "\tabs" | abs( -65 ) | endl;23 sout | "signed long int\t\t" | -65l | "\tabs" | abs( -65l ) | endl;24 sout | "signed long long int\t" | -65ll | "\tabs" | abs( -65ll ) | endl;25 sout | "float\t\t\t" | -65.0f | "\tabs" | abs( -65.0f ) | endl;26 sout | "double\t\t\t" | -65.0 | "\tabs" | abs( -65.0 ) | endl;27 sout | "long double\t\t" | -65.0l | "\tabs" | abs( -65.0l ) | endl;28 sout | "float _Complex\t\t" | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF ) | endl;29 sout | "double _Complex\t\t" | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD ) | endl;30 sout | "long double _Complex\t" | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL ) | endl;21 sout | "char\t\t\t" | ch | "\tabs " | abs( ch ); 22 sout | "signed int\t\t" | -65 | "\tabs" | abs( -65 ); 23 sout | "signed long int\t\t" | -65l | "\tabs" | abs( -65l ); 24 sout | "signed long long int\t" | -65ll | "\tabs" | abs( -65ll ); 25 sout | "float\t\t\t" | -65.0f | "\tabs" | abs( -65.0f ); 26 sout | "double\t\t\t" | -65.0 | "\tabs" | abs( -65.0 ); 27 sout | "long double\t\t" | -65.0l | "\tabs" | abs( -65.0l ); 28 sout | "float _Complex\t\t" | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF ); 29 sout | "double _Complex\t\t" | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD ); 30 sout | "long double _Complex\t" | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL ); 31 31 } // main 32 32 33 33 // Local Variables: // 34 34 // tab-width: 4 // 35 // compile-command: "cfa abs.c " //35 // compile-command: "cfa abs.cfa" // 36 36 // End: // -
tests/alloc.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // alloc.c --7 // alloc.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 9 06:21:35201813 // Update Count : 33 712 // Last Modified On : Tue Nov 6 17:50:52 2018 13 // Update Count : 339 14 14 // 15 15 … … 272 272 // Local Variables: // 273 273 // tab-width: 4 // 274 // compile-command: "cfa alloc.c " //274 // compile-command: "cfa alloc.cfa" // 275 275 // End: // -
tests/ato.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ato.c --7 // ato.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Feb 4 08:10:57 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Nov 16 18:31:56 201713 // Update Count : 8912 // Last Modified On : Tue Dec 4 21:33:53 2018 13 // Update Count : 92 14 14 // 15 15 … … 20 20 const char * sptr = "-123"; 21 21 int i = ato( sptr ); 22 sout | i | sptr | endl;22 sout | i | sptr; 23 23 sptr = "123"; 24 24 unsigned int ui = ato( sptr ); 25 sout | ui | sptr | endl;25 sout | ui | sptr; 26 26 27 27 sptr = "-123"; 28 28 long int li = ato( sptr ); 29 sout | li | sptr | endl;29 sout | li | sptr; 30 30 sptr = "123"; 31 31 unsigned long int uli = ato( sptr ); 32 sout | uli | sptr | endl;32 sout | uli | sptr; 33 33 34 34 sptr = "-123"; 35 35 long long int lli = ato( sptr ); 36 sout | lli | sptr | endl;36 sout | lli | sptr; 37 37 sptr = "123"; 38 38 unsigned long long int ulli = ato( sptr ); 39 sout | ulli | sptr | endl;39 sout | ulli | sptr; 40 40 41 41 sptr = "-123.456"; 42 42 float f = ato( sptr ); 43 sout | f | sptr | endl;43 sout | f | sptr; 44 44 sptr = "-123.4567890123456"; 45 45 double d = ato( sptr ); 46 sout | d | sptr | endl;46 sout | d | sptr; 47 47 sptr = "-123.45678901234567890123456789"; 48 48 long double ld = ato( sptr ); 49 sout | ld | sptr | endl;49 sout | ld | sptr; 50 50 51 51 sptr = "-123.456-123.456i"; 52 52 float _Complex fc = ato( sptr ); 53 sout | fc | sptr | endl;53 sout | fc | sptr; 54 54 sptr = "-123.4567890123456+123.4567890123456i"; 55 55 double _Complex dc = ato( sptr ); 56 sout | dc | sptr | endl;56 sout | dc | sptr; 57 57 sptr = "123.45678901234567890123456789-123.45678901234567890123456789i"; 58 58 long double _Complex ldc = ato( sptr ); 59 sout | ldc | sptr | endl;59 sout | ldc | sptr; 60 60 sptr = "123.45678901234-123.4567890i"; 61 61 long double _Complex ldc2 = ato( sptr ); 62 sout | ldc2 | sptr | endl;62 sout | ldc2 | sptr; 63 63 64 64 65 65 sptr = "-123"; 66 66 i = strto( sptr, 0, 10 ); 67 sout | i | sptr | endl;67 sout | i | sptr; 68 68 sptr = "123"; 69 69 ui = strto( sptr, 0, 10 ); 70 sout | ui | sptr | endl;70 sout | ui | sptr; 71 71 72 72 sptr = "-123"; 73 73 li = strto( sptr, 0, 10 ); 74 sout | li | sptr | endl;74 sout | li | sptr; 75 75 sptr = "123"; 76 76 uli = strto( sptr, 0, 10 ); 77 sout | uli | sptr | endl;77 sout | uli | sptr; 78 78 79 79 sptr = "-123"; 80 80 lli = strto( sptr, 0, 10 ); 81 sout | lli | sptr | endl;81 sout | lli | sptr; 82 82 sptr = "123"; 83 83 ulli = strto( sptr, 0, 10 ); 84 sout | ulli | sptr | endl;84 sout | ulli | sptr; 85 85 86 86 sptr = "-123.456"; 87 87 f = strto( sptr, 0 ); 88 sout | f | sptr | endl;88 sout | f | sptr; 89 89 sptr = "-123.4567890123456"; 90 90 d = strto( sptr, 0 ); 91 sout | d | sptr | endl;91 sout | d | sptr; 92 92 sptr = "-123.45678901234567890123456789"; 93 93 ld = strto( sptr, 0 ); 94 sout | ld | sptr | endl;94 sout | ld | sptr; 95 95 96 96 sptr = "-123.456-123.456i"; 97 97 fc = strto( sptr, 0 ); 98 sout | fc | sptr | endl;98 sout | fc | sptr; 99 99 100 100 char * eptr = 0; 101 101 // sptr = "2fred"; 102 102 // fc = strto( sptr, &eptr ); 103 // sout | fc | sptr | eptr | endl;103 // sout | fc | sptr | eptr; 104 104 105 105 sptr = "2 3"; 106 106 fc = strto( sptr, &eptr ); 107 sout | fc | sptr | eptr | endl;107 sout | fc | sptr | eptr; 108 108 109 109 sptr = "-123.4567890123456+123.4567890123456i"; 110 110 dc = strto( sptr, 0 ); 111 sout | dc | sptr | endl;111 sout | dc | sptr; 112 112 sptr = "123.45678901234567890123456789-123.45678901234567890123456789i"; 113 113 ldc = strto( sptr, 0 ); 114 sout | ldc | sptr | endl;114 sout | ldc | sptr; 115 115 sptr = "123.45678901234-123.4567890i"; 116 116 ldc2 = strto( sptr, 0 ); 117 sout | ldc2 | sptr | endl;117 sout | ldc2 | sptr; 118 118 } // main 119 119 120 120 // Local Variables: // 121 121 // tab-width: 4 // 122 // compile-command: "cfa ato.c " //122 // compile-command: "cfa ato.cfa" // 123 123 // End: // -
tests/attributes.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // attributes.c --7 // attributes.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Mon Feb 6 16:07:02 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jul 19 13:50:51201813 // Update Count : 1 512 // Last Modified On : Tue Nov 6 17:51:12 2018 13 // Update Count : 17 14 14 // 15 15 … … 154 154 // Local Variables: // 155 155 // tab-width: 4 // 156 // compile-command: "cfa attributes.c " //156 // compile-command: "cfa attributes.cfa" // 157 157 // End: // -
tests/complex.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // complex.c --7 // complex.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 24 22:07:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 22:08:01 201713 // Update Count : 112 // Last Modified On : Tue Dec 4 21:34:21 2018 13 // Update Count : 4 14 14 // 15 15 … … 25 25 printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) ); 26 26 #ifdef __CFA__ 27 sout | "x:" | x | "y:" | y | "z:" | z | endl;27 sout | "x:" | x | "y:" | y | "z:" | z; 28 28 #endif // __CFA 29 29 x = 2.1 + 1.3i; … … 32 32 printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) ); 33 33 #ifdef __CFA__ 34 sout | "x:" | x | "y:" | y | "z:" | z | endl;34 sout | "x:" | x | "y:" | y | "z:" | z; 35 35 #endif // __CFA 36 36 } … … 38 38 // Local Variables: // 39 39 // tab-width: 4 // 40 // compile-command: "cfa complex.c " //40 // compile-command: "cfa complex.cfa" // 41 41 // End: // -
tests/concurrent/coroutineYield.cfa
rff5caaf r95b8aa7 6 6 7 7 #define __kick_rate 150000ul 8 #include "long_tests.h "8 #include "long_tests.hfa" 9 9 10 10 #ifndef PREEMPTION_RATE … … 27 27 while(true) { 28 28 #if !defined(TEST_FOREVER) 29 sout | "Coroutine 1" | endl;29 sout | "Coroutine 1"; 30 30 #endif 31 31 yield(); 32 32 #if !defined(TEST_FOREVER) 33 sout | "Coroutine 2" | endl;33 sout | "Coroutine 2"; 34 34 #endif 35 35 suspend(); … … 42 42 for(int i = 0; TEST(i < N); i++) { 43 43 #if !defined(TEST_FOREVER) 44 sout | "Thread 1" | endl;44 sout | "Thread 1"; 45 45 #endif 46 46 resume(c); 47 47 #if !defined(TEST_FOREVER) 48 sout | "Thread 2" | endl;48 sout | "Thread 2"; 49 49 #endif 50 50 yield(); -
tests/concurrent/examples/boundedBufferEXT.cfa
rff5caaf r95b8aa7 8 8 // Created On : Wed Apr 18 22:52:12 2018 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : T hu Aug 16 08:17:03201811 // Update Count : 810 // Last Modified On : Tue Dec 11 21:55:02 2018 11 // Update Count : 9 12 12 // 13 13 … … 115 115 sum += sums[i]; 116 116 } // for 117 sout | "total:" | sum | endl;117 sout | "total:" | sum; 118 118 } 119 119 -
tests/concurrent/examples/boundedBufferINT.cfa
rff5caaf r95b8aa7 8 8 // Created On : Mon Oct 30 12:45:13 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : T hu Aug 16 08:17:58201811 // Update Count : 8 310 // Last Modified On : Tue Dec 11 21:55:45 2018 11 // Update Count : 84 12 12 // 13 13 … … 116 116 sum += sums[i]; 117 117 } // for 118 sout | "total:" | sum | endl;118 sout | "total:" | sum; 119 119 } 120 120 -
tests/concurrent/examples/datingService.cfa
rff5caaf r95b8aa7 8 8 // Created On : Mon Oct 30 12:56:20 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Sun May 27 09:05:18201811 // Update Count : 2 610 // Last Modified On : Tue Dec 11 21:55:34 2018 11 // Update Count : 28 12 12 // 13 13 … … 58 58 yield( random( 100 ) ); // don't all start at the same time 59 59 unsigned int partner = girl( TheExchange, id, ccode ); 60 sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode | endl;60 sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode; 61 61 girlck[id] = partner; 62 62 } // Girl main … … 69 69 70 70 thread Boy { 71 DatingService & TheExchange;71 DatingService & TheExchange; 72 72 unsigned int id, ccode; 73 73 }; // Boy … … 76 76 yield( random( 100 ) ); // don't all start at the same time 77 77 unsigned int partner = boy( TheExchange, id, ccode ); 78 sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode | endl;78 sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode; 79 79 boyck[id] = partner; 80 80 } // Boy main -
tests/concurrent/examples/matrixSum.cfa
rff5caaf r95b8aa7 6 6 // file "LICENCE" distributed with Cforall. 7 7 // 8 // matrixSum.c --8 // matrixSum.cfa -- 9 9 // 10 10 // Author : Peter A. Buhr 11 11 // Created On : Mon Oct 9 08:29:28 2017 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : T hu Aug 9 09:17:30201814 // Update Count : 1 313 // Last Modified On : Tue Dec 11 21:54:55 2018 14 // Update Count : 15 15 15 // 16 16 … … 54 54 total += subtotals[r]; // total subtotals 55 55 } // for 56 sout | total | endl;56 sout | total; 57 57 } 58 58 59 59 // Local Variables: // 60 60 // tab-width: 4 // 61 // compile-command: "cfa matrixSum.c " //61 // compile-command: "cfa matrixSum.cfa" // 62 62 // End: // -
tests/concurrent/examples/quickSort.cfa
rff5caaf r95b8aa7 9 9 // Created On : Wed Dec 6 12:15:52 2017 10 10 // Last Modified By : Peter A. Buhr 11 // Last Modified On : Thu Aug 16 08:17:41201812 // Update Count : 16 311 // Last Modified On : Sat Dec 22 08:44:27 2018 12 // Update Count : 168 13 13 // 14 14 … … 88 88 89 89 void usage( char * argv[] ) { 90 sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )" | endl;90 sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )"; 91 91 exit( EXIT_FAILURE ); // TERMINATE! 92 92 } // usage … … 114 114 &sortedfile = new( (const char *)argv[2] ); // open the output file 115 115 if ( fail( sortedfile ) ) { 116 serr | "Error! Could not open sorted output file \"" | argv[2] | "\"" | endl;116 serr | "Error! Could not open sorted output file \"" | argv[2] | "\""; 117 117 usage( argv ); 118 118 } // if … … 121 121 &unsortedfile = new( (const char *)argv[1] ); // open the input file 122 122 if ( fail( unsortedfile ) ) { 123 serr | "Error! Could not open unsorted input file \"" | argv[1] | "\"" | endl;123 serr | "Error! Could not open unsorted input file \"" | argv[1] | "\""; 124 124 usage( argv ); 125 125 } // if … … 127 127 } // if 128 128 } // if 129 sortedfile | nlOff; // turn off auto newline 129 130 130 131 enum { ValuesPerLine = 22 }; // number of values printed per line … … 137 138 for ( int counter = 0; counter < size; counter += 1 ) { // read unsorted numbers 138 139 unsortedfile | values[counter]; 139 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | endl | " ";140 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; 140 141 sortedfile | values[counter]; 141 142 if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' '; 142 143 } // for 143 sortedfile | endl;144 sortedfile | nl; 144 145 if ( size > 0 ) { // values to sort ? 145 146 Quicksort QS = { values, size - 1, 0 }; // sort values 146 147 } // wait until sort tasks terminate 147 148 for ( int counter = 0; counter < size; counter += 1 ) { // print sorted list 148 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | endl | " ";149 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; 149 150 sortedfile | values[counter]; 150 151 if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' '; 151 152 } // for 152 sortedfile | endl | endl;153 sortedfile | nl | nl; 153 154 154 155 delete( values ); -
tests/concurrent/monitor.cfa
rff5caaf r95b8aa7 40 40 MyThread f[4]; 41 41 } 42 sout | global.value | endl;42 sout | global.value; 43 43 } -
tests/concurrent/multi-monitor.cfa
rff5caaf r95b8aa7 52 52 } 53 53 } 54 sout | global12 | global23 | global13 | endl;54 sout | global12 | global23 | global13; 55 55 } -
tests/concurrent/preempt.cfa
rff5caaf r95b8aa7 3 3 #include <time.hfa> 4 4 5 #include "long_tests.h "5 #include "long_tests.hfa" 6 6 7 7 #ifndef PREEMPTION_RATE -
tests/concurrent/signal/block.cfa
rff5caaf r95b8aa7 14 14 #include <time.hfa> 15 15 16 #include "long_tests.h "16 #include "long_tests.hfa" 17 17 18 18 #ifndef PREEMPTION_RATE … … 57 57 58 58 if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) { 59 sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread | endl;59 sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread; 60 60 abort(); 61 61 } … … 85 85 86 86 if( ! signal_block( cond ) ) { 87 sout | "ERROR expected to be able to signal" | endl;87 sout | "ERROR expected to be able to signal"; 88 88 abort(); 89 89 } … … 92 92 93 93 if(a.last_thread != next || b.last_thread != next) { 94 sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread | endl;94 sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread; 95 95 abort(); 96 96 } … … 130 130 Signaller s[4]; 131 131 Barger b[13]; 132 sout | "Starting waiters" | endl;132 sout | "Starting waiters"; 133 133 { 134 134 Waiter w[3]; 135 135 } 136 sout | "Waiters done" | endl;136 sout | "Waiters done"; 137 137 done = true; 138 138 } -
tests/concurrent/signal/disjoint.cfa
rff5caaf r95b8aa7 5 5 #include <time.hfa> 6 6 7 #include "long_tests.h "7 #include "long_tests.hfa" 8 8 9 9 #ifndef PREEMPTION_RATE … … 66 66 wait( cond ); 67 67 if( d.state != SIGNAL ) { 68 sout | "ERROR barging!" | endl;68 sout | "ERROR barging!"; 69 69 } 70 70 71 71 #if !defined(TEST_FOREVER) 72 72 d.counter++; 73 if( (d.counter % 1000) == 0 ) sout | d.counter | endl;73 if( (d.counter % 1000) == 0 ) sout | d.counter; 74 74 #endif 75 75 … … 99 99 bool running = TEST(data.counter < N) && data.counter > 0; 100 100 if( data.state != SIGNAL && running ) { 101 sout | "ERROR Eager signal" | data.state | endl;101 sout | "ERROR Eager signal" | data.state; 102 102 } 103 103 } … … 124 124 Waiter w[4]; 125 125 } 126 sout | "All waiter done" | endl;126 sout | "All waiter done"; 127 127 all_done = true; 128 128 } -
tests/concurrent/signal/wait.cfa
rff5caaf r95b8aa7 13 13 14 14 #define __kick_rate 12000ul 15 #include "long_tests.h "15 #include "long_tests.hfa" 16 16 17 17 #ifndef PREEMPTION_RATE … … 83 83 break; 84 84 default: 85 sout | "Something went wrong" | endl;85 sout | "Something went wrong"; 86 86 abort(); 87 87 } … … 140 140 waiter_left = 4; 141 141 processor p[2]; 142 sout | "Starting" | endl;142 sout | "Starting"; 143 143 { 144 144 Signaler e; … … 150 150 } 151 151 } 152 sout | "Done" | endl;152 sout | "Done"; 153 153 } -
tests/concurrent/thread.cfa
rff5caaf r95b8aa7 12 12 void main(First& this) { 13 13 for(int i = 0; i < 10; i++) { 14 sout | "First : Suspend No." | i + 1 | endl;14 sout | "First : Suspend No." | i + 1; 15 15 yield(); 16 16 } … … 21 21 P(*this.lock); 22 22 for(int i = 0; i < 10; i++) { 23 sout | "Second : Suspend No." | i + 1 | endl;23 sout | "Second : Suspend No." | i + 1; 24 24 yield(); 25 25 } … … 29 29 int main(int argc, char* argv[]) { 30 30 semaphore lock = { 0 }; 31 sout | "User main begin" | endl;31 sout | "User main begin"; 32 32 { 33 33 processor p; … … 37 37 } 38 38 } 39 sout | "User main end" | endl;39 sout | "User main end"; 40 40 } -
tests/concurrent/waitfor/barge.cfa
rff5caaf r95b8aa7 48 48 yield(random( 10 )); 49 49 if( this.state != WAITFOR && !this.done && this.started ) { 50 serr | "Barging before caller detected" | endl;50 serr | "Barging before caller detected"; 51 51 } 52 52 … … 66 66 this.state = WAITFOR; 67 67 waitfor(do_call, this) { 68 sout | i | endl;68 sout | i; 69 69 } 70 70 71 71 if( this.state != CALL ) { 72 serr | "Barging after caller detected" | endl;72 serr | "Barging after caller detected"; 73 73 } 74 74 } … … 83 83 84 84 int main() { 85 sout | "Starting" | endl;85 sout | "Starting"; 86 86 { 87 87 barger_t bargers[17]; … … 89 89 waiter_t waiters; 90 90 } 91 sout | "Stopping" | endl;91 sout | "Stopping"; 92 92 } -
tests/concurrent/waitfor/dtor.cfa
rff5caaf r95b8aa7 29 29 switch(state) { 30 30 case CTOR : break; 31 case MAIN : if( this.state != CTOR ) { serr | "ERROR Expected state to be CTOR" | endl; abort(); } this.state = state; break;32 case AFTER : if( this.state != MAIN ) { serr | "ERROR Expected state to be MAIN" | endl; abort(); } this.state = state; break;33 case END : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER" | endl; abort(); } this.state = state; break;34 case DTOR : if( this.state != END ) { serr | "ERROR Expected state to be END" | endl; abort(); } this.state = state; break;31 case MAIN : if( this.state != CTOR ) { serr | "ERROR Expected state to be CTOR" ; abort(); } this.state = state; break; 32 case AFTER : if( this.state != MAIN ) { serr | "ERROR Expected state to be MAIN" ; abort(); } this.state = state; break; 33 case END : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER"; abort(); } this.state = state; break; 34 case DTOR : if( this.state != END ) { serr | "ERROR Expected state to be END" ; abort(); } this.state = state; break; 35 35 } 36 36 } … … 54 54 55 55 int main() { 56 sout | "Starting" | endl;56 sout | "Starting"; 57 57 processor p; 58 58 for( int i = 0; i < N; i++ ){ … … 60 60 yield( random( 100 ) ); 61 61 } 62 sout | "Stopping" | endl;62 sout | "Stopping"; 63 63 } -
tests/concurrent/waitfor/else.cfa
rff5caaf r95b8aa7 12 12 void test( M & mutex m ) { 13 13 int i = 0; 14 sout | "Starting" | endl;14 sout | "Starting"; 15 15 16 16 when( false ) waitfor( notcalled, m ); 17 17 18 sout | "Step" | i++ | endl;18 sout | "Step" | i++; 19 19 20 20 waitfor( notcalled, m ); or else { 21 sout | "else called" | endl;21 sout | "else called"; 22 22 } 23 23 24 sout | "Step" | i++ | endl;24 sout | "Step" | i++; 25 25 26 26 when( true ) waitfor( notcalled, m ); or when( true ) else { 27 sout | "else called" | endl;27 sout | "else called"; 28 28 } 29 29 30 sout | "Step" | i++ | endl;30 sout | "Step" | i++; 31 31 32 32 when( false ) waitfor( notcalled, m ); or when( true ) else { 33 sout | "else called" | endl;33 sout | "else called"; 34 34 } 35 35 36 sout | "Step" | i++ | endl;36 sout | "Step" | i++; 37 37 38 38 when( false ) waitfor( notcalled, m ); or when( false ) else { 39 sout | "else called" | endl;39 sout | "else called"; 40 40 } 41 41 42 sout | "Done" | endl;42 sout | "Done"; 43 43 } 44 44 -
tests/concurrent/waitfor/recurse.cfa
rff5caaf r95b8aa7 95 95 rand_yield(); 96 96 97 sout | "1st" | endl;97 sout | "1st" | nl; 98 98 99 99 return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP; … … 123 123 case THIRD : while( !global.ready ) { yield(); } this.state = call3( global, this.idx ); break; 124 124 case LAST : while( !global.ready ) { yield(); } this.state = call4( global, this.idx ); break; 125 case STOP : serr | "This should not happen" | endl;125 case STOP : serr | "This should not happen" | nl; 126 126 } 127 127 } … … 132 132 int main() { 133 133 srandom( time(NULL) ); 134 sout | "Starting" | endl; 134 sout | nlOff; // turn off auto newline 135 sout | "Starting" | nl; 135 136 { 136 137 waiter_t waiters[4] = { … … 142 143 the_threads = waiters; 143 144 } 144 sout | "Stopping" | endl;145 sout | "Stopping" | nl; 145 146 } -
tests/concurrent/waitfor/simple.cfa
rff5caaf r95b8aa7 31 31 32 32 void do_wait( global_t * mutex a ) { 33 sout | "Waiting to accept" | endl;33 sout | "Waiting to accept"; 34 34 yield( random( 10 ) ); 35 35 36 sout | "Accepting" | endl;36 sout | "Accepting"; 37 37 38 38 __acceptable_t acceptable; … … 43 43 __waitfor_internal( 1, &acceptable ); 44 44 45 sout | "Accepted" | endl;45 sout | "Accepted"; 46 46 yield( random( 10 ) ); 47 47 } … … 50 50 for( int i = 0; i < N; i++ ) { 51 51 do_wait( &globalA ); 52 sout | i | endl;52 sout | i; 53 53 } 54 54 … … 76 76 srandom( time( NULL ) ); 77 77 printf("%p\n", &globalA); 78 sout | "Starting" | endl;78 sout | "Starting"; 79 79 { 80 80 Acceptor r; … … 82 82 83 83 } 84 sout | "Done" | endl;84 sout | "Done"; 85 85 } -
tests/concurrent/waitfor/statment.cfa
rff5caaf r95b8aa7 84 84 case 7: return call7( m ); 85 85 default : 86 serr | "Incorrect index" | index | endl;86 serr | "Incorrect index" | index; 87 87 abort(); 88 88 } … … 102 102 while( !done ) { 103 103 waitfor( get_index, this ); 104 or waitfor( call1, this ) { sout | "Statement" | endl; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val | endl; } }105 or waitfor( call2, this ) { sout | "Statement" | endl; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val | endl; } }106 or waitfor( call3, this ) { sout | "Statement" | endl; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val | endl; } }107 or waitfor( call4, this ) { sout | "Statement" | endl; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val | endl; } }108 or waitfor( call5, this ) { sout | "Statement" | endl; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val | endl; } }109 or waitfor( call6, this ) { sout | "Statement" | endl; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val | endl; } }110 or waitfor( call7, this ) { sout | "Statement" | endl; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val | endl; } }104 or waitfor( call1, this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } } 105 or waitfor( call2, this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } } 106 or waitfor( call3, this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } } 107 or waitfor( call4, this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } } 108 or waitfor( call5, this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } } 109 or waitfor( call6, this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } } 110 or waitfor( call7, this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } } 111 111 112 112 done = true; … … 128 128 int main() { 129 129 processor p[2]; 130 sout | "Starting" | endl;130 sout | "Starting"; 131 131 { 132 132 caller c[7]; 133 133 waiter w; 134 134 } 135 sout | "Stopping" | endl;135 sout | "Stopping"; 136 136 } -
tests/concurrent/waitfor/when.cfa
rff5caaf r95b8aa7 58 58 void arbiter( global_t & mutex this ) { 59 59 for( int i = 0; i < N; i++ ) { 60 when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call | endl; } }61 or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call | endl; } }62 or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call | endl; } }63 or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call | endl; } }64 or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call | endl; } }65 or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call | endl; } }60 when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } } 61 or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } } 62 or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } } 63 or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } } 64 or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } } 65 or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } } 66 66 67 sout | this.last_call | endl;67 sout | this.last_call; 68 68 } 69 69 … … 78 78 int main() { 79 79 srandom( time(NULL) ); 80 sout | "Starting" | endl;80 sout | "Starting"; 81 81 { 82 82 arbiter_t arbiter; … … 84 84 85 85 } 86 sout | "Stopping" | endl;86 sout | "Stopping"; 87 87 } -
tests/coroutine/.expect/fmtLines.txt
rff5caaf r95b8aa7 16 16 difi ed B y : Pete r A. 17 17 Buh r// Last Mod ifie 18 d On : M on S ep 1 8 1119 :3 5: 57 2 017/ / Up date20 Cou nt : 3 1/ /#in18 d On : T ue D ec 1 1 23 19 :31: 12 2 018/ / Up date 20 Cou nt : 32/ /#in 21 21 clud e <f stre am.h fa># 22 22 incl ude <cor outi ne.h … … 34 34 t ) { if ( fm t.g 35 35 != 0 || fmt. b != 0 ) 36 sou t | endl ;}vo id m 37 ain( For mat & fm t ) 38 { fo r ( ;; ) { 39 // f or a s ma ny c 40 hara cter s f or ( fmt 41 .g = 0; fmt. g < 5; f 42 mt.g += 1 ) { / / gr 43 oups of 5 bl ocks f 44 or ( fmt .b = 0; fmt. 45 b < 4; f mt.b += 1 ) 46 { // blo cks of 4 cha 47 ract ers f or ( ;; 48 ) { // for new 49 line cha ract ers 50 susp end( ); i f ( 51 fmt. ch ! = '\ n' ) bre 52 ak; // igno re n ewli 53 ne } // f or so 54 ut | fmt .ch; / 55 / pr int char acte r 56 } // for s out | " 57 "; / / pr int 58 bloc k se para tor } / 59 / fo r s out | en dl; 60 // p rint gro 61 up s epar ator } / / fo 62 r} / / ma invo id p rt( 63 Form at & fmt , ch ar c 64 h ) { fmt .ch = ch 65 ; res ume( fmt );} 66 // prti nt m ain( ) { 67 Form at f mt; char ch; 68 for ( ; ; ) { s in | 69 ch; // rea 70 d on e ch arac ter if 71 ( e of( sin ) ) brea 72 k; // eof ? p 73 rt( fmt, ch ); } // 74 for} // main // L ocal 75 Var iabl es: //// tab 76 -wid th: 4 // // c ompi 77 le-c omma nd: "cfa fmt 78 Line s.c" /// / En d: / 79 / 36 sou t | nl;} void mai 37 n( F orma t & fmt ) { 38 for ( ;; ) { 39 // for as many cha 40 ract ers for ( f mt.g 41 = 0 ; fm t.g < 5; fmt 42 .g + = 1 ) { // grou 43 ps o f 5 bloc ks for 44 ( f mt.b = 0 ; fm t.b 45 < 4; fmt .b + = 1 ) { 46 // b lock s of 4 c hara 47 cter s for ( ; ; ) 48 { // f or n ewli 49 ne c hara cter s su 50 spen d(); if ( fm 51 t.ch != '\n' ) b reak 52 ; / / ig nore new line 53 } // for sout 54 | f mt.c h; // 55 prin t ch arac ter } 56 // f or sou t | " " 57 ; // prin t bl 58 ock sepa rato r } // 59 for sou t | nl; 60 // p rint gro up s 61 epar ator } / / fo r} / 62 / ma invo id p rt( Form 63 at & fmt , ch ar c h ) 64 { fmt .ch = ch ; 65 res ume( fmt );} // 66 prti nt m ain( ) { Form 67 at f mt; char ch; for 68 ( ; ; ) { s in | ch; 69 // rea d on 70 e ch arac ter if ( e 71 of( sin ) ) brea k; 72 // eof ? p rt( 73 fmt, ch ); } // for} 74 // main // L ocal Var 75 iabl es: //// tab -wid 76 th: 4 // // c ompi le-c 77 omma nd: "cfa fmt Line 78 s.c" /// / En d: / / -
tests/coroutine/.in/fmtLines.txt
rff5caaf r95b8aa7 10 10 // Created On : Sun Sep 17 21:56:15 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 18 11:35:57 201713 // Update Count : 3 112 // Last Modified On : Tue Dec 11 23:31:12 2018 13 // Update Count : 32 14 14 // 15 15 … … 27 27 28 28 void ^?{}( Format & fmt ) { 29 if ( fmt.g != 0 || fmt.b != 0 ) sout | endl;29 if ( fmt.g != 0 || fmt.b != 0 ) sout | nl; 30 30 } 31 31 … … 42 42 sout | " "; // print block separator 43 43 } // for 44 sout | endl; // print group separator44 sout | nl; // print group separator 45 45 } // for 46 46 } // main -
tests/coroutine/fibonacci.cfa
rff5caaf r95b8aa7 10 10 // Created On : Thu Jun 8 07:29:37 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 11:21:58201813 // Update Count : 2 412 // Last Modified On : Tue Dec 11 21:57:33 2018 13 // Update Count : 25 14 14 // 15 15 … … 39 39 Fibonacci f1, f2; 40 40 for ( 10 ) { // print N Fibonacci values 41 sout | next( f1 ) | next( f2 ) | endl;41 sout | next( f1 ) | next( f2 ); 42 42 } // for 43 43 } -
tests/coroutine/fibonacci_1.cfa
rff5caaf r95b8aa7 10 10 // Created On : Thu Apr 26 23:20:08 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 11:21:02201813 // Update Count : 1 312 // Last Modified On : Tue Dec 11 21:57:54 2018 13 // Update Count : 14 14 14 // 15 15 … … 36 36 Fibonacci f1, f2; 37 37 for ( 10 ) { // print N Fibonacci values 38 sout | next( f1 ) | next( f2 ) | endl;38 sout | next( f1 ) | next( f2 ); 39 39 } // for 40 40 } -
tests/coroutine/fmtLines.cfa
rff5caaf r95b8aa7 10 10 // Created On : Sun Sep 17 21:56:15 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 16 08:20:54201813 // Update Count : 4512 // Last Modified On : Sat Dec 22 18:27:00 2018 13 // Update Count : 57 14 14 // 15 15 … … 24 24 void main( Format & fmt ) with( fmt ) { 25 25 for () { // for as many characters 26 for ( g ; 5 ) {// groups of 5 blocks27 for ( b ; 4 ) {// blocks of 4 characters26 for ( g = 0; g < 5; g += 1 ) { // groups of 5 blocks 27 for ( b = 0; b < 4; b += 1 ) { // blocks of 4 characters 28 28 for () { // for newline characters 29 29 suspend(); 30 if ( ch != '\n' ) break;// ignore newline30 if ( ch != '\n' ) break; // ignore newline 31 31 } // for 32 32 sout | ch; // print character … … 34 34 sout | " "; // print block separator 35 35 } // for 36 sout | endl;// print group separator36 sout | nl; // print group separator 37 37 } // for 38 38 } // main … … 43 43 44 44 void ^?{}( Format & fmt ) with( fmt ) { 45 if ( g != 0 || b != 0 ) sout | endl;45 if ( g != 0 || b != 0 ) sout | nl; 46 46 } 47 47 48 48 void format( Format & fmt ) { 49 49 resume( fmt ); 50 } // prt50 } // format 51 51 52 52 int main() { 53 53 Format fmt; 54 sout | nlOff; // turn off auto newline 54 55 55 56 eof: for () { // read until end of file -
tests/coroutine/pingpong.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed Sep 20 11:55:23 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 11:31:11201813 // Update Count : 2 812 // Last Modified On : Tue Dec 11 21:58:06 2018 13 // Update Count : 29 14 14 // 15 15 … … 24 24 25 25 void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) { 26 (this.__cor){name}; 26 27 this.name = name; 27 28 this.N = N; … … 40 41 void main( PingPong & pingpong ) { // ping's starter ::main, pong's starter ping 41 42 for ( pingpong.N ) { // N ping-pongs 42 sout | pingpong.name | endl;43 sout | pingpong.name; 43 44 cycle( *pingpong.part ); 44 45 } // for -
tests/coroutine/prodcons.cfa
rff5caaf r95b8aa7 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 12:55:10201813 // Update Count : 5 112 // Last Modified On : Wed Dec 12 23:04:49 2018 13 // Update Count : 53 14 14 // 15 15 … … 24 24 25 25 coroutine Prod { 26 Cons *c;26 Cons & c; 27 27 int N, money, receipt; 28 28 }; … … 30 30 // 1st resume starts here 31 31 for ( i; N ) { // N pairs of values 32 int p1 = random( 100 ); 33 int p2 = random( 100 ); 34 sout | p1 | " " | p2 | endl; 35 int status = delivery( *c, p1, p2 ); 36 sout | " $" | money | endl; 37 sout | status | endl; 32 int p1 = random( 100 ), p2 = random( 100 ); 33 sout | p1 | " " | p2; 34 int status = delivery( c, p1, p2 ); 35 sout | " $" | money | nl | status; 38 36 receipt += 1; 39 37 } 40 stop( *c );41 sout | "prod stops" | endl;38 stop( c ); 39 sout | "prod stops"; 42 40 } 43 41 int payment( Prod & prod, int money ) { … … 47 45 } 48 46 void start( Prod & prod, int N, Cons &c ) { 49 prod.N = N; 50 prod.c = &c; 51 prod.receipt = 0; 47 &prod.c = &c; 48 prod.[N, receipt] = [N, 0]; 52 49 resume( prod ); // activate main 53 50 } 54 51 55 52 coroutine Cons { 56 Prod *p;53 Prod & p; 57 54 int p1, p2, status; 58 55 bool done; 59 56 }; 60 57 void ?{}( Cons & cons, Prod & p ) { 61 cons.p = &p; 62 cons.status = 0; 63 cons.done = false; 58 &cons.p = &p; 59 cons.[status, done ] = [0, false]; 64 60 } 65 61 void ^?{}( Cons & cons ) {} … … 68 64 int money = 1, receipt; 69 65 for ( ; ! done; ) { 70 sout | p1 | " " | p2 | endl; 71 sout | " $" | money | endl; 66 sout | p1 | " " | p2 | nl | " $" | money; 72 67 status += 1; 73 receipt = payment( *p, money );74 sout | " #" | receipt | endl;68 receipt = payment( p, money ); 69 sout | " #" | receipt; 75 70 money += 1; 76 71 } 77 sout | "cons stops" | endl;72 sout | "cons stops"; 78 73 } 79 74 int delivery( Cons & cons, int p1, int p2 ) { 80 cons.p1 = p1; 81 cons.p2 = p2; 75 cons.[p1, p2] = [p1, p2]; 82 76 resume( cons ); // main 1st time, then 83 77 return cons.status; // cons in payment … … 92 86 srandom( /* getpid() */ 103 ); // fixed seed for testing 93 87 start( prod, 5, cons ); 94 sout | "main stops" | endl;88 sout | "main stops"; 95 89 } 96 90 -
tests/coroutine/runningTotal.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed Dec 6 08:05:27 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 16 08:22:29201813 // Update Count : 312 // Last Modified On : Tue Dec 11 21:59:00 2018 13 // Update Count : 4 14 14 // 15 15 … … 42 42 RunTotal rntl; 43 43 for ( i; 10 ) { 44 sout | i | add( rntl, i ) | endl;44 sout | i | add( rntl, i ); 45 45 } // for 46 46 } -
tests/counter.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // counter.c --7 // counter.cfa -- 8 8 // 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Feb 22 15:27:00 2018 11 // Last Modified By : Aaron B. Moss12 // Last Modified On : T hu Feb 22 15:27:00201813 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 6 17:50:23 2018 13 // Update Count : 2 14 14 // 15 15 … … 37 37 // Local Variables: // 38 38 // tab-width: 4 // 39 // compile-command: "cfa counter.c " //39 // compile-command: "cfa counter.cfa" // 40 40 // End: // -
tests/declarationErrors.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // declarationErrors.c --7 // declarationErrors.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:23:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 9 22:57:52 201613 // Update Count : 3 112 // Last Modified On : Tue Nov 6 17:52:47 2018 13 // Update Count : 32 14 14 // 15 15 … … 42 42 // Local Variables: // 43 43 // tab-width: 4 // 44 // compile-command: "cfa declarationErrors.c " //44 // compile-command: "cfa declarationErrors.cfa" // 45 45 // End: // -
tests/declarationSpecifier.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // declarationSpecifier.c --7 // declarationSpecifier.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:21:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:24:33 201613 // Update Count : 212 // Last Modified On : Tue Nov 6 17:52:59 2018 13 // Update Count : 3 14 14 // 15 15 … … 96 96 // Local Variables: // 97 97 // tab-width: 4 // 98 // compile-command: "cfa declarationSpecifier.c " //98 // compile-command: "cfa declarationSpecifier.cfa" // 99 99 // End: // -
tests/div.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // div.c --7 // div.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Aug 8 16:28:43 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Dec 7 09:06:52 201713 // Update Count : 1812 // Last Modified On : Tue Dec 4 21:35:01 2018 13 // Update Count : 20 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <stdlib.hfa> 17 #include <stdlib.hfa> // div 18 18 19 19 struct T { int i; }; … … 23 23 24 24 int main( void ) { 25 sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ) | endl;25 sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ); 26 26 short s1 = 13, s2 = 5; 27 sout | "div" | div( s1, s2 ) | endl;27 sout | "div" | div( s1, s2 ); 28 28 T t1 = { 13 }, t2 = { 5 }; 29 sout | "div" | div( t1, t2 ) | endl;// polymorphic div29 sout | "div" | div( t1, t2 ); // polymorphic div 30 30 } // main 31 31 32 32 // Local Variables: // 33 33 // tab-width: 4 // 34 // compile-command: "cfa div.c " //34 // compile-command: "cfa div.cfa" // 35 35 // End: // -
tests/except-0.cfa
rff5caaf r95b8aa7 8 8 #include <stdbool.h> 9 9 10 #include "except-mac.h "10 #include "except-mac.hfa" 11 11 TRIVIAL_EXCEPTION(yin) 12 12 TRIVIAL_EXCEPTION(yang) … … 25 25 void ^?{}(signal_exit * this) { 26 26 printf("Exiting: %s\n", this->area); 27 // sout | "Exiting:" | this->area | endl;27 // sout | "Exiting:" | this->area; 28 28 } 29 29 -
tests/except-1.cfa
rff5caaf r95b8aa7 5 5 #include <stdio.h> 6 6 7 #include "except-mac.h "7 #include "except-mac.hfa" 8 8 TRIVIAL_EXCEPTION(yin) 9 9 TRIVIAL_EXCEPTION(yang) -
tests/except-2.cfa
rff5caaf r95b8aa7 3 3 4 4 #include <stdlib.hfa> 5 #include "except-mac.h "5 #include "except-mac.hfa" 6 6 7 7 TRIVIAL_EXCEPTION(yin) -
tests/except-3.cfa
rff5caaf r95b8aa7 2 2 3 3 #include <stdio.h> 4 #include "except-mac.h "4 #include "except-mac.hfa" 5 5 TRIVIAL_EXCEPTION(myth) 6 6 -
tests/extension.cfa
rff5caaf r95b8aa7 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 // extension.c --4 // extension.cfa -- 5 5 // 6 6 // Author : Peter A. Buhr 7 7 // Created On : Mon Jul 4 20:42:43 2016 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Mon Feb 6 15:44:39 201710 // Update Count : 4 69 // Last Modified On : Tue Nov 6 17:53:21 2018 10 // Update Count : 47 11 11 // 12 12 … … 56 56 // Local Variables: // 57 57 // tab-width: 4 // 58 // compile-command: "cfa extension.c " //58 // compile-command: "cfa extension.cfa" // 59 59 // End: // -
tests/forall.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // forall.c --7 // forall.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 9 08:48:15 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jul 12 16:19:08201813 // Update Count : 3 012 // Last Modified On : Tue Nov 6 17:53:43 2018 13 // Update Count : 31 14 14 // 15 15 … … 219 219 // Local Variables: // 220 220 // tab-width: 4 // 221 // compile-command: "cfa forall.c " //221 // compile-command: "cfa forall.cfa" // 222 222 // End: // -
tests/fstream_test.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // fstream_test.c --7 // fstream_test.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 24 11:30:26 201713 // Update Count : 6 512 // Last Modified On : Sat Dec 22 09:47:44 2018 13 // Update Count : 68 14 14 // 15 15 … … 18 18 int main( void ) { 19 19 int nombre; 20 sout | "Entrez un nombre, s'il vous plaît:" | endl;20 sout | "Entrez un nombre, s'il vous plaît:"; 21 21 sin | nombre; 22 sout | "Vous avez entré" | nombre | endl;22 sout | "Vous avez entré" | nombre; 23 23 sout | "le nombre" | nombre | "est" 24 | (nombre > 0 ? "positif" : nombre == 0 ? "zéro" : "négatif") | endl;24 | (nombre > 0 ? "positif" : nombre == 0 ? "zéro" : "négatif"); 25 25 26 sout | "Entrez trois nombres, s'il vous plaît: " | endl;26 sout | "Entrez trois nombres, s'il vous plaît:"; 27 27 int i, j, k; 28 28 sin | i | j | k; 29 sout | "Vous avez entré" | "i:" | "" | i | "j:" | "" | j | "k:" | "" | k | endl;29 sout | "Vous avez entré" | "i:" | "" | i | "j:" | "" | j | "k:" | "" | k; 30 30 } 31 31 32 32 // Local Variables: // 33 33 // tab-width: 4 // 34 // compile-command: "cfa fstream_test.c " //34 // compile-command: "cfa fstream_test.cfa" // 35 35 // End: // -
tests/function-operator.cfa
rff5caaf r95b8aa7 10 10 // Created On : Fri Aug 25 15:21:11 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 2 09:27:53201813 // Update Count : 812 // Last Modified On : Tue Dec 4 21:37:09 2018 13 // Update Count : 9 14 14 // 15 15 … … 83 83 // TODO: abstract over (os, T) 84 84 os_wrapper ?=?(os_wrapper & wrapper, int x) { 85 *wrapper.out | x | endl;85 *wrapper.out | x; 86 86 return wrapper; 87 87 } -
tests/functions.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // functions.c --7 // functions.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:39:58 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 17 22:44:12201813 // Update Count : 1 212 // Last Modified On : Tue Nov 6 17:54:09 2018 13 // Update Count : 13 14 14 // 15 15 … … 188 188 // Local Variables: // 189 189 // tab-width: 4 // 190 // compile-command: "cfa functions.c " //190 // compile-command: "cfa functions.cfa" // 191 191 // End: // -
tests/gccExtensions.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // gccExtensions.c --7 // gccExtensions.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sun Aug 14 17:28:17 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 09:26:50 201613 // Update Count : 1 012 // Last Modified On : Tue Nov 6 17:54:20 2018 13 // Update Count : 11 14 14 // 15 15 … … 120 120 // Local Variables: // 121 121 // tab-width: 4 // 122 // compile-command: "cfa gccExtensions.c " //122 // compile-command: "cfa gccExtensions.cfa" // 123 123 // End: // -
tests/gmp.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // gmp.c --7 // gmp.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Apr 19 08:55:51 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 18 12:43:13201813 // Update Count : 55 612 // Last Modified On : Thu Dec 20 22:41:47 2018 13 // Update Count : 559 14 14 // 15 15 … … 19 19 20 20 int main( void ) { 21 sout | "constructors" | endl;21 sout | "constructors"; 22 22 short int si = 3; 23 23 Int x = { "50000000000000000000" }, y = { si }, z = x + y; 24 sout | x | y | z | endl;25 sout | "x:" | x | "y:" | y | "z:" | z | endl;24 sout | x | y | z; 25 sout | "x:" | x | "y:" | y | "z:" | z; 26 26 27 sout | "conversions" | endl;27 sout | "conversions"; 28 28 y = 'a'; 29 sout | "y:" | y | endl;29 sout | "y:" | y; 30 30 y = "12345678901234567890123456789"; 31 sout | "y:" | y | endl;31 sout | "y:" | y; 32 32 y = 100`mp + 100`mp; 33 sout | "y:" | y | endl;33 sout | "y:" | y; 34 34 y = -200u`mp + -200u`mp; 35 sout | "y:" | y | endl;35 sout | "y:" | y; 36 36 y = "12345678901234567890123456789"`mp + "12345678901234567890123456789"`mp; 37 sout | "y:" | y | endl;37 sout | "y:" | y; 38 38 y = si; 39 sout | "y:" | y | endl;39 sout | "y:" | y; 40 40 y = -3; 41 sout | "y:" | y | endl;41 sout | "y:" | y; 42 42 y += 7; 43 sout | "y:" | y | endl;43 sout | "y:" | y; 44 44 y -= 1; 45 sout | "y:" | y | endl;45 sout | "y:" | y; 46 46 int b; 47 47 b = y; 48 48 si = y; 49 sout | "y:" | y | "b:" | b | "si:" | si | endl;49 sout | "y:" | y | "b:" | b | "si:" | si; 50 50 51 sout | "comparison" | endl;52 sout | x == x | endl;53 sout | x != x | endl;54 sout | x < x | endl;55 sout | x <= x | endl;56 sout | x > x | endl;57 sout | x >= x | endl;51 sout | "comparison"; 52 sout | x == x; 53 sout | x != x; 54 sout | x < x; 55 sout | x <= x; 56 sout | x > x; 57 sout | x >= x; 58 58 59 sout | "arithmetic" | endl;59 sout | "arithmetic"; 60 60 z = x + y + z; 61 sout | "z:" | z | endl;61 sout | "z:" | z; 62 62 z = z = x; 63 sout | "z:" | z | endl;63 sout | "z:" | z; 64 64 z = x - y - z; 65 sout | "z:" | z | endl;65 sout | "z:" | z; 66 66 z = x * y * z; 67 sout | "z:" | z | endl;67 sout | "z:" | z; 68 68 z = x * 3; 69 sout | "z:" | z | endl;69 sout | "z:" | z; 70 70 z = 3 * x; 71 sout | "z:" | z | endl;71 sout | "z:" | z; 72 72 z = x / 3; 73 sout | "z:" | z | endl;74 sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;73 sout | "z:" | z; 74 sout | div( x, 3 ) | x / 3 | "," | x % 3; 75 75 [ x, y ] = div( x, 3 ); 76 sout | "x:" | x | "y:" | y | endl;76 sout | "x:" | x | "y:" | y; 77 77 78 sout | endl;78 sout | nl; 79 79 80 80 sin | x | y | z; 81 sout | x | y | z | endl;81 sout | x | y | z; 82 82 83 sout | endl;83 sout | nl; 84 84 85 sout | "Fibonacci Numbers" | endl;85 sout | "Fibonacci Numbers"; 86 86 Int fn, fn1, fn2; 87 87 fn = (Int){0}; fn1 = fn; // 1st case 88 sout | (int)0 | fn | endl;88 sout | (int)0 | fn; 89 89 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 90 sout | 1 | fn | endl;90 sout | 1 | fn; 91 91 for ( i; 2u ~= 200 ) { 92 92 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 93 sout | i | fn | endl;93 sout | i | fn; 94 94 } // for 95 95 96 sout | endl;96 sout | nl; 97 97 98 sout | "Factorial Numbers" | endl;98 sout | "Factorial Numbers"; 99 99 Int fact = 1; // 1st case 100 sout | (int)0 | fact | endl;100 sout | (int)0 | fact; 101 101 for ( i; 1u ~= 40u ) { 102 102 fact *= i; // general case 103 sout | i | fact | endl;103 sout | i | fact; 104 104 } // for 105 105 } // main … … 107 107 // Local Variables: // 108 108 // tab-width: 4 // 109 // compile-command: "cfa gmp.c -lgmp" //109 // compile-command: "cfa gmp.cfa -lgmp" // 110 110 // End: // -
tests/heap.cfa
rff5caaf r95b8aa7 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // heap.cfa -- 8 // 9 // Author : Peter A. Buhr 10 // Created On : Tue Nov 6 17:54:56 2018 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 11 21:52:40 2018 13 // Update Count : 18 14 // 15 1 16 #include <thread.hfa> 2 #include <kernel.hfa> 3 #include <stdlib.hfa> 17 #include <kernel.hfa> // processor 18 #include <stdlib.hfa> // *allocs 4 19 #include <malloc.h> // malloc_* 5 20 … … 22 37 void main( Worker & ) { 23 38 enum { NoOfAllocs = 5000, NoOfMmaps = 10 }; 24 char * locns[NoOfAllocs];39 char * locns[NoOfAllocs]; 25 40 int i; 26 41 27 42 // check alloc/free 28 43 29 for ( int j = 0; j < 40; j += 1) {30 for ( i = 0; i < NoOfAllocs; i += 1) {44 for ( j; 40 ) { 45 for ( i; NoOfAllocs ) { 31 46 locns[i] = alloc( i ); 32 //sout | (void *)locns[i] | endl;33 for ( int k = 0; k < i; k += 1) locns[i][k] = '\345';34 } // for 35 //sout | (char *)sbrk(0) - start | " bytes" | endl;36 37 for ( i = 0; i < NoOfAllocs; i += 1) {38 //sout | (void *)locns[i] | endl;39 for ( int k = 0; k < i; k += 1) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage1" );47 //sout | (void *)locns[i]; 48 for ( k; i ) locns[i][k] = '\345'; 49 } // for 50 //sout | (char *)sbrk(0) - start | " bytes"; 51 52 for ( i; NoOfAllocs ) { 53 //sout | (void *)locns[i]; 54 for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage1" ); 40 55 free( locns[i] ); 41 56 } // for 42 //sout | (char *)sbrk(0) - start | " bytes" | endl;43 44 for ( i = 0; i < NoOfAllocs; i += 1) {57 //sout | (char *)sbrk(0) - start | " bytes"; 58 59 for ( i; NoOfAllocs ) { 45 60 locns[i] = alloc( i ); 46 //sout | (void *)locns[i] | endl;47 for ( int k = 0; k < i; k += 1) locns[i][k] = '\345';48 } // for 49 for ( i = NoOfAllocs - 1; i >=0 ; i -= 1) {50 //sout | (void *)locns[i] | endl;51 for ( int k = 0; k < i; k += 1) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage2" );61 //sout | (void *)locns[i]; 62 for ( k; i ) locns[i][k] = '\345'; 63 } // for 64 for ( i; NoOfAllocs - 1 -~= 0 ) { 65 //sout | (void *)locns[i]; 66 for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage2" ); 52 67 free( locns[i] ); 53 68 } // for … … 56 71 // check malloc/free (sbrk) 57 72 58 for ( i = 0; i < NoOfAllocs; i += 1) {73 for ( i; NoOfAllocs ) { 59 74 size_t s = (i + 1) * 20; 60 char * area = (char *)malloc( s );75 char * area = (char *)malloc( s ); 61 76 if ( area == 0 ) abort( "malloc/free out of memory" ); 62 77 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last … … 65 80 } // for 66 81 67 for ( i = 0; i < NoOfAllocs; i += 1) {68 size_t s = i + 1; // +1 to make initialization simpler82 for ( i; NoOfAllocs ) { 83 size_t s = i + 1; // +1 to make initialization simpler 69 84 locns[i] = (char *)malloc( s ); 70 85 if ( locns[i] == 0 ) abort( "malloc/free out of memory" ); … … 72 87 locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte 73 88 } // for 74 for ( i = 0; i < NoOfAllocs; i += 1) {89 for ( i; NoOfAllocs ) { 75 90 size_t s = i + 1; 76 91 if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' || … … 81 96 // check malloc/free (mmap) 82 97 83 for ( i = 0; i < NoOfMmaps; i += 1) {84 size_t s = i + default_mmap_start(); 85 char * area = (char *)malloc( s );98 for ( i; NoOfMmaps ) { 99 size_t s = i + default_mmap_start(); // cross over point 100 char * area = (char *)malloc( s ); 86 101 if ( area == 0 ) abort( "malloc/free out of memory" ); 87 102 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last … … 90 105 } // for 91 106 92 for ( i = 0; i < NoOfMmaps; i += 1) {93 size_t s = i + default_mmap_start(); 107 for ( i; NoOfMmaps ) { 108 size_t s = i + default_mmap_start(); // cross over point 94 109 locns[i] = (char *)malloc( s ); 95 110 if ( locns[i] == 0 ) abort( "malloc/free out of memory" ); … … 97 112 locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte 98 113 } // for 99 for ( i = 0; i < NoOfMmaps; i += 1) {100 size_t s = i + default_mmap_start(); 114 for ( i; NoOfMmaps ) { 115 size_t s = i + default_mmap_start(); // cross over point 101 116 if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' || 102 117 locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "malloc/free corrupt storage" ); … … 106 121 // check calloc/free (sbrk) 107 122 108 for ( i = 0; i < NoOfAllocs; i += 1) {123 for ( i; NoOfAllocs ) { 109 124 size_t s = (i + 1) * 20; 110 char * area = (char *)calloc( 5, s );125 char * area = (char *)calloc( 5, s ); 111 126 if ( area == 0 ) abort( "calloc/free out of memory" ); 112 127 if ( area[0] != '\0' || area[s - 1] != '\0' || … … 118 133 } // for 119 134 120 for ( i = 0; i < NoOfAllocs; i += 1) {135 for ( i; NoOfAllocs ) { 121 136 size_t s = i + 1; 122 137 locns[i] = (char *)calloc( 5, s ); … … 128 143 locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte 129 144 } // for 130 for ( i = 0; i < NoOfAllocs; i += 1) {145 for ( i; NoOfAllocs ) { 131 146 size_t s = i + 1; 132 147 if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' || … … 137 152 // check calloc/free (mmap) 138 153 139 for ( i = 0; i < NoOfMmaps; i += 1) {140 size_t s = i + default_mmap_start(); 141 char * area = (char *)calloc( 1, s );154 for ( i; NoOfMmaps ) { 155 size_t s = i + default_mmap_start(); // cross over point 156 char * area = (char *)calloc( 1, s ); 142 157 if ( area == 0 ) abort( "calloc/free out of memory" ); 143 158 if ( area[0] != '\0' || area[s - 1] != '\0' ) abort( "calloc/free corrupt storage4.1" ); … … 149 164 } // for 150 165 151 for ( i = 0; i < NoOfMmaps; i += 1) {152 size_t s = i + default_mmap_start(); 166 for ( i; NoOfMmaps ) { 167 size_t s = i + default_mmap_start(); // cross over point 153 168 locns[i] = (char *)calloc( 1, s ); 154 169 if ( locns[i] == 0 ) abort( "calloc/free out of memory" ); … … 159 174 locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte 160 175 } // for 161 for ( i = 0; i < NoOfMmaps; i += 1) {162 size_t s = i + default_mmap_start(); 176 for ( i; NoOfMmaps ) { 177 size_t s = i + default_mmap_start(); // cross over point 163 178 if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' || 164 179 locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "calloc/free corrupt storage6" ); … … 170 185 enum { limit = 64 * 1024 }; // check alignments up to here 171 186 172 for ( size_t a = libAlign(); a <= limit; a += a ) {// generate powers of 2173 //sout | alignments[a] | endl;174 for ( int s = 1; s < NoOfAllocs; s += 1 ) {// allocation of size 0 can return null175 char * area = (char *)memalign( a, s );187 for ( a; libAlign() ~= limit ~ a ) { // generate powers of 2 188 //sout | alignments[a]; 189 for ( s; 1 ~ NoOfAllocs ) { // allocation of size 0 can return null 190 char * area = (char *)memalign( a, s ); 176 191 if ( area == 0 ) abort( "memalign/free out of memory" ); 177 //sout | i | " " | area | endl;192 //sout | i | " " | area; 178 193 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 179 194 abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, s, area ); … … 187 202 // check memalign/free (mmap) 188 203 189 for ( size_t a = libAlign(); a <= limit; a += a ) {// generate powers of 2190 //sout | alignments[a] | endl;191 for ( i = 1; i < NoOfMmaps; i += 1) {192 size_t s = i + default_mmap_start(); 193 char * area = (char *)memalign( a, s );204 for ( a; libAlign() ~= limit ~ a ) { // generate powers of 2 205 //sout | alignments[a]; 206 for ( i; 1 ~ NoOfMmaps ) { 207 size_t s = i + default_mmap_start(); // cross over point 208 char * area = (char *)memalign( a, s ); 194 209 if ( area == 0 ) abort( "memalign/free out of memory" ); 195 //sout | i | " " | area | endl;210 //sout | i | " " | area; 196 211 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 197 212 abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)s, area ); … … 205 220 // check calloc/realloc/free (sbrk) 206 221 207 for ( i = 1; i < 10000; i +=12 ) {222 for ( i; 1 ~ 10_000 ~ 12 ) { 208 223 // initial N byte allocation 209 char * area = (char *)calloc( 5, i );224 char * area = (char *)calloc( 5, i ); 210 225 if ( area == 0 ) abort( "calloc/realloc/free out of memory" ); 211 226 if ( area[0] != '\0' || area[i - 1] != '\0' || … … 214 229 215 230 // Do not start this loop index at 0 because realloc of 0 bytes frees the storage. 216 for ( int s = i; s < 256 * 1024; s += 26 ) {// start at initial memory request231 for ( s; i ~ 256 * 1024 ~ 26 ) { // start at initial memory request 217 232 area = (char *)realloc( area, s ); // attempt to reuse storage 218 233 if ( area == 0 ) abort( "calloc/realloc/free out of memory" ); … … 226 241 // check calloc/realloc/free (mmap) 227 242 228 for ( i = 1; i < 1000; i +=12 ) {243 for ( i; 1 ~ 10_000 ~ 12 ) { 229 244 // initial N byte allocation 230 size_t s = i + default_mmap_start(); 231 char * area = (char *)calloc( 1, s );245 size_t s = i + default_mmap_start(); // cross over point 246 char * area = (char *)calloc( 1, s ); 232 247 if ( area == 0 ) abort( "calloc/realloc/free out of memory" ); 233 248 if ( area[0] != '\0' || area[s - 1] != '\0' || … … 236 251 237 252 // Do not start this loop index at 0 because realloc of 0 bytes frees the storage. 238 for ( int r = i; r < 256 * 1024; r += 26 ) {// start at initial memory request239 area = (char *)realloc( area, r ); // attempt to reuse storage253 for ( r; i ~ 256 * 1024 ~ 26 ) { // start at initial memory request 254 area = (char *)realloc( area, r ); // attempt to reuse storage 240 255 if ( area == 0 ) abort( "calloc/realloc/free out of memory" ); 241 256 if ( area[0] != '\0' || area[r - 1] != '\0' || … … 249 264 250 265 size_t amount = 2; 251 for ( size_t a = libAlign(); a <= limit; a += a ) {// generate powers of 2266 for ( a; libAlign() ~= limit ~ a ) { // generate powers of 2 252 267 // initial N byte allocation 253 char * area = (char *)memalign( a, amount );// aligned N-byte allocation268 char * area = (char *)memalign( a, amount ); // aligned N-byte allocation 254 269 if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ? 255 //sout | alignments[a] | " " | area | endl;270 //sout | alignments[a] | " " | area; 256 271 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 257 272 abort( "memalign/realloc/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area ); … … 260 275 261 276 // Do not start this loop index at 0 because realloc of 0 bytes frees the storage. 262 for ( int s = amount; s < 256 * 1024; s += 1 ) {// start at initial memory request277 for ( s; amount ~ 256 * 1024 ) { // start at initial memory request 263 278 if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "memalign/realloc/free corrupt storage" ); 264 279 area = (char *)realloc( area, s ); // attempt to reuse storage 265 280 if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ? 266 //sout | i | " " | area | endl;281 //sout | i | " " | area; 267 282 if ( (size_t)area % a != 0 ) { // check for initial alignment 268 283 abort( "memalign/realloc/free bad alignment %p", area ); … … 275 290 // check cmemalign/free 276 291 277 for ( size_t a = libAlign(); a <= limit; a += a ) {// generate powers of 2278 //sout | alignments[a] | endl;279 for ( int s = 1; s < limit; s += 1 ) {// allocation of size 0 can return null280 char * area = (char *)cmemalign( a, 1, s );292 for ( a; libAlign() ~= limit ~ a ) { // generate powers of 2 293 //sout | alignments[a]; 294 for ( s; 1 ~ limit ) { // allocation of size 0 can return null 295 char * area = (char *)cmemalign( a, 1, s ); 281 296 if ( area == 0 ) abort( "cmemalign/free out of memory" ); 282 //sout | i | " " | area | endl;297 //sout | i | " " | area; 283 298 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 284 299 abort( "cmemalign/free bad alignment : cmemalign(%d,%d) = %p", (int)a, s, area ); … … 295 310 296 311 amount = 2; 297 for ( size_t a = libAlign() + libAlign(); a <= limit; a += a ) {// generate powers of 2312 for ( a; libAlign() ~= limit ~ a ) { // generate powers of 2 298 313 // initial N byte allocation 299 char * area = (char *)cmemalign( a, 1, amount );// aligned N-byte allocation314 char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation 300 315 if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ? 301 //sout | alignments[a] | " " | area | endl;316 //sout | alignments[a] | " " | area; 302 317 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 303 318 abort( "cmemalign/realloc/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area ); … … 309 324 310 325 // Do not start this loop index at 0 because realloc of 0 bytes frees the storage. 311 for ( int s = amount; s < 256 * 1024; s += 1 ) {// start at initial memory request326 for ( s; amount ~ 256 * 1024 ) { // start at initial memory request 312 327 if ( area[0] != '\345' || area[s - 2] != '\345' ) abort( "cmemalign/realloc/free corrupt storage2" ); 313 328 area = (char *)realloc( area, s ); // attempt to reuse storage 314 329 if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ? 315 //sout | i | " " | area | endl;330 //sout | i | " " | area; 316 331 if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment 317 332 abort( "cmemalign/realloc/free bad alignment %p", area ); … … 324 339 free( area ); 325 340 } // for 326 //sout | "worker" | thisTask() | "successful completion" | endl;341 //sout | "worker" | thisTask() | "successful completion"; 327 342 } // Worker main 328 343 … … 339 354 // Local Variables: // 340 355 // tab-width: 4 // 341 // compile-command: "cfa -nodebug -O2 heap.c " //356 // compile-command: "cfa -nodebug -O2 heap.cfa" // 342 357 // End: // -
tests/identFuncDeclarator.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // identFuncDeclarator.c --7 // identFuncDeclarator.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:36:34 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 17 22:39:13 201813 // Update Count : 212 // Last Modified On : Tue Nov 6 17:56:33 2018 13 // Update Count : 3 14 14 // 15 15 … … 115 115 // Local Variables: // 116 116 // tab-width: 4 // 117 // compile-command: "cfa identFuncDeclarator.c " //117 // compile-command: "cfa identFuncDeclarator.cfa" // 118 118 // End: // -
tests/identParamDeclarator.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // identParamDeclarator.c --7 // identParamDeclarator.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:37:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 17 22:36:11201813 // Update Count : 212 // Last Modified On : Tue Nov 6 17:56:44 2018 13 // Update Count : 3 14 14 // 15 15 … … 163 163 // Local Variables: // 164 164 // tab-width: 4 // 165 // compile-command: "cfa identParamDeclarator.c " //165 // compile-command: "cfa identParamDeclarator.cfa" // 166 166 // End: // -
tests/ifwhileCtl.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ifwhileCtl.c --7 // ifwhileCtl.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Aug 26 10:13:11 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 6 17:15:09201813 // Update Count : 2 112 // Last Modified On : Tue Dec 4 21:39:18 2018 13 // Update Count : 23 14 14 // 15 15 … … 22 22 23 23 if ( int x = 1 ) { 24 sout | "x != 0 correct" | endl;24 sout | "x != 0 correct"; 25 25 } else { 26 sout | "x == 0 incorrect" | endl;26 sout | "x == 0 incorrect"; 27 27 } // if 28 28 29 29 if ( int x = 4, y = 0 ) { 30 sout | "x != 0 && y != 0 incorrect" | endl;30 sout | "x != 0 && y != 0 incorrect"; 31 31 } else if ( int x = 4, y = 1 ) { 32 sout | "x != 0 && y != 0 correct" | endl;32 sout | "x != 0 && y != 0 correct"; 33 33 } else { 34 sout | "x == 0 || y == 0 incorrect" | endl;34 sout | "x == 0 || y == 0 incorrect"; 35 35 } // if 36 36 37 37 if ( int x = 5, y = f( x ); x == y ) { 38 sout | "x == y correct" | endl;38 sout | "x == y correct"; 39 39 } else { 40 sout | "x != y incorrect" | endl;40 sout | "x != y incorrect"; 41 41 } // if 42 42 43 43 if ( struct S { int i; } s = { 3 }; s.i < 4 ) { 44 44 S s1; 45 sout | "s.i < 4 correct" | endl;45 sout | "s.i < 4 correct"; 46 46 } else { 47 47 S s1; 48 sout | "s.i >= 4 incorrect" | endl;48 sout | "s.i >= 4 incorrect"; 49 49 } // if 50 50 51 51 while ( int x = 1 ) { 52 sout | "x != 0 correct" | endl;52 sout | "x != 0 correct"; 53 53 break; 54 54 } // while 55 55 56 56 while ( int x = 4, y = 0 ) { 57 sout | "x != 0 && y != 0 incorrect" | endl;57 sout | "x != 0 && y != 0 incorrect"; 58 58 } // while 59 59 60 60 while ( int x = 5, y = f( x ); x == y ) { 61 sout | "x == y correct" | endl;61 sout | "x == y correct"; 62 62 break; 63 63 } // while … … 65 65 while ( struct S { int i; } s = { 3 }; s.i < 4 ) { 66 66 S s1; 67 sout | "s.i < 4 correct" | endl;67 sout | "s.i < 4 correct"; 68 68 break; 69 69 } // while … … 72 72 // Local Variables: // 73 73 // tab-width: 4 // 74 // compile-command: "cfa ifwhileCtl.c " //74 // compile-command: "cfa ifwhileCtl.cfa" // 75 75 // End: // -
tests/labelledExit.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // labelledExit.c --7 // labelledExit.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 10 07:29:39 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 16 08:55:39201813 // Update Count : 312 // Last Modified On : Tue Nov 6 17:57:42 2018 13 // Update Count : 4 14 14 // 15 15 … … 159 159 // Local Variables: // 160 160 // tab-width: 4 // 161 // compile-command: "cfa labelledExit.c " //161 // compile-command: "cfa labelledExit.cfa" // 162 162 // End: // -
tests/limits.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // limits.c --7 // limits.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue May 10 20:44:20 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 1 16:21:55 201813 // Update Count : 712 // Last Modified On : Tue Nov 6 17:57:55 2018 13 // Update Count : 8 14 14 // 15 15 … … 153 153 // Local Variables: // 154 154 // tab-width: 4 // 155 // compile-command: "cfa limits.c " //155 // compile-command: "cfa limits.cfa" // 156 156 // End: // -
tests/literals.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // literals.c --7 // literals.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 9 16:34:38 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 1 15:12:15201813 // Update Count : 13 712 // Last Modified On : Tue Dec 4 21:44:01 2018 13 // Update Count : 139 14 14 // 15 15 … … 18 18 #include <fstream.hfa> 19 19 20 void f( char v ) { sout | "char " | v | endl; }21 void f( signed char v ) { sout | "signed char " | v | endl; }22 void f( unsigned char v ) { sout | "unsigned char " | v | endl; }23 void f( signed short v ) { sout | "signed short int" | v | endl; }24 void f( unsigned short v ) { sout | "unsigned short int" | v | endl; }25 void f( size_t v ) { sout | "size_t" | v | endl; }20 void f( char v ) { sout | "char " | v; } 21 void f( signed char v ) { sout | "signed char " | v; } 22 void f( unsigned char v ) { sout | "unsigned char " | v; } 23 void f( signed short v ) { sout | "signed short int" | v; } 24 void f( unsigned short v ) { sout | "unsigned short int" | v; } 25 void f( size_t v ) { sout | "size_t" | v; } 26 26 #endif // __CFA__ 27 27 … … 324 324 // Local Variables: // 325 325 // tab-width: 4 // 326 // compile-command: "cfa literals.c " //326 // compile-command: "cfa literals.cfa" // 327 327 // End: // -
tests/math1.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // math1.c --7 // math1.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 24 21:01:15201813 // Update Count : 8 512 // Last Modified On : Wed Dec 12 16:28:49 2018 13 // Update Count : 89 14 14 // 15 15 … … 22 22 long double l; 23 23 24 sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ) | endl; 25 sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ) | endl; 24 sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | nonl; 25 sout | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ); 26 sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ); 26 27 int quot; 27 28 f = remquo( 3.6F, 0.5F, " ); 28 sout | "remquo:" | quot | f ;29 sout | "remquo:" | quot | f | nonl; 29 30 d = remquo( 3.6D, 0.5F, " ); 30 sout | quot | d ;31 sout | quot | d | nonl; 31 32 l = remquo( 3.6L, 0.5L, " ); 32 sout | quot | l | endl;33 sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L ) | endl;34 sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, , 1.0L ) | endl;35 sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L ) | endl;36 sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" ) | endl;33 sout | quot | l; 34 sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L ); 35 sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, , 1.0L ); 36 sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L ); 37 sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" ); 37 38 38 39 //---------------------- Exponential ---------------------- 39 40 40 sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI ) | endl; 41 sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ) | endl; 42 sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L ) | endl; 43 sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI ) | endl; 41 sout | "exp:" | exp( 1.0F ) | exp( 1.0D ) | exp( 1.0L ) | nonl; 42 sout | exp( 1.0F+1.0FI ) | exp( 1.0D+1.0DI ) | exp( 1.0DL+1.0LI ); 43 sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ); 44 sout | "expm1:" | expm1( 1.0F ) | expm1( 1.0D ) | expm1( 1.0L ); 45 sout | "pow:" | pow( 1.0F, 1.0F ) | pow( 1.0D, 1.0D ) | pow( 1.0L, 1.0L ) | nonl; 46 sout | pow( 1.0F+1.0FI, 1.0F+1.0FI ) | pow( 1.0D+1.0DI, 1.0D+1.0DI ) | pow( 1.5DL+1.5LI, 1.5DL+1.5LI ); 44 47 45 48 int b = 4; 46 49 unsigned int e = 2; 47 50 b \= e; 48 sout | "\\" | b | b \ e | endl; 49 sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi) | endl; 51 sout | "\\" | b | b \ e; 52 sout | "\\" | 'a' \ 3u | 2 \ 8u | 4 \ 3u | -4 \ 3u | nonl; 53 sout | 4 \ -3 | -4 \ -3 | 4.0 \ 2.1 | (1.0f+2.0fi) \ (3.0f+2.0fi); 50 54 } // main 51 55 52 56 // Local Variables: // 53 57 // tab-width: 4 // 54 // compile-command: "cfa math1.c " //58 // compile-command: "cfa math1.cfa" // 55 59 // End: // -
tests/math3.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // math3.c --7 // math3.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 24 21:06:12201813 // Update Count : 8 212 // Last Modified On : Wed Dec 12 16:30:41 2018 13 // Update Count : 86 14 14 // 15 15 … … 24 24 //---------------------- Hyperbolic ---------------------- 25 25 26 sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI ) | endl; 27 sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI ) | endl; 28 sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI ) | endl; 29 sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI ) | endl; 30 sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI ) | endl; 31 sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI ) | endl; 26 sout | "sinh:" | sinh( 1.0F ) | sinh( 1.0D ) | sinh( 1.0L ) | nonl; 27 sout | sinh( 1.0F+1.0FI ) | sinh( 1.0D+1.0DI ) | sinh( 1.0DL+1.0LI ); 28 sout | "cosh:" | cosh( 1.0F ) | cosh( 1.0D ) | cosh( 1.0L ) | nonl; 29 sout | cosh( 1.0F+1.0FI ) | cosh( 1.0D+1.0DI ) | cosh( 1.0DL+1.0LI ); 30 sout | "tanh:" | tanh( 1.0F ) | tanh( 1.0D ) | tanh( 1.0L ) | nonl; 31 sout | tanh( 1.0F+1.0FI ) | tanh( 1.0D+1.0DI ) | tanh( 1.0DL+1.0LI ); 32 sout | "acosh:" | acosh( 1.0F ) | acosh( 1.0D ) | acosh( 1.0L ) | nonl; 33 sout | acosh( 1.0F+1.0FI ) | acosh( 1.0D+1.0DI ) | acosh( 1.0DL+1.0LI ); 34 sout | "asinh:" | asinh( 1.0F ) | asinh( 1.0D ) | asinh( 1.0L ) | nonl; 35 sout | asinh( 1.0F+1.0FI ) | asinh( 1.0D+1.0DI ) | asinh( 1.0DL+1.0LI ); 36 sout | "atanh:" | atanh( 1.0F ) | atanh( 1.0D ) | atanh( 1.0L ) | nonl; 37 sout | atanh( 1.0F+1.0FI ) | atanh( 1.0D+1.0DI ) | atanh( 1.0DL+1.0LI ); 32 38 33 39 //---------------------- Error / Gamma ---------------------- 34 40 35 sout | "erf:" | erf( 1.0F ) | erf( 1.0D ) | erf( 1.0L ) | endl;36 sout | "erfc:" | erfc( 1.0F ) | erfc( 1.0D ) | erfc( 1.0L ) | endl;37 sout | "lgamma:" | lgamma( 4.0F ) | lgamma( 4.0D ) | lgamma( 4.0L ) | endl;41 sout | "erf:" | erf( 1.0F ) | erf( 1.0D ) | erf( 1.0L ); 42 sout | "erfc:" | erfc( 1.0F ) | erfc( 1.0D ) | erfc( 1.0L ); 43 sout | "lgamma:" | lgamma( 4.0F ) | lgamma( 4.0D ) | lgamma( 4.0L ); 38 44 int sign; 39 45 f = lgamma( 4.0F, &sign ); 40 sout | "lgamma:" | f | sign ;46 sout | "lgamma:" | f | sign | nonl; 41 47 d = lgamma( 4.0D, &sign ); 42 sout | d | sign ;48 sout | d | sign | nonl; 43 49 l = lgamma( 4.0L, &sign ); 44 sout | l | sign | endl;45 sout | "tgamma:" | tgamma( 4.0F ) | tgamma( 4.0D ) | tgamma( 4.0L ) | endl;50 sout | l | sign; 51 sout | "tgamma:" | tgamma( 4.0F ) | tgamma( 4.0D ) | tgamma( 4.0L ); 46 52 } // main 47 53 48 54 // Local Variables: // 49 55 // tab-width: 4 // 50 // compile-command: "cfa math3.c " //56 // compile-command: "cfa math3.cfa" // 51 57 // End: // -
tests/math4.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // math4.c --7 // math4.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu May 24 20:56:54 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu May 24 20:58:06201813 // Update Count : 212 // Last Modified On : Tue Dec 4 18:15:01 2018 13 // Update Count : 4 14 14 // 15 15 … … 24 24 //---------------------- Nearest Integer ---------------------- 25 25 26 sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L ) | endl;27 sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L ) | endl;28 sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L ) | endl;29 sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L ) | endl;30 sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L ) | endl;31 sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L ) | endl;32 sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L ) | endl;33 sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L ) | endl;34 sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L ) | endl;35 sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L ) | endl;36 sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L ) | endl;37 sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L ) | endl;38 sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L ) | endl;39 sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L ) | endl;26 sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L ); 27 sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L ); 28 sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L ); 29 sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L ); 30 sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L ); 31 sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L ); 32 sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L ); 33 sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L ); 34 sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L ); 35 sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L ); 36 sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L ); 37 sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L ); 38 sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L ); 39 sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L ); 40 40 41 41 //---------------------- Manipulation ---------------------- 42 42 43 sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L ) | endl;43 sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L ); 44 44 int exp; 45 45 f = frexp( 4.0F, &exp ); 46 sout | "frexp:" | f | exp ;46 sout | "frexp:" | f | exp | nonl; 47 47 d = frexp( 4.0D, &exp ); 48 sout | d | exp ;48 sout | d | exp | nonl; 49 49 l = frexp( 4.0L, &exp ); 50 sout | l | exp | endl;51 sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 ) | endl;50 sout | l | exp; 51 sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 ); 52 52 float fi; 53 53 double di; 54 54 long double ldi; 55 55 f = modf( 2.3F, &fi ); 56 sout | "modf:" | fi | f ;56 sout | "modf:" | fi | f | nonl; 57 57 d = modf( 2.3D, &di ); 58 sout | di | d ;58 sout | di | d | nonl; 59 59 l = modf( 2.3L, &ldi ); 60 sout | ldi | l | endl;61 sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L ) | endl;62 sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L ) | endl;63 sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L ) | endl;60 sout | ldi | l; 61 sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L ); 62 sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L ); 63 sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L ); 64 64 65 sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 ) | endl;66 sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L ) | endl;65 sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 ); 66 sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L ); 67 67 } // main 68 68 69 69 // Local Variables: // 70 70 // tab-width: 4 // 71 // compile-command: "cfa math3.c " //71 // compile-command: "cfa math3.cfa" // 72 72 // End: // -
tests/minmax.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // minmax.c --7 // minmax.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 10 17:29:09201813 // Update Count : 5 012 // Last Modified On : Tue Dec 4 21:45:31 2018 13 // Update Count : 52 14 14 // 15 15 … … 22 22 int ?>?( char op1, char op2 ) { return (int)op1 > (int)op2; } 23 23 24 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' ) | endl;25 sout | "signed int\t\t" | 4 | 3 | "\tmin" | min( 4, 3 ) | endl;26 sout | "unsigned int\t\t" | 4u | 3u | "\tmin" | min( 4u, 3u ) | endl;27 sout | "signed long int\t\t" | 4l | 3l | "\tmin" | min( 4l, 3l ) | endl;28 sout | "unsigned long int\t" | 4ul | 3ul | "\tmin" | min( 4ul, 3ul ) | endl;29 sout | "signed long long int\t" | 4ll | 3ll | "\tmin" | min( 4ll, 3ll ) | endl;30 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmin" | min( 4ull, 3ull ) | endl;31 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f ) | endl;32 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 ) | endl;33 sout | "long double\t\t" | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l ) | endl;24 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' ); 25 sout | "signed int\t\t" | 4 | 3 | "\tmin" | min( 4, 3 ); 26 sout | "unsigned int\t\t" | 4u | 3u | "\tmin" | min( 4u, 3u ); 27 sout | "signed long int\t\t" | 4l | 3l | "\tmin" | min( 4l, 3l ); 28 sout | "unsigned long int\t" | 4ul | 3ul | "\tmin" | min( 4ul, 3ul ); 29 sout | "signed long long int\t" | 4ll | 3ll | "\tmin" | min( 4ll, 3ll ); 30 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmin" | min( 4ull, 3ull ); 31 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f ); 32 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 ); 33 sout | "long double\t\t" | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l ); 34 34 35 sout | endl;35 sout | nl; 36 36 37 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' ) | endl;38 sout | "signed int\t\t" | 4 | 3 | "\tmax" | max( 4, 3 ) | endl;39 sout | "unsigned int\t\t" | 4u | 3u | "\tmax" | max( 4u, 3u ) | endl;40 sout | "signed long int\t\t" | 4l | 3l | "\tmax" | max( 4l, 3l ) | endl;41 sout | "unsigned long int\t" | 4ul | 3ul | "\tmax" | max( 4ul, 3ul ) | endl;42 sout | "signed long long int\t" | 4ll | 3ll | "\tmax" | max( 4ll, 3ll ) | endl;43 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmax" | max( 4ull, 3ull ) | endl;44 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f ) | endl;45 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 ) | endl;46 sout | "long double\t\t" | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l ) | endl;37 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' ); 38 sout | "signed int\t\t" | 4 | 3 | "\tmax" | max( 4, 3 ); 39 sout | "unsigned int\t\t" | 4u | 3u | "\tmax" | max( 4u, 3u ); 40 sout | "signed long int\t\t" | 4l | 3l | "\tmax" | max( 4l, 3l ); 41 sout | "unsigned long int\t" | 4ul | 3ul | "\tmax" | max( 4ul, 3ul ); 42 sout | "signed long long int\t" | 4ll | 3ll | "\tmax" | max( 4ll, 3ll ); 43 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmax" | max( 4ull, 3ull ); 44 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f ); 45 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 ); 46 sout | "long double\t\t" | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l ); 47 47 } // main 48 48 49 49 // Local Variables: // 50 50 // tab-width: 4 // 51 // compile-command: "cfa minmax.c " //51 // compile-command: "cfa minmax.cfa" // 52 52 // End: // -
tests/nested-types.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // nested-types.c --7 // nested-types.cfa -- 8 8 // 9 9 // Author : Rob Schluntz 10 10 // Created On : Mon Jul 9 10:20:03 2018 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Mon Jul 9 10:20:03 201713 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 6 17:59:40 2018 13 // Update Count : 2 14 14 // 15 15 … … 88 88 // Local Variables: // 89 89 // tab-width: 4 // 90 // compile-command: "cfa nested-types.c " //90 // compile-command: "cfa nested-types.cfa" // 91 91 // End: // -
tests/numericConstants.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // numericConstants.c --7 // numericConstants.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 24 22:10:36 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 22:11:36 201713 // Update Count : 212 // Last Modified On : Tue Nov 6 17:59:53 2018 13 // Update Count : 3 14 14 // 15 15 … … 67 67 // Local Variables: // 68 68 // tab-width: 4 // 69 // compile-command: "cfa minmax.c " //69 // compile-command: "cfa minmax.cfa" // 70 70 // End: // -
tests/polymorphism.cfa
rff5caaf r95b8aa7 9 9 // Author : Rob Schluntz 10 10 // Created On : Tue Oct 17 12:19:48 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Oct 17 12:21:07 201713 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 25 14:40:24 2018 13 // Update Count : 3 14 14 // 15 15 16 16 #include <assert.h> 17 17 #include <inttypes.h> 18 #include <fstream.hfa> 18 19 19 20 forall(otype T) … … 61 62 int y = 456; 62 63 int z = f(x, y); 63 printf("%d %d %d\n", x, y, z);64 sout | x | y | z; 64 65 } 65 66 66 { 67 67 // explicitly specialize function 68 68 int (*f)(int) = ident; 69 69 ((int(*)(int))ident); 70 printf("%d %d\n", f(5), ((int(*)(int))ident)(5));70 sout | f(5) | ((int(*)(int))ident)(5); 71 71 } 72 73 72 { 74 73 // test aggregates with polymorphic members … … 100 99 101 100 void print(x_type x) { 102 printf("%"PRIu32"\n", x);101 sout | x; 103 102 } 104 103 105 104 void print(y_type y) { 106 printf("%"PRIu64"\n", y);105 sout | y; 107 106 } 108 107 -
tests/preempt_longrun/Makefile.am
rff5caaf r95b8aa7 16 16 17 17 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 18 ACLOCAL_AMFLAGS = -I automake 18 19 19 20 repeats=10 -
tests/preempt_longrun/Makefile.in
rff5caaf r95b8aa7 93 93 subdir = tests/preempt_longrun 94 94 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 95 am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \ 96 $(top_srcdir)/configure.ac 95 am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \ 96 $(top_srcdir)/automake/ltoptions.m4 \ 97 $(top_srcdir)/automake/ltsugar.m4 \ 98 $(top_srcdir)/automake/ltversion.m4 \ 99 $(top_srcdir)/automake/lt~obsolete.m4 \ 100 $(top_srcdir)/automake/cfa.m4 $(top_srcdir)/configure.ac 97 101 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 98 102 $(ACLOCAL_M4) … … 333 337 AMTAR = @AMTAR@ 334 338 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 339 AR = @AR@ 335 340 AUTOCONF = @AUTOCONF@ 336 341 AUTOHEADER = @AUTOHEADER@ 337 342 AUTOMAKE = @AUTOMAKE@ 338 343 AWK = @AWK@ 339 BACKEND_CC = @BACKEND_CC@340 344 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@ 341 345 CC = @CFACC@ … … 357 361 CPPFLAGS = @CPPFLAGS@ 358 362 CXX = @CXX@ 363 CXXCPP = @CXXCPP@ 359 364 CXXDEPMODE = @CXXDEPMODE@ 360 365 CXXFLAGS = @CXXFLAGS@ … … 362 367 DEFS = @DEFS@ 363 368 DEPDIR = @DEPDIR@ 369 DLLTOOL = @DLLTOOL@ 364 370 DRIVER_DIR = @DRIVER_DIR@ 371 DSYMUTIL = @DSYMUTIL@ 372 DUMPBIN = @DUMPBIN@ 365 373 ECHO_C = @ECHO_C@ 366 374 ECHO_N = @ECHO_N@ … … 368 376 EGREP = @EGREP@ 369 377 EXEEXT = @EXEEXT@ 378 FGREP = @FGREP@ 370 379 GREP = @GREP@ 371 380 HOST_FLAGS = @HOST_FLAGS@ … … 375 384 INSTALL_SCRIPT = @INSTALL_SCRIPT@ 376 385 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 386 LD = @LD@ 377 387 LDFLAGS = @LDFLAGS@ 378 388 LEX = @LEX@ … … 383 393 LIBOBJS = @LIBOBJS@ 384 394 LIBS = @LIBS@ 395 LIBTOOL = @LIBTOOL@ 396 LIPO = @LIPO@ 397 LN_S = @LN_S@ 385 398 LTLIBOBJS = @LTLIBOBJS@ 399 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 386 400 MAKEINFO = @MAKEINFO@ 401 MANIFEST_TOOL = @MANIFEST_TOOL@ 387 402 MKDIR_P = @MKDIR_P@ 403 NM = @NM@ 404 NMEDIT = @NMEDIT@ 405 OBJDUMP = @OBJDUMP@ 388 406 OBJEXT = @OBJEXT@ 407 OTOOL = @OTOOL@ 408 OTOOL64 = @OTOOL64@ 389 409 PACKAGE = @PACKAGE@ 390 410 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ … … 396 416 PATH_SEPARATOR = @PATH_SEPARATOR@ 397 417 RANLIB = @RANLIB@ 418 SED = @SED@ 398 419 SET_MAKE = @SET_MAKE@ 399 420 SHELL = @SHELL@ … … 407 428 abs_top_builddir = @abs_top_builddir@ 408 429 abs_top_srcdir = @abs_top_srcdir@ 430 ac_ct_AR = @ac_ct_AR@ 409 431 ac_ct_CC = @ac_ct_CC@ 410 432 ac_ct_CXX = @ac_ct_CXX@ 433 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 411 434 am__include = @am__include@ 412 435 am__leading_dot = @am__leading_dot@ … … 456 479 top_srcdir = @top_srcdir@ 457 480 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 481 ACLOCAL_AMFLAGS = -I automake 458 482 repeats = 10 459 483 max_time = 600 … … 503 527 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 504 528 $(am__aclocal_m4_deps): 529 530 mostlyclean-libtool: 531 -rm -f *.lo 532 533 clean-libtool: 534 -rm -rf .libs _libs 505 535 tags TAGS: 506 536 … … 806 836 clean: clean-am 807 837 808 clean-am: clean-generic clean-l ocal mostlyclean-am838 clean-am: clean-generic clean-libtool clean-local mostlyclean-am 809 839 810 840 distclean: distclean-am … … 858 888 mostlyclean: mostlyclean-am 859 889 860 mostlyclean-am: mostlyclean-generic 890 mostlyclean-am: mostlyclean-generic mostlyclean-libtool 861 891 862 892 pdf: pdf-am … … 873 903 874 904 .PHONY: all all-am all-local check check-TESTS check-am clean \ 875 clean-generic clean-local cscopelist-am ctags-am distclean \ 876 distclean-generic distdir dvi dvi-am html html-am info info-am \ 877 install install-am install-data install-data-am install-dvi \ 878 install-dvi-am install-exec install-exec-am install-html \ 879 install-html-am install-info install-info-am install-man \ 880 install-pdf install-pdf-am install-ps install-ps-am \ 881 install-strip installcheck installcheck-am installdirs \ 882 maintainer-clean maintainer-clean-generic mostlyclean \ 883 mostlyclean-generic pdf pdf-am ps ps-am recheck tags-am \ 905 clean-generic clean-libtool clean-local cscopelist-am ctags-am \ 906 distclean distclean-generic distclean-libtool distdir dvi \ 907 dvi-am html html-am info info-am install install-am \ 908 install-data install-data-am install-dvi install-dvi-am \ 909 install-exec install-exec-am install-html install-html-am \ 910 install-info install-info-am install-man install-pdf \ 911 install-pdf-am install-ps install-ps-am install-strip \ 912 installcheck installcheck-am installdirs maintainer-clean \ 913 maintainer-clean-generic mostlyclean mostlyclean-generic \ 914 mostlyclean-libtool pdf pdf-am ps ps-am recheck tags-am \ 884 915 uninstall uninstall-am 885 916 -
tests/preempt_longrun/create.c
rff5caaf r95b8aa7 3 3 #include <time.hfa> 4 4 5 #include "long_tests.h "5 #include "long_tests.hfa" 6 6 7 7 #ifndef PREEMPTION_RATE -
tests/preempt_longrun/enter3.c
rff5caaf r95b8aa7 5 5 6 6 #define __kick_rate 75000ul 7 #include "long_tests.h "7 #include "long_tests.hfa" 8 8 9 9 #ifndef PREEMPTION_RATE -
tests/preempt_longrun/processor.c
rff5caaf r95b8aa7 5 5 #include <unistd.h> 6 6 7 #include "long_tests.h "7 #include "long_tests.hfa" 8 8 9 9 #ifndef PREEMPTION_RATE -
tests/preempt_longrun/yield.c
rff5caaf r95b8aa7 4 4 5 5 #define __kick_rate 550000ul 6 #include "long_tests.h "6 #include "long_tests.hfa" 7 7 8 8 #ifndef PREEMPTION_RATE -
tests/pybin/tools.py
rff5caaf r95b8aa7 79 79 def diff( lhs, rhs ): 80 80 # diff the output of the files 81 diff_cmd = ("diff --ignore-all-space --text " 82 "--ignore-blank-lines " 81 diff_cmd = ("diff --text " 82 # "--ignore-all-space " 83 # "--ignore-blank-lines " 83 84 "--old-group-format='\t\tmissing lines :\n" 84 85 "%%<' \\\n" … … 246 247 if column: 247 248 cmd = "%s 2> /dev/null" % column 248 print(cmd)249 249 proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True) 250 proc.communicate(input=text )250 proc.communicate(input=text + "\n") 251 251 else: 252 252 print(text) -
tests/quotedKeyword.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // quoted _keyword.c-- test quoted keyword usage7 // quotedKeyword.cfa -- test quoted keyword usage 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jun 30 14:03:59 201613 // Update Count : 1912 // Last Modified On : Tue Dec 4 21:45:53 2018 13 // Update Count : 23 14 14 // 15 15 … … 41 41 st.`struct` = 3; 42 42 `throw` = 4; 43 sout | `catch` + st.`otype` + st.`struct` + `throw` | endl;43 sout | `catch` + st.`otype` + st.`struct` + `throw`; 44 44 } 45 45 46 46 // Local Variables: // 47 47 // tab-width: 4 // 48 // compile-command: "cfa quoted _keyword.c" //48 // compile-command: "cfa quotedKeyword.cfa" // 49 49 // End: // -
tests/raii/.expect/ctor-autogen-ERR1.txt
rff5caaf r95b8aa7 1 raii/ctor-autogen.c :102:1 error: Unique best alternative includes deleted identifier in Cast of:1 raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Cast of: 2 2 Application of 3 3 Deleted Expression 4 4 Variable Expression: ?{}: static inline function 5 5 ... with parameters 6 _dst: reference to instance of struct Managed with body 1 6 _dst: reference to instance of struct Managed with body 1 7 7 x: signed int 8 ... returning nothing 8 ... returning nothing 9 9 10 10 ... deleted by: ?{}: function 11 11 ... with parameters 12 m: reference to instance of struct Managed with body 1 13 ... returning nothing 14 ... with body 12 m: reference to instance of struct Managed with body 1 13 ... returning nothing 14 ... with body 15 15 CompoundStmt 16 16 Expression Statement: … … 20 20 intrinsic reference to signed int 21 21 intrinsic signed int 22 ... returning 22 ... returning 23 23 _retval__operator_assign: signed int 24 ... with attributes: 24 ... with attributes: 25 25 Attribute with name: unused 26 26 … … 28 28 ... to arguments 29 29 Cast of: 30 Member Expression, with field: 30 Member Expression, with field: 31 31 x: signed int 32 ... from aggregate: 32 ... from aggregate: 33 33 Cast of: 34 Variable Expression: m: reference to instance of struct Managed with body 1 34 Variable Expression: m: reference to instance of struct Managed with body 1 35 35 ... to: 36 instance of struct Managed with body 1 36 instance of struct Managed with body 1 37 37 ... to: 38 38 reference to signed int … … 49 49 ... to arguments 50 50 Cast of: 51 Variable Expression: x: instance of struct Managed with body 1 51 Variable Expression: x: instance of struct Managed with body 1 52 52 ... to: 53 reference to instance of struct Managed with body 1 53 reference to instance of struct Managed with body 1 54 54 constant expression (123 123: signed int) 55 55 -
tests/raii/.expect/dtor-early-exit-ERR1.txt
rff5caaf r95b8aa7 1 raii/dtor-early-exit.c :150:1 error: jump to label 'L1' crosses initialization of y Branch (Goto)1 raii/dtor-early-exit.cfa:150:1 error: jump to label 'L1' crosses initialization of y Branch (Goto) 2 2 with target: L1 3 3 with original target: L1 -
tests/raii/.expect/dtor-early-exit-ERR2.txt
rff5caaf r95b8aa7 1 raii/dtor-early-exit.c :214:1 error: jump to label 'L2' crosses initialization of y Branch (Goto)1 raii/dtor-early-exit.cfa:214:1 error: jump to label 'L2' crosses initialization of y Branch (Goto) 2 2 with target: L2 3 3 with original target: L2 -
tests/raii/.expect/memberCtors-ERR1.txt
rff5caaf r95b8aa7 1 raii/memberCtors.c :71:1 error: in void ?{}(B &b), field a2 used before being constructed1 raii/memberCtors.cfa:71:1 error: in void ?{}(B &b), field a2 used before being constructed -
tests/raii/dtor-early-exit.cfa
rff5caaf r95b8aa7 10 10 // Created On : Wed Aug 17 08:26:25 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 11 07:58:39 201813 // Update Count : 812 // Last Modified On : Fri Dec 21 08:45:19 2018 13 // Update Count : 10 14 14 // 15 15 … … 25 25 // don't want these called 26 26 void ?{}(A & a) { assert( false ); } 27 void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name | endl; a.x = (int*)malloc(); }27 void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name; a.x = (int*)malloc(); } 28 28 void ?{}(A & a, const char * name, int * ptr) { assert( false ); } 29 29 30 30 A ?=?(A & a, A b) { sout | "assign " | a.name | " " | b.name; return a; } 31 void ?{}(A & a, A b) { sout | "copy construct " | b.name | endl; a.x = (int*)malloc(); }32 void ^?{}(A & a) { sout | "destruct " | a.name | endl; free(a.x); }31 void ?{}(A & a, A b) { sout | "copy construct " | b.name; a.x = (int*)malloc(); } 32 void ^?{}(A & a) { sout | "destruct " | a.name; free(a.x); } 33 33 34 34 // test returns 35 35 void f(int i) { 36 sout | "f i=" | i | endl;36 sout | "f i=" | i; 37 37 A x = { "x" }; // construct x 38 38 { … … 55 55 void g() { 56 56 for (int i = 0; i < 10; i++) { 57 sout | "g for i=" | i | endl;57 sout | "g for i=" | i; 58 58 A x = { "x" }; 59 59 // construct x 60 60 // destruct x 61 61 } 62 sout | endl;62 sout | nl; 63 63 { 64 64 int i = 0; 65 65 while (i < 10) { 66 sout | "g while i=" | i | endl;66 sout | "g while i=" | i; 67 67 A x = { "x" }; 68 68 // construct x … … 71 71 } 72 72 } 73 sout | endl;73 sout | nl; 74 74 for (int i = 0; i < 10; i++) { 75 75 switch(10) { … … 78 78 case 10: { 79 79 A y = { "y" }; 80 sout | "g switch i=" | i | endl;80 sout | "g switch i=" | i; 81 81 // construct y 82 82 break; // destruct y 83 83 } 84 84 default: { 85 sout | "g switch i=" | i | endl;85 sout | "g switch i=" | i; 86 86 A x = { "x" }; 87 87 // construct x … … 90 90 } 91 91 } 92 sout | endl;92 sout | nl; 93 93 for (int k = 0; k < 2; k++) { 94 sout | "g for k=" | k | endl;94 sout | "g for k=" | k; 95 95 L1: for (int i = 0; i < 10; i++) { 96 sout | "g for i=" | i | endl;96 sout | "g for i=" | i; 97 97 98 98 A x = { "x" }; 99 99 if (i == 2) { 100 sout | "continue L1" | endl;100 sout | "continue L1"; 101 101 continue; // destruct x 102 102 } else if (i == 3) { 103 sout | "break L1" | endl;103 sout | "break L1"; 104 104 break; // destruct x 105 105 } 106 106 107 107 L2: for (int j = 0; j < 10; j++) { 108 sout | "g for j=" | j | endl;108 sout | "g for j=" | j; 109 109 A y = { "y" }; 110 110 if (j == 0) { 111 sout | "continue L2" | endl;111 sout | "continue L2"; 112 112 continue; // destruct y - missing because object that needs to be destructed is not a part of this block, it's a part of the for's block 113 113 } else if (j == 1) { 114 sout | "break L2" | endl;114 sout | "break L2"; 115 115 break; // destruct y 116 116 } else if (i == 1) { 117 sout | "continue L1" | endl;117 sout | "continue L1"; 118 118 continue L1; // destruct x,y - note: continue takes you to destructors for block, so only generate destructor for y 119 119 } else if (k == 1) { 120 sout | "break L1" | endl;120 sout | "break L1"; 121 121 break L1; // destruct x,y 122 122 } … … 125 125 } 126 126 127 sout | endl;127 sout | nl; 128 128 L3: if( 3 ) { 129 129 A w = { "w" }; 130 130 if( 4 ) { 131 131 A v = { "v" }; 132 sout | "break L3" | endl;132 sout | "break L3"; 133 133 break L3; 134 134 } … … 144 144 // * if S_L-S_G is non-empty, error 145 145 // * emit destructors for all variables in S_G-S_L 146 sout | "h" | endl;146 sout | "h"; 147 147 { 148 148 L0: ; … … 152 152 A y = { "y" }; 153 153 // S_L1 = { y } 154 L1: sout | "L1" | endl;154 L1: sout | "L1"; 155 155 A x = { "x" }; 156 156 // S_L2 = { y, x } 157 L2: sout | "L2" | endl;157 L2: sout | "L2"; 158 158 if (i == 0) { 159 159 ++i; 160 sout | "goto L1" | endl;160 sout | "goto L1"; 161 161 // S_G = { y, x } 162 162 goto L1; // jump back, destruct b/c before x definition … … 165 165 } else if (i == 1) { 166 166 ++i; 167 sout | "goto L2" | endl;167 sout | "goto L2"; 168 168 // S_G = { y, x } 169 169 goto L2; // jump back, do not destruct … … 172 172 } else if (i == 2) { 173 173 ++i; 174 sout | "goto L3" | endl;174 sout | "goto L3"; 175 175 // S_G = { y, x } 176 176 goto L3; // jump ahead, do not destruct … … 180 180 ++i; 181 181 A z = { "z" }; 182 sout | "goto L3-2" | endl;182 sout | "goto L3-2"; 183 183 // S_G = { z, y, x } 184 184 goto L3; … … 187 187 } else { 188 188 ++i; 189 sout | "goto L4" | endl;189 sout | "goto L4"; 190 190 // S_G = { y, x } 191 191 goto L4; // jump ahead, destruct b/c left block x was defined in … … 194 194 } 195 195 // S_L3 = { y, x } 196 L3: sout | "L3" | endl;197 sout | "goto L2-2" | endl;196 L3: sout | "L3"; 197 sout | "goto L2-2"; 198 198 // S_G = { y, x } 199 199 goto L2; // jump back, do not destruct … … 202 202 } 203 203 // S_L4 = {} 204 L4: sout | "L4" | endl;204 L4: sout | "L4"; 205 205 if (i == 4) { 206 sout | "goto L0" | endl;206 sout | "goto L0"; 207 207 // S_G = {} 208 208 goto L0; … … 240 240 f(i); 241 241 } 242 sout | endl;242 sout | nl; 243 243 g(); 244 sout | endl;244 sout | nl; 245 245 h(); 246 246 -
tests/raii/globals.cfa
rff5caaf r95b8aa7 70 70 71 71 int main() { 72 sout | "static\t\tinline\t\tautogen\t\tvalue" | endl;72 sout | "static\t\tinline\t\tautogen\t\tvalue"; 73 73 74 sout | "no \t\tno \t\tno \t\t" | g.val.value | endl;75 sout | "no \t\tno \t\tyes\t\t" | ga.val.value | endl;76 sout | "no \t\tyes\t\tno \t\t" | gi.val.value | endl;77 sout | "no \t\tyes\t\tyes\t\t" | gia.val.value | endl;78 sout | "yes\t\tno \t\tno \t\t" | gs.val.value | endl;79 sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value | endl;80 sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value | endl;81 sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value | endl;74 sout | "no \t\tno \t\tno \t\t" | g.val.value; 75 sout | "no \t\tno \t\tyes\t\t" | ga.val.value; 76 sout | "no \t\tyes\t\tno \t\t" | gi.val.value; 77 sout | "no \t\tyes\t\tyes\t\t" | gia.val.value; 78 sout | "yes\t\tno \t\tno \t\t" | gs.val.value; 79 sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value; 80 sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value; 81 sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value; 82 82 83 83 } -
tests/random.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // random.c --7 // random.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Jul 5 21:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:19:34201813 // Update Count : 1912 // Last Modified On : Tue Dec 4 21:46:25 2018 13 // Update Count : 22 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <stdlib.hfa> 17 #include <stdlib.hfa> // random 18 18 #include <unistd.h> // getpid 19 19 … … 24 24 // test polymorphic calls to random and stream 25 25 char c = random(); 26 sout | c | endl;26 sout | c; 27 27 c = random( 'A' ); 28 sout | c | endl;28 sout | c; 29 29 c = random( 'A', 'Z' ); 30 sout | c | endl;30 sout | c; 31 31 32 32 int i = random(); 33 sout | i | endl;33 sout | i; 34 34 i = random( 10 ); 35 sout | i | endl;35 sout | i; 36 36 i = random( -10, 20 ); 37 sout | i | endl;37 sout | i; 38 38 39 39 unsigned int ui = random(); 40 sout | ui | endl;40 sout | ui; 41 41 ui = random( 10u ); 42 sout | ui | endl;42 sout | ui; 43 43 ui = random( 10u, 20u ); 44 sout | ui | endl;44 sout | ui; 45 45 46 46 long int li = random(); 47 sout | li | endl;47 sout | li; 48 48 li = random( 10l ); 49 sout | li | endl;49 sout | li; 50 50 li = random( -10l, 20l ); 51 sout | li | endl;51 sout | li; 52 52 53 53 unsigned long int uli = random(); 54 sout | uli | endl;54 sout | uli; 55 55 uli = random( 10ul ); 56 sout | uli | endl;56 sout | uli; 57 57 uli = random( 10ul, 20ul ); 58 sout | uli | endl;58 sout | uli; 59 59 60 60 float f = random(); 61 sout | f | endl;61 sout | f; 62 62 63 63 double d = random(); 64 sout | d | endl;64 sout | d; 65 65 66 66 float _Complex fc = random(); 67 sout | fc | endl;67 sout | fc; 68 68 69 69 double _Complex dc = random(); 70 sout | dc | endl;70 sout | dc; 71 71 72 72 long double _Complex ldc = random(); 73 sout | ldc | endl;73 sout | ldc; 74 74 } // main 75 75 76 76 // Local Variables: // 77 77 // tab-width: 4 // 78 // compile-command: "cfa random.c " //78 // compile-command: "cfa random.cfa" // 79 79 // End: // -
tests/rational.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // rational.c -- test rational number package7 // rational.cfa -- test rational number package 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Mon Mar 28 08:43:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Oct 10 23:25:04 201713 // Update Count : 6 712 // Last Modified On : Tue Dec 4 21:46:42 2018 13 // Update Count : 69 14 14 // 15 15 … … 27 27 28 28 int main() { 29 sout | "constructor" | endl;29 sout | "constructor"; 30 30 Rational(int) a = { 3 }, b = { 4 }, c; 31 sout | a | b | c | endl;31 sout | a | b | c; 32 32 33 33 a = (Rational(int)){ 4, 8 }; 34 34 b = (Rational(int)){ 5, 7 }; 35 sout | a | b | endl;35 sout | a | b; 36 36 a = (Rational(int)){ -2, -3 }; 37 37 b = (Rational(int)){ 3, -2 }; 38 sout | a | b | endl;38 sout | a | b; 39 39 a = (Rational(int)){ -2, 3 }; 40 40 b = (Rational(int)){ 3, 2 }; 41 sout | a | b | endl;41 sout | a | b; 42 42 43 sout | "logical" | endl;43 sout | "logical"; 44 44 a = (Rational(int)){ -2 }; 45 45 b = (Rational(int)){ -3, 2 }; 46 sout | a | b | endl;47 // sout | a == 1 | endl; // FIX ME48 sout | a != b | endl;49 sout | a < b | endl;50 sout | a <= b | endl;51 sout | a > b | endl;52 sout | a >= b | endl;46 sout | a | b; 47 // sout | a == 1; // FIX ME 48 sout | a != b; 49 sout | a < b; 50 sout | a <= b; 51 sout | a > b; 52 sout | a >= b; 53 53 54 sout | "arithmetic" | endl;55 sout | a | b | endl;56 sout | a + b | endl;57 sout | a - b | endl;58 sout | a * b | endl;59 sout | a / b | endl;54 sout | "arithmetic"; 55 sout | a | b; 56 sout | a + b; 57 sout | a - b; 58 sout | a * b; 59 sout | a / b; 60 60 61 sout | "conversion" | endl;61 sout | "conversion"; 62 62 a = (Rational(int)){ 3, 4 }; 63 sout | widen( a ) | endl;63 sout | widen( a ); 64 64 a = (Rational(int)){ 1, 7 }; 65 sout | widen( a ) | endl;65 sout | widen( a ); 66 66 a = (Rational(int)){ 355, 113 }; 67 sout | widen( a ) | endl;68 sout | narrow( 0.75, 4 ) | endl;69 sout | narrow( 0.14285714285714, 16 ) | endl;70 sout | narrow( 3.14159265358979, 256 ) | endl;67 sout | widen( a ); 68 sout | narrow( 0.75, 4 ); 69 sout | narrow( 0.14285714285714, 16 ); 70 sout | narrow( 3.14159265358979, 256 ); 71 71 72 sout | "decompose" | endl;72 sout | "decompose"; 73 73 int n, d; 74 74 // [n, d] = a; 75 // sout | a | n | d | endl;75 // sout | a | n | d; 76 76 77 sout | "more tests" | endl;77 sout | "more tests"; 78 78 Rational(int) x = { 1, 2 }, y = { 2 }; 79 sout | x - y | endl;80 sout | x > y | endl;81 sout | x | numerator( x, 2 ) | x | endl;82 sout | y | denominator( y, -2 ) | y | endl;79 sout | x - y; 80 sout | x > y; 81 sout | x | numerator( x, 2 ) | x; 82 sout | y | denominator( y, -2 ) | y; 83 83 84 84 Rational(int) z = { 0, 5 }; 85 sout | z | endl;85 sout | z; 86 86 87 sout | x | numerator( x, 0 ) | x | endl;87 sout | x | numerator( x, 0 ) | x; 88 88 89 89 x = (Rational(int)){ 1, MAX } + (Rational(int)){ 1, MAX }; 90 sout | x | endl;90 sout | x; 91 91 x = (Rational(int)){ 3, MAX } + (Rational(int)){ 2, MAX }; 92 sout | x | endl;92 sout | x; 93 93 94 94 sin | a | b; 95 sout | a | b | endl;95 sout | a | b; 96 96 } // main 97 97 98 98 // Local Variables: // 99 99 // tab-width: 4 // 100 // compile-command: "cfa rational.c " //100 // compile-command: "cfa rational.cfa" // 101 101 // End: // -
tests/searchsort.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // searchsort.c --7 // searchsort.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Feb 4 18:17:50 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 9 07:54:57201813 // Update Count : 10 112 // Last Modified On : Thu Dec 20 22:49:46 2018 13 // Update Count : 108 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <stdlib.hfa> 17 #include <stdlib.hfa> // bsearch, qsort 18 18 #include <stdlib.h> // C version of bsearch 19 19 … … 24 24 int iarr[size]; 25 25 26 sout | nlOff; // turn off auto newline 27 26 28 for ( i; 0 ~ size ) { 27 29 iarr[i] = size - i; 28 30 sout | iarr[i] | ", "; 29 31 } // for 30 sout | endl | endl;32 sout | nl | nl; 31 33 32 34 // ascending sort/search by changing < to > … … 35 37 sout | iarr[i] | ", "; 36 38 } // for 37 sout | endl;39 sout | nl; 38 40 for ( i; 0 ~ size ) { // C version 39 41 int key = size - i; … … 41 43 sout | key | ':' | *v | ", "; 42 44 } // for 43 sout | endl;45 sout | nl; 44 46 45 47 for ( i; 0 ~ size ) { … … 47 49 sout | size - i | ':' | *v | ", "; 48 50 } // for 49 sout | endl;51 sout | nl; 50 52 for ( i; 0 ~ size ) { 51 53 unsigned int posn = bsearch( size - i, iarr, size ); 52 54 sout | size - i | ':' | iarr[posn] | ", "; 53 55 } // for 54 sout | endl | endl;56 sout | nl | nl; 55 57 56 58 // descending sort/search by changing < to > … … 59 61 sout | iarr[i] | ", "; 60 62 } // for 61 sout | endl;63 sout | nl; 62 64 { 63 65 // redefinition of ?<? can't overlap the loop controls: 64 //int ?<?( int x, int y ) { return x > y; }65 66 { 66 67 int (*?<?)(int, int) = ?>?; … … 70 71 sout | iarr[i] | ", "; 71 72 } // for 72 sout | endl;73 sout | nl; 73 74 for ( i; 0 ~ size ) { 74 75 int (*?<?)(int, int) = ?>?; … … 76 77 sout | size - i | ':' | *v | ", "; 77 78 } // for 78 sout | endl;79 sout | nl; 79 80 for ( i; 0 ~ size ) { 80 81 int (*?<?)(int, int) = ?>?; … … 83 84 } // for 84 85 } 85 sout | endl | endl;86 sout | nl | nl; 86 87 87 88 double darr[size]; … … 90 91 sout | darr[i] | ", "; 91 92 } // for 92 sout | endl;93 sout | nl; 93 94 qsort( darr, size ); 94 95 for ( i; 0 ~ size ) { 95 96 sout | darr[i] | ", "; 96 97 } // for 97 sout | endl;98 sout | nl; 98 99 for ( i; 0 ~ size ) { 99 100 double * v = bsearch( size - i + 0.5, darr, size ); 100 101 sout | size - i + 0.5 | ':' | *v | ", "; 101 102 } // for 102 sout | endl;103 sout | nl; 103 104 for ( i; 0 ~ size ) { 104 105 unsigned int posn = bsearch( size - i + 0.5, darr, size ); 105 106 sout | size - i + 0.5 | ':' | darr[posn] | ", "; 106 107 } // for 107 sout | endl | endl;108 sout | nl | nl; 108 109 109 110 struct S { int i, j; } sarr[size]; … … 115 116 sout | sarr[i] | ", "; 116 117 } // for 117 sout | endl;118 sout | nl; 118 119 qsort( sarr, size ); 119 120 for ( i; 0 ~ size ) { 120 121 sout | sarr[i] | ", "; 121 122 } // for 122 sout | endl;123 sout | nl; 123 124 for ( i; 0 ~ size ) { 124 125 S temp = { size - i, size - i + 1 }; … … 126 127 sout | temp | ':' | *v | ", "; 127 128 } // for 128 sout | endl;129 sout | nl; 129 130 for ( i; 0 ~ size ) { 130 131 S temp = { size - i, size - i + 1 }; … … 132 133 sout | temp | ':' | sarr[posn] | ", "; 133 134 } // for 134 sout | endl | endl;135 sout | nl | nl; 135 136 { 136 137 int getKey( const S & s ) { return s.j; } … … 138 139 sout | sarr[i] | ", "; 139 140 } // for 140 sout | endl;141 sout | nl; 141 142 for ( i; 0 ~ size ) { 142 143 S * v = bsearch( size - i + 1, sarr, size ); 143 144 sout | size - i + 1 | ':' | *v | ", "; 144 145 } // for 145 sout | endl;146 sout | nl; 146 147 for ( i; 0 ~ size ) { 147 148 unsigned int posn = bsearch( size - i + 1, sarr, size ); 148 149 sout | size - i + 1 | ':' | sarr[posn] | ", "; 149 150 } // for 150 sout | endl | endl;151 sout | nl | nl; 151 152 } 152 153 } // main … … 154 155 // Local Variables: // 155 156 // tab-width: 4 // 156 // compile-command: "cfa searchsort.c " //157 // compile-command: "cfa searchsort.cfa" // 157 158 // End: // -
tests/stdincludes.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // stdincludes.c --7 // stdincludes.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Aug 29 08:26:14 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 30 07:56:39 201713 // Update Count : 512 // Last Modified On : Tue Nov 6 18:00:53 2018 13 // Update Count : 6 14 14 // 15 15 … … 51 51 // Local Variables: // 52 52 // tab-width: 4 // 53 // compile-command: "cfa stdincludes.c " //53 // compile-command: "cfa stdincludes.cfa" // 54 54 // End: // -
tests/sum.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // sum.c -- test resolvers ability to deal with many variables with the same name and to use the minimum number of casts8 // necessary to disambiguate overloaded variable names.7 // sum.cfa -- test resolvers ability to deal with many variables with the same name and to use the minimum number of 8 // casts necessary to disambiguate overloaded variable names. 9 9 // 10 10 // Author : Peter A. Buhr 11 11 // Created On : Wed May 27 17:56:53 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Thu Aug 2 08:03:09201814 // Update Count : 2 7913 // Last Modified On : Sun Dec 23 23:00:38 2018 14 // Update Count : 287 15 15 // 16 16 … … 56 56 } // for 57 57 sout | "sum from" | low | "to" | High | "is" 58 | sum( size, (unsigned char *)a ) | ", check" | (int)s | endl;58 | sum( size, (unsigned char *)a ) | ", check" | (int)s; 59 59 60 60 int s = 0, a[size], v = low; … … 64 64 } // for 65 65 sout | "sum from" | low | "to" | High | "is" 66 | sum( size, (int *)a ) | ", check" | (int)s | endl;66 | sum( size, (int *)a ) | ", check" | (int)s; 67 67 68 68 float s = 0.0f, a[size], v = low / 10.0f; … … 72 72 } // for 73 73 sout | "sum from" | low / 10.0f | "to" | High / 10.0f | "is" 74 | sum( size, (float *)a ) | ", check" | (float)s | endl;74 | sum( size, (float *)a ) | ", check" | (float)s; 75 75 76 76 double s = 0.0, a[size], v = low / 10.0; … … 80 80 } // for 81 81 sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is" 82 | sum( size, (double *)a ) | ", check" | (double)s | endl;82 | sum( size, (double *)a ) | ", check" | (double)s; 83 83 84 84 struct S { int i, j; }; … … 93 93 S ?++( S & t ) { S temp = t; t += (S){1}; return temp; } 94 94 ofstream & ?|?( ofstream & os, S v ) { return os | v.i | v.j; } 95 void ?|?( ofstream & os, S v ) { (ofstream &)(os | v); nl( os ); } 95 96 96 97 S s = (S){0}, a[size], v = { low, low }; … … 100 101 } // for 101 102 sout | "sum from" | low | "to" | High | "is" 102 | sum( size, (S *)a ) | ", check" | (S)s | endl;103 | sum( size, (S *)a ) | ", check" | (S)s; 103 104 104 105 forall( otype Impl | sumable( Impl ) ) … … 114 115 } // for 115 116 sout | "sum from" | low | "to" | High | "is" 116 | sum( size, gs.x ) | ", check" | (int)s | endl;// add field array in generic type117 | sum( size, gs.x ) | ", check" | (int)s; // add field array in generic type 117 118 delete( gs.x ); 118 119 } // main … … 120 121 // Local Variables: // 121 122 // tab-width: 4 // 122 // compile-command: "cfa sum.c " //123 // compile-command: "cfa sum.cfa" // 123 124 // End: // -
tests/swap.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // swap.c --7 // swap.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 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 7 09:13:13 201713 // Update Count : 7 112 // Last Modified On : Sun Dec 23 23:00:49 2018 13 // Update Count : 77 14 14 // 15 15 … … 19 19 int main( void ) { 20 20 char c1 = 'a', c2 = 'b'; 21 sout | "char\t\t\t" | c1 | ' ' | c2 | "\t\t\tswap " ;21 sout | "char\t\t\t" | c1 | ' ' | c2 | "\t\t\tswap " | nonl; 22 22 swap( c1, c2 ); 23 sout | '\t' | c1 | ' ' | c2 | endl;23 sout | '\t' | c1 | ' ' | c2; 24 24 25 25 signed int i1 = -1, i2 = -2; 26 sout | "signed int\t\t" | i1 | i2 | "\t\t\tswap " ;26 sout | "signed int\t\t" | i1 | i2 | "\t\t\tswap " | nonl; 27 27 swap( i1, i2 ); 28 sout | '\t' | i1 | i2 | endl;28 sout | '\t' | i1 | i2; 29 29 30 30 unsigned int ui1 = 1, ui2 = 2; 31 sout | "unsigned int\t\t" | ui1 | ui2 | "\t\t\tswap " ;31 sout | "unsigned int\t\t" | ui1 | ui2 | "\t\t\tswap " | nonl; 32 32 swap( ui1, ui2 ); 33 sout | '\t' | ui1 | ui2 | endl;33 sout | '\t' | ui1 | ui2; 34 34 35 35 signed long int li1 = -1, li2 = -2; 36 sout | "signed long int\t\t" | li1 | li2 | "\t\t\tswap " ;36 sout | "signed long int\t\t" | li1 | li2 | "\t\t\tswap " | nonl; 37 37 swap( li1, li2 ); 38 sout | '\t' | li1 | li2 | endl;38 sout | '\t' | li1 | li2; 39 39 40 40 unsigned long int uli1 = 1, uli2 = 2; 41 sout | "unsigned long int\t" | uli1 | uli2 | "\t\t\tswap " ;41 sout | "unsigned long int\t" | uli1 | uli2 | "\t\t\tswap " | nonl; 42 42 swap( uli1, uli2 ); 43 sout | '\t' | uli1 | uli2 | endl;43 sout | '\t' | uli1 | uli2; 44 44 45 45 signed long long int lli1 = -1, lli2 = -2; 46 sout | "signed long long int\t" | lli1 | lli2 | "\t\t\tswap " ;46 sout | "signed long long int\t" | lli1 | lli2 | "\t\t\tswap " | nonl; 47 47 swap( lli1, lli2 ); 48 sout | '\t' | lli1 | lli2 | endl;48 sout | '\t' | lli1 | lli2; 49 49 50 50 unsigned long long int ulli1 = 1, ulli2 = 2; 51 sout | "unsigned long long int\t" | ulli1 | ulli2 | "\t\t\tswap " ;51 sout | "unsigned long long int\t" | ulli1 | ulli2 | "\t\t\tswap " | nonl; 52 52 swap( ulli1, ulli2 ); 53 sout | '\t' | ulli1 | ulli2 | endl;53 sout | '\t' | ulli1 | ulli2; 54 54 55 55 float f1 = 1.5, f2 = 2.5; 56 sout | "float\t\t\t" | f1 | f2 | "\t\t\tswap " ;56 sout | "float\t\t\t" | f1 | f2 | "\t\t\tswap " | nonl; 57 57 swap( f1, f2 ); 58 sout | '\t' | f1 | f2 | endl;58 sout | '\t' | f1 | f2; 59 59 60 60 double d1 = 1.5, d2 = 2.5; 61 sout | "double\t\t\t" | d1 | d2 | "\t\t\tswap " ;61 sout | "double\t\t\t" | d1 | d2 | "\t\t\tswap " | nonl; 62 62 swap( d1, d2 ); 63 sout | '\t' | d1 | d2 | endl;63 sout | '\t' | d1 | d2; 64 64 65 65 long double ld1 = 1.5, ld2 = 2.5; 66 sout | "long double\t\t" | ld1 | ld2 | "\t\t\tswap " ;66 sout | "long double\t\t" | ld1 | ld2 | "\t\t\tswap " | nonl; 67 67 swap( ld1, ld2 ); 68 sout | '\t' | ld1 | ld2 | endl;68 sout | '\t' | ld1 | ld2; 69 69 70 70 float _Complex fc1 = 1.5f+1.5if, fc2 = 2.5f+2.5if; 71 sout | "float _Complex\t\t" | fc1 | fc2 | "\tswap " ;71 sout | "float _Complex\t\t" | fc1 | fc2 | "\tswap " | nonl; 72 72 swap( fc1, fc2 ); 73 sout | '\t' | fc1 | fc2 | endl;73 sout | '\t' | fc1 | fc2; 74 74 75 75 double _Complex dc1 = 1.5d+1.5id, dc2 = 2.5d+2.5id; 76 sout | "double _Complex\t\t" | dc1 | dc2 | "\tswap " ;76 sout | "double _Complex\t\t" | dc1 | dc2 | "\tswap " | nonl; 77 77 swap( dc1, dc2 ); 78 sout | '\t' | dc1 | dc2 | endl;78 sout | '\t' | dc1 | dc2; 79 79 80 80 long double _Complex ldc1 = 1.5d+1.5il, ldc2 = 2.5d+2.5il; 81 sout | "long double _Complex\t" | ldc1 | ldc2 | "\tswap " ;81 sout | "long double _Complex\t" | ldc1 | ldc2 | "\tswap " | nonl; 82 82 swap( ldc1, ldc2 ); 83 sout | '\t' | ldc1 | ldc2 | endl;83 sout | '\t' | ldc1 | ldc2; 84 84 85 85 struct S { int i, j; } s1 = { 1, 2 }, s2 = { 2, 1 }; 86 86 ofstream & ?|?( ofstream & os, S s ) { return os | s.i | s.j; } 87 sout | "struct S\t\t" | s1 | "," | s2 | "\t\tswap "; 87 void ?|?( ofstream & os, S s ) { (ofstream &)(os | s.i | s.j); nl( os ); } 88 sout | "struct S\t\t" | s1 | "," | s2 | "\t\tswap " | nonl; 88 89 swap( s1, s2 ); 89 sout | '\t' | s1 | "," | s2 | endl;90 sout | '\t' | s1 | "," | s2; 90 91 } // main 91 92 92 93 // Local Variables: // 93 94 // tab-width: 4 // 94 // compile-command: "cfa swap.c " //95 // compile-command: "cfa swap.cfa" // 95 96 // End: // -
tests/switch.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // switch.c --7 // switch.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Jul 12 06:50:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 07:33:05201813 // Update Count : 3 612 // Last Modified On : Tue Nov 6 18:01:34 2018 13 // Update Count : 37 14 14 // 15 15 … … 104 104 // Local Variables: // 105 105 // tab-width: 4 // 106 // compile-command: "cfa switch.c " //106 // compile-command: "cfa switch.cfa" // 107 107 // End: // -
tests/test.py
rff5caaf r95b8aa7 19 19 20 20 def matchTest(path): 21 match = re.search(" %s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt" % settings.SRCDIR, path)21 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path) 22 22 if match : 23 23 test = Test() … … 34 34 # reads the directory ./.expect and indentifies the tests 35 35 def listTests( includes, excludes ): 36 includes = [canonicalPath( i ) for i in includes] if includes else None37 excludes = [canonicalPath( i ) for i in excludes] if excludes else None38 39 36 # tests directly in the .expect folder will always be processed 40 37 test_list = findTests() -
tests/tuple/tupleAssign.cfa
rff5caaf r95b8aa7 10 10 // Created On : Tue Nov 15 17:24:32 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 6 21:23:58 201713 // Update Count : 3 412 // Last Modified On : Tue Dec 4 22:03:48 2018 13 // Update Count : 35 14 14 // 15 15 … … 24 24 // swap x, y and store the new [x, y] in [u, v] and in z; 25 25 printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z ); 26 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;26 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]"; 27 27 z = [u, v] = [x, y] = [y, x]; 28 28 printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z ); 29 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;29 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]"; 30 30 31 31 // shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v 32 32 [v, z, u] = [z, u, v]; 33 33 printf( "u=%d v=%d z=[%d, %d]\n", u, v, z ); 34 sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;34 sout | "u=" | u | "v=" | v | "z=[" | z | "]"; 35 35 36 36 // multiple assignment with tuple expression on right … … 38 38 [u, v] = [123, 456]; 39 39 printf( "u=%d v=%d z=[%d, %d]\n", u, v, z ); 40 sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;40 sout | "u=" | u | "v=" | v | "z=[" | z | "]"; 41 41 } 42 42 { … … 55 55 [t, x, d, i, c, x] = (double)94.12; 56 56 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t ); 57 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;57 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]"; 58 58 [x, c, i, d, x, t] = (double)-94.12; 59 59 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t ); 60 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;60 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]"; 61 61 } 62 62 } -
tests/userLiterals.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // user_literals.c --7 // user_literals.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Sep 6 21:40:50 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 29 16:51:42201813 // Update Count : 5 412 // Last Modified On : Tue Dec 4 22:03:10 2018 13 // Update Count : 56 14 14 // 15 15 … … 18 18 #include <uchar.h> 19 19 20 int ?`s( int s ) { sout | "secs" | s | endl; return s; }21 int ?`m( int m ) { sout | "mins" | m | endl; return m * 60; }22 int ?`h( int h ) { sout | "hours" | h | endl; return h * 3600; }23 int ?`_A_( int x ) { sout | "_A_" | x | endl; return x; }24 int ?`__thingy_( int x ) { sout | "_thingy_" | x | endl; return x; }20 int ?`s( int s ) { sout | "secs" | s; return s; } 21 int ?`m( int m ) { sout | "mins" | m; return m * 60; } 22 int ?`h( int h ) { sout | "hours" | h; return h * 3600; } 23 int ?`_A_( int x ) { sout | "_A_" | x; return x; } 24 int ?`__thingy_( int x ) { sout | "_thingy_" | x; return x; } 25 25 26 int ?`s( const char * s ) { sout | "secs" | s | endl; return 0; }27 int ?`m( const char16_t * m ) { sout | "mins" | m | endl; return 0;}28 int ?`h( const char32_t * h ) { sout | "hours" | h | endl; return 0; }29 int ?`_A_( const wchar_t * str ) { sout | "_A_" | str | endl; return 0; }30 int ?`__thingy_( const char * str ) { sout | "_thingy_" | str | endl; return 0; }26 int ?`s( const char * s ) { sout | "secs" | s; return 0; } 27 int ?`m( const char16_t * m ) { sout | "mins" | m; return 0;} 28 int ?`h( const char32_t * h ) { sout | "hours" | h; return 0; } 29 int ?`_A_( const wchar_t * str ) { sout | "_A_" | str; return 0; } 30 int ?`__thingy_( const char * str ) { sout | "_thingy_" | str; return 0; } 31 31 32 32 … … 46 46 Weight w, heavy = { 20 }; // 20 stone 47 47 w = 155`lb; 48 sout | w | endl;48 sout | w; 49 49 w = 0b_1111`st; 50 sout | w | endl;50 sout | w; 51 51 w = 0_233`lb; // octal weight (155) 52 sout | w | endl;52 sout | w; 53 53 w = 0x_9b_u`kg; 54 sout | w | endl;54 sout | w; 55 55 w = 70.3`kg; 56 sout | w | endl;56 sout | w; 57 57 w = 11`st + 1`lb; 58 sout | w | endl;58 sout | w; 59 59 w = 5`st + 8`kg + 25`lb + heavy; 60 sout | w | endl;60 sout | w; 61 61 62 62 // 0`secs; … … 90 90 // Local Variables: // 91 91 // tab-width: 4 // 92 // compile-command: "cfa user_literals.c " //92 // compile-command: "cfa user_literals.cfa" // 93 93 // End: // -
tests/variableDeclarator.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // variableDeclarator.c --7 // variableDeclarator.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:41:42 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:42:21 201613 // Update Count : 112 // Last Modified On : Tue Nov 6 18:02:16 2018 13 // Update Count : 2 14 14 // 15 15 … … 182 182 // Local Variables: // 183 183 // tab-width: 4 // 184 // compile-command: "cfa variableDeclarator.c " //184 // compile-command: "cfa variableDeclarator.cfa" // 185 185 // End: // -
tests/vector.cfa
rff5caaf r95b8aa7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // vector.c --7 // vector.cfa -- 8 8 // 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Jul 4 23:36:19 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jan 18 17:08:08201813 // Update Count : 2 712 // Last Modified On : Tue Dec 4 22:02:39 2018 13 // Update Count : 29 14 14 // 15 15 … … 21 21 do { \ 22 22 if ( !(x) ) { \ 23 sout | "CHECK failed :" | #x | "at" | __FILE__ | " :" | __LINE__ | endl; \23 sout | "CHECK failed :" | #x | "at" | __FILE__ | " :" | __LINE__; \ 24 24 abort(); \ 25 25 } \ … … 31 31 assert( empty( &iv ) ); 32 32 assert( size( &iv ) == 0 ); 33 sout | size( &iv ) | endl;33 sout | size( &iv ); 34 34 35 35 push_back( &iv, 1 ); 36 36 assert( size( &iv ) == 1 ); 37 sout | size( &iv ) | endl;37 sout | size( &iv ); 38 38 39 39 push_back( &iv, 2 ); 40 40 assert( size( &iv ) == 2 ); 41 sout | size( &iv ) | endl;41 sout | size( &iv ); 42 42 43 43 push_back( &iv, 3 ); 44 44 assert( size( &iv ) == 3 ); 45 sout | size( &iv ) | endl;45 sout | size( &iv ); 46 46 47 47 assert( !empty( &iv ) ); … … 58 58 assert( empty( &iv ) ); 59 59 assert( size( &iv ) == 0 ); 60 sout | size( &iv ) | endl;60 sout | size( &iv ); 61 61 } 62 62 63 63 // Local Variables: // 64 64 // tab-width: 4 // 65 // compile-command: "cfa vector.c " //65 // compile-command: "cfa vector.cfa" // 66 66 // End: // -
tests/warnings/.expect/self-assignment.txt
rff5caaf r95b8aa7 1 warnings/self-assignment.c :29:1 warning: self assignment of expression: Cast of:1 warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Cast of: 2 2 Variable Expression: j: signed int 3 3 ... to: 4 4 reference to signed int 5 warnings/self-assignment.c :30:1 warning: self assignment of expression: Cast of:6 Variable Expression: s: instance of struct S with body 1 5 warnings/self-assignment.cfa:30:1 warning: self assignment of expression: Cast of: 6 Variable Expression: s: instance of struct S with body 1 7 7 ... to: 8 reference to instance of struct S with body 1 9 warnings/self-assignment.c :31:1 warning: self assignment of expression: Cast of:10 Member Expression, with field: 8 reference to instance of struct S with body 1 9 warnings/self-assignment.cfa:31:1 warning: self assignment of expression: Cast of: 10 Member Expression, with field: 11 11 i: signed int 12 ... from aggregate: 13 Variable Expression: s: instance of struct S with body 1 12 ... from aggregate: 13 Variable Expression: s: instance of struct S with body 1 14 14 ... to: 15 15 reference to signed int 16 warnings/self-assignment.c :32:1 warning: self assignment of expression: Cast of:17 Member Expression, with field: 16 warnings/self-assignment.cfa:32:1 warning: self assignment of expression: Cast of: 17 Member Expression, with field: 18 18 i: signed int 19 ... from aggregate: 20 Member Expression, with field: 21 s: instance of struct S with body 1 22 ... from aggregate: 23 Variable Expression: t: instance of struct T with body 1 19 ... from aggregate: 20 Member Expression, with field: 21 s: instance of struct S with body 1 22 ... from aggregate: 23 Variable Expression: t: instance of struct T with body 1 24 24 ... to: 25 25 reference to signed int
Note:
See TracChangeset
for help on using the changeset viewer.