- Timestamp:
- Oct 29, 2019, 4:01:24 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 773db65, 9421f3d8
- Parents:
- 7951100 (diff), 8364209 (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:
-
- 95 added
- 207 moved
-
.expect/KRfunctions.x64.txt (added)
-
.expect/KRfunctions.x86.txt (added)
-
.expect/abs.txt (added)
-
.expect/alloc-ERROR.txt (added)
-
.expect/alloc.txt (added)
-
.expect/array.txt (moved) (moved from src/tests/.expect/array.txt )
-
.expect/ato.txt (moved) (moved from src/tests/.expect/ato.txt ) (1 diff)
-
.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 (added)
-
.expect/completeTypeError.txt (added)
-
.expect/complex.txt (moved) (moved from src/tests/.expect/complex.txt ) (1 diff)
-
.expect/copyfile.txt (added)
-
.expect/counter.txt (moved) (moved from src/tests/.expect/counter.txt )
-
.expect/declarationErrors.txt (added)
-
.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 (moved) (moved from src/tests/.expect/fallthrough.txt )
-
.expect/forall.txt (moved) (moved from src/tests/.expect/identFuncDeclarator.txt )
-
.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/labelledExit.txt )
-
.expect/identParamDeclarator.txt (moved) (moved from src/tests/.expect/limits.txt )
-
.expect/identity.txt (moved) (moved from src/tests/.expect/identity.txt ) (1 diff)
-
.expect/ifwhileCtl.txt (moved) (moved from src/tests/.expect/ifwhileCtl.txt )
-
.expect/io1.txt (moved) (moved from src/tests/.expect/io1.txt ) (2 diffs)
-
.expect/io2.txt (moved) (moved from src/tests/.expect/io2.txt )
-
.expect/labelledExit.txt (moved) (moved from src/tests/.expect/maybe.txt )
-
.expect/limits.txt (moved) (moved from src/tests/.expect/numericConstants.txt )
-
.expect/literals.txt (moved) (moved from src/tests/.expect/literals.txt )
-
.expect/loopctrl.txt (added)
-
.expect/manipulatorsInput.txt (added)
-
.expect/manipulatorsOutput1.txt (added)
-
.expect/manipulatorsOutput2.x64.txt (added)
-
.expect/manipulatorsOutput2.x86.txt (added)
-
.expect/math1.txt (added)
-
.expect/math2.txt (moved) (moved from src/tests/.expect/math2.x64.txt ) (2 diffs)
-
.expect/math3.txt (moved) (moved from src/tests/.expect/math3.x64.txt ) (2 diffs)
-
.expect/math4.txt (added)
-
.expect/maybe.txt (moved) (moved from src/tests/.expect/operators.txt )
-
.expect/minmax.txt (moved) (moved from src/tests/.expect/minmax.txt ) (2 diffs)
-
.expect/nested-types-ERR1.txt (added)
-
.expect/nested-types-ERR2.txt (added)
-
.expect/nested-types.txt (moved) (moved from src/tests/.expect/result.txt )
-
.expect/numericConstants.txt (moved) (moved from src/tests/.expect/stdincludes.txt )
-
.expect/operators.txt (moved) (moved from src/tests/.expect/switch.txt )
-
.expect/polymorphism.txt (moved) (moved from src/tests/.expect/polymorphism.txt )
-
.expect/quotedKeyword.txt (moved) (moved from src/tests/.expect/quoted_keyword.txt )
-
.expect/random.txt (moved) (moved from src/tests/.expect/random.txt )
-
.expect/rational.txt (moved) (moved from src/tests/.expect/rational.txt )
-
.expect/references.txt (moved) (moved from src/tests/.expect/references.txt ) (1 diff)
-
.expect/result.txt (moved) (moved from src/tests/.expect/typedefRedef.txt )
-
.expect/scopeErrors.txt (added)
-
.expect/searchsort.txt (moved) (moved from src/tests/.expect/searchsort.txt )
-
.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/typeof.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/variableDeclarator.txt )
-
.expect/time.txt (moved) (moved from src/tests/.expect/time.x64.txt ) (1 diff)
-
.expect/typedefRedef-ERR1.txt (added)
-
.expect/typedefRedef.txt (moved) (moved from src/tests/.expect/voidPtr.txt )
-
.expect/typeof.txt (moved) (moved from src/tests/builtins/.expect/sync.txt )
-
.expect/variableDeclarator.txt (moved) (moved from src/tests/raii/.expect/ctor-autogen.txt )
-
.expect/vector.txt (moved) (moved from src/tests/.expect/vector.txt )
-
.expect/voidPtr.txt (moved) (moved from src/tests/raii/.expect/init_once.txt )
-
.gitignore (moved) (moved from src/tests/.gitignore ) (1 diff)
-
.in/copyfile.txt (added)
-
.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 (moved) (moved from src/tests/io.data )
-
.in/manipulatorsInput.txt (added)
-
.in/rational.txt (moved) (moved from src/tests/.in/rational.txt )
-
KRfunctions.cfa (moved) (moved from src/tests/KRfunctions.c ) (2 diffs)
-
Makefile.am (added)
-
Makefile.in (moved) (moved from src/examples/Makefile.in ) (23 diffs)
-
abort.cfa (added)
-
abs.cfa (moved) (moved from src/tests/abs.c ) (1 diff)
-
alloc.cfa (moved) (moved from src/tests/alloc.c ) (13 diffs)
-
array.cfa (added)
-
ato.cfa (moved) (moved from src/tests/ato.c ) (1 diff)
-
attributes.cfa (moved) (moved from src/tests/attributes.c ) (4 diffs)
-
avltree/avl-private.cfa (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.cfa (moved) (moved from src/tests/avltree/avl0.c )
-
avltree/avl1.cfa (moved) (moved from src/tests/avltree/avl1.c ) (1 diff)
-
avltree/avl2.cfa (moved) (moved from src/tests/avltree/avl2.c )
-
avltree/avl3.cfa (moved) (moved from src/tests/avltree/avl3.c ) (1 diff)
-
avltree/avl4.cfa (moved) (moved from src/tests/avltree/avl4.c )
-
avltree/avl_test.cfa (moved) (moved from src/tests/avltree/avl_test.c ) (1 diff)
-
builtins/.expect/sync.txt (added)
-
builtins/sync.cfa (moved) (moved from src/tests/builtins/sync.c ) (7 diffs)
-
cast.cfa (moved) (moved from src/tests/cast.c )
-
castError.cfa (added)
-
commentMisc.cfa (moved) (moved from src/tests/commentMisc.c )
-
completeTypeError.cfa (moved) (moved from src/tests/completeTypeError.c ) (5 diffs)
-
complex.cfa (moved) (moved from src/tests/complex.c ) (4 diffs)
-
concurrent/.expect/coroutineYield.txt (moved) (moved from src/tests/concurrent/.expect/coroutineYield.txt )
-
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 (moved) (moved from src/tests/concurrent/.expect/preempt.txt )
-
concurrent/.expect/thread.txt (moved) (moved from src/tests/concurrent/.expect/thread.txt )
-
concurrent/coroutineThen.cfa (added)
-
concurrent/coroutineYield.cfa (added)
-
concurrent/examples/.expect/boundedBufferEXT.txt (moved) (moved from src/tests/concurrent/examples/.expect/boundedBufferEXT.txt )
-
concurrent/examples/.expect/boundedBufferINT.txt (moved) (moved from src/tests/concurrent/examples/.expect/boundedBufferINT.txt )
-
concurrent/examples/.expect/datingService.txt (moved) (moved from src/tests/concurrent/examples/.expect/datingService.txt )
-
concurrent/examples/.expect/gortn.txt (added)
-
concurrent/examples/.expect/matrixSum.txt (moved) (moved from src/tests/concurrent/examples/.expect/matrixSum.txt )
-
concurrent/examples/.expect/quickSort.txt (moved) (moved from src/tests/concurrent/examples/.expect/quickSort.txt )
-
concurrent/examples/.in/quickSort.txt (moved) (moved from src/tests/concurrent/examples/.in/quickSort.txt )
-
concurrent/examples/boundedBufferEXT.cfa (moved) (moved from src/tests/concurrent/examples/boundedBufferEXT.c ) (6 diffs)
-
concurrent/examples/boundedBufferINT.cfa (moved) (moved from src/tests/concurrent/examples/boundedBufferINT.c ) (6 diffs)
-
concurrent/examples/boundedBufferTHREAD.cfa (added)
-
concurrent/examples/datingService.cfa (moved) (moved from src/tests/concurrent/examples/datingService.c ) (9 diffs)
-
concurrent/examples/gortn.cfa (added)
-
concurrent/examples/matrixSum.cfa (moved) (moved from src/tests/concurrent/examples/matrixSum.c ) (3 diffs)
-
concurrent/examples/quickSort.cfa (moved) (moved from src/tests/concurrent/examples/quickSort.c ) (10 diffs)
-
concurrent/examples/quickSort.generic.cfa (added)
-
concurrent/monitor.cfa (moved) (moved from src/tests/concurrent/monitor.c ) (2 diffs)
-
concurrent/multi-monitor.cfa (moved) (moved from src/tests/concurrent/multi-monitor.c ) (2 diffs)
-
concurrent/preempt.cfa (moved) (moved from src/tests/concurrent/preempt.c ) (4 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.cfa (moved) (moved from src/tests/concurrent/signal/block.c ) (7 diffs)
-
concurrent/signal/disjoint.cfa (moved) (moved from src/tests/concurrent/signal/disjoint.c ) (6 diffs)
-
concurrent/signal/wait.cfa (moved) (moved from src/tests/concurrent/signal/wait.c ) (9 diffs)
-
concurrent/thread.cfa (moved) (moved from src/tests/concurrent/thread.c ) (5 diffs)
-
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.cfa (moved) (moved from src/tests/concurrent/waitfor/barge.c ) (5 diffs)
-
concurrent/waitfor/dtor.cfa (moved) (moved from src/tests/concurrent/waitfor/dtor.c ) (4 diffs)
-
concurrent/waitfor/else.cfa (moved) (moved from src/tests/concurrent/waitfor/else.c ) (2 diffs)
-
concurrent/waitfor/parse.cfa (moved) (moved from src/tests/concurrent/waitfor/parse.c ) (1 diff)
-
concurrent/waitfor/parse2.cfa (moved) (moved from src/tests/concurrent/waitfor/parse2.c ) (2 diffs)
-
concurrent/waitfor/recurse.cfa (moved) (moved from src/tests/concurrent/waitfor/recurse.c ) (5 diffs)
-
concurrent/waitfor/simple.cfa (moved) (moved from src/tests/concurrent/waitfor/simple.c ) (6 diffs)
-
concurrent/waitfor/statment.cfa (moved) (moved from src/tests/concurrent/waitfor/statment.c ) (4 diffs)
-
concurrent/waitfor/when.cfa (moved) (moved from src/tests/concurrent/waitfor/when.c ) (4 diffs)
-
config.py.in (added)
-
context.cfa (moved) (moved from src/tests/context.c )
-
copyfile.cfa (added)
-
coroutine/.expect/devicedriver.txt (added)
-
coroutine/.expect/fibonacci.txt (moved) (moved from src/tests/coroutine/.expect/fibonacci.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/raii.txt (added)
-
coroutine/.expect/runningTotal.txt (moved) (moved from src/tests/coroutine/.expect/runningTotal.txt )
-
coroutine/.in/devicedriver.txt (added)
-
coroutine/.in/fmtLines.txt (moved) (moved from src/tests/coroutine/.in/fmtLines.txt ) (4 diffs)
-
coroutine/cntparens.cfa (added)
-
coroutine/devicedriver.cfa (added)
-
coroutine/fibonacci.cfa (moved) (moved from src/tests/coroutine/fibonacci.c ) (4 diffs)
-
coroutine/fibonacci_1.cfa (added)
-
coroutine/fmtLines.cfa (moved) (moved from src/tests/coroutine/fmtLines.c ) (5 diffs)
-
coroutine/pingpong.cfa (moved) (moved from src/tests/coroutine/pingpong.c ) (3 diffs)
-
coroutine/prodcons.cfa (moved) (moved from src/tests/coroutine/prodcons.c ) (5 diffs)
-
coroutine/raii.cfa (added)
-
coroutine/runningTotal.cfa (moved) (moved from src/tests/coroutine/runningTotal.c ) (4 diffs)
-
coroutine/suspend_then.cfa (added)
-
counter.cfa (moved) (moved from src/tests/counter.c ) (2 diffs)
-
declarationErrors.cfa (moved) (moved from src/tests/declarationErrors.c ) (2 diffs)
-
declarationSpecifier.cfa (moved) (moved from src/tests/declarationSpecifier.c ) (2 diffs)
-
designations.cfa (moved) (moved from src/tests/designations.c )
-
div.cfa (moved) (moved from src/tests/div.c ) (2 diffs)
-
enum.cfa (moved) (moved from src/tests/enum.c )
-
except-0.cfa (moved) (moved from src/tests/except-0.c ) (2 diffs)
-
except-1.cfa (moved) (moved from src/tests/except-1.c ) (1 diff)
-
except-2.cfa (moved) (moved from src/tests/except-2.c ) (1 diff)
-
except-3.cfa (moved) (moved from src/tests/except-3.c ) (1 diff)
-
except-mac.hfa (moved) (moved from src/tests/except-mac.h )
-
expression.cfa (moved) (moved from src/tests/expression.c )
-
extension.cfa (moved) (moved from src/tests/extension.c ) (2 diffs)
-
fallthrough.cfa (added)
-
forall.cfa (added)
-
fstream_test.cfa (moved) (moved from src/tests/fstream_test.c ) (1 diff)
-
function-operator.cfa (moved) (moved from src/tests/function-operator.c ) (5 diffs)
-
functions.cfa (moved) (moved from src/tests/functions.c ) (2 diffs)
-
gccExtensions.cfa (moved) (moved from src/tests/gccExtensions.c ) (3 diffs)
-
genericUnion.cfa (added)
-
gmp.cfa (added)
-
heap.cfa (added)
-
hello.cfa (added)
-
identFuncDeclarator.cfa (moved) (moved from src/tests/identFuncDeclarator.c ) (2 diffs)
-
identParamDeclarator.cfa (moved) (moved from src/tests/identParamDeclarator.c ) (2 diffs)
-
identity.cfa (added)
-
ifwhileCtl.cfa (moved) (moved from src/tests/ifwhileCtl.c ) (4 diffs)
-
io1.cfa (added)
-
io2.cfa (added)
-
labelledExit.cfa (moved) (moved from src/tests/labelledExit.c ) (8 diffs)
-
limits.cfa (moved) (moved from src/tests/limits.c ) (2 diffs)
-
linking/.expect/nothreads.txt (added)
-
linking/.expect/withthreads.txt (added)
-
linking/nothreads.cfa (added)
-
linking/withthreads.cfa (added)
-
literals.cfa (moved) (moved from src/tests/literals.c ) (4 diffs)
-
long_tests.hfa (added)
-
loopctrl.cfa (added)
-
manipulatorsInput.cfa (added)
-
manipulatorsOutput1.cfa (added)
-
manipulatorsOutput2.cfa (added)
-
math1.cfa (added)
-
math2.cfa (added)
-
math3.cfa (added)
-
math4.cfa (moved) (moved from src/tests/math4.c ) (2 diffs)
-
maybe.cfa (moved) (moved from src/tests/maybe.c ) (1 diff)
-
minmax.cfa (moved) (moved from src/tests/minmax.c ) (2 diffs)
-
namedParmArg.cfa (moved) (moved from src/tests/namedParmArg.c )
-
nested-types.cfa (added)
-
numericConstants.cfa (moved) (moved from src/tests/numericConstants.c ) (2 diffs)
-
occursError.cfa (moved) (moved from src/tests/occursError.c )
-
operators.cfa (moved) (moved from src/tests/operators.c )
-
polymorphism.cfa (moved) (moved from src/tests/polymorphism.c ) (3 diffs)
-
pybin/__init__.py (moved) (moved from src/tests/pybin/__init__.py )
-
pybin/print-core.gdb (added)
-
pybin/settings.py (added)
-
pybin/test_run.py (moved) (moved from src/tests/pybin/test_run.py ) (4 diffs)
-
pybin/tools.py (added)
-
quotedKeyword.cfa (moved) (moved from src/tests/quoted_keyword.c ) (2 diffs)
-
raii/.expect/ctor-autogen-ERR1.txt (moved) (moved from src/tests/raii/.expect/ctor-autogen-ERR1.txt ) (3 diffs)
-
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/raii/.expect/dtor-early-exit.txt )
-
raii/.expect/globals.txt (moved) (moved from src/tests/raii/.expect/globals.txt )
-
raii/.expect/init_once.txt (added)
-
raii/.expect/memberCtors-ERR1.txt (added)
-
raii/.expect/memberCtors.txt (added)
-
raii/ctor-autogen.cfa (moved) (moved from src/tests/raii/ctor-autogen.c )
-
raii/dtor-early-exit.cfa (moved) (moved from src/tests/raii/dtor-early-exit.c ) (16 diffs)
-
raii/globals.cfa (moved) (moved from src/tests/raii/globals.c ) (2 diffs)
-
raii/init_once.cfa (moved) (moved from src/tests/raii/init_once.c ) (2 diffs)
-
raii/memberCtors.cfa (moved) (moved from src/tests/raii/memberCtors.c ) (5 diffs)
-
raii/multiDimension.cfa (moved) (moved from src/tests/raii/multiDimension.c )
-
raii/multiDimension.txt (moved) (moved from src/tests/raii/multiDimension.txt )
-
random.cfa (moved) (moved from src/tests/random.c ) (2 diffs)
-
rational.cfa (added)
-
references.cfa (added)
-
result.cfa (moved) (moved from src/tests/result.c ) (1 diff)
-
scope.cfa (moved) (moved from src/tests/scope.c )
-
scopeErrors.cfa (moved) (moved from src/tests/scopeErrors.c )
-
searchsort.cfa (moved) (moved from src/tests/searchsort.c ) (3 diffs)
-
shortCircuit.cfa (added)
-
simpleGenericTriple.cfa (moved) (moved from src/tests/simpleGenericTriple.c )
-
stdincludes.cfa (moved) (moved from src/tests/stdincludes.c ) (2 diffs)
-
structMember.cfa (added)
-
subrange.cfa (moved) (moved from src/tests/subrange.c )
-
sum.cfa (added)
-
swap.cfa (added)
-
switch.cfa (moved) (moved from src/tests/switch.c ) (2 diffs)
-
test.py (moved) (moved from src/tests/test.py ) (16 diffs)
-
time.cfa (added)
-
tuple/.expect/tupleAssign.txt (moved) (moved from src/tests/tuple/.expect/tupleAssign.txt )
-
tuple/.expect/tupleCast.txt (moved) (moved from src/tests/tuple/.expect/tupleCast.txt )
-
tuple/.expect/tupleFunction.txt (moved) (moved from src/tests/tuple/.expect/tupleFunction.txt )
-
tuple/.expect/tupleMember.txt (moved) (moved from src/tests/tuple/.expect/tupleMember.txt )
-
tuple/.expect/tuplePolymorphism.txt (moved) (moved from src/tests/tuple/.expect/tuplePolymorphism.txt )
-
tuple/.expect/tupleVariadic.txt (moved) (moved from src/tests/tuple/.expect/tupleVariadic.txt )
-
tuple/tupleAssign.cfa (moved) (moved from src/tests/tuple/tupleAssign.c ) (4 diffs)
-
tuple/tupleCast.cfa (moved) (moved from src/tests/tuple/tupleCast.c )
-
tuple/tupleFunction.cfa (moved) (moved from src/tests/tuple/tupleFunction.c )
-
tuple/tupleMember.cfa (moved) (moved from src/tests/tuple/tupleMember.c )
-
tuple/tuplePolymorphism.cfa (moved) (moved from src/tests/tuple/tuplePolymorphism.c )
-
tuple/tupleVariadic.cfa (moved) (moved from src/tests/tuple/tupleVariadic.c ) (5 diffs)
-
tuple/tuples.cfa (moved) (moved from src/tests/tuple/tuples.c )
-
typeGenerator.cfa (moved) (moved from src/tests/typeGenerator.c )
-
typedef.cfa (moved) (moved from src/tests/typedef.c )
-
typedefDeclarator.cfa (moved) (moved from src/tests/typedefDeclarator.c )
-
typedefRedef.cfa (moved) (moved from src/tests/typedefRedef.c )
-
typeof.cfa (moved) (moved from src/tests/typeof.c )
-
userLiterals.cfa (moved) (moved from src/tests/user_literals.c ) (3 diffs)
-
variableDeclarator.cfa (moved) (moved from src/tests/variableDeclarator.c ) (2 diffs)
-
vector.cfa (moved) (moved from src/tests/vector.c ) (4 diffs)
-
virtualCast.cfa (moved) (moved from src/tests/virtualCast.c ) (1 diff)
-
voidPtr.cfa (moved) (moved from src/tests/voidPtr.c )
-
warnings/.expect/self-assignment.txt (added)
-
warnings/self-assignment.cfa (moved) (moved from src/tests/warnings/self-assignment.c ) (1 diff)
-
withStatement.cfa (added)
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/ato.txt
r7951100 rb067d9b 22 22 -123.456789012345679 -123.45678901234567890123456789 23 23 -123.456-123.456i -123.456-123.456i 24 0 +0i 2 324 0.+0.i 2 3 25 25 -123.456789012346+123.456789012346i -123.4567890123456+123.4567890123456i 26 26 123.456789012345679-123.456789012345679i 123.45678901234567890123456789-123.45678901234567890123456789i -
tests/.expect/complex.txt
r7951100 rb067d9b 1 1 x:3+2i y:4+5i z:7+7i 2 x:3 +2i y:4+5i z:7+7i2 x:3.+2.i y:4.+5.i z:7.+7.i 3 3 x:2.1+1.3i y:3.2+4.5i z:5.3+5.8i 4 4 x:2.1+1.3i y:3.2+4.5i z:5.3+5.8i -
tests/.expect/identity.txt
r7951100 rb067d9b 9 9 double 4.1 10 10 long double 4.1 11 float _Complex -4.1-2 i12 double _Complex -4.1-2 i13 long double _Complex -4.1-2 i11 float _Complex -4.1-2.i 12 double _Complex -4.1-2.i 13 long double _Complex -4.1-2.i -
tests/.expect/io1.txt
r7951100 rb067d9b 1 1 9 6 28 0 7 1 2 2 1 2 33 1234 1232 0 1 2 3 3 0123 4 0123 5 5 6 6 opening delimiters … … 8 8 9 9 closing delimiters 10 1, x 2. x 3; x 4! x 5? x 6% x 7 ¢ x 8» x 9) x 10] x 11} x10 1, x 2. x 3; x 4! x 5? x 6% x 7 ¢ x 8 » x 9) x 10] x 11} x 11 11 12 12 opening/closing delimiters -
tests/.expect/math2.txt
r7951100 rb067d9b 1 log:0 0 00.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i2 log2:3 3 33 log10:2 2 21 log:0. 0. 0. 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i 2 log2:3. 3. 3. 3 log10:2. 2. 2. 4 4 log1p:0.693147 0.693147180559945 0.693147180559945309 5 5 ilogb:0 0 0 6 logb:3 3 37 sqrt:1 1 11.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i8 cbrt:3 3 36 logb:3. 3. 3. 7 sqrt:1. 1. 1. 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i 8 cbrt:3. 3. 3. 9 9 hypot:1.41421 1.4142135623731 1.41421356237309505 10 10 sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i … … 12 12 tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 13 13 asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 14 acos:0 0 00.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i14 acos:0. 0. 0. 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 15 15 atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i 16 16 atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.78539816339744831 -
tests/.expect/math3.txt
r7951100 rb067d9b 2 2 cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i 3 3 tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i 4 acosh:0 0 01.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i4 acosh:0. 0. 0. 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i 5 5 asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i 6 6 atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i … … 9 9 lgamma:1.79176 1.79175946922805 1.791759469228055 10 10 lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1 11 tgamma:6 6 611 tgamma:6. 6. 6. -
tests/.expect/minmax.txt
r7951100 rb067d9b 6 6 signed long long int 4 3 min 3 7 7 unsigned long long int 4 3 min 3 8 float 4 3.1 min 3.19 double 4 3.1 min 3.110 long double 4 3.1 min 3.18 float 4. 3.1 min 3.1 9 double 4. 3.1 min 3.1 10 long double 4. 3.1 min 3.1 11 11 12 12 char z a max z … … 17 17 signed long long int 4 3 max 4 18 18 unsigned long long int 4 3 max 4 19 float 4 3.1 max 420 double 4 3.1 max 421 long double 4 3.1 max 419 float 4. 3.1 max 4. 20 double 4. 3.1 max 4. 21 long double 4. 3.1 max 4. -
tests/.expect/references.txt
r7951100 rb067d9b 35 35 3 36 36 3 37 3 9 { 1 , 7}, [1, 2, 3]37 3 9 { 1., 7. }, [1, 2, 3] 38 38 Destructing a Y 39 39 Destructing a Y -
tests/.expect/sum.txt
r7951100 rb067d9b 1 sum from 5 to 15 is 95, check 95 2 sum from 5 to 15 is 95, check 95 1 3 sum from 5 to 15 is 95, check 95 2 4 sum from 5 to 15 is 95, check 95 -
tests/.expect/time.txt
r7951100 rb067d9b 1 10800 2 3. 0712 1.000012 0 2 3. 071 10800 2 3.375 12 1.00001 2 0 2 3.375 3 3 7 7 7 4 4 14 -
tests/.gitignore
r7951100 rb067d9b 1 1 .out/ 2 2 .err/ 3 .type -
tests/KRfunctions.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // KRfunctions.c --7 // KRfunctions.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Feb 16 15:23:17 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 20 07:34:17 201713 // Update Count : 712 // Last Modified On : Tue Nov 6 17:50:34 2018 13 // Update Count : 9 14 14 // 15 15 … … 49 49 // Local Variables: // 50 50 // tab-width: 4 // 51 // compile-command: "cfa KRfunctions.c " //51 // compile-command: "cfa KRfunctions.cfa" // 52 52 // End: // -
tests/Makefile.in
r7951100 rb067d9b 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 = avl_test$(EXEEXT) .dummy_hack$(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/libtool.m4 \ 97 $(top_srcdir)/automake/ltoptions.m4 \ 98 $(top_srcdir)/automake/ltsugar.m4 \ 99 $(top_srcdir)/automake/ltversion.m4 \ 100 $(top_srcdir)/automake/lt~obsolete.m4 \ 101 $(top_srcdir)/automake/cfa.m4 $(top_srcdir)/configure.ac 99 102 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 100 103 $(ACLOCAL_M4) … … 102 105 mkinstalldirs = $(install_sh) -d 103 106 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) 107 CONFIG_CLEAN_FILES = config.py 108 CONFIG_CLEAN_VPATH_FILES = test.py 109 am__dummy_hack_OBJECTS = .dummy_hack.$(OBJEXT) .dummy_hackxx.$(OBJEXT) 110 _dummy_hack_OBJECTS = $(am__dummy_hack_OBJECTS) 111 _dummy_hack_LDADD = $(LDADD) 112 AM_V_lt = $(am__v_lt_@AM_V@) 113 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) 114 am__v_lt_0 = --silent 115 am__v_lt_1 = 110 116 am__dirstamp = $(am__leading_dot)dirstamp 111 117 am_avl_test_OBJECTS = avltree/avl_test.$(OBJEXT) \ … … 115 121 avl_test_OBJECTS = $(am_avl_test_OBJECTS) 116 122 avl_test_LDADD = $(LDADD) 117 am_fstream_test_OBJECTS = fstream_test.$(OBJEXT)118 fstream_test_OBJECTS = $(am_fstream_test_OBJECTS)119 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 123 AM_V_P = $(am__v_P_@AM_V@) 125 124 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) … … 140 139 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 141 140 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 141 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 142 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ 143 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 144 $(AM_CFLAGS) $(CFLAGS) 142 145 AM_V_CC = $(am__v_CC_@AM_V@) 143 146 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) … … 145 148 am__v_CC_1 = 146 149 CCLD = $(CC) 147 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 150 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 151 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 152 $(AM_LDFLAGS) $(LDFLAGS) -o $@ 148 153 AM_V_CCLD = $(am__v_CCLD_@AM_V@) 149 154 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) 150 155 am__v_CCLD_0 = @echo " CCLD " $@; 151 156 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) 157 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 158 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 159 LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ 160 $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ 161 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 162 $(AM_CXXFLAGS) $(CXXFLAGS) 163 AM_V_CXX = $(am__v_CXX_@AM_V@) 164 am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) 165 am__v_CXX_0 = @echo " CXX " $@; 166 am__v_CXX_1 = 167 CXXLD = $(CXX) 168 CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ 169 $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ 170 $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 171 AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) 172 am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) 173 am__v_CXXLD_0 = @echo " CXXLD " $@; 174 am__v_CXXLD_1 = 175 SOURCES = $(_dummy_hack_SOURCES) $(avl_test_SOURCES) 176 DIST_SOURCES = $(_dummy_hack_SOURCES) $(avl_test_SOURCES) 156 177 am__can_run_installinfo = \ 157 178 case $$AM_UPDATE_INFO_DIR in \ … … 178 199 ETAGS = etags 179 200 CTAGS = ctags 180 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/automake/depcomp 201 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.py.in \ 202 $(srcdir)/test.py $(top_srcdir)/automake/depcomp \ 203 $(top_srcdir)/src/cfa.make 181 204 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 182 205 ACLOCAL = @ACLOCAL@ 183 ALLOCA = @ALLOCA@184 206 AMTAR = @AMTAR@ 185 207 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 208 AR = @AR@ 186 209 AUTOCONF = @AUTOCONF@ 187 210 AUTOHEADER = @AUTOHEADER@ 188 211 AUTOMAKE = @AUTOMAKE@ 189 212 AWK = @AWK@ 190 BACKEND_CC = @BACKEND_CC@ 191 CC = @CFA_BINDIR@/@CFA_NAME@ 213 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@ 214 215 # adjust CC to current flags 216 CC = $(if $(ifeq $(DISTCC_CFA_PATH),yes),distcc $(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) 192 217 CCAS = @CCAS@ 193 218 CCASDEPMODE = @CCASDEPMODE@ 194 219 CCASFLAGS = @CCASFLAGS@ 195 220 CCDEPMODE = @CCDEPMODE@ 221 CFACC = $(CC) 222 CFACC_INSTALL = @CFACC_INSTALL@ 223 CFACPP = @CFACPP@ 196 224 CFA_BACKEND_CC = @CFA_BACKEND_CC@ 197 225 CFA_BINDIR = @CFA_BINDIR@ … … 201 229 CFA_NAME = @CFA_NAME@ 202 230 CFA_PREFIX = @CFA_PREFIX@ 203 204 # applies to both programs 205 CFLAGS = 231 CFLAGS = @CFLAGS@ 206 232 CPP = @CPP@ 207 233 CPPFLAGS = @CPPFLAGS@ 208 234 CXX = @CXX@ 235 CXXCPP = @CXXCPP@ 209 236 CXXDEPMODE = @CXXDEPMODE@ 210 237 CXXFLAGS = @CXXFLAGS@ 211 238 CYGPATH_W = @CYGPATH_W@ 212 239 DEFS = @DEFS@ 240 DEMANGLER = @DEMANGLER@ 213 241 DEPDIR = @DEPDIR@ 242 DLLTOOL = @DLLTOOL@ 243 DRIVER_DIR = @DRIVER_DIR@ 244 DSYMUTIL = @DSYMUTIL@ 245 DUMPBIN = @DUMPBIN@ 214 246 ECHO_C = @ECHO_C@ 215 247 ECHO_N = @ECHO_N@ … … 217 249 EGREP = @EGREP@ 218 250 EXEEXT = @EXEEXT@ 251 FGREP = @FGREP@ 219 252 GREP = @GREP@ 253 HAS_DISTCC = @HAS_DISTCC@ 254 HOST_FLAGS = @HOST_FLAGS@ 220 255 INSTALL = @INSTALL@ 221 256 INSTALL_DATA = @INSTALL_DATA@ … … 223 258 INSTALL_SCRIPT = @INSTALL_SCRIPT@ 224 259 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 260 LD = @LD@ 225 261 LDFLAGS = @LDFLAGS@ 226 262 LEX = @LEX@ 227 263 LEXLIB = @LEXLIB@ 228 264 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ 265 LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@ 266 LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@ 267 LIBDEMANGLE = @LIBDEMANGLE@ 229 268 LIBOBJS = @LIBOBJS@ 230 269 LIBS = @LIBS@ 270 LIBTOOL = @LIBTOOL@ 271 LIPO = @LIPO@ 272 LN_S = @LN_S@ 231 273 LTLIBOBJS = @LTLIBOBJS@ 232 MACHINE_TYPE = @MACHINE_TYPE@ 233 MAINT = @MAINT@ 274 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 234 275 MAKEINFO = @MAKEINFO@ 276 MANIFEST_TOOL = @MANIFEST_TOOL@ 235 277 MKDIR_P = @MKDIR_P@ 278 NM = @NM@ 279 NMEDIT = @NMEDIT@ 280 OBJDUMP = @OBJDUMP@ 236 281 OBJEXT = @OBJEXT@ 282 OTOOL = @OTOOL@ 283 OTOOL64 = @OTOOL64@ 237 284 PACKAGE = @PACKAGE@ 238 285 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ … … 244 291 PATH_SEPARATOR = @PATH_SEPARATOR@ 245 292 RANLIB = @RANLIB@ 293 SED = @SED@ 246 294 SET_MAKE = @SET_MAKE@ 247 295 SHELL = @SHELL@ 248 296 STRIP = @STRIP@ 297 TARGET_HOSTS = @TARGET_HOSTS@ 249 298 VERSION = @VERSION@ 250 299 YACC = @YACC@ … … 254 303 abs_top_builddir = @abs_top_builddir@ 255 304 abs_top_srcdir = @abs_top_srcdir@ 305 ac_ct_AR = @ac_ct_AR@ 256 306 ac_ct_CC = @ac_ct_CC@ 257 307 ac_ct_CXX = @ac_ct_CXX@ 308 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 258 309 am__include = @am__include@ 259 310 am__leading_dot = @am__leading_dot@ … … 302 353 top_builddir = @top_builddir@ 303 354 top_srcdir = @top_srcdir@ 304 AM_CFLAGS = -g -Wall -Wno-unused-function -O2 305 fstream_test_SOURCES = fstream_test.c 306 vector_test_SOURCES = vector_int.c array.c vector_test.c 307 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 355 AUTOMAKE_OPTIONS = foreign # do not require all the GNU file names 356 ACLOCAL_AMFLAGS = -I automake 357 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS) 358 LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 359 $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \ 360 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) \ 361 $(AM_CFLAGS) $(CFLAGS) 362 363 AM_V_CFA = $(am__v_CFA_@AM_V@) 364 am__v_CFA_ = $(am__v_CFA_@AM_DEFAULT_V@) 365 am__v_CFA_0 = @echo " CFA " $@; 366 am__v_CFA_1 = 367 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 368 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 369 am__v_JAVAC_0 = @echo " JAVAC " $@; 370 am__v_JAVAC_1 = 371 AM_V_GOC = $(am__v_GOC_@AM_V@) 372 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 373 am__v_GOC_0 = @echo " GOC " $@; 374 am__v_GOC_1 = 375 UPPCC = u++ 376 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) 377 AM_V_UPP = $(am__v_UPP_@AM_V@) 378 am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@) 379 am__v_UPP_0 = @echo " UPP " $@; 380 am__v_UPP_1 = 381 debug = yes 382 installed = no 383 archiveerrors = 384 DEBUG_FLAGS = -debug -O0 385 quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes 386 concurrent = 387 timeouts = 388 TEST_PY = python3 ${builddir}/test.py 389 390 # applies to both programs 391 # since automake doesn't have support for CFA we have to 392 AM_CFLAGS = $(if $(test), 2> $(test), ) \ 393 -g \ 394 -Wall \ 395 -Wno-unused-function \ 396 -quiet @CFA_FLAGS@ \ 397 -DIN_DIR="${abs_srcdir}/.in/" 398 399 400 # get the desired cfa to test 401 TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@) 402 403 # get local binary for depedencies 404 CFACCBIN = @CFACC@ 405 406 # adjusted CC but without the actual distcc call 407 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS}) 408 PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} && 409 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa 410 # automake doesn't know we still need C/CPP rules so pretend like we have a C program 411 _dummy_hack_SOURCES = .dummy_hack.c .dummy_hackxx.cpp 412 413 #---------------------------------------------------------------------------------------------------------------- 414 415 # Use for all tests, make sure the path are correct and all flags are added 416 CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGSCFA" | sed 's/-\|\//_/g')) 417 418 #------------------------------------------------------------------------------ 419 # TARGETS WITH CUSTOM FLAGS 420 #------------------------------------------------------------------------------ 421 # custom libs 422 gmp_FLAGSLD = -lgmp 423 424 #------------------------------------------------------------------------------ 425 # Generated code 426 GENERATED_CODE = declarationSpecifier gccExtensions extension attributes functions KRfunctions 427 428 # Use for tests where the make command is expected to succeed but the expected.txt should be compared to stderr 429 EXPECT_STDERR = builtins/sync warnings/self-assignment 308 430 all: all-am 309 431 310 432 .SUFFIXES: 311 .SUFFIXES: .c . o .obj312 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am$(am__configure_deps)433 .SUFFIXES: .c .cfa .cpp .dummy_hack .dummy_hackxx .lo .o .obj .validate 434 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/src/cfa.make $(am__configure_deps) 313 435 @for dep in $?; do \ 314 436 case '$(am__configure_deps)' in \ … … 319 441 esac; \ 320 442 done; \ 321 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/examples/Makefile'; \443 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ 322 444 $(am__cd) $(top_srcdir) && \ 323 $(AUTOMAKE) --foreign src/examples/Makefile445 $(AUTOMAKE) --foreign tests/Makefile 324 446 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 325 447 @case '$?' in \ … … 330 452 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 331 453 esac; 454 $(top_srcdir)/src/cfa.make $(am__empty): 332 455 333 456 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 334 457 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 335 458 336 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@$(am__configure_deps)459 $(top_srcdir)/configure: $(am__configure_deps) 337 460 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 338 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@$(am__aclocal_m4_deps)461 $(ACLOCAL_M4): $(am__aclocal_m4_deps) 339 462 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 340 463 $(am__aclocal_m4_deps): 341 342 clean-noinstPROGRAMS: 343 -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) 464 config.py: $(top_builddir)/config.status $(srcdir)/config.py.in 465 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 466 467 .dummy_hack$(EXEEXT): $(_dummy_hack_OBJECTS) $(_dummy_hack_DEPENDENCIES) $(EXTRA__dummy_hack_DEPENDENCIES) 468 @rm -f .dummy_hack$(EXEEXT) 469 $(AM_V_CXXLD)$(CXXLINK) $(_dummy_hack_OBJECTS) $(_dummy_hack_LDADD) $(LIBS) 344 470 avltree/$(am__dirstamp): 345 471 @$(MKDIR_P) avltree … … 367 493 $(AM_V_CCLD)$(LINK) $(avl_test_OBJECTS) $(avl_test_LDADD) $(LIBS) 368 494 369 fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES)370 @rm -f fstream_test$(EXEEXT)371 $(AM_V_CCLD)$(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS)372 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 495 mostlyclean-compile: 378 496 -rm -f *.$(OBJEXT) … … 382 500 -rm -f *.tab.c 383 501 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 @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 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl-private.Po@am__quote@ 390 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl0.Po@am__quote@ 391 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl1.Po@am__quote@ 392 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl2.Po@am__quote@ 393 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl3.Po@am__quote@ 394 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl4.Po@am__quote@ 395 @AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test.Po@am__quote@ 502 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/.dummy_hack.Po@am__quote@ 503 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/.dummy_hackxx.Po@am__quote@ 396 504 397 505 .c.o: … … 410 518 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 411 519 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 520 521 .c.lo: 522 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 523 @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 524 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo 525 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 526 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 527 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< 528 529 .cpp.o: 530 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ 531 @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 532 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po 533 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 534 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 535 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< 536 537 .cpp.obj: 538 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ 539 @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ 540 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po 541 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 542 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 543 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 544 545 .cpp.lo: 546 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 547 @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 548 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo 549 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 550 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 551 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< 552 553 mostlyclean-libtool: 554 -rm -f *.lo 555 556 clean-libtool: 557 -rm -rf .libs _libs 412 558 413 559 ID: $(am__tagged_files) … … 495 641 check-am: all-am 496 642 check: check-am 497 all-am: Makefile $(PROGRAMS)643 all-am: Makefile all-local 498 644 installdirs: 499 645 install: install-am … … 531 677 clean: clean-am 532 678 533 clean-am: clean-generic clean- noinstPROGRAMSmostlyclean-am679 clean-am: clean-generic clean-libtool clean-local mostlyclean-am 534 680 535 681 distclean: distclean-am 536 -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)682 -rm -rf ./$(DEPDIR) 537 683 -rm -f Makefile 538 684 distclean-am: clean-am distclean-compile distclean-generic \ … … 580 726 581 727 maintainer-clean: maintainer-clean-am 582 -rm -rf ./$(DEPDIR) avltree/$(DEPDIR)728 -rm -rf ./$(DEPDIR) 583 729 -rm -f Makefile 584 730 maintainer-clean-am: distclean-am maintainer-clean-generic … … 586 732 mostlyclean: mostlyclean-am 587 733 588 mostlyclean-am: mostlyclean-compile mostlyclean-generic 734 mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 735 mostlyclean-libtool 589 736 590 737 pdf: pdf-am … … 600 747 .MAKE: install-am install-strip 601 748 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 dvi-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 installcheck installcheck-am installdirs maintainer-clean \ 749 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ 750 clean-generic clean-libtool clean-local cscopelist-am ctags \ 751 ctags-am distclean distclean-compile distclean-generic \ 752 distclean-libtool distclean-tags distdir dvi dvi-am html \ 753 html-am info info-am install install-am install-data \ 754 install-data-am install-dvi install-dvi-am install-exec \ 755 install-exec-am install-html install-html-am install-info \ 756 install-info-am install-man install-pdf install-pdf-am \ 757 install-ps install-ps-am install-strip installcheck \ 758 installcheck-am installdirs maintainer-clean \ 611 759 maintainer-clean-generic mostlyclean mostlyclean-compile \ 612 mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall\613 uninstall-am760 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 761 tags tags-am uninstall uninstall-am 614 762 615 763 .PRECIOUS: Makefile 616 764 617 765 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 ; 766 .cfa.o: 767 $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ 768 $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 769 $(am__mv) $$depbase.Tpo $$depbase.Po 770 771 .cfa.lo: 772 $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 773 $(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 774 $(am__mv) $$depbase.Tpo $$depbase.Plo 775 776 .PHONY: list .validate 777 .INTERMEDIATE: .validate .validate.cfa 778 779 #---------------------------------------------------------------------------------------------------------------- 780 all-local : 781 @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} 782 783 all-tests : 784 @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program 785 786 clean-local : 787 rm -f ${EXTRA_PROGRAMS} 788 789 list : 790 @+${TEST_PY} --list ${concurrent} 791 792 .validate: .validate.cfa 793 $(CFACOMPILE) .validate.cfa -fsyntax-only -Wall -Wextra -Werror 794 795 .validate.cfa: 796 @echo "int main() { return 0; }" > ${@} 797 798 # automake doesn't know we still need C rules so pretend like we have a C program 799 .dummy_hack.c: 800 @echo "int main() { return 0; }" > ${@} 801 802 .dummy_hackxx.cpp: 803 @echo "int bar() { return 0; }" > ${@} 804 805 concurrency : 806 @+${TEST_PY} --debug=${debug} --install=${installed} -Iconcurrent 807 808 #---------------------------------------------------------------------------------------------------------------- 809 810 # implicit rule so not all test require a rule 811 # split into two steps to support compiling remotely using distcc 812 # don't use distcc to do the linking because distcc doesn't do linking 813 % : %.cfa $(CFACCBIN) 814 $(CFACOMPILETEST) -c -o $(abspath ${@}).o 815 $(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@}) 816 817 # implicit rule for c++ test 818 # convient for testing the testsuite itself but not actuall used 819 % : %.cpp 820 $(PRETTY_PATH) $(CXXCOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@}) 821 $(GENERATED_CODE): % : %.cfa $(CFACCBIN) 822 $(CFACOMPILETEST) -CFA -XCFA -p -c -fsyntax-only -o $(abspath ${@}) 823 $(EXPECT_STDERR): % : %.cfa $(CFACCBIN) 824 $(CFACOMPILETEST) -c -fsyntax-only 2> $(abspath ${@}) 825 826 #------------------------------------------------------------------------------ 827 # CUSTOM TARGET 828 #------------------------------------------------------------------------------ 829 # expected failures 830 # use custom target since they require a custom define and custom dependencies 831 alloc-ERROR : alloc.cfa $(CFACCBIN) 832 $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) 833 834 typedefRedef-ERR1 : typedefRedef.cfa $(CFACCBIN) 835 $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) 836 837 nested-types-ERR1 : nested-types.cfa $(CFACCBIN) 838 $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) 839 840 nested-types-ERR2 : nested-types.cfa $(CFACCBIN) 841 $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@}) 842 843 raii/memberCtors-ERR1 : raii/memberCtors.cfa $(CFACCBIN) 844 $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) 845 846 raii/ctor-autogen-ERR1 : raii/ctor-autogen.cfa $(CFACCBIN) 847 $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) 848 849 raii/dtor-early-exit-ERR1 : raii/dtor-early-exit.cfa $(CFACCBIN) 850 $(CFACOMPILETEST) -DERR1 -c -fsyntax-only -o $(abspath ${@}) 851 852 raii/dtor-early-exit-ERR2 : raii/dtor-early-exit.cfa $(CFACCBIN) 853 $(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@}) 854 855 #------------------------------------------------------------------------------ 856 # Other targets 625 857 626 858 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
tests/abs.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // abs.c --7 // abs.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Jan 28 18:26:16 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 22 22:31:03 201713 // Update Count : 5 212 // Last Modified On : Tue Dec 4 21:33:15 2018 13 // Update Count : 55 14 14 // 15 15 16 #include <fstream >17 #include <stdlib > // abs16 #include <fstream.hfa> 17 #include <stdlib.hfa> // abs 18 18 19 19 int main( void ) { 20 20 signed char ch = -65; 21 sout | "char\t\t\t" | ch | "\tabs " | abs( ch ) | endl;22 sout | "signed int\t\t" | -65 | "\tabs" | abs( -65 ) | endl;23 sout | "signed long int\t\t" | -65l | "\tabs" | abs( -65l ) | endl;24 sout | "signed long long int\t" | -65ll | "\tabs" | abs( -65ll ) | endl;25 sout | "float\t\t\t" | -65.0f | "\tabs" | abs( -65.0f ) | endl;26 sout | "double\t\t\t" | -65.0 | "\tabs" | abs( -65.0 ) | endl;27 sout | "long double\t\t" | -65.0l | "\tabs" | abs( -65.0l ) | endl;28 sout | "float _Complex\t\t" | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF ) | endl;29 sout | "double _Complex\t\t" | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD ) | endl;30 sout | "long double _Complex\t" | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL ) | endl;21 sout | "char\t\t\t" | ch | "\tabs " | abs( ch ); 22 sout | "signed int\t\t" | -65 | "\tabs" | abs( -65 ); 23 sout | "signed long int\t\t" | -65l | "\tabs" | abs( -65l ); 24 sout | "signed long long int\t" | -65ll | "\tabs" | abs( -65ll ); 25 sout | "float\t\t\t" | -65.0f | "\tabs" | abs( -65.0f ); 26 sout | "double\t\t\t" | -65.0 | "\tabs" | abs( -65.0 ); 27 sout | "long double\t\t" | -65.0l | "\tabs" | abs( -65.0l ); 28 sout | "float _Complex\t\t" | -65.0F-2.0iF | "\tabs" | abs( -65.0F-2.0iF ); 29 sout | "double _Complex\t\t" | -65.0D-2.0iD | "\tabs" | abs( -65.0D-2.0iD ); 30 sout | "long double _Complex\t" | -65.0L-2.0iL | "\tabs" | abs( -65.0L-2.0iL ); 31 31 } // main 32 32 33 33 // Local Variables: // 34 34 // tab-width: 4 // 35 // compile-command: "cfa abs.c " //35 // compile-command: "cfa abs.cfa" // 36 36 // End: // -
tests/alloc.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // alloc.c --7 // alloc.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 16 15:42:31 201813 // Update Count : 3 3012 // Last Modified On : Sun Oct 20 21:45:21 2019 13 // Update Count : 391 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 = '\x ff';30 int * p ;29 char fill = '\xde'; 30 int * p, * p1; 31 31 32 32 // allocation, non-array types 33 34 // int & r = malloc();35 // r = 0xdeadbeef;36 // printf( "C malloc %#x\n", r );37 // free( &r );38 33 39 34 p = (int *)malloc( sizeof(*p) ); // C malloc, type unsafe … … 52 47 free( p ); 53 48 54 p = alloc( fill ); // CFA alloc, fill 49 p = alloc_set( fill ); // CFA alloc, fill 50 printf( "CFA array alloc, fill %#hhx\n", fill ); 55 51 printf( "CFA alloc, fill %08x\n", *p ); 52 free( p ); 53 54 p = alloc_set( 3 ); // CFA alloc, fill 55 printf( "CFA alloc, fill %d\n", *p ); 56 free( p ); 56 57 57 58 … … 61 62 p = (int *)calloc( dim, sizeof( *p ) ); // C array calloc, type unsafe 62 63 printf( "C array calloc, fill 0\n" ); 63 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }64 for ( i; dim ) { printf( "%#x ", p[i] ); } 64 65 printf( "\n" ); 65 66 free( p ); … … 67 68 p = calloc( dim ); // CFA array calloc, type safe 68 69 printf( "CFA array calloc, fill 0\n" ); 69 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }70 for ( i; dim ) { printf( "%#x ", p[i] ); } 70 71 printf( "\n" ); 71 72 free( p ); 72 73 73 74 p = alloc( dim ); // CFA array alloc, type safe 74 for ( i nt i = 0; i < dim; i += 1) { p[i] = 0xdeadbeef; }75 for ( i; dim ) { p[i] = 0xdeadbeef; } 75 76 printf( "CFA array alloc, no fill\n" ); 76 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] ); }77 printf( "\n" ); 78 free( p ); 79 80 p = alloc ( 2 * dim, fill );// CFA array alloc, fill77 for ( i; dim ) { printf( "%#x ", p[i] ); } 78 printf( "\n" ); 79 free( p ); 80 81 p = alloc_set( 2 * dim, fill ); // CFA array alloc, fill 81 82 printf( "CFA array alloc, fill %#hhx\n", fill ); 82 for ( int i = 0; i < 2 * dim; i += 1 ) { printf( "%#x ", p[i] ); } 83 printf( "\n" ); 84 // do not free 83 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 84 printf( "\n" ); 85 free( p ); 86 87 p = alloc_set( 2 * dim, 0xdeadbeef ); // CFA array alloc, fill 88 printf( "CFA array alloc, fill %#hhx\n", 0xdeadbeef ); 89 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 90 printf( "\n" ); 91 // do not free 92 93 p1 = alloc_set( 2 * dim, p ); // CFA array alloc, fill 94 printf( "CFA array alloc, fill from array\n" ); 95 for ( i; 2 * dim ) { printf( "%#x %#x, ", p[i], p1[i] ); } 96 free( p1 ); 97 printf( "\n" ); 85 98 86 99 … … 89 102 90 103 p = (int *)realloc( p, dim * sizeof(*p) ); // C realloc 91 for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; }92 printf( "C realloc\n" );93 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); }94 printf( "\n" );104 printf( "C realloc\n" ); 105 for ( i; dim ) { printf( "%#x ", p[i] ); } 106 printf( "\n" ); 107 // do not free 95 108 96 109 p = realloc( p, 2 * dim * sizeof(*p) ); // CFA realloc 97 for ( i nt i = dim; i < 2 * dim; i += 1) { p[i] = 0x1010101; }110 for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; } 98 111 printf( "CFA realloc\n" ); 99 for ( i nt i = 0; i < 2 * dim; i += 1) { printf( "%#x ", p[i] ); }112 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 100 113 printf( "\n" ); 101 114 // do not free … … 106 119 107 120 p = alloc( p, dim ); // CFA resize array alloc 108 for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; } 109 printf( "CFA resize alloc\n" ); 110 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 111 printf( "\n" ); 121 for ( i; dim ) { p[i] = 0xdeadbeef; } 122 printf( "CFA resize array alloc\n" ); 123 for ( i; dim ) { printf( "%#x ", p[i] ); } 124 printf( "\n" ); 125 // do not free 112 126 113 127 p = alloc( p, 2 * dim ); // CFA resize array alloc 114 for ( i nt i = dim; i < 2 * dim; i += 1) { p[i] = 0x1010101; }128 for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; } 115 129 printf( "CFA resize array alloc\n" ); 116 for ( int i = 0; i < 2 * dim; i += 1 ) { printf( "%#x ", p[i] ); } 117 printf( "\n" ); 118 119 p = alloc( p, dim ); // CFA array alloc 130 for ( i; 2 * dim ) { printf( "%#x ", p[i] ); } 131 printf( "\n" ); 132 // do not free 133 134 p = alloc( p, dim ); // CFA resize array alloc 120 135 printf( "CFA resize array alloc\n" ); 121 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 122 printf( "\n" ); 123 124 free( p ); 125 p = 0; 126 127 p = alloc( p, dim, fill ); // CFA array alloc, fill 136 for ( i; dim ) { printf( "%#x ", p[i] ); } 137 printf( "\n" ); 138 // do not free 139 140 p = alloc_set( p, 3 * dim, fill ); // CFA resize array alloc, fill 128 141 printf( "CFA resize array alloc, fill\n" ); 129 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 130 printf( "\n" ); 131 132 p = alloc( p, 2 * dim, fill ); // CFA array alloc, fill 142 for ( i; 3 * dim ) { printf( "%#x ", p[i] ); } 143 printf( "\n" ); 144 // do not free 145 146 p = alloc_set( p, dim, fill ); // CFA resize array alloc, fill 133 147 printf( "CFA resize array alloc, fill\n" ); 134 for ( int i = 0; i < 2 * dim; i += 1 ) { printf( "%#x ", p[i] ); } 135 printf( "\n" ); 136 137 p = alloc( p, dim, fill ); // CFA array alloc, fill 148 for ( i; dim ) { printf( "%#x ", p[i] ); } 149 printf( "\n" ); 150 // do not free 151 152 p = alloc_set( p, 3 * dim, fill ); // CFA resize array alloc, fill 138 153 printf( "CFA resize array alloc, fill\n" ); 139 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x ", p[i] );; }154 for ( i; 3 * dim ) { printf( "%#x ", p[i] );; } 140 155 printf( "\n" ); 141 156 free( p ); … … 171 186 free( stp ); 172 187 173 stp = &(*aligned_alloc( Alignment )){ 42, 42.5 }; // CFA aligned_alloc 174 assert( (uintptr_t)stp % Alignment == 0 ); 175 printf( "CFA aligned_alloc %d %g\n", stp->x, stp->y ); 176 free( stp ); 177 178 stp = &(*align_alloc( Alignment )){ 42, 42.5 }; // CFA align_alloc 179 assert( (uintptr_t)stp % Alignment == 0 ); 180 printf( "CFA align_alloc %d %g\n", stp->x, stp->y ); 181 free( stp ); 182 183 stp = align_alloc( Alignment, fill ); // CFA memalign, fill 184 assert( (uintptr_t)stp % Alignment == 0 ); 185 printf( "CFA align_alloc fill %#x %a\n", stp->x, stp->y ); 188 stp = &(*alloc_align( Alignment)){ 42, 42.5 }; // CFA alloc_align 189 assert( (uintptr_t)stp % Alignment == 0 ); 190 printf( "CFA alloc_align %d %g\n", stp->x, stp->y ); 191 free( stp ); 192 193 stp = &(*alloc_align( Alignment )){ 42, 42.5 }; // CFA alloc_align 194 assert( (uintptr_t)stp % Alignment == 0 ); 195 printf( "CFA alloc_align %d %g\n", stp->x, stp->y ); 196 free( stp ); 197 198 stp = alloc_align_set( Alignment, fill ); // CFA memalign, fill 199 assert( (uintptr_t)stp % Alignment == 0 ); 200 printf( "CFA alloc_align fill %#x %a\n", stp->x, stp->y ); 201 free( stp ); 202 203 stp = alloc_align_set( Alignment, (Struct){ 42, 42.5 } ); // CFA memalign, fill 204 assert( (uintptr_t)stp % Alignment == 0 ); 205 printf( "CFA alloc_align fill %d %g\n", stp->x, stp->y ); 206 // do not free 207 208 stp = &(*alloc_align( stp, 4096 )){ 42, 42.5 }; // CFA realign 209 assert( (uintptr_t)stp % 4096 == 0 ); 210 printf( "CFA alloc_align %d %g\n", stp->x, stp->y ); 186 211 free( stp ); 187 212 … … 190 215 printf( "\n" ); 191 216 192 stp = align_alloc( Alignment, dim ); // CFA array memalign 193 assert( (uintptr_t)stp % Alignment == 0 ); 194 for ( int i = 0; i < dim; i += 1 ) { stp[i] = (Struct){ 42, 42.5 }; } 195 printf( "CFA array align_alloc\n" ); 196 for ( int i = 0; i < dim; i += 1 ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 197 printf( "\n" ); 198 free( stp ); 199 200 stp = align_alloc( Alignment, dim, fill ); // CFA array memalign, fill 201 assert( (uintptr_t)stp % Alignment == 0 ); 202 printf( "CFA array align_alloc, fill\n" ); 203 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x %a, ", stp[i].x, stp[i].y ); } 217 stp = alloc_align( Alignment, dim ); // CFA array memalign 218 assert( (uintptr_t)stp % Alignment == 0 ); 219 for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; } 220 printf( "CFA array alloc_align\n" ); 221 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 222 printf( "\n" ); 223 free( stp ); 224 225 stp = alloc_align_set( Alignment, dim, fill ); // CFA array memalign, fill 226 assert( (uintptr_t)stp % Alignment == 0 ); 227 printf( "CFA array alloc_align, fill\n" ); 228 for ( i; dim ) { printf( "%#x %a, ", stp[i].x, stp[i].y ); } 229 printf( "\n" ); 230 free( stp ); 231 232 stp = alloc_align_set( Alignment, dim, (Struct){ 42, 42.5 } ); // CFA array memalign, fill 233 assert( (uintptr_t)stp % Alignment == 0 ); 234 printf( "CFA array alloc_align, fill\n" ); 235 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 236 printf( "\n" ); 237 // do not free 238 239 stp1 = alloc_align_set( Alignment, dim, stp ); // CFA array memalign, fill 240 assert( (uintptr_t)stp % Alignment == 0 ); 241 printf( "CFA array alloc_align, fill array\n" ); 242 for ( i; dim ) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); } 243 printf( "\n" ); 244 free( stp1 ); 245 246 stp = alloc_align( stp, 4096, dim ); // CFA aligned realloc array 247 assert( (uintptr_t)stp % 4096 == 0 ); 248 for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; } 249 printf( "CFA realloc array alloc_align\n" ); 250 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 204 251 printf( "\n" ); 205 252 free( stp ); … … 218 265 printf( "\n" ); 219 266 220 memset( sta, dim, fill );// CFA array memset, type safe267 amemset( sta, fill, dim ); // CFA array memset, type safe 221 268 printf( "CFA array memset\n" ); 222 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x %a, ", sta[i].x, sta[i].y ); }223 printf( "\n" ); 224 225 memcpy( sta1, sta, dim );// CFA array memcpy, type safe226 printf( "CFA memcpy\n" );227 for ( i nt i = 0; i < dim; i += 1) { printf( "%#x %a, ", sta1[i].x, sta1[i].y ); }269 for ( i; dim ) { printf( "%#x %a, ", sta[i].x, sta[i].y ); } 270 printf( "\n" ); 271 272 amemcpy( sta1, sta, dim ); // CFA array memcpy, type safe 273 printf( "CFA array memcpy\n" ); 274 for ( i; dim ) { printf( "%#x %a, ", sta1[i].x, sta1[i].y ); } 228 275 printf( "\n" ); 229 276 … … 240 287 stp = anew( dim, 42, 42.5 ); 241 288 printf( "CFA array new initialize\n" ); 242 for ( i nt i = 0; i < dim; i += 1) { printf( "%d %g, ", stp[i].x, stp[i].y ); }289 for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); } 243 290 printf( "\n" ); 244 291 stp1 = anew( dim, 42, 42.5 ); 245 for ( i nt i = 0; i < dim; i += 1) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); }292 for ( i; dim ) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); } 246 293 printf( "\n" ); 247 294 adelete( dim, stp, dim, stp1 ); … … 271 318 // Local Variables: // 272 319 // tab-width: 4 // 273 // compile-command: "cfa alloc.c " //320 // compile-command: "cfa alloc.cfa" // 274 321 // End: // -
tests/ato.cfa
r7951100 rb067d9b 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 // ato.c --8 // 6 // 7 // ato.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Feb 4 08:10:57 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Nov 16 18:31:56 201713 // Update Count : 8914 // 12 // Last Modified On : Tue Dec 4 21:33:53 2018 13 // Update Count : 92 14 // 15 15 16 #include <fstream >17 #include <stdlib > // ato, strto16 #include <fstream.hfa> 17 #include <stdlib.hfa> // ato, strto 18 18 19 19 int main( void ) { 20 20 const char * sptr = "-123"; 21 21 int i = ato( sptr ); 22 sout | i | sptr | endl;22 sout | i | sptr; 23 23 sptr = "123"; 24 24 unsigned int ui = ato( sptr ); 25 sout | ui | sptr | endl;25 sout | ui | sptr; 26 26 27 27 sptr = "-123"; 28 28 long int li = ato( sptr ); 29 sout | li | sptr | endl;29 sout | li | sptr; 30 30 sptr = "123"; 31 31 unsigned long int uli = ato( sptr ); 32 sout | uli | sptr | endl;32 sout | uli | sptr; 33 33 34 34 sptr = "-123"; 35 35 long long int lli = ato( sptr ); 36 sout | lli | sptr | endl;36 sout | lli | sptr; 37 37 sptr = "123"; 38 38 unsigned long long int ulli = ato( sptr ); 39 sout | ulli | sptr | endl;39 sout | ulli | sptr; 40 40 41 41 sptr = "-123.456"; 42 42 float f = ato( sptr ); 43 sout | f | sptr | endl;43 sout | f | sptr; 44 44 sptr = "-123.4567890123456"; 45 45 double d = ato( sptr ); 46 sout | d | sptr | endl;46 sout | d | sptr; 47 47 sptr = "-123.45678901234567890123456789"; 48 48 long double ld = ato( sptr ); 49 sout | ld | sptr | endl;49 sout | ld | sptr; 50 50 51 51 sptr = "-123.456-123.456i"; 52 52 float _Complex fc = ato( sptr ); 53 sout | fc | sptr | endl;53 sout | fc | sptr; 54 54 sptr = "-123.4567890123456+123.4567890123456i"; 55 55 double _Complex dc = ato( sptr ); 56 sout | dc | sptr | endl;56 sout | dc | sptr; 57 57 sptr = "123.45678901234567890123456789-123.45678901234567890123456789i"; 58 58 long double _Complex ldc = ato( sptr ); 59 sout | ldc | sptr | endl;59 sout | ldc | sptr; 60 60 sptr = "123.45678901234-123.4567890i"; 61 61 long double _Complex ldc2 = ato( sptr ); 62 sout | ldc2 | sptr | endl;62 sout | ldc2 | sptr; 63 63 64 64 65 65 sptr = "-123"; 66 66 i = strto( sptr, 0, 10 ); 67 sout | i | sptr | endl;67 sout | i | sptr; 68 68 sptr = "123"; 69 69 ui = strto( sptr, 0, 10 ); 70 sout | ui | sptr | endl;70 sout | ui | sptr; 71 71 72 72 sptr = "-123"; 73 73 li = strto( sptr, 0, 10 ); 74 sout | li | sptr | endl;74 sout | li | sptr; 75 75 sptr = "123"; 76 76 uli = strto( sptr, 0, 10 ); 77 sout | uli | sptr | endl;77 sout | uli | sptr; 78 78 79 79 sptr = "-123"; 80 80 lli = strto( sptr, 0, 10 ); 81 sout | lli | sptr | endl;81 sout | lli | sptr; 82 82 sptr = "123"; 83 83 ulli = strto( sptr, 0, 10 ); 84 sout | ulli | sptr | endl;84 sout | ulli | sptr; 85 85 86 86 sptr = "-123.456"; 87 87 f = strto( sptr, 0 ); 88 sout | f | sptr | endl;88 sout | f | sptr; 89 89 sptr = "-123.4567890123456"; 90 90 d = strto( sptr, 0 ); 91 sout | d | sptr | endl;91 sout | d | sptr; 92 92 sptr = "-123.45678901234567890123456789"; 93 93 ld = strto( sptr, 0 ); 94 sout | ld | sptr | endl;94 sout | ld | sptr; 95 95 96 96 sptr = "-123.456-123.456i"; 97 97 fc = strto( sptr, 0 ); 98 sout | fc | sptr | endl;98 sout | fc | sptr; 99 99 100 100 char * eptr = 0; 101 101 // sptr = "2fred"; 102 102 // fc = strto( sptr, &eptr ); 103 // sout | fc | sptr | eptr | endl;103 // sout | fc | sptr | eptr; 104 104 105 105 sptr = "2 3"; 106 106 fc = strto( sptr, &eptr ); 107 sout | fc | sptr | eptr | endl;107 sout | fc | sptr | eptr; 108 108 109 109 sptr = "-123.4567890123456+123.4567890123456i"; 110 110 dc = strto( sptr, 0 ); 111 sout | dc | sptr | endl;111 sout | dc | sptr; 112 112 sptr = "123.45678901234567890123456789-123.45678901234567890123456789i"; 113 113 ldc = strto( sptr, 0 ); 114 sout | ldc | sptr | endl;114 sout | ldc | sptr; 115 115 sptr = "123.45678901234-123.4567890i"; 116 116 ldc2 = strto( sptr, 0 ); 117 sout | ldc2 | sptr | endl;117 sout | ldc2 | sptr; 118 118 } // main 119 119 120 120 // Local Variables: // 121 121 // tab-width: 4 // 122 // compile-command: "cfa ato.c " //122 // compile-command: "cfa ato.cfa" // 123 123 // End: // -
tests/attributes.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // attributes.c --7 // attributes.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Mon Feb 6 16:07:02 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 23:05:52 201713 // Update Count : 312 // Last Modified On : Tue Nov 6 17:51:12 2018 13 // Update Count : 17 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 156 154 // Local Variables: // 157 155 // tab-width: 4 // 158 // compile-command: "cfa attributes.c " //156 // compile-command: "cfa attributes.cfa" // 159 157 // End: // -
tests/avltree/avl1.cfa
r7951100 rb067d9b 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.cfa
r7951100 rb067d9b 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.cfa
r7951100 rb067d9b 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/builtins/sync.cfa
r7951100 rb067d9b 11 11 volatile __int128 * vp16 = 0; __int128 * rp16 = 0; __int128 v16 = 0; 12 12 #endif 13 struct type * volatile * vpp = 0; struct type ** rpp = 0; struct type * vp = 0; 13 14 14 15 { char ret; ret = __sync_fetch_and_add(vp1, v1); } … … 180 181 { _Bool ret; ret = __sync_bool_compare_and_swap_16(vp16, v16,v16); } 181 182 #endif 183 { _Bool ret; ret = __sync_bool_compare_and_swap(vpp, vp, vp); } 182 184 183 185 { char ret; ret = __sync_val_compare_and_swap(vp1, v1, v1); } … … 193 195 { __int128 ret; ret = __sync_val_compare_and_swap_16(vp16, v16,v16); } 194 196 #endif 197 { struct type * ret; ret = __sync_val_compare_and_swap(vpp, vp, vp); } 198 195 199 196 200 { char ret; ret = __sync_lock_test_and_set(vp1, v1); } … … 230 234 { __atomic_clear(vp1, v1); } 231 235 232 { char ret; ret = __atomic_exchange_n(vp1, &v1, __ATOMIC_SEQ_CST); }236 { char ret; ret = __atomic_exchange_n(vp1, v1, __ATOMIC_SEQ_CST); } 233 237 { char ret; ret = __atomic_exchange_1(vp1, v1, __ATOMIC_SEQ_CST); } 234 238 { char ret; __atomic_exchange(vp1, &v1, &ret, __ATOMIC_SEQ_CST); } 235 { short ret; ret = __atomic_exchange_n(vp2, &v2, __ATOMIC_SEQ_CST); }239 { short ret; ret = __atomic_exchange_n(vp2, v2, __ATOMIC_SEQ_CST); } 236 240 { short ret; ret = __atomic_exchange_2(vp2, v2, __ATOMIC_SEQ_CST); } 237 241 { short ret; __atomic_exchange(vp2, &v2, &ret, __ATOMIC_SEQ_CST); } 238 { int ret; ret = __atomic_exchange_n(vp4, &v4, __ATOMIC_SEQ_CST); }242 { int ret; ret = __atomic_exchange_n(vp4, v4, __ATOMIC_SEQ_CST); } 239 243 { int ret; ret = __atomic_exchange_4(vp4, v4, __ATOMIC_SEQ_CST); } 240 244 { int ret; __atomic_exchange(vp4, &v4, &ret, __ATOMIC_SEQ_CST); } 241 { long long int ret; ret = __atomic_exchange_n(vp8, &v8, __ATOMIC_SEQ_CST); }245 { long long int ret; ret = __atomic_exchange_n(vp8, v8, __ATOMIC_SEQ_CST); } 242 246 { long long int ret; ret = __atomic_exchange_8(vp8, v8, __ATOMIC_SEQ_CST); } 243 247 { long long int ret; __atomic_exchange(vp8, &v8, &ret, __ATOMIC_SEQ_CST); } 244 248 #if defined(__SIZEOF_INT128__) 245 { __int128 ret; ret = __atomic_exchange_n(vp16, &v16, __ATOMIC_SEQ_CST); }249 { __int128 ret; ret = __atomic_exchange_n(vp16, v16, __ATOMIC_SEQ_CST); } 246 250 { __int128 ret; ret = __atomic_exchange_16(vp16, v16, __ATOMIC_SEQ_CST); } 247 251 { __int128 ret; __atomic_exchange(vp16, &v16, &ret, __ATOMIC_SEQ_CST); } 248 252 #endif 253 { struct type * ret; ret = __atomic_exchange_n(vpp, vp, __ATOMIC_SEQ_CST); } 254 { struct type * ret; __atomic_exchange(vpp, &vp, &ret, __ATOMIC_SEQ_CST); } 249 255 250 256 { char ret; ret = __atomic_load_n(vp1, __ATOMIC_SEQ_CST); } … … 265 271 { __int128 ret; __atomic_load(vp16, &ret, __ATOMIC_SEQ_CST); } 266 272 #endif 273 { struct type * ret; ret = __atomic_load_n(vpp, __ATOMIC_SEQ_CST); } 274 { struct type * ret; __atomic_load(vpp, &ret, __ATOMIC_SEQ_CST); } 267 275 268 276 { _Bool ret; ret = __atomic_compare_exchange_n(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } … … 283 291 { _Bool ret; ret = __atomic_compare_exchange(vp16, rp16, &v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } 284 292 #endif 293 { _Bool ret; ret = __atomic_compare_exchange_n(vpp, rpp, vp, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } 294 { _Bool ret; ret = __atomic_compare_exchange(vpp, rpp, &vp, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); } 285 295 286 296 { __atomic_store_n(vp1, v1, __ATOMIC_SEQ_CST); } … … 301 311 { __atomic_store(vp16, &v16, __ATOMIC_SEQ_CST); } 302 312 #endif 313 { __atomic_store_n(vpp, vp, __ATOMIC_SEQ_CST); } 314 { __atomic_store(vpp, &vp, __ATOMIC_SEQ_CST); } 303 315 304 316 { char ret; ret = __atomic_add_fetch(vp1, v1, __ATOMIC_SEQ_CST); } -
tests/completeTypeError.cfa
r7951100 rb067d9b 5 5 forall(dtype T | sized(T)) void quux(T *); 6 6 7 struct A; // incomplete8 struct B {}; // complete7 struct A; // incomplete 8 struct B {}; // complete 9 9 10 10 int main() { 11 int * i;12 void * v;11 int * i; 12 void * v; 13 13 14 14 A * x; … … 19 19 // okay 20 20 *i; 21 * x; // picks B21 *y; 22 22 *z; 23 23 foo(i); … … 32 32 // bad 33 33 *v; 34 * y;34 *x; // ambiguous 35 35 foo(v); 36 36 baz(v); … … 52 52 void qux(T * y) { 53 53 // okay 54 *y; 54 55 bar(y); 55 56 qux(y); … … 58 59 baz(y); 59 60 quux(y); 60 *y;61 61 } 62 62 -
tests/complex.cfa
r7951100 rb067d9b 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.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 24 22:07:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 22:08:01 201713 // Update Count : 114 // 12 // Last Modified On : Tue Dec 4 21:34:21 2018 13 // Update Count : 4 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 … … 25 25 printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) ); 26 26 #ifdef __CFA__ 27 sout | "x:" | x | "y:" | y | "z:" | z | endl;27 sout | "x:" | x | "y:" | y | "z:" | z; 28 28 #endif // __CFA 29 29 x = 2.1 + 1.3i; … … 32 32 printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) ); 33 33 #ifdef __CFA__ 34 sout | "x:" | x | "y:" | y | "z:" | z | endl;34 sout | "x:" | x | "y:" | y | "z:" | z; 35 35 #endif // __CFA 36 36 } … … 38 38 // Local Variables: // 39 39 // tab-width: 4 // 40 // compile-command: "cfa complex.c " //40 // compile-command: "cfa complex.cfa" // 41 41 // End: // -
tests/concurrent/examples/boundedBufferEXT.cfa
r7951100 rb067d9b 1 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo 3 // 2 4 // The contents of this file are covered under the licence agreement in the 3 5 // file "LICENCE" distributed with Cforall. … … 8 10 // Created On : Wed Apr 18 22:52:12 2018 9 11 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Wed May 2 16:12:58 201811 // Update Count : 712 // Last Modified On : Fri Jun 21 08:19:20 2019 13 // Update Count : 14 12 14 // 13 15 14 #include <stdlib >// random15 #include <fstream >16 #include <kernel >17 #include <thread >16 #include <stdlib.hfa> // random 17 #include <fstream.hfa> 18 #include <kernel.hfa> 19 #include <thread.hfa> 18 20 #include <unistd.h> // getpid 19 21 … … 50 52 } 51 53 52 const int Sentinel = -1;54 enum { Sentinel = -1 }; 53 55 54 56 thread Producer { … … 57 59 }; 58 60 void main( Producer & prod ) with( prod ) { 59 for ( i nt i = 1; i <= N; i += 1) {61 for ( i; 1 ~= N ) { 60 62 yield( random( 5 ) ); 61 63 insert( buffer, 1 ); … … 73 75 void main( Consumer & cons ) with( cons ) { 74 76 sum = 0; 75 for ( ;;) {77 for () { 76 78 yield( random( 5 ) ); 77 79 int item = remove( buffer ); … … 97 99 srandom( 1003 ); 98 100 99 for ( i = 0; i < Cons; i += 1 ) {// create consumers101 for ( i; Cons ) { // create consumers 100 102 cons[i] = new( &buffer, sums[i] ); 101 103 } // for 102 for ( i = 0; i < Prods; i += 1 ) {// create producers104 for ( i; Prods ) { // create producers 103 105 prods[i] = new( &buffer, 100000 ); 104 106 } // for 105 107 106 for ( i = 0; i < Prods; i += 1 ) {// wait for producers to finish108 for ( i; Prods ) { // wait for producers to finish 107 109 delete( prods[i] ); 108 110 } // for 109 for ( i = 0; i < Cons; i += 1 ) {// generate sentinal values to stop consumers111 for ( i; Cons ) { // generate sentinal values to stop consumers 110 112 insert( buffer, Sentinel ); 111 113 } // for 112 114 int sum = 0; 113 for ( i = 0; i < Cons; i += 1 ) {// wait for consumers to finish115 for ( i; Cons ) { // wait for consumers to finish 114 116 delete( cons[i] ); 115 117 sum += sums[i]; 116 118 } // for 117 sout | "total:" | sum | endl;119 sout | "total:" | sum; 118 120 } 119 121 120 122 // Local Variables: // 121 123 // tab-width: 4 // 122 // compile-command: "cfa boundedBufferEXT.c " //124 // compile-command: "cfa boundedBufferEXT.cfa" // 123 125 // End: // -
tests/concurrent/examples/boundedBufferINT.cfa
r7951100 rb067d9b 1 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 // 2 4 // The contents of this file are covered under the licence agreement in the 3 5 // file "LICENCE" distributed with Cforall. … … 8 10 // Created On : Mon Oct 30 12:45:13 2017 9 11 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Thu Apr 26 23:08:17 201811 // Update Count : 8212 // Last Modified On : Fri Jun 21 08:20:46 2019 13 // Update Count : 90 12 14 // 13 15 14 #include <stdlib >// random15 #include <fstream >16 #include <kernel >17 #include <thread >16 #include <stdlib.hfa> // random 17 #include <fstream.hfa> 18 #include <kernel.hfa> 19 #include <thread.hfa> 18 20 #include <unistd.h> // getpid 19 21 … … 51 53 } 52 54 53 const int Sentinel = -1;55 enum { Sentinel = -1 }; 54 56 55 57 thread Producer { … … 58 60 }; 59 61 void main( Producer & prod ) with( prod ) { 60 for ( i nt i = 1; i <= N; i += 1) {62 for ( i; 1 ~= N ) { 61 63 yield( random( 5 ) ); 62 64 insert( buffer, 1 ); … … 74 76 void main( Consumer & cons ) with( cons ) { 75 77 sum = 0; 76 for ( ;;) {78 for () { 77 79 yield( random( 5 ) ); 78 80 int item = remove( buffer ); … … 98 100 srandom( 1003 ); 99 101 100 for ( i = 0; i < Cons; i += 1 ) {// create consumers102 for ( i; Cons ) { // create consumers 101 103 cons[i] = new( &buffer, sums[i] ); 102 104 } // for 103 for ( i = 0; i < Prods; i += 1 ) {// create producers105 for ( i; Prods ) { // create producers 104 106 prods[i] = new( &buffer, 100000 ); 105 107 } // for 106 108 107 for ( i = 0; i < Prods; i += 1 ) {// wait for producers to finish109 for ( i; Prods ) { // wait for producers to finish 108 110 delete( prods[i] ); 109 111 } // for 110 for ( i = 0; i < Cons; i += 1 ) {// generate sentinal values to stop consumers112 for ( i; Cons ) { // generate sentinal values to stop consumers 111 113 insert( buffer, Sentinel ); 112 114 } // for 113 115 int sum = 0; 114 for ( i = 0; i < Cons; i += 1 ) {// wait for consumers to finish116 for ( i; Cons ) { // wait for consumers to finish 115 117 delete( cons[i] ); 116 118 sum += sums[i]; 117 119 } // for 118 sout | "total:" | sum | endl;120 sout | "total:" | sum; 119 121 } 120 122 121 123 // Local Variables: // 122 124 // tab-width: 4 // 123 // compile-command: "cfa boundedBufferINT.c " //125 // compile-command: "cfa boundedBufferINT.cfa" // 124 126 // End: // -
tests/concurrent/examples/datingService.cfa
r7951100 rb067d9b 1 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 // 2 4 // The contents of this file are covered under the licence agreement in the 3 5 // file "LICENCE" distributed with Cforall. … … 8 10 // Created On : Mon Oct 30 12:56:20 2017 9 11 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Sun May 27 09:05:18 201811 // Update Count : 2612 // Last Modified On : Fri Jun 21 11:32:34 2019 13 // Update Count : 38 12 14 // 13 15 14 #include <stdlib >// random15 #include <fstream >16 #include <kernel >17 #include <thread >16 #include <stdlib.hfa> // random 17 #include <fstream.hfa> 18 #include <kernel.hfa> 19 #include <thread.hfa> 18 20 #include <unistd.h> // getpid 19 21 … … 33 35 signal_block( Boys[ccode] ); // restart boy to set phone number 34 36 } // if 37 sout | "Girl:" | PhoneNo | "is dating Boy at" | BoyPhoneNo | "with ccode" | ccode; 35 38 return BoyPhoneNo; 36 39 } // DatingService girl … … 44 47 signal_block( Girls[ccode] ); // restart girl to set phone number 45 48 } // if 49 sout | " Boy:" | PhoneNo | "is dating Girl" | GirlPhoneNo | "with ccode" | ccode; 46 50 return GirlPhoneNo; 47 51 } // DatingService boy … … 58 62 yield( random( 100 ) ); // don't all start at the same time 59 63 unsigned int partner = girl( TheExchange, id, ccode ); 60 sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode | endl;61 64 girlck[id] = partner; 62 65 } // Girl main … … 69 72 70 73 thread Boy { 71 DatingService & TheExchange;74 DatingService & TheExchange; 72 75 unsigned int id, ccode; 73 76 }; // Boy … … 76 79 yield( random( 100 ) ); // don't all start at the same time 77 80 unsigned int partner = boy( TheExchange, id, ccode ); 78 sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode | endl;79 81 boyck[id] = partner; 80 82 } // Boy main … … 93 95 srandom( /*getpid()*/ 103 ); 94 96 95 for ( unsigned int i = 0; i < CompCodes; i += 1) {96 girls[i] = new( &TheExchange, i, i ); 97 for ( i; (unsigned int)CompCodes ) { 98 girls[i] = new( &TheExchange, i, i ); // TheExchange constructor needs unsigned int 97 99 boys[i] = new( &TheExchange, i, CompCodes - ( i + 1 ) ); 98 100 } // for 99 101 100 for ( unsigned int i = 0; i < CompCodes; i += 1) {102 for ( i; CompCodes ) { 101 103 delete( boys[i] ); 102 104 delete( girls[i] ); 103 105 } // for 104 106 105 for ( unsigned int i = 0; i < CompCodes; i += 1) {107 for ( i; CompCodes ) { 106 108 if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort(); 107 109 } // for … … 110 112 // Local Variables: // 111 113 // tab-width: 4 // 112 // compile-command: "cfa datingService.c " //114 // compile-command: "cfa datingService.cfa" // 113 115 // End: // -
tests/concurrent/examples/matrixSum.cfa
r7951100 rb067d9b 1 // -*- Mode: C -*- 2 // 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 4 3 // 5 4 // The contents of this file are covered under the licence agreement in the 6 5 // file "LICENCE" distributed with Cforall. 7 // 8 // matrixSum.c --9 // 6 // 7 // matrixSum.cfa -- 8 // 10 9 // Author : Peter A. Buhr 11 10 // Created On : Mon Oct 9 08:29:28 2017 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri May 25 09:34:27 201814 // Update Count : 1 015 // 12 // Last Modified On : Wed Feb 20 08:37:53 2019 13 // Update Count : 16 14 // 16 15 17 #include <fstream >18 #include <kernel >19 #include <thread >16 #include <fstream.hfa> 17 #include <kernel.hfa> 18 #include <thread.hfa> 20 19 21 20 thread Adder { … … 30 29 void main( Adder & adder ) with( adder ) { // thread starts here 31 30 subtotal = 0; 32 for ( int c = 0; c < cols; c += 1) {31 for ( c; cols ) { 33 32 subtotal += row[c]; 34 33 } // for … … 36 35 37 36 int main() { 38 constint rows = 10, cols = 1000;37 /* const */ int rows = 10, cols = 1000; 39 38 int matrix[rows][cols], subtotals[rows], total = 0; 40 39 processor p; // add kernel thread 41 40 42 for ( int r = 0; r < rows; r += 1) {43 for ( int c = 0; c < cols; c += 1) {41 for ( r; rows ) { 42 for ( c; cols ) { 44 43 matrix[r][c] = 1; 45 44 } // for 46 45 } // for 47 46 Adder * adders[rows]; 48 for ( int r = 0; r < rows; r += 1 ) {// start threads to sum rows47 for ( r; rows ) { // start threads to sum rows 49 48 adders[r] = &(*malloc()){ matrix[r], cols, subtotals[r] }; 50 49 // adders[r] = new( matrix[r], cols, &subtotals[r] ); 51 50 } // for 52 for ( int r = 0; r < rows; r += 1 ) {// wait for threads to finish51 for ( r; rows ) { // wait for threads to finish 53 52 delete( adders[r] ); 54 53 total += subtotals[r]; // total subtotals 55 54 } // for 56 sout | total | endl;55 sout | total; 57 56 } 58 57 59 58 // Local Variables: // 60 59 // tab-width: 4 // 61 // compile-command: "cfa matrixSum.c " //60 // compile-command: "cfa matrixSum.cfa" // 62 61 // End: // -
tests/concurrent/examples/quickSort.cfa
r7951100 rb067d9b 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 1 3 // 2 4 // The contents of this file are covered under the licence agreement in the … … 9 11 // Created On : Wed Dec 6 12:15:52 2017 10 12 // Last Modified By : Peter A. Buhr 11 // Last Modified On : T ue Jan 30 15:58:58 201812 // Update Count : 1 6213 // Last Modified On : Thu Oct 10 13:58:18 2019 14 // Update Count : 176 13 15 // 14 16 15 #include <fstream >16 #include <stdlib >17 #include <kernel >18 #include <thread >17 #include <fstream.hfa> 18 #include <stdlib.hfa> 19 #include <kernel.hfa> 20 #include <thread.hfa> 19 21 #include <string.h> // strcmp 20 22 … … 64 66 if ( depth > 0 ) { 65 67 depth -= 1; 66 Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half 67 //Quicksort lqs( values, left, high, depth ); // concurrently sort lower half 68 sort( values, left, high, depth ); // concurrently sort lower half 68 Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half 69 Quicksort rqs = { values, left, high, depth }; // concurrently sort upper half 70 // Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half 71 // sort( values, left, high, depth ); // concurrently sort upper half 69 72 } else { 70 73 sort( values, low, right, 0 ); // sequentially sort lower half … … 88 91 89 92 void usage( char * argv[] ) { 90 sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )" | endl;93 sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )"; 91 94 exit( EXIT_FAILURE ); // TERMINATE! 92 95 } // usage … … 114 117 &sortedfile = new( (const char *)argv[2] ); // open the output file 115 118 if ( fail( sortedfile ) ) { 116 serr | "Error! Could not open sorted output file \"" | argv[2] | "\"" | endl;119 serr | "Error! Could not open sorted output file \"" | argv[2] | "\""; 117 120 usage( argv ); 118 121 } // if … … 121 124 &unsortedfile = new( (const char *)argv[1] ); // open the input file 122 125 if ( fail( unsortedfile ) ) { 123 serr | "Error! Could not open unsorted input file \"" | argv[1] | "\"" | endl;126 serr | "Error! Could not open unsorted input file \"" | argv[1] | "\""; 124 127 usage( argv ); 125 128 } // if … … 127 130 } // if 128 131 } // if 132 sortedfile | nlOff; // turn off auto newline 129 133 130 134 enum { ValuesPerLine = 22 }; // number of values printed per line 131 135 132 136 if ( &unsortedfile ) { // generate output ? 133 for ( ;;) {137 for () { 134 138 unsortedfile | size; // read number of elements in the list 135 139 if ( eof( unsortedfile ) ) break; 136 140 int * values = alloc( size ); // values to be sorted, too large to put on stack 137 for ( int counter = 0; counter < size; counter += 1 ) {// read unsorted numbers141 for ( counter; size ) { // read unsorted numbers 138 142 unsortedfile | values[counter]; 139 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | endl | " ";143 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; 140 144 sortedfile | values[counter]; 141 145 if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' '; 142 146 } // for 143 sortedfile | endl;147 sortedfile | nl; 144 148 if ( size > 0 ) { // values to sort ? 145 149 Quicksort QS = { values, size - 1, 0 }; // sort values 146 150 } // wait until sort tasks terminate 147 for ( int counter = 0; counter < size; counter += 1 ) {// print sorted list148 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | endl | " ";151 for ( counter; size ) { // print sorted list 152 if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | " "; 149 153 sortedfile | values[counter]; 150 154 if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' '; 151 155 } // for 152 sortedfile | endl | endl;156 sortedfile | nl | nl; 153 157 154 158 delete( values ); … … 159 163 processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads 160 164 161 int * values = alloc( size ); // values to be sorted, too large to put on stack162 for ( int counter = 0; counter < size; counter += 1 ) {// generate unsorted numbers165 int * values = alloc( size ); // values to be sorted, too large to put on stack 166 for ( counter; size ) { // generate unsorted numbers 163 167 values[counter] = size - counter; // descending values 168 } // for 169 for ( int i = 0; i < 200; i +=1 ) { // random shuffle a few values 170 swap( values[rand() % size], values[rand() % size] ); 164 171 } // for 165 172 { … … 167 174 } // wait until sort tasks terminate 168 175 169 // for ( int counter = 0; counter < size - 1; counter += 1 ) {// check sorting176 // for ( counter; size - 1 ) { // check sorting 170 177 // if ( values[counter] > values[counter + 1] ) abort(); 171 178 // } // for … … 175 182 } // main 176 183 184 // for depth in 0 1 2 3 4 5 ; do echo "sort 500000000 values with ${depth} depth" ; time -f "%Uu %Ss %E %Mkb" a.out -t 500000000 ${depth} ; done 185 177 186 // Local Variables: // 178 187 // tab-width: 4 // 179 // compile-command: "cfa quickSort.c " //188 // compile-command: "cfa quickSort.cfa" // 180 189 // End: // -
tests/concurrent/monitor.cfa
r7951100 rb067d9b 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 { … … 40 40 MyThread f[4]; 41 41 } 42 sout | global.value | endl;42 sout | global.value; 43 43 } -
tests/concurrent/multi-monitor.cfa
r7951100 rb067d9b 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; … … 52 52 } 53 53 } 54 sout | global12 | global23 | global13 | endl;54 sout | global12 | global23 | global13; 55 55 } -
tests/concurrent/preempt.cfa
r7951100 rb067d9b 1 #include <kernel> 2 #include <thread> 3 #include <time> 1 #include <kernel.hfa> 2 #include <thread.hfa> 3 #include <time.hfa> 4 5 #include "long_tests.hfa" 4 6 5 7 #ifndef PREEMPTION_RATE … … 11 13 } 12 14 13 #ifdef LONG_TEST15 #ifdef TEST_LONG 14 16 static const unsigned long N = 30_000ul; 15 17 #else … … 30 32 31 33 void main(worker_t & this) { 32 while( counter < N) {34 while(TEST(counter < N)) { 33 35 __cfaabi_check_preemption(); 34 36 if( (counter % 7) == this.value ) { … … 40 42 } 41 43 __cfaabi_check_preemption(); 44 KICK_WATCHDOG; 42 45 } 43 46 } -
tests/concurrent/signal/block.cfa
r7951100 rb067d9b 7 7 8 8 9 #include <fstream> 10 #include <kernel> 11 #include <monitor> 12 #include <stdlib> 13 #include <thread> 14 #include <time> 9 #include <fstream.hfa> 10 #include <kernel.hfa> 11 #include <monitor.hfa> 12 #include <stdlib.hfa> 13 #include <thread.hfa> 14 #include <time.hfa> 15 16 #include "long_tests.hfa" 15 17 16 18 #ifndef PREEMPTION_RATE … … 22 24 } 23 25 24 #ifdef LONG_TEST26 #ifdef TEST_LONG 25 27 static const unsigned long N = 150_000ul; 26 28 #else … … 55 57 56 58 if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) { 57 sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread | endl;59 sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread; 58 60 abort(); 59 61 } … … 66 68 thread Waiter {}; 67 69 void main( Waiter & this ) { 68 for( int i = 0; i < N; i++ ) {70 for( int i = 0; TEST(i < N); i++ ) { 69 71 wait_op( globalA, globalB, i ); 72 KICK_WATCHDOG; 70 73 } 71 74 } … … 82 85 83 86 if( ! signal_block( cond ) ) { 84 sout | "ERROR expected to be able to signal" | endl;87 sout | "ERROR expected to be able to signal"; 85 88 abort(); 86 89 } … … 89 92 90 93 if(a.last_thread != next || b.last_thread != next) { 91 sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread | endl;94 sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread; 92 95 abort(); 93 96 } … … 127 130 Signaller s[4]; 128 131 Barger b[13]; 129 sout | "Starting waiters" | endl;132 sout | "Starting waiters"; 130 133 { 131 134 Waiter w[3]; 132 135 } 133 sout | "Waiters done" | endl;136 sout | "Waiters done"; 134 137 done = true; 135 138 } -
tests/concurrent/signal/disjoint.cfa
r7951100 rb067d9b 1 #include <fstream> 2 #include <kernel> 3 #include <monitor> 4 #include <thread> 5 #include <time> 1 #include <fstream.hfa> 2 #include <kernel.hfa> 3 #include <monitor.hfa> 4 #include <thread.hfa> 5 #include <time.hfa> 6 7 #include "long_tests.hfa" 6 8 7 9 #ifndef PREEMPTION_RATE … … 13 15 } 14 16 15 #ifdef LONG_TEST17 #ifdef TEST_LONG 16 18 static const unsigned long N = 300_000ul; 17 19 #else … … 64 66 wait( cond ); 65 67 if( d.state != SIGNAL ) { 66 sout | "ERROR barging!" | endl;68 sout | "ERROR barging!"; 67 69 } 68 70 69 d.counter++; 71 #if !defined(TEST_FOREVER) 72 d.counter++; 73 if( (d.counter % 1000) == 0 ) sout | d.counter; 74 #endif 70 75 71 if( (d.counter % 1000) == 0 ) sout | d.counter | endl; 72 73 return d.counter < N; 76 return TEST(d.counter < N); 74 77 } 75 78 … … 77 80 78 81 void main( Waiter & this ) { 79 while( wait( mut, data ) ) { yield(); }82 while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); } 80 83 } 81 84 … … 94 97 95 98 //This is technically a mutual exclusion violation but the mutex monitor protects us 96 bool running = data.counter < N&& data.counter > 0;99 bool running = TEST(data.counter < N) && data.counter > 0; 97 100 if( data.state != SIGNAL && running ) { 98 sout | "ERROR Eager signal" | data.state | endl;101 sout | "ERROR Eager signal" | data.state; 99 102 } 100 103 } … … 121 124 Waiter w[4]; 122 125 } 123 sout | "All waiter done" | endl;126 sout | "All waiter done"; 124 127 all_done = true; 125 128 } -
tests/concurrent/signal/wait.cfa
r7951100 rb067d9b 5 5 6 6 7 #include <fstream> 8 #include <kernel> 9 #include <monitor> 10 #include <stdlib> 11 #include <thread> 12 #include <time> 7 #include <fstream.hfa> 8 #include <kernel.hfa> 9 #include <monitor.hfa> 10 #include <stdlib.hfa> 11 #include <thread.hfa> 12 #include <time.hfa> 13 14 #define __kick_rate 12000ul 15 #include "long_tests.hfa" 13 16 14 17 #ifndef PREEMPTION_RATE … … 20 23 } 21 24 22 #ifdef LONG_TEST25 #ifdef TEST_LONG 23 26 static const unsigned long N = 375_000ul; 24 27 #else … … 80 83 break; 81 84 default: 82 sout | "Something went wrong" | endl;85 sout | "Something went wrong"; 83 86 abort(); 84 87 } … … 90 93 // Waiter ABC 91 94 void main( WaiterABC & this ) { 92 for( int i = 0; i < N; i++ ) {95 for( int i = 0; TEST(i < N); i++ ) { 93 96 wait( condABC, globalA, globalB, globalC ); 97 KICK_WATCHDOG; 94 98 } 95 99 … … 100 104 // Waiter AB 101 105 void main( WaiterAB & this ) { 102 for( int i = 0; i < N; i++ ) {106 for( int i = 0; TEST(i < N); i++ ) { 103 107 wait( condAB , globalA, globalB ); 108 KICK_WATCHDOG; 104 109 } 105 110 … … 110 115 // Waiter AC 111 116 void main( WaiterAC & this ) { 112 for( int i = 0; i < N; i++ ) {117 for( int i = 0; TEST(i < N); i++ ) { 113 118 wait( condAC , globalA, globalC ); 119 KICK_WATCHDOG; 114 120 } 115 121 … … 120 126 // Waiter BC 121 127 void main( WaiterBC & this ) { 122 for( int i = 0; i < N; i++ ) {128 for( int i = 0; TEST(i < N); i++ ) { 123 129 wait( condBC , globalB, globalC ); 130 KICK_WATCHDOG; 124 131 } 125 132 … … 133 140 waiter_left = 4; 134 141 processor p[2]; 135 sout | "Starting" | endl;142 sout | "Starting"; 136 143 { 137 144 Signaler e; … … 143 150 } 144 151 } 145 sout | "Done" | endl;152 sout | "Done"; 146 153 } -
tests/concurrent/thread.cfa
r7951100 rb067d9b 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; }; … … 12 12 void main(First& this) { 13 13 for(int i = 0; i < 10; i++) { 14 sout | "First : Suspend No." | i + 1 | endl;14 sout | "First : Suspend No." | i + 1; 15 15 yield(); 16 16 } … … 21 21 P(*this.lock); 22 22 for(int i = 0; i < 10; i++) { 23 sout | "Second : Suspend No." | i + 1 | endl;23 sout | "Second : Suspend No." | i + 1; 24 24 yield(); 25 25 } … … 29 29 int main(int argc, char* argv[]) { 30 30 semaphore lock = { 0 }; 31 sout | "User main begin" | endl;31 sout | "User main begin"; 32 32 { 33 33 processor p; … … 37 37 } 38 38 } 39 sout | "User main end" | endl;39 sout | "User main end"; 40 40 } -
tests/concurrent/waitfor/barge.cfa
r7951100 rb067d9b 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> … … 48 48 yield(random( 10 )); 49 49 if( this.state != WAITFOR && !this.done && this.started ) { 50 serr | "Barging before caller detected" | endl;50 serr | "Barging before caller detected"; 51 51 } 52 52 … … 66 66 this.state = WAITFOR; 67 67 waitfor(do_call, this) { 68 sout | i | endl;68 sout | i; 69 69 } 70 70 71 71 if( this.state != CALL ) { 72 serr | "Barging after caller detected" | endl;72 serr | "Barging after caller detected"; 73 73 } 74 74 } … … 83 83 84 84 int main() { 85 sout | "Starting" | endl;85 sout | "Starting"; 86 86 { 87 87 barger_t bargers[17]; … … 89 89 waiter_t waiters; 90 90 } 91 sout | "Stopping" | endl;91 sout | "Stopping"; 92 92 } -
tests/concurrent/waitfor/dtor.cfa
r7951100 rb067d9b 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> … … 29 29 switch(state) { 30 30 case CTOR : break; 31 case MAIN : if( this.state != CTOR ) { serr | "ERROR Expected state to be CTOR" | endl; abort(); } this.state = state; break;32 case AFTER : if( this.state != MAIN ) { serr | "ERROR Expected state to be MAIN" | endl; abort(); } this.state = state; break;33 case END : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER" | endl; abort(); } this.state = state; break;34 case DTOR : if( this.state != END ) { serr | "ERROR Expected state to be END" | endl; abort(); } this.state = state; break;31 case MAIN : if( this.state != CTOR ) { serr | "ERROR Expected state to be CTOR" ; abort(); } this.state = state; break; 32 case AFTER : if( this.state != MAIN ) { serr | "ERROR Expected state to be MAIN" ; abort(); } this.state = state; break; 33 case END : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER"; abort(); } this.state = state; break; 34 case DTOR : if( this.state != END ) { serr | "ERROR Expected state to be END" ; abort(); } this.state = state; break; 35 35 } 36 36 } … … 54 54 55 55 int main() { 56 sout | "Starting" | endl;56 sout | "Starting"; 57 57 processor p; 58 58 for( int i = 0; i < N; i++ ){ … … 60 60 yield( random( 100 ) ); 61 61 } 62 sout | "Stopping" | endl;62 sout | "Stopping"; 63 63 } -
tests/concurrent/waitfor/else.cfa
r7951100 rb067d9b 1 #include <fstream >2 #include <monitor >1 #include <fstream.hfa> 2 #include <monitor.hfa> 3 3 4 4 #include <stdbool.h> … … 12 12 void test( M & mutex m ) { 13 13 int i = 0; 14 sout | "Starting" | endl;14 sout | "Starting"; 15 15 16 16 when( false ) waitfor( notcalled, m ); 17 17 18 sout | "Step" | i++ | endl;18 sout | "Step" | i++; 19 19 20 20 waitfor( notcalled, m ); or else { 21 sout | "else called" | endl;21 sout | "else called"; 22 22 } 23 23 24 sout | "Step" | i++ | endl;24 sout | "Step" | i++; 25 25 26 26 when( true ) waitfor( notcalled, m ); or when( true ) else { 27 sout | "else called" | endl;27 sout | "else called"; 28 28 } 29 29 30 sout | "Step" | i++ | endl;30 sout | "Step" | i++; 31 31 32 32 when( false ) waitfor( notcalled, m ); or when( true ) else { 33 sout | "else called" | endl;33 sout | "else called"; 34 34 } 35 35 36 sout | "Step" | i++ | endl;36 sout | "Step" | i++; 37 37 38 38 when( false ) waitfor( notcalled, m ); or when( false ) else { 39 sout | "else called" | endl;39 sout | "else called"; 40 40 } 41 41 42 sout | "Done" | endl;42 sout | "Done"; 43 43 } 44 44 -
tests/concurrent/waitfor/parse.cfa
r7951100 rb067d9b 8 8 //---------------------------------------------------------------------------------------- 9 9 10 #include <monitor >10 #include <monitor.hfa> 11 11 12 12 monitor M {}; -
tests/concurrent/waitfor/parse2.cfa
r7951100 rb067d9b 10 10 // Created On : Wed Aug 30 17:53:29 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 30 17:55:17 201713 // Update Count : 212 // Last Modified On : Fri Mar 22 13:42:11 2019 13 // Update Count : 3 14 14 // 15 15 … … 246 246 // Local Variables: // 247 247 // tab-width: 4 // 248 // compile-command: "cfa waitfor.c " //248 // compile-command: "cfa waitfor.cfa" // 249 249 // End: // -
tests/concurrent/waitfor/recurse.cfa
r7951100 rb067d9b 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> … … 95 95 rand_yield(); 96 96 97 sout | "1st" | endl;97 sout | "1st" | nl; 98 98 99 99 return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP; … … 123 123 case THIRD : while( !global.ready ) { yield(); } this.state = call3( global, this.idx ); break; 124 124 case LAST : while( !global.ready ) { yield(); } this.state = call4( global, this.idx ); break; 125 case STOP : serr | "This should not happen" | endl;125 case STOP : serr | "This should not happen" | nl; 126 126 } 127 127 } … … 132 132 int main() { 133 133 srandom( time(NULL) ); 134 sout | "Starting" | endl; 134 sout | nlOff; // turn off auto newline 135 sout | "Starting" | nl; 135 136 { 136 137 waiter_t waiters[4] = { … … 142 143 the_threads = waiters; 143 144 } 144 sout | "Stopping" | endl;145 sout | "Stopping" | nl; 145 146 } -
tests/concurrent/waitfor/simple.cfa
r7951100 rb067d9b 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> … … 31 31 32 32 void do_wait( global_t * mutex a ) { 33 sout | "Waiting to accept" | endl;33 sout | "Waiting to accept"; 34 34 yield( random( 10 ) ); 35 35 36 sout | "Accepting" | endl;36 sout | "Accepting"; 37 37 38 38 __acceptable_t acceptable; … … 43 43 __waitfor_internal( 1, &acceptable ); 44 44 45 sout | "Accepted" | endl;45 sout | "Accepted"; 46 46 yield( random( 10 ) ); 47 47 } … … 50 50 for( int i = 0; i < N; i++ ) { 51 51 do_wait( &globalA ); 52 sout | i | endl;52 sout | i; 53 53 } 54 54 … … 76 76 srandom( time( NULL ) ); 77 77 printf("%p\n", &globalA); 78 sout | "Starting" | endl;78 sout | "Starting"; 79 79 { 80 80 Acceptor r; … … 82 82 83 83 } 84 sout | "Done" | endl;84 sout | "Done"; 85 85 } -
tests/concurrent/waitfor/statment.cfa
r7951100 rb067d9b 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> … … 84 84 case 7: return call7( m ); 85 85 default : 86 serr | "Incorrect index" | index | endl;86 serr | "Incorrect index" | index; 87 87 abort(); 88 88 } … … 102 102 while( !done ) { 103 103 waitfor( get_index, this ); 104 or waitfor( call1, this ) { sout | "Statement" | endl; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val | endl; } }105 or waitfor( call2, this ) { sout | "Statement" | endl; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val | endl; } }106 or waitfor( call3, this ) { sout | "Statement" | endl; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val | endl; } }107 or waitfor( call4, this ) { sout | "Statement" | endl; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val | endl; } }108 or waitfor( call5, this ) { sout | "Statement" | endl; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val | endl; } }109 or waitfor( call6, this ) { sout | "Statement" | endl; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val | endl; } }110 or waitfor( call7, this ) { sout | "Statement" | endl; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val | endl; } }104 or waitfor( call1, this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } } 105 or waitfor( call2, this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } } 106 or waitfor( call3, this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } } 107 or waitfor( call4, this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } } 108 or waitfor( call5, this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } } 109 or waitfor( call6, this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } } 110 or waitfor( call7, this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } } 111 111 112 112 done = true; … … 128 128 int main() { 129 129 processor p[2]; 130 sout | "Starting" | endl;130 sout | "Starting"; 131 131 { 132 132 caller c[7]; 133 133 waiter w; 134 134 } 135 sout | "Stopping" | endl;135 sout | "Stopping"; 136 136 } -
tests/concurrent/waitfor/when.cfa
r7951100 rb067d9b 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> … … 58 58 void arbiter( global_t & mutex this ) { 59 59 for( int i = 0; i < N; i++ ) { 60 when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call | endl; } }61 or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call | endl; } }62 or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call | endl; } }63 or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call | endl; } }64 or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call | endl; } }65 or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call | endl; } }60 when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } } 61 or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } } 62 or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } } 63 or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } } 64 or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } } 65 or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } } 66 66 67 sout | this.last_call | endl;67 sout | this.last_call; 68 68 } 69 69 … … 78 78 int main() { 79 79 srandom( time(NULL) ); 80 sout | "Starting" | endl;80 sout | "Starting"; 81 81 { 82 82 arbiter_t arbiter; … … 84 84 85 85 } 86 sout | "Stopping" | endl;86 sout | "Stopping"; 87 87 } -
tests/coroutine/.in/fmtLines.txt
r7951100 rb067d9b 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 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 18 11:35:57 201713 // Update Count : 3 114 // 12 // Last Modified On : Fri Mar 22 13:41:03 2019 13 // Update Count : 33 14 // 15 15 16 #include <fstream >17 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 18 18 19 19 coroutine Format { … … 27 27 28 28 void ^?{}( Format & fmt ) { 29 if ( fmt.g != 0 || fmt.b != 0 ) sout | endl;29 if ( fmt.g != 0 || fmt.b != 0 ) sout | nl; 30 30 } 31 31 … … 42 42 sout | " "; // print block separator 43 43 } // for 44 sout | endl; // print group separator44 sout | nl; // print group separator 45 45 } // for 46 46 } // main … … 64 64 // Local Variables: // 65 65 // tab-width: 4 // 66 // compile-command: "cfa fmtLines.c " //66 // compile-command: "cfa fmtLines.cfa" // 67 67 // End: // -
tests/coroutine/fibonacci.cfa
r7951100 rb067d9b 6 6 // 7 7 // fibonacci.c -- 3-state finite-state machine 8 9 8 // 10 9 // Author : Thierry Delisle 11 10 // Created On : Thu Jun 8 07:29:37 2017 12 11 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Apr 27 08:55:31 201814 // Update Count : 1912 // Last Modified On : Fri Mar 22 13:40:35 2019 13 // Update Count : 26 15 14 // 16 15 17 #include <fstream >18 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 19 18 20 19 coroutine Fibonacci { int fn; }; // used for communication … … 26 25 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 27 26 suspend(); // restart last resume 28 for ( ;;) {27 for () { 29 28 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 30 29 suspend(); // restart last resume … … 39 38 int main() { 40 39 Fibonacci f1, f2; 41 for ( int i = 1; i <= 10; i += 1 ) {42 sout | next( f1 ) | next( f2 ) | endl;40 for ( 10 ) { // print N Fibonacci values 41 sout | next( f1 ) | next( f2 ); 43 42 } // for 44 43 } … … 46 45 // Local Variables: // 47 46 // tab-width: 4 // 48 // compile-command: "cfa fibonacci.c " //47 // compile-command: "cfa fibonacci.cfa" // 49 48 // End: // -
tests/coroutine/fmtLines.cfa
r7951100 rb067d9b 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 // 6 // 7 7 // fmtLines.cc -- format characters into blocks of 4 and groups of 5 blocks per line 8 // 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sun Sep 17 21:56:15 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 15 12:25:33 201813 // Update Count : 4214 // 12 // Last Modified On : Fri Mar 22 13:41:16 2019 13 // Update Count : 58 14 // 15 15 16 #include <fstream >17 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 18 18 19 19 coroutine Format { … … 23 23 24 24 void main( Format & fmt ) with( fmt ) { 25 for ( ;; ) {// for as many characters25 for () { // for as many characters 26 26 for ( g = 0; g < 5; g += 1 ) { // groups of 5 blocks 27 27 for ( b = 0; b < 4; b += 1 ) { // blocks of 4 characters 28 for ( ;; ) {// for newline characters28 for () { // for newline characters 29 29 suspend(); 30 if ( ch != '\n' ) break;// ignore newline30 if ( ch != '\n' ) break; // ignore newline 31 31 } // for 32 32 sout | ch; // print character … … 34 34 sout | " "; // print block separator 35 35 } // for 36 sout | endl;// print group separator36 sout | nl; // print group separator 37 37 } // for 38 38 } // main … … 43 43 44 44 void ^?{}( Format & fmt ) with( fmt ) { 45 if ( g != 0 || b != 0 ) sout | endl;45 if ( g != 0 || b != 0 ) sout | nl; 46 46 } 47 47 48 48 void format( Format & fmt ) { 49 49 resume( fmt ); 50 } // prt50 } // format 51 51 52 52 int main() { 53 53 Format fmt; 54 sout | nlOff; // turn off auto newline 54 55 55 eof: for ( ;; ) {// read until end of file56 eof: for () { // read until end of file 56 57 sin | fmt.ch; // read one character 57 58 if ( eof( sin ) ) break eof; // eof ? … … 62 63 // Local Variables: // 63 64 // tab-width: 4 // 64 // compile-command: "cfa fmtLines.c " //65 // compile-command: "cfa fmtLines.cfa" // 65 66 // End: // -
tests/coroutine/pingpong.cfa
r7951100 rb067d9b 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 : 2614 // 12 // Last Modified On : Tue Mar 26 17:54:14 2019 13 // Update Count : 35 14 // 15 15 16 #include <coroutine >17 #include <fstream >16 #include <coroutine.hfa> 17 #include <fstream.hfa> 18 18 19 19 coroutine PingPong { 20 20 const char * name; 21 21 /* const */ unsigned int N; 22 PingPong *part;22 PingPong & part; 23 23 }; 24 24 25 25 void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) { 26 this.name = name; 27 this.N = N; 28 this.part = ∂ 26 this.[name, N] = [name, N]; &this.part = ∂ 29 27 } 30 28 void ?{}( PingPong & this, const char * name, unsigned int N ) { 31 this{ name, N, * (PingPong *)0 };29 this{ name, N, *0p }; // call first constructor 32 30 } 33 31 void cycle( PingPong & pingpong ) { … … 35 33 } 36 34 void partner( PingPong & this, PingPong & part ) { 37 this.part = ∂35 &this.part = ∂ 38 36 resume( this ); 39 37 } 40 void main( PingPong & pingpong ) {// ping's starter ::main, pong's starter ping41 for ( unsigned int i = 0; i < pingpong.N; i += 1 ) {42 sout | pingpong.name | endl;43 cycle( *pingpong.part );38 void main( PingPong & pingpong ) with(pingpong) { // ping's starter ::main, pong's starter ping 39 for ( N ) { // N ping-pongs 40 sout | name; 41 cycle( part ); 44 42 } // for 45 43 } … … 52 50 // Local Variables: // 53 51 // tab-width: 4 // 54 // compile-command: "cfa pingpong.c " //52 // compile-command: "cfa pingpong.cfa" // 55 53 // End: // -
tests/coroutine/prodcons.cfa
r7951100 rb067d9b 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 : Tue Jan 2 12:17:01 201813 // Update Count : 4714 // 12 // Last Modified On : Fri Mar 22 13:41:10 2019 13 // Update Count : 54 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 29 void main( Prod & prod ) with( prod ) { // starter ::main 30 30 // 1st resume starts here 31 for ( int i = 0; i < N; i += 1 ) { 32 int p1 = random( 100 ); 33 int p2 = random( 100 ); 34 sout | p1 | " " | p2 | endl; 35 int status = delivery( *c, p1, p2 ); 36 sout | " $" | money | endl; 37 sout | status | endl; 31 for ( i; N ) { // N pairs of values 32 int p1 = random( 100 ), p2 = random( 100 ); 33 sout | p1 | " " | p2; 34 int status = delivery( c, p1, p2 ); 35 sout | " $" | money | nl | status; 38 36 receipt += 1; 39 37 } 40 stop( *c );41 sout | "prod stops" | endl;38 stop( c ); 39 sout | "prod stops"; 42 40 } 43 41 int payment( Prod & prod, int money ) { … … 47 45 } 48 46 void start( Prod & prod, int N, Cons &c ) { 49 prod.N = N; 50 prod.c = &c; 51 prod.receipt = 0; 47 &prod.c = &c; 48 prod.[N, receipt] = [N, 0]; 52 49 resume( prod ); // activate main 53 50 } 54 51 55 52 coroutine Cons { 56 Prod *p;53 Prod & p; 57 54 int p1, p2, status; 58 55 bool done; 59 56 }; 60 57 void ?{}( Cons & cons, Prod & p ) { 61 cons.p = &p; 62 cons.status = 0; 63 cons.done = false; 58 &cons.p = &p; 59 cons.[status, done ] = [0, false]; 64 60 } 65 61 void ^?{}( Cons & cons ) {} … … 68 64 int money = 1, receipt; 69 65 for ( ; ! done; ) { 70 sout | p1 | " " | p2 | endl; 71 sout | " $" | money | endl; 66 sout | p1 | " " | p2 | nl | " $" | money; 72 67 status += 1; 73 receipt = payment( *p, money );74 sout | " #" | receipt | endl;68 receipt = payment( p, money ); 69 sout | " #" | receipt; 75 70 money += 1; 76 71 } 77 sout | "cons stops" | endl;72 sout | "cons stops"; 78 73 } 79 74 int delivery( Cons & cons, int p1, int p2 ) { 80 cons.p1 = p1; 81 cons.p2 = p2; 75 cons.[p1, p2] = [p1, p2]; 82 76 resume( cons ); // main 1st time, then 83 77 return cons.status; // cons in payment … … 92 86 srandom( /* getpid() */ 103 ); // fixed seed for testing 93 87 start( prod, 5, cons ); 94 sout | "main stops" | endl;88 sout | "main stops"; 95 89 } 96 90 97 91 // Local Variables: // 98 92 // tab-width: 4 // 99 // compile-command: "cfa prodcons.c " //93 // compile-command: "cfa prodcons.cfa" // 100 94 // End: // -
tests/coroutine/runningTotal.cfa
r7951100 rb067d9b 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 // runningTotal.c -- 8 // 6 // 7 // runningTotal.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Dec 6 08:05:27 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 6 08:09:24 201713 // Update Count : 214 // 12 // Last Modified On : Fri Mar 22 13:40:49 2019 13 // Update Count : 5 14 // 15 15 16 #include <fstream >17 #include <coroutine >16 #include <fstream.hfa> 17 #include <coroutine.hfa> 18 18 19 19 coroutine RunTotal { // input numbers and return running total … … 29 29 30 30 void main( RunTotal & rntl ) with( rntl ) { 31 for ( ;;) {31 for () { 32 32 update( rntl, input ); 33 33 } // for … … 41 41 int main() { 42 42 RunTotal rntl; 43 for ( i nt i = 0; i < 10; i += 1) {44 sout | i | add( rntl, i ) | endl;43 for ( i; 10 ) { 44 sout | i | add( rntl, i ); 45 45 } // for 46 46 } … … 48 48 // Local Variables: // 49 49 // tab-width: 4 // 50 // compile-command: "cfa runningTotal.c " //50 // compile-command: "cfa runningTotal.cfa" // 51 51 // End: // -
tests/counter.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // counter.c --7 // counter.cfa -- 8 8 // 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Feb 22 15:27:00 2018 11 // Last Modified By : Aaron B. Moss12 // Last Modified On : T hu Feb 22 15:27:00201813 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 6 17:50:23 2018 13 // Update Count : 2 14 14 // 15 15 … … 37 37 // Local Variables: // 38 38 // tab-width: 4 // 39 // compile-command: "cfa counter.c " //39 // compile-command: "cfa counter.cfa" // 40 40 // End: // -
tests/declarationErrors.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // declarationErrors.c --7 // declarationErrors.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:23:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 9 22:57:52 201613 // Update Count : 3 112 // Last Modified On : Tue Nov 6 17:52:47 2018 13 // Update Count : 32 14 14 // 15 15 … … 42 42 // Local Variables: // 43 43 // tab-width: 4 // 44 // compile-command: "cfa declarationErrors.c " //44 // compile-command: "cfa declarationErrors.cfa" // 45 45 // End: // -
tests/declarationSpecifier.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // declarationSpecifier.c --7 // declarationSpecifier.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:21:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:24:33 201613 // Update Count : 212 // Last Modified On : Tue Apr 30 18:20:36 2019 13 // Update Count : 4 14 14 // 15 15 … … 89 89 90 90 //Dummy main 91 int main(int argc, char const *argv[]) 92 { 93 return 0; 94 } 91 int main( int argc, char const * argv[] ) {} 95 92 96 93 // Local Variables: // 97 94 // tab-width: 4 // 98 // compile-command: "cfa declarationSpecifier.c " //95 // compile-command: "cfa declarationSpecifier.cfa" // 99 96 // End: // -
tests/div.cfa
r7951100 rb067d9b 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.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Aug 8 16:28:43 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Dec 7 09:06:52 201713 // Update Count : 1814 // 12 // Last Modified On : Tue Dec 4 21:35:01 2018 13 // Update Count : 20 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; }; … … 23 23 24 24 int main( void ) { 25 sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ) | endl;25 sout | "div" | div( 13, 5 ) | div( 13L, 5L ) | div( 13LL, 5LL ); 26 26 short s1 = 13, s2 = 5; 27 sout | "div" | div( s1, s2 ) | endl;27 sout | "div" | div( s1, s2 ); 28 28 T t1 = { 13 }, t2 = { 5 }; 29 sout | "div" | div( t1, t2 ) | endl;// polymorphic div29 sout | "div" | div( t1, t2 ); // polymorphic div 30 30 } // main 31 31 32 32 // Local Variables: // 33 33 // tab-width: 4 // 34 // compile-command: "cfa div.c " //34 // compile-command: "cfa div.cfa" // 35 35 // End: // -
tests/except-0.cfa
r7951100 rb067d9b 8 8 #include <stdbool.h> 9 9 10 #include "except-mac.h "10 #include "except-mac.hfa" 11 11 TRIVIAL_EXCEPTION(yin) 12 12 TRIVIAL_EXCEPTION(yang) … … 25 25 void ^?{}(signal_exit * this) { 26 26 printf("Exiting: %s\n", this->area); 27 // sout | "Exiting:" | this->area | endl;27 // sout | "Exiting:" | this->area; 28 28 } 29 29 -
tests/except-1.cfa
r7951100 rb067d9b 5 5 #include <stdio.h> 6 6 7 #include "except-mac.h "7 #include "except-mac.hfa" 8 8 TRIVIAL_EXCEPTION(yin) 9 9 TRIVIAL_EXCEPTION(yang) -
tests/except-2.cfa
r7951100 rb067d9b 2 2 3 3 4 #include <stdlib >5 #include "except-mac.h "4 #include <stdlib.hfa> 5 #include "except-mac.hfa" 6 6 7 7 TRIVIAL_EXCEPTION(yin) -
tests/except-3.cfa
r7951100 rb067d9b 2 2 3 3 #include <stdio.h> 4 #include "except-mac.h "4 #include "except-mac.hfa" 5 5 TRIVIAL_EXCEPTION(myth) 6 6 -
tests/extension.cfa
r7951100 rb067d9b 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 // extension.c --4 // extension.cfa -- 5 5 // 6 6 // Author : Peter A. Buhr 7 7 // Created On : Mon Jul 4 20:42:43 2016 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Mon Feb 6 15:44:39 201710 // Update Count : 4 69 // Last Modified On : Tue Nov 6 17:53:21 2018 10 // Update Count : 47 11 11 // 12 12 … … 56 56 // Local Variables: // 57 57 // tab-width: 4 // 58 // compile-command: "cfa extension.c " //58 // compile-command: "cfa extension.cfa" // 59 59 // End: // -
tests/fstream_test.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // fstream_test.c --7 // fstream_test.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 24 11:30:26 201713 // Update Count : 6 512 // Last Modified On : Sat Dec 22 09:47:44 2018 13 // Update Count : 68 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int main( void ) { 19 19 int nombre; 20 sout | "Entrez un nombre, s'il vous plaît:" | endl;20 sout | "Entrez un nombre, s'il vous plaît:"; 21 21 sin | nombre; 22 sout | "Vous avez entré" | nombre | endl;22 sout | "Vous avez entré" | nombre; 23 23 sout | "le nombre" | nombre | "est" 24 | (nombre > 0 ? "positif" : nombre == 0 ? "zéro" : "négatif") | endl;24 | (nombre > 0 ? "positif" : nombre == 0 ? "zéro" : "négatif"); 25 25 26 sout | "Entrez trois nombres, s'il vous plaît: " | endl;26 sout | "Entrez trois nombres, s'il vous plaît:"; 27 27 int i, j, k; 28 28 sin | i | j | k; 29 sout | "Vous avez entré" | "i:" | "" | i | "j:" | "" | j | "k:" | "" | k | endl;29 sout | "Vous avez entré" | "i:" | "" | i | "j:" | "" | j | "k:" | "" | k; 30 30 } 31 31 32 32 // Local Variables: // 33 33 // tab-width: 4 // 34 // compile-command: "cfa fstream_test.c " //34 // compile-command: "cfa fstream_test.cfa" // 35 35 // End: // -
tests/function-operator.cfa
r7951100 rb067d9b 10 10 // Created On : Fri Aug 25 15:21:11 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 7 12:42:26 201713 // Update Count : 612 // Last Modified On : Thu Apr 11 18:27:45 2019 13 // Update Count : 10 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])) … … 62 62 63 63 // test ?()(T, ...) -- ?() with function call-by-reference 64 forall(otype Generator, otype GenRet | { GenRet ?()(Generator &); }, dtype Iter, otype T | Iterator(Iter, T) | Assignable(T, GenRet))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 66 int i = 0; … … 83 83 // TODO: abstract over (os, T) 84 84 os_wrapper ?=?(os_wrapper & wrapper, int x) { 85 *wrapper.out | x | endl;85 *wrapper.out | x; 86 86 return wrapper; 87 87 } … … 92 92 void ?{}(ostream_iterator & iter, ofstream * out) { 93 93 iter.out = new(out); 94 }94 } 95 95 // no destructor, memory leak. This is necessary for this to work at the moment, since 96 96 // *? requires its parameter by value and returns a reference. … … 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.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // functions.c --7 // functions.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:39:58 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 17 22:44:12201813 // Update Count : 1 212 // Last Modified On : Tue Nov 6 17:54:09 2018 13 // Update Count : 13 14 14 // 15 15 … … 188 188 // Local Variables: // 189 189 // tab-width: 4 // 190 // compile-command: "cfa functions.c " //190 // compile-command: "cfa functions.cfa" // 191 191 // End: // -
tests/gccExtensions.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // gccExtensions.c --7 // gccExtensions.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sun Aug 14 17:28:17 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 09:26:50 201613 // Update Count : 1012 // Last Modified On : Mon Aug 5 18:04:37 2019 13 // Update Count : 28 14 14 // 15 15 … … 50 50 51 51 L1: L2: 52 asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5"53 : /* No outputs. */54 : "r"(src), "r"(&dst)55 : "r5", "memory"56 : L1, L2 );52 asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5" 53 : /* No outputs. */ 54 : "r"(src), "r"(&dst) 55 : "r5", "memory" 56 : L1, L2 ); 57 57 58 58 // alternative type/qualifer names … … 110 110 struct __attribute(()) s4 { int i; } x2, y2 __attribute(()); 111 111 112 int m1 [10] __attribute(());113 int m2 [10][10] __attribute(());112 int m1[10] __attribute(()); 113 int m2[10][10] __attribute(()); 114 114 int __attribute(()) m3 [10][10]; 115 115 // int ( __attribute(()) m4 [10] )[10]; 116 116 117 return 0; 117 // int128 118 119 #if defined( __SIZEOF_INT128__ ) 120 void f128( __int128 i ); 121 void f128( __uint128_t ); 122 123 __int128 i128_0; 124 f128( i128_0 ); 125 unsigned __int128 i128_1; 126 f128( i128_1 ); 127 __int128_t i128_2; 128 f128( i128_2 ); 129 __uint128_t i128_3; 130 f128( i128_3 ); 131 #endif 118 132 } 119 133 120 134 // Local Variables: // 121 135 // tab-width: 4 // 122 // compile-command: "cfa gccExtensions.c " //136 // compile-command: "cfa gccExtensions.cfa" // 123 137 // End: // -
tests/identFuncDeclarator.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // identFuncDeclarator.c --7 // identFuncDeclarator.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:36:34 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 17 22:39:13 201813 // Update Count : 212 // Last Modified On : Tue Nov 6 17:56:33 2018 13 // Update Count : 3 14 14 // 15 15 … … 115 115 // Local Variables: // 116 116 // tab-width: 4 // 117 // compile-command: "cfa identFuncDeclarator.c " //117 // compile-command: "cfa identFuncDeclarator.cfa" // 118 118 // End: // -
tests/identParamDeclarator.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // identParamDeclarator.c --7 // identParamDeclarator.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:37:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 17 22:36:11201813 // Update Count : 212 // Last Modified On : Tue Nov 6 17:56:44 2018 13 // Update Count : 3 14 14 // 15 15 … … 163 163 // Local Variables: // 164 164 // tab-width: 4 // 165 // compile-command: "cfa identParamDeclarator.c " //165 // compile-command: "cfa identParamDeclarator.cfa" // 166 166 // End: // -
tests/ifwhileCtl.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ifwhileCtl.c --7 // ifwhileCtl.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Aug 26 10:13:11 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 6 17:15:09201813 // Update Count : 2 112 // Last Modified On : Tue Dec 4 21:39:18 2018 13 // Update Count : 23 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int f( int r ) { return r; } … … 22 22 23 23 if ( int x = 1 ) { 24 sout | "x != 0 correct" | endl;24 sout | "x != 0 correct"; 25 25 } else { 26 sout | "x == 0 incorrect" | endl;26 sout | "x == 0 incorrect"; 27 27 } // if 28 28 29 29 if ( int x = 4, y = 0 ) { 30 sout | "x != 0 && y != 0 incorrect" | endl;30 sout | "x != 0 && y != 0 incorrect"; 31 31 } else if ( int x = 4, y = 1 ) { 32 sout | "x != 0 && y != 0 correct" | endl;32 sout | "x != 0 && y != 0 correct"; 33 33 } else { 34 sout | "x == 0 || y == 0 incorrect" | endl;34 sout | "x == 0 || y == 0 incorrect"; 35 35 } // if 36 36 37 37 if ( int x = 5, y = f( x ); x == y ) { 38 sout | "x == y correct" | endl;38 sout | "x == y correct"; 39 39 } else { 40 sout | "x != y incorrect" | endl;40 sout | "x != y incorrect"; 41 41 } // if 42 42 43 43 if ( struct S { int i; } s = { 3 }; s.i < 4 ) { 44 44 S s1; 45 sout | "s.i < 4 correct" | endl;45 sout | "s.i < 4 correct"; 46 46 } else { 47 47 S s1; 48 sout | "s.i >= 4 incorrect" | endl;48 sout | "s.i >= 4 incorrect"; 49 49 } // if 50 50 51 51 while ( int x = 1 ) { 52 sout | "x != 0 correct" | endl;52 sout | "x != 0 correct"; 53 53 break; 54 54 } // while 55 55 56 56 while ( int x = 4, y = 0 ) { 57 sout | "x != 0 && y != 0 incorrect" | endl;57 sout | "x != 0 && y != 0 incorrect"; 58 58 } // while 59 59 60 60 while ( int x = 5, y = f( x ); x == y ) { 61 sout | "x == y correct" | endl;61 sout | "x == y correct"; 62 62 break; 63 63 } // while … … 65 65 while ( struct S { int i; } s = { 3 }; s.i < 4 ) { 66 66 S s1; 67 sout | "s.i < 4 correct" | endl;67 sout | "s.i < 4 correct"; 68 68 break; 69 69 } // while … … 72 72 // Local Variables: // 73 73 // tab-width: 4 // 74 // compile-command: "cfa ifwhileCtl.c " //74 // compile-command: "cfa ifwhileCtl.cfa" // 75 75 // End: // -
tests/labelledExit.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // labelledExit.c --7 // labelledExit.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 10 07:29:39 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 10 07:30:15 201613 // Update Count : 112 // Last Modified On : Fri Oct 25 17:41:51 2019 13 // Update Count : 7 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 } … … 136 136 } 137 137 138 // all nested control options, labelled exits 139 140 Comp: { 141 Try: try { 142 For: for ( ;; ) { 143 While: while ( true ) { 144 Do: do { 145 If: if ( true ) { 146 Switch2: switch ( 3 ) { 147 case 3: 148 break Try; 149 break Comp; 150 break For; continue For; 151 break While; continue While; 152 break Do; continue Do; 153 break If; 154 break Switch2; 155 } // switch 156 } // if 157 } while ( true ); 158 } // while 159 } // for 160 } finally {} // always executed 161 } // compound 162 138 163 // computed goto 139 164 // { … … 159 184 // Local Variables: // 160 185 // tab-width: 4 // 161 // compile-command: "cfa labelledExit.c " //186 // compile-command: "cfa labelledExit.cfa" // 162 187 // End: // -
tests/limits.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // limits.c --7 // limits.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue May 10 20:44:20 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 1 16:21:55 201813 // Update Count : 712 // Last Modified On : Tue Nov 6 17:57:55 2018 13 // Update Count : 8 14 14 // 15 15 16 #include <limits >16 #include <limits.hfa> 17 17 18 18 // Integral Constants … … 153 153 // Local Variables: // 154 154 // tab-width: 4 // 155 // compile-command: "cfa limits.c " //155 // compile-command: "cfa limits.cfa" // 156 156 // End: // -
tests/literals.cfa
r7951100 rb067d9b 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.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 9 16:34:38 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Mar 4 10:41:31 2018 13 // Update Count : 134 14 // 15 12 // Last Modified On : Tue Feb 12 08:07:39 2019 13 // Update Count : 224 14 // 15 16 #include <features.h> // __GNUC_PREREQ 16 17 #ifdef __CFA__ 17 #include <stdint.h> 18 #include <fstream> 19 20 void f( char v ) { sout | "char " | v | endl; } 21 void f( signed char v ) { sout | "signed char " | v | endl; } 22 void f( unsigned char v ) { sout | "unsigned char " | v | endl; } 23 void f( signed short v ) { sout | "signed short int" | v | endl; } 24 void f( unsigned short v ) { sout | "unsigned short int" | v | endl; } 25 void f( size_t v ) { sout | "size_t" | v | endl; } 18 #include <fstream.hfa> 19 20 void f( char v ) { sout | "char " | v; } 21 void f( signed char v ) { sout | "signed char " | v; } 22 void f( unsigned char v ) { sout | "unsigned char " | v; } 23 void f( signed short v ) { sout | "signed short int" | v; } 24 void f( unsigned short v ) { sout | "unsigned short int" | v; } 25 void f( size_t v ) { sout | "size_t" | v; } 26 26 #endif // __CFA__ 27 27 … … 151 151 -0X0123456789.0123456789P-09; -0X0123456789.0123456789P-09f; -0X0123456789.0123456789P-09l; -0X0123456789.0123456789P-09F; -0X0123456789.0123456789P-09L; 152 152 153 #if defined(__GNUC__) && __GNUC_PREREQ(7,0) // gcc version >= 7 154 // floating with length, gcc f16/f128x unsupported and no prelude code for any _FloatXXx, so they work by conversion to long double 155 156 /* 0123456789.f16; */ 0123456789.f32; 0123456789.f32x; 0123456789.f64; 0123456789.f64x; 0123456789.W; 0123456789.f128; 0123456789.q; /* 0123456789.f128x; */ 157 /* +0123456789.f16; */ +0123456789.f32; +0123456789.f32x; +0123456789.f64; +0123456789.f64x; +0123456789.w; +0123456789.f128; +0123456789.Q; /* +0123456789.f128x; */ 158 /* -0123456789.f16; */ -0123456789.f32; -0123456789.f32x; -0123456789.f64; -0123456789.f64x; -0123456789.W; -0123456789.f128; -0123456789.q; /* -0123456789.f128x; */ 159 160 /* 0123456789.e09F16; */ 0123456789.e09F32; 0123456789.e09F32x; 0123456789.e09F64; 0123456789.e09F64x; 0123456789.e09W; 0123456789.e09F128; 0123456789.e09q; /* .0123456789e09q; */ 161 /* +0123456789.e+09F16; */ +0123456789.e+09F32; +0123456789.e+09F32x; +0123456789.e+09F64; +0123456789.e+09F64x; +0123456789.e+09w; +0123456789.e+09F128; +0123456789.e+09Q; /* +.0123456789E+09Q; */ 162 /* -0123456789.e-09F16; */ -0123456789.e-09F32; -0123456789.e-09F32x; -0123456789.e-09F64; -0123456789.e-09F64x; -0123456789.e-09W; -0123456789.e-09F128; -0123456789.e-09q; /* -.0123456789E-09q; */ 163 164 /* .0123456789e09F16; */ .0123456789e09F32; .0123456789e09F32x; .0123456789e09F64; .0123456789e09F64x; .0123456789e09W; .0123456789e09F128; .0123456789e09q; /* .0123456789e09q; */ 165 /* +.0123456789e+09F16; */ +.0123456789e+09F32; +.0123456789e+09F32x; +.0123456789e+09F64; +.0123456789e+09F64x; +.0123456789e+09w; +.0123456789e+09F128; +.0123456789e+09Q; /* +.0123456789E+09Q; */ 166 /* -.0123456789e-09F16; */ -.0123456789e-09F32; -.0123456789e-09F32x; -.0123456789e-09F64; -.0123456789e-09F64x; -.0123456789e-09W; -.0123456789e-09F128; -.0123456789e-09q; /* -.0123456789E-09q; */ 167 168 /* 0123456789.0123456789F16; */ 0123456789.0123456789F32; 0123456789.0123456789F32x; 0123456789.0123456789F64; 0123456789.0123456789F64x; 0123456789.0123456789W; 0123456789.0123456789F128; 0123456789.0123456789q; /* 0123456789.0123456789q; */ 169 /* +0123456789.0123456789F16; */ +0123456789.0123456789F32; +0123456789.0123456789F32x; +0123456789.0123456789F64; +0123456789.0123456789F64x; +0123456789.0123456789w; +0123456789.0123456789F128; +0123456789.0123456789Q; /* +0123456789.0123456789Q; */ 170 /* -0123456789.0123456789F16; */ -0123456789.0123456789F32; -0123456789.0123456789F32x; -0123456789.0123456789F64; -0123456789.0123456789F64x; -0123456789.0123456789W; -0123456789.0123456789F128; -0123456789.0123456789q; /* -0123456789.0123456789q; */ 171 172 /* 0123456789.0123456789E09F16; */ 0123456789.0123456789E09F32; 0123456789.0123456789E09F32x; 0123456789.0123456789E09F64; 0123456789.0123456789E09F64x; 0123456789.0123456789E09W; 0123456789.0123456789E09F128; 0123456789.0123456789E09q; /* 0123456789.0123456789E09q; */ 173 /* +0123456789.0123456789E+09F16; */ +0123456789.0123456789E+09F32; +0123456789.0123456789E+09F32x; +0123456789.0123456789E+09F64; +0123456789.0123456789E+09F64x; +0123456789.0123456789E+09w; +0123456789.0123456789E+09F128; +0123456789.0123456789E+09Q; /* +0123456789.0123456789E+09Q; */ 174 /* -0123456789.0123456789E-09F16; */ -0123456789.0123456789E-09F32; -0123456789.0123456789E-09F32x; -0123456789.0123456789E-09F64; -0123456789.0123456789E-09F64x; -0123456789.0123456789E-09W; -0123456789.0123456789E-09F128; -0123456789.0123456789E-09q; /* -0123456789.0123456789E-09q; */ 175 176 /* 0x123456789.p09f16; */ 0x123456789.p09f32; 0x123456789.p09f32x; 0x123456789.p09f64; 0x123456789.p09f64x; 0x123456789.p09W; 0x123456789.p09f128; 0x123456789.p09q; /* 0x123456789.p09f128x; */ 177 /* +0x123456789.P+09f16; */ +0x123456789.P+09f32; +0x123456789.P+09f32x; +0x123456789.P+09f64; +0x123456789.P+09f64x; +0x123456789.P+09w; +0x123456789.P+09f128; +0x123456789.P+09Q; /* +0x123456789.P+09f128x; */ 178 /* -0x123456789.P-09f16; */ -0x123456789.P-09f32; -0x123456789.P-09f32x; -0x123456789.P-09f64; -0x123456789.P-09f64x; -0x123456789.P-09W; -0x123456789.P-09f128; -0x123456789.P-09q; /* -0x123456789.P-09f128x; */ 179 180 /* 0x123456789.p09F16; */ 0x123456789.p09F32; 0x123456789.p09F32x; 0x123456789.p09F64; 0x123456789.p09F64x; 0x123456789.p09W; 0x123456789.p09F128; 0x123456789.p09q; /* .0123456789p09q; */ 181 /* +0x123456789.p+09F16; */ +0x123456789.p+09F32; +0x123456789.p+09F32x; +0x123456789.p+09F64; +0x123456789.p+09F64x; +0x123456789.p+09w; +0x123456789.p+09F128; +0x123456789.p+09Q; /* +.0123456789p+09Q; */ 182 /* -0x123456789.p-09F16; */ -0x123456789.p-09F32; -0x123456789.p-09F32x; -0x123456789.p-09F64; -0x123456789.p-09F64x; -0x123456789.p-09W; -0x123456789.p-09F128; -0x123456789.p-09q; /* -.0123456789P-09q; */ 183 184 /* 0X.0123456789p09F16; */ 0X.0123456789p09F32; 0X.0123456789p09F32x; 0X.0123456789p09F64; 0X.0123456789p09F64x; 0X.0123456789p09W; 0X.0123456789p09F128; 0X.0123456789p09q; /* 0X.0123456789p09q; */ 185 /* +0X.0123456789p+09F16; */ +0X.0123456789p+09F32; +0X.0123456789p+09F32x; +0X.0123456789p+09F64; +0X.0123456789p+09F64x; +0X.0123456789p+09w; +0X.0123456789p+09F128; +0X.0123456789p+09Q; /* +0X.0123456789p+09Q; */ 186 /* -0X.0123456789p-09F16; */ -0X.0123456789p-09F32; -0X.0123456789p-09F32x; -0X.0123456789p-09F64; -0X.0123456789p-09F64x; -0X.0123456789p-09W; -0X.0123456789p-09F128; -0X.0123456789p-09q; /* -0X.0123456789P-09q; */ 187 188 /* 0x123456789.0123456789P09F16; */ 0x123456789.0123456789P09F32; 0x123456789.0123456789P09F32x; 0x123456789.0123456789P09F64; 0x123456789.0123456789P09F64x; 0x123456789.0123456789P09W; 0x123456789.0123456789P09F128; 0x123456789.0123456789P09q; /* 0x123456789.0123456789P09q; */ 189 /* +0x123456789.0123456789P+09F16; */ +0x123456789.0123456789P+09F32; +0x123456789.0123456789P+09F32x; +0x123456789.0123456789P+09F64; +0x123456789.0123456789P+09F64x; +0x123456789.0123456789P+09w; +0x123456789.0123456789P+09F128; +0x123456789.0123456789P+09Q; /* +0x123456789.0123456789P+09Q; */ 190 /* -0x123456789.0123456789p-09F16; */ -0x123456789.0123456789p-09F32; -0x123456789.0123456789p-09F32x; -0x123456789.0123456789p-09F64; -0x123456789.0123456789p-09F64x; -0x123456789.0123456789p-09W; -0x123456789.0123456789p-09F128; -0x123456789.0123456789p-09q; /* -0x123456789.0123456789p-09q; */ 191 192 /* 0x123456789.0123456789P09F16; */ 0x123456789.0123456789P09F32; 0x123456789.0123456789P09F32x; 0x123456789.0123456789P09F64; 0x123456789.0123456789P09F64x; 0x123456789.0123456789P09W; 0x123456789.0123456789P09F128; 0x123456789.0123456789P09q; /* 0x123456789.0123456789P09q; */ 193 /* +0x123456789.0123456789p+09F16; */ +0x123456789.0123456789p+09F32; +0x123456789.0123456789p+09F32x; +0x123456789.0123456789p+09F64; +0x123456789.0123456789p+09F64x; +0x123456789.0123456789p+09w; +0x123456789.0123456789p+09F128; +0x123456789.0123456789p+09Q; /* +0x123456789.0123456789p+09Q; */ 194 /* -0x123456789.0123456789P-09F16; */ -0x123456789.0123456789P-09F32; -0x123456789.0123456789P-09F32x; -0x123456789.0123456789P-09F64; -0x123456789.0123456789P-09F64x; -0x123456789.0123456789P-09W; -0x123456789.0123456789P-09F128; -0x123456789.0123456789P-09q; /* -0x123456789.0123456789P-09q; */ 195 #endif // __GNUC_PREREQ(7,0) 196 153 197 #ifdef __CFA__ 154 198 // fixed-size length 155 199 156 200 // binary 157 0b01101011_l8; 0b01101011_l16; 0b01101011_l32; 0b01101011_l64; 0b01101011_l128; 0b01101011_l8u; 0b01101011_ul16; 0b01101011_l32u; 0b01101011_ul64; 0b01101011_ul128; 158 +0b01101011_l8; +0b01101011_l16; +0b01101011_l32; +0b01101011_l64; +0b01101011_l128; +0b01101011_l8u; +0b01101011_ul16; +0b01101011_l32u; +0b01101011_ul64; +0b01101011_ul128; 159 -0b01101011_l8; -0b01101011_l16; -0b01101011_l32; -0b01101011_l64; -0b01101011_l128; -0b01101011_l8u; -0b01101011_ul16; -0b01101011_l32u; -0b01101011_ul64; -0b01101011_ul128; 201 0b01101011_l8; 0b01101011_l16; 0b01101011_l32; 0b01101011_l64; 0b01101011_l8u; 0b01101011_ul16; 0b01101011_l32u; 0b01101011_ul64; 202 +0b01101011_l8; +0b01101011_l16; +0b01101011_l32; +0b01101011_l64; +0b01101011_l8u; +0b01101011_ul16; +0b01101011_l32u; +0b01101011_ul64; 203 -0b01101011_l8; -0b01101011_l16; -0b01101011_l32; -0b01101011_l64; -0b01101011_l8u; -0b01101011_ul16; -0b01101011_l32u; -0b01101011_ul64; 204 205 #ifdef __LP64__ // 64-bit processor 206 0b01101011_l128; 0b01101011_ul128; 207 +0b01101011_l128; +0b01101011_ul128; 208 -0b01101011_l128; -0b01101011_ul128; 209 #endif // __LP64__ 160 210 161 211 // octal 162 01234567_l8; 01234567_l16; 01234567_l32; 01234567_l64; 01234567_l128; 01234567_l8u; 01234567_ul16; 01234567_l32u; 01234567_ul64; 01234567_ul128; 163 +01234567_l8; +01234567_l16; +01234567_l32; +01234567_l64; +01234567_l128; +01234567_l8u; +01234567_ul16; +01234567_l32u; +01234567_ul64; +01234567_ul128; 164 -01234567_l8; -01234567_l16; -01234567_l32; -01234567_l64; -01234567_l128; -01234567_l8u; -01234567_ul16; -01234567_l32u; -01234567_ul64; -01234567_ul128; 212 01234567_l8; 01234567_l16; 01234567_l32; 01234567_l64; 01234567_l8u; 01234567_ul16; 01234567_l32u; 01234567_ul64; 213 +01234567_l8; +01234567_l16; +01234567_l32; +01234567_l64; +01234567_ul8; +01234567_ul16; +01234567_l32u; +01234567_ul64; 214 -01234567_l8; -01234567_l16; -01234567_l32; -01234567_l64; -01234567_l8u; -01234567_ul16; -01234567_l32u; -01234567_ul64; 215 216 #ifdef __LP64__ // 64-bit processor 217 01234567_l128; 01234567_ul128; 218 +01234567_l128; +01234567_ul128; 219 -01234567_l128; -01234567_ul128; 220 #endif // __LP64__ 165 221 166 222 // decimal 167 1234567890L8; 1234567890L16; 1234567890l32; 1234567890l64; 1234567890l128; 1234567890UL8; 1234567890L16U; 1234567890Ul32; 1234567890l64u; 1234567890l128u; 168 +1234567890L8; +1234567890L16; +1234567890l32; +1234567890l64; +1234567890l128; +1234567890UL8; +1234567890L16U; +1234567890Ul32; +1234567890l64u; +1234567890l128u; 169 -1234567890L8; -1234567890L16; -1234567890l32; -1234567890l64; -1234567890l128; -1234567890UL8; -1234567890L16U; -1234567890Ul32; -1234567890l64u; -1234567890l128u; 223 1234567890L8; 1234567890L16; 1234567890l32; 1234567890l64; 1234567890UL8; 1234567890L16U; 1234567890Ul32; 1234567890l64u; 224 +1234567890L8; +1234567890L16; +1234567890l32; +1234567890l64; +1234567890UL8; +1234567890L16U; +1234567890Ul32; +1234567890l64u; 225 -1234567890L8; -1234567890L16; -1234567890l32; -1234567890l64; -1234567890UL8; -1234567890L16U; -1234567890Ul32; -1234567890l64u; 226 227 #ifdef __LP64__ // 64-bit processor 228 1234567890l128; 1234567890l128u; 229 +1234567890l128; +1234567890l128u; 230 -1234567890l128; -1234567890l128u; 231 #endif // __LP64__ 170 232 171 233 // hexadecimal … … 185 247 +0X0123456789ABCDEF_l8; +0X0123456789ABCDEF_l16; +0X0123456789ABCDEFl32; +0X0123456789ABCDEFl64; +0X0123456789ABCDEF_ul8; +0X0123456789ABCDEF_l16u; +0X0123456789ABCDEFul32; +0X0123456789ABCDEFl64u; 186 248 -0X0123456789ABCDEF_l8; -0X0123456789ABCDEF_l16; -0X0123456789ABCDEFl32; -0X0123456789ABCDEFl64; -0X0123456789ABCDEF_ul8; -0X0123456789ABCDEF_l16u; -0X0123456789ABCDEFul32; -0X0123456789ABCDEFl64u; 187 188 // floating189 0123456789.l32; 0123456789.l64; 0123456789.l80; 0123456789.l128;190 +0123456789.l32; +0123456789.l64; +0123456789.l80; +0123456789.l128;191 -0123456789.l32; -0123456789.l64; -0123456789.l80; -0123456789.l128;192 193 0123456789.e09L32; 0123456789.e09L64; 0123456789.e09L80; 0123456789.e09L128;194 +0123456789.e+09L32; +0123456789.e+09L64; +0123456789.e+09L80; +0123456789.e+09L128;195 -0123456789.e-09L32; -0123456789.e-09L64; -0123456789.e-09L80; -0123456789.e-09L128;196 197 .0123456789e09L32; .0123456789e09L64; .0123456789e09L80; .0123456789e09L128;198 +.0123456789E+09L32; +.0123456789E+09L64; +.0123456789E+09L80; +.0123456789E+09L128;199 -.0123456789E-09L32; -.0123456789E-09L64; -.0123456789E-09L80; -.0123456789E-09L128;200 201 0123456789.0123456789L32; 0123456789.0123456789L64; 0123456789.0123456789L80; 0123456789.0123456789L128;202 +0123456789.0123456789E09L32; +0123456789.0123456789E09L64; +0123456789.0123456789E09L80; +0123456789.0123456789E09L128;203 -0123456789.0123456789E+09L32; -0123456789.0123456789E+09L64; -0123456789.0123456789E+09L80; -0123456789.0123456789E+09L128;204 0123456789.0123456789E-09L32; 0123456789.0123456789E-09L64; 0123456789.0123456789E-09L80; 0123456789.0123456789E-09L128;205 206 0x0123456789.p09l32; 0x0123456789.p09l64; 0x0123456789.p09l80; 0x0123456789.p09l128;207 +0x0123456789.p09l32; +0x0123456789.p09l64; +0x0123456789.p09l80; +0x0123456789.p09l128;208 -0x0123456789.p09l32; -0x0123456789.p09l64; -0x0123456789.p09l80; -0x0123456789.p09l128;209 210 0x0123456789.p+09l32; 0x0123456789.p+09L64; 0x0123456789.p+09L80; 0x0123456789.p+09L128;211 +0x0123456789.p-09l32; +0x0123456789.p-09L64; +0x0123456789.p-09L80; +0x0123456789.p-09L128;212 -0x.0123456789p09l32; -0x.0123456789p09L64; -0x.0123456789p09L80; -0x.0123456789p09L128;213 249 214 250 // char, short, int suffix overloading … … 306 342 // Local Variables: // 307 343 // tab-width: 4 // 308 // compile-command: "cfa literals.c " //344 // compile-command: "cfa literals.cfa" // 309 345 // End: // -
tests/math4.cfa
r7951100 rb067d9b 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 // math4.c --8 // 6 // 7 // math4.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu May 24 20:56:54 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu May 24 20:58:06201813 // Update Count : 214 // 12 // Last Modified On : Tue Dec 4 18:15:01 2018 13 // Update Count : 4 14 // 15 15 16 #include <fstream >17 #include <math >16 #include <fstream.hfa> 17 #include <math.hfa> 18 18 19 19 int main( void ) { … … 24 24 //---------------------- Nearest Integer ---------------------- 25 25 26 sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L ) | endl;27 sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L ) | endl;28 sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L ) | endl;29 sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L ) | endl;30 sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L ) | endl;31 sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L ) | endl;32 sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L ) | endl;33 sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L ) | endl;34 sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L ) | endl;35 sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L ) | endl;36 sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L ) | endl;37 sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L ) | endl;38 sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L ) | endl;39 sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L ) | endl;26 sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L ); 27 sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L ); 28 sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L ); 29 sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L ); 30 sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L ); 31 sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L ); 32 sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L ); 33 sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L ); 34 sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L ); 35 sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L ); 36 sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L ); 37 sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L ); 38 sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L ); 39 sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L ); 40 40 41 41 //---------------------- Manipulation ---------------------- 42 42 43 sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L ) | endl;43 sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L ); 44 44 int exp; 45 45 f = frexp( 4.0F, &exp ); 46 sout | "frexp:" | f | exp ;46 sout | "frexp:" | f | exp | nonl; 47 47 d = frexp( 4.0D, &exp ); 48 sout | d | exp ;48 sout | d | exp | nonl; 49 49 l = frexp( 4.0L, &exp ); 50 sout | l | exp | endl;51 sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 ) | endl;50 sout | l | exp; 51 sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 ); 52 52 float fi; 53 53 double di; 54 54 long double ldi; 55 55 f = modf( 2.3F, &fi ); 56 sout | "modf:" | fi | f ;56 sout | "modf:" | fi | f | nonl; 57 57 d = modf( 2.3D, &di ); 58 sout | di | d ;58 sout | di | d | nonl; 59 59 l = modf( 2.3L, &ldi ); 60 sout | ldi | l | endl;61 sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L ) | endl;62 sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L ) | endl;63 sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L ) | endl;60 sout | ldi | l; 61 sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L ); 62 sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L ); 63 sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L ); 64 64 65 sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 ) | endl;66 sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L ) | endl;65 sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 ); 66 sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L ); 67 67 } // main 68 68 69 69 // Local Variables: // 70 70 // tab-width: 4 // 71 // compile-command: "cfa math3.c " //71 // compile-command: "cfa math3.cfa" // 72 72 // End: // -
tests/maybe.cfa
r7951100 rb067d9b 15 15 16 16 #include <assert.h> 17 #include <containers/maybe >17 #include <containers/maybe.hfa> 18 18 19 19 void checkPredicates() { -
tests/minmax.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // minmax.c --7 // minmax.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 10 17:29:09201813 // Update Count : 5 012 // Last Modified On : Tue Dec 4 21:45:31 2018 13 // Update Count : 52 14 14 // 15 15 16 #include <fstream >17 #include <stdlib > // min, max16 #include <fstream.hfa> 17 #include <stdlib.hfa> // min, max 18 18 19 19 int main( void ) { … … 22 22 int ?>?( char op1, char op2 ) { return (int)op1 > (int)op2; } 23 23 24 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' ) | endl;25 sout | "signed int\t\t" | 4 | 3 | "\tmin" | min( 4, 3 ) | endl;26 sout | "unsigned int\t\t" | 4u | 3u | "\tmin" | min( 4u, 3u ) | endl;27 sout | "signed long int\t\t" | 4l | 3l | "\tmin" | min( 4l, 3l ) | endl;28 sout | "unsigned long int\t" | 4ul | 3ul | "\tmin" | min( 4ul, 3ul ) | endl;29 sout | "signed long long int\t" | 4ll | 3ll | "\tmin" | min( 4ll, 3ll ) | endl;30 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmin" | min( 4ull, 3ull ) | endl;31 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f ) | endl;32 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 ) | endl;33 sout | "long double\t\t" | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l ) | endl;24 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' ); 25 sout | "signed int\t\t" | 4 | 3 | "\tmin" | min( 4, 3 ); 26 sout | "unsigned int\t\t" | 4u | 3u | "\tmin" | min( 4u, 3u ); 27 sout | "signed long int\t\t" | 4l | 3l | "\tmin" | min( 4l, 3l ); 28 sout | "unsigned long int\t" | 4ul | 3ul | "\tmin" | min( 4ul, 3ul ); 29 sout | "signed long long int\t" | 4ll | 3ll | "\tmin" | min( 4ll, 3ll ); 30 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmin" | min( 4ull, 3ull ); 31 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f ); 32 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmin" | min( 4.0, 3.1 ); 33 sout | "long double\t\t" | 4.0l | 3.1l | "\tmin" | min( 4.0l, 3.1l ); 34 34 35 sout | endl;35 sout | nl; 36 36 37 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' ) | endl;38 sout | "signed int\t\t" | 4 | 3 | "\tmax" | max( 4, 3 ) | endl;39 sout | "unsigned int\t\t" | 4u | 3u | "\tmax" | max( 4u, 3u ) | endl;40 sout | "signed long int\t\t" | 4l | 3l | "\tmax" | max( 4l, 3l ) | endl;41 sout | "unsigned long int\t" | 4ul | 3ul | "\tmax" | max( 4ul, 3ul ) | endl;42 sout | "signed long long int\t" | 4ll | 3ll | "\tmax" | max( 4ll, 3ll ) | endl;43 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmax" | max( 4ull, 3ull ) | endl;44 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f ) | endl;45 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 ) | endl;46 sout | "long double\t\t" | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l ) | endl;37 sout | "char\t\t\t" | 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' ); 38 sout | "signed int\t\t" | 4 | 3 | "\tmax" | max( 4, 3 ); 39 sout | "unsigned int\t\t" | 4u | 3u | "\tmax" | max( 4u, 3u ); 40 sout | "signed long int\t\t" | 4l | 3l | "\tmax" | max( 4l, 3l ); 41 sout | "unsigned long int\t" | 4ul | 3ul | "\tmax" | max( 4ul, 3ul ); 42 sout | "signed long long int\t" | 4ll | 3ll | "\tmax" | max( 4ll, 3ll ); 43 sout | "unsigned long long int\t" | 4ull | 3ull | "\tmax" | max( 4ull, 3ull ); 44 sout | "float\t\t\t" | 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f ); 45 sout | "double\t\t\t" | 4.0 | 3.1 | "\tmax" | max( 4.0, 3.1 ); 46 sout | "long double\t\t" | 4.0l | 3.1l | "\tmax" | max( 4.0l, 3.1l ); 47 47 } // main 48 48 49 49 // Local Variables: // 50 50 // tab-width: 4 // 51 // compile-command: "cfa minmax.c " //51 // compile-command: "cfa minmax.cfa" // 52 52 // End: // -
tests/numericConstants.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // numericConstants.c --7 // numericConstants.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 24 22:10:36 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 22:11:36 201713 // Update Count : 212 // Last Modified On : Tue Feb 5 08:58:16 2019 13 // Update Count : 5 14 14 // 15 15 … … 67 67 // Local Variables: // 68 68 // tab-width: 4 // 69 // compile-command: "cfa minmax.c" //69 // compile-command: "cfa numericConstants.cfa" // 70 70 // End: // -
tests/polymorphism.cfa
r7951100 rb067d9b 9 9 // Author : Rob Schluntz 10 10 // Created On : Tue Oct 17 12:19:48 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Oct 17 12:21:07 201713 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 25 14:40:24 2018 13 // Update Count : 3 14 14 // 15 15 16 16 #include <assert.h> 17 17 #include <inttypes.h> 18 #include <fstream.hfa> 18 19 19 20 forall(otype T) … … 61 62 int y = 456; 62 63 int z = f(x, y); 63 printf("%d %d %d\n", x, y, z);64 sout | x | y | z; 64 65 } 65 66 66 { 67 67 // explicitly specialize function 68 68 int (*f)(int) = ident; 69 69 ((int(*)(int))ident); 70 printf("%d %d\n", f(5), ((int(*)(int))ident)(5));70 sout | f(5) | ((int(*)(int))ident)(5); 71 71 } 72 73 72 { 74 73 // test aggregates with polymorphic members … … 100 99 101 100 void print(x_type x) { 102 printf("%"PRIu32"\n", x);101 sout | x; 103 102 } 104 103 105 104 void print(y_type y) { 106 printf("%"PRIu64"\n", y);105 sout | y; 107 106 } 108 107 -
tests/pybin/test_run.py
r7951100 rb067d9b 4 4 5 5 import pybin.settings 6 import datetime7 8 from string import Template9 10 class DeltaTemplate(Template):11 delimiter = "%"12 13 def strfdelta(tdelta, fmt):14 d["H"], rem = divmod(tdelta.seconds, 3600)15 d["M"], d["S"] = divmod(rem, 60)16 t = DeltaTemplate(fmt)17 return t.substitute(**d)18 6 19 7 # Test class that defines what a test is … … 28 16 29 17 def prepare(self): 30 sh("mkdir -p %s" % os.path.join(self.path, '.err')) 31 sh("mkdir -p %s" % os.path.join(self.path, '.out')) 32 sh("mkdir -p %s" % os.path.join(self.path, '.in' )) 18 mkdir( (self.output_log(), self.error_log(), self.input() ) ) 19 rm ( (self.output_log(), self.error_log(), self.target_executable()) ) 33 20 34 21 def expect(self): 35 return ("%s/.expect/%s%s.txt" % (self.path, self.name, '' if not self.arch else ".%s" % self.arch))22 return os.path.normpath( os.path.join(settings.SRCDIR , self.path, ".expect", "%s%s.txt" % (self.name,'' if not self.arch else ".%s" % self.arch)) ) 36 23 37 24 def error_log(self): 38 return ("%s/.err/%s.log" % (self.path, self.name))25 return os.path.normpath( os.path.join(settings.BUILDDIR, self.path, ".err" , "%s.log" % self.name) ) 39 26 40 27 def output_log(self): 41 return ("%s/.out/%s.log" % (self.path, self.name))28 return os.path.normpath( os.path.join(settings.BUILDDIR, self.path, ".out" , "%s.log" % self.name) ) 42 29 43 30 def input(self): 44 return ("%s/.in/%s.txt" % (self.path, self.name))31 return os.path.normpath( os.path.join(settings.SRCDIR , self.path, ".in" , "%s.txt" % self.name) ) 45 32 46 33 def target_output(self): … … 48 35 49 36 def target(self): 50 return os.path.join(self.path, self.name) 37 return os.path.normpath( os.path.join(self.path, self.name) ) 38 39 def target_executable(self): 40 return os.path.normpath( os.path.join(settings.BUILDDIR, self.path, self.name) ) 51 41 52 42 @classmethod … … 58 48 test = Test() 59 49 test.name = os.path.basename(target) 60 test.path = os.path. dirname (target)61 test.arch = settings.arch.t oString()if settings.arch.cross_compile else ''50 test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR) 51 test.arch = settings.arch.target if settings.arch.cross_compile else '' 62 52 return test 63 53 -
tests/quotedKeyword.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // quoted _keyword.c-- test quoted keyword usage7 // quotedKeyword.cfa -- test quoted keyword usage 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jun 30 14:03:59 201613 // Update Count : 1912 // Last Modified On : Tue Dec 4 21:45:53 2018 13 // Update Count : 23 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 struct { … … 41 41 st.`struct` = 3; 42 42 `throw` = 4; 43 sout | `catch` + st.`otype` + st.`struct` + `throw` | endl;43 sout | `catch` + st.`otype` + st.`struct` + `throw`; 44 44 } 45 45 46 46 // Local Variables: // 47 47 // tab-width: 4 // 48 // compile-command: "cfa quoted _keyword.c" //48 // compile-command: "cfa quotedKeyword.cfa" // 49 49 // End: // -
tests/raii/.expect/ctor-autogen-ERR1.txt
r7951100 rb067d9b 1 raii/ctor-autogen.c :102:1 error: Unique best alternative includes deleted identifier inCast of:1 raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Generated Cast of: 2 2 Application of 3 3 Deleted Expression 4 4 Variable Expression: ?{}: static inline function 5 5 ... with parameters 6 _dst: reference to instance of struct Managed with body 1 6 _dst: reference to instance of struct Managed with body 1 7 7 x: signed int 8 ... returning nothing 8 ... returning nothing 9 9 10 10 ... deleted by: ?{}: function 11 11 ... with parameters 12 m: reference to instance of struct Managed with body 1 13 ... returning nothing 14 ... with body 12 m: reference to instance of struct Managed with body 1 13 ... returning nothing 14 ... with body 15 15 CompoundStmt 16 16 Expression Statement: … … 20 20 intrinsic reference to signed int 21 21 intrinsic signed int 22 ... returning 22 ... returning 23 23 _retval__operator_assign: signed int 24 ... with attributes: 24 ... with attributes: 25 25 Attribute with name: unused 26 26 27 27 28 28 ... to arguments 29 Cast of:30 Member Expression, with field: 29 Generated Cast of: 30 Member Expression, with field: 31 31 x: signed int 32 ... from aggregate: 33 Cast of:34 Variable Expression: m: reference to instance of struct Managed with body 1 32 ... from aggregate: 33 Generated Cast of: 34 Variable Expression: m: reference to instance of struct Managed with body 1 35 35 ... to: 36 instance of struct Managed with body 1 36 instance of struct Managed with body 1 37 37 ... to: 38 38 reference to signed int 39 Cast of:39 Generated Cast of: 40 40 constant expression (0 0: zero_t) 41 41 ... to: … … 48 48 49 49 ... to arguments 50 Cast of:51 Variable Expression: x: instance of struct Managed with body 1 50 Generated Cast of: 51 Variable Expression: x: instance of struct Managed with body 1 52 52 ... to: 53 reference to instance of struct Managed with body 1 53 reference to instance of struct Managed with body 1 54 54 constant expression (123 123: signed int) 55 55 -
tests/raii/dtor-early-exit.cfa
r7951100 rb067d9b 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 : Fri Dec 21 08:45:19 2018 13 // Update Count : 10 14 // 15 16 #include <fstream.hfa> 17 #include <stdlib.hfa> 18 #include <assert.h> 22 19 23 20 struct A { … … 28 25 // don't want these called 29 26 void ?{}(A & a) { assert( false ); } 30 void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name | endl; a.x = (int*)malloc(); }27 void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name; a.x = (int*)malloc(); } 31 28 void ?{}(A & a, const char * name, int * ptr) { assert( false ); } 32 29 33 30 A ?=?(A & a, A b) { sout | "assign " | a.name | " " | b.name; return a; } 34 void ?{}(A & a, A b) { sout | "copy construct " | b.name | endl; a.x = (int*)malloc(); }35 void ^?{}(A & a) { sout | "destruct " | a.name | endl; free(a.x); }31 void ?{}(A & a, A b) { sout | "copy construct " | b.name; a.x = (int*)malloc(); } 32 void ^?{}(A & a) { sout | "destruct " | a.name; free(a.x); } 36 33 37 34 // test returns 38 35 void f(int i) { 39 sout | "f i=" | i | endl;36 sout | "f i=" | i; 40 37 A x = { "x" }; // construct x 41 38 { … … 58 55 void g() { 59 56 for (int i = 0; i < 10; i++) { 60 sout | "g for i=" | i | endl;57 sout | "g for i=" | i; 61 58 A x = { "x" }; 62 59 // construct x 63 60 // destruct x 64 61 } 65 sout | endl;62 sout | nl; 66 63 { 67 64 int i = 0; 68 65 while (i < 10) { 69 sout | "g while i=" | i | endl;66 sout | "g while i=" | i; 70 67 A x = { "x" }; 71 68 // construct x … … 74 71 } 75 72 } 76 sout | endl;73 sout | nl; 77 74 for (int i = 0; i < 10; i++) { 78 75 switch(10) { … … 81 78 case 10: { 82 79 A y = { "y" }; 83 sout | "g switch i=" | i | endl;80 sout | "g switch i=" | i; 84 81 // construct y 85 82 break; // destruct y 86 83 } 87 84 default: { 88 sout | "g switch i=" | i | endl;85 sout | "g switch i=" | i; 89 86 A x = { "x" }; 90 87 // construct x … … 93 90 } 94 91 } 95 sout | endl;92 sout | nl; 96 93 for (int k = 0; k < 2; k++) { 97 sout | "g for k=" | k | endl;94 sout | "g for k=" | k; 98 95 L1: for (int i = 0; i < 10; i++) { 99 sout | "g for i=" | i | endl;96 sout | "g for i=" | i; 100 97 101 98 A x = { "x" }; 102 99 if (i == 2) { 103 sout | "continue L1" | endl;100 sout | "continue L1"; 104 101 continue; // destruct x 105 102 } else if (i == 3) { 106 sout | "break L1" | endl;103 sout | "break L1"; 107 104 break; // destruct x 108 105 } 109 106 110 107 L2: for (int j = 0; j < 10; j++) { 111 sout | "g for j=" | j | endl;108 sout | "g for j=" | j; 112 109 A y = { "y" }; 113 110 if (j == 0) { 114 sout | "continue L2" | endl;111 sout | "continue L2"; 115 112 continue; // destruct y - missing because object that needs to be destructed is not a part of this block, it's a part of the for's block 116 113 } else if (j == 1) { 117 sout | "break L2" | endl;114 sout | "break L2"; 118 115 break; // destruct y 119 116 } else if (i == 1) { 120 sout | "continue L1" | endl;117 sout | "continue L1"; 121 118 continue L1; // destruct x,y - note: continue takes you to destructors for block, so only generate destructor for y 122 119 } else if (k == 1) { 123 sout | "break L1" | endl;120 sout | "break L1"; 124 121 break L1; // destruct x,y 125 122 } … … 128 125 } 129 126 130 sout | endl;127 sout | nl; 131 128 L3: if( 3 ) { 132 129 A w = { "w" }; 133 130 if( 4 ) { 134 131 A v = { "v" }; 135 sout | "break L3" | endl;132 sout | "break L3"; 136 133 break L3; 137 134 } … … 147 144 // * if S_L-S_G is non-empty, error 148 145 // * emit destructors for all variables in S_G-S_L 149 sout | "h" | endl;146 sout | "h"; 150 147 { 151 148 L0: ; … … 155 152 A y = { "y" }; 156 153 // S_L1 = { y } 157 L1: sout | "L1" | endl;154 L1: sout | "L1"; 158 155 A x = { "x" }; 159 156 // S_L2 = { y, x } 160 L2: sout | "L2" | endl;157 L2: sout | "L2"; 161 158 if (i == 0) { 162 159 ++i; 163 sout | "goto L1" | endl;160 sout | "goto L1"; 164 161 // S_G = { y, x } 165 162 goto L1; // jump back, destruct b/c before x definition … … 168 165 } else if (i == 1) { 169 166 ++i; 170 sout | "goto L2" | endl;167 sout | "goto L2"; 171 168 // S_G = { y, x } 172 169 goto L2; // jump back, do not destruct … … 175 172 } else if (i == 2) { 176 173 ++i; 177 sout | "goto L3" | endl;174 sout | "goto L3"; 178 175 // S_G = { y, x } 179 176 goto L3; // jump ahead, do not destruct … … 183 180 ++i; 184 181 A z = { "z" }; 185 sout | "goto L3-2" | endl;182 sout | "goto L3-2"; 186 183 // S_G = { z, y, x } 187 184 goto L3; … … 190 187 } else { 191 188 ++i; 192 sout | "goto L4" | endl;189 sout | "goto L4"; 193 190 // S_G = { y, x } 194 191 goto L4; // jump ahead, destruct b/c left block x was defined in … … 197 194 } 198 195 // S_L3 = { y, x } 199 L3: sout | "L3" | endl;200 sout | "goto L2-2" | endl;196 L3: sout | "L3"; 197 sout | "goto L2-2"; 201 198 // S_G = { y, x } 202 199 goto L2; // jump back, do not destruct … … 205 202 } 206 203 // S_L4 = {} 207 L4: sout | "L4" | endl;204 L4: sout | "L4"; 208 205 if (i == 4) { 209 sout | "goto L0" | endl;206 sout | "goto L0"; 210 207 // S_G = {} 211 208 goto L0; … … 243 240 f(i); 244 241 } 245 sout | endl;242 sout | nl; 246 243 g(); 247 sout | endl;244 sout | nl; 248 245 h(); 249 246 -
tests/raii/globals.cfa
r7951100 rb067d9b 1 #include <fstream >1 #include <fstream.hfa> 2 2 3 3 struct value_t { … … 70 70 71 71 int main() { 72 sout | "static\t\tinline\t\tautogen\t\tvalue" | endl;72 sout | "static\t\tinline\t\tautogen\t\tvalue"; 73 73 74 sout | "no \t\tno \t\tno \t\t" | g.val.value | endl;75 sout | "no \t\tno \t\tyes\t\t" | ga.val.value | endl;76 sout | "no \t\tyes\t\tno \t\t" | gi.val.value | endl;77 sout | "no \t\tyes\t\tyes\t\t" | gia.val.value | endl;78 sout | "yes\t\tno \t\tno \t\t" | gs.val.value | endl;79 sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value | endl;80 sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value | endl;81 sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value | endl;74 sout | "no \t\tno \t\tno \t\t" | g.val.value; 75 sout | "no \t\tno \t\tyes\t\t" | ga.val.value; 76 sout | "no \t\tyes\t\tno \t\t" | gi.val.value; 77 sout | "no \t\tyes\t\tyes\t\t" | gia.val.value; 78 sout | "yes\t\tno \t\tno \t\t" | gs.val.value; 79 sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value; 80 sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value; 81 sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value; 82 82 83 83 } -
tests/raii/init_once.cfa
r7951100 rb067d9b 10 10 // Created On : Tue Jun 14 15:43:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 9 11:30:29 201613 // Update Count : 312 // Last Modified On : Fri Mar 22 13:41:26 2019 13 // Update Count : 4 14 14 // 15 15 … … 192 192 // Local Variables: // 193 193 // tab-width: 4 // 194 // compile-command: "cfa init_once.c " //194 // compile-command: "cfa init_once.cfa" // 195 195 // End: // -
tests/raii/memberCtors.cfa
r7951100 rb067d9b 1 1 struct WrappedInt { 2 2 int x; 3 int id; 3 4 }; 5 int intID = 0; 4 6 5 7 void ?{}(WrappedInt & this) { 6 printf("constructing int\n"); 8 this.id = intID++; 9 printf("constructing int id: %d\n", this.id); 7 10 this.x = 0; 8 11 } 9 12 10 13 void ?{}(WrappedInt & this, WrappedInt other) { 11 printf("copy constructing int: %d\n", other.x); 14 this.id = intID++; 15 printf("copy constructing int: %d id: %d\n", other.x, this.id); 12 16 this.x = other.x; 13 17 } 14 18 15 19 void ?{}(WrappedInt & this, int x) { 16 printf("constructing int: %d\n", x); 20 this.id = intID++; 21 printf("constructing int: %d id: %d\n", x, this.id); 17 22 this.x = x; 18 23 } 19 24 20 25 void ^?{}(WrappedInt & this) { 21 printf("destructing int: %d \n", this.x);26 printf("destructing int: %d id: %d\n", this.x, this.id); 22 27 } 23 28 24 void ?=?(WrappedInt & this, int x) {25 printf("assigning int: %d %d \n", this.x, x);29 /* WrappedInt */ void ?=?(WrappedInt & this, int x) { 30 printf("assigning int: %d %d id: %d\n", this.x, x, this.id); 26 31 this.x = x; 32 // return this; 27 33 } 34 35 // WrappedInt ?=?(WrappedInt & this, WrappedInt other) { 36 // printf("assigning int: %d %d\n", this.x, other.x); 37 // this.x = other.x; 38 // return this; 39 // } 28 40 29 41 struct A { 30 42 WrappedInt x, y, z; 43 int id; 31 44 }; 45 int AID = 0; 32 46 33 47 void ?{}(A & a) { 34 48 // currently must define default ctor, since there's no "= default" syntax 49 a.id = AID++; 50 printf("default construct A %d\n", a.id); 35 51 } 36 52 37 53 void ?{}(A & a, int x) { 38 printf("begin construct A\n"); 54 a.id = AID++; 55 printf("begin construct A id: %d\n", a.id); 39 56 printf("construct a.x\n"); 40 57 (a.x){ x+999 }; … … 45 62 46 63 void ?{}(A & this, A other) { 47 printf("begin copy construct A\n"); 64 this.id = AID++; 65 printf("begin copy construct A id: %d\n", this.id); 48 66 printf("copy construct this.x\n"); 49 67 (this.x){ other.x }; … … 54 72 55 73 A ?=?(A & this, A other) { 56 printf("begin ?=? A \n");74 printf("begin ?=? A id: %d\n", this.id); 57 75 this.x = other.x; 58 76 this.y = other.y; … … 64 82 struct B { 65 83 A a1, a2, a3; 84 int id; 66 85 }; 86 int BID = 0; 67 87 68 88 void ?{}(B & b) { 69 printf("begin construct B\n"); 89 b.id = BID++; 90 printf("begin construct B id: %d\n", b.id); 70 91 printf("assign b.a2\n"); 71 92 b.a2 = (A) { 2 }; … … 79 100 80 101 void ^?{}(B & b) { 102 b.id = BID++; 103 printf("begin destruct B id: %d\n", b.id); 81 104 b.a2 = (A) { 0 }; 82 105 ^(b.a1){}; 106 printf("end destruct B\n"); 83 107 } // a2, a3 never destructed - will be automatically destructed 84 108 85 109 int main() { 86 110 printf("Before declaration of b1\n"); 87 B b1; 111 B b1; // b1 = { { 1000, 0, 0 }, { 1001, 0, 0 }, { 0, 0, 0 } } 88 112 printf("Before declaration of b2\n"); 89 113 B b2 = b1; -
tests/random.cfa
r7951100 rb067d9b 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.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Jul 5 21:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:19:34201813 // Update Count : 1914 // 12 // Last Modified On : Tue Dec 4 21:46:25 2018 13 // Update Count : 22 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 … … 24 24 // test polymorphic calls to random and stream 25 25 char c = random(); 26 sout | c | endl;26 sout | c; 27 27 c = random( 'A' ); 28 sout | c | endl;28 sout | c; 29 29 c = random( 'A', 'Z' ); 30 sout | c | endl;30 sout | c; 31 31 32 32 int i = random(); 33 sout | i | endl;33 sout | i; 34 34 i = random( 10 ); 35 sout | i | endl;35 sout | i; 36 36 i = random( -10, 20 ); 37 sout | i | endl;37 sout | i; 38 38 39 39 unsigned int ui = random(); 40 sout | ui | endl;40 sout | ui; 41 41 ui = random( 10u ); 42 sout | ui | endl;42 sout | ui; 43 43 ui = random( 10u, 20u ); 44 sout | ui | endl;44 sout | ui; 45 45 46 46 long int li = random(); 47 sout | li | endl;47 sout | li; 48 48 li = random( 10l ); 49 sout | li | endl;49 sout | li; 50 50 li = random( -10l, 20l ); 51 sout | li | endl;51 sout | li; 52 52 53 53 unsigned long int uli = random(); 54 sout | uli | endl;54 sout | uli; 55 55 uli = random( 10ul ); 56 sout | uli | endl;56 sout | uli; 57 57 uli = random( 10ul, 20ul ); 58 sout | uli | endl;58 sout | uli; 59 59 60 60 float f = random(); 61 sout | f | endl;61 sout | f; 62 62 63 63 double d = random(); 64 sout | d | endl;64 sout | d; 65 65 66 66 float _Complex fc = random(); 67 sout | fc | endl;67 sout | fc; 68 68 69 69 double _Complex dc = random(); 70 sout | dc | endl;70 sout | dc; 71 71 72 72 long double _Complex ldc = random(); 73 sout | ldc | endl;73 sout | ldc; 74 74 } // main 75 75 76 76 // Local Variables: // 77 77 // tab-width: 4 // 78 // compile-command: "cfa random.c " //78 // compile-command: "cfa random.cfa" // 79 79 // End: // -
tests/result.cfa
r7951100 rb067d9b 15 15 16 16 #include <assert.h> 17 #include <containers/result >17 #include <containers/result.hfa> 18 18 19 19 void checkPredicates() { -
tests/searchsort.cfa
r7951100 rb067d9b 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.cfa -- 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 : T ue Jan 2 08:01:17201813 // Update Count : 10 014 // 12 // Last Modified On : Thu Dec 20 22:49:46 2018 13 // Update Count : 108 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 … … 21 21 22 22 int main( void ) { 23 const unsignedint size = 10;23 const int size = 10; 24 24 int iarr[size]; 25 25 26 for ( unsigned int i = 0; i < size; i += 1 ) { 26 sout | nlOff; // turn off auto newline 27 28 for ( i; 0 ~ size ) { 27 29 iarr[i] = size - i; 28 30 sout | iarr[i] | ", "; 29 31 } // for 30 sout | endl | endl;32 sout | nl | nl; 31 33 32 34 // ascending sort/search by changing < to > 33 35 qsort( iarr, size ); 34 for ( unsigned int i = 0; i < size; i += 1) {36 for ( i; 0 ~ size ) { 35 37 sout | iarr[i] | ", "; 36 38 } // for 37 sout | endl;38 for ( unsigned int i = 0; i < size; i += 1) { // C version39 sout | nl; 40 for ( i; 0 ~ size ) { // C version 39 41 int key = size - i; 40 42 int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp ); 41 43 sout | key | ':' | *v | ", "; 42 44 } // for 43 sout | endl;45 sout | nl; 44 46 45 for ( unsigned int i = 0; i < size; i += 1) {47 for ( i; 0 ~ size ) { 46 48 int * v = bsearch( size - i, iarr, size ); 47 49 sout | size - i | ':' | *v | ", "; 48 50 } // for 49 sout | endl;50 for ( unsigned int i = 0; i < size; i += 1) {51 sout | nl; 52 for ( i; 0 ~ size ) { 51 53 unsigned int posn = bsearch( size - i, iarr, size ); 52 54 sout | size - i | ':' | iarr[posn] | ", "; 53 55 } // for 54 sout | endl | endl;56 sout | nl | nl; 55 57 56 58 // descending sort/search by changing < to > 57 for ( unsigned int i = 0; i < size; i += 1) {59 for ( i; 0 ~ size ) { 58 60 iarr[i] = i + 1; 59 61 sout | iarr[i] | ", "; 60 62 } // for 61 sout | endl;63 sout | nl; 62 64 { 63 int ?<?( int x, int y ) { return x > y; } 64 qsort( iarr, size ); 65 for ( unsigned int i = 0; i < size; i += 1 ) { 65 // redefinition of ?<? can't overlap the loop controls: 66 { 67 int (*?<?)(int, int) = ?>?; 68 qsort( iarr, size ); 69 } 70 for ( i; 0 ~ size ) { 66 71 sout | iarr[i] | ", "; 67 72 } // for 68 sout | endl; 69 for ( unsigned int i = 0; i < size; i += 1 ) { 73 sout | nl; 74 for ( i; 0 ~ size ) { 75 int (*?<?)(int, int) = ?>?; 70 76 int * v = bsearch( size - i, iarr, size ); 71 77 sout | size - i | ':' | *v | ", "; 72 78 } // for 73 sout | endl; 74 for ( unsigned int i = 0; i < size; i += 1 ) { 79 sout | nl; 80 for ( i; 0 ~ size ) { 81 int (*?<?)(int, int) = ?>?; 75 82 unsigned int posn = bsearch( size - i, iarr, size ); 76 83 sout | size - i | ':' | iarr[posn] | ", "; 77 84 } // for 78 85 } 79 sout | endl | endl;86 sout | nl | nl; 80 87 81 88 double darr[size]; 82 for ( unsigned int i = 0; i < size; i += 1) {89 for ( i; 0 ~ size ) { 83 90 darr[i] = size - i + 0.5; 84 91 sout | darr[i] | ", "; 85 92 } // for 86 sout | endl;93 sout | nl; 87 94 qsort( darr, size ); 88 for ( unsigned int i = 0; i < size; i += 1) {95 for ( i; 0 ~ size ) { 89 96 sout | darr[i] | ", "; 90 97 } // for 91 sout | endl;92 for ( unsigned int i = 0; i < size; i += 1) {98 sout | nl; 99 for ( i; 0 ~ size ) { 93 100 double * v = bsearch( size - i + 0.5, darr, size ); 94 101 sout | size - i + 0.5 | ':' | *v | ", "; 95 102 } // for 96 sout | endl;97 for ( unsigned int i = 0; i < size; i += 1) {103 sout | nl; 104 for ( i; 0 ~ size ) { 98 105 unsigned int posn = bsearch( size - i + 0.5, darr, size ); 99 106 sout | size - i + 0.5 | ':' | darr[posn] | ", "; 100 107 } // for 101 sout | endl | endl;108 sout | nl | nl; 102 109 103 110 struct S { int i, j; } sarr[size]; 104 111 int ?<?( S t1, S t2 ) { return t1.i < t2.i && t1.j < t2.j; } 105 112 ofstream & ?|?( ofstream & os, S v ) { return os | v.i | ' ' | v.j; } 106 for ( unsigned int i = 0; i < size; i += 1) {113 for ( i; 0 ~ size ) { 107 114 sarr[i].i = size - i; 108 115 sarr[i].j = size - i + 1; 109 116 sout | sarr[i] | ", "; 110 117 } // for 111 sout | endl;118 sout | nl; 112 119 qsort( sarr, size ); 113 for ( unsigned int i = 0; i < size; i += 1) {120 for ( i; 0 ~ size ) { 114 121 sout | sarr[i] | ", "; 115 122 } // for 116 sout | endl;117 for ( unsigned int i = 0; i < size; i += 1) {123 sout | nl; 124 for ( i; 0 ~ size ) { 118 125 S temp = { size - i, size - i + 1 }; 119 126 S * v = bsearch( temp, sarr, size ); 120 127 sout | temp | ':' | *v | ", "; 121 128 } // for 122 sout | endl;123 for ( unsigned int i = 0; i < size; i += 1) {129 sout | nl; 130 for ( i; 0 ~ size ) { 124 131 S temp = { size - i, size - i + 1 }; 125 132 unsigned int posn = bsearch( temp, sarr, size ); 126 133 sout | temp | ':' | sarr[posn] | ", "; 127 134 } // for 128 sout | endl | endl;135 sout | nl | nl; 129 136 { 130 unsignedint getKey( const S & s ) { return s.j; }131 for ( unsigned int i = 0; i < size; i += 1) {137 int getKey( const S & s ) { return s.j; } 138 for ( i; 0 ~ size ) { 132 139 sout | sarr[i] | ", "; 133 140 } // for 134 sout | endl;135 for ( unsigned int i = 0; i < size; i += 1) {141 sout | nl; 142 for ( i; 0 ~ size ) { 136 143 S * v = bsearch( size - i + 1, sarr, size ); 137 144 sout | size - i + 1 | ':' | *v | ", "; 138 145 } // for 139 sout | endl;140 for ( unsigned int i = 0; i < size; i += 1) {146 sout | nl; 147 for ( i; 0 ~ size ) { 141 148 unsigned int posn = bsearch( size - i + 1, sarr, size ); 142 149 sout | size - i + 1 | ':' | sarr[posn] | ", "; 143 150 } // for 144 sout | endl | endl;151 sout | nl | nl; 145 152 } 146 153 } // main … … 148 155 // Local Variables: // 149 156 // tab-width: 4 // 150 // compile-command: "cfa searchsort.c " //157 // compile-command: "cfa searchsort.cfa" // 151 158 // End: // -
tests/stdincludes.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // stdincludes.c --7 // stdincludes.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Aug 29 08:26:14 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 30 07:56:39 201713 // Update Count : 512 // Last Modified On : Tue Nov 6 18:00:53 2018 13 // Update Count : 6 14 14 // 15 15 … … 51 51 // Local Variables: // 52 52 // tab-width: 4 // 53 // compile-command: "cfa stdincludes.c " //53 // compile-command: "cfa stdincludes.cfa" // 54 54 // End: // -
tests/switch.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // switch.c --7 // switch.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Jul 12 06:50:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 07:33:05201813 // Update Count : 3 612 // Last Modified On : Tue Nov 6 18:01:34 2018 13 // Update Count : 37 14 14 // 15 15 … … 104 104 // Local Variables: // 105 105 // tab-width: 4 // 106 // compile-command: "cfa switch.c " //106 // compile-command: "cfa switch.cfa" // 107 107 // End: // -
tests/test.py
r7951100 rb067d9b 1 #!/usr/bin/python 2 from __future__ import print_function 1 #!/usr/bin/python3 3 2 4 3 from pybin.tools import * … … 9 8 import re 10 9 import sys 10 import tempfile 11 11 import time 12 12 … … 15 15 ################################################################################ 16 16 17 def find Tests():17 def find_tests(): 18 18 expected = [] 19 19 20 def match Test(path):21 match = re.search(" (\.[\w\/\-_]*)\/.expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt", path)20 def match_test(path): 21 match = re.search("^%s\/([\w\/\-_]*).expect\/([\w\-_]+)(\.[\w\-_]+)?\.txt$" % settings.SRCDIR, path) 22 22 if match : 23 23 test = Test() … … 28 28 expected.append(test) 29 29 30 path Walk( matchTest )30 path_walk( match_test ) 31 31 32 32 return expected 33 33 34 34 # reads the directory ./.expect and indentifies the tests 35 def listTests( includes, excludes ): 36 includes = [canonicalPath( i ) for i in includes] if includes else None 37 excludes = [canonicalPath( i ) for i in excludes] if excludes else None 38 35 def list_tests( includes, excludes ): 39 36 # tests directly in the .expect folder will always be processed 40 test_list = find Tests()37 test_list = find_tests() 41 38 42 39 # if we have a limited number of includes, filter by them … … 55 52 56 53 # from the found tests, filter all the valid tests/desired tests 57 def valid Tests( options ):54 def valid_tests( options ): 58 55 tests = [] 59 56 … … 62 59 if options.regenerate_expected : 63 60 for testname in options.tests : 64 testname = canonical Path( testname )61 testname = canonical_path( testname ) 65 62 if Test.valid_name(testname): 66 found = [test for test in all Tests if test.target() == testname]63 found = [test for test in all_tests if canonical_path( test.target() ) == testname] 67 64 tests.append( found[0] if len(found) == 1 else Test.from_target(testname) ) 68 65 else : … … 72 69 # otherwise we only need to validate that all tests are present in the complete list 73 70 for testname in options.tests: 74 test = [t for t in all Tests if pathCmp( t.target(), testname )]71 test = [t for t in all_tests if path_cmp( t.target(), testname )] 75 72 76 73 if test : … … 82 79 83 80 # parses the option 84 def getOptions():81 def parse_args(): 85 82 # create a parser with the arguments for the tests script 86 83 parser = argparse.ArgumentParser(description='Script which runs cforall tests') 87 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no') 84 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='yes') 85 parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=yes_no, default='no') 88 86 parser.add_argument('--arch', help='Test for specific architecture', type=str, default='') 87 parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60) 88 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) 89 89 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true') 90 90 parser.add_argument('--list', help='List all test available', action='store_true') 91 91 parser.add_argument('--all', help='Run all test available', action='store_true') 92 92 parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true') 93 parser.add_argument('--archive-errors', help='If called with a valid path, on test crashes the test script will copy the core dump and the executable to the specified path.', type=str, default='') 93 94 parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int) 94 95 parser.add_argument('--list-comp', help='List all valide arguments', action='store_true') … … 97 98 parser.add_argument('tests', metavar='test', type=str, nargs='*', help='a list of tests to run') 98 99 99 options = parser.parse_args() 100 try: 101 options = parser.parse_args() 102 except: 103 print('ERROR: invalid arguments', file=sys.stderr) 104 parser.print_help(sys.stderr) 105 sys.exit(1) 100 106 101 107 # script must have at least some tests to run or be listing … … 107 113 # check that exactly one of the booleans is set to true 108 114 if not sum( (listing, all_tests, some_tests, some_dirs) ) > 0 : 109 print(' ERROR: must have option \'--all\', \'--list\', \'--include\', \'-I\' or non-empty test list', file=sys.stderr)115 print('''ERROR: must have option '--all', '--list', '--include', '-I' or non-empty test list''', file=sys.stderr) 110 116 parser.print_help() 111 117 sys.exit(1) … … 116 122 # running test functions 117 123 ################################################################################ 124 def success(val): 125 return val == 0 or settings.dry_run 126 127 def no_rule(file, target): 128 return not settings.dry_run and file_contains_only(file, "make: *** No rule to make target `%s'. Stop." % target) 129 118 130 # logic to run a single test and return the result (No handling of printing or other test framework logic) 119 131 def run_single_test(test): 120 132 121 133 # find the output file based on the test name and options flag 134 exe_file = test.target_executable(); 122 135 out_file = test.target_output() 123 136 err_file = test.error_log() … … 128 141 test.prepare() 129 142 130 # remove any outputs from the previous tests to prevent side effects131 rm( (out_file, err_file, test.target()) )132 133 143 # build, skipping to next test on error 134 before = time.time() 135 make_ret, _ = make( test.target(), 136 redirects = "2> %s 1> /dev/null" % out_file, 137 error_file = err_file 138 ) 139 after = time.time() 140 141 comp_dur = after - before 144 with Timed() as comp_dur: 145 make_ret, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file ) 142 146 143 147 run_dur = None 144 145 # if the make command succeds continue otherwise skip to diff 146 if make_ret == 0 or settings.dry_run: 147 before = time.time() 148 if settings.dry_run or fileIsExecutable(test.target()) : 149 # run test 150 retcode, _ = sh("timeout 60 %s > %s 2>&1" % (test.target(), out_file), input = in_file) 151 else : 152 # simply cat the result into the output 153 retcode, _ = sh("cat %s > %s" % (test.target(), out_file)) 154 155 after = time.time() 156 run_dur = after - before 157 else: 158 retcode, _ = sh("mv %s %s" % (err_file, out_file)) 159 160 161 if retcode == 0: 162 if settings.generating : 163 # if we are ounly generating the output we still need to check that the test actually exists 164 if not settings.dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'. Stop." % test.target()) : 165 retcode = 1; 166 error = "\t\tNo make target for test %s!" % test.target() 167 sh("rm %s" % out_file, False) 168 else: 169 error = None 170 else : 171 # fetch return code and error from the diff command 172 retcode, error = diff(cmp_file, out_file) 173 174 else: 175 with open (out_file, "r") as myfile: 176 error = myfile.read() 148 # run everything in a temp directory to make sure core file are handled properly 149 with tempdir(): 150 # if the make command succeds continue otherwise skip to diff 151 if success(make_ret): 152 with Timed() as run_dur: 153 if settings.dry_run or is_exe(exe_file): 154 # run test 155 retcode, _ = sh(exe_file, output_file=out_file, input_file=in_file, timeout=True) 156 else : 157 # simply cat the result into the output 158 retcode = cat(exe_file, out_file) 159 else: 160 retcode = mv(err_file, out_file) 161 162 if success(retcode): 163 if settings.generating : 164 # if we are ounly generating the output we still need to check that the test actually exists 165 if no_rule(out_file, test.target()) : 166 retcode = 1 167 error = "\t\tNo make target for test %s!" % test.target() 168 rm(out_file) 169 else: 170 error = None 171 else : 172 # fetch return code and error from the diff command 173 retcode, error = diff(cmp_file, out_file) 174 175 else: 176 with open (out_file, "r") as myfile: 177 error = myfile.read() 178 179 ret, info = core_info(exe_file) 180 error = error + info if error else info 181 182 if settings.archive: 183 error = error + '\n' + core_archive(settings.archive, test.target(), exe_file) 184 177 185 178 186 179 187 # clean the executable 180 sh("rm -f %s > /dev/null 2>&1" % test.target())181 182 return retcode, error, [comp_dur , run_dur]188 rm(exe_file) 189 190 return retcode, error, [comp_dur.duration, run_dur.duration if run_dur else None] 183 191 184 192 # run a single test and handle the errors, outputs, printing, exception handling, etc. 185 193 def run_test_worker(t) : 186 187 with SignalHandling(): 194 try : 188 195 # print formated name 189 name_txt = "%20s " % t.name196 name_txt = '{0:{width}} '.format(t.target(), width=settings.output_width) 190 197 191 198 retcode, error, duration = run_single_test(t) … … 195 202 196 203 #print result with error if needed 197 text = name_txt + result_txt204 text = '\t' + name_txt + result_txt 198 205 out = sys.stdout 199 206 if error : 200 text = text + "\n" + error 201 out = sys.stderr 202 203 print(text, file = out) 204 sys.stdout.flush() 207 text = text + '\n' + error 208 209 return retcode == TestResult.SUCCESS, text 210 except KeyboardInterrupt: 211 return False, "" 212 except Exception as ex: 213 print("Unexpected error in worker thread: %s" % ex, file=sys.stderr) 205 214 sys.stderr.flush() 206 207 return retcode != TestResult.SUCCESS 215 return False, "" 216 208 217 209 218 # run the given list of tests with the given parameters 210 219 def run_tests(tests, jobs) : 211 220 # clean the sandbox from previous commands 212 make('clean', redirects = '> /dev/null 2>&1')221 make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL) 213 222 214 223 # create the executor for our jobs and handle the signal properly 215 pool = setupPool(jobs) 224 pool = multiprocessing.Pool(jobs) 225 226 failed = False 216 227 217 228 # for each test to run 218 229 try : 219 results = pool.map_async( 230 num = len(tests) 231 fancy = sys.stdout.isatty() 232 results = pool.imap_unordered( 220 233 run_test_worker, 221 234 tests, 222 235 chunksize = 1 223 ).get(7200) 236 ) 237 238 for i, (succ, txt) in enumerate(timed(results, timeout = settings.timeout.total), 1) : 239 if not succ : 240 failed = True 241 242 print(" " + txt) 243 244 if(fancy and i != num): 245 print("%d/%d" % (i, num), end='\r') 246 sys.stdout.flush() 247 224 248 except KeyboardInterrupt: 249 print("Tests interrupted by user", file=sys.stderr) 225 250 pool.terminate() 226 print("Tests interrupted by user") 227 sys.exit(1) 251 pool.join() 252 failed = True 253 except multiprocessing.TimeoutError: 254 print("ERROR: Test suite timed out", file=sys.stderr) 255 pool.terminate() 256 pool.join() 257 failed = True 258 killgroup() # needed to cleanly kill all children 259 228 260 229 261 # clean the workspace 230 make('clean', redirects = '> /dev/null 2>&1') 231 232 for failed in results: 233 if failed : 234 return 1 235 236 return 0 262 make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL) 263 264 return 1 if failed else 0 237 265 238 266 … … 241 269 ################################################################################ 242 270 if __name__ == "__main__": 243 #always run from same folder244 chdir()245 271 246 272 # parse the command line arguments 247 options = getOptions()273 options = parse_args() 248 274 249 275 # init global settings … … 251 277 252 278 # fetch the liest of all valid tests 253 allTests = listTests( options.include, options.exclude ) 279 all_tests = list_tests( options.include, options.exclude ) 280 254 281 255 282 # if user wants all tests than no other treatement of the test list is required 256 283 if options.all or options.list or options.list_comp or options.include : 257 tests = all Tests284 tests = all_tests 258 285 259 286 #otherwise we need to validate that the test list that was entered is valid 260 287 else : 261 tests = valid Tests( options )288 tests = valid_tests( options ) 262 289 263 290 # make sure we have at least some test to run … … 272 299 # users may want to simply list the tests 273 300 if options.list_comp : 274 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected - j --jobs ", end='')301 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout -j --jobs ", end='') 275 302 print(" ".join(map(lambda t: "%s" % (t.target()), tests))) 276 303 277 304 elif options.list : 278 305 print("Listing for %s:%s"% (settings.arch.string, settings.debug.string)) 279 fancy_print("\n".join(map(lambda t: "%s" % (t.toString()), tests)))306 fancy_print("\n".join(map(lambda t: t.toString(), tests))) 280 307 281 308 else : 282 options.jobs, forceJobs = jobCount( options, tests ) 283 settings.updateMakeCmd(forceJobs, options.jobs) 284 285 print('%s (%s:%s) on %i cores' % ( 286 'Regenerate tests' if settings.generating else 'Running', 309 # check the build configuration works 310 settings.prep_output(tests) 311 settings.validate() 312 313 options.jobs, forceJobs = job_count( options, tests ) 314 settings.update_make_cmd(forceJobs, options.jobs) 315 316 print('%s %i tests on %i cores (%s:%s)' % ( 317 'Regenerating' if settings.generating else 'Running', 318 len(tests), 319 options.jobs, 287 320 settings.arch.string, 288 settings.debug.string, 289 options.jobs 321 settings.debug.string 290 322 )) 291 323 -
tests/tuple/tupleAssign.cfa
r7951100 rb067d9b 10 10 // Created On : Tue Nov 15 17:24:32 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 6 21:23:58 201713 // Update Count : 3 412 // Last Modified On : Tue Dec 4 22:03:48 2018 13 // Update Count : 35 14 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 18 18 int main() { … … 24 24 // swap x, y and store the new [x, y] in [u, v] and in z; 25 25 printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z ); 26 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;26 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]"; 27 27 z = [u, v] = [x, y] = [y, x]; 28 28 printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z ); 29 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;29 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]"; 30 30 31 31 // shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v 32 32 [v, z, u] = [z, u, v]; 33 33 printf( "u=%d v=%d z=[%d, %d]\n", u, v, z ); 34 sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;34 sout | "u=" | u | "v=" | v | "z=[" | z | "]"; 35 35 36 36 // multiple assignment with tuple expression on right … … 38 38 [u, v] = [123, 456]; 39 39 printf( "u=%d v=%d z=[%d, %d]\n", u, v, z ); 40 sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;40 sout | "u=" | u | "v=" | v | "z=[" | z | "]"; 41 41 } 42 42 { … … 55 55 [t, x, d, i, c, x] = (double)94.12; 56 56 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t ); 57 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;57 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]"; 58 58 [x, c, i, d, x, t] = (double)-94.12; 59 59 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t ); 60 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;60 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]"; 61 61 } 62 62 } -
tests/tuple/tupleVariadic.cfa
r7951100 rb067d9b 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 { … … 66 65 a.data[2] = a2; 67 66 printf("called ?{} with a: %d %d %d\n", a0, a1, a2); 67 } 68 69 void ^?{}(array & a) { 70 free(a.data); 68 71 } 69 72 … … 126 129 bar(x); 127 130 } 131 132 delete(ptr); 133 delete(x4); 134 delete(x3); 135 delete(x2); 136 delete(x1); 137 delete(x0); 128 138 } 129 139 … … 131 141 // tab-width: 4 // 132 142 // End: // 133 -
tests/userLiterals.cfa
r7951100 rb067d9b 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.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Sep 6 21:40:50 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 29 16:51:42201813 // Update Count : 5 414 // 12 // Last Modified On : Tue Dec 4 22:03:10 2018 13 // Update Count : 56 14 // 15 15 16 #include <fstream >16 #include <fstream.hfa> 17 17 #include <wchar.h> 18 18 #include <uchar.h> 19 19 20 int ?`s( int s ) { sout | "secs" | s | endl; return s; }21 int ?`m( int m ) { sout | "mins" | m | endl; return m * 60; }22 int ?`h( int h ) { sout | "hours" | h | endl; return h * 3600; }23 int ?`_A_( int x ) { sout | "_A_" | x | endl; return x; }24 int ?`__thingy_( int x ) { sout | "_thingy_" | x | endl; return x; }20 int ?`s( int s ) { sout | "secs" | s; return s; } 21 int ?`m( int m ) { sout | "mins" | m; return m * 60; } 22 int ?`h( int h ) { sout | "hours" | h; return h * 3600; } 23 int ?`_A_( int x ) { sout | "_A_" | x; return x; } 24 int ?`__thingy_( int x ) { sout | "_thingy_" | x; return x; } 25 25 26 int ?`s( const char * s ) { sout | "secs" | s | endl; return 0; }27 int ?`m( const char16_t * m ) { sout | "mins" | m | endl; return 0;}28 int ?`h( const char32_t * h ) { sout | "hours" | h | endl; return 0; }29 int ?`_A_( const wchar_t * str ) { sout | "_A_" | str | endl; return 0; }30 int ?`__thingy_( const char * str ) { sout | "_thingy_" | str | endl; return 0; }26 int ?`s( const char * s ) { sout | "secs" | s; return 0; } 27 int ?`m( const char16_t * m ) { sout | "mins" | m; return 0;} 28 int ?`h( const char32_t * h ) { sout | "hours" | h; return 0; } 29 int ?`_A_( const wchar_t * str ) { sout | "_A_" | str; return 0; } 30 int ?`__thingy_( const char * str ) { sout | "_thingy_" | str; return 0; } 31 31 32 32 … … 46 46 Weight w, heavy = { 20 }; // 20 stone 47 47 w = 155`lb; 48 sout | w | endl;48 sout | w; 49 49 w = 0b_1111`st; 50 sout | w | endl;50 sout | w; 51 51 w = 0_233`lb; // octal weight (155) 52 sout | w | endl;52 sout | w; 53 53 w = 0x_9b_u`kg; 54 sout | w | endl;54 sout | w; 55 55 w = 70.3`kg; 56 sout | w | endl;56 sout | w; 57 57 w = 11`st + 1`lb; 58 sout | w | endl;58 sout | w; 59 59 w = 5`st + 8`kg + 25`lb + heavy; 60 sout | w | endl;60 sout | w; 61 61 62 62 // 0`secs; … … 90 90 // Local Variables: // 91 91 // tab-width: 4 // 92 // compile-command: "cfa user_literals.c " //92 // compile-command: "cfa user_literals.cfa" // 93 93 // End: // -
tests/variableDeclarator.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // variableDeclarator.c --7 // variableDeclarator.cfa -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:41:42 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 08:42:21 201613 // Update Count : 112 // Last Modified On : Tue Nov 6 18:02:16 2018 13 // Update Count : 2 14 14 // 15 15 … … 182 182 // Local Variables: // 183 183 // tab-width: 4 // 184 // compile-command: "cfa variableDeclarator.c " //184 // compile-command: "cfa variableDeclarator.cfa" // 185 185 // End: // -
tests/vector.cfa
r7951100 rb067d9b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // vector.c --7 // vector.cfa -- 8 8 // 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Jul 4 23:36:19 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jan 18 17:08:08201813 // Update Count : 2 712 // Last Modified On : Tue Dec 4 22:02:39 2018 13 // Update Count : 29 14 14 // 15 15 16 #include <fstream >17 #include <vector >16 #include <fstream.hfa> 17 #include <vector.hfa> 18 18 19 19 #undef assert … … 21 21 do { \ 22 22 if ( !(x) ) { \ 23 sout | "CHECK failed :" | #x | "at" | __FILE__ | " :" | __LINE__ | endl; \23 sout | "CHECK failed :" | #x | "at" | __FILE__ | " :" | __LINE__; \ 24 24 abort(); \ 25 25 } \ … … 31 31 assert( empty( &iv ) ); 32 32 assert( size( &iv ) == 0 ); 33 sout | size( &iv ) | endl;33 sout | size( &iv ); 34 34 35 35 push_back( &iv, 1 ); 36 36 assert( size( &iv ) == 1 ); 37 sout | size( &iv ) | endl;37 sout | size( &iv ); 38 38 39 39 push_back( &iv, 2 ); 40 40 assert( size( &iv ) == 2 ); 41 sout | size( &iv ) | endl;41 sout | size( &iv ); 42 42 43 43 push_back( &iv, 3 ); 44 44 assert( size( &iv ) == 3 ); 45 sout | size( &iv ) | endl;45 sout | size( &iv ); 46 46 47 47 assert( !empty( &iv ) ); … … 58 58 assert( empty( &iv ) ); 59 59 assert( size( &iv ) == 0 ); 60 sout | size( &iv ) | endl;60 sout | size( &iv ); 61 61 } 62 62 63 63 // Local Variables: // 64 64 // tab-width: 4 // 65 // compile-command: "cfa vector.c " //65 // compile-command: "cfa vector.cfa" // 66 66 // End: // -
tests/virtualCast.cfa
r7951100 rb067d9b 9 9 */ 10 10 11 #include <stdlib >11 #include <stdlib.hfa> 12 12 #include <assert.h> 13 13 -
tests/warnings/self-assignment.cfa
r7951100 rb067d9b 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Mar 1 13:53:57 2018 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Thu Mar 1 13:53:57 201813 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 20 07:56:17 2019 13 // Update Count : 3 14 14 // 15 15 16 16 struct S { 17 int i;17 int i; 18 18 }; 19 19 20 20 struct T { 21 S s;21 S s; 22 22 }; 23 23 24 24 int main() { 25 int j = 0;26 S s = { 0 };27 T t = { { 0 } };25 int j = 0; 26 S s = { 0 }; 27 T t = { { 0 } }; 28 28 29 j = j;30 s = s;31 s.i = s.i;32 t.s.i = t.s.i;29 j = j; 30 s = s; 31 s.i = s.i; 32 t.s.i = t.s.i; 33 33 } 34 34
Note:
See TracChangeset
for help on using the changeset viewer.