- Timestamp:
- Aug 27, 2018, 4:40:34 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (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:
-
- 87 added
- 202 moved
-
.expect/KRfunctions.x64.txt (added)
-
.expect/KRfunctions.x86.txt (added)
-
.expect/abs.txt (moved) (moved from src/tests/.expect/abs.txt )
-
.expect/alloc-ERROR.txt (moved) (moved from src/tests/.expect/alloc-ERROR.txt ) (3 diffs)
-
.expect/alloc.txt (added)
-
.expect/array.txt (moved) (moved from src/tests/.expect/array.txt )
-
.expect/ato.txt (added)
-
.expect/attributes.x64.txt (added)
-
.expect/attributes.x86.txt (added)
-
.expect/avl_test.txt (moved) (moved from src/tests/.expect/avl_test.txt )
-
.expect/cast.txt (moved) (moved from src/tests/.expect/cast.txt )
-
.expect/castError.txt (moved) (moved from src/tests/.expect/castError.txt )
-
.expect/completeTypeError.txt (moved) (moved from src/tests/.expect/completeTypeError.txt )
-
.expect/complex.txt (moved) (moved from src/tests/.expect/complex.txt )
-
.expect/counter.txt (added)
-
.expect/declarationErrors.txt (moved) (moved from src/tests/.expect/declarationErrors.txt ) (1 diff)
-
.expect/declarationSpecifier.x64.txt (added)
-
.expect/declarationSpecifier.x86.txt (added)
-
.expect/designations.txt (moved) (moved from src/tests/.expect/designations.txt )
-
.expect/div.txt (moved) (moved from src/tests/.expect/div.txt )
-
.expect/enum.txt (moved) (moved from src/tests/.expect/enum.txt )
-
.expect/expression.txt (moved) (moved from src/tests/.expect/expression.txt )
-
.expect/extension.x64.txt (added)
-
.expect/extension.x86.txt (added)
-
.expect/fallthrough.txt (added)
-
.expect/forall.txt (moved) (moved from src/tests/.expect/identFuncDeclarator.txt )
-
.expect/forctrl.txt (added)
-
.expect/fstream_test.txt (added)
-
.expect/function-operator.txt (moved) (moved from src/tests/.expect/function-operator.txt )
-
.expect/functions.x64.txt (added)
-
.expect/functions.x86.txt (added)
-
.expect/gccExtensions.x64.txt (added)
-
.expect/gccExtensions.x86.txt (added)
-
.expect/genericUnion.txt (moved) (moved from src/tests/.expect/genericUnion.txt )
-
.expect/gmp.x64.txt (moved) (moved from src/tests/.expect/gmp.x64.txt )
-
.expect/heap.txt (moved) (moved from src/tests/.expect/identParamDeclarator.txt )
-
.expect/hello.txt (moved) (moved from src/tests/.expect/hello.txt )
-
.expect/identFuncDeclarator.txt (moved) (moved from src/tests/.expect/init_once.txt )
-
.expect/identParamDeclarator.txt (moved) (moved from src/tests/.expect/labelledExit.txt )
-
.expect/identity.txt (moved) (moved from src/tests/.expect/identity.txt )
-
.expect/ifwhileCtl.txt (added)
-
.expect/io1.txt (added)
-
.expect/io2.txt (moved) (moved from src/tests/.expect/io.txt ) (1 diff)
-
.expect/labelledExit.txt (moved) (moved from src/tests/.expect/limits.txt )
-
.expect/limits.txt (moved) (moved from src/tests/.expect/maybe.txt )
-
.expect/literals.txt (added)
-
.expect/math1.txt (moved) (moved from src/tests/.expect/math1.x64.txt ) (1 diff)
-
.expect/math2.txt (added)
-
.expect/math3.txt (moved) (moved from src/tests/.expect/math2.x64.txt ) (1 diff)
-
.expect/math4.txt (moved) (moved from src/tests/.expect/math3.x64.txt )
-
.expect/maybe.txt (moved) (moved from src/tests/.expect/numericConstants.txt )
-
.expect/minmax.txt (moved) (moved from src/tests/.expect/minmax.txt )
-
.expect/nested-types-ERR1.txt (added)
-
.expect/nested-types-ERR2.txt (added)
-
.expect/nested-types.txt (moved) (moved from src/tests/.expect/operators.txt )
-
.expect/numericConstants.txt (moved) (moved from src/tests/.expect/result.txt )
-
.expect/operators.txt (moved) (moved from src/tests/.expect/stdincludes.txt )
-
.expect/polymorphism.txt (moved) (moved from src/tests/.expect/polymorphism.txt )
-
.expect/quoted_keyword.txt (moved) (moved from src/tests/.expect/quoted_keyword.txt )
-
.expect/random.txt (added)
-
.expect/rational.txt (moved) (moved from src/tests/.expect/rational.txt )
-
.expect/references.txt (moved) (moved from src/tests/.expect/references.txt ) (2 diffs)
-
.expect/result.txt (moved) (moved from src/tests/.expect/switch.txt )
-
.expect/scopeErrors.txt (moved) (moved from src/tests/.expect/scopeErrors.txt )
-
.expect/searchsort.txt (added)
-
.expect/shortCircuit.txt (moved) (moved from src/tests/.expect/shortCircuit.txt )
-
.expect/simpleGenericTriple.txt (moved) (moved from src/tests/.expect/simpleGenericTriple.txt )
-
.expect/stdincludes.txt (moved) (moved from src/tests/.expect/typedefRedef.txt )
-
.expect/sum.txt (moved) (moved from src/tests/.expect/sum.txt ) (1 diff)
-
.expect/swap.txt (moved) (moved from src/tests/.expect/swap.txt )
-
.expect/switch.txt (moved) (moved from src/tests/.expect/typeof.txt )
-
.expect/time.txt (added)
-
.expect/typedefRedef-ERR1.txt (moved) (moved from src/tests/.expect/typedefRedef-ERR1.txt )
-
.expect/typedefRedef.txt (moved) (moved from src/tests/.expect/variableDeclarator.txt )
-
.expect/typeof.txt (moved) (moved from src/tests/.expect/voidPtr.txt )
-
.expect/user_literals.txt (moved) (moved from src/tests/.expect/user_literals.txt ) (2 diffs)
-
.expect/variableDeclarator.txt (moved) (moved from src/tests/concurrent/examples/.expect/datingService.txt )
-
.expect/vector.txt (moved) (moved from src/tests/.expect/libcfa_vector.txt )
-
.expect/voidPtr.txt (added)
-
.expect/with-statement.txt (moved) (moved from src/tests/.expect/with-statement.txt )
-
.gitignore (moved) (moved from src/tests/.gitignore ) (1 diff)
-
.in/fstream_test.txt (moved) (moved from src/tests/.in/fstream_test.txt )
-
.in/gmp.txt (moved) (moved from src/tests/.in/gmp.txt )
-
.in/io.data (added)
-
.in/rational.txt (moved) (moved from src/tests/.in/rational.txt )
-
KRfunctions.c (moved) (moved from src/tests/KRfunctions.c )
-
Makefile.am (added)
-
Makefile.in (moved) (moved from src/examples/Makefile.in ) (20 diffs)
-
abs.c (moved) (moved from src/tests/abs.c ) (2 diffs)
-
alloc.c (moved) (moved from src/tests/alloc.c ) (14 diffs)
-
array.c (moved) (moved from src/tests/array.c )
-
ato.c (added)
-
attributes.c (moved) (moved from src/tests/attributes.c ) (4 diffs)
-
avltree/avl-private.c (moved) (moved from src/tests/avltree/avl-private.c )
-
avltree/avl-private.h (moved) (moved from src/tests/avltree/avl-private.h )
-
avltree/avl.h (moved) (moved from src/tests/avltree/avl.h )
-
avltree/avl0.c (moved) (moved from src/tests/avltree/avl0.c )
-
avltree/avl1.c (moved) (moved from src/tests/avltree/avl1.c ) (1 diff)
-
avltree/avl2.c (moved) (moved from src/tests/avltree/avl2.c )
-
avltree/avl3.c (moved) (moved from src/tests/avltree/avl3.c ) (1 diff)
-
avltree/avl4.c (moved) (moved from src/tests/avltree/avl4.c )
-
avltree/avl_test.c (moved) (moved from src/tests/avltree/avl_test.c ) (1 diff)
-
builtins/.expect/sync.txt (added)
-
builtins/sync.c (added)
-
cast.c (moved) (moved from src/tests/cast.c )
-
castError.c (moved) (moved from src/tests/castError.c )
-
commentMisc.c (moved) (moved from src/tests/commentMisc.c )
-
completeTypeError.c (moved) (moved from src/tests/completeTypeError.c )
-
complex.c (moved) (moved from src/tests/complex.c ) (2 diffs)
-
concurrent/.expect/coroutineYield.txt (added)
-
concurrent/.expect/monitor.txt (moved) (moved from src/tests/concurrent/.expect/monitor.txt )
-
concurrent/.expect/multi-monitor.txt (moved) (moved from src/tests/concurrent/.expect/multi-monitor.txt )
-
concurrent/.expect/preempt.txt (added)
-
concurrent/.expect/thread.txt (moved) (moved from src/tests/concurrent/.expect/thread.txt )
-
concurrent/coroutineYield.c (added)
-
concurrent/examples/.expect/boundedBufferEXT.txt (added)
-
concurrent/examples/.expect/boundedBufferINT.txt (added)
-
concurrent/examples/.expect/datingService.txt (added)
-
concurrent/examples/.expect/matrixSum.txt (moved) (moved from src/tests/concurrent/examples/.expect/matrixSum.txt )
-
concurrent/examples/.expect/quickSort.txt (added)
-
concurrent/examples/.in/quickSort.txt (added)
-
concurrent/examples/boundedBufferEXT.c (added)
-
concurrent/examples/boundedBufferINT.c (added)
-
concurrent/examples/datingService.c (added)
-
concurrent/examples/matrixSum.c (added)
-
concurrent/examples/quickSort.c (added)
-
concurrent/monitor.c (moved) (moved from src/tests/concurrent/monitor.c ) (1 diff)
-
concurrent/multi-monitor.c (moved) (moved from src/tests/concurrent/multi-monitor.c ) (1 diff)
-
concurrent/preempt.c (moved) (moved from src/tests/concurrent/preempt.c ) (2 diffs)
-
concurrent/signal/.expect/block.txt (moved) (moved from src/tests/concurrent/signal/.expect/block.txt )
-
concurrent/signal/.expect/disjoint.txt (moved) (moved from src/tests/concurrent/signal/.expect/disjoint.txt )
-
concurrent/signal/.expect/wait.txt (moved) (moved from src/tests/concurrent/signal/.expect/wait.txt )
-
concurrent/signal/block.c (moved) (moved from src/tests/concurrent/signal/block.c ) (8 diffs)
-
concurrent/signal/disjoint.c (moved) (moved from src/tests/concurrent/signal/disjoint.c ) (7 diffs)
-
concurrent/signal/wait.c (moved) (moved from src/tests/concurrent/signal/wait.c ) (6 diffs)
-
concurrent/thread.c (moved) (moved from src/tests/concurrent/thread.c ) (1 diff)
-
concurrent/waitfor/.expect/barge.txt (moved) (moved from src/tests/concurrent/waitfor/.expect/barge.txt )
-
concurrent/waitfor/.expect/dtor.txt (moved) (moved from src/tests/concurrent/waitfor/.expect/dtor.txt )
-
concurrent/waitfor/.expect/else.txt (moved) (moved from src/tests/concurrent/waitfor/.expect/else.txt )
-
concurrent/waitfor/.expect/recurse.txt (moved) (moved from src/tests/concurrent/waitfor/.expect/recurse.txt )
-
concurrent/waitfor/.expect/statment.txt (moved) (moved from src/tests/concurrent/waitfor/.expect/statment.txt )
-
concurrent/waitfor/.expect/when.txt (moved) (moved from src/tests/concurrent/waitfor/.expect/when.txt )
-
concurrent/waitfor/barge.c (moved) (moved from src/tests/concurrent/waitfor/barge.c ) (1 diff)
-
concurrent/waitfor/dtor.c (moved) (moved from src/tests/concurrent/waitfor/dtor.c ) (1 diff)
-
concurrent/waitfor/else.c (moved) (moved from src/tests/concurrent/waitfor/else.c ) (1 diff)
-
concurrent/waitfor/parse.c (moved) (moved from src/tests/concurrent/waitfor/parse.c ) (1 diff)
-
concurrent/waitfor/parse2.c (moved) (moved from src/tests/concurrent/waitfor/parse2.c )
-
concurrent/waitfor/recurse.c (moved) (moved from src/tests/concurrent/waitfor/recurse.c ) (2 diffs)
-
concurrent/waitfor/simple.c (moved) (moved from src/tests/concurrent/waitfor/simple.c ) (3 diffs)
-
concurrent/waitfor/statment.c (moved) (moved from src/tests/concurrent/waitfor/statment.c ) (1 diff)
-
concurrent/waitfor/when.c (moved) (moved from src/tests/concurrent/waitfor/when.c ) (2 diffs)
-
config.py.in (added)
-
context.c (moved) (moved from src/tests/context.c )
-
coroutine/.expect/fibonacci.txt (moved) (moved from src/tests/coroutine/.expect/coroutine.txt )
-
coroutine/.expect/fmtLines.txt (added)
-
coroutine/.expect/pingpong.txt (moved) (moved from src/tests/coroutine/.expect/pingpong.txt )
-
coroutine/.expect/prodcons.txt (moved) (moved from src/tests/coroutine/.expect/prodcons.txt )
-
coroutine/.expect/runningTotal.txt (added)
-
coroutine/.in/fmtLines.txt (moved) (moved from src/tests/coroutine/.in/fmtLines.txt ) (2 diffs)
-
coroutine/fibonacci.c (moved) (moved from src/tests/coroutine/coroutine.c ) (1 diff)
-
coroutine/fibonacci_1.c (added)
-
coroutine/fmtLines.c (added)
-
coroutine/pingpong.c (moved) (moved from src/tests/coroutine/pingpong.c ) (2 diffs)
-
coroutine/prodcons.c (moved) (moved from src/tests/coroutine/prodcons.c ) (4 diffs)
-
coroutine/runningTotal.c (added)
-
counter.c (added)
-
declarationErrors.c (moved) (moved from src/tests/declarationErrors.c )
-
declarationSpecifier.c (moved) (moved from src/tests/declarationSpecifier.c )
-
designations.c (moved) (moved from src/tests/designations.c )
-
div.c (moved) (moved from src/tests/div.c ) (1 diff)
-
enum.c (moved) (moved from src/tests/enum.c )
-
except-0.c (moved) (moved from src/tests/except-0.c )
-
except-1.c (moved) (moved from src/tests/except-1.c )
-
except-2.c (moved) (moved from src/tests/except-2.c ) (1 diff)
-
except-3.c (moved) (moved from src/tests/except-3.c )
-
except-mac.h (moved) (moved from src/tests/except-mac.h )
-
expression.c (moved) (moved from src/tests/expression.c )
-
extension.c (moved) (moved from src/tests/extension.c )
-
fallthrough.c (added)
-
forall.c (added)
-
forctrl.c (added)
-
fstream_test.c (moved) (moved from src/tests/fstream_test.c ) (2 diffs)
-
function-operator.c (moved) (moved from src/tests/function-operator.c ) (10 diffs)
-
functions.c (moved) (moved from src/tests/functions.c ) (11 diffs)
-
gccExtensions.c (moved) (moved from src/tests/gccExtensions.c )
-
genericUnion.c (moved) (moved from src/tests/genericUnion.c ) (1 diff)
-
gmp.c (moved) (moved from src/tests/gmp.c ) (3 diffs)
-
heap.c (added)
-
hello.c (moved) (moved from src/tests/hello.c ) (2 diffs)
-
identFuncDeclarator.c (moved) (moved from src/tests/identFuncDeclarator.c ) (5 diffs)
-
identParamDeclarator.c (moved) (moved from src/tests/identParamDeclarator.c ) (2 diffs)
-
identity.c (moved) (moved from src/tests/identity.c ) (2 diffs)
-
ifwhileCtl.c (moved) (moved from src/tests/ifcond.c ) (2 diffs)
-
io1.c (added)
-
io2.c (moved) (moved from src/tests/io.c ) (6 diffs)
-
labelledExit.c (moved) (moved from src/tests/labelledExit.c ) (6 diffs)
-
limits.c (added)
-
literals.c (moved) (moved from src/tests/literals.c ) (4 diffs)
-
long_tests.h (added)
-
math1.c (moved) (moved from src/tests/math1.c ) (3 diffs)
-
math2.c (added)
-
math3.c (moved) (moved from src/tests/math2.c ) (3 diffs)
-
math4.c (moved) (moved from src/tests/math3.c ) (1 diff)
-
maybe.c (moved) (moved from src/tests/maybe.c ) (1 diff)
-
minmax.c (moved) (moved from src/tests/minmax.c ) (1 diff)
-
namedParmArg.c (moved) (moved from src/tests/namedParmArg.c )
-
nested-types.c (added)
-
numericConstants.c (moved) (moved from src/tests/numericConstants.c )
-
occursError.c (moved) (moved from src/tests/occursError.c )
-
operators.c (moved) (moved from src/tests/operators.c ) (1 diff)
-
polymorphism.c (moved) (moved from src/tests/polymorphism.c )
-
preempt_longrun/Makefile.am (added)
-
preempt_longrun/Makefile.in (moved) (moved from src/tests/preempt_longrun/Makefile.in ) (11 diffs)
-
preempt_longrun/block.c (added)
-
preempt_longrun/coroutine.c (added)
-
preempt_longrun/create.c (added)
-
preempt_longrun/disjoint.c (added)
-
preempt_longrun/enter.c (added)
-
preempt_longrun/enter3.c (added)
-
preempt_longrun/preempt.c (added)
-
preempt_longrun/processor.c (added)
-
preempt_longrun/stack.c (added)
-
preempt_longrun/update-type (added)
-
preempt_longrun/wait.c (added)
-
preempt_longrun/yield.c (added)
-
pybin/__init__.py (moved) (moved from src/tests/pybin/__init__.py )
-
pybin/settings.py (added)
-
pybin/test_run.py (added)
-
pybin/tools.py (moved) (moved from src/tests/pybin/tools.py ) (10 diffs)
-
quoted_keyword.c (moved) (moved from src/tests/quoted_keyword.c ) (1 diff)
-
raii/.expect/ctor-autogen-ERR1.txt (added)
-
raii/.expect/ctor-autogen.txt (added)
-
raii/.expect/dtor-early-exit-ERR1.txt (added)
-
raii/.expect/dtor-early-exit-ERR2.txt (added)
-
raii/.expect/dtor-early-exit.txt (moved) (moved from src/tests/.expect/dtor-early-exit.txt )
-
raii/.expect/globals.txt (moved) (moved from src/tests/.expect/globals.txt )
-
raii/.expect/init_once.txt (added)
-
raii/.expect/memberCtors-ERR1.txt (added)
-
raii/.expect/memberCtors.txt (moved) (moved from src/tests/.expect/memberCtors.txt )
-
raii/ctor-autogen.c (moved) (moved from src/tests/ctor-autogen.c )
-
raii/dtor-early-exit.c (moved) (moved from src/tests/dtor-early-exit.c ) (1 diff)
-
raii/globals.c (moved) (moved from src/tests/globals.c ) (1 diff)
-
raii/init_once.c (moved) (moved from src/tests/init_once.c )
-
raii/memberCtors.c (moved) (moved from src/tests/memberCtors.c )
-
raii/multiDimension.c (moved) (moved from src/tests/multiDimension.c )
-
raii/multiDimension.txt (moved) (moved from src/tests/.expect/multiDimension.txt )
-
random.c (moved) (moved from src/tests/random.c ) (1 diff)
-
rational.c (moved) (moved from src/tests/rational.c ) (1 diff)
-
references.c (moved) (moved from src/tests/references.c ) (5 diffs)
-
result.c (moved) (moved from src/tests/result.c ) (1 diff)
-
scope.c (moved) (moved from src/tests/scope.c )
-
scopeErrors.c (moved) (moved from src/tests/scopeErrors.c )
-
searchsort.c (moved) (moved from src/tests/searchsort.c ) (8 diffs)
-
shortCircuit.c (moved) (moved from src/tests/shortCircuit.c ) (1 diff)
-
simpleGenericTriple.c (moved) (moved from src/tests/simpleGenericTriple.c )
-
stdincludes.c (moved) (moved from src/tests/stdincludes.c )
-
structMember.c (added)
-
subrange.c (moved) (moved from src/tests/subrange.c )
-
sum.c (moved) (moved from src/tests/sum.c ) (7 diffs)
-
swap.c (moved) (moved from src/tests/swap.c ) (2 diffs)
-
switch.c (moved) (moved from src/tests/switch.c ) (3 diffs)
-
test.py (moved) (moved from src/tests/test.py ) (17 diffs)
-
time.c (added)
-
tuple/.expect/tupleAssign.txt (moved) (moved from src/tests/.expect/tupleAssign.txt )
-
tuple/.expect/tupleCast.txt (moved) (moved from src/tests/.expect/tupleCast.txt )
-
tuple/.expect/tupleFunction.txt (moved) (moved from src/tests/.expect/tupleFunction.txt )
-
tuple/.expect/tupleMember.txt (moved) (moved from src/tests/.expect/tupleMember.txt )
-
tuple/.expect/tuplePolymorphism.txt (moved) (moved from src/tests/.expect/tuplePolymorphism.txt )
-
tuple/.expect/tupleVariadic.txt (moved) (moved from src/tests/.expect/tupleVariadic.txt )
-
tuple/tupleAssign.c (moved) (moved from src/tests/tupleAssign.c ) (2 diffs)
-
tuple/tupleCast.c (moved) (moved from src/tests/tupleCast.c )
-
tuple/tupleFunction.c (moved) (moved from src/tests/tupleFunction.c )
-
tuple/tupleMember.c (moved) (moved from src/tests/tupleMember.c )
-
tuple/tuplePolymorphism.c (moved) (moved from src/tests/tuplePolymorphism.c )
-
tuple/tupleVariadic.c (moved) (moved from src/tests/tupleVariadic.c ) (6 diffs)
-
tuple/tuples.c (moved) (moved from src/tests/tuples.c )
-
typeGenerator.c (moved) (moved from src/tests/typeGenerator.c )
-
typedef.c (moved) (moved from src/tests/typedef.c )
-
typedefDeclarator.c (moved) (moved from src/tests/typedefDeclarator.c )
-
typedefRedef.c (moved) (moved from src/tests/typedefRedef.c )
-
typeof.c (moved) (moved from src/tests/typeof.c )
-
user_literals.c (moved) (moved from src/tests/user_literals.c ) (3 diffs)
-
variableDeclarator.c (moved) (moved from src/tests/variableDeclarator.c )
-
vector.c (moved) (moved from src/tests/libcfa_vector.c ) (2 diffs)
-
virtualCast.c (moved) (moved from src/tests/virtualCast.c ) (1 diff)
-
voidPtr.c (moved) (moved from src/tests/voidPtr.c )
-
warnings/.expect/self-assignment.txt (added)
-
warnings/self-assignment.c (added)
-
with-statement.c (moved) (moved from src/tests/with-statement.c )
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/alloc-ERROR.txt
rf9feab8 r90152a4 1 alloc.c:259:1 error: No reasonable alternatives for expression Applying untyped: 1 alloc.c:265:1 error: No reasonable alternatives for expression Applying untyped: 2 Name: ?=? 3 ...to: 4 Name: p 5 Applying untyped: 6 Name: realloc 7 ...to: 8 Name: stp 9 Applying untyped: 10 Name: ?*? 11 ...to: 12 Name: dim 13 Sizeof Expression on: Applying untyped: 14 Name: *? 15 ...to: 16 Name: stp 17 18 19 20 21 alloc.c:266:1 error: No reasonable alternatives for expression Applying untyped: 2 22 Name: ?=? 3 23 ...to: … … 19 39 20 40 21 alloc.c:26 0:1 error: No reasonable alternatives for expression Applying untyped:41 alloc.c:267:1 error: No reasonable alternatives for expression Applying untyped: 22 42 Name: ?=? 23 43 ...to: … … 30 50 31 51 32 alloc.c:26 1:1 error: No reasonable alternatives for expression Applying untyped:52 alloc.c:268:1 error: No reasonable alternatives for expression Applying untyped: 33 53 Name: ?=? 34 54 ...to: -
tests/.expect/declarationErrors.txt
rf9feab8 r90152a4 17 17 18 18 19 declarationErrors.c:22:1 error: duplicate static in declaration of x6: static const volatile instance of typeInt19 declarationErrors.c:22:1 error: duplicate static in declaration of x6: static const volatile Int 20 20 21 21 declarationErrors.c:24:1 error: duplicate const in declaration of f01: static inline function -
tests/.expect/io2.txt
rf9feab8 r90152a4 1 9 6 28 0 7 1 22 1 2 33 1234 1235 6 opening delimiters7 x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «108 9 closing delimiters10 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x11 12 opening/closing delimiters13 x`1`x'2'x"3"x:4:x 5 x 6 x14 715 x16 817 x18 919 x20 1021 x22 23 override opening/closing delimiters24 x ( 1 ) x 2 , x 3 :x: 425 26 1 input bacis types 27 2 28 3 output basic types 4 false 29 5 A 23 93 30 6 1 2 3 4 5 6 7 8 -
tests/.expect/math1.txt
rf9feab8 r90152a4 9 9 exp2:2 2 2 10 10 expm1:1.71828 1.71828182845905 1.71828182845904524 11 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614627i11 pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i -0.638110484918098871+0.705394566961838155i 12 12 \ 16 256 13 13 \ 912673 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 14 log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i15 log2:3 3 316 log10:2 2 217 log1p:0.693147 0.693147180559945 0.69314718055994530918 ilogb:0 0 019 logb:3 3 320 sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i21 cbrt:3 3 322 hypot:1.41421 1.4142135623731 1.41421356237309505 -
tests/.expect/math3.txt
rf9feab8 r90152a4 1 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i2 cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i3 tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i4 asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i5 acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i6 atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i7 atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.785398163397448318 1 sinh:1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i 9 2 cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i -
tests/.expect/references.txt
rf9feab8 r90152a4 4 4 13 1 12 5 5 14 14 6 x = 6 ; x2 = 789 7 x = 6 ; x2 = 999 8 x = 12345 ; x2 = 999 9 x = 22222 ; x2 = 999 6 10 Default constructing a Y 7 11 Copy constructing a Y … … 28 32 Destructing a Y 29 33 Destructing a Y 34 3 3 35 3 36 3 37 3 9 { 1, 7 }, [1, 2, 3] 30 38 Destructing a Y 31 39 Destructing a Y -
tests/.expect/sum.txt
rf9feab8 r90152a4 4 4 sum from 0.5 to 1.5 is 9.5, check 9.5 5 5 sum from 5 to 15 is 95 95, check 95 95 6 sum from 5 to 15 is 95, check 95 -
tests/.expect/user_literals.txt
rf9feab8 r90152a4 1 1 11.0714285714286 2 1 1.072252 15 3 3 11.0714285714286 4 24.8 5 11.248 4 6 11.0714285714286 5 11.0714285714286 6 22.0457142857143 7 28.0657142857143 7 8 secs 1 8 9 secs 23 … … 22 23 _thingy_ 10 23 24 secs abc 24 mins25 hours abc26 _A_ abc27 25 _thingy_ abc -
tests/.gitignore
rf9feab8 r90152a4 1 1 .out/ 2 2 .err/ 3 .type -
tests/Makefile.in
rf9feab8 r90152a4 17 17 ######################## -*- Mode: Makefile-Automake -*- ###################### 18 18 ############################################################################### 19 20 19 VPATH = @srcdir@ 21 20 am__is_gnu_make = { \ … … 92 91 build_triplet = @build@ 93 92 host_triplet = @host@ 94 noinst_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \ 95 avl_test$(EXEEXT) Bench$(EXEEXT) 96 subdir = src/examples 93 EXTRA_PROGRAMS = fstream_test$(EXEEXT) avl_test$(EXEEXT) 94 subdir = tests 97 95 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 98 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 96 am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \ 97 $(top_srcdir)/configure.ac 99 98 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 100 99 $(ACLOCAL_M4) … … 102 101 mkinstalldirs = $(install_sh) -d 103 102 CONFIG_HEADER = $(top_builddir)/config.h 104 CONFIG_CLEAN_FILES = 105 CONFIG_CLEAN_VPATH_FILES = 106 PROGRAMS = $(noinst_PROGRAMS) 107 Bench_SOURCES = Bench.c 108 Bench_OBJECTS = Bench.$(OBJEXT) 109 Bench_LDADD = $(LDADD) 103 CONFIG_CLEAN_FILES = config.py 104 CONFIG_CLEAN_VPATH_FILES = test.py 110 105 am__dirstamp = $(am__leading_dot)dirstamp 111 106 am_avl_test_OBJECTS = avltree/avl_test.$(OBJEXT) \ … … 118 113 fstream_test_OBJECTS = $(am_fstream_test_OBJECTS) 119 114 fstream_test_LDADD = $(LDADD) 120 am_vector_test_OBJECTS = vector_int.$(OBJEXT) array.$(OBJEXT) \121 vector_test.$(OBJEXT)122 vector_test_OBJECTS = $(am_vector_test_OBJECTS)123 vector_test_LDADD = $(LDADD)124 115 AM_V_P = $(am__v_P_@AM_V@) 125 116 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) … … 150 141 am__v_CCLD_0 = @echo " CCLD " $@; 151 142 am__v_CCLD_1 = 152 SOURCES = Bench.c $(avl_test_SOURCES) $(fstream_test_SOURCES) \ 153 $(vector_test_SOURCES) 154 DIST_SOURCES = Bench.c $(avl_test_SOURCES) $(fstream_test_SOURCES) \ 155 $(vector_test_SOURCES) 143 SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) 144 DIST_SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) 156 145 am__can_run_installinfo = \ 157 146 case $$AM_UPDATE_INFO_DIR in \ … … 178 167 ETAGS = etags 179 168 CTAGS = ctags 180 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp 169 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.py.in \ 170 $(srcdir)/test.py $(top_srcdir)/automake/depcomp 181 171 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 182 172 ACLOCAL = @ACLOCAL@ … … 189 179 AWK = @AWK@ 190 180 BACKEND_CC = @BACKEND_CC@ 191 CC = @CFA_BINDIR@/@CFA_NAME@ 181 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@ 182 CC = @CFACC@ 192 183 CCAS = @CCAS@ 193 184 CCASDEPMODE = @CCASDEPMODE@ 194 185 CCASFLAGS = @CCASFLAGS@ 195 186 CCDEPMODE = @CCDEPMODE@ 187 CFACC = @CFACC@ 188 CFACPP = @CFACPP@ 196 189 CFA_BACKEND_CC = @CFA_BACKEND_CC@ 197 190 CFA_BINDIR = @CFA_BINDIR@ … … 201 194 CFA_NAME = @CFA_NAME@ 202 195 CFA_PREFIX = @CFA_PREFIX@ 203 204 # applies to both programs 205 CFLAGS = 196 CFLAGS = @CFLAGS@ 206 197 CPP = @CPP@ 207 198 CPPFLAGS = @CPPFLAGS@ … … 212 203 DEFS = @DEFS@ 213 204 DEPDIR = @DEPDIR@ 205 DRIVER_DIR = @DRIVER_DIR@ 214 206 ECHO_C = @ECHO_C@ 215 207 ECHO_N = @ECHO_N@ … … 218 210 EXEEXT = @EXEEXT@ 219 211 GREP = @GREP@ 212 HOST_FLAGS = @HOST_FLAGS@ 220 213 INSTALL = @INSTALL@ 221 214 INSTALL_DATA = @INSTALL_DATA@ … … 227 220 LEXLIB = @LEXLIB@ 228 221 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ 222 LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@ 223 LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@ 229 224 LIBOBJS = @LIBOBJS@ 230 225 LIBS = @LIBS@ 231 226 LTLIBOBJS = @LTLIBOBJS@ 232 MACHINE_TYPE = @MACHINE_TYPE@233 MAINT = @MAINT@234 227 MAKEINFO = @MAKEINFO@ 235 228 MKDIR_P = @MKDIR_P@ … … 247 240 SHELL = @SHELL@ 248 241 STRIP = @STRIP@ 242 TARGET_HOSTS = @TARGET_HOSTS@ 249 243 VERSION = @VERSION@ 250 244 YACC = @YACC@ … … 302 296 top_builddir = @top_builddir@ 303 297 top_srcdir = @top_srcdir@ 304 AM_CFLAGS = -g -Wall -Wno-unused-function -O2 298 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 299 debug = yes 300 installed = no 301 quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes 302 concurrent = 303 TEST_PY = python ${builddir}/test.py 304 305 # applies to both programs 306 AM_CFLAGS = $(if $(test), 2> $(test), ) -g -Wall -Wno-unused-function \ 307 -quiet @CFA_FLAGS@ -DIN_DIR="${srcdir}/.in/" ${DEBUG_FLAGS} \ 308 ${INSTALL_FLAGS} ${ARCH_FLAGS} 309 PRETTY_PATH = cd ${srcdir} && 305 310 fstream_test_SOURCES = fstream_test.c 306 vector_test_SOURCES = vector_int.c array.c vector_test.c307 311 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 308 312 all: all-am 309 313 310 314 .SUFFIXES: 311 .SUFFIXES: .c .o .obj 312 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@$(srcdir)/Makefile.am $(am__configure_deps)315 .SUFFIXES: .c .o .obj .validate 316 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 313 317 @for dep in $?; do \ 314 318 case '$(am__configure_deps)' in \ … … 319 323 esac; \ 320 324 done; \ 321 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/examples/Makefile'; \325 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ 322 326 $(am__cd) $(top_srcdir) && \ 323 $(AUTOMAKE) --foreign src/examples/Makefile327 $(AUTOMAKE) --foreign tests/Makefile 324 328 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 325 329 @case '$?' in \ … … 334 338 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 335 339 336 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@$(am__configure_deps)340 $(top_srcdir)/configure: $(am__configure_deps) 337 341 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 338 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@$(am__aclocal_m4_deps)342 $(ACLOCAL_M4): $(am__aclocal_m4_deps) 339 343 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 340 344 $(am__aclocal_m4_deps): 341 342 clean-noinstPROGRAMS: 343 -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) 345 config.py: $(top_builddir)/config.status $(srcdir)/config.py.in 346 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 344 347 avltree/$(am__dirstamp): 345 348 @$(MKDIR_P) avltree … … 371 374 $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS) 372 375 373 vector_test$(EXEEXT): $(vector_test_OBJECTS) $(vector_test_DEPENDENCIES) $(EXTRA_vector_test_DEPENDENCIES)374 @rm -f vector_test$(EXEEXT)375 $(AM_V_CCLD)$(LINK) $(vector_test_OBJECTS) $(vector_test_LDADD) $(LIBS)376 377 376 mostlyclean-compile: 378 377 -rm -f *.$(OBJEXT) … … 382 381 -rm -f *.tab.c 383 382 384 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Bench.Po@am__quote@385 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@386 383 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@ 387 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@388 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_test.Po@am__quote@389 384 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl-private.Po@am__quote@ 390 385 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl0.Po@am__quote@ … … 495 490 check-am: all-am 496 491 check: check-am 497 all-am: Makefile $(PROGRAMS)492 all-am: Makefile all-local 498 493 installdirs: 499 494 install: install-am … … 531 526 clean: clean-am 532 527 533 clean-am: clean-generic clean- noinstPROGRAMSmostlyclean-am528 clean-am: clean-generic clean-local mostlyclean-am 534 529 535 530 distclean: distclean-am … … 600 595 .MAKE: install-am install-strip 601 596 602 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic\603 clean- noinstPROGRAMS cscopelist-am ctags ctags-am distclean\604 distclean -compile distclean-generic distclean-tags distdir dvi\605 d vi-am html html-am info info-am install install-am\606 install- data install-data-am install-dvi install-dvi-am\607 install- exec install-exec-am install-html install-html-am\608 install- info install-info-am install-man install-pdf\609 install-pdf -am install-ps install-ps-am install-strip\610 install check installcheck-am installdirs maintainer-clean\611 maintainer-clean -generic mostlyclean mostlyclean-compile\612 mostlyclean- generic pdf pdf-am ps ps-am tags tags-am uninstall\613 uninstall-am597 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ 598 clean-generic clean-local cscopelist-am ctags ctags-am \ 599 distclean distclean-compile distclean-generic distclean-tags \ 600 distdir dvi dvi-am html html-am info info-am install \ 601 install-am install-data install-data-am install-dvi \ 602 install-dvi-am install-exec install-exec-am install-html \ 603 install-html-am install-info install-info-am install-man \ 604 install-pdf install-pdf-am install-ps install-ps-am \ 605 install-strip installcheck installcheck-am installdirs \ 606 maintainer-clean maintainer-clean-generic mostlyclean \ 607 mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ 608 tags tags-am uninstall uninstall-am 614 609 615 610 .PRECIOUS: Makefile 616 611 617 612 618 Bench : Bench.c 619 @for ccflags in "-debug" "-nodebug"; do \ 620 echo ${CC} ${AM_CFLAGS} ${CFLAGS} $${ccflags} -lrt Bench.c;\ 621 ${CC} ${AM_CFLAGS} ${CFLAGS} $${ccflags} -lrt Bench.c;\ 622 ./a.out ; \ 623 done ; \ 624 rm -f ./a.out ; 613 .PHONY: list .validate 614 .INTERMEDIATE: .validate .validate.c 615 616 #---------------------------------------------------------------------------------------------------------------- 617 all-local : 618 @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${quick_test} 619 620 all-tests : 621 @+${TEST_PY} --all --debug=${debug} --install=${installed} ${concurrent} # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program 622 623 clean-local : 624 rm -f ${EXTRA_PROGRAMS} 625 626 list : 627 @+${TEST_PY} --list ${concurrent} 628 629 .validate: .validate.c 630 $(COMPILE) .validate.c -fsyntax-only -Wall -Wextra -Werror 631 632 .validate.c: 633 @echo "int main() { return 0; }" > ${@} 634 635 concurrency : 636 @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent 637 638 #---------------------------------------------------------------------------------------------------------------- 639 # implicit rule so not all test require a rule 640 % : %.c $(CC) 641 $(PRETTY_PATH) $(COMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 642 643 declarationSpecifier: declarationSpecifier.c $(CC) 644 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 645 646 gccExtensions : gccExtensions.c $(CC) 647 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 648 649 extension : extension.c $(CC) 650 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 651 652 attributes : attributes.c $(CC) 653 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 654 655 functions: functions.c $(CC) 656 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 657 658 KRfunctions : KRfunctions.c $(CC) 659 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 660 661 sched-ext-parse : sched-ext-parse.c $(CC) 662 $(PRETTY_PATH) $(COMPILE) -CFA -XCFA -p $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 663 664 gmp : gmp.c $(CC) 665 $(PRETTY_PATH) $(COMPILE) -lgmp $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 666 667 #builtins 668 builtins/sync: builtins/sync.c $(CC) 669 $(PRETTY_PATH) $(COMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only 670 671 #------------------------------------------------------------------------------ 672 #To make errors path independent we need to cd into the correct directories 673 completeTypeError : completeTypeError.c $(CC) 674 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 675 676 typedefRedef-ERR1: typedefRedef.c $(CC) 677 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 678 679 alloc-ERROR: alloc.c $(CC) 680 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 681 682 fallthrough-ERROR: fallthrough.c $(CC) 683 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 684 685 nested-types-ERR1: nested-types.c $(CC) 686 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 687 688 nested-types-ERR2: nested-types.c $(CC) 689 $(PRETTY_PATH) $(COMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 690 691 # Constructor/destructor tests 692 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c $(CC) 693 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 694 695 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.c $(CC) 696 $(PRETTY_PATH) $(COMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 697 698 raii/memberCtors-ERR1: raii/memberCtors.c $(CC) 699 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 700 701 raii/ctor-autogen-ERR1: raii/ctor-autogen.c $(CC) 702 $(PRETTY_PATH) $(COMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 703 704 # Warnings 705 warnings/self-assignment: warnings/self-assignment.c $(CC) 706 $(PRETTY_PATH) $(COMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only 625 707 626 708 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
tests/abs.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // abs.c -- 7 // abs.c -- 8 8 // 9 9 // Author : Peter A. Buhr … … 14 14 // 15 15 16 #include <fstream >17 #include <stdlib > // abs16 #include <fstream.hfa> 17 #include <stdlib.hfa> // abs 18 18 19 19 int main( void ) { -
tests/alloc.c
rf9feab8 r90152a4 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 20 16:01:10 201713 // Update Count : 3 1812 // Last Modified On : Thu Aug 9 06:21:35 2018 13 // Update Count : 337 14 14 // 15 15 … … 18 18 #include <stdint.h> // uintptr_t 19 19 #include <stdlib.h> // posix_memalign 20 #include <fstream >21 #include <stdlib >// access C malloc, realloc20 #include <fstream.hfa> 21 #include <stdlib.hfa> // access C malloc, realloc 22 22 23 23 int * foo( int * p, int c ) { return p; } … … 27 27 int main( void ) { 28 28 size_t dim = 10; 29 char fill = '\xff'; 29 30 int * p; 30 char fill = '\1';31 31 32 32 // allocation, non-array types 33 33 34 p = (int *)(void *)malloc( sizeof(*p) ); // C malloc, type unsafe 34 // int & r = malloc(); 35 // r = 0xdeadbeef; 36 // printf( "C malloc %#x\n", r ); 37 // free( &r ); 38 39 p = (int *)malloc( sizeof(*p) ); // C malloc, type unsafe 35 40 *p = 0xdeadbeef; 36 41 printf( "C malloc %#x\n", *p ); … … 49 54 p = alloc( fill ); // CFA alloc, fill 50 55 printf( "CFA alloc, fill %08x\n", *p ); 56 free( p ); 51 57 52 58 … … 54 60 printf( "\n" ); 55 61 56 p = (int *)calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe62 p = (int *)calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe 57 63 printf( "C array calloc, fill 0\n" ); 58 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }64 for ( i; dim ) { printf( "%#x ", p[i] ); } 59 65 printf( "\n" ); 60 66 free( p ); … … 62 68 p = calloc( dim ); // CFA array calloc, type safe 63 69 printf( "CFA array calloc, fill 0\n" ); 64 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }70 for ( i; dim ) { printf( "%#x ", p[i] ); } 65 71 printf( "\n" ); 66 72 free( p ); 67 73 68 74 p = alloc( dim ); // CFA array alloc, type safe 69 for ( i nt i = 0; i < dim; i += 1) { p[i] = 0xdeadbeef; }75 for ( i; dim ) { p[i] = 0xdeadbeef; } 70 76 printf( "CFA array alloc, no fill\n" ); 71 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }77 for ( i; dim ) { printf( "%#x ", p[i] ); } 72 78 printf( "\n" ); 73 79 free( p ); 74 80 75 81 p = alloc( 2 * dim, fill ); // CFA array alloc, fill 76 printf( "CFA array alloc, fill %# x\n", fill );77 for ( i nt i = 0; i < 2 * dim; i += 1) { printf( "%#x ", p[i] ); }82 printf( "CFA array alloc, fill %#hhx\n", fill ); 83 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 78 84 printf( "\n" ); 79 85 // do not free … … 83 89 printf( "\n" ); 84 90 85 p = (int *) (void *)realloc( p, dim * sizeof(*p) );// C realloc86 for ( i nt i = 0; i < dim; i += 1) { p[i] = 0xdeadbeef; }91 p = (int *)realloc( p, dim * sizeof(*p) ); // C realloc 92 for ( i; dim ) { p[i] = 0xdeadbeef; } 87 93 printf( "C realloc\n" ); 88 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }94 for ( i; dim ) { printf( "%#x ", p[i] ); } 89 95 printf( "\n" ); 90 96 91 97 p = realloc( p, 2 * dim * sizeof(*p) ); // CFA realloc 92 for ( i nt i = dim; i < 2 * dim; i += 1) { p[i] = 0x1010101; }98 for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; } 93 99 printf( "CFA realloc\n" ); 94 for ( i nt i = 0; i < 2 * dim; i += 1) { printf( "%#x ", p[i] ); }100 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 95 101 printf( "\n" ); 96 102 // do not free … … 101 107 102 108 p = alloc( p, dim ); // CFA resize array alloc 103 for ( i nt i = 0; i < dim; i += 1) { p[i] = 0xdeadbeef; }109 for ( i; dim ) { p[i] = 0xdeadbeef; } 104 110 printf( "CFA resize alloc\n" ); 105 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }111 for ( i; dim ) { printf( "%#x ", p[i] ); } 106 112 printf( "\n" ); 107 113 108 114 p = alloc( p, 2 * dim ); // CFA resize array alloc 109 for ( i nt i = dim; i < 2 * dim; i += 1) { p[i] = 0x1010101; }115 for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; } 110 116 printf( "CFA resize array alloc\n" ); 111 for ( i nt i = 0; i < 2 * dim; i += 1) { printf( "%#x ", p[i] ); }117 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 112 118 printf( "\n" ); 113 119 114 120 p = alloc( p, dim ); // CFA array alloc 115 121 printf( "CFA resize array alloc\n" ); 116 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }122 for ( i; dim ) { printf( "%#x ", p[i] ); } 117 123 printf( "\n" ); 118 124 … … 122 128 p = alloc( p, dim, fill ); // CFA array alloc, fill 123 129 printf( "CFA resize array alloc, fill\n" ); 124 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }130 for ( i; dim ) { printf( "%#x ", p[i] ); } 125 131 printf( "\n" ); 126 132 127 133 p = alloc( p, 2 * dim, fill ); // CFA array alloc, fill 128 134 printf( "CFA resize array alloc, fill\n" ); 129 for ( i nt i = 0; i < 2 * dim; i += 1) { printf( "%#x ", p[i] ); }135 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 130 136 printf( "\n" ); 131 137 132 138 p = alloc( p, dim, fill ); // CFA array alloc, fill 133 139 printf( "CFA resize array alloc, fill\n" ); 134 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] );; }140 for ( i; dim ) { printf( "%#x ", p[i] );; } 135 141 printf( "\n" ); 136 142 free( p ); … … 187 193 stp = align_alloc( Alignment, dim ); // CFA array memalign 188 194 assert( (uintptr_t)stp % Alignment == 0 ); 189 for ( i nt i = 0; i < dim; i += 1) { stp[i] = (Struct){ 42, 42.5 }; }195 for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; } 190 196 printf( "CFA array align_alloc\n" ); 191 for ( i nt i = 0; i < dim; i += 1) { printf( "%d %g, ", stp[i].x, stp[i].y ); }197 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 192 198 printf( "\n" ); 193 199 free( stp ); … … 196 202 assert( (uintptr_t)stp % Alignment == 0 ); 197 203 printf( "CFA array align_alloc, fill\n" ); 198 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x %a, ", stp[i].x, stp[i].y ); }204 for ( i; dim ) { printf( "%#x %a, ", stp[i].x, stp[i].y ); } 199 205 printf( "\n" ); 200 206 free( stp ); … … 213 219 printf( "\n" ); 214 220 215 memset( sta, dim, fill );// CFA array memset, type safe221 amemset( sta, fill, dim ); // CFA array memset, type safe 216 222 printf( "CFA array memset\n" ); 217 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x %a, ", sta[i].x, sta[i].y ); }218 printf( "\n" ); 219 220 memcpy( sta1, sta, dim );// CFA array memcpy, type safe221 printf( "CFA memcpy\n" );222 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x %a, ", sta1[i].x, sta1[i].y ); }223 for ( i; dim ) { printf( "%#x %a, ", sta[i].x, sta[i].y ); } 224 printf( "\n" ); 225 226 amemcpy( sta1, sta, dim ); // CFA array memcpy, type safe 227 printf( "CFA array memcpy\n" ); 228 for ( i; dim ) { printf( "%#x %a, ", sta1[i].x, sta1[i].y ); } 223 229 printf( "\n" ); 224 230 … … 235 241 stp = anew( dim, 42, 42.5 ); 236 242 printf( "CFA array new initialize\n" ); 237 for ( i nt i = 0; i < dim; i += 1) { printf( "%d %g, ", stp[i].x, stp[i].y ); }243 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 238 244 printf( "\n" ); 239 245 stp1 = anew( dim, 42, 42.5 ); 240 for ( i nt i = 0; i < dim; i += 1) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); }246 for ( i; dim ) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); } 241 247 printf( "\n" ); 242 248 adelete( dim, stp, dim, stp1 ); … … 254 260 free( p ); 255 261 262 #ifdef ERR1 256 263 stp = malloc(); 257 264 printf( "\nSHOULD FAIL\n" ); 258 #ifdef ERR1 259 p = alloc( stp, dim * sizeof( *stp) );265 p = realloc( stp, dim * sizeof( *stp ) ); 266 p = alloc( stp, dim * sizeof( *stp ) ); 260 267 p = memset( stp, 10 ); 261 268 p = memcpy( &st1, &st ); -
tests/attributes.c
rf9feab8 r90152a4 10 10 // Created On : Mon Feb 6 16:07:02 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 23:05:52 201713 // Update Count : 312 // Last Modified On : Thu Jul 19 13:50:51 2018 13 // Update Count : 15 14 14 // 15 15 … … 29 29 enum __attribute__(( packed )) Agn3 { E2 }; 30 30 #ifdef __CFA__ 31 struct __attribute__(( unused )) ( int ) {};32 struct __attribute__(( unused )) ( int ) {};31 struct __attribute__(( unused )) {} ( int ); 32 struct __attribute__(( unused )) Agn4 {} ( int ); 33 33 #endif // __CFA__ 34 34 … … 42 42 __attribute__(( unused )) int f5 __attribute__(( unused )); 43 43 __attribute__(( used )) int f6 __attribute__(( packed )), f7 __attribute__(( unused )) __attribute__(( unused )), __attribute__(( used )) f8 __attribute__(( unused )); 44 int __attribute__(( unused ));45 44 int ( ( * (f9) __attribute__(( unused )) ) __attribute__(( unused )) ); 46 45 }; … … 149 148 struct Vad { 150 149 int __attribute__(( unused )); 151 int __attribute__(( unused )) * __attribute__(( unused )); 152 int __attribute__(( unused )) [10] __attribute__(( unused )); 153 int __attribute__(( unused )) (*)() __attribute__(( unused )); 150 int __attribute__(( unused )) :4; 151 int __attribute__(( unused )) :4, __attribute__(( unused )) :6; 154 152 }; 155 153 -
tests/avltree/avl1.c
rf9feab8 r90152a4 1 1 #include "avl.h" 2 2 // #include "cwrap.h" 3 #include <stdlib >3 #include <stdlib.hfa> 4 4 5 5 forall(otype K | Comparable(K), otype V) -
tests/avltree/avl3.c
rf9feab8 r90152a4 1 1 #include "avl.h" 2 2 #include "avl-private.h" 3 #include <stdlib >3 #include <stdlib.hfa> 4 4 5 5 // swaps the data within two tree nodes -
tests/avltree/avl_test.c
rf9feab8 r90152a4 1 1 #include "avl.h" 2 2 #include "avl-private.h" 3 #include <stdlib >3 #include <stdlib.hfa> 4 4 5 5 extern "C" { -
tests/complex.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // complex.c -- 8 // 6 // 7 // complex.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 24 22:07:31 2017 … … 12 12 // Last Modified On : Wed May 24 22:08:01 2017 13 13 // Update Count : 1 14 // 14 // 15 15 16 16 #include <stdio.h> 17 17 #include <complex.h> 18 18 #ifdef __CFA__ 19 #include <fstream >19 #include <fstream.hfa> 20 20 #endif // __CFA 21 21 -
tests/concurrent/monitor.c
rf9feab8 r90152a4 1 #include <fstream >2 #include <kernel >3 #include <monitor >4 #include <thread >1 #include <fstream.hfa> 2 #include <kernel.hfa> 3 #include <monitor.hfa> 4 #include <thread.hfa> 5 5 6 6 monitor global_t { -
tests/concurrent/multi-monitor.c
rf9feab8 r90152a4 1 #include <fstream >2 #include <kernel >3 #include <monitor >4 #include <thread >1 #include <fstream.hfa> 2 #include <kernel.hfa> 3 #include <monitor.hfa> 4 #include <thread.hfa> 5 5 6 6 static int global12, global23, global13; -
tests/concurrent/preempt.c
rf9feab8 r90152a4 1 #include <kernel> 2 #include <thread> 1 #include <kernel.hfa>hfa> 2 #include <thread.hfa> 3 #include <time.hfa> 4 5 #include "long_tests.h" 3 6 4 7 #ifndef PREEMPTION_RATE 5 #define PREEMPTION_RATE 10 _000ul8 #define PREEMPTION_RATE 10`ms 6 9 #endif 7 10 8 unsigned intdefault_preemption() {11 Duration default_preemption() { 9 12 return PREEMPTION_RATE; 10 13 } 14 15 #ifdef TEST_LONG 16 static const unsigned long N = 30_000ul; 17 #else 18 static const unsigned long N = 500ul; 19 #endif 20 21 extern void __cfaabi_check_preemption(); 11 22 12 23 static volatile int counter = 0; … … 21 32 22 33 void main(worker_t & this) { 23 while(counter < 1000) { 34 while(TEST(counter < N)) { 35 __cfaabi_check_preemption(); 24 36 if( (counter % 7) == this.value ) { 37 __cfaabi_check_preemption(); 25 38 int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST); 39 __cfaabi_check_preemption(); 26 40 if( (next % 100) == 0 ) printf("%d\n", (int)next); 41 __cfaabi_check_preemption(); 27 42 } 43 __cfaabi_check_preemption(); 44 KICK_WATCHDOG; 28 45 } 29 46 } -
tests/concurrent/signal/block.c
rf9feab8 r90152a4 7 7 8 8 9 #include <fstream> 10 #include <kernel> 11 #include <monitor> 12 #include <stdlib> 13 #include <thread> 9 #include <fstream.hfa> 10 #include <kernel.hfa>hfa> 11 #include <monitor.hfa> 12 #include <stdlib.hfa> 13 #include <thread.hfa> 14 #include <time.hfa> 14 15 15 #include <time.h> 16 17 static const unsigned long N = 5_000ul; 16 #include "long_tests.h" 18 17 19 18 #ifndef PREEMPTION_RATE 20 #define PREEMPTION_RATE 10 _000ul19 #define PREEMPTION_RATE 10`ms 21 20 #endif 22 21 23 unsigned intdefault_preemption() {22 Duration default_preemption() { 24 23 return PREEMPTION_RATE; 25 24 } 25 26 #ifdef TEST_LONG 27 static const unsigned long N = 150_000ul; 28 #else 29 static const unsigned long N = 5_000ul; 30 #endif 26 31 27 32 enum state_t { WAITED, SIGNAL, BARGE }; … … 37 42 } 38 43 39 void ^?{} ( global_data_t & this ) {}44 void ^?{} ( global_data_t & mutex this ) {} 40 45 41 46 global_data_t globalA, globalB; … … 47 52 //------------------------------------------------------------------------------ 48 53 void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) { 49 wait( cond, (uintptr_t)this_thread);54 wait( cond, (uintptr_t)active_thread() ); 50 55 51 56 yield( random( 10 ) ); … … 56 61 } 57 62 58 a.last_thread = b.last_thread = this_thread;63 a.last_thread = b.last_thread = active_thread(); 59 64 60 65 yield( random( 10 ) ); … … 63 68 thread Waiter {}; 64 69 void main( Waiter & this ) { 65 for( int i = 0; i < N; i++ ) {70 for( int i = 0; TEST(i < N); i++ ) { 66 71 wait_op( globalA, globalB, i ); 72 KICK_WATCHDOG; 67 73 } 68 74 } … … 72 78 yield( random( 10 ) ); 73 79 74 [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = this_thread;80 [a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = active_thread(); 75 81 76 82 if( !is_empty( cond ) ) { … … 102 108 //------------------------------------------------------------------------------ 103 109 void barge_op( global_data_t & mutex a ) { 104 a.last_thread = this_thread;110 a.last_thread = active_thread(); 105 111 } 106 112 … … 118 124 119 125 int main(int argc, char* argv[]) { 120 random_seed( time( NULL ) );126 srandom( time( NULL ) ); 121 127 done = false; 122 128 processor p; -
tests/concurrent/signal/disjoint.c
rf9feab8 r90152a4 1 #include <fstream> 2 #include <kernel> 3 #include <monitor> 4 #include <thread> 1 #include <fstream.hfa> 2 #include <kernel.hfa>hfa> 3 #include <monitor.hfa> 4 #include <thread.hfa> 5 #include <time.hfa> 5 6 6 #include <time.h> 7 8 static const unsigned long N = 10_000ul; 7 #include "long_tests.h" 9 8 10 9 #ifndef PREEMPTION_RATE 11 #define PREEMPTION_RATE 10 _000ul10 #define PREEMPTION_RATE 10`ms 12 11 #endif 13 12 14 unsigned intdefault_preemption() {13 Duration default_preemption() { 15 14 return PREEMPTION_RATE; 16 15 } 16 17 #ifdef TEST_LONG 18 static const unsigned long N = 300_000ul; 19 #else 20 static const unsigned long N = 10_000ul; 21 #endif 17 22 18 23 enum state_t { WAIT, SIGNAL, BARGE }; … … 23 28 monitor global_data_t; 24 29 void ?{}( global_data_t & this ); 25 void ^?{} ( global_data_t & this );30 void ^?{} ( global_data_t & mutex this ); 26 31 27 32 monitor global_data_t { … … 39 44 } 40 45 41 void ^?{} ( global_data_t & this ) {}46 void ^?{} ( global_data_t & mutex this ) {} 42 47 43 48 //------------------------------------------------------------------------------ … … 64 69 } 65 70 66 d.counter++; 71 #if !defined(TEST_FOREVER) 72 d.counter++; 73 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 74 #endif 67 75 68 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 69 70 return d.counter < N; 76 return TEST(d.counter < N); 71 77 } 72 78 … … 74 80 75 81 void main( Waiter & this ) { 76 while( wait( mut, data ) ) { yield(); }82 while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); } 77 83 } 78 84 … … 91 97 92 98 //This is technically a mutual exclusion violation but the mutex monitor protects us 93 bool running = data.counter < N&& data.counter > 0;99 bool running = TEST(data.counter < N) && data.counter > 0; 94 100 if( data.state != SIGNAL && running ) { 95 101 sout | "ERROR Eager signal" | data.state | endl; … … 109 115 // Main loop 110 116 int main(int argc, char* argv[]) { 111 random_seed( time( NULL ) );117 srandom( time( NULL ) ); 112 118 all_done = false; 113 119 processor p; -
tests/concurrent/signal/wait.c
rf9feab8 r90152a4 5 5 6 6 7 #include <fstream> 8 #include <kernel> 9 #include <monitor> 10 #include <stdlib> 11 #include <thread> 7 #include <fstream.hfa> 8 #include <kernel.hfa>hfa> 9 #include <monitor.hfa> 10 #include <stdlib.hfa> 11 #include <thread.hfa> 12 #include <time.hfa> 12 13 13 #include <time.h> 14 15 static const unsigned long N = 2_500ul; 14 #define __kick_rate 12000ul 15 #include "long_tests.h" 16 16 17 17 #ifndef PREEMPTION_RATE 18 #define PREEMPTION_RATE 10 _000ul18 #define PREEMPTION_RATE 10`ms 19 19 #endif 20 20 21 unsigned intdefault_preemption() {21 Duration default_preemption() { 22 22 return PREEMPTION_RATE; 23 23 } 24 25 #ifdef TEST_LONG 26 static const unsigned long N = 375_000ul; 27 #else 28 static const unsigned long N = 2_500ul; 29 #endif 24 30 25 31 monitor global_t {}; … … 87 93 // Waiter ABC 88 94 void main( WaiterABC & this ) { 89 for( int i = 0; i < N; i++ ) {95 for( int i = 0; TEST(i < N); i++ ) { 90 96 wait( condABC, globalA, globalB, globalC ); 97 KICK_WATCHDOG; 91 98 } 92 99 … … 97 104 // Waiter AB 98 105 void main( WaiterAB & this ) { 99 for( int i = 0; i < N; i++ ) {106 for( int i = 0; TEST(i < N); i++ ) { 100 107 wait( condAB , globalA, globalB ); 108 KICK_WATCHDOG; 101 109 } 102 110 … … 107 115 // Waiter AC 108 116 void main( WaiterAC & this ) { 109 for( int i = 0; i < N; i++ ) {117 for( int i = 0; TEST(i < N); i++ ) { 110 118 wait( condAC , globalA, globalC ); 119 KICK_WATCHDOG; 111 120 } 112 121 … … 117 126 // Waiter BC 118 127 void main( WaiterBC & this ) { 119 for( int i = 0; i < N; i++ ) {128 for( int i = 0; TEST(i < N); i++ ) { 120 129 wait( condBC , globalB, globalC ); 130 KICK_WATCHDOG; 121 131 } 122 132 … … 127 137 // Main 128 138 int main(int argc, char* argv[]) { 129 random_seed( time( NULL ) );139 srandom( time( NULL ) ); 130 140 waiter_left = 4; 131 141 processor p[2]; -
tests/concurrent/thread.c
rf9feab8 r90152a4 1 #include <fstream >2 #include <kernel >3 #include <stdlib >4 #include <thread >1 #include <fstream.hfa> 2 #include <kernel.hfa> 3 #include <stdlib.hfa> 4 #include <thread.hfa> 5 5 6 6 thread First { semaphore* lock; }; 7 7 thread Second { semaphore* lock; }; 8 8 9 void ?{}( First & this, semaphore & lock ) {this.lock = &lock; }10 void ?{}( Second & this, semaphore & lock ) { this.lock = &lock; }9 void ?{}( First & this, semaphore & lock ) { ((thread&)this){"Thread 1"}; this.lock = &lock; } 10 void ?{}( Second & this, semaphore & lock ) { ((thread&)this){"Thread 2"}; this.lock = &lock; } 11 11 12 12 void main(First& this) { -
tests/concurrent/waitfor/barge.c
rf9feab8 r90152a4 6 6 //--------------------------------------------------------- 7 7 8 #include <fstream >9 #include <kernel >10 #include <monitor >11 #include <stdlib >12 #include <thread >8 #include <fstream.hfa> 9 #include <kernel.hfa> 10 #include <monitor.hfa> 11 #include <stdlib.hfa> 12 #include <thread.hfa> 13 13 14 14 #include <stdbool.h> -
tests/concurrent/waitfor/dtor.c
rf9feab8 r90152a4 4 4 //--------------------------------------------------------- 5 5 6 #include <fstream >7 #include <kernel >8 #include <monitor >9 #include <stdlib >10 #include <thread >6 #include <fstream.hfa> 7 #include <kernel.hfa> 8 #include <monitor.hfa> 9 #include <stdlib.hfa> 10 #include <thread.hfa> 11 11 12 12 #include <stdbool.h> -
tests/concurrent/waitfor/else.c
rf9feab8 r90152a4 1 #include <fstream >2 #include <monitor >1 #include <fstream.hfa> 2 #include <monitor.hfa> 3 3 4 4 #include <stdbool.h> -
tests/concurrent/waitfor/parse.c
rf9feab8 r90152a4 8 8 //---------------------------------------------------------------------------------------- 9 9 10 #include <monitor >10 #include <monitor.hfa> 11 11 12 12 monitor M {}; -
tests/concurrent/waitfor/recurse.c
rf9feab8 r90152a4 4 4 //----------------------------------------------------------------- 5 5 6 #include <fstream >7 #include <kernel >8 #include <monitor >9 #include <stdlib >10 #include <thread >6 #include <fstream.hfa> 7 #include <kernel.hfa> 8 #include <monitor.hfa> 9 #include <stdlib.hfa> 10 #include <thread.hfa> 11 11 12 12 #include <stdbool.h> … … 131 131 132 132 int main() { 133 random_seed( time(NULL) );133 srandom( time(NULL) ); 134 134 sout | "Starting" | endl; 135 135 { -
tests/concurrent/waitfor/simple.c
rf9feab8 r90152a4 1 #include <fstream >2 #include <kernel >3 #include <monitor >4 #include <stdlib >5 #include <thread >1 #include <fstream.hfa> 2 #include <kernel.hfa> 3 #include <monitor.hfa> 4 #include <stdlib.hfa> 5 #include <thread.hfa> 6 6 7 7 #include <time.h> … … 10 10 11 11 #ifndef PREEMPTION_RATE 12 #define PREEMPTION_RATE 10 _000ul12 #define PREEMPTION_RATE 10`ms 13 13 #endif 14 14 15 unsigned intdefault_preemption() {15 Duration default_preemption() { 16 16 return PREEMPTION_RATE; 17 17 } … … 74 74 int main(int argc, char* argv[]) { 75 75 done = false; 76 random_seed( time( NULL ) );76 srandom( time( NULL ) ); 77 77 printf("%p\n", &globalA); 78 78 sout | "Starting" | endl; -
tests/concurrent/waitfor/statment.c
rf9feab8 r90152a4 1 #include <fstream >2 #include <kernel >3 #include <monitor >4 #include <thread >1 #include <fstream.hfa> 2 #include <kernel.hfa> 3 #include <monitor.hfa> 4 #include <thread.hfa> 5 5 6 6 #include <stdbool.h> -
tests/concurrent/waitfor/when.c
rf9feab8 r90152a4 4 4 //----------------------------------------------------------------- 5 5 6 #include <fstream >7 #include <kernel >8 #include <monitor >9 #include <stdlib >10 #include <thread >6 #include <fstream.hfa> 7 #include <kernel.hfa> 8 #include <monitor.hfa> 9 #include <stdlib.hfa> 10 #include <thread.hfa> 11 11 12 12 #include <stdbool.h> … … 77 77 78 78 int main() { 79 random_seed( time(NULL) );79 srandom( time(NULL) ); 80 80 sout | "Starting" | endl; 81 81 { -
tests/coroutine/.in/fmtLines.txt
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // fmtLines.cc -- 8 // 6 // 7 // fmtLines.cc -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sun Sep 17 21:56:15 2017 … … 12 12 // Last Modified On : Mon Sep 18 11:35:57 2017 13 13 // Update Count : 31 14 // 14 // 15 15 16 #include <fstream >17 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 18 18 19 19 coroutine Format { -
tests/coroutine/fibonacci.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // fibonacci.c -- 7 // fibonacci.c -- 3-state finite-state machine 8 8 // 9 9 // Author : Thierry Delisle 10 10 // Created On : Thu Jun 8 07:29:37 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Sep 17 21:38:15 201713 // Update Count : 712 // Last Modified On : Sat Aug 18 11:21:58 2018 13 // Update Count : 24 14 14 // 15 15 16 #include <fstream >17 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 18 18 19 coroutine Fibonacci { 20 int fn; // used for communication 21 }; 19 coroutine Fibonacci { int fn; }; // used for communication 22 20 23 void ?{}( Fibonacci & this ) { 24 this.fn = 0; 25 } 26 27 void main( Fibonacci & this ) { 21 void main( Fibonacci & fib ) with( fib ) { // called on first resume 28 22 int fn1, fn2; // retained between resumes 29 this.fn = 0; // case 0 30 fn1 = this.fn; 23 fn = 0; fn1 = fn; // 1st case 31 24 suspend(); // restart last resume 32 33 this.fn = 1; // case 1 34 fn2 = fn1; fn1 = this.fn; 25 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 35 26 suspend(); // restart last resume 36 37 for ( ;; ) { // general case 38 this.fn = fn1 + fn2; 39 fn2 = fn1; fn1 = this.fn; 27 for () { 28 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 40 29 suspend(); // restart last resume 41 30 } // for 42 31 } 43 32 44 int next( Fibonacci & this) {45 resume( this); // restart last suspend46 return this.fn;33 int next( Fibonacci & fib ) with( fib ) { 34 resume( fib ); // restart last suspend 35 return fn; 47 36 } 48 37 49 38 int main() { 50 39 Fibonacci f1, f2; 51 for ( int i = 1; i <= 10; i += 1 ) {40 for ( 10 ) { // print N Fibonacci values 52 41 sout | next( f1 ) | next( f2 ) | endl; 53 42 } // for -
tests/coroutine/pingpong.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // pingpong.c -- 8 // 6 // 7 // pingpong.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Sep 20 11:55:23 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 20 13:41:39 201713 // Update Count : 2 614 // 12 // Last Modified On : Sat Aug 18 11:31:11 2018 13 // Update Count : 28 14 // 15 15 16 #include <coroutine >17 #include <fstream >16 #include <coroutine.hfa> 17 #include <fstream.hfa> 18 18 19 19 coroutine PingPong { … … 39 39 } 40 40 void main( PingPong & pingpong ) { // ping's starter ::main, pong's starter ping 41 for ( unsigned int i = 0; i < pingpong.N; i += 1 ) {41 for ( pingpong.N ) { // N ping-pongs 42 42 sout | pingpong.name | endl; 43 43 cycle( *pingpong.part ); -
tests/coroutine/prodcons.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // prodcons.c -- 8 // 6 // 7 // prodcons.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Oct 30 23:06:05 201713 // Update Count : 4214 // 12 // Last Modified On : Sat Aug 18 12:55:10 2018 13 // Update Count : 51 14 // 15 15 16 #include <fstream >17 #include <coroutine >18 #include <stdlib >// random16 #include <fstream.hfa> 17 #include <coroutine.hfa> 18 #include <stdlib.hfa> // random 19 19 #include <unistd.h> // getpid 20 20 … … 24 24 25 25 coroutine Prod { 26 Cons * c;26 Cons * c; 27 27 int N, money, receipt; 28 28 }; 29 void main( Prod & prod ) {// starter ::main29 void main( Prod & prod ) with( prod ) { // starter ::main 30 30 // 1st resume starts here 31 for ( i nt i = 0; i < prod.N; i += 1 ) {31 for ( i; N ) { // N pairs of values 32 32 int p1 = random( 100 ); 33 33 int p2 = random( 100 ); 34 34 sout | p1 | " " | p2 | endl; 35 int status = delivery( * prod.c, p1, p2 );36 sout | " $" | prod.money | endl;35 int status = delivery( *c, p1, p2 ); 36 sout | " $" | money | endl; 37 37 sout | status | endl; 38 prod.receipt += 1;38 receipt += 1; 39 39 } 40 stop( * prod.c );40 stop( *c ); 41 41 sout | "prod stops" | endl; 42 42 } … … 64 64 } 65 65 void ^?{}( Cons & cons ) {} 66 void main( Cons & cons ) {// starter prod66 void main( Cons & cons ) with( cons ) { // starter prod 67 67 // 1st resume starts here 68 68 int money = 1, receipt; 69 for ( ; ! cons.done; ) {70 sout | cons.p1 | " " | cons.p2 | endl;69 for ( ; ! done; ) { 70 sout | p1 | " " | p2 | endl; 71 71 sout | " $" | money | endl; 72 cons.status += 1;73 receipt = payment( * cons.p, money );72 status += 1; 73 receipt = payment( *p, money ); 74 74 sout | " #" | receipt | endl; 75 75 money += 1; … … 90 90 Prod prod; 91 91 Cons cons = { prod }; 92 random_seed( /* getpid() */ 103 );// fixed seed for testing92 srandom( /* getpid() */ 103 ); // fixed seed for testing 93 93 start( prod, 5, cons ); 94 94 sout | "main stops" | endl; -
tests/div.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // div.c -- 8 // 6 // 7 // div.c -- 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 : Wed Aug 30 07:56:28201713 // Update Count : 1 714 // 12 // Last Modified On : Thu Dec 7 09:06:52 2017 13 // Update Count : 18 14 // 15 15 16 #include <fstream >17 #include <stdlib > // div16 #include <fstream.hfa> 17 #include <stdlib.hfa> // div 18 18 19 19 struct T { int i; }; 20 20 T ?/?( T t1, T t2 ) { return t1.i / t2.i; } 21 21 T ?%?( T t1, T t2 ) { return t1.i % t2.i; } 22 ofstream * ?|?( ofstream *os, T t ) { return os | t.i; }22 ofstream & ?|?( ofstream & os, T t ) { return os | t.i; } 23 23 24 24 int main( void ) { -
tests/except-2.c
rf9feab8 r90152a4 2 2 3 3 4 #include <stdlib >4 #include <stdlib.hfa> 5 5 #include "except-mac.h" 6 6 -
tests/fstream_test.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // fstream_test.c -- 7 // fstream_test.c -- 8 8 // 9 9 // Author : Peter A. Buhr … … 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int main( void ) { -
tests/function-operator.c
rf9feab8 r90152a4 9 9 // Author : Rob Schluntz 10 10 // Created On : Fri Aug 25 15:21:11 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Aug 25 15:31:29 201713 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 2 09:27:53 2018 13 // Update Count : 8 14 14 // 15 15 16 #include <fstream >17 #include <stdlib >16 #include <fstream.hfa> 17 #include <stdlib.hfa> 18 18 19 19 #define length(array) (sizeof((array))/sizeof((array)[0])) … … 34 34 forall(otype Tin, dtype Input | Iterator(Input, Tin), otype Tout, dtype Output | Iterator(Output, Tout) | Assignable(Tout, Tin)) 35 35 Output copy(Input first, Input last, Output result) { 36 while (first != last) {37 *result = *first;38 ++result; ++first;39 }40 return result;36 while (first != last) { 37 *result = *first; 38 ++result; ++first; 39 } 40 return result; 41 41 } 42 42 … … 44 44 forall(otype Tin, dtype Input | Iterator(Input, Tin), otype Tout, dtype Output | Iterator(Output, Tout), otype FuncRet, dtype Func | { FuncRet ?()(Func *, Tin); } | Assignable(Tout, FuncRet)) 45 45 Output transform (Input first, Input last, Output result, Func * op) { 46 while (first != last) {47 *result = op(*first);48 ++result; ++first;49 }50 return result;46 while (first != last) { 47 *result = op(*first); 48 ++result; ++first; 49 } 50 return result; 51 51 } 52 52 … … 54 54 forall(dtype Iter, otype T | Iterator(Iter, T), otype Pred | { int ?()(Pred, T); }) 55 55 Iter find_if (Iter first, Iter last, Pred pred) { 56 while (first != last) {57 if (pred(*first)) return first;58 ++first;59 }60 return last;56 while (first != last) { 57 if (pred(*first)) return first; 58 ++first; 59 } 60 return last; 61 61 } 62 62 … … 64 64 forall(otype Generator, otype GenRet | { GenRet ?()(Generator &); }, dtype Iter, otype T| Iterator(Iter, T) | Assignable(T, GenRet)) 65 65 void generate(Iter first, Iter last, Generator & gen) { 66 int i = 0;67 while (first != last) {68 *first = gen();69 ++first;70 }66 int i = 0; 67 while (first != last) { 68 *first = gen(); 69 ++first; 70 } 71 71 } 72 72 … … 78 78 // TODO: abstract over os type with ostream trait; resolver is currently too slow for this to be reasonable, but it does work. 79 79 struct os_wrapper { 80 ofstream * out;80 ofstream * out; 81 81 }; 82 82 83 83 // TODO: abstract over (os, T) 84 84 os_wrapper ?=?(os_wrapper & wrapper, int x) { 85 wrapper.out | x | endl;86 return wrapper;85 *wrapper.out | x | endl; 86 return wrapper; 87 87 } 88 88 89 struct ostream_iterator {90 os_wrapper * out;91 };89 struct ostream_iterator { 90 os_wrapper * out; 91 }; 92 92 void ?{}(ostream_iterator & iter, ofstream * out) { 93 iter.out = new(out);93 iter.out = new(out); 94 94 } 95 95 // no destructor, memory leak. This is necessary for this to work at the moment, since … … 98 98 // implement Iterator 99 99 os_wrapper & *?(ostream_iterator iter) { 100 return *iter.out;100 return *iter.out; 101 101 } 102 102 ostream_iterator ++?(ostream_iterator & iter) { 103 // nothing to do104 return iter;103 // nothing to do 104 return iter; 105 105 } 106 106 int ?!=?(ostream_iterator i1, ostream_iterator i2) { 107 return i1.out->out != i2.out->out;107 return i1.out->out != i2.out->out; 108 108 } 109 109 … … 132 132 forall(otype Return, ttype Args) 133 133 struct function { 134 Return (*f)(Args);134 Return (*f)(Args); 135 135 }; 136 136 // TODO: missing adapter in these functions … … 148 148 149 149 // copy for output 150 ostream_iterator out_iter = { sout };150 ostream_iterator out_iter = { &sout }; 151 151 copy(begin(x), end(x), out_iter); 152 152 copy(begin(y), end(y), out_iter); … … 168 168 transform(begin(x), end(x), begin(x), ×2); 169 169 copy(begin(x), end(x), out_iter); 170 171 // REMOVE WHEN ?* PROBLEM FIXED. 172 delete(out_iter.out); 170 173 } 171 174 -
tests/functions.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // functions.c -- 8 // 6 // 7 // functions.c -- 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 : Mon Nov 27 18:08:54 201713 // Update Count : 1 114 // 12 // Last Modified On : Wed Jan 17 22:44:12 2018 13 // Update Count : 12 14 // 15 15 16 16 // ANSI function definitions … … 25 25 void g(void) 26 26 ) { 27 (* g)();27 (* g)(); 28 28 g(); 29 29 g = h; … … 32 32 int f1() {} 33 33 int (f2()) {} 34 int (* f3())() {}35 int * ((f4())) {}36 int ((* f5()))() {}37 int * f6() {}38 int * (f7)() {}39 int ** f8() {}40 int * const * (f9)() {}41 int (* f10())[] {}42 int (* f11())[][3] {}43 int ((* f12())[])[3] {}34 int (* f3())() {} 35 int * ((f4())) {} 36 int ((* f5()))() {} 37 int * f6() {} 38 int * (f7)() {} 39 int ** f8() {} 40 int * const * (f9)() {} 41 int (* f10())[] {} 42 int (* f11())[][3] {} 43 int ((* f12())[])[3] {} 44 44 45 45 // "implicit int" otype specifier (not ANSI) … … 50 50 extern const fII4( int i ) {} 51 51 52 * fII5() {}53 const * fII6() {}54 const long * fII7() {}55 static const long * fII8() {}56 const static long * fII9() {}52 * fII5() {} 53 const * fII6() {} 54 const long * fII7() {} 55 static const long * fII8() {} 56 const static long * fII9() {} 57 57 58 58 // K&R function definitions … … 117 117 [int](int) 118 118 ) { 119 int (* (*pc)[][10])[][3];119 int (* (* pc)[][10])[][3]; 120 120 * [][10] * [][3] int p; 121 121 * [] * [int](int) p; 122 122 } 123 123 124 static const int * f1() {}125 static [ const int ] f2() {}124 static const int * f1() {} 125 static [ * const int ] f2() {} 126 126 static inline [ const * int ] f3() {} 127 127 static inline [ const [ * int, int ] ] f4() {} … … 133 133 int (), 134 134 135 int * (),136 int ** (),137 int * const * (),135 int * (), 136 int ** (), 137 int * const * (), 138 138 int * const * const (), 139 139 … … 141 141 int ([10]), 142 142 143 int * ([]),144 int * ([10]),145 int ** ([]),146 int ** ([10]),147 int * const * ([]),148 int * const * ([10]),143 int * ([]), 144 int * ([10]), 145 int ** ([]), 146 int ** ([10]), 147 int * const * ([]), 148 int * const * ([10]), 149 149 int * const * const ([]), 150 150 int * const * const ([10]) … … 154 154 int (), 155 155 156 int * (),157 int ** (),158 int * const * (),156 int * (), 157 int ** (), 158 int * const * (), 159 159 int * const * const (), 160 160 … … 162 162 int ([10]), 163 163 164 int * ([]),165 int * ([10]),166 int ** ([]),167 int ** ([10]),168 int * const * ([]),169 int * const * ([10]),164 int * ([]), 165 int * ([10]), 166 int ** ([]), 167 int ** ([10]), 168 int * const * ([]), 169 int * const * ([10]), 170 170 int * const * const ([]), 171 171 int * const * const ([10]) … … 175 175 typedef int T; 176 176 177 int f( T (* f), T t ) {177 int f( T (* f), T t ) { 178 178 T (T); 179 179 } … … 184 184 //int (f[])() {} 185 185 //int f[]() {} 186 //int ((* f15())())[] {}186 //int ((* f15())())[] {} 187 187 188 188 // Local Variables: // -
tests/genericUnion.c
rf9feab8 r90152a4 1 #include <limits >1 #include <limits.hfa> 2 2 3 3 forall(otype T) -
tests/gmp.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // gmp.c -- 8 // 6 // 7 // gmp.c -- 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 : Thu Sep 28 18:33:51 201713 // Update Count : 55 514 // 12 // Last Modified On : Sat Aug 18 12:43:13 2018 13 // Update Count : 556 14 // 15 15 16 16 // NOTE: UBUNTU DOES NOT SUPPORT GMP MULTILIB, SO ONLY 64-BIT GMP IS TESTED. 17 17 18 #include <gmp >18 #include <gmp.hfa> 19 19 20 20 int main( void ) { … … 89 89 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 90 90 sout | 1 | fn | endl; 91 for ( unsigned int i = 2; i <= 200; i += 1) {91 for ( i; 2u ~= 200 ) { 92 92 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 93 93 sout | i | fn | endl; … … 99 99 Int fact = 1; // 1st case 100 100 sout | (int)0 | fact | endl; 101 for ( unsigned int i = 1; i <= 40; i += 1) {101 for ( i; 1u ~= 40u ) { 102 102 fact *= i; // general case 103 103 sout | i | fact | endl; -
tests/hello.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // hello.c -- 7 // hello.c -- 8 8 // 9 9 // Author : Peter A. Buhr … … 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int main() { -
tests/identFuncDeclarator.c
rf9feab8 r90152a4 10 10 // Created On : Wed Aug 17 08:36:34 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:37:06 201613 // Update Count : 112 // Last Modified On : Wed Jan 17 22:39:13 2018 13 // Update Count : 2 14 14 // 15 15 … … 18 18 int (f2); 19 19 20 int * f3;21 int ** f4;22 int * const * f5;20 int * f3; 21 int ** f4; 22 int * const * f5; 23 23 int * const * const f6; 24 24 25 int * (f7);26 int ** (f8);27 int * const * (f9);25 int * (f7); 26 int ** (f8); 27 int * const * (f9); 28 28 int * const * const (f10); 29 29 30 int (* f11);31 int (** f12);32 int (* const * f13);30 int (* f11); 31 int (** f12); 32 int (* const * f13); 33 33 int (* const * const f14); 34 34 … … 38 38 int (f18[10]); 39 39 40 int * f19[2];41 int * f20[10];42 int ** f21[2];43 int ** f22[10];44 int * const * f23[2];45 int * const * f24[10];40 int * f19[2]; 41 int * f20[10]; 42 int ** f21[2]; 43 int ** f22[10]; 44 int * const * f23[2]; 45 int * const * f24[10]; 46 46 int * const * const f25[2]; 47 47 int * const * const f26[10]; 48 48 49 int * (f27[2]);50 int * (f28[10]);51 int ** (f29[2]);52 int ** (f30[10]);53 int * const * (f31[2]);54 int * const * (f32[10]);49 int * (f27[2]); 50 int * (f28[10]); 51 int ** (f29[2]); 52 int ** (f30[10]); 53 int * const * (f31[2]); 54 int * const * (f32[10]); 55 55 int * const * const (f33[2]); 56 56 int * const * const (f34[10]); 57 57 58 int (* f35[2]);59 int (* f36[10]);60 int (** f37[2]);61 int (** f38[10]);62 int (* const * f39[2]);63 int (* const * f40[10]);58 int (* f35[2]); 59 int (* f36[10]); 60 int (** f37[2]); 61 int (** f38[10]); 62 int (* const * f39[2]); 63 int (* const * f40[10]); 64 64 int (* const * const f41[2]); 65 65 int (* const * const f42[10]); … … 72 72 int ((f48[3]))[3]; 73 73 74 int * f49[2][3];75 int * f50[3][3];76 int ** f51[2][3];77 int ** f52[3][3];78 int * const * f53[2][3];79 int * const * f54[3][3];74 int * f49[2][3]; 75 int * f50[3][3]; 76 int ** f51[2][3]; 77 int ** f52[3][3]; 78 int * const * f53[2][3]; 79 int * const * f54[3][3]; 80 80 int * const * const f55[2][3]; 81 81 int * const * const f56[3][3]; 82 82 83 int (* f57[2][3]);84 int (* f58[3][3]);85 int (** f59[2][3]);86 int (** f60[3][3]);87 int (* const * f61[2][3]);88 int (* const * f62[3][3]);83 int (* f57[2][3]); 84 int (* f58[3][3]); 85 int (** f59[2][3]); 86 int (** f60[3][3]); 87 int (* const * f61[2][3]); 88 int (* const * f62[3][3]); 89 89 int (* const * const f63[2][3]); 90 90 int (* const * const f64[3][3]); … … 93 93 int (f66)(int); 94 94 95 int * f67(int);96 int ** f68(int);97 int * const * f69(int);95 int * f67(int); 96 int ** f68(int); 97 int * const * f69(int); 98 98 int * const * const f70(int); 99 99 100 int * (f71)(int);101 int ** (f72)(int);102 int * const * (f73)(int);100 int * (f71)(int); 101 int ** (f72)(int); 102 int * const * (f73)(int); 103 103 int * const * const (f74)(int); 104 104 105 int (* f75)(int);106 int (** f76)(int);107 int (* const * f77)(int);105 int (* f75)(int); 106 int (** f76)(int); 107 int (* const * f77)(int); 108 108 int (* const * const f78)(int); 109 109 110 int (* (*f79)(int))();111 int (* (* const f80)(int))();110 int (* (* f79)(int))(); 111 int (* (* const f80)(int))(); 112 112 int (* const(* const f81)(int))(); 113 113 } -
tests/identParamDeclarator.c
rf9feab8 r90152a4 10 10 // Created On : Wed Aug 17 08:37:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:38:42 201613 // Update Count : 112 // Last Modified On : Wed Jan 17 22:36:11 2018 13 // Update Count : 2 14 14 // 15 15 16 int fred (16 int fred ( 17 17 int f1, 18 18 int (f2), … … 157 157 ); 158 158 159 //Dummy main 160 int main(int argc, char const *argv[]) 161 { 159 int main( int argc, char const *argv[] ) { // dummy main 162 160 return 0; 163 161 } -
tests/identity.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // identity.c -- 7 // identity.c -- 8 8 // 9 9 // Author : Peter A. Buhr … … 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 forall( otype T ) -
tests/ifwhileCtl.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // if cond.c --7 // ifwhileCtl.c -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Aug 26 10:13:11 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Sep 01 15:22:19 201713 // Update Count : 1411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 6 17:15:09 2018 13 // Update Count : 21 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int f( int r ) { return r; } … … 40 40 sout | "x != y incorrect" | endl; 41 41 } // if 42 43 if ( struct S { int i; } s = { 3 }; s.i < 4 ) { 44 S s1; 45 sout | "s.i < 4 correct" | endl; 46 } else { 47 S s1; 48 sout | "s.i >= 4 incorrect" | endl; 49 } // if 50 51 while ( int x = 1 ) { 52 sout | "x != 0 correct" | endl; 53 break; 54 } // while 55 56 while ( int x = 4, y = 0 ) { 57 sout | "x != 0 && y != 0 incorrect" | endl; 58 } // while 59 60 while ( int x = 5, y = f( x ); x == y ) { 61 sout | "x == y correct" | endl; 62 break; 63 } // while 64 65 while ( struct S { int i; } s = { 3 }; s.i < 4 ) { 66 S s1; 67 sout | "s.i < 4 correct" | endl; 68 break; 69 } // while 42 70 } // main 43 71 44 72 // Local Variables: // 45 73 // tab-width: 4 // 46 // compile-command: "cfa if cond.c" //74 // compile-command: "cfa ifwhileCtl.c" // 47 75 // End: // -
tests/io2.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // io .c --8 // 6 // 7 // io2.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 11 08:53:41 201713 // Update Count : 8114 // 12 // Last Modified On : Thu May 24 21:17:41 2018 13 // Update Count : 103 14 // 15 15 16 #include <fstream> 16 #include <fstream.hfa> 17 18 #define xstr(s) str(s) 19 #define str(s) #s 17 20 18 21 int main() { 19 char c; // basic types 22 _Bool b; // basic types 23 char c; 20 24 signed char sc; 21 25 unsigned char usc; … … 37 41 char s1[size], s2[size]; 38 42 39 int x = 3, y = 5, z = 7; 40 sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl; 41 sout | 1 | 2 | 3 | endl; 42 sout | '1' | '2' | '3' | endl; 43 sout | 1 | "" | 2 | "" | 3 | endl; 44 sout | endl; 45 46 sout | "opening delimiters" | endl; 47 sout 48 | "x (" | 1 49 | "x [" | 2 50 | "x {" | 3 51 | "x =" | 4 52 | "x $" | 5 53 | "x £" | 6 54 | "x ¥" | 7 55 | "x ¡" | 8 56 | "x ¿" | 9 57 | "x «" | 10 58 | endl | endl; 59 60 sout | "closing delimiters" | endl; 61 sout 62 | 1 | ", x" 63 | 2 | ". x" 64 | 3 | "; x" 65 | 4 | "! x" 66 | 5 | "? x" 67 | 6 | "% x" 68 | 7 | "¢ x" 69 | 8 | "» x" 70 | 9 | ") x" 71 | 10 | "] x" 72 | 11 | "} x" 73 | endl | endl; 74 75 sout | "opening/closing delimiters" | endl; 76 sout 77 | "x`" | 1 | "`x'" | 2 78 | "'x\"" | 3 | "\"x:" | 4 79 | ":x " | 5 | " x\t" | 6 80 | "\tx\f" | 7 | "\fx\v" | 8 81 | "\vx\n" | 9 | "\nx\r" | 10 82 | "\rx" 83 | endl | endl; 84 85 sout | "override opening/closing delimiters" | endl; 86 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl; 87 sout | endl; 88 89 ifstream in; // create / open file 90 open( &in, "io.data", "r" ); 43 ifstream in = { xstr(IN_DIR) "io.data" }; // create / open file 91 44 92 45 sout | "input bacis types" | endl; 93 &in | c | sc | usc // character 94 | si | usi | i | ui | li | uli | lli | ulli // integral 95 | f | d | ld // floating point 96 | fc | dc | ldc // floating-point complex 97 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 46 in | b // boolean 47 | c | sc | usc // character 48 | si | usi | i | ui | li | uli | lli | ulli // integral 49 | f | d | ld // floating point 50 | fc | dc | ldc // floating-point complex 51 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 98 52 sout | endl; 99 53 100 54 sout | "output basic types" | endl; 101 sout | c | ' ' | sc | ' ' | usc | endl // character 102 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 103 | f | d | ld | endl // floating point 104 | fc | dc | ldc | endl; // complex 55 sout | b | endl // boolean 56 | c | ' ' | sc | ' ' | usc | endl // character 57 | si | usi | i | ui | li | uli | lli | ulli | endl // integral 58 | f | d | ld | endl // floating point 59 | fc | dc | ldc | endl; // complex 105 60 sout | endl; 106 61 … … 112 67 sout | "toggle separator" | endl; 113 68 sout | f | "" | d | "" | ld | endl // floating point without separator 114 | sepDisable | fc | dc | ldc | endl// complex without separator115 | fc | sepOn | dc | ldc | endl // local separator add116 | sepEnable | fc | dc | ldc | endl // complex with separator117 | fc | sepOff | dc | ldc | endl// local separator removal118 | s1 | sepOff | s2 | endl // local separator removal119 | s1 | "" | s2 | endl; // local separator removal69 | sepDisable | fc | dc | ldc | endl // complex without separator 70 | fc | sepOn | dc | ldc | endl // local separator add 71 | sepEnable | fc | dc | ldc | endl // complex with separator 72 | fc | sepOff | dc | ldc | endl // local separator removal 73 | s1 | sepOff | s2 | endl // local separator removal 74 | s1 | "" | s2 | endl; // local separator removal 120 75 sout | endl; 121 76 … … 125 80 sout | " to \"" | sep | "\"" | endl; 126 81 sout | f | d | ld | endl 127 | fc | dc | ldc | endl128 | s1 | s2 | endl129 | t1 | t2 | endl; // print tuple82 | fc | dc | ldc | endl 83 | s1 | s2 | endl 84 | t1 | t2 | endl; // print tuple 130 85 sout | endl; 131 86 sout | "from \"" | sep | "\" "; … … 133 88 sout | "to \"" | sep | "\"" | endl; 134 89 sout | f | d | ld | endl 135 | fc | dc | ldc | endl136 | s1 | s2 | endl137 | t1 | t2 | endl; // print tuple90 | fc | dc | ldc | endl 91 | s1 | s2 | endl 92 | t1 | t2 | endl; // print tuple 138 93 sout | endl; 139 94 … … 179 134 // Local Variables: // 180 135 // tab-width: 4 // 181 // compile-command: "cfa io .c" //136 // compile-command: "cfa io2.c" // 182 137 // End: // -
tests/labelledExit.c
rf9feab8 r90152a4 10 10 // Created On : Wed Aug 10 07:29:39 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 10 07:30:15 201613 // Update Count : 112 // Last Modified On : Thu Aug 16 08:55:39 2018 13 // Update Count : 3 14 14 // 15 15 … … 60 60 } 61 61 62 D: for ( ;;) {62 D: for () { 63 63 break D; 64 64 continue D; … … 67 67 Z : i += 1; 68 68 goto Z; 69 X: Y: for ( ;;) {69 X: Y: for () { 70 70 i += 1; 71 71 if ( i > 5 ) continue X; … … 74 74 break; 75 75 } 76 XX: for ( ;;) {77 YY: for ( ;;) {78 ZZ: for ( ;;) {76 XX: for () { 77 YY: for () { 78 ZZ: for () { 79 79 i += 1; 80 80 if ( i > 5 ) continue XX; … … 89 89 } 90 90 91 for ( ;;) ;91 for () ; 92 92 for ( int i = 0 ;; ) ; 93 93 for ( ; i < 0; ) ; … … 97 97 L20: L21: L22: L23: L24: L25: L26: L27: L28: L29: 98 98 L31: L32: L33: L34: 99 for ( ;;) {99 for () { 100 100 break L0; 101 101 } -
tests/literals.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // literals.c -- 8 // 6 // 7 // literals.c -- 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 : Mon Sep 25 20:26:00 201713 // Update Count : 13 214 // 12 // Last Modified On : Sun Jul 1 15:12:15 2018 13 // Update Count : 137 14 // 15 15 16 16 #ifdef __CFA__ 17 17 #include <stdint.h> 18 #include <fstream >18 #include <fstream.hfa> 19 19 20 20 void f( char v ) { sout | "char " | v | endl; } … … 31 31 // integer literals 32 32 33 // binary 34 0b01101011; 0b01101011u; 0b01101011l; 0b01101011ll; 0b01101011ul; 0b01101011lu; 0b01101011ull; 0b01101011llu; 35 +0b01101011; +0b01101011u; +0b01101011l; +0b01101011ll; +0b01101011ul; +0b01101011lu; +0b01101011ull; +0b01101011llu; 36 -0b01101011; -0b01101011u; -0b01101011l; -0b01101011ll; -0b01101011ul; -0b01101011lu; -0b01101011ull; -0b01101011llu; 37 33 38 // octal 34 39 01234567; 01234567u; 01234567l; 01234567ll; 01234567ul; 01234567lu; 01234567ull; 01234567llu; … … 149 154 // fixed-size length 150 155 156 // binary 157 0b01101011_l8; 0b01101011_l16; 0b01101011_l32; 0b01101011_l64; 0b01101011_l8u; 0b01101011_ul16; 0b01101011_l32u; 0b01101011_ul64; 158 +0b01101011_l8; +0b01101011_l16; +0b01101011_l32; +0b01101011_l64; +0b01101011_l8u; +0b01101011_ul16; +0b01101011_l32u; +0b01101011_ul64; 159 -0b01101011_l8; -0b01101011_l16; -0b01101011_l32; -0b01101011_l64; -0b01101011_l8u; -0b01101011_ul16; -0b01101011_l32u; -0b01101011_ul64; 160 161 #ifdef __LP64__ // 64-bit processor 162 0b01101011_l128; 0b01101011_ul128; 163 +0b01101011_l128; +0b01101011_ul128; 164 -0b01101011_l128; -0b01101011_ul128; 165 #endif // __LP64__ 166 151 167 // octal 152 01234567_l8; 01234567_l16; 01234567_l32; 01234567_l64; 01234567_l128; 01234567_l8u; 01234567_ul16; 01234567_l32u; 01234567_ul64; 01234567_ul128; 153 +01234567_l8; +01234567_l16; +01234567_l32; +01234567_l64; +01234567_l128; +01234567_l8u; +01234567_ul16; +01234567_l32u; +01234567_ul64; +01234567_ul128; 154 -01234567_l8; -01234567_l16; -01234567_l32; -01234567_l64; -01234567_l128; -01234567_l8u; -01234567_ul16; -01234567_l32u; -01234567_ul64; -01234567_ul128; 168 01234567_l8; 01234567_l16; 01234567_l32; 01234567_l64; 01234567_l8u; 01234567_ul16; 01234567_l32u; 01234567_ul64; 169 +01234567_l8; +01234567_l16; +01234567_l32; +01234567_l64; +01234567_l8u; +01234567_ul16; +01234567_l32u; +01234567_ul64; 170 -01234567_l8; -01234567_l16; -01234567_l32; -01234567_l64; -01234567_l8u; -01234567_ul16; -01234567_l32u; -01234567_ul64; 171 172 #ifdef __LP64__ // 64-bit processor 173 01234567_l128; 01234567_ul128; 174 +01234567_l128; +01234567_ul128; 175 -01234567_l128; -01234567_ul128; 176 #endif // __LP64__ 155 177 156 178 // decimal 157 1234567890L8; 1234567890L16; 1234567890l32; 1234567890l64; 1234567890l128; 1234567890UL8; 1234567890L16U; 1234567890Ul32; 1234567890l64u; 1234567890l128u; 158 +1234567890L8; +1234567890L16; +1234567890l32; +1234567890l64; +1234567890l128; +1234567890UL8; +1234567890L16U; +1234567890Ul32; +1234567890l64u; +1234567890l128u; 159 -1234567890L8; -1234567890L16; -1234567890l32; -1234567890l64; -1234567890l128; -1234567890UL8; -1234567890L16U; -1234567890Ul32; -1234567890l64u; -1234567890l128u; 179 1234567890L8; 1234567890L16; 1234567890l32; 1234567890l64; 1234567890UL8; 1234567890L16U; 1234567890Ul32; 1234567890l64u; 180 +1234567890L8; +1234567890L16; +1234567890l32; +1234567890l64; +1234567890UL8; +1234567890L16U; +1234567890Ul32; +1234567890l64u; 181 -1234567890L8; -1234567890L16; -1234567890l32; -1234567890l64; -1234567890UL8; -1234567890L16U; -1234567890Ul32; -1234567890l64u; 182 183 #ifdef __LP64__ // 64-bit processor 184 1234567890l128; 1234567890l128u; 185 +1234567890l128; +1234567890l128u; 186 -1234567890l128; -1234567890l128u; 187 #endif // __LP64__ 160 188 161 189 // hexadecimal … … 193 221 -0123456789.0123456789E+09L32; -0123456789.0123456789E+09L64; -0123456789.0123456789E+09L80; -0123456789.0123456789E+09L128; 194 222 0123456789.0123456789E-09L32; 0123456789.0123456789E-09L64; 0123456789.0123456789E-09L80; 0123456789.0123456789E-09L128; 195 223 196 224 0x0123456789.p09l32; 0x0123456789.p09l64; 0x0123456789.p09l80; 0x0123456789.p09l128; 197 225 +0x0123456789.p09l32; +0x0123456789.p09l64; +0x0123456789.p09l80; +0x0123456789.p09l128; -
tests/math1.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // math1.c -- 8 // 6 // 7 // math1.c -- 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 : Fri Aug 11 15:16:41 201713 // Update Count : 8 414 // 12 // Last Modified On : Thu May 24 21:01:15 2018 13 // Update Count : 85 14 // 15 15 16 #include <fstream >17 #include <math >16 #include <fstream.hfa> 17 #include <math.hfa> 18 18 19 19 int main( void ) { … … 41 41 sout | "exp2:" | exp2( 1.0F ) | exp2( 1.0D ) | exp2( 1.0L ) | endl; 42 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. 0DL+1.0LI, 1.0DL+1.0LI ) | 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; 44 44 45 45 int b = 4; … … 48 48 sout | "\\" | b | b \ e | endl; 49 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; 50 51 //---------------------- Logarithm ----------------------52 53 sout | "log:" | log( 1.0F ) | log( 1.0D ) | log( 1.0L ) | log( 1.0F+1.0FI ) | log( 1.0D+1.0DI ) | log( 1.0DL+1.0LI ) | endl;54 sout | "log2:" | log2( 8.0F ) | log2( 8.0D ) | log2( 8.0L ) | endl;55 sout | "log10:" | log10( 100.0F ) | log10( 100.0D ) | log10( 100.0L ) | endl;56 sout | "log1p:" | log1p( 1.0F ) | log1p( 1.0D ) | log1p( 1.0L ) | endl;57 sout | "ilogb:" | ilogb( 1.0F ) | ilogb( 1.0D ) | ilogb( 1.0L ) | endl;58 sout | "logb:" | logb( 8.0F ) | logb( 8.0D ) | logb( 8.0L ) | endl;59 60 sout | "sqrt:" | sqrt( 1.0F ) | sqrt( 1.0D ) | sqrt( 1.0L ) | sqrt( 1.0F+1.0FI ) | sqrt( 1.0D+1.0DI ) | sqrt( 1.0DL+1.0LI ) | endl;61 sout | "cbrt:" | cbrt( 27.0F ) | cbrt( 27.0D ) | cbrt( 27.0L ) | endl;62 sout | "hypot:" | hypot( 1.0F, -1.0F ) | hypot( 1.0D, -1.0D ) | hypot( 1.0L, -1.0L ) | endl;63 50 } // main 64 51 -
tests/math3.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // math 2.c --8 // 6 // 7 // math3.c -- 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 : Fri Aug 11 15:40:04 201713 // Update Count : 8 114 // 12 // Last Modified On : Thu May 24 21:06:12 2018 13 // Update Count : 82 14 // 15 15 16 #include <fstream >17 #include <math >16 #include <fstream.hfa> 17 #include <math.hfa> 18 18 19 19 int main( void ) { … … 21 21 double d; 22 22 long double l; 23 24 //---------------------- Trigonometric ----------------------25 26 sout | "sin:" | sin( 1.0F ) | sin( 1.0D ) | sin( 1.0L ) | sin( 1.0F+1.0FI ) | sin( 1.0D+1.0DI ) | sin( 1.0DL+1.0LI ) | endl;27 sout | "cos:" | cos( 1.0F ) | cos( 1.0D ) | cos( 1.0L ) | cos( 1.0F+1.0FI ) | cos( 1.0D+1.0DI ) | cos( 1.0DL+1.0LI ) | endl;28 sout | "tan:" | tan( 1.0F ) | tan( 1.0D ) | tan( 1.0L ) | tan( 1.0F+1.0FI ) | tan( 1.0D+1.0DI ) | tan( 1.0DL+1.0LI ) | endl;29 sout | "asin:" | asin( 1.0F ) | asin( 1.0D ) | asin( 1.0L ) | asin( 1.0F+1.0FI ) | asin( 1.0D+1.0DI ) | asin( 1.0DL+1.0LI ) | endl;30 sout | "acos:" | acos( 1.0F ) | acos( 1.0D ) | acos( 1.0L ) | acos( 1.0F+1.0FI ) | acos( 1.0D+1.0DI ) | acos( 1.0DL+1.0LI ) | endl;31 sout | "atan:" | atan( 1.0F ) | atan( 1.0D ) | atan( 1.0L ) | atan( 1.0F+1.0FI ) | atan( 1.0D+1.0DI ) | atan( 1.0DL+1.0LI ) | endl;32 sout | "atan2:" | atan2( 1.0F, 1.0F ) | atan2( 1.0D, 1.0D ) | atan2( 1.0L, 1.0L );33 sout | "atan:" | atan( 1.0F, 1.0F ) | atan( 1.0D, 1.0D ) | atan( 1.0L, 1.0L ) | endl;34 23 35 24 //---------------------- Hyperbolic ---------------------- … … 59 48 // Local Variables: // 60 49 // tab-width: 4 // 61 // compile-command: "cfa math 2.c" //50 // compile-command: "cfa math3.c" // 62 51 // End: // -
tests/math4.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // math 3.c --8 // 6 // 7 // math4.c -- 8 // 9 9 // Author : Peter A. Buhr 10 // Created On : Fri Apr 22 14:59:21 201610 // Created On : Thu May 24 20:56:54 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 11 15:40:03 201713 // Update Count : 8114 // 12 // Last Modified On : Thu May 24 20:58:06 2018 13 // Update Count : 2 14 // 15 15 16 #include <fstream >17 #include <math >16 #include <fstream.hfa> 17 #include <math.hfa> 18 18 19 19 int main( void ) { -
tests/maybe.c
rf9feab8 r90152a4 15 15 16 16 #include <assert.h> 17 #include <containers/maybe >17 #include <containers/maybe.hfa> 18 18 19 19 void checkPredicates() { -
tests/minmax.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // minmax.c -- 7 // minmax.c -- 8 8 // 9 // Author : Richard C. Bilson9 // 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 : Mon Feb 29 23:45:16 201613 // Update Count : 4912 // Last Modified On : Tue Apr 10 17:29:09 2018 13 // Update Count : 50 14 14 // 15 15 16 #include <fstream >17 #include <stdlib > // min, max16 #include <fstream.hfa> 17 #include <stdlib.hfa> // min, max 18 18 19 19 int main( void ) { -
tests/operators.c
rf9feab8 r90152a4 27 27 a(b); 28 28 a + b; 29 struct accumulator ?+?; // why not, eh?30 a + b;31 29 } 32 30 -
tests/preempt_longrun/Makefile.in
rf9feab8 r90152a4 91 91 build_triplet = @build@ 92 92 host_triplet = @host@ 93 subdir = src/tests/preempt_longrun93 subdir = tests/preempt_longrun 94 94 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 95 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 95 am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \ 96 $(top_srcdir)/configure.ac 96 97 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 97 98 $(ACLOCAL_M4) … … 337 338 AWK = @AWK@ 338 339 BACKEND_CC = @BACKEND_CC@ 339 CC = @CFA_BINDIR@/@CFA_NAME@ 340 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@ 341 CC = @CFACC@ 340 342 CCAS = @CCAS@ 341 343 CCASDEPMODE = @CCASDEPMODE@ 342 344 CCASFLAGS = @CCASFLAGS@ 343 345 CCDEPMODE = @CCDEPMODE@ 346 CFACC = @CFACC@ 347 CFACPP = @CFACPP@ 344 348 CFA_BACKEND_CC = @CFA_BACKEND_CC@ 345 349 CFA_BINDIR = @CFA_BINDIR@ … … 358 362 DEFS = @DEFS@ 359 363 DEPDIR = @DEPDIR@ 364 DRIVER_DIR = @DRIVER_DIR@ 360 365 ECHO_C = @ECHO_C@ 361 366 ECHO_N = @ECHO_N@ … … 364 369 EXEEXT = @EXEEXT@ 365 370 GREP = @GREP@ 371 HOST_FLAGS = @HOST_FLAGS@ 366 372 INSTALL = @INSTALL@ 367 373 INSTALL_DATA = @INSTALL_DATA@ … … 373 379 LEXLIB = @LEXLIB@ 374 380 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ 381 LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@ 382 LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@ 375 383 LIBOBJS = @LIBOBJS@ 376 384 LIBS = @LIBS@ 377 385 LTLIBOBJS = @LTLIBOBJS@ 378 MACHINE_TYPE = @MACHINE_TYPE@379 MAINT = @MAINT@380 386 MAKEINFO = @MAKEINFO@ 381 387 MKDIR_P = @MKDIR_P@ … … 393 399 SHELL = @SHELL@ 394 400 STRIP = @STRIP@ 401 TARGET_HOSTS = @TARGET_HOSTS@ 395 402 VERSION = @VERSION@ 396 403 YACC = @YACC@ … … 448 455 top_builddir = @top_builddir@ 449 456 top_srcdir = @top_srcdir@ 457 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 450 458 repeats = 10 451 459 max_time = 600 452 preempt = 1_000ul 453 REPEAT = ${abs_top_srcdir}/tools/repeat -s 454 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -debug -O2 -DPREEMPTION_RATE=${preempt} 455 TESTS = block create disjoint enter enter3 processor stack wait yield 460 preempt = 10ul\`ms 461 debug = -debug 462 type = LONG 463 REPEAT = ${abs_top_srcdir}/tools/repeat 464 WATCHDOG = ${abs_top_srcdir}/tools/watchdog 465 TIME = /usr/bin/time -f "%E" 466 467 # $(shell ./update-type $(type)) 468 # ./update-type $(type) 469 UPDATED_TYPE = $(shell ./update-type $(type)) 470 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} -I.. -I. -DTEST_$(shell cat .type | tr a-z A-Z) 471 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 456 472 all: all-am 457 473 458 474 .SUFFIXES: 459 475 .SUFFIXES: .log .test .test$(EXEEXT) .trs 460 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@$(srcdir)/Makefile.am $(am__configure_deps)476 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 461 477 @for dep in $?; do \ 462 478 case '$(am__configure_deps)' in \ … … 467 483 esac; \ 468 484 done; \ 469 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tests/preempt_longrun/Makefile'; \485 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/preempt_longrun/Makefile'; \ 470 486 $(am__cd) $(top_srcdir) && \ 471 $(AUTOMAKE) --foreign src/tests/preempt_longrun/Makefile487 $(AUTOMAKE) --foreign tests/preempt_longrun/Makefile 472 488 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 473 489 @case '$?' in \ … … 482 498 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 483 499 484 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@$(am__configure_deps)500 $(top_srcdir)/configure: $(am__configure_deps) 485 501 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 486 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@$(am__aclocal_m4_deps)502 $(ACLOCAL_M4): $(am__aclocal_m4_deps) 487 503 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 488 504 $(am__aclocal_m4_deps): … … 642 658 $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 643 659 "$$tst" $(AM_TESTS_FD_REDIRECT) 660 coroutine.log: coroutine 661 @p='coroutine'; \ 662 b='coroutine'; \ 663 $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ 664 --log-file $$b.log --trs-file $$b.trs \ 665 $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 666 "$$tst" $(AM_TESTS_FD_REDIRECT) 644 667 create.log: create 645 668 @p='create'; \ … … 864 887 865 888 866 .INTERMEDIATE: ${TESTS}889 # .INTERMEDIATE: ${TESTS} 867 890 868 891 all-local: ${TESTS:=.run} 869 892 893 runall : ${TESTS:=.run} 894 @ echo "All programs terminated normally" 895 896 watchall : ${TESTS:=.watch} 897 @ echo "All programs terminated normally" 898 899 compileall : ${TESTS} 900 @ echo "Compiled" 901 870 902 clean-local: 871 rm -f ${TESTS} 872 873 % : %.c ${CC} 874 ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}875 876 %.run : % 877 @ time ${REPEAT} $(repeats) timeout ${max_time} ./${<}903 rm -f ${TESTS} core* out.log .type 904 905 % : %.c ${CC} ${UPDATED_TYPE} 906 ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@} 907 908 %.run : % ${REPEAT} 909 @ time ${REPEAT} -r out.log -i -s $(repeats) timeout ${max_time} ./${<} 878 910 @ rm ${<} 879 911 @ echo -e "${<}: SUCCESS\n" 912 913 %.watch : % ${WATCHDOG} 914 @ time ${WATCHDOG} ./${<} 915 @ rm ${<} 916 @ echo -e "${<}: SUCCESS\n" 917 918 %.time : % ${REPEAT} 919 @ ${REPEAT} -i -s -- $(repeats) $(TIME) -a -o times.log ./${<} 920 @ rm ${<} 921 @ echo -e "${<}: SUCCESS\n" 922 923 ${REPEAT}: ${abs_top_srcdir}/tools/Makefile 924 @+make -C ${abs_top_srcdir}/tools/ 925 926 ${WATCHDOG}: ${abs_top_srcdir}/tools/Makefile 927 @+make -C ${abs_top_srcdir}/tools/ 880 928 881 929 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
tests/pybin/tools.py
rf9feab8 r90152a4 9 9 import stat 10 10 import sys 11 import fileinput 11 12 12 13 from pybin import settings … … 34 35 return proc.returncode, out 35 36 37 def is_ascii(fname): 38 if settings.dry_run: 39 print("is_ascii: %s" % fname) 40 return True 41 42 if not os.path.isfile(fname): 43 return False 44 45 code, out = sh("file %s" % fname, print2stdout = False) 46 if code != 0: 47 return False 48 49 match = re.search(".*: (.*)", out) 50 51 if not match: 52 return False 53 54 return match.group(1).startswith("ASCII text") 55 36 56 # Remove 1 or more files silently 37 57 def rm( files ): 38 try: 58 if isinstance( files, basestring ): 59 sh("rm -f %s > /dev/null 2>&1" % files ) 60 else: 39 61 for file in files: 40 62 sh("rm -f %s > /dev/null 2>&1" % file ) 41 except TypeError: 42 sh("rm -f %s > /dev/null 2>&1" % files ) 63 64 # Create 1 or more directory 65 def mkdir( files ): 66 if isinstance( files, basestring ): 67 sh("mkdir -p %s" % os.path.dirname(files) ) 68 else: 69 for file in files: 70 sh("mkdir -p %s" % os.path.dirname(file) ) 71 43 72 44 73 def chdir( dest = __main__.__file__ ): … … 50 79 def diff( lhs, rhs ): 51 80 # diff the output of the files 52 diff_cmd = ("diff --ignore-all-space "81 diff_cmd = ("diff --ignore-all-space --text " 53 82 "--ignore-blank-lines " 54 83 "--old-group-format='\t\tmissing lines :\n" … … 76 105 '-s' if silent else '', 77 106 test_param, 107 settings.arch.flags, 78 108 settings.debug.flags, 109 settings.install.flags, 79 110 flags, 80 111 target, … … 83 114 return sh(cmd) 84 115 116 def which(program): 117 import os 118 def is_exe(fpath): 119 return os.path.isfile(fpath) and os.access(fpath, os.X_OK) 120 121 fpath, fname = os.path.split(program) 122 if fpath: 123 if is_exe(program): 124 return program 125 else: 126 for path in os.environ["PATH"].split(os.pathsep): 127 exe_file = os.path.join(path, program) 128 if is_exe(exe_file): 129 return exe_file 130 131 return None 85 132 ################################################################################ 86 133 # file handling … … 89 136 # helper function to replace patterns in a file 90 137 def file_replace(fname, pat, s_after): 91 # first, see if the pattern is even in the file. 92 with open(fname) as f: 93 if not any(re.search(pat, line) for line in f): 94 return # pattern does not occur in file so we are done. 95 96 # pattern is in the file, so perform replace operation. 97 with open(fname) as f: 98 out_fname = fname + ".tmp" 99 out = open(out_fname, "w") 100 for line in f: 101 out.write(re.sub(pat, s_after, line)) 102 out.close() 103 os.rename(out_fname, fname) 138 if settings.dry_run: 139 print("replacing '%s' with '%s' in %s" % (pat, s_after, fname)) 140 return 141 142 file = fileinput.FileInput(fname, inplace=True, backup='.bak') 143 for line in file: 144 print(line.replace(pat, s_after), end='') 145 file.close() 104 146 105 147 # helper function to check if a files contains only a specific string … … 124 166 # transform path to canonical form 125 167 def canonicalPath(path): 126 return os.path.join('.', os.path.normpath(path) ) 168 abspath = os.path.abspath(__main__.__file__) 169 dname = os.path.dirname(abspath) 170 return os.path.join(dname, os.path.normpath(path) ) 127 171 128 172 # compare path even if form is different … … 135 179 for name in names: 136 180 path = os.path.join(dirname, name) 137 138 181 op( path ) 139 182 140 183 # Start the walk 141 os.path.walk('.', step, '') 184 dname = settings.SRCDIR 185 os.path.walk(dname, step, '') 142 186 143 187 ################################################################################ 144 188 # system 145 189 ################################################################################ 146 147 # parses the Makefile to find the machine type (32-bit / 64-bit)148 def getMachineType():149 sh('echo "void ?{}(int&a,int b){}int main(){return 0;}" > .dummy.c')150 ret, out = make('.dummy', silent = True)151 152 if ret != 0:153 print("Failed to identify architecture:")154 print(out)155 print("Stopping")156 rm( (".dummy.c",".dummy") )157 sys.exit(1)158 159 _, out = sh("file .dummy", print2stdout=False)160 rm( (".dummy.c",".dummy") )161 162 if settings.dry_run :163 return 'x64'164 165 return re.search(r"[^,]+,([^,]+),", out).group(1).strip()166 167 190 # count number of jobs to create 168 191 def jobCount( options, tests ): 169 192 # check if the user already passed in a number of jobs for multi-threading 170 make_flags = os.environ.get('MAKEFLAGS') 171 make_jobs_fds = re.search("--jobserver-(auth|fds)=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None 172 if make_jobs_fds : 173 tokens = os.read(int(make_jobs_fds.group(2)), 1024) 174 options.jobs = len(tokens) 175 os.write(int(make_jobs_fds.group(3)), tokens) 193 if not options.jobs: 194 make_flags = os.environ.get('MAKEFLAGS') 195 force = bool(make_flags) 196 make_jobs_fds = re.search("--jobserver-(auth|fds)=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None 197 if make_jobs_fds : 198 tokens = os.read(int(make_jobs_fds.group(2)), 1024) 199 options.jobs = len(tokens) 200 os.write(int(make_jobs_fds.group(3)), tokens) 201 else : 202 options.jobs = multiprocessing.cpu_count() 176 203 else : 177 options.jobs = multiprocessing.cpu_count()204 force = True 178 205 179 206 # make sure we have a valid number of jobs that corresponds to user input … … 182 209 sys.exit(1) 183 210 184 return min( options.jobs, len(tests) ), True if make_flags else False211 return min( options.jobs, len(tests) ), force 185 212 186 213 # setup a proper processor pool with correct signal handling … … 215 242 return False 216 243 217 218 settings.set_machine_default( getMachineType ) 244 def fancy_print(text): 245 column = which('column') 246 if column: 247 cmd = "%s 2> /dev/null" % column 248 print(cmd) 249 proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True) 250 proc.communicate(input=text) 251 else: 252 print(text) -
tests/quoted_keyword.c
rf9feab8 r90152a4 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 struct { -
tests/raii/dtor-early-exit.c
rf9feab8 r90152a4 10 10 // Created On : Wed Aug 17 08:26:25 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:29:37 2016 13 // Update Count : 2 14 // 15 16 #include <fstream> 17 #include <stdlib> 18 extern "C" { 19 #define false ((int)0) // until stdbool.h works 20 #define assert(cond) if (! (cond)) { sout | "Assertion failed: (" | #cond | ") at " __FILE__ | ":" | __LINE__ | endl; abort(); } 21 } 12 // Last Modified On : Sat Aug 11 07:58:39 2018 13 // Update Count : 8 14 // 15 16 #include <fstream.hfa> 17 #include <stdlib.hfa> 18 #include <assert.h> 22 19 23 20 struct A { -
tests/raii/globals.c
rf9feab8 r90152a4 1 #include <fstream >1 #include <fstream.hfa> 2 2 3 3 struct value_t { -
tests/random.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // random.c -- 8 // 6 // 7 // random.c -- 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 : Mon Oct 30 23:06:49 201713 // Update Count : 614 // 12 // Last Modified On : Tue Jan 2 12:19:34 2018 13 // Update Count : 19 14 // 15 15 16 #include <fstream >17 #include <stdlib > // random16 #include <fstream.hfa> 17 #include <stdlib.hfa> // random 18 18 #include <unistd.h> // getpid 19 19 20 20 int main() { 21 // srandom( getpid() ); // set random seed22 random_seed( 1003 );// fixed seed for repeatable tests21 // srandom( getpid() ); // set random seed 22 srandom( 1003 ); // fixed seed for repeatable tests 23 23 24 24 // test polymorphic calls to random and stream 25 25 char c = random(); 26 26 sout | c | endl; 27 c = random( 'A' ); 28 sout | c | endl; 29 c = random( 'A', 'Z' ); 30 sout | c | endl; 31 27 32 int i = random(); 28 33 sout | i | endl; 34 i = random( 10 ); 35 sout | i | endl; 36 i = random( -10, 20 ); 37 sout | i | endl; 38 29 39 unsigned int ui = random(); 30 40 sout | ui | endl; 41 ui = random( 10u ); 42 sout | ui | endl; 43 ui = random( 10u, 20u ); 44 sout | ui | endl; 45 31 46 long int li = random(); 32 47 sout | li | endl; 48 li = random( 10l ); 49 sout | li | endl; 50 li = random( -10l, 20l ); 51 sout | li | endl; 52 33 53 unsigned long int uli = random(); 34 54 sout | uli | endl; 55 uli = random( 10ul ); 56 sout | uli | endl; 57 uli = random( 10ul, 20ul ); 58 sout | uli | endl; 59 35 60 float f = random(); 36 61 sout | f | endl; 62 37 63 double d = random(); 38 64 sout | d | endl; 65 39 66 float _Complex fc = random(); 40 67 sout | fc | endl; 68 41 69 double _Complex dc = random(); 42 70 sout | dc | endl; 71 43 72 long double _Complex ldc = random(); 44 73 sout | ldc | endl; -
tests/rational.c
rf9feab8 r90152a4 14 14 // 15 15 16 #include <rational >17 #include <limits >18 #include <stdlib >19 #include <fstream >16 #include <rational.hfa> 17 #include <limits.hfa> 18 #include <stdlib.hfa> 19 #include <fstream.hfa> 20 20 21 21 // UNNECESSARY, FIX ME -
tests/references.c
rf9feab8 r90152a4 46 46 47 47 int main() { 48 int x = 123456, *p1 = &x, **p2 = &p1, ***p3 = &p2,48 int x = 123456, x2 = 789, *p1 = &x, **p2 = &p1, ***p3 = &p2, 49 49 &r1 = x, &&r2 = r1, &&&r3 = r2; 50 50 ***p3 = 3; // change x … … 52 52 *p3 = &p1; // change p2 53 53 int y = 0, z = 11, & ar[3] = { x, y, z }; // initialize array of references 54 // &ar[1] = &z; // change reference array element 55 // typeof( ar[1] ) p = 3; // is int, i.e., the type of referenced object 56 // typeof( &ar[1] ) q = &x; // is int *, i.e., the type of pointer 57 // _Static_assert( sizeof( ar[1] ) == sizeof( int ), "Array type should be int." ); // is true, i.e., the size of referenced object 58 // _Static_assert( sizeof( &ar[1] ) == sizeof( int *), "Address of array should be int *." ); // is true, i.e., the size of a reference 54 59 60 ((int*&)&r3) = &x; // change r1, (&*)**r3 61 x = 3; 55 62 // test that basic reference properties are true - r1 should be an alias for x 56 63 printf("%d %d %d\n", x, r1, &x == &r1); … … 68 75 printf("%d %d\n", r1, x); 69 76 77 r3 = 6; // change x, ***r3 78 printf("x = %d ; x2 = %d\n", x, x2); // check that x was changed 79 &r3 = &x2; // change r1 to refer to x2, (&*)**r3 80 r3 = 999; // modify x2 81 printf("x = %d ; x2 = %d\n", x, x2); // check that x2 was changed 82 ((int**&)&&r3) = p2; // change r2, (&(&*)*)*r3, ensure explicit cast to reference works 83 r3 = 12345; // modify x 84 printf("x = %d ; x2 = %d\n", x, x2); // check that x was changed 85 &&&r3 = p3; // change r3 to p3, (&(&(&*)*)*)r3 86 ((int&)r3) = 22222; // modify x, ensure explicit cast to reference works 87 printf("x = %d ; x2 = %d\n", x, x2); // check that x was changed 88 70 89 // test that reference members are not implicitly constructed/destructed/assigned 71 90 X x1, x2 = x1; … … 76 95 &z1.r = &z1r; 77 96 &z2.r = &z2r; 97 78 98 z1 = z2; 99 100 // test rvalue-to-reference conversion 101 { 102 struct S { double x, y; }; 103 void f( int & i, int & j, S & s, int v[] ) { 104 printf("%d %d { %g, %g }, [%d, %d, %d]\n", i, j, s.[x, y], v[0], v[1], v[2]); 105 } 106 void g(int & i) { printf("%d\n", i); } 107 void h(int &&& i) { printf("%d\n", i); } 108 109 int &&& r = 3; // rvalue to reference 110 int i = r; 111 printf("%d %d\n", i, r); // both 3 112 113 g( 3 ); // rvalue to reference 114 h( (int &&&)3 ); // rvalue to reference 115 116 int a = 5, b = 4; 117 f( 3, a + b, (S){ 1.0, 7.0 }, (int [3]){ 1, 2, 3 } ); // two rvalue to reference 118 } 79 119 } 80 120 … … 82 122 // tab-width: 4 // 83 123 // End: // 84 -
tests/result.c
rf9feab8 r90152a4 15 15 16 16 #include <assert.h> 17 #include <containers/result >17 #include <containers/result.hfa> 18 18 19 19 void checkPredicates() { -
tests/searchsort.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // searchsort.c -- 8 // 6 // 7 // searchsort.c -- 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 : Sun Apr 2 11:29:30 201713 // Update Count : 7614 // 12 // Last Modified On : Thu Aug 9 07:54:57 2018 13 // Update Count : 101 14 // 15 15 16 #include <fstream >17 #include <stdlib > // bsearch, qsort16 #include <fstream.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 for ( unsigned int i = 0; i < size; i += 1) {26 for ( i; 0u ~ size ) { 27 27 iarr[i] = size - i; 28 28 sout | iarr[i] | ", "; … … 32 32 // ascending sort/search by changing < to > 33 33 qsort( iarr, size ); 34 for ( unsigned int i = 0; i < size; i += 1) {34 for ( i; 0u ~ size ) { 35 35 sout | iarr[i] | ", "; 36 36 } // for 37 37 sout | endl; 38 for ( unsigned int i = 0; i < size; i += 1) { // C version38 for ( i; 0u ~ size ) { // C version 39 39 int key = size - i; 40 int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );41 sout | *v | ", ";40 int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp ); 41 sout | key | ':' | *v | ", "; 42 42 } // for 43 43 sout | endl; 44 for ( unsigned int i = 0; i < size; i += 1 ) { 45 int *v = bsearch( size - i, iarr, size ); 46 sout | *v | ", "; 44 45 for ( i; 0u ~ size ) { 46 int * v = bsearch( size - i, iarr, size ); 47 sout | size - i | ':' | *v | ", "; 47 48 } // for 48 49 sout | endl; 49 for ( unsigned int i = 0; i < size; i += 1) {50 for ( i; 0u ~ size ) { 50 51 unsigned int posn = bsearch( size - i, iarr, size ); 51 sout | iarr[posn] | ", ";52 sout | size - i | ':' | iarr[posn] | ", "; 52 53 } // for 53 54 sout | endl | endl; 54 55 55 56 // descending sort/search by changing < to > 56 for ( unsigned int i = 0; i < size; i += 1) {57 for ( i; 0u ~ size ) { 57 58 iarr[i] = i + 1; 58 59 sout | iarr[i] | ", "; … … 62 63 int ?<?( int x, int y ) { return x > y; } 63 64 qsort( iarr, size ); 64 for ( unsigned int i = 0; i < size; i += 1) {65 for ( i; 0u ~ size ) { 65 66 sout | iarr[i] | ", "; 66 67 } // for 67 68 sout | endl; 68 for ( unsigned int i = 0; i < size; i += 1) {69 int * v = bsearch( size - i, iarr, size );70 sout | *v | ", ";69 for ( i; 0u ~ size ) { 70 int * v = bsearch( size - i, iarr, size ); 71 sout | size - i | ':' | *v | ", "; 71 72 } // for 72 73 sout | endl; 73 for ( unsigned int i = 0; i < size; i += 1) {74 for ( i; 0u ~ size ) { 74 75 unsigned int posn = bsearch( size - i, iarr, size ); 75 sout | iarr[posn] | ", ";76 sout | size - i | ':' | iarr[posn] | ", "; 76 77 } // for 77 78 } … … 79 80 80 81 double darr[size]; 81 for ( unsigned int i = 0; i < size; i += 1) {82 for ( i; 0u ~ size ) { 82 83 darr[i] = size - i + 0.5; 83 84 sout | darr[i] | ", "; … … 85 86 sout | endl; 86 87 qsort( darr, size ); 87 for ( unsigned int i = 0; i < size; i += 1) {88 for ( i; 0u ~ size ) { 88 89 sout | darr[i] | ", "; 89 90 } // for 90 91 sout | endl; 91 for ( unsigned int i = 0; i < size; i += 1) {92 double * v = bsearch( size - i + 0.5, darr, size );93 sout | *v | ", ";92 for ( i; 0u ~ size ) { 93 double * v = bsearch( size - i + 0.5, darr, size ); 94 sout | size - i + 0.5 | ':' | *v | ", "; 94 95 } // for 95 96 sout | endl; 96 for ( unsigned int i = 0; i < size; i += 1) {97 for ( i; 0u ~ size ) { 97 98 unsigned int posn = bsearch( size - i + 0.5, darr, size ); 98 sout | darr[posn] | ", ";99 sout | size - i + 0.5 | ':' | darr[posn] | ", "; 99 100 } // for 100 101 sout | endl | endl; … … 102 103 struct S { int i, j; } sarr[size]; 103 104 int ?<?( S t1, S t2 ) { return t1.i < t2.i && t1.j < t2.j; } 104 ofstream * ?|?( ofstream *os, S v ) { return os | v.i | ' ' | v.j; }105 for ( unsigned int i = 0; i < size; i += 1) {105 ofstream & ?|?( ofstream & os, S v ) { return os | v.i | ' ' | v.j; } 106 for ( i; 0u ~ size ) { 106 107 sarr[i].i = size - i; 107 108 sarr[i].j = size - i + 1; … … 110 111 sout | endl; 111 112 qsort( sarr, size ); 112 for ( unsigned int i = 0; i < size; i += 1) {113 for ( i; 0u ~ size ) { 113 114 sout | sarr[i] | ", "; 114 115 } // for 115 116 sout | endl; 116 for ( unsigned int i = 0; i < size; i += 1) {117 for ( i; 0u ~ size ) { 117 118 S temp = { size - i, size - i + 1 }; 118 S * v = bsearch( temp, sarr, size );119 sout | *v | ", ";119 S * v = bsearch( temp, sarr, size ); 120 sout | temp | ':' | *v | ", "; 120 121 } // for 121 122 sout | endl; 122 for ( unsigned int i = 0; i < size; i += 1) {123 for ( i; 0u ~ size ) { 123 124 S temp = { size - i, size - i + 1 }; 124 125 unsigned int posn = bsearch( temp, sarr, size ); 125 sout | sarr[posn] | ", ";126 sout | temp | ':' | sarr[posn] | ", "; 126 127 } // for 127 128 sout | endl | endl; 129 { 130 unsigned int getKey( const S & s ) { return s.j; } 131 for ( i; 0u ~ size ) { 132 sout | sarr[i] | ", "; 133 } // for 134 sout | endl; 135 for ( i; 0u ~ size ) { 136 S * v = bsearch( size - i + 1, sarr, size ); 137 sout | size - i + 1 | ':' | *v | ", "; 138 } // for 139 sout | endl; 140 for ( i; 0u ~ size ) { 141 unsigned int posn = bsearch( size - i + 1, sarr, size ); 142 sout | size - i + 1 | ':' | sarr[posn] | ", "; 143 } // for 144 sout | endl | endl; 145 } 128 146 } // main 129 147 -
tests/shortCircuit.c
rf9feab8 r90152a4 22 22 } 23 23 24 #include <fstream >24 #include <fstream.hfa> 25 25 26 26 struct test_t { -
tests/sum.c
rf9feab8 r90152a4 11 11 // Created On : Wed May 27 17:56:53 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Oct 29 10:29:12 201714 // Update Count : 2 6013 // Last Modified On : Thu Aug 2 08:03:09 2018 14 // Update Count : 279 15 15 // 16 16 17 #include <fstream> 17 #include <fstream.hfa> 18 #include <stdlib.hfa> 18 19 19 void ?{}( int & c, zero_t ) { c = 0; } 20 void ?{}( int & c, zero_t ) { c = 0; } // not in prelude 20 21 21 22 trait sumable( otype T ) { 22 void ?{}( T &, zero_t ); // constructor from 0 literal23 void ?{}( T &, zero_t ); // 0 literal constructor 23 24 T ?+?( T, T ); // assortment of additions 24 25 T ?+=?( T &, T ); … … 28 29 29 30 forall( otype T | sumable( T ) ) // use trait 30 T sum( unsigned int n, T a[] ) {31 T total = 0; // in stantiate T, select 032 for ( unsigned int i = 0; i < n; i += 1 )33 total += a[i]; // select +31 T sum( size_t size, T a[] ) { 32 T total = 0; // initialize by 0 constructor 33 for ( size_t i = 0; i < size; i += 1 ) 34 total += a[i]; // select appropriate + 34 35 return total; 35 36 } // sum … … 55 56 } // for 56 57 sout | "sum from" | low | "to" | High | "is" 57 | sum( size, (unsigned char *)a ) | ", check" | (int)s | endl;58 | sum( size, (unsigned char *)a ) | ", check" | (int)s | endl; 58 59 59 60 int s = 0, a[size], v = low; … … 63 64 } // for 64 65 sout | "sum from" | low | "to" | High | "is" 65 | sum( size, (int *)a ) | ", check" | (int)s | endl;66 | sum( size, (int *)a ) | ", check" | (int)s | endl; 66 67 67 68 float s = 0.0f, a[size], v = low / 10.0f; … … 71 72 } // for 72 73 sout | "sum from" | low / 10.0f | "to" | High / 10.0f | "is" 73 | sum( size, (float *)a ) | ", check" | (float)s | endl;74 | sum( size, (float *)a ) | ", check" | (float)s | endl; 74 75 75 76 double s = 0.0, a[size], v = low / 10.0; … … 79 80 } // for 80 81 sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is" 81 | sum( size, (double *)a ) | ", check" | (double)s | endl;82 | sum( size, (double *)a ) | ", check" | (double)s | endl; 82 83 83 84 struct S { int i, j; }; 84 85 void ?{}( S & s ) { s.[i, j] = 0; } 85 void ?{}( S & s, int i, int j ) { s.[i,j] = [i, j]; } 86 void ?{}( S & s, zero_t ) { s.[i,j] = 0; } 87 void ?{}( S & s, one_t ) { s.[i,j] = 1; } 86 void ?{}( S & s, int i ) { s.[i, j] = [i, 0]; } 87 void ?{}( S & s, int i, int j ) { s.[i, j] = [i, j]; } 88 void ?{}( S & s, zero_t ) { s.[i, j] = 0; } 89 void ?{}( S & s, one_t ) { s.[i, j] = 1; } 88 90 S ?+?( S t1, S t2 ) { return (S){ t1.i + t2.i, t1.j + t2.j }; } 89 91 S ?+=?( S & t1, S t2 ) { t1 = t1 + t2; return t1; } 90 92 S ++?( S & t ) { t += (S){1}; return t; } 91 93 S ?++( S & t ) { S temp = t; t += (S){1}; return temp; } 92 ofstream * ?|?( ofstream *os, S v ) { return os | v.i | v.j; }94 ofstream & ?|?( ofstream & os, S v ) { return os | v.i | v.j; } 93 95 94 96 S s = (S){0}, a[size], v = { low, low }; … … 98 100 } // for 99 101 sout | "sum from" | low | "to" | High | "is" 100 | sum( size, (S *)a ) | ", check" | (S)s | endl; 102 | sum( size, (S *)a ) | ", check" | (S)s | endl; 103 104 forall( otype Impl | sumable( Impl ) ) 105 struct GS { 106 Impl * x, * y; 107 }; 108 GS(int) gs; 109 gs.x = anew( size ); // create array storage for field 110 s = 0; v = low; 111 for ( int i = 0; i < size; i += 1, v += 1 ) { 112 s += (int)v; 113 gs.x[i] = (int)v; // set field array in generic type 114 } // for 115 sout | "sum from" | low | "to" | High | "is" 116 | sum( size, gs.x ) | ", check" | (int)s | endl; // add field array in generic type 117 delete( gs.x ); 101 118 } // main 102 119 -
tests/swap.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // swap.c -- 7 // swap.c -- 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 : Wed Aug 23 20:34:45201713 // Update Count : 7 012 // Last Modified On : Thu Dec 7 09:13:13 2017 13 // Update Count : 71 14 14 // 15 15 16 #include <fstream >17 #include <stdlib > // swap16 #include <fstream.hfa> 17 #include <stdlib.hfa> // swap 18 18 19 19 int main( void ) { … … 84 84 85 85 struct S { int i, j; } s1 = { 1, 2 }, s2 = { 2, 1 }; 86 ofstream * ?|?( ofstream *os, S s ) { return os | s.i | s.j; }86 ofstream & ?|?( ofstream & os, S s ) { return os | s.i | s.j; } 87 87 sout | "struct S\t\t" | s1 | "," | s2 | "\t\tswap "; 88 88 swap( s1, s2 ); -
tests/switch.c
rf9feab8 r90152a4 10 10 // Created On : Tue Jul 12 06:50:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 26 10:14:21 201713 // Update Count : 3 312 // Last Modified On : Thu Mar 8 07:33:05 2018 13 // Update Count : 36 14 14 // 15 15 … … 87 87 S s; 88 88 case 19: 89 case 'A' ...'Z':90 case 0 ... 6:89 case 'A'...'Z': 90 case 0 ...6: // space required, or lexed as decimal point 91 91 case 20, 30, 40: 92 92 i = 3; … … 96 96 case 8~10: 97 97 f( 3 ); 98 fallthru 98 fallthru; 99 99 case 'd': 100 100 j = 5; -
tests/test.py
rf9feab8 r90152a4 9 9 import re 10 10 import sys 11 import time 11 12 12 13 ################################################################################ … … 18 19 19 20 def matchTest(path): 20 match = re.search(" (\.[\w\/\-_]*)\/.expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt", path)21 match = re.search("%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt" % settings.SRCDIR, path) 21 22 if match : 22 23 test = Test() … … 42 43 if includes: 43 44 test_list = [x for x in test_list if 44 x. path.startswith( tuple(includes) )45 x.target().startswith( tuple(includes) ) 45 46 ] 46 47 … … 48 49 if excludes: 49 50 test_list = [x for x in test_list if not 50 x. path.startswith( tuple(excludes) )51 x.target().startswith( tuple(excludes) ) 51 52 ] 52 53 … … 61 62 if options.regenerate_expected : 62 63 for testname in options.tests : 64 testname = canonicalPath( testname ) 63 65 if Test.valid_name(testname): 64 found = [test for test in allTests if test.target() == testname]66 found = [test for test in allTests if canonicalPath( test.target() ) == testname] 65 67 tests.append( found[0] if len(found) == 1 else Test.from_target(testname) ) 66 68 else : … … 77 79 print('ERROR: No expected file for test %s, ignoring it' % testname, file=sys.stderr) 78 80 79 # make sure we have at least some test to run80 if not tests :81 print('ERROR: No valid test to run', file=sys.stderr)82 sys.exit(1)83 84 81 return tests 85 82 … … 88 85 # create a parser with the arguments for the tests script 89 86 parser = argparse.ArgumentParser(description='Script which runs cforall tests') 90 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no') 87 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='yes') 88 parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=yes_no, default='no') 91 89 parser.add_argument('--arch', help='Test for specific architecture', type=str, default='') 90 parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60) 91 parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200) 92 92 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true') 93 93 parser.add_argument('--list', help='List all test available', action='store_true') 94 94 parser.add_argument('--all', help='Run all test available', action='store_true') 95 95 parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true') 96 parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int , default='8')96 parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int) 97 97 parser.add_argument('--list-comp', help='List all valide arguments', action='store_true') 98 98 parser.add_argument('-I','--include', help='Directory of test to include, can be used multiple time, All if omitted', action='append') … … 100 100 parser.add_argument('tests', metavar='test', type=str, nargs='*', help='a list of tests to run') 101 101 102 options = parser.parse_args() 102 try: 103 options = parser.parse_args() 104 except: 105 print('ERROR: invalid arguments', file=sys.stderr) 106 parser.print_help(sys.stderr) 107 sys.exit(1) 103 108 104 109 # script must have at least some tests to run or be listing … … 119 124 # running test functions 120 125 ################################################################################ 126 # fix the absolute paths in the output 127 def fixoutput( fname ): 128 if not is_ascii(fname): 129 return 130 131 file_replace(fname, "%s/" % settings.SRCDIR, "") 132 133 121 134 # logic to run a single test and return the result (No handling of printing or other test framework logic) 122 135 def run_single_test(test): 123 136 124 137 # find the output file based on the test name and options flag 138 exe_file = test.target_executable(); 125 139 out_file = test.target_output() 126 140 err_file = test.error_log() … … 131 145 test.prepare() 132 146 133 # remove any outputs from the previous tests to prevent side effects134 rm( (out_file, err_file, test.target()) )135 136 147 # build, skipping to next test on error 148 before = time.time() 137 149 make_ret, _ = make( test.target(), 138 150 redirects = "2> %s 1> /dev/null" % out_file, 139 151 error_file = err_file 140 152 ) 153 after = time.time() 154 155 comp_dur = after - before 156 157 run_dur = None 141 158 142 159 # if the make command succeds continue otherwise skip to diff 143 160 if make_ret == 0 or settings.dry_run: 144 if settings.dry_run or fileIsExecutable(test.target()) : 161 before = time.time() 162 if settings.dry_run or fileIsExecutable(exe_file) : 145 163 # run test 146 retcode, _ = sh("timeout 60 %s > %s 2>&1" % (test.target(), out_file), input = in_file)164 retcode, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe_file, out_file), input = in_file) 147 165 else : 148 166 # simply cat the result into the output 149 retcode, _ = sh("cat %s > %s" % (test.target(), out_file)) 167 retcode, _ = sh("cat %s > %s" % (exe_file, out_file)) 168 169 after = time.time() 170 run_dur = after - before 150 171 else: 151 172 retcode, _ = sh("mv %s %s" % (err_file, out_file)) … … 153 174 154 175 if retcode == 0: 176 # fixoutput(out_file) 155 177 if settings.generating : 156 178 # if we are ounly generating the output we still need to check that the test actually exists … … 173 195 sh("rm -f %s > /dev/null 2>&1" % test.target()) 174 196 175 return retcode, error 197 return retcode, error, [comp_dur, run_dur] 176 198 177 199 # run a single test and handle the errors, outputs, printing, exception handling, etc. … … 182 204 name_txt = "%20s " % t.name 183 205 184 retcode, error = run_single_test(t)206 retcode, error, duration = run_single_test(t) 185 207 186 208 # update output based on current action 187 result_txt = TestResult.toString( retcode )209 result_txt = TestResult.toString( retcode, duration ) 188 210 189 211 #print result with error if needed … … 214 236 tests, 215 237 chunksize = 1 216 ).get( 7200)238 ).get(settings.timeout.total) 217 239 except KeyboardInterrupt: 218 240 pool.terminate() … … 234 256 ################################################################################ 235 257 if __name__ == "__main__": 236 #always run from same folder237 chdir()238 258 239 259 # parse the command line arguments … … 254 274 tests = validTests( options ) 255 275 276 # make sure we have at least some test to run 277 if not tests : 278 print('ERROR: No valid test to run', file=sys.stderr) 279 sys.exit(1) 280 281 256 282 # sort the test alphabetically for convenience 257 283 tests.sort(key=lambda t: (t.arch if t.arch else '') + t.target()) … … 259 285 # users may want to simply list the tests 260 286 if options.list_comp : 261 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected - j --jobs ", end='')287 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --install --timeout --global-timeout -j --jobs ", end='') 262 288 print(" ".join(map(lambda t: "%s" % (t.target()), tests))) 263 289 264 290 elif options.list : 265 291 print("Listing for %s:%s"% (settings.arch.string, settings.debug.string)) 266 print("\n".join(map(lambda t: "%s" % (t.toString()), tests)))292 fancy_print("\n".join(map(lambda t: "%s" % (t.toString()), tests))) 267 293 268 294 else : 295 # check the build configuration works 296 settings.validate() 297 269 298 options.jobs, forceJobs = jobCount( options, tests ) 270 299 settings.updateMakeCmd(forceJobs, options.jobs) -
tests/tuple/tupleAssign.c
rf9feab8 r90152a4 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int main() { … … 48 48 int z; 49 49 } x; 50 X ?=?(X & x, double d) { }50 X ?=?(X & x, double d) { return x; } 51 51 [int, double, int] t; 52 52 -
tests/tuple/tupleVariadic.c
rf9feab8 r90152a4 9 9 // Author : Rob Schluntz 10 10 // Created On : Fri Dec 16 10:25:35 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Dec 21 14:42:48 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 2 09:24:04 2018 13 // Update Count : 6 14 14 // 15 16 #include <stdlib.hfa> 15 17 16 18 void func(void) { … … 28 30 printf("called process(double) %g\n", x); 29 31 } 30 31 forall( dtype T, ttype Params | sized(T) | { void ?{}(T &, Params); } )32 T * new(Params p);33 32 34 33 struct array { … … 68 67 } 69 68 69 void ^?{}(array & a) { 70 free(a.data); 71 } 72 70 73 // test use of a tuple argument 71 74 [void] ?{}(array & a, [int, int, int, int] args) { … … 95 98 } 96 99 100 forall(ttype T | { void foo(T); }) void bar(T x) {} 101 void foo(int) {} 102 97 103 int main() { 98 104 array * x0 = new(); … … 117 123 func(3, 2.0, 111, 4.145); 118 124 printf("finished func\n"); 125 126 { 127 // T = [const int] -- this ensures that void(*)(int) satisfies void(*)(const int) 128 const int x; 129 bar(x); 130 } 131 132 delete(ptr); 133 delete(x4); 134 delete(x3); 135 delete(x2); 136 delete(x1); 137 delete(x0); 119 138 } 120 139 … … 122 141 // tab-width: 4 // 123 142 // End: // 124 -
tests/user_literals.c
rf9feab8 r90152a4 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // user_literals.c -- 8 // 6 // 7 // user_literals.c -- 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 : S at Sep 9 08:31:32 201713 // Update Count : 4814 // 12 // Last Modified On : Sun Apr 29 16:51:42 2018 13 // Update Count : 54 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 #include <wchar.h> 18 18 #include <uchar.h> … … 31 31 32 32 33 struct Weight { 34 double stones; 35 }; 36 void ?{}( Weight & w ) { w.stones = 0; } // operations 33 struct Weight { double stones; }; 34 void ?{}( Weight & w ) { w.stones = 0; } 37 35 void ?{}( Weight & w, double w ) { w.stones = w; } 38 Weight ?+?( Weight l, Weight r ) { return (Weight){ l.stones + r.stones }; } 39 ofstream * ?|?( ofstream * os, Weight w ) { return os | w.stones; } 36 Weight ?+?( Weight l, Weight r ) { 37 return (Weight){ l.stones + r.stones }; 38 } 39 ofstream & ?|?( ofstream & os, Weight w ) { return os | w.stones; } 40 40 41 41 Weight ?`st( double w ) { return (Weight){ w }; } // backquote for user literals 42 42 Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; } 43 Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; } 44 43 Weight ?`kg( double w ) { return (Weight) { w * 0.16 }; } 45 44 46 45 int main() { 47 Weight w, hw = { 14 }; // 14 stone 48 w = 11`st + 1`lb; 46 Weight w, heavy = { 20 }; // 20 stone 47 w = 155`lb; 48 sout | w | endl; 49 w = 0b_1111`st; 50 sout | w | endl; 51 w = 0_233`lb; // octal weight (155) 52 sout | w | endl; 53 w = 0x_9b_u`kg; 49 54 sout | w | endl; 50 55 w = 70.3`kg; 51 56 sout | w | endl; 52 w = 1 55`lb;57 w = 11`st + 1`lb; 53 58 sout | w | endl; 54 w = 0x_9b_u`lb; // hexadecimal unsigned weight (155) 55 sout | w | endl; 56 w = 0_233`lb; // octal weight (155) 57 sout | w | endl; 58 w = 5`st + 8`kg + 25`lb + hw; 59 w = 5`st + 8`kg + 25`lb + heavy; 59 60 sout | w | endl; 60 61 … … 81 82 82 83 "abc"`s; 83 u"abc"`m;84 U_"abc"`h;85 L"abc"`_A_;84 // u"abc"`m; 85 // U_"abc"`h; 86 // L"abc"`_A_; 86 87 u8_"abc"`__thingy_; 87 88 } // main -
tests/vector.c
rf9feab8 r90152a4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // libcfa_vector.c --7 // vector.c -- 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 ue Jul 5 15:08:05 201613 // Update Count : 2 612 // Last Modified On : Thu Jan 18 17:08:08 2018 13 // Update Count : 27 14 14 // 15 15 16 #include <fstream >17 #include <vector >16 #include <fstream.hfa> 17 #include <vector.hfa> 18 18 19 19 #undef assert … … 63 63 // Local Variables: // 64 64 // tab-width: 4 // 65 // compile-command: "cfa libcfa_vector.c" //65 // compile-command: "cfa vector.c" // 66 66 // End: // -
tests/virtualCast.c
rf9feab8 r90152a4 9 9 */ 10 10 11 #include <stdlib >11 #include <stdlib.hfa> 12 12 #include <assert.h> 13 13
Note:
See TracChangeset
for help on using the changeset viewer.