Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/Makefile.am	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -33,30 +33,21 @@
 CFACC = @CFACC@
 
-headers = fstream iostream iterator limits rational time stdlib common \
-	  containers/maybe containers/pair containers/result containers/vector
+#----------------------------------------------------------------------------------------------------------------
+headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
+	  containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
 
 # not all platforms support concurrency, add option do disable it
-headers += concurrency/coroutine concurrency/thread concurrency/kernel concurrency/monitor concurrency/mutex
+headers += concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
 
-libobjs = ${headers:=.o}
+libobjs = ${headers:.hfa=.o}
 libsrc = prelude.c startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa \
-	${headers:=.cfa}
+	${headers:.hfa=.cfa}
 
 # not all platforms support concurrency, add option do disable it
 libsrc += concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa
 
-# extensionless header files are overridden by -o flag in default makerule => explicitly override default rule to silently do nothing
-# SKULLDUGGERY in order to make sure this isn't called make the rule always fail but also create a rule for headers
-% : %.c
-	echo "Dummy rule, should never be called"
-	false
-
-# This rule should always match headers and since it has no prerequisite it will never be called
-$(addprefix $(srcdir)/,$(headers)):
-	echo "Dummy rule, should never be called"
-	false
-
-
-${libobjs} : ${cfalib_DATA} # add dependency to cfa-cpp so all libraries are rebuilt with new translator
+#----------------------------------------------------------------------------------------------------------------
+# add dependency to cfa-cpp so all libraries are rebuilt with new translator
+${libobjs} : ${cfalib_DATA}
 
 libcfa_a_SOURCES = ${libsrc}
@@ -65,19 +56,20 @@
 
 cfa_includedir = $(CFA_INCDIR)
-nobase_cfa_include_HEADERS = 	\
-	${headers}		\
-	${stdhdr}		\
-	math			\
-	gmp			\
-	time_t.h		\
-	bits/align.h 		\
-	bits/containers.h	\
-	bits/defs.h 		\
-	bits/debug.h 		\
-	bits/locks.h 		\
-	concurrency/invoke.h
+nobase_cfa_include_HEADERS = \
+	${headers}             \
+	${stdhdr}              \
+	math.hfa               \
+	gmp.hfa                \
+	time_t.hfa             \
+	bits/align.hfa         \
+	bits/containers.hfa    \
+	bits/defs.hfa          \
+	bits/debug.hfa         \
+	bits/locks.hfa         \
+	concurrency/invoke.hfa
 
-CLEANFILES = prelude.c
+MOSTLYCLEANFILES = prelude.c
 
+#----------------------------------------------------------------------------------------------------------------
 maintainer-clean-local:
 	-rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
Index: libcfa/src/assert.cfa
===================================================================
--- libcfa/src/assert.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/assert.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -17,5 +17,5 @@
 #include <stdarg.h>								// varargs
 #include <stdio.h>								// fprintf
-#include "bits/debug.h"
+#include "bits/debug.hfa"
 
 extern "C" {
Index: libcfa/src/bits/algorithm.hfa
===================================================================
--- libcfa/src/bits/algorithm.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/algorithm.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,191 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// bits/algorithms.hfa -- Builtins for exception handling.
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Oct 30 13:37:34 2017
+// Last Modified By : --
+// Last Modified On : --
+// Update Count     : 0
+//
+
+#pragma once
+
+#ifdef SAFE_SORT
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort2( T * arr );
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort3( T * arr );
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort4( T * arr );
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort5( T * arr );
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort6( T * arr );
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sortN( T * arr, size_t dim );
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sort( T * arr, size_t dim ) {
+	switch( dim ) {
+		case 1 : return;
+		case 2 : __libcfa_small_sort2( arr ); return;
+		case 3 : __libcfa_small_sort3( arr ); return;
+		case 4 : __libcfa_small_sort4( arr ); return;
+		case 5 : __libcfa_small_sort5( arr ); return;
+		case 6 : __libcfa_small_sort6( arr ); return;
+		default: __libcfa_small_sortN( arr, dim ); return;
+	}
+}
+
+#define min(x, y) (y > x ? x : y)
+#define max(x, y) (y > x ? y : x)
+#define SWAP(x,y) { T a = min(arr[x], arr[y]); T b = max(arr[x], arr[y]); arr[x] = a; arr[y] = b;}
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sort2( T * arr ) {
+	SWAP(0, 1);
+}
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sort3( T * arr ) {
+	SWAP(1, 2);
+	SWAP(0, 2);
+	SWAP(0, 1);
+}
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sort4( T * arr ) {
+	SWAP(0, 1);
+	SWAP(2, 3);
+	SWAP(0, 2);
+	SWAP(1, 3);
+	SWAP(1, 2);
+}
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sort5( T * arr ) {
+	SWAP(0, 1);
+	SWAP(3, 4);
+	SWAP(2, 4);
+	SWAP(2, 3);
+	SWAP(0, 3);
+	SWAP(0, 2);
+	SWAP(1, 4);
+	SWAP(1, 3);
+	SWAP(1, 2);
+}
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sort6( T * arr ) {
+	SWAP(1, 2);
+	SWAP(4, 5);
+	SWAP(0, 2);
+	SWAP(3, 5);
+	SWAP(0, 1);
+	SWAP(3, 4);
+	SWAP(1, 4);
+	SWAP(0, 3);
+	SWAP(2, 5);
+	SWAP(1, 3);
+	SWAP(2, 4);
+	SWAP(2, 3);
+}
+
+forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
+static inline void __libcfa_small_sortN( T * arr, size_t dim ) {
+	int i, j;
+	for (i = 1; i < dim; i++) {
+		T tmp = arr[i];
+		for (j = i; j >= 1 && tmp < arr[j-1]; j--) {
+			arr[j] = arr[j-1];
+		}
+		arr[j] = tmp;
+	}
+}
+
+#else
+
+static inline void __libcfa_small_sort2( void* * arr );
+static inline void __libcfa_small_sort3( void* * arr );
+static inline void __libcfa_small_sort4( void* * arr );
+static inline void __libcfa_small_sort5( void* * arr );
+static inline void __libcfa_small_sort6( void* * arr );
+static inline void __libcfa_small_sortN( void* * arr, size_t dim );
+
+forall( dtype T )
+static inline void __libcfa_small_sort( T* * arr, size_t dim ) {
+	switch( dim ) {
+		case 1 : return;
+		case 2 : __libcfa_small_sort2( (void **) arr ); return;
+		case 3 : __libcfa_small_sort3( (void **) arr ); return;
+		case 4 : __libcfa_small_sort4( (void **) arr ); return;
+		case 5 : __libcfa_small_sort5( (void **) arr ); return;
+		case 6 : __libcfa_small_sort6( (void **) arr ); return;
+		default: __libcfa_small_sortN( (void **) arr, dim ); return;
+	}
+}
+
+#define min(x, y) (y > x ? x : y)
+#define max(x, y) (y > x ? y : x)
+#define SWAP(x,y) { void* a = min(arr[x], arr[y]); void* b = max(arr[x], arr[y]); arr[x] = a; arr[y] = b;}
+
+static inline void __libcfa_small_sort2( void* * arr ) {
+	SWAP(0, 1);
+}
+
+static inline void __libcfa_small_sort3( void* * arr ) {
+	SWAP(1, 2);
+	SWAP(0, 2);
+	SWAP(0, 1);
+}
+
+static inline void __libcfa_small_sort4( void* * arr ) {
+	SWAP(0, 1);
+	SWAP(2, 3);
+	SWAP(0, 2);
+	SWAP(1, 3);
+	SWAP(1, 2);
+}
+
+static inline void __libcfa_small_sort5( void* * arr ) {
+	SWAP(0, 1);
+	SWAP(3, 4);
+	SWAP(2, 4);
+	SWAP(2, 3);
+	SWAP(0, 3);
+	SWAP(0, 2);
+	SWAP(1, 4);
+	SWAP(1, 3);
+	SWAP(1, 2);
+}
+
+static inline void __libcfa_small_sort6( void* * arr ) {
+	SWAP(1, 2);
+	SWAP(4, 5);
+	SWAP(0, 2);
+	SWAP(3, 5);
+	SWAP(0, 1);
+	SWAP(3, 4);
+	SWAP(1, 4);
+	SWAP(0, 3);
+	SWAP(2, 5);
+	SWAP(1, 3);
+	SWAP(2, 4);
+	SWAP(2, 3);
+}
+
+static inline void __libcfa_small_sortN( void* * arr, size_t dim ) {
+	int i, j;
+	for (i = 1; i < dim; i++) {
+		void* tmp = arr[i];
+		for (j = i; j >= 1 && tmp < arr[j-1]; j--) {
+			arr[j] = arr[j-1];
+		}
+		arr[j] = tmp;
+	}
+}
+
+#endif
+
+#undef SWAP
+#undef min
+#undef max
Index: libcfa/src/bits/algorithms.h
===================================================================
--- libcfa/src/bits/algorithms.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,191 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// bits/algorithms.h -- Builtins for exception handling.
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Oct 30 13:37:34 2017
-// Last Modified By : --
-// Last Modified On : --
-// Update Count     : 0
-//
-
-#pragma once
-
-#ifdef SAFE_SORT
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort2( T * arr );
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort3( T * arr );
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort4( T * arr );
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort5( T * arr );
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort6( T * arr );
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sortN( T * arr, size_t dim );
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sort( T * arr, size_t dim ) {
-	switch( dim ) {
-		case 1 : return;
-		case 2 : __libcfa_small_sort2( arr ); return;
-		case 3 : __libcfa_small_sort3( arr ); return;
-		case 4 : __libcfa_small_sort4( arr ); return;
-		case 5 : __libcfa_small_sort5( arr ); return;
-		case 6 : __libcfa_small_sort6( arr ); return;
-		default: __libcfa_small_sortN( arr, dim ); return;
-	}
-}
-
-#define min(x, y) (y > x ? x : y)
-#define max(x, y) (y > x ? y : x)
-#define SWAP(x,y) { T a = min(arr[x], arr[y]); T b = max(arr[x], arr[y]); arr[x] = a; arr[y] = b;}
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sort2( T * arr ) {
-	SWAP(0, 1);
-}
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sort3( T * arr ) {
-	SWAP(1, 2);
-	SWAP(0, 2);
-	SWAP(0, 1);
-}
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sort4( T * arr ) {
-	SWAP(0, 1);
-	SWAP(2, 3);
-	SWAP(0, 2);
-	SWAP(1, 3);
-	SWAP(1, 2);
-}
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sort5( T * arr ) {
-	SWAP(0, 1);
-	SWAP(3, 4);
-	SWAP(2, 4);
-	SWAP(2, 3);
-	SWAP(0, 3);
-	SWAP(0, 2);
-	SWAP(1, 4);
-	SWAP(1, 3);
-	SWAP(1, 2);
-}
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sort6( T * arr ) {
-	SWAP(1, 2);
-	SWAP(4, 5);
-	SWAP(0, 2);
-	SWAP(3, 5);
-	SWAP(0, 1);
-	SWAP(3, 4);
-	SWAP(1, 4);
-	SWAP(0, 3);
-	SWAP(2, 5);
-	SWAP(1, 3);
-	SWAP(2, 4);
-	SWAP(2, 3);
-}
-
-forall( otype T | {  int ?<?( T, T ); int ?>?( T, T ); } )
-static inline void __libcfa_small_sortN( T * arr, size_t dim ) {
-	int i, j;
-	for (i = 1; i < dim; i++) {
-		T tmp = arr[i];
-		for (j = i; j >= 1 && tmp < arr[j-1]; j--) {
-			arr[j] = arr[j-1];
-		}
-		arr[j] = tmp;
-	}
-}
-
-#else
-
-static inline void __libcfa_small_sort2( void* * arr );
-static inline void __libcfa_small_sort3( void* * arr );
-static inline void __libcfa_small_sort4( void* * arr );
-static inline void __libcfa_small_sort5( void* * arr );
-static inline void __libcfa_small_sort6( void* * arr );
-static inline void __libcfa_small_sortN( void* * arr, size_t dim );
-
-forall( dtype T )
-static inline void __libcfa_small_sort( T* * arr, size_t dim ) {
-	switch( dim ) {
-		case 1 : return;
-		case 2 : __libcfa_small_sort2( (void **) arr ); return;
-		case 3 : __libcfa_small_sort3( (void **) arr ); return;
-		case 4 : __libcfa_small_sort4( (void **) arr ); return;
-		case 5 : __libcfa_small_sort5( (void **) arr ); return;
-		case 6 : __libcfa_small_sort6( (void **) arr ); return;
-		default: __libcfa_small_sortN( (void **) arr, dim ); return;
-	}
-}
-
-#define min(x, y) (y > x ? x : y)
-#define max(x, y) (y > x ? y : x)
-#define SWAP(x,y) { void* a = min(arr[x], arr[y]); void* b = max(arr[x], arr[y]); arr[x] = a; arr[y] = b;}
-
-static inline void __libcfa_small_sort2( void* * arr ) {
-	SWAP(0, 1);
-}
-
-static inline void __libcfa_small_sort3( void* * arr ) {
-	SWAP(1, 2);
-	SWAP(0, 2);
-	SWAP(0, 1);
-}
-
-static inline void __libcfa_small_sort4( void* * arr ) {
-	SWAP(0, 1);
-	SWAP(2, 3);
-	SWAP(0, 2);
-	SWAP(1, 3);
-	SWAP(1, 2);
-}
-
-static inline void __libcfa_small_sort5( void* * arr ) {
-	SWAP(0, 1);
-	SWAP(3, 4);
-	SWAP(2, 4);
-	SWAP(2, 3);
-	SWAP(0, 3);
-	SWAP(0, 2);
-	SWAP(1, 4);
-	SWAP(1, 3);
-	SWAP(1, 2);
-}
-
-static inline void __libcfa_small_sort6( void* * arr ) {
-	SWAP(1, 2);
-	SWAP(4, 5);
-	SWAP(0, 2);
-	SWAP(3, 5);
-	SWAP(0, 1);
-	SWAP(3, 4);
-	SWAP(1, 4);
-	SWAP(0, 3);
-	SWAP(2, 5);
-	SWAP(1, 3);
-	SWAP(2, 4);
-	SWAP(2, 3);
-}
-
-static inline void __libcfa_small_sortN( void* * arr, size_t dim ) {
-	int i, j;
-	for (i = 1; i < dim; i++) {
-		void* tmp = arr[i];
-		for (j = i; j >= 1 && tmp < arr[j-1]; j--) {
-			arr[j] = arr[j-1];
-		}
-		arr[j] = tmp;
-	}
-}
-
-#endif
-
-#undef SWAP
-#undef min
-#undef max
Index: libcfa/src/bits/align.h
===================================================================
--- libcfa/src/bits/align.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,62 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// align.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Nov 28 12:27:26 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 21 23:05:35 2017
-// Update Count     : 2
-//
-// This  library is free  software; you  can redistribute  it and/or  modify it
-// under the terms of the GNU Lesser General Public License as published by the
-// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
-// option) any later version.
-//
-// This library is distributed in the  hope that it will be useful, but WITHOUT
-// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
-// for more details.
-//
-// You should  have received a  copy of the  GNU Lesser General  Public License
-// along  with this library.
-//
-
-#pragma once
-
-#include <assert.h>
-#include <stdbool.h>
-
-// Minimum size used to align memory boundaries for memory allocations.
-#define libAlign() (sizeof(double))
-
-// Check for power of 2
-static inline bool libPow2( unsigned long int value ) {
-    // clears all bits below value, rounding value down to the next lower multiple of value
-    return (value & (value - 1ul)) == 0ul;
-} // libPow2
-
-
-// Returns value aligned at the floor of align.
-static inline unsigned long int libFloor( unsigned long int value, unsigned long int align ) {
-    assert( libPow2( align ) );
-    // clears all bits above or equal to align, getting (value % align), the phase of value with regards to align
-    return value & -align;
-} // libFloor
-
-
-// Returns value aligned at the ceiling of align.
-
-static inline unsigned long int libCeiling( unsigned long int value, unsigned long int align ) {
-    assert( libPow2( align ) );
-    // "negate, round down, negate" is the same as round up
-    return -libFloor( -value, align );
-} // uCeiling
-
-// Local Variables: //
-// compile-command: "make install" //
-// End: //
Index: libcfa/src/bits/align.hfa
===================================================================
--- libcfa/src/bits/align.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/align.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,62 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// align.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Nov 28 12:27:26 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Jul 21 23:05:35 2017
+// Update Count     : 2
+//
+// This  library is free  software; you  can redistribute  it and/or  modify it
+// under the terms of the GNU Lesser General Public License as published by the
+// Free Software  Foundation; either  version 2.1 of  the License, or  (at your
+// option) any later version.
+//
+// This library is distributed in the  hope that it will be useful, but WITHOUT
+// ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+// for more details.
+//
+// You should  have received a  copy of the  GNU Lesser General  Public License
+// along  with this library.
+//
+
+#pragma once
+
+#include <assert.h>
+#include <stdbool.h>
+
+// Minimum size used to align memory boundaries for memory allocations.
+#define libAlign() (sizeof(double))
+
+// Check for power of 2
+static inline bool libPow2( unsigned long int value ) {
+    // clears all bits below value, rounding value down to the next lower multiple of value
+    return (value & (value - 1ul)) == 0ul;
+} // libPow2
+
+
+// Returns value aligned at the floor of align.
+static inline unsigned long int libFloor( unsigned long int value, unsigned long int align ) {
+    assert( libPow2( align ) );
+    // clears all bits above or equal to align, getting (value % align), the phase of value with regards to align
+    return value & -align;
+} // libFloor
+
+
+// Returns value aligned at the ceiling of align.
+
+static inline unsigned long int libCeiling( unsigned long int value, unsigned long int align ) {
+    assert( libPow2( align ) );
+    // "negate, round down, negate" is the same as round up
+    return -libFloor( -value, align );
+} // uCeiling
+
+// Local Variables: //
+// compile-command: "make install" //
+// End: //
Index: libcfa/src/bits/containers.h
===================================================================
--- libcfa/src/bits/containers.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,282 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// bits/containers.h -- Intrusive generic containers.h
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Oct 31 16:38:50 2017
-// Last Modified By : --
-// Last Modified On : --
-// Update Count     : 0
-
-#pragma once
-
-#include "bits/align.h"
-#include "bits/defs.h"
-
-//-----------------------------------------------------------------------------
-// Array
-//-----------------------------------------------------------------------------
-
-#ifdef __cforall
-	forall(dtype T)
-#else
-	#define T void
-#endif
-struct __small_array {
-	T *           data;
-	__lock_size_t size;
-};
-#undef T
-
-#ifdef __cforall
-	#define __small_array_t(T) __small_array(T)
-#else
-	#define __small_array_t(T) struct __small_array
-#endif
-
-#ifdef __cforall
-	// forall(otype T | sized(T))
-	// static inline void ?{}(__small_array(T) & this) {}
-
-	forall(dtype T | sized(T))
-	static inline T& ?[?]( __small_array(T) & this, __lock_size_t idx) {
-		return ((typeof(this.data))this.data)[idx];
-	}
-
-	forall(dtype T | sized(T))
-	static inline T& ?[?]( const __small_array(T) & this, __lock_size_t idx) {
-		return ((typeof(this.data))this.data)[idx];
-	}
-
-	forall(dtype T | sized(T))
-	static inline T* begin( const __small_array(T) & this ) {
-		return ((typeof(this.data))this.data);
-	}
-
-	forall(dtype T | sized(T))
-	static inline T* end( const __small_array(T) & this ) {
-		return ((typeof(this.data))this.data) + this.size;
-	}
-#endif
-
-//-----------------------------------------------------------------------------
-// Node Base
-//-----------------------------------------------------------------------------
-
-#ifdef __cforall
-	trait is_node(dtype T) {
-		T*& get_next( T& );
-	};
-#endif
-
-//-----------------------------------------------------------------------------
-// Stack
-//-----------------------------------------------------------------------------
-#ifdef __cforall
-	forall(dtype TYPE | is_node(TYPE))
-	#define T TYPE
-#else
-	#define T void
-#endif
-struct __stack {
-	T * top;
-};
-#undef T
-
-#ifdef __cforall
-#define __stack_t(T) __stack(T)
-#else
-#define __stack_t(T) struct __stack
-#endif
-
-#ifdef __cforall
-	forall(dtype T | is_node(T))
-	static inline void ?{}( __stack(T) & this ) {
-		(this.top){ NULL };
-	}
-
-	forall(dtype T | is_node(T) | sized(T))
-	static inline void push( __stack(T) & this, T * val ) {
-		verify( !get_next( *val ) );
-		get_next( *val ) = this.top;
-		this.top = val;
-	}
-
-	forall(dtype T | is_node(T) | sized(T))
-	static inline T * pop( __stack(T) & this ) {
-		T * top = this.top;
-		if( top ) {
-			this.top = get_next( *top );
-			get_next( *top ) = NULL;
-		}
-		return top;
-	}
-#endif
-
-//-----------------------------------------------------------------------------
-// Queue
-//-----------------------------------------------------------------------------
-#ifdef __cforall
-	forall(dtype TYPE | is_node(TYPE))
-	#define T TYPE
-#else
-	#define T void
-#endif
-struct __queue {
-	T * head;
-	T ** tail;
-};
-#undef T
-
-#ifdef __cforall
-#define __queue_t(T) __queue(T)
-#else
-#define __queue_t(T) struct __queue
-#endif
-
-#ifdef __cforall
-
-	forall(dtype T | is_node(T))
-	static inline void ?{}( __queue(T) & this ) with( this ) {
-		head{ NULL };
-		tail{ &head };
-	}
-
-	forall(dtype T | is_node(T) | sized(T))
-	static inline void append( __queue(T) & this, T * val ) with( this ) {
-		verify(tail != NULL);
-		*tail = val;
-		tail = &get_next( *val );
-	}
-
-	forall(dtype T | is_node(T) | sized(T))
-	static inline T * pop_head( __queue(T) & this ) {
-		T * head = this.head;
-		if( head ) {
-			this.head = get_next( *head );
-			if( !get_next( *head ) ) {
-				this.tail = &this.head;
-			}
-			get_next( *head ) = NULL;
-		}
-		return head;
-	}
-
-	forall(dtype T | is_node(T) | sized(T))
-	static inline T * remove( __queue(T) & this, T ** it ) with( this ) {
-		T * val = *it;
-		verify( val );
-
-		(*it) = get_next( *val );
-
-		if( tail == &get_next( *val ) ) {
-			tail = it;
-		}
-
-		get_next( *val ) = NULL;
-
-		verify( (head == NULL) == (&head == tail) );
-		verify( *tail == NULL );
-		return val;
-	}
-
-	forall(dtype T | is_node(T))
-	static inline bool ?!=?( __queue(T) & this, zero_t zero ) {
-		return this.head != 0;
-	}
-#endif
-
-
-//-----------------------------------------------------------------------------
-// Doubly Linked List
-//-----------------------------------------------------------------------------
-#ifdef __cforall
-	forall(dtype TYPE | sized(TYPE))
-	#define T TYPE
-	#define __getter_t * [T * & next, T * & prev] ( T & )
-#else
-	typedef void (*__generit_c_getter_t)();
-	#define T void
-	#define __getter_t __generit_c_getter_t
-#endif
-struct __dllist {
-	T * head;
-	__getter_t __get;
-};
-#undef T
-#undef __getter_t
-
-#ifdef __cforall
-#define __dllist_t(T) __dllist(T)
-#else
-#define __dllist_t(T) struct __dllist
-#endif
-
-#ifdef __cforall
-
-	forall(dtype T | sized(T))
-	static inline [void] ?{}( __dllist(T) & this, * [T * & next, T * & prev] ( T & ) __get ) {
-		this.head{ NULL };
-		this.__get = __get;
-	}
-
-	#define next 0
-	#define prev 1
-	forall(dtype T | sized(T))
-	static inline void push_front( __dllist(T) & this, T & node ) with( this ) {
-		verify(__get);
-		if ( head ) {
-			__get( node ).next = head;
-			__get( node ).prev = __get( *head ).prev;
-			// inserted node must be consistent before it is seen
-			// prevent code movement across barrier
-			asm( "" : : : "memory" );
-			__get( *head ).prev = &node;
-			T & _prev = *__get( node ).prev;
-			__get( _prev ).next = &node;
-		}
-		else {
-			__get( node ).next = &node;
-			__get( node ).prev = &node;
-		}
-
-		// prevent code movement across barrier
-		asm( "" : : : "memory" );
-		head = &node;
-	}
-
-	forall(dtype T | sized(T))
-	static inline void remove( __dllist(T) & this, T & node ) with( this ) {
-		verify(__get);
-		if ( &node == head ) {
-			if ( __get( *head ).next == head ) {
-				head = NULL;
-			}
-			else {
-				head = __get( *head ).next;
-			}
-		}
-		__get( *__get( node ).next ).prev = __get( node ).prev;
-		__get( *__get( node ).prev ).next = __get( node ).next;
-		__get( node ).next = NULL;
-		__get( node ).prev = NULL;
-	}
-
-	forall(dtype T | sized(T))
-	static inline bool ?!=?( __dllist(T) & this, zero_t zero ) {
-		return this.head != 0;
-	}
-	#undef next
-	#undef prev
-#endif
-
-//-----------------------------------------------------------------------------
-// Tools
-//-----------------------------------------------------------------------------
-#ifdef __cforall
-
-#endif
Index: libcfa/src/bits/containers.hfa
===================================================================
--- libcfa/src/bits/containers.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/containers.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,282 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// bits/containers.hfa -- Intrusive generic containers.hfa
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Oct 31 16:38:50 2017
+// Last Modified By : --
+// Last Modified On : --
+// Update Count     : 0
+
+#pragma once
+
+#include "bits/align.hfa"
+#include "bits/defs.hfa"
+
+//-----------------------------------------------------------------------------
+// Array
+//-----------------------------------------------------------------------------
+
+#ifdef __cforall
+	forall(dtype T)
+#else
+	#define T void
+#endif
+struct __small_array {
+	T *           data;
+	__lock_size_t size;
+};
+#undef T
+
+#ifdef __cforall
+	#define __small_array_t(T) __small_array(T)
+#else
+	#define __small_array_t(T) struct __small_array
+#endif
+
+#ifdef __cforall
+	// forall(otype T | sized(T))
+	// static inline void ?{}(__small_array(T) & this) {}
+
+	forall(dtype T | sized(T))
+	static inline T& ?[?]( __small_array(T) & this, __lock_size_t idx) {
+		return ((typeof(this.data))this.data)[idx];
+	}
+
+	forall(dtype T | sized(T))
+	static inline T& ?[?]( const __small_array(T) & this, __lock_size_t idx) {
+		return ((typeof(this.data))this.data)[idx];
+	}
+
+	forall(dtype T | sized(T))
+	static inline T* begin( const __small_array(T) & this ) {
+		return ((typeof(this.data))this.data);
+	}
+
+	forall(dtype T | sized(T))
+	static inline T* end( const __small_array(T) & this ) {
+		return ((typeof(this.data))this.data) + this.size;
+	}
+#endif
+
+//-----------------------------------------------------------------------------
+// Node Base
+//-----------------------------------------------------------------------------
+
+#ifdef __cforall
+	trait is_node(dtype T) {
+		T*& get_next( T& );
+	};
+#endif
+
+//-----------------------------------------------------------------------------
+// Stack
+//-----------------------------------------------------------------------------
+#ifdef __cforall
+	forall(dtype TYPE | is_node(TYPE))
+	#define T TYPE
+#else
+	#define T void
+#endif
+struct __stack {
+	T * top;
+};
+#undef T
+
+#ifdef __cforall
+#define __stack_t(T) __stack(T)
+#else
+#define __stack_t(T) struct __stack
+#endif
+
+#ifdef __cforall
+	forall(dtype T | is_node(T))
+	static inline void ?{}( __stack(T) & this ) {
+		(this.top){ NULL };
+	}
+
+	forall(dtype T | is_node(T) | sized(T))
+	static inline void push( __stack(T) & this, T * val ) {
+		verify( !get_next( *val ) );
+		get_next( *val ) = this.top;
+		this.top = val;
+	}
+
+	forall(dtype T | is_node(T) | sized(T))
+	static inline T * pop( __stack(T) & this ) {
+		T * top = this.top;
+		if( top ) {
+			this.top = get_next( *top );
+			get_next( *top ) = NULL;
+		}
+		return top;
+	}
+#endif
+
+//-----------------------------------------------------------------------------
+// Queue
+//-----------------------------------------------------------------------------
+#ifdef __cforall
+	forall(dtype TYPE | is_node(TYPE))
+	#define T TYPE
+#else
+	#define T void
+#endif
+struct __queue {
+	T * head;
+	T ** tail;
+};
+#undef T
+
+#ifdef __cforall
+#define __queue_t(T) __queue(T)
+#else
+#define __queue_t(T) struct __queue
+#endif
+
+#ifdef __cforall
+
+	forall(dtype T | is_node(T))
+	static inline void ?{}( __queue(T) & this ) with( this ) {
+		head{ NULL };
+		tail{ &head };
+	}
+
+	forall(dtype T | is_node(T) | sized(T))
+	static inline void append( __queue(T) & this, T * val ) with( this ) {
+		verify(tail != NULL);
+		*tail = val;
+		tail = &get_next( *val );
+	}
+
+	forall(dtype T | is_node(T) | sized(T))
+	static inline T * pop_head( __queue(T) & this ) {
+		T * head = this.head;
+		if( head ) {
+			this.head = get_next( *head );
+			if( !get_next( *head ) ) {
+				this.tail = &this.head;
+			}
+			get_next( *head ) = NULL;
+		}
+		return head;
+	}
+
+	forall(dtype T | is_node(T) | sized(T))
+	static inline T * remove( __queue(T) & this, T ** it ) with( this ) {
+		T * val = *it;
+		verify( val );
+
+		(*it) = get_next( *val );
+
+		if( tail == &get_next( *val ) ) {
+			tail = it;
+		}
+
+		get_next( *val ) = NULL;
+
+		verify( (head == NULL) == (&head == tail) );
+		verify( *tail == NULL );
+		return val;
+	}
+
+	forall(dtype T | is_node(T))
+	static inline bool ?!=?( __queue(T) & this, zero_t zero ) {
+		return this.head != 0;
+	}
+#endif
+
+
+//-----------------------------------------------------------------------------
+// Doubly Linked List
+//-----------------------------------------------------------------------------
+#ifdef __cforall
+	forall(dtype TYPE | sized(TYPE))
+	#define T TYPE
+	#define __getter_t * [T * & next, T * & prev] ( T & )
+#else
+	typedef void (*__generit_c_getter_t)();
+	#define T void
+	#define __getter_t __generit_c_getter_t
+#endif
+struct __dllist {
+	T * head;
+	__getter_t __get;
+};
+#undef T
+#undef __getter_t
+
+#ifdef __cforall
+#define __dllist_t(T) __dllist(T)
+#else
+#define __dllist_t(T) struct __dllist
+#endif
+
+#ifdef __cforall
+
+	forall(dtype T | sized(T))
+	static inline [void] ?{}( __dllist(T) & this, * [T * & next, T * & prev] ( T & ) __get ) {
+		this.head{ NULL };
+		this.__get = __get;
+	}
+
+	#define next 0
+	#define prev 1
+	forall(dtype T | sized(T))
+	static inline void push_front( __dllist(T) & this, T & node ) with( this ) {
+		verify(__get);
+		if ( head ) {
+			__get( node ).next = head;
+			__get( node ).prev = __get( *head ).prev;
+			// inserted node must be consistent before it is seen
+			// prevent code movement across barrier
+			asm( "" : : : "memory" );
+			__get( *head ).prev = &node;
+			T & _prev = *__get( node ).prev;
+			__get( _prev ).next = &node;
+		}
+		else {
+			__get( node ).next = &node;
+			__get( node ).prev = &node;
+		}
+
+		// prevent code movement across barrier
+		asm( "" : : : "memory" );
+		head = &node;
+	}
+
+	forall(dtype T | sized(T))
+	static inline void remove( __dllist(T) & this, T & node ) with( this ) {
+		verify(__get);
+		if ( &node == head ) {
+			if ( __get( *head ).next == head ) {
+				head = NULL;
+			}
+			else {
+				head = __get( *head ).next;
+			}
+		}
+		__get( *__get( node ).next ).prev = __get( node ).prev;
+		__get( *__get( node ).prev ).next = __get( node ).next;
+		__get( node ).next = NULL;
+		__get( node ).prev = NULL;
+	}
+
+	forall(dtype T | sized(T))
+	static inline bool ?!=?( __dllist(T) & this, zero_t zero ) {
+		return this.head != 0;
+	}
+	#undef next
+	#undef prev
+#endif
+
+//-----------------------------------------------------------------------------
+// Tools
+//-----------------------------------------------------------------------------
+#ifdef __cforall
+
+#endif
Index: libcfa/src/bits/debug.h
===================================================================
--- libcfa/src/bits/debug.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,74 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// debug.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Nov 28 12:27:26 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Feb  8 12:35:19 2018
-// Update Count     : 2
-//
-
-#pragma once
-
-#ifdef __CFA_DEBUG__
-	#define __cfaabi_dbg_debug_do(...) __VA_ARGS__
-	#define __cfaabi_dbg_no_debug_do(...)
-	#define __cfaabi_dbg_ctx __PRETTY_FUNCTION__
-	#define __cfaabi_dbg_ctx2 , __PRETTY_FUNCTION__
-	#define __cfaabi_dbg_ctx_param const char * caller
-	#define __cfaabi_dbg_ctx_param2 , const char * caller
-#else
-	#define __cfaabi_dbg_debug_do(...)
-	#define __cfaabi_dbg_no_debug_do(...) __VA_ARGS__
-	#define __cfaabi_dbg_ctx
-	#define __cfaabi_dbg_ctx2
-	#define __cfaabi_dbg_ctx_param
-	#define __cfaabi_dbg_ctx_param2
-#endif
-
-#ifdef __cforall
-extern "C" {
-#endif
-	#include <stdarg.h>
-	#include <stdio.h>
-
-      extern void __cfaabi_dbg_bits_write( const char *buffer, int len );
-      extern void __cfaabi_dbg_bits_acquire();
-      extern void __cfaabi_dbg_bits_release();
-      extern void __cfaabi_dbg_bits_print_safe  ( const char fmt[], ... ) __attribute__(( format(printf, 1, 2) ));
-      extern void __cfaabi_dbg_bits_print_nolock( const char fmt[], ... ) __attribute__(( format(printf, 1, 2) ));
-      extern void __cfaabi_dbg_bits_print_vararg( const char fmt[], va_list arg );
-      extern void __cfaabi_dbg_bits_print_buffer( char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format(printf, 3, 4) ));
-#ifdef __cforall
-}
-#endif
-
-#ifdef __CFA_DEBUG_PRINT__
-	#define __cfaabi_dbg_write( buffer, len )         __cfaabi_dbg_bits_write( buffer, len )
-	#define __cfaabi_dbg_acquire()                    __cfaabi_dbg_bits_acquire()
-	#define __cfaabi_dbg_release()                    __cfaabi_dbg_bits_release()
-	#define __cfaabi_dbg_print_safe(...)              __cfaabi_dbg_bits_print_safe   (__VA_ARGS__)
-	#define __cfaabi_dbg_print_nolock(...)            __cfaabi_dbg_bits_print_nolock (__VA_ARGS__)
-	#define __cfaabi_dbg_print_buffer(...)            __cfaabi_dbg_bits_print_buffer (__VA_ARGS__)
-	#define __cfaabi_dbg_print_buffer_decl(...)       char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_bits_write( __dbg_text, __dbg_len );
-	#define __cfaabi_dbg_print_buffer_local(...)      __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_bits_write( __dbg_text, __dbg_len );
-#else
-	#define __cfaabi_dbg_write(...)               ((void)0)
-	#define __cfaabi_dbg_acquire()                ((void)0)
-	#define __cfaabi_dbg_release()                ((void)0)
-	#define __cfaabi_dbg_print_safe(...)          ((void)0)
-	#define __cfaabi_dbg_print_nolock(...)        ((void)0)
-	#define __cfaabi_dbg_print_buffer(...)        ((void)0)
-	#define __cfaabi_dbg_print_buffer_decl(...)   ((void)0)
-	#define __cfaabi_dbg_print_buffer_local(...)  ((void)0)
-#endif
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/bits/debug.hfa
===================================================================
--- libcfa/src/bits/debug.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/debug.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,74 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// debug.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Nov 28 12:27:26 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Feb  8 12:35:19 2018
+// Update Count     : 2
+//
+
+#pragma once
+
+#ifdef __CFA_DEBUG__
+	#define __cfaabi_dbg_debug_do(...) __VA_ARGS__
+	#define __cfaabi_dbg_no_debug_do(...)
+	#define __cfaabi_dbg_ctx __PRETTY_FUNCTION__
+	#define __cfaabi_dbg_ctx2 , __PRETTY_FUNCTION__
+	#define __cfaabi_dbg_ctx_param const char * caller
+	#define __cfaabi_dbg_ctx_param2 , const char * caller
+#else
+	#define __cfaabi_dbg_debug_do(...)
+	#define __cfaabi_dbg_no_debug_do(...) __VA_ARGS__
+	#define __cfaabi_dbg_ctx
+	#define __cfaabi_dbg_ctx2
+	#define __cfaabi_dbg_ctx_param
+	#define __cfaabi_dbg_ctx_param2
+#endif
+
+#ifdef __cforall
+extern "C" {
+#endif
+	#include <stdarg.h>
+	#include <stdio.h>
+
+      extern void __cfaabi_dbg_bits_write( const char *buffer, int len );
+      extern void __cfaabi_dbg_bits_acquire();
+      extern void __cfaabi_dbg_bits_release();
+      extern void __cfaabi_dbg_bits_print_safe  ( const char fmt[], ... ) __attribute__(( format(printf, 1, 2) ));
+      extern void __cfaabi_dbg_bits_print_nolock( const char fmt[], ... ) __attribute__(( format(printf, 1, 2) ));
+      extern void __cfaabi_dbg_bits_print_vararg( const char fmt[], va_list arg );
+      extern void __cfaabi_dbg_bits_print_buffer( char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format(printf, 3, 4) ));
+#ifdef __cforall
+}
+#endif
+
+#ifdef __CFA_DEBUG_PRINT__
+	#define __cfaabi_dbg_write( buffer, len )         __cfaabi_dbg_bits_write( buffer, len )
+	#define __cfaabi_dbg_acquire()                    __cfaabi_dbg_bits_acquire()
+	#define __cfaabi_dbg_release()                    __cfaabi_dbg_bits_release()
+	#define __cfaabi_dbg_print_safe(...)              __cfaabi_dbg_bits_print_safe   (__VA_ARGS__)
+	#define __cfaabi_dbg_print_nolock(...)            __cfaabi_dbg_bits_print_nolock (__VA_ARGS__)
+	#define __cfaabi_dbg_print_buffer(...)            __cfaabi_dbg_bits_print_buffer (__VA_ARGS__)
+	#define __cfaabi_dbg_print_buffer_decl(...)       char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_bits_write( __dbg_text, __dbg_len );
+	#define __cfaabi_dbg_print_buffer_local(...)      __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_bits_write( __dbg_text, __dbg_len );
+#else
+	#define __cfaabi_dbg_write(...)               ((void)0)
+	#define __cfaabi_dbg_acquire()                ((void)0)
+	#define __cfaabi_dbg_release()                ((void)0)
+	#define __cfaabi_dbg_print_safe(...)          ((void)0)
+	#define __cfaabi_dbg_print_nolock(...)        ((void)0)
+	#define __cfaabi_dbg_print_buffer(...)        ((void)0)
+	#define __cfaabi_dbg_print_buffer_decl(...)   ((void)0)
+	#define __cfaabi_dbg_print_buffer_local(...)  ((void)0)
+#endif
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/bits/defs.h
===================================================================
--- libcfa/src/bits/defs.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,42 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// defs.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Thu Nov  9 13:24:10 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Feb  8 16:22:41 2018
-// Update Count     : 8
-//
-
-#pragma once
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define likely(x)   __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#define thread_local _Thread_local
-
-typedef void (*fptr_t)();
-typedef int_fast16_t __lock_size_t;
-
-#ifdef __cforall
-#define __cfa_anonymous_object(x) inline struct x
-#else
-#define __cfa_anonymous_object(x) x __cfa_anonymous_object
-#endif
-
-#ifdef __cforall
-void abort ( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
-extern "C" {
-#endif
-void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
-#ifdef __cforall
-}
-#endif
Index: libcfa/src/bits/defs.hfa
===================================================================
--- libcfa/src/bits/defs.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/defs.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,42 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// defs.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Thu Nov  9 13:24:10 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Feb  8 16:22:41 2018
+// Update Count     : 8
+//
+
+#pragma once
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#define likely(x)   __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#define thread_local _Thread_local
+
+typedef void (*fptr_t)();
+typedef int_fast16_t __lock_size_t;
+
+#ifdef __cforall
+#define __cfa_anonymous_object(x) inline struct x
+#else
+#define __cfa_anonymous_object(x) x __cfa_anonymous_object
+#endif
+
+#ifdef __cforall
+void abort ( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
+extern "C" {
+#endif
+void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
+#ifdef __cforall
+}
+#endif
Index: libcfa/src/bits/locks.h
===================================================================
--- libcfa/src/bits/locks.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,165 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// bits/locks.h -- Fast internal locks.
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Oct 31 15:14:38 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Mar 30 18:18:13 2018
-// Update Count     : 9
-//
-
-#pragma once
-
-#include "bits/debug.h"
-#include "bits/defs.h"
-#include <assert.h>
-
-#ifdef __cforall
-	extern "C" {
-		#include <pthread.h>
-	}
-#endif
-
-// pause to prevent excess processor bus usage
-#if defined( __sparc )
-	#define Pause() __asm__ __volatile__ ( "rd %ccr,%g0" )
-#elif defined( __i386 ) || defined( __x86_64 )
-	#define Pause() __asm__ __volatile__ ( "pause" : : : )
-#elif defined( __ARM_ARCH )
-	#define Pause() __asm__ __volatile__ ( "nop" : : : )
-#else
-	#error unsupported architecture
-#endif
-
-#if defined( __i386 ) || defined( __x86_64 ) || defined( __ARM_ARCH )
-	// Intel recommendation
-	#define __ALIGN__ __attribute__(( aligned (128) ))
-#elif defined( __sparc )
-	#define __ALIGN__ CALIGN
-#else
-	#error unsupported architecture
-#endif
-
-struct __spinlock_t {
-	// Wrap in struct to prevent false sharing with debug info
-	struct {
-		// Align lock on 128-bit boundary
-		__ALIGN__ volatile _Bool lock;
-	};
-	#ifdef __CFA_DEBUG__
-		// previous function to acquire the lock
-		const char * prev_name;
-		// previous thread to acquire the lock
-		void* prev_thrd;
-	#endif
-} __ALIGN__;
-
-#ifdef __cforall
-	extern "C" {
-		extern void disable_interrupts();
-		extern void enable_interrupts_noPoll();
-	}
-
-	extern void yield( unsigned int );
-
-	static inline void ?{}( __spinlock_t & this ) {
-		this.lock = 0;
-	}
-
-
-	#ifdef __CFA_DEBUG__
-		void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name);
-	#else
-		#define __cfaabi_dbg_record(x, y)
-	#endif
-
-	// Lock the spinlock, return false if already acquired
-	static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
-		_Bool result = (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0);
-		if( result ) {
-			disable_interrupts();
-			__cfaabi_dbg_record( this, caller );
-		}
-		return result;
-	}
-
-	// Lock the spinlock, spin if already acquired
-	static inline void lock( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
-		#ifndef NOEXPBACK
-			enum { SPIN_START = 4, SPIN_END = 64 * 1024, };
-			unsigned int spin = SPIN_START;
-		#endif
-
-		for ( unsigned int i = 1;; i += 1 ) {
-			if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break;
-			#ifndef NOEXPBACK
-				// exponential spin
-				for ( volatile unsigned int s = 0; s < spin; s += 1 ) Pause();
-
-				// slowly increase by powers of 2
-				if ( i % 64 == 0 ) spin += spin;
-
-				// prevent overflow
-				if ( spin > SPIN_END ) spin = SPIN_START;
-			#else
-				Pause();
-			#endif
-		}
-		disable_interrupts();
-		__cfaabi_dbg_record( this, caller );
-	}
-
-	static inline void unlock( __spinlock_t & this ) {
-		enable_interrupts_noPoll();
-		__atomic_clear( &this.lock, __ATOMIC_RELEASE );
-	}
-
-
-	#ifdef __CFA_WITH_VERIFY__
-		extern bool __cfaabi_dbg_in_kernel();
-	#endif
-
-	struct __bin_sem_t {
-		bool     		signaled;
-		pthread_mutex_t 	lock;
-		pthread_cond_t  	cond;
-	};
-
-	static inline void ?{}(__bin_sem_t & this) with( this ) {
-		signaled = false;
-		pthread_mutex_init(&lock, NULL);
-		pthread_cond_init (&cond, NULL);
-	}
-
-	static inline void ^?{}(__bin_sem_t & this) with( this ) {
-		pthread_mutex_destroy(&lock);
-		pthread_cond_destroy (&cond);
-	}
-
-	static inline void wait(__bin_sem_t & this) with( this ) {
-		verify(__cfaabi_dbg_in_kernel());
-		pthread_mutex_lock(&lock);
-			if(!signaled) {   // this must be a loop, not if!
-				pthread_cond_wait(&cond, &lock);
-			}
-			signaled = false;
-		pthread_mutex_unlock(&lock);
-	}
-
-	static inline void post(__bin_sem_t & this) with( this ) {
-		verify(__cfaabi_dbg_in_kernel());
-
-		pthread_mutex_lock(&lock);
-			bool needs_signal = !signaled;
-			signaled = true;
-		pthread_mutex_unlock(&lock);
-
-		if (needs_signal)
-			pthread_cond_signal(&cond);
-	}
-#endif
Index: libcfa/src/bits/locks.hfa
===================================================================
--- libcfa/src/bits/locks.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/locks.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,165 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// bits/locks.hfa -- Fast internal locks.
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Oct 31 15:14:38 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Mar 30 18:18:13 2018
+// Update Count     : 9
+//
+
+#pragma once
+
+#include "bits/debug.hfa"
+#include "bits/defs.hfa"
+#include <assert.h>
+
+#ifdef __cforall
+	extern "C" {
+		#include <pthread.h>
+	}
+#endif
+
+// pause to prevent excess processor bus usage
+#if defined( __sparc )
+	#define Pause() __asm__ __volatile__ ( "rd %ccr,%g0" )
+#elif defined( __i386 ) || defined( __x86_64 )
+	#define Pause() __asm__ __volatile__ ( "pause" : : : )
+#elif defined( __ARM_ARCH )
+	#define Pause() __asm__ __volatile__ ( "nop" : : : )
+#else
+	#error unsupported architecture
+#endif
+
+#if defined( __i386 ) || defined( __x86_64 ) || defined( __ARM_ARCH )
+	// Intel recommendation
+	#define __ALIGN__ __attribute__(( aligned (128) ))
+#elif defined( __sparc )
+	#define __ALIGN__ CALIGN
+#else
+	#error unsupported architecture
+#endif
+
+struct __spinlock_t {
+	// Wrap in struct to prevent false sharing with debug info
+	struct {
+		// Align lock on 128-bit boundary
+		__ALIGN__ volatile _Bool lock;
+	};
+	#ifdef __CFA_DEBUG__
+		// previous function to acquire the lock
+		const char * prev_name;
+		// previous thread to acquire the lock
+		void* prev_thrd;
+	#endif
+} __ALIGN__;
+
+#ifdef __cforall
+	extern "C" {
+		extern void disable_interrupts();
+		extern void enable_interrupts_noPoll();
+	}
+
+	extern void yield( unsigned int );
+
+	static inline void ?{}( __spinlock_t & this ) {
+		this.lock = 0;
+	}
+
+
+	#ifdef __CFA_DEBUG__
+		void __cfaabi_dbg_record(__spinlock_t & this, const char * prev_name);
+	#else
+		#define __cfaabi_dbg_record(x, y)
+	#endif
+
+	// Lock the spinlock, return false if already acquired
+	static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
+		_Bool result = (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0);
+		if( result ) {
+			disable_interrupts();
+			__cfaabi_dbg_record( this, caller );
+		}
+		return result;
+	}
+
+	// Lock the spinlock, spin if already acquired
+	static inline void lock( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
+		#ifndef NOEXPBACK
+			enum { SPIN_START = 4, SPIN_END = 64 * 1024, };
+			unsigned int spin = SPIN_START;
+		#endif
+
+		for ( unsigned int i = 1;; i += 1 ) {
+			if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break;
+			#ifndef NOEXPBACK
+				// exponential spin
+				for ( volatile unsigned int s = 0; s < spin; s += 1 ) Pause();
+
+				// slowly increase by powers of 2
+				if ( i % 64 == 0 ) spin += spin;
+
+				// prevent overflow
+				if ( spin > SPIN_END ) spin = SPIN_START;
+			#else
+				Pause();
+			#endif
+		}
+		disable_interrupts();
+		__cfaabi_dbg_record( this, caller );
+	}
+
+	static inline void unlock( __spinlock_t & this ) {
+		enable_interrupts_noPoll();
+		__atomic_clear( &this.lock, __ATOMIC_RELEASE );
+	}
+
+
+	#ifdef __CFA_WITH_VERIFY__
+		extern bool __cfaabi_dbg_in_kernel();
+	#endif
+
+	struct __bin_sem_t {
+		bool     		signaled;
+		pthread_mutex_t 	lock;
+		pthread_cond_t  	cond;
+	};
+
+	static inline void ?{}(__bin_sem_t & this) with( this ) {
+		signaled = false;
+		pthread_mutex_init(&lock, NULL);
+		pthread_cond_init (&cond, NULL);
+	}
+
+	static inline void ^?{}(__bin_sem_t & this) with( this ) {
+		pthread_mutex_destroy(&lock);
+		pthread_cond_destroy (&cond);
+	}
+
+	static inline void wait(__bin_sem_t & this) with( this ) {
+		verify(__cfaabi_dbg_in_kernel());
+		pthread_mutex_lock(&lock);
+			if(!signaled) {   // this must be a loop, not if!
+				pthread_cond_wait(&cond, &lock);
+			}
+			signaled = false;
+		pthread_mutex_unlock(&lock);
+	}
+
+	static inline void post(__bin_sem_t & this) with( this ) {
+		verify(__cfaabi_dbg_in_kernel());
+
+		pthread_mutex_lock(&lock);
+			bool needs_signal = !signaled;
+			signaled = true;
+		pthread_mutex_unlock(&lock);
+
+		if (needs_signal)
+			pthread_cond_signal(&cond);
+	}
+#endif
Index: libcfa/src/bits/signal.h
===================================================================
--- libcfa/src/bits/signal.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,65 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// bits/signal.h -- Helper functions and defines to use signals
-//
-// Author           : Thierry Delisle
-// Created On       : Thu Jan 25 16:06:29 2018
-// Last Modified By :
-// Last Modified On :
-// Update Count     :
-//
-
-#pragma once
-
-#include "bits/debug.h"
-#include "bits/defs.h"
-
-extern "C" {
-#include <errno.h>
-#define __USE_GNU
-#include <signal.h>
-#undef __USE_GNU
-#include <stdlib.h>
-#include <string.h>
-}
-
-// Short hands for signal context information
-#define __CFA_SIGCXT__ ucontext_t *
-#define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
-
-// Sigaction wrapper : register an signal handler
-static void __cfaabi_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
-	struct sigaction act;
-
-	act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
-	act.sa_flags = flags;
-
-	if ( sigaction( sig, &act, NULL ) == -1 ) {
-		__cfaabi_dbg_print_buffer_decl(
-			" __cfaabi_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
-			sig, handler, flags, errno, strerror( errno )
-		);
-		_exit( EXIT_FAILURE );
-	}
-}
-
-// Sigaction wrapper : restore default handler
-static void __cfaabi_sigdefault( int sig ) {
-	struct sigaction act;
-
-	act.sa_handler = SIG_DFL;
-	act.sa_flags = 0;
-	sigemptyset( &act.sa_mask );
-
-	if ( sigaction( sig, &act, NULL ) == -1 ) {
-		__cfaabi_dbg_print_buffer_decl(
-			" __cfaabi_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
-			sig, errno, strerror( errno )
-		);
-		_exit( EXIT_FAILURE );
-	}
-}
Index: libcfa/src/bits/signal.hfa
===================================================================
--- libcfa/src/bits/signal.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/bits/signal.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,65 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// bits/signal.hfa -- Helper functions and defines to use signals
+//
+// Author           : Thierry Delisle
+// Created On       : Thu Jan 25 16:06:29 2018
+// Last Modified By :
+// Last Modified On :
+// Update Count     :
+//
+
+#pragma once
+
+#include "bits/debug.hfa"
+#include "bits/defs.hfa"
+
+extern "C" {
+#include <errno.h>
+#define __USE_GNU
+#include <signal.hfa>
+#undef __USE_GNU
+#include <stdlib.h>
+#include <string.h>
+}
+
+// Short hands for signal context information
+#define __CFA_SIGCXT__ ucontext_t *
+#define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
+
+// Sigaction wrapper : register an signal handler
+static void __cfaabi_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
+	struct sigaction act;
+
+	act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
+	act.sa_flags = flags;
+
+	if ( sigaction( sig, &act, NULL ) == -1 ) {
+		__cfaabi_dbg_print_buffer_decl(
+			" __cfaabi_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
+			sig, handler, flags, errno, strerror( errno )
+		);
+		_exit( EXIT_FAILURE );
+	}
+}
+
+// Sigaction wrapper : restore default handler
+static void __cfaabi_sigdefault( int sig ) {
+	struct sigaction act;
+
+	act.sa_handler = SIG_DFL;
+	act.sa_flags = 0;
+	sigemptyset( &act.sa_mask );
+
+	if ( sigaction( sig, &act, NULL ) == -1 ) {
+		__cfaabi_dbg_print_buffer_decl(
+			" __cfaabi_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
+			sig, errno, strerror( errno )
+		);
+		_exit( EXIT_FAILURE );
+	}
+}
Index: libcfa/src/clock
===================================================================
--- libcfa/src/clock	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,96 +1,0 @@
-// 
-// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-// 
-// clock -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Thu Apr 12 14:36:06 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jul  2 21:40:01 2018
-// Update Count     : 7
-// 
-
-#include <time>
-
-
-//######################### C time #########################
-
-static inline char * ctime( time_t tp ) { char * buf = ctime( &tp ); buf[24] = '\0'; return buf; }
-static inline char * ctime_r( time_t tp, char * buf ) { ctime_r( &tp, buf ); buf[24] = '\0'; return buf; }
-static inline tm * gmtime( time_t tp ) { return gmtime( &tp ); }
-static inline tm * gmtime_r( time_t tp, tm * result ) { return gmtime_r( &tp, result ); }
-static inline tm * localtime( time_t tp ) { return localtime( &tp ); }
-static inline tm * localtime_r( time_t tp, tm * result ) { return localtime_r( &tp, result ); }
-
-
-//######################### Clock #########################
-
-struct Clock {											// private
-	Duration offset;									// for virtual clock: contains offset from real-time
-	int clocktype;										// implementation only -1 (virtual), CLOCK_REALTIME
-};
-
-static inline {
-	void resetClock( Clock & clk ) with( clk ) {
-		clocktype = CLOCK_REALTIME_COARSE;
-	} // Clock::resetClock
-
-	void resetClock( Clock & clk, Duration adj ) with( clk ) {
-		clocktype = -1;
-		offset = adj + __timezone`s;					// timezone (global) is (UTC - local time) in seconds
-	} // resetClock
-
-	void ?{}( Clock & clk ) { resetClock( clk ); }
-	void ?{}( Clock & clk, Duration adj ) { resetClock( clk, adj ); }
-
-	Duration getResNsec() {
-		struct timespec res;
-		clock_getres( CLOCK_REALTIME, &res );
-		return ((int64_t)res.tv_sec * TIMEGRAN + res.tv_nsec)`ns;
-	} // getRes
-
-	Duration getRes() {
-		struct timespec res;
-		clock_getres( CLOCK_REALTIME_COARSE, &res );
-		return ((int64_t)res.tv_sec * TIMEGRAN + res.tv_nsec)`ns;
-	} // getRes
-
-	Time getTimeNsec() {								// with nanoseconds
-		timespec curr;
-		clock_gettime( CLOCK_REALTIME, &curr );
-		return (Time){ curr };
-	} // getTime
-
-	Time getTime() {									// without nanoseconds
-		timespec curr;
-		clock_gettime( CLOCK_REALTIME_COARSE, &curr );
-		curr.tv_nsec = 0;
-		return (Time){ curr };
-	} // getTime
-
-	Time getTime( Clock & clk ) with( clk ) {
-		return getTime() + offset;
-	} // getTime
-
-	Time ?()( Clock & clk ) with( clk ) {				// alternative syntax
-		return getTime() + offset;
-	} // getTime
-
-	timeval getTime( Clock & clk ) {
-		return (timeval){ clk() };
-	} // getTime
-
-	tm getTime( Clock & clk ) with( clk ) {
-		tm ret;
-		localtime_r( getTime( clk ).tv_sec, &ret );
-		return ret;
-	} // getTime
-} // distribution
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/clock.hfa
===================================================================
--- libcfa/src/clock.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/clock.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,96 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// clock --
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu Apr 12 14:36:06 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Mon Jul  2 21:40:01 2018
+// Update Count     : 7
+//
+
+#include <time.hfa>
+
+
+//######################### C time #########################
+
+static inline char * ctime( time_t tp ) { char * buf = ctime( &tp ); buf[24] = '\0'; return buf; }
+static inline char * ctime_r( time_t tp, char * buf ) { ctime_r( &tp, buf ); buf[24] = '\0'; return buf; }
+static inline tm * gmtime( time_t tp ) { return gmtime( &tp ); }
+static inline tm * gmtime_r( time_t tp, tm * result ) { return gmtime_r( &tp, result ); }
+static inline tm * localtime( time_t tp ) { return localtime( &tp ); }
+static inline tm * localtime_r( time_t tp, tm * result ) { return localtime_r( &tp, result ); }
+
+
+//######################### Clock #########################
+
+struct Clock {											// private
+	Duration offset;									// for virtual clock: contains offset from real-time
+	int clocktype;										// implementation only -1 (virtual), CLOCK_REALTIME
+};
+
+static inline {
+	void resetClock( Clock & clk ) with( clk ) {
+		clocktype = CLOCK_REALTIME_COARSE;
+	} // Clock::resetClock
+
+	void resetClock( Clock & clk, Duration adj ) with( clk ) {
+		clocktype = -1;
+		offset = adj + __timezone`s;					// timezone (global) is (UTC - local time) in seconds
+	} // resetClock
+
+	void ?{}( Clock & clk ) { resetClock( clk ); }
+	void ?{}( Clock & clk, Duration adj ) { resetClock( clk, adj ); }
+
+	Duration getResNsec() {
+		struct timespec res;
+		clock_getres( CLOCK_REALTIME, &res );
+		return ((int64_t)res.tv_sec * TIMEGRAN + res.tv_nsec)`ns;
+	} // getRes
+
+	Duration getRes() {
+		struct timespec res;
+		clock_getres( CLOCK_REALTIME_COARSE, &res );
+		return ((int64_t)res.tv_sec * TIMEGRAN + res.tv_nsec)`ns;
+	} // getRes
+
+	Time getTimeNsec() {								// with nanoseconds
+		timespec curr;
+		clock_gettime( CLOCK_REALTIME, &curr );
+		return (Time){ curr };
+	} // getTime
+
+	Time getTime() {									// without nanoseconds
+		timespec curr;
+		clock_gettime( CLOCK_REALTIME_COARSE, &curr );
+		curr.tv_nsec = 0;
+		return (Time){ curr };
+	} // getTime
+
+	Time getTime( Clock & clk ) with( clk ) {
+		return getTime() + offset;
+	} // getTime
+
+	Time ?()( Clock & clk ) with( clk ) {				// alternative syntax
+		return getTime() + offset;
+	} // getTime
+
+	timeval getTime( Clock & clk ) {
+		return (timeval){ clk() };
+	} // getTime
+
+	tm getTime( Clock & clk ) with( clk ) {
+		tm ret;
+		localtime_r( getTime( clk ).tv_sec, &ret );
+		return ret;
+	} // getTime
+} // distribution
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/common
===================================================================
--- libcfa/src/common	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,85 +1,0 @@
-// 
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-// 
-// common -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Wed Jul 11 17:54:36 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jul 12 08:02:18 2018
-// Update Count     : 5
-// 
-
-#pragma once
-
-//---------------------------------------
-
-[ int, int ] div( int num, int denom );
-[ long int, long int ] div( long int num, long int denom );
-[ long long int, long long int ] div( long long int num, long long int denom );
-forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
-[ T, T ] div( T num, T demon );
-
-//---------------------------------------
-
-extern "C" {
-	int abs( int );										// stdlib.h
-	long int labs( long int );
-	long long int llabs( long long int );
-} // extern "C"
-
-static inline {
-	unsigned char abs( signed char v ) { return abs( (int)v ); }
-	// use default C routine for int
-	unsigned long int abs( long int v ) { return labs( v ); }
-	unsigned long long int abs( long long int v ) { return llabs( v ); }
-} // distribution
-
-extern "C" {
-	double fabs( double );								// math.h
-	float fabsf( float );
-	long double fabsl( long double );
-} // extern "C"
-static inline {
-	float abs( float x ) { return fabsf( x ); }
-	double abs( double x ) { return fabs( x ); }
-	long double abs( long double x ) { return fabsl( x ); }
-} // distribution
-
-extern "C" {
-	double cabs( double _Complex );						// complex.h
-	float cabsf( float _Complex );
-	long double cabsl( long double _Complex );
-} // extern "C"
-static inline {
-	float abs( float _Complex x ) { return cabsf( x ); }
-	double abs( double _Complex x ) { return cabs( x ); }
-	long double abs( long double _Complex x ) { return cabsl( x ); }
-} // distribution
-
-forall( otype T | { void ?{}( T &, zero_t ); int ?<?( T, T ); T -?( T ); } )
-T abs( T );
-
-//---------------------------------------
-
-static inline {
-	forall( otype T | { int ?<?( T, T ); } )
-	T min( T t1, T t2 ) { return t1 < t2 ? t1 : t2; }
-
-	forall( otype T | { int ?>?( T, T ); } )
-	T max( T t1, T t2 ) { return t1 > t2 ? t1 : t2; }
-
-	forall( otype T | { T min( T, T ); T max( T, T ); } )
-	T clamp( T value, T min_val, T max_val ) { return max( min_val, min( value, max_val ) ); }
-
-	forall( otype T )
-	void swap( T & v1, T & v2 ) { T temp = v1; v1 = v2; v2 = temp; }
-} // distribution
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/common.hfa
===================================================================
--- libcfa/src/common.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/common.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,85 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// common -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Jul 11 17:54:36 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Jul 12 08:02:18 2018
+// Update Count     : 5
+// 
+
+#pragma once
+
+//---------------------------------------
+
+[ int, int ] div( int num, int denom );
+[ long int, long int ] div( long int num, long int denom );
+[ long long int, long long int ] div( long long int num, long long int denom );
+forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
+[ T, T ] div( T num, T demon );
+
+//---------------------------------------
+
+extern "C" {
+	int abs( int );										// stdlib.h
+	long int labs( long int );
+	long long int llabs( long long int );
+} // extern "C"
+
+static inline {
+	unsigned char abs( signed char v ) { return abs( (int)v ); }
+	// use default C routine for int
+	unsigned long int abs( long int v ) { return labs( v ); }
+	unsigned long long int abs( long long int v ) { return llabs( v ); }
+} // distribution
+
+extern "C" {
+	double fabs( double );								// math.h
+	float fabsf( float );
+	long double fabsl( long double );
+} // extern "C"
+static inline {
+	float abs( float x ) { return fabsf( x ); }
+	double abs( double x ) { return fabs( x ); }
+	long double abs( long double x ) { return fabsl( x ); }
+} // distribution
+
+extern "C" {
+	double cabs( double _Complex );						// complex.h
+	float cabsf( float _Complex );
+	long double cabsl( long double _Complex );
+} // extern "C"
+static inline {
+	float abs( float _Complex x ) { return cabsf( x ); }
+	double abs( double _Complex x ) { return cabs( x ); }
+	long double abs( long double _Complex x ) { return cabsl( x ); }
+} // distribution
+
+forall( otype T | { void ?{}( T &, zero_t ); int ?<?( T, T ); T -?( T ); } )
+T abs( T );
+
+//---------------------------------------
+
+static inline {
+	forall( otype T | { int ?<?( T, T ); } )
+	T min( T t1, T t2 ) { return t1 < t2 ? t1 : t2; }
+
+	forall( otype T | { int ?>?( T, T ); } )
+	T max( T t1, T t2 ) { return t1 > t2 ? t1 : t2; }
+
+	forall( otype T | { T min( T, T ); T max( T, T ); } )
+	T clamp( T value, T min_val, T max_val ) { return max( min_val, min( value, max_val ) ); }
+
+	forall( otype T )
+	void swap( T & v1, T & v2 ) { T temp = v1; v1 = v2; v2 = temp; }
+} // distribution
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/concurrency/alarm.cfa
===================================================================
--- libcfa/src/concurrency/alarm.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/alarm.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -22,7 +22,7 @@
 }
 
-#include "alarm.h"
-#include "kernel_private.h"
-#include "preemption.h"
+#include "alarm.hfa"
+#include "kernel_private.hfa"
+#include "preemption.hfa"
 
 //=============================================================================================
Index: libcfa/src/concurrency/alarm.h
===================================================================
--- libcfa/src/concurrency/alarm.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,78 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// alarm.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Fri Jun 2 11:31:25 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Mar 26 16:25:41 2018
-// Update Count     : 11
-//
-
-#pragma once
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include <assert.h>
-
-#include "time"
-
-struct thread_desc;
-struct processor;
-
-//=============================================================================================
-// Clock logic
-//=============================================================================================
-
-Time __kernel_get_time();
-void __kernel_set_timer( Duration alarm );
-
-//=============================================================================================
-// Alarm logic
-//=============================================================================================
-
-struct alarm_node_t {
-	Time alarm;				// time when alarm goes off
-	Duration period;			// if > 0 => period of alarm
-	alarm_node_t * next;		// intrusive link list field
-
-	union {
-		thread_desc * thrd;	// thrd who created event
-		processor * proc;		// proc who created event
-	};
-
-	bool set		:1;		// whether or not the alarm has be registered
-	bool kernel_alarm	:1;		// true if this is not a user defined alarm
-};
-
-typedef alarm_node_t ** __alarm_it_t;
-
-void ?{}( alarm_node_t & this, thread_desc * thrd, Time alarm, Duration period );
-void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
-void ^?{}( alarm_node_t & this );
-
-struct alarm_list_t {
-	alarm_node_t * head;
-	__alarm_it_t tail;
-};
-
-static inline void ?{}( alarm_list_t & this ) with( this ) {
-	head = 0;
-	tail = &head;
-}
-
-void insert( alarm_list_t * this, alarm_node_t * n );
-alarm_node_t * pop( alarm_list_t * this );
-
-void register_self  ( alarm_node_t * this );
-void unregister_self( alarm_node_t * this );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 6 //
-// End: //
Index: libcfa/src/concurrency/alarm.hfa
===================================================================
--- libcfa/src/concurrency/alarm.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/alarm.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,78 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// alarm.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Fri Jun 2 11:31:25 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Mon Mar 26 16:25:41 2018
+// Update Count     : 11
+//
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include <assert.h>
+
+#include "time"
+
+struct thread_desc;
+struct processor;
+
+//=============================================================================================
+// Clock logic
+//=============================================================================================
+
+Time __kernel_get_time();
+void __kernel_set_timer( Duration alarm );
+
+//=============================================================================================
+// Alarm logic
+//=============================================================================================
+
+struct alarm_node_t {
+	Time alarm;				// time when alarm goes off
+	Duration period;			// if > 0 => period of alarm
+	alarm_node_t * next;		// intrusive link list field
+
+	union {
+		thread_desc * thrd;	// thrd who created event
+		processor * proc;		// proc who created event
+	};
+
+	bool set		:1;		// whether or not the alarm has be registered
+	bool kernel_alarm	:1;		// true if this is not a user defined alarm
+};
+
+typedef alarm_node_t ** __alarm_it_t;
+
+void ?{}( alarm_node_t & this, thread_desc * thrd, Time alarm, Duration period );
+void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
+void ^?{}( alarm_node_t & this );
+
+struct alarm_list_t {
+	alarm_node_t * head;
+	__alarm_it_t tail;
+};
+
+static inline void ?{}( alarm_list_t & this ) with( this ) {
+	head = 0;
+	tail = &head;
+}
+
+void insert( alarm_list_t * this, alarm_node_t * n );
+alarm_node_t * pop( alarm_list_t * this );
+
+void register_self  ( alarm_node_t * this );
+void unregister_self( alarm_node_t * this );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 6 //
+// End: //
Index: libcfa/src/concurrency/coroutine
===================================================================
--- libcfa/src/concurrency/coroutine	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,151 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// coroutine --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Nov 28 12:27:26 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Mar 30 18:23:45 2018
-// Update Count     : 8
-//
-
-#pragma once
-
-#include <assert.h>
-#include "invoke.h"
-
-//-----------------------------------------------------------------------------
-// Coroutine trait
-// Anything that implements this trait can be resumed.
-// Anything that is resumed is a coroutine.
-trait is_coroutine(dtype T) {
-      void main(T & this);
-      coroutine_desc * get_coroutine(T & this);
-};
-
-#define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X& this) { return &this.__cor; } void main(X& this)
-
-//-----------------------------------------------------------------------------
-// Ctors and dtors
-// void ?{}( coStack_t & this );
-// void ^?{}( coStack_t & this );
-
-void ?{}( coroutine_desc & this, const char * name, void * storage, size_t storageSize );
-void ^?{}( coroutine_desc & this );
-
-static inline void ?{}( coroutine_desc & this)                                       { this{ "Anonymous Coroutine", NULL, 0 }; }
-static inline void ?{}( coroutine_desc & this, size_t stackSize)                     { this{ "Anonymous Coroutine", NULL, stackSize }; }
-static inline void ?{}( coroutine_desc & this, void * storage, size_t storageSize )  { this{ "Anonymous Coroutine", storage, storageSize }; }
-static inline void ?{}( coroutine_desc & this, const char * name)                    { this{ name, NULL, 0 }; }
-static inline void ?{}( coroutine_desc & this, const char * name, size_t stackSize ) { this{ name, NULL, stackSize }; }
-
-//-----------------------------------------------------------------------------
-// Public coroutine API
-static inline void suspend();
-
-forall(dtype T | is_coroutine(T))
-static inline void resume(T & cor);
-
-forall(dtype T | is_coroutine(T))
-void prime(T & cor);
-
-//-----------------------------------------------------------------------------
-// PRIVATE exposed because of inline
-
-// Start coroutine routines
-extern "C" {
-      forall(dtype T | is_coroutine(T))
-      void CtxInvokeCoroutine(T * this);
-
-      forall(dtype T | is_coroutine(T))
-      void CtxStart(T * this, void ( *invoke)(T *));
-}
-
-// Private wrappers for context switch and stack creation
-extern void CoroutineCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
-extern void create_stack( coStack_t * this, unsigned int storageSize );
-
-// Suspend implementation inlined for performance
-static inline void suspend() {
-	// optimization : read TLS once and reuse it
-	// Safety note: this is preemption safe since if
-	// preemption occurs after this line, the pointer
-	// will also migrate which means this value will
-	// stay in syn with the TLS
-	coroutine_desc * src = TL_GET( this_coroutine );
-
-	assertf( src->last != 0,
-		"Attempt to suspend coroutine \"%.256s\" (%p) that has never been resumed.\n"
-		"Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
-		src->name, src );
-	assertf( src->last->state != Halted,
-		"Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
-		"Possible cause is terminated coroutine's main routine has already returned.",
-		src->name, src, src->last->name, src->last );
-
-	CoroutineCtxSwitch( src, src->last );
-}
-
-// Resume implementation inlined for performance
-forall(dtype T | is_coroutine(T))
-static inline void resume(T & cor) {
-	// optimization : read TLS once and reuse it
-	// Safety note: this is preemption safe since if
-	// preemption occurs after this line, the pointer
-	// will also migrate which means this value will
-	// stay in syn with the TLS
-	coroutine_desc * src = TL_GET( this_coroutine );
-	coroutine_desc * dst = get_coroutine(cor);
-
-	if( unlikely(!dst->stack.base) ) {
-		create_stack(&dst->stack, dst->stack.size);
-		CtxStart(&cor, CtxInvokeCoroutine);
-	}
-
-	// not resuming self ?
-	if ( src != dst ) {
-		assertf( dst->state != Halted ,
-			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
-			"Possible cause is terminated coroutine's main routine has already returned.",
-			src->name, src, dst->name, dst );
-
-		// set last resumer
-		dst->last = src;
-		dst->starter = dst->starter ? dst->starter : src;
-	}
-
-	// always done for performance testing
-	CoroutineCtxSwitch( src, dst );
-}
-
-static inline void resume(coroutine_desc * dst) {
-	// optimization : read TLS once and reuse it
-	// Safety note: this is preemption safe since if
-	// preemption occurs after this line, the pointer
-	// will also migrate which means this value will
-	// stay in syn with the TLS
-	coroutine_desc * src = TL_GET( this_coroutine );
-
-	// not resuming self ?
-	if ( src != dst ) {
-		assertf( dst->state != Halted ,
-			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
-			"Possible cause is terminated coroutine's main routine has already returned.",
-			src->name, src, dst->name, dst );
-
-		// set last resumer
-		dst->last = src;
-	}
-
-	// always done for performance testing
-	CoroutineCtxSwitch( src, dst );
-}
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/concurrency/coroutine.cfa
===================================================================
--- libcfa/src/concurrency/coroutine.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/coroutine.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -25,5 +25,5 @@
 }
 
-#include "kernel_private.h"
+#include "kernel_private.hfa"
 
 #define __CFA_INVOKE_PRIVATE__
Index: libcfa/src/concurrency/coroutine.hfa
===================================================================
--- libcfa/src/concurrency/coroutine.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/coroutine.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,151 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// coroutine --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Nov 28 12:27:26 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Mar 30 18:23:45 2018
+// Update Count     : 8
+//
+
+#pragma once
+
+#include <assert.h>
+#include "invoke.h"
+
+//-----------------------------------------------------------------------------
+// Coroutine trait
+// Anything that implements this trait can be resumed.
+// Anything that is resumed is a coroutine.
+trait is_coroutine(dtype T) {
+      void main(T & this);
+      coroutine_desc * get_coroutine(T & this);
+};
+
+#define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X& this) { return &this.__cor; } void main(X& this)
+
+//-----------------------------------------------------------------------------
+// Ctors and dtors
+// void ?{}( coStack_t & this );
+// void ^?{}( coStack_t & this );
+
+void ?{}( coroutine_desc & this, const char * name, void * storage, size_t storageSize );
+void ^?{}( coroutine_desc & this );
+
+static inline void ?{}( coroutine_desc & this)                                       { this{ "Anonymous Coroutine", NULL, 0 }; }
+static inline void ?{}( coroutine_desc & this, size_t stackSize)                     { this{ "Anonymous Coroutine", NULL, stackSize }; }
+static inline void ?{}( coroutine_desc & this, void * storage, size_t storageSize )  { this{ "Anonymous Coroutine", storage, storageSize }; }
+static inline void ?{}( coroutine_desc & this, const char * name)                    { this{ name, NULL, 0 }; }
+static inline void ?{}( coroutine_desc & this, const char * name, size_t stackSize ) { this{ name, NULL, stackSize }; }
+
+//-----------------------------------------------------------------------------
+// Public coroutine API
+static inline void suspend();
+
+forall(dtype T | is_coroutine(T))
+static inline void resume(T & cor);
+
+forall(dtype T | is_coroutine(T))
+void prime(T & cor);
+
+//-----------------------------------------------------------------------------
+// PRIVATE exposed because of inline
+
+// Start coroutine routines
+extern "C" {
+      forall(dtype T | is_coroutine(T))
+      void CtxInvokeCoroutine(T * this);
+
+      forall(dtype T | is_coroutine(T))
+      void CtxStart(T * this, void ( *invoke)(T *));
+}
+
+// Private wrappers for context switch and stack creation
+extern void CoroutineCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
+extern void create_stack( coStack_t * this, unsigned int storageSize );
+
+// Suspend implementation inlined for performance
+static inline void suspend() {
+	// optimization : read TLS once and reuse it
+	// Safety note: this is preemption safe since if
+	// preemption occurs after this line, the pointer
+	// will also migrate which means this value will
+	// stay in syn with the TLS
+	coroutine_desc * src = TL_GET( this_coroutine );
+
+	assertf( src->last != 0,
+		"Attempt to suspend coroutine \"%.256s\" (%p) that has never been resumed.\n"
+		"Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
+		src->name, src );
+	assertf( src->last->state != Halted,
+		"Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
+		"Possible cause is terminated coroutine's main routine has already returned.",
+		src->name, src, src->last->name, src->last );
+
+	CoroutineCtxSwitch( src, src->last );
+}
+
+// Resume implementation inlined for performance
+forall(dtype T | is_coroutine(T))
+static inline void resume(T & cor) {
+	// optimization : read TLS once and reuse it
+	// Safety note: this is preemption safe since if
+	// preemption occurs after this line, the pointer
+	// will also migrate which means this value will
+	// stay in syn with the TLS
+	coroutine_desc * src = TL_GET( this_coroutine );
+	coroutine_desc * dst = get_coroutine(cor);
+
+	if( unlikely(!dst->stack.base) ) {
+		create_stack(&dst->stack, dst->stack.size);
+		CtxStart(&cor, CtxInvokeCoroutine);
+	}
+
+	// not resuming self ?
+	if ( src != dst ) {
+		assertf( dst->state != Halted ,
+			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
+			"Possible cause is terminated coroutine's main routine has already returned.",
+			src->name, src, dst->name, dst );
+
+		// set last resumer
+		dst->last = src;
+		dst->starter = dst->starter ? dst->starter : src;
+	}
+
+	// always done for performance testing
+	CoroutineCtxSwitch( src, dst );
+}
+
+static inline void resume(coroutine_desc * dst) {
+	// optimization : read TLS once and reuse it
+	// Safety note: this is preemption safe since if
+	// preemption occurs after this line, the pointer
+	// will also migrate which means this value will
+	// stay in syn with the TLS
+	coroutine_desc * src = TL_GET( this_coroutine );
+
+	// not resuming self ?
+	if ( src != dst ) {
+		assertf( dst->state != Halted ,
+			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
+			"Possible cause is terminated coroutine's main routine has already returned.",
+			src->name, src, dst->name, dst );
+
+		// set last resumer
+		dst->last = src;
+	}
+
+	// always done for performance testing
+	CoroutineCtxSwitch( src, dst );
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/concurrency/invoke.h
===================================================================
--- libcfa/src/concurrency/invoke.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/invoke.h	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -14,7 +14,7 @@
 //
 
-#include "bits/containers.h"
-#include "bits/defs.h"
-#include "bits/locks.h"
+#include "bits/containers.hfa"
+#include "bits/defs.hfa"
+#include "bits/locks.hfa"
 
 #ifdef __cforall
Index: libcfa/src/concurrency/kernel
===================================================================
--- libcfa/src/concurrency/kernel	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,205 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// kernel --
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Jan 17 12:27:26 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Apr 10 14:46:49 2018
-// Update Count     : 10
-//
-
-#pragma once
-
-#include <stdbool.h>
-
-#include "invoke.h"
-#include "time_t.h"
-
-extern "C" {
-#include <pthread.h>
-#include <semaphore.h>
-}
-
-//-----------------------------------------------------------------------------
-// Locks
-struct semaphore {
-	__spinlock_t lock;
-	int count;
-	__queue_t(thread_desc) waiting;
-};
-
-void  ?{}(semaphore & this, int count = 1);
-void ^?{}(semaphore & this);
-void   P (semaphore & this);
-void   V (semaphore & this);
-
-
-//-----------------------------------------------------------------------------
-// Processor
-extern struct cluster * mainCluster;
-
-enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule, Release_Multi, Release_Multi_Schedule, Callback };
-
-typedef void (*__finish_callback_fptr_t)(void);
-
-//TODO use union, many of these fields are mutually exclusive (i.e. MULTI vs NOMULTI)
-struct FinishAction {
-	FinishOpCode action_code;
-	/*
-	// Union of possible actions
-	union {
-		// Option 1 : locks and threads
-		struct {
-			// 1 thread or N thread
-			union {
-				thread_desc * thrd;
-				struct {
-					thread_desc ** thrds;
-					unsigned short thrd_count;
-				};
-			};
-			// 1 lock or N lock
-			union {
-				__spinlock_t * lock;
-				struct {
-					__spinlock_t ** locks;
-					unsigned short lock_count;
-				};
-			};
-		};
-		// Option 2 : action pointer
-		__finish_callback_fptr_t callback;
-	};
-	/*/
-	thread_desc * thrd;
-	thread_desc ** thrds;
-	unsigned short thrd_count;
-	__spinlock_t * lock;
-	__spinlock_t ** locks;
-	unsigned short lock_count;
-	__finish_callback_fptr_t callback;
-	//*/
-};
-static inline void ?{}(FinishAction & this) {
-	this.action_code = No_Action;
-	this.thrd = NULL;
-	this.lock = NULL;
-}
-static inline void ^?{}(FinishAction & this) {}
-
-// Processor
-coroutine processorCtx_t {
-	struct processor * proc;
-};
-
-// Wrapper around kernel threads
-struct processor {
-	// Main state
-	// Coroutine ctx who does keeps the state of the processor
-	struct processorCtx_t runner;
-
-	// Cluster from which to get threads
-	struct cluster * cltr;
-
-	// Name of the processor
-	const char * name;
-
-	// Handle to pthreads
-	pthread_t kernel_thread;
-
-	// RunThread data
-	// Action to do after a thread is ran
-	struct FinishAction finish;
-
-	// Preemption data
-	// Node which is added in the discrete event simulaiton
-	struct alarm_node_t * preemption_alarm;
-
-	// If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
-	bool pending_preemption;
-
-	// Idle lock
-	__bin_sem_t idleLock;
-
-	// Termination
-	// Set to true to notify the processor should terminate
-	volatile bool do_terminate;
-
-	// Termination synchronisation
-	semaphore terminated;
-
-	// Link lists fields
-	struct __dbg_node_proc {
-		struct processor * next;
-		struct processor * prev;
-	} node;
-
-#ifdef __CFA_DEBUG__
-	// Last function to enable preemption on this processor
-	const char * last_enable;
-#endif
-};
-
-void  ?{}(processor & this, const char * name, struct cluster & cltr);
-void ^?{}(processor & this);
-
-static inline void  ?{}(processor & this)                    { this{ "Anonymous Processor", *mainCluster}; }
-static inline void  ?{}(processor & this, struct cluster & cltr)    { this{ "Anonymous Processor", cltr}; }
-static inline void  ?{}(processor & this, const char * name) { this{name, *mainCluster }; }
-
-static inline [processor *&, processor *& ] __get( processor & this ) {
-	return this.node.[next, prev];
-}
-
-//-----------------------------------------------------------------------------
-// Cluster
-struct cluster {
-	// Ready queue locks
-	__spinlock_t ready_queue_lock;
-
-	// Ready queue for threads
-	__queue_t(thread_desc) ready_queue;
-
-	// Name of the cluster
-	const char * name;
-
-	// Preemption rate on this cluster
-	Duration preemption_rate;
-
-	// List of processors
-	__spinlock_t proc_list_lock;
-	__dllist_t(struct processor) procs;
-	__dllist_t(struct processor) idles;
-
-	// List of processors
-	__spinlock_t thread_list_lock;
-	__dllist_t(struct thread_desc) threads;
-
-	// Link lists fields
-	struct __dbg_node_cltr {
-		cluster * next;
-		cluster * prev;
-	} node;
-};
-extern Duration default_preemption();
-
-void ?{} (cluster & this, const char * name, Duration preemption_rate);
-void ^?{}(cluster & this);
-
-static inline void ?{} (cluster & this)                           { this{"Anonymous Cluster", default_preemption()}; }
-static inline void ?{} (cluster & this, Duration preemption_rate) { this{"Anonymous Cluster", preemption_rate}; }
-static inline void ?{} (cluster & this, const char * name)        { this{name, default_preemption()}; }
-
-static inline [cluster *&, cluster *& ] __get( cluster & this ) {
-	return this.node.[next, prev];
-}
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/kernel.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -22,5 +22,5 @@
 #include <fenv.h>
 #include <sys/resource.h>
-#include <signal.h>
+#include <signal.hfa>
 #include <unistd.h>
 }
@@ -28,7 +28,7 @@
 //CFA Includes
 #include "time"
-#include "kernel_private.h"
-#include "preemption.h"
-#include "startup.h"
+#include "kernel_private.hfa"
+#include "preemption.hfa"
+#include "startup.hfa"
 
 //Private includes
Index: libcfa/src/concurrency/kernel.hfa
===================================================================
--- libcfa/src/concurrency/kernel.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/kernel.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,205 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// kernel --
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Jan 17 12:27:26 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Apr 10 14:46:49 2018
+// Update Count     : 10
+//
+
+#pragma once
+
+#include <stdbool.h>
+
+#include "invoke.h"
+#include "time_t.hfa"
+
+extern "C" {
+#include <pthread.h>
+#include <semaphore.h>
+}
+
+//-----------------------------------------------------------------------------
+// Locks
+struct semaphore {
+	__spinlock_t lock;
+	int count;
+	__queue_t(thread_desc) waiting;
+};
+
+void  ?{}(semaphore & this, int count = 1);
+void ^?{}(semaphore & this);
+void   P (semaphore & this);
+void   V (semaphore & this);
+
+
+//-----------------------------------------------------------------------------
+// Processor
+extern struct cluster * mainCluster;
+
+enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule, Release_Multi, Release_Multi_Schedule, Callback };
+
+typedef void (*__finish_callback_fptr_t)(void);
+
+//TODO use union, many of these fields are mutually exclusive (i.e. MULTI vs NOMULTI)
+struct FinishAction {
+	FinishOpCode action_code;
+	/*
+	// Union of possible actions
+	union {
+		// Option 1 : locks and threads
+		struct {
+			// 1 thread or N thread
+			union {
+				thread_desc * thrd;
+				struct {
+					thread_desc ** thrds;
+					unsigned short thrd_count;
+				};
+			};
+			// 1 lock or N lock
+			union {
+				__spinlock_t * lock;
+				struct {
+					__spinlock_t ** locks;
+					unsigned short lock_count;
+				};
+			};
+		};
+		// Option 2 : action pointer
+		__finish_callback_fptr_t callback;
+	};
+	/*/
+	thread_desc * thrd;
+	thread_desc ** thrds;
+	unsigned short thrd_count;
+	__spinlock_t * lock;
+	__spinlock_t ** locks;
+	unsigned short lock_count;
+	__finish_callback_fptr_t callback;
+	//*/
+};
+static inline void ?{}(FinishAction & this) {
+	this.action_code = No_Action;
+	this.thrd = NULL;
+	this.lock = NULL;
+}
+static inline void ^?{}(FinishAction & this) {}
+
+// Processor
+coroutine processorCtx_t {
+	struct processor * proc;
+};
+
+// Wrapper around kernel threads
+struct processor {
+	// Main state
+	// Coroutine ctx who does keeps the state of the processor
+	struct processorCtx_t runner;
+
+	// Cluster from which to get threads
+	struct cluster * cltr;
+
+	// Name of the processor
+	const char * name;
+
+	// Handle to pthreads
+	pthread_t kernel_thread;
+
+	// RunThread data
+	// Action to do after a thread is ran
+	struct FinishAction finish;
+
+	// Preemption data
+	// Node which is added in the discrete event simulaiton
+	struct alarm_node_t * preemption_alarm;
+
+	// If true, a preemption was triggered in an unsafe region, the processor must preempt as soon as possible
+	bool pending_preemption;
+
+	// Idle lock
+	__bin_sem_t idleLock;
+
+	// Termination
+	// Set to true to notify the processor should terminate
+	volatile bool do_terminate;
+
+	// Termination synchronisation
+	semaphore terminated;
+
+	// Link lists fields
+	struct __dbg_node_proc {
+		struct processor * next;
+		struct processor * prev;
+	} node;
+
+#ifdef __CFA_DEBUG__
+	// Last function to enable preemption on this processor
+	const char * last_enable;
+#endif
+};
+
+void  ?{}(processor & this, const char * name, struct cluster & cltr);
+void ^?{}(processor & this);
+
+static inline void  ?{}(processor & this)                    { this{ "Anonymous Processor", *mainCluster}; }
+static inline void  ?{}(processor & this, struct cluster & cltr)    { this{ "Anonymous Processor", cltr}; }
+static inline void  ?{}(processor & this, const char * name) { this{name, *mainCluster }; }
+
+static inline [processor *&, processor *& ] __get( processor & this ) {
+	return this.node.[next, prev];
+}
+
+//-----------------------------------------------------------------------------
+// Cluster
+struct cluster {
+	// Ready queue locks
+	__spinlock_t ready_queue_lock;
+
+	// Ready queue for threads
+	__queue_t(thread_desc) ready_queue;
+
+	// Name of the cluster
+	const char * name;
+
+	// Preemption rate on this cluster
+	Duration preemption_rate;
+
+	// List of processors
+	__spinlock_t proc_list_lock;
+	__dllist_t(struct processor) procs;
+	__dllist_t(struct processor) idles;
+
+	// List of processors
+	__spinlock_t thread_list_lock;
+	__dllist_t(struct thread_desc) threads;
+
+	// Link lists fields
+	struct __dbg_node_cltr {
+		cluster * next;
+		cluster * prev;
+	} node;
+};
+extern Duration default_preemption();
+
+void ?{} (cluster & this, const char * name, Duration preemption_rate);
+void ^?{}(cluster & this);
+
+static inline void ?{} (cluster & this)                           { this{"Anonymous Cluster", default_preemption()}; }
+static inline void ?{} (cluster & this, Duration preemption_rate) { this{"Anonymous Cluster", preemption_rate}; }
+static inline void ?{} (cluster & this, const char * name)        { this{name, default_preemption()}; }
+
+static inline [cluster *&, cluster *& ] __get( cluster & this ) {
+	return this.node.[next, prev];
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/concurrency/kernel_private.h
===================================================================
--- libcfa/src/concurrency/kernel_private.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,114 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// kernel_private.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Feb 13 12:27:26 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Mar 29 14:06:40 2018
-// Update Count     : 3
-//
-
-#pragma once
-
-#include "kernel"
-#include "thread"
-
-#include "alarm.h"
-
-
-//-----------------------------------------------------------------------------
-// Scheduler
-
-extern "C" {
-	void disable_interrupts();
-	void enable_interrupts_noPoll();
-	void enable_interrupts( __cfaabi_dbg_ctx_param );
-}
-
-void ScheduleThread( thread_desc * );
-static inline void WakeThread( thread_desc * thrd ) {
-	if( !thrd ) return;
-
-	disable_interrupts();
-	ScheduleThread( thrd );
-	enable_interrupts( __cfaabi_dbg_ctx );
-}
-thread_desc * nextThread(cluster * this);
-
-//Block current thread and release/wake-up the following resources
-void BlockInternal(void);
-void BlockInternal(__spinlock_t * lock);
-void BlockInternal(thread_desc * thrd);
-void BlockInternal(__spinlock_t * lock, thread_desc * thrd);
-void BlockInternal(__spinlock_t * locks [], unsigned short count);
-void BlockInternal(__spinlock_t * locks [], unsigned short count, thread_desc * thrds [], unsigned short thrd_count);
-void BlockInternal(__finish_callback_fptr_t callback);
-void LeaveThread(__spinlock_t * lock, thread_desc * thrd);
-
-//-----------------------------------------------------------------------------
-// Processor
-void main(processorCtx_t *);
-
-static inline void wake_fast(processor * this) {
-	__cfaabi_dbg_print_safe("Kernel : Waking up processor %p\n", this);
-	post( this->idleLock );
-}
-
-static inline void wake(processor * this) {
-	disable_interrupts();
-	wake_fast(this);
-	enable_interrupts( __cfaabi_dbg_ctx );
-}
-
-struct event_kernel_t {
-	alarm_list_t alarms;
-	__spinlock_t lock;
-};
-
-extern event_kernel_t * event_kernel;
-
-struct __cfa_kernel_preemption_state_t {
-	bool enabled;
-	bool in_progress;
-	unsigned short disable_count;
-};
-
-extern volatile thread_local __cfa_kernel_preemption_state_t preemption_state;
-
-//-----------------------------------------------------------------------------
-// Threads
-extern "C" {
-      forall(dtype T | is_thread(T))
-      void CtxInvokeThread(T * this);
-}
-
-extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
-
-__cfaabi_dbg_debug_do(
-	extern void __cfaabi_dbg_thread_register  ( thread_desc * thrd );
-	extern void __cfaabi_dbg_thread_unregister( thread_desc * thrd );
-)
-
-//-----------------------------------------------------------------------------
-// Utils
-#define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
-
-
-void doregister( struct cluster & cltr );
-void unregister( struct cluster & cltr );
-
-void doregister( struct cluster * cltr, struct thread_desc & thrd );
-void unregister( struct cluster * cltr, struct thread_desc & thrd );
-
-void doregister( struct cluster * cltr, struct processor * proc );
-void unregister( struct cluster * cltr, struct processor * proc );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/concurrency/kernel_private.hfa
===================================================================
--- libcfa/src/concurrency/kernel_private.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/kernel_private.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,114 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// kernel_private.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Feb 13 12:27:26 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Mar 29 14:06:40 2018
+// Update Count     : 3
+//
+
+#pragma once
+
+#include "kernel"
+#include "thread"
+
+#include "alarm.hfa"
+
+
+//-----------------------------------------------------------------------------
+// Scheduler
+
+extern "C" {
+	void disable_interrupts();
+	void enable_interrupts_noPoll();
+	void enable_interrupts( __cfaabi_dbg_ctx_param );
+}
+
+void ScheduleThread( thread_desc * );
+static inline void WakeThread( thread_desc * thrd ) {
+	if( !thrd ) return;
+
+	disable_interrupts();
+	ScheduleThread( thrd );
+	enable_interrupts( __cfaabi_dbg_ctx );
+}
+thread_desc * nextThread(cluster * this);
+
+//Block current thread and release/wake-up the following resources
+void BlockInternal(void);
+void BlockInternal(__spinlock_t * lock);
+void BlockInternal(thread_desc * thrd);
+void BlockInternal(__spinlock_t * lock, thread_desc * thrd);
+void BlockInternal(__spinlock_t * locks [], unsigned short count);
+void BlockInternal(__spinlock_t * locks [], unsigned short count, thread_desc * thrds [], unsigned short thrd_count);
+void BlockInternal(__finish_callback_fptr_t callback);
+void LeaveThread(__spinlock_t * lock, thread_desc * thrd);
+
+//-----------------------------------------------------------------------------
+// Processor
+void main(processorCtx_t *);
+
+static inline void wake_fast(processor * this) {
+	__cfaabi_dbg_print_safe("Kernel : Waking up processor %p\n", this);
+	post( this->idleLock );
+}
+
+static inline void wake(processor * this) {
+	disable_interrupts();
+	wake_fast(this);
+	enable_interrupts( __cfaabi_dbg_ctx );
+}
+
+struct event_kernel_t {
+	alarm_list_t alarms;
+	__spinlock_t lock;
+};
+
+extern event_kernel_t * event_kernel;
+
+struct __cfa_kernel_preemption_state_t {
+	bool enabled;
+	bool in_progress;
+	unsigned short disable_count;
+};
+
+extern volatile thread_local __cfa_kernel_preemption_state_t preemption_state;
+
+//-----------------------------------------------------------------------------
+// Threads
+extern "C" {
+      forall(dtype T | is_thread(T))
+      void CtxInvokeThread(T * this);
+}
+
+extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
+
+__cfaabi_dbg_debug_do(
+	extern void __cfaabi_dbg_thread_register  ( thread_desc * thrd );
+	extern void __cfaabi_dbg_thread_unregister( thread_desc * thrd );
+)
+
+//-----------------------------------------------------------------------------
+// Utils
+#define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
+
+
+void doregister( struct cluster & cltr );
+void unregister( struct cluster & cltr );
+
+void doregister( struct cluster * cltr, struct thread_desc & thrd );
+void unregister( struct cluster * cltr, struct thread_desc & thrd );
+
+void doregister( struct cluster * cltr, struct processor * proc );
+void unregister( struct cluster * cltr, struct processor * proc );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/concurrency/monitor
===================================================================
--- libcfa/src/concurrency/monitor	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,149 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// monitor --
-//
-// Author           : Thierry Delisle
-// Created On       : Thd Feb 23 12:27:26 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Oct  7 18:06:45 2017
-// Update Count     : 10
-//
-
-#pragma once
-
-#include <stddef.h>
-
-#include <assert.h>
-#include "invoke.h"
-#include "stdlib"
-
-trait is_monitor(dtype T) {
-	monitor_desc * get_monitor( T & );
-	void ^?{}( T & mutex );
-};
-
-static inline void ?{}(monitor_desc & this) with( this ) {
-	lock{};
-	entry_queue{};
-	signal_stack{};
-	owner         = NULL;
-	recursion     = 0;
-	mask.accepted = NULL;
-	mask.data     = NULL;
-	mask.size     = 0;
-	dtor_node     = NULL;
-}
-
-struct monitor_guard_t {
-	monitor_desc ** 	m;
-	__lock_size_t   	count;
-	__monitor_group_t prev;
-};
-
-void ?{}( monitor_guard_t & this, monitor_desc ** m, __lock_size_t count, void (*func)() );
-void ^?{}( monitor_guard_t & this );
-
-struct monitor_dtor_guard_t {
-	monitor_desc *    m;
-	__monitor_group_t prev;
-};
-
-void ?{}( monitor_dtor_guard_t & this, monitor_desc ** m, void (*func)() );
-void ^?{}( monitor_dtor_guard_t & this );
-
-static inline forall( dtype T | sized(T) | { void ^?{}( T & mutex ); } )
-void delete( T * th ) {
-	^(*th){};
-	free( th );
-}
-
-//-----------------------------------------------------------------------------
-// Internal scheduling
-
-struct __condition_criterion_t {
-	// Whether or not the criterion is met (True if met)
-	bool ready;
-
-	// The monitor this criterion concerns
-	monitor_desc * target;
-
-	// The parent node to which this criterion belongs
-	struct __condition_node_t * owner;
-
-	// Intrusive linked list Next field
-	__condition_criterion_t * next;
-};
-
-static inline __condition_criterion_t * & get_next( __condition_criterion_t & this ) {
-	return this.next;
-}
-
-struct __condition_node_t {
-	// Thread that needs to be woken when all criteria are met
-	thread_desc * waiting_thread;
-
-	// Array of criteria (Criterions are contiguous in memory)
-	__condition_criterion_t * criteria;
-
-	// Number of criterions in the criteria
-	__lock_size_t count;
-
-	// Intrusive linked list Next field
-	__condition_node_t * next;
-
-	// Custom user info accessible before signalling
-	uintptr_t user_info;
-};
-
-static inline __condition_node_t * & get_next( __condition_node_t & this ) {
-	return this.next;
-}
-
-void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info );
-void ?{}(__condition_criterion_t & this );
-void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner );
-
-struct condition {
-	// Link list which contains the blocked threads as-well as the information needed to unblock them
-	__queue_t(__condition_node_t) blocked;
-
-	// Array of monitor pointers (Monitors are NOT contiguous in memory)
-	monitor_desc ** monitors;
-
-	// Number of monitors in the array
-	__lock_size_t monitor_count;
-};
-
-static inline void ?{}( condition & this ) {
-	this.monitors = NULL;
-	this.monitor_count = 0;
-}
-
-static inline void ^?{}( condition & this ) {
-	free( this.monitors );
-}
-
-              void wait        ( condition & this, uintptr_t user_info = 0 );
-              bool signal      ( condition & this );
-              bool signal_block( condition & this );
-static inline bool is_empty    ( condition & this ) { return !this.blocked.head; }
-         uintptr_t front       ( condition & this );
-
-//-----------------------------------------------------------------------------
-// External scheduling
-
-struct __acceptable_t {
-	inline struct __monitor_group_t;
-	bool is_dtor;
-};
-
-void __waitfor_internal( const __waitfor_mask_t & mask, int duration );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/concurrency/monitor.cfa
===================================================================
--- libcfa/src/concurrency/monitor.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/monitor.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -16,10 +16,10 @@
 #include "monitor"
 
-#include <stdlib>
+#include <stdlib.hfa>
 #include <inttypes.h>
 
-#include "kernel_private.h"
-
-#include "bits/algorithms.h"
+#include "kernel_private.hfa"
+
+#include "bits/algorithms.hfa"
 
 //-----------------------------------------------------------------------------
Index: libcfa/src/concurrency/monitor.hfa
===================================================================
--- libcfa/src/concurrency/monitor.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/monitor.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,149 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// monitor --
+//
+// Author           : Thierry Delisle
+// Created On       : Thd Feb 23 12:27:26 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Oct  7 18:06:45 2017
+// Update Count     : 10
+//
+
+#pragma once
+
+#include <stddef.h>
+
+#include <assert.h>
+#include "invoke.h"
+#include "stdlib"
+
+trait is_monitor(dtype T) {
+	monitor_desc * get_monitor( T & );
+	void ^?{}( T & mutex );
+};
+
+static inline void ?{}(monitor_desc & this) with( this ) {
+	lock{};
+	entry_queue{};
+	signal_stack{};
+	owner         = NULL;
+	recursion     = 0;
+	mask.accepted = NULL;
+	mask.data     = NULL;
+	mask.size     = 0;
+	dtor_node     = NULL;
+}
+
+struct monitor_guard_t {
+	monitor_desc ** 	m;
+	__lock_size_t   	count;
+	__monitor_group_t prev;
+};
+
+void ?{}( monitor_guard_t & this, monitor_desc ** m, __lock_size_t count, void (*func)() );
+void ^?{}( monitor_guard_t & this );
+
+struct monitor_dtor_guard_t {
+	monitor_desc *    m;
+	__monitor_group_t prev;
+};
+
+void ?{}( monitor_dtor_guard_t & this, monitor_desc ** m, void (*func)() );
+void ^?{}( monitor_dtor_guard_t & this );
+
+static inline forall( dtype T | sized(T) | { void ^?{}( T & mutex ); } )
+void delete( T * th ) {
+	^(*th){};
+	free( th );
+}
+
+//-----------------------------------------------------------------------------
+// Internal scheduling
+
+struct __condition_criterion_t {
+	// Whether or not the criterion is met (True if met)
+	bool ready;
+
+	// The monitor this criterion concerns
+	monitor_desc * target;
+
+	// The parent node to which this criterion belongs
+	struct __condition_node_t * owner;
+
+	// Intrusive linked list Next field
+	__condition_criterion_t * next;
+};
+
+static inline __condition_criterion_t * & get_next( __condition_criterion_t & this ) {
+	return this.next;
+}
+
+struct __condition_node_t {
+	// Thread that needs to be woken when all criteria are met
+	thread_desc * waiting_thread;
+
+	// Array of criteria (Criterions are contiguous in memory)
+	__condition_criterion_t * criteria;
+
+	// Number of criterions in the criteria
+	__lock_size_t count;
+
+	// Intrusive linked list Next field
+	__condition_node_t * next;
+
+	// Custom user info accessible before signalling
+	uintptr_t user_info;
+};
+
+static inline __condition_node_t * & get_next( __condition_node_t & this ) {
+	return this.next;
+}
+
+void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info );
+void ?{}(__condition_criterion_t & this );
+void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner );
+
+struct condition {
+	// Link list which contains the blocked threads as-well as the information needed to unblock them
+	__queue_t(__condition_node_t) blocked;
+
+	// Array of monitor pointers (Monitors are NOT contiguous in memory)
+	monitor_desc ** monitors;
+
+	// Number of monitors in the array
+	__lock_size_t monitor_count;
+};
+
+static inline void ?{}( condition & this ) {
+	this.monitors = NULL;
+	this.monitor_count = 0;
+}
+
+static inline void ^?{}( condition & this ) {
+	free( this.monitors );
+}
+
+              void wait        ( condition & this, uintptr_t user_info = 0 );
+              bool signal      ( condition & this );
+              bool signal_block( condition & this );
+static inline bool is_empty    ( condition & this ) { return !this.blocked.head; }
+         uintptr_t front       ( condition & this );
+
+//-----------------------------------------------------------------------------
+// External scheduling
+
+struct __acceptable_t {
+	inline struct __monitor_group_t;
+	bool is_dtor;
+};
+
+void __waitfor_internal( const __waitfor_mask_t & mask, int duration );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/concurrency/mutex
===================================================================
--- libcfa/src/concurrency/mutex	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,171 +1,0 @@
-
-//                              -*- Mode: CFA -*-
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// mutex --
-//
-// Author           : Thierry Delisle
-// Created On       : Fri May 25 01:24:09 2018
-// Last Modified By : Thierry Delisle
-// Last Modified On : Fri May 25 01:24:12 2018
-// Update Count     : 0
-//
-
-#pragma once
-
-#include <stdbool.h>
-
-#include "bits/algorithms.h"
-#include "bits/locks.h"
-
-#include "invoke.h"
-#include "time_t.h"
-
-//-----------------------------------------------------------------------------
-// Locks
-
-// Exclusive lock - non-recursive
-// ---
-struct mutex_lock {
-	// Spin lock used for mutual exclusion
-	__spinlock_t lock;
-
-	// List of blocked threads
-	__queue_t(struct thread_desc) blocked_threads;
-
-	// Locked flag
-	bool is_locked;
-};
-
-void ?{}(mutex_lock & this);
-void ^?{}(mutex_lock & this);
-void lock(mutex_lock & this);
-bool try_lock(mutex_lock & this);
-void unlock(mutex_lock & this);
-
-// Exclusive lock - recursive
-// ---
-struct recursive_mutex_lock{
-	// Spin lock used for mutual exclusion
-	__spinlock_t lock;
-
-	// List of blocked threads
-	__queue_t(struct thread_desc) blocked_threads;
-
-	// Current thread owning the lock
-	struct thread_desc * owner;
-
-	// Number of recursion level
-	size_t recursion_count;
-};
-
-void ?{}(recursive_mutex_lock & this);
-void ^?{}(recursive_mutex_lock & this);
-void lock(recursive_mutex_lock & this);
-bool try_lock(recursive_mutex_lock & this);
-void unlock(recursive_mutex_lock & this);
-
-trait is_lock(dtype L | sized(L)) {
-	void lock  (L &);
-	void unlock(L &);
-};
-
-//-----------------------------------------------------------------------------
-// Condition variables
-
-struct condition_variable {
-	// Spin lock used for mutual exclusion
-	__spinlock_t lock;
-
-	// List of blocked threads
-	__queue_t(struct thread_desc) blocked_threads;
-};
-
-void ?{}(condition_variable & this);
-void ^?{}(condition_variable & this);
-
-void notify_one(condition_variable & this);
-void notify_all(condition_variable & this);
-
-void wait(condition_variable & this);
-
-forall(dtype L | is_lock(L))
-void wait(condition_variable & this, L & l);
-
-//-----------------------------------------------------------------------------
-// Scopes
-forall(dtype L | is_lock(L)) {
-	#if !defined( __TUPLE_ARRAYS_EXIST__ )
-	void lock  ( L * locks [], size_t count);
-	void unlock( L * locks [], size_t count);
-
-	struct lock_scope {
-		L **   locks;
-		size_t count;
-	};
-
-	static inline void ?{}(lock_scope(L) & this) {
-		this.locks = NULL;
-		this.count = 0;
-	}
-
-	static inline void ^?{}(lock_scope(L) & this) {
-		if(this.count > 0) {
-			unlock(this.locks, this.count);
-		}
-	}
-
-	static inline lock_scope(L) lock( L * locks [], size_t count, lock_scope(L) & scope) {
-		lock(locks, count);
-		scope.locks = locks;
-		scope.count = count;
-	}
-
-	static inline void unlock( lock_scope(L) & this ) {
-		unlock(this.locks, this.count);
-		this.count = 0;
-	}
-
-	static inline void release( lock_scope(L) & this ) {
-		this.count = 0;
-	}
-	#else
-	void lock( [L &...] locks );
-	void unlock( [L &...] locks );
-
-	forall(size_t N)
-	struct lock_scope {
-		bool released;
-		[L &... N] locks;
-	};
-
-	void ?{}(lock_scope(L) & this) = void;
-	void ?{}(lock_scope(L) & this, lock_scope(L) other) = void;
-	void ?move?(lock_scope(L) & this, lock_scope(L) & other) = default;
-
-	static inline void ^?{}(lock_scope(L) & this) {
-		if( !this.released ) {
-			unlock(this.locks);
-		}
-	}
-
-	forall(size_t N)
-	static inline lock_scope(L, N) lock( [L &...] locks ) {
-		lock(locks);
-		return @{false, locks};
-	}
-
-	static inline void unlock( lock_scope(L) & this ) {
-		unlock(this.locks);
-		this.released = true
-	}
-
-	static inline void release( lock_scope(L) & this ) {
-		this.released = true;
-	}
-	#endif
-}
Index: libcfa/src/concurrency/mutex.cfa
===================================================================
--- libcfa/src/concurrency/mutex.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/mutex.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -18,5 +18,5 @@
 #include "mutex"
 
-#include "kernel_private.h"
+#include "kernel_private.hfa"
 
 //-----------------------------------------------------------------------------
Index: libcfa/src/concurrency/mutex.hfa
===================================================================
--- libcfa/src/concurrency/mutex.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/mutex.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,171 @@
+
+//                              -*- Mode: CFA -*-
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// mutex --
+//
+// Author           : Thierry Delisle
+// Created On       : Fri May 25 01:24:09 2018
+// Last Modified By : Thierry Delisle
+// Last Modified On : Fri May 25 01:24:12 2018
+// Update Count     : 0
+//
+
+#pragma once
+
+#include <stdbool.h>
+
+#include "bits/algorithms.hfa"
+#include "bits/locks.hfa"
+
+#include "invoke.h"
+#include "time_t.hfa"
+
+//-----------------------------------------------------------------------------
+// Locks
+
+// Exclusive lock - non-recursive
+// ---
+struct mutex_lock {
+	// Spin lock used for mutual exclusion
+	__spinlock_t lock;
+
+	// List of blocked threads
+	__queue_t(struct thread_desc) blocked_threads;
+
+	// Locked flag
+	bool is_locked;
+};
+
+void ?{}(mutex_lock & this);
+void ^?{}(mutex_lock & this);
+void lock(mutex_lock & this);
+bool try_lock(mutex_lock & this);
+void unlock(mutex_lock & this);
+
+// Exclusive lock - recursive
+// ---
+struct recursive_mutex_lock{
+	// Spin lock used for mutual exclusion
+	__spinlock_t lock;
+
+	// List of blocked threads
+	__queue_t(struct thread_desc) blocked_threads;
+
+	// Current thread owning the lock
+	struct thread_desc * owner;
+
+	// Number of recursion level
+	size_t recursion_count;
+};
+
+void ?{}(recursive_mutex_lock & this);
+void ^?{}(recursive_mutex_lock & this);
+void lock(recursive_mutex_lock & this);
+bool try_lock(recursive_mutex_lock & this);
+void unlock(recursive_mutex_lock & this);
+
+trait is_lock(dtype L | sized(L)) {
+	void lock  (L &);
+	void unlock(L &);
+};
+
+//-----------------------------------------------------------------------------
+// Condition variables
+
+struct condition_variable {
+	// Spin lock used for mutual exclusion
+	__spinlock_t lock;
+
+	// List of blocked threads
+	__queue_t(struct thread_desc) blocked_threads;
+};
+
+void ?{}(condition_variable & this);
+void ^?{}(condition_variable & this);
+
+void notify_one(condition_variable & this);
+void notify_all(condition_variable & this);
+
+void wait(condition_variable & this);
+
+forall(dtype L | is_lock(L))
+void wait(condition_variable & this, L & l);
+
+//-----------------------------------------------------------------------------
+// Scopes
+forall(dtype L | is_lock(L)) {
+	#if !defined( __TUPLE_ARRAYS_EXIST__ )
+	void lock  ( L * locks [], size_t count);
+	void unlock( L * locks [], size_t count);
+
+	struct lock_scope {
+		L **   locks;
+		size_t count;
+	};
+
+	static inline void ?{}(lock_scope(L) & this) {
+		this.locks = NULL;
+		this.count = 0;
+	}
+
+	static inline void ^?{}(lock_scope(L) & this) {
+		if(this.count > 0) {
+			unlock(this.locks, this.count);
+		}
+	}
+
+	static inline lock_scope(L) lock( L * locks [], size_t count, lock_scope(L) & scope) {
+		lock(locks, count);
+		scope.locks = locks;
+		scope.count = count;
+	}
+
+	static inline void unlock( lock_scope(L) & this ) {
+		unlock(this.locks, this.count);
+		this.count = 0;
+	}
+
+	static inline void release( lock_scope(L) & this ) {
+		this.count = 0;
+	}
+	#else
+	void lock( [L &...] locks );
+	void unlock( [L &...] locks );
+
+	forall(size_t N)
+	struct lock_scope {
+		bool released;
+		[L &... N] locks;
+	};
+
+	void ?{}(lock_scope(L) & this) = void;
+	void ?{}(lock_scope(L) & this, lock_scope(L) other) = void;
+	void ?move?(lock_scope(L) & this, lock_scope(L) & other) = default;
+
+	static inline void ^?{}(lock_scope(L) & this) {
+		if( !this.released ) {
+			unlock(this.locks);
+		}
+	}
+
+	forall(size_t N)
+	static inline lock_scope(L, N) lock( [L &...] locks ) {
+		lock(locks);
+		return @{false, locks};
+	}
+
+	static inline void unlock( lock_scope(L) & this ) {
+		unlock(this.locks);
+		this.released = true
+	}
+
+	static inline void release( lock_scope(L) & this ) {
+		this.released = true;
+	}
+	#endif
+}
Index: libcfa/src/concurrency/preemption.cfa
===================================================================
--- libcfa/src/concurrency/preemption.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/preemption.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -14,5 +14,5 @@
 //
 
-#include "preemption.h"
+#include "preemption.hfa"
 #include <assert.h>
 
@@ -24,5 +24,5 @@
 }
 
-#include "bits/signal.h"
+#include "bits/signal.hfa"
 
 #if !defined(__CFA_DEFAULT_PREEMPTION__)
Index: libcfa/src/concurrency/preemption.h
===================================================================
--- libcfa/src/concurrency/preemption.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,36 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// preemption.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Jun 5 14:20:42 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Mar 23 17:18:53 2018
-// Update Count     : 2
-//
-
-#pragma once
-
-#include "alarm.h"
-#include "kernel_private.h"
-
-void kernel_start_preemption();
-void kernel_stop_preemption();
-void update_preemption( processor * this, Duration duration );
-
-struct preemption_scope {
-	alarm_node_t alarm;
-	processor * proc;
-};
-
-void ?{}( preemption_scope & this, processor * proc );
-void ^?{}( preemption_scope & this );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/concurrency/preemption.hfa
===================================================================
--- libcfa/src/concurrency/preemption.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/preemption.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,36 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// preemption.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Jun 5 14:20:42 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Mar 23 17:18:53 2018
+// Update Count     : 2
+//
+
+#pragma once
+
+#include "alarm.hfa"
+#include "kernel_private.hfa"
+
+void kernel_start_preemption();
+void kernel_stop_preemption();
+void update_preemption( processor * this, Duration duration );
+
+struct preemption_scope {
+	alarm_node_t alarm;
+	processor * proc;
+};
+
+void ?{}( preemption_scope & this, processor * proc );
+void ^?{}( preemption_scope & this );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/concurrency/thread
===================================================================
--- libcfa/src/concurrency/thread	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,96 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// thread --
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Jan 17 12:27:26 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Mar 29 14:07:11 2018
-// Update Count     : 4
-//
-
-#pragma once
-
-#include <assert.h>
-#include "invoke.h"
-
-#include "coroutine"
-#include "kernel"
-#include "monitor"
-
-//-----------------------------------------------------------------------------
-// thread trait
-trait is_thread(dtype T) {
-      void ^?{}(T& mutex this);
-      void main(T& this);
-      thread_desc* get_thread(T& this);
-};
-
-#define DECL_THREAD(X) thread_desc* get_thread(X& this) { return &this.__thrd; } void main(X& this)
-
-forall( dtype T | is_thread(T) )
-static inline coroutine_desc* get_coroutine(T & this) {
-	return &get_thread(this)->self_cor;
-}
-
-forall( dtype T | is_thread(T) )
-static inline monitor_desc* get_monitor(T & this) {
-	return &get_thread(this)->self_mon;
-}
-
-static inline coroutine_desc* get_coroutine(thread_desc * this) {
-	return &this->self_cor;
-}
-
-static inline monitor_desc* get_monitor(thread_desc * this) {
-	return &this->self_mon;
-}
-
-extern struct cluster * mainCluster;
-
-forall( dtype T | is_thread(T) )
-void __thrd_start( T & this );
-
-//-----------------------------------------------------------------------------
-// Ctors and dtors
-void ?{}(thread_desc & this, const char * const name, struct cluster & cl, void * storage, size_t storageSize );
-void ^?{}(thread_desc & this);
-
-static inline void ?{}(thread_desc & this)                                                                  { this{ "Anonymous Thread", *mainCluster, NULL, 0 }; }
-static inline void ?{}(thread_desc & this, size_t stackSize )                                               { this{ "Anonymous Thread", *mainCluster, NULL, stackSize }; }
-static inline void ?{}(thread_desc & this, void * storage, size_t storageSize )                             { this{ "Anonymous Thread", *mainCluster, storage, storageSize }; }
-static inline void ?{}(thread_desc & this, struct cluster & cl )                                            { this{ "Anonymous Thread", cl, NULL, 0 }; }
-static inline void ?{}(thread_desc & this, struct cluster & cl, size_t stackSize )                          { this{ "Anonymous Thread", cl, 0, stackSize }; }
-static inline void ?{}(thread_desc & this, struct cluster & cl, void * storage, size_t storageSize )        { this{ "Anonymous Thread", cl, storage, storageSize }; }
-static inline void ?{}(thread_desc & this, const char * const name)                                         { this{ name, *mainCluster, NULL, 0 }; }
-static inline void ?{}(thread_desc & this, const char * const name, struct cluster & cl )                   { this{ name, cl, NULL, 0 }; }
-static inline void ?{}(thread_desc & this, const char * const name, struct cluster & cl, size_t stackSize ) { this{ name, cl, NULL, stackSize }; }
-
-//-----------------------------------------------------------------------------
-// thread runner
-// Structure that actually start and stop threads
-forall( dtype T | sized(T) | is_thread(T) )
-struct scoped {
-	T handle;
-};
-
-forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
-void ?{}( scoped(T)& this );
-
-forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
-void ?{}( scoped(T)& this, P params );
-
-forall( dtype T | sized(T) | is_thread(T) )
-void ^?{}( scoped(T)& this );
-
-void yield();
-void yield( unsigned times );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/concurrency/thread.cfa
===================================================================
--- libcfa/src/concurrency/thread.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/concurrency/thread.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -16,5 +16,5 @@
 #include "thread"
 
-#include "kernel_private.h"
+#include "kernel_private.hfa"
 
 #define __CFA_INVOKE_PRIVATE__
Index: libcfa/src/concurrency/thread.hfa
===================================================================
--- libcfa/src/concurrency/thread.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/concurrency/thread.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,96 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// thread --
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Jan 17 12:27:26 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Mar 29 14:07:11 2018
+// Update Count     : 4
+//
+
+#pragma once
+
+#include <assert.h>
+#include "invoke.h"
+
+#include "coroutine"
+#include "kernel"
+#include "monitor"
+
+//-----------------------------------------------------------------------------
+// thread trait
+trait is_thread(dtype T) {
+      void ^?{}(T& mutex this);
+      void main(T& this);
+      thread_desc* get_thread(T& this);
+};
+
+#define DECL_THREAD(X) thread_desc* get_thread(X& this) { return &this.__thrd; } void main(X& this)
+
+forall( dtype T | is_thread(T) )
+static inline coroutine_desc* get_coroutine(T & this) {
+	return &get_thread(this)->self_cor;
+}
+
+forall( dtype T | is_thread(T) )
+static inline monitor_desc* get_monitor(T & this) {
+	return &get_thread(this)->self_mon;
+}
+
+static inline coroutine_desc* get_coroutine(thread_desc * this) {
+	return &this->self_cor;
+}
+
+static inline monitor_desc* get_monitor(thread_desc * this) {
+	return &this->self_mon;
+}
+
+extern struct cluster * mainCluster;
+
+forall( dtype T | is_thread(T) )
+void __thrd_start( T & this );
+
+//-----------------------------------------------------------------------------
+// Ctors and dtors
+void ?{}(thread_desc & this, const char * const name, struct cluster & cl, void * storage, size_t storageSize );
+void ^?{}(thread_desc & this);
+
+static inline void ?{}(thread_desc & this)                                                                  { this{ "Anonymous Thread", *mainCluster, NULL, 0 }; }
+static inline void ?{}(thread_desc & this, size_t stackSize )                                               { this{ "Anonymous Thread", *mainCluster, NULL, stackSize }; }
+static inline void ?{}(thread_desc & this, void * storage, size_t storageSize )                             { this{ "Anonymous Thread", *mainCluster, storage, storageSize }; }
+static inline void ?{}(thread_desc & this, struct cluster & cl )                                            { this{ "Anonymous Thread", cl, NULL, 0 }; }
+static inline void ?{}(thread_desc & this, struct cluster & cl, size_t stackSize )                          { this{ "Anonymous Thread", cl, 0, stackSize }; }
+static inline void ?{}(thread_desc & this, struct cluster & cl, void * storage, size_t storageSize )        { this{ "Anonymous Thread", cl, storage, storageSize }; }
+static inline void ?{}(thread_desc & this, const char * const name)                                         { this{ name, *mainCluster, NULL, 0 }; }
+static inline void ?{}(thread_desc & this, const char * const name, struct cluster & cl )                   { this{ name, cl, NULL, 0 }; }
+static inline void ?{}(thread_desc & this, const char * const name, struct cluster & cl, size_t stackSize ) { this{ name, cl, NULL, stackSize }; }
+
+//-----------------------------------------------------------------------------
+// thread runner
+// Structure that actually start and stop threads
+forall( dtype T | sized(T) | is_thread(T) )
+struct scoped {
+	T handle;
+};
+
+forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
+void ?{}( scoped(T)& this );
+
+forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
+void ?{}( scoped(T)& this, P params );
+
+forall( dtype T | sized(T) | is_thread(T) )
+void ^?{}( scoped(T)& this );
+
+void yield();
+void yield( unsigned times );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/containers/maybe
===================================================================
--- libcfa/src/containers/maybe	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,69 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// maybe -- May contain a value.
-//
-// Author           : Andrew Beach
-// Created On       : Wed May 24 14:43:00 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jul 22 10:00:52 2017
-// Update Count     : 4
-//
-
-#pragma once
-
-#include <stdbool.h>
-
-// DO NOT USE DIRECTLY!
-forall(otype T)
-struct maybe {
-    bool has_value;
-    T value;
-};
-
-
-forall(otype T)
-void ?{}(maybe(T) & this);
-
-forall(otype T)
-void ?{}(maybe(T) & this, T value);
-
-forall(otype T)
-void ?{}(maybe(T) & this, maybe(T) other);
-
-forall(otype T)
-void ^?{}(maybe(T) & this);
-
-forall(otype T)
-maybe(T) ?=?(maybe(T) & this, maybe(T) other);
-
-forall(otype T)
-bool ?!=?(maybe(T) this, zero_t);
-
-/* Waiting for bug#11 to be fixed.
-forall(otype T)
-maybe(T) maybe_value(T value);
-
-forall(otype T)
-maybe(T) maybe_none();
-*/
-
-forall(otype T)
-bool has_value(maybe(T) * this);
-
-forall(otype T)
-T get(maybe(T) * this);
-
-forall(otype T)
-void set(maybe(T) * this, T value);
-
-forall(otype T)
-void set_none(maybe(T) * this);
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/containers/maybe.hfa
===================================================================
--- libcfa/src/containers/maybe.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/containers/maybe.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,69 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// maybe -- May contain a value.
+//
+// Author           : Andrew Beach
+// Created On       : Wed May 24 14:43:00 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Jul 22 10:00:52 2017
+// Update Count     : 4
+//
+
+#pragma once
+
+#include <stdbool.h>
+
+// DO NOT USE DIRECTLY!
+forall(otype T)
+struct maybe {
+    bool has_value;
+    T value;
+};
+
+
+forall(otype T)
+void ?{}(maybe(T) & this);
+
+forall(otype T)
+void ?{}(maybe(T) & this, T value);
+
+forall(otype T)
+void ?{}(maybe(T) & this, maybe(T) other);
+
+forall(otype T)
+void ^?{}(maybe(T) & this);
+
+forall(otype T)
+maybe(T) ?=?(maybe(T) & this, maybe(T) other);
+
+forall(otype T)
+bool ?!=?(maybe(T) this, zero_t);
+
+/* Waiting for bug#11 to be fixed.
+forall(otype T)
+maybe(T) maybe_value(T value);
+
+forall(otype T)
+maybe(T) maybe_none();
+*/
+
+forall(otype T)
+bool has_value(maybe(T) * this);
+
+forall(otype T)
+T get(maybe(T) * this);
+
+forall(otype T)
+void set(maybe(T) * this, T value);
+
+forall(otype T)
+void set_none(maybe(T) * this);
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/containers/pair
===================================================================
--- libcfa/src/containers/pair	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,48 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// pair --
-//
-// Author           : Aaron Moss
-// Created On       : Wed Apr 12 15:32:00 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jul 22 09:59:53 2017
-// Update Count     : 2
-//
-
-#pragma once
-
-forall(otype R, otype S) struct pair {
-	R first;
-	S second;
-};
-
-forall(otype R, otype S 
-	| { int ?==?(R, R); int ?<?(R, R); int ?<?(S, S); })
-int ?<?(pair(R, S) p, pair(R, S) q);
-
-forall(otype R, otype S 
-	| { int ?==?(R, R); int ?<?(R, R); int ?<=?(S, S); })
-int ?<=?(pair(R, S) p, pair(R, S) q);
-
-forall(otype R, otype S | { int ?==?(R, R); int ?==?(S, S); })
-int ?==?(pair(R, S) p, pair(R, S) q);
-
-forall(otype R, otype S | { int ?!=?(R, R); int ?!=?(S, S); })
-int ?!=?(pair(R, S) p, pair(R, S) q);
-
-forall(otype R, otype S 
-	| { int ?==?(R, R); int ?>?(R, R); int ?>?(S, S); })
-int ?>?(pair(R, S) p, pair(R, S) q);
-
-forall(otype R, otype S 
-	| { int ?==?(R, R); int ?>?(R, R); int ?>=?(S, S); })
-int ?>=?(pair(R, S) p, pair(R, S) q);
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/containers/pair.hfa
===================================================================
--- libcfa/src/containers/pair.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/containers/pair.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,48 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// pair --
+//
+// Author           : Aaron Moss
+// Created On       : Wed Apr 12 15:32:00 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Jul 22 09:59:53 2017
+// Update Count     : 2
+//
+
+#pragma once
+
+forall(otype R, otype S) struct pair {
+	R first;
+	S second;
+};
+
+forall(otype R, otype S 
+	| { int ?==?(R, R); int ?<?(R, R); int ?<?(S, S); })
+int ?<?(pair(R, S) p, pair(R, S) q);
+
+forall(otype R, otype S 
+	| { int ?==?(R, R); int ?<?(R, R); int ?<=?(S, S); })
+int ?<=?(pair(R, S) p, pair(R, S) q);
+
+forall(otype R, otype S | { int ?==?(R, R); int ?==?(S, S); })
+int ?==?(pair(R, S) p, pair(R, S) q);
+
+forall(otype R, otype S | { int ?!=?(R, R); int ?!=?(S, S); })
+int ?!=?(pair(R, S) p, pair(R, S) q);
+
+forall(otype R, otype S 
+	| { int ?==?(R, R); int ?>?(R, R); int ?>?(S, S); })
+int ?>?(pair(R, S) p, pair(R, S) q);
+
+forall(otype R, otype S 
+	| { int ?==?(R, R); int ?>?(R, R); int ?>=?(S, S); })
+int ?>=?(pair(R, S) p, pair(R, S) q);
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/containers/result
===================================================================
--- libcfa/src/containers/result	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,81 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// result -- Contains the expected value or an error value.
-//
-// Author           : Andrew Beach
-// Created On       : Wed May 24 14:45:00 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jul 22 10:00:44 2017
-// Update Count     : 3
-//
-
-#pragma once
-
-#include <stdbool.h>
-
-// DO NOT USE DIRECTLY!
-forall(otype T, otype E)
-union inner_result{
-	T value;
-	E error;
-};
-
-forall(otype T, otype E)
-struct result {
-	bool has_value;
-	inline union inner_result(T, E);
-};
-
-
-forall(otype T, otype E)
-void ?{}(result(T, E) & this);
-
-forall(otype T, otype E)
-void ?{}(result(T, E) & this, one_t, T value);
-
-forall(otype T, otype E)
-void ?{}(result(T, E) & this, zero_t, E error);
-
-forall(otype T, otype E)
-void ?{}(result(T, E) & this, result(T, E) other);
-
-forall(otype T, otype E)
-void ^?{}(result(T, E) & this);
-
-forall(otype T, otype E)
-result(T, E) ?=?(result(T, E) & this, result(T, E) other);
-
-forall(otype T, otype E)
-bool ?!=?(result(T, E) this, zero_t);
-
-/* Wating for bug#11 to be fixed.
-forall(otype T, otype E)
-result(T, E) result_value(T value);
-
-forall(otype T, otype E)
-result(T, E) result_error(E error);
-*/
-
-forall(otype T, otype E)
-bool has_value(result(T, E) * this);
-
-forall(otype T, otype E)
-T get(result(T, E) * this);
-
-forall(otype T, otype E)
-E get_error(result(T, E) * this);
-
-forall(otype T, otype E)
-void set(result(T, E) * this, T value);
-
-forall(otype T, otype E)
-void set_error(result(T, E) * this, E error);
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/containers/result.hfa
===================================================================
--- libcfa/src/containers/result.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/containers/result.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,81 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// result -- Contains the expected value or an error value.
+//
+// Author           : Andrew Beach
+// Created On       : Wed May 24 14:45:00 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Jul 22 10:00:44 2017
+// Update Count     : 3
+//
+
+#pragma once
+
+#include <stdbool.h>
+
+// DO NOT USE DIRECTLY!
+forall(otype T, otype E)
+union inner_result{
+	T value;
+	E error;
+};
+
+forall(otype T, otype E)
+struct result {
+	bool has_value;
+	inline union inner_result(T, E);
+};
+
+
+forall(otype T, otype E)
+void ?{}(result(T, E) & this);
+
+forall(otype T, otype E)
+void ?{}(result(T, E) & this, one_t, T value);
+
+forall(otype T, otype E)
+void ?{}(result(T, E) & this, zero_t, E error);
+
+forall(otype T, otype E)
+void ?{}(result(T, E) & this, result(T, E) other);
+
+forall(otype T, otype E)
+void ^?{}(result(T, E) & this);
+
+forall(otype T, otype E)
+result(T, E) ?=?(result(T, E) & this, result(T, E) other);
+
+forall(otype T, otype E)
+bool ?!=?(result(T, E) this, zero_t);
+
+/* Wating for bug#11 to be fixed.
+forall(otype T, otype E)
+result(T, E) result_value(T value);
+
+forall(otype T, otype E)
+result(T, E) result_error(E error);
+*/
+
+forall(otype T, otype E)
+bool has_value(result(T, E) * this);
+
+forall(otype T, otype E)
+T get(result(T, E) * this);
+
+forall(otype T, otype E)
+E get_error(result(T, E) * this);
+
+forall(otype T, otype E)
+void set(result(T, E) * this, T value);
+
+forall(otype T, otype E)
+void set_error(result(T, E) * this, E error);
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/containers/vector
===================================================================
--- libcfa/src/containers/vector	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,170 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// vector --
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Jul  5 18:00:07 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jul 22 10:01:18 2017
-// Update Count     : 3
-//
-
-#pragma once
-
-extern "C" {
-#include <stdbool.h>
-}
-
-//------------------------------------------------------------------------------
-//Allocator
-forall(otype T)
-struct heap_allocator
-{
-	T* storage;
-	size_t capacity;
-};
-
-forall(otype T)
-void ?{}(heap_allocator(T)& this);
-
-forall(otype T)
-void ?{}(heap_allocator(T)& this, heap_allocator(T) rhs);
-
-forall(otype T)
-heap_allocator(T) ?=?(heap_allocator(T)& this, heap_allocator(T) rhs);
-
-forall(otype T)
-void ^?{}(heap_allocator(T)& this);
-
-forall(otype T)
-void realloc_storage(heap_allocator(T)* this, size_t size);
-
-forall(otype T)
-static inline T* data(heap_allocator(T)* this)
-{
-	return this->storage;
-}
-
-//------------------------------------------------------------------------------
-//Declaration
-trait allocator_c(otype T, otype allocator_t)
-{
-	void realloc_storage(allocator_t*, size_t);
-	T* data(allocator_t*);
-};
-
-forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
-struct vector;
-
-//------------------------------------------------------------------------------
-//Initialization
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void ?{}(vector(T, allocator_t)& this);
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void ?{}(vector(T, allocator_t)& this, vector(T, allocator_t) rhs);
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-vector(T, allocator_t) ?=?(vector(T, allocator_t)& this, vector(T, allocator_t) rhs);
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void ^?{}(vector(T, allocator_t)& this);
-
-forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
-struct vector
-{
-	allocator_t storage;
-	size_t size;
-};
-
-//------------------------------------------------------------------------------
-//Capacity
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline bool empty(vector(T, allocator_t)* this)
-{
-	return this->size == 0;
-}
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline size_t size(vector(T, allocator_t)* this)
-{
-	return this->size;
-}
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline void reserve(vector(T, allocator_t)* this, size_t size)
-{
-	realloc_storage(&this->storage, this->size+1);
-}
-
-//------------------------------------------------------------------------------
-//Element access
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline T at(vector(T, allocator_t)* this, size_t index)
-{
-	return data(&this->storage)[index];
-}
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline T ?[?](vector(T, allocator_t)* this, size_t index)
-{
-	return data(&this->storage)[index];
-}
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline T front(vector(T, allocator_t)* this)
-{
-	return data(&this->storage)[0];
-}
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline T back(vector(T, allocator_t)* this)
-{
-	return data(&this->storage)[this->size - 1];
-}
-
-//------------------------------------------------------------------------------
-//Modifiers
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void push_back(vector(T, allocator_t)* this, T value);
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void pop_back(vector(T, allocator_t)* this);
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void clear(vector(T, allocator_t)* this);
-
-//------------------------------------------------------------------------------
-//Iterators
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline T* begin(vector(T, allocator_t)* this)
-{
-	return data(&this->storage);
-}
-
-// forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-// static inline const T* cbegin(const vector(T, allocator_t)* this)
-// {
-// 	return data(&this->storage);
-// }
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-static inline T* end(vector(T, allocator_t)* this)
-{
-	return data(&this->storage) + this->size;
-}
-
-// forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-// static inline const T* cend(const vector(T, allocator_t)* this)
-// {
-// 	return data(&this->storage) + this->size;
-// }
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/containers/vector.cfa
===================================================================
--- libcfa/src/containers/vector.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/containers/vector.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -16,5 +16,5 @@
 #include <containers/vector>
 
-#include <stdlib>
+#include <stdlib.hfa>
 
 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
Index: libcfa/src/containers/vector.hfa
===================================================================
--- libcfa/src/containers/vector.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/containers/vector.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,170 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// vector --
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Jul  5 18:00:07 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Jul 22 10:01:18 2017
+// Update Count     : 3
+//
+
+#pragma once
+
+extern "C" {
+#include <stdbool.h>
+}
+
+//------------------------------------------------------------------------------
+//Allocator
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+void ?{}(heap_allocator(T)& this);
+
+forall(otype T)
+void ?{}(heap_allocator(T)& this, heap_allocator(T) rhs);
+
+forall(otype T)
+heap_allocator(T) ?=?(heap_allocator(T)& this, heap_allocator(T) rhs);
+
+forall(otype T)
+void ^?{}(heap_allocator(T)& this);
+
+forall(otype T)
+void realloc_storage(heap_allocator(T)* this, size_t size);
+
+forall(otype T)
+static inline T* data(heap_allocator(T)* this)
+{
+	return this->storage;
+}
+
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t)
+{
+	void realloc_storage(allocator_t*, size_t);
+	T* data(allocator_t*);
+};
+
+forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
+struct vector;
+
+//------------------------------------------------------------------------------
+//Initialization
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void ?{}(vector(T, allocator_t)& this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void ?{}(vector(T, allocator_t)& this, vector(T, allocator_t) rhs);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+vector(T, allocator_t) ?=?(vector(T, allocator_t)& this, vector(T, allocator_t) rhs);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void ^?{}(vector(T, allocator_t)& this);
+
+forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+//------------------------------------------------------------------------------
+//Capacity
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline bool empty(vector(T, allocator_t)* this)
+{
+	return this->size == 0;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline size_t size(vector(T, allocator_t)* this)
+{
+	return this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline void reserve(vector(T, allocator_t)* this, size_t size)
+{
+	realloc_storage(&this->storage, this->size+1);
+}
+
+//------------------------------------------------------------------------------
+//Element access
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T at(vector(T, allocator_t)* this, size_t index)
+{
+	return data(&this->storage)[index];
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T ?[?](vector(T, allocator_t)* this, size_t index)
+{
+	return data(&this->storage)[index];
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T front(vector(T, allocator_t)* this)
+{
+	return data(&this->storage)[0];
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T back(vector(T, allocator_t)* this)
+{
+	return data(&this->storage)[this->size - 1];
+}
+
+//------------------------------------------------------------------------------
+//Modifiers
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void push_back(vector(T, allocator_t)* this, T value);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void pop_back(vector(T, allocator_t)* this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void clear(vector(T, allocator_t)* this);
+
+//------------------------------------------------------------------------------
+//Iterators
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T* begin(vector(T, allocator_t)* this)
+{
+	return data(&this->storage);
+}
+
+// forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+// static inline const T* cbegin(const vector(T, allocator_t)* this)
+// {
+// 	return data(&this->storage);
+// }
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+static inline T* end(vector(T, allocator_t)* this)
+{
+	return data(&this->storage) + this->size;
+}
+
+// forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+// static inline const T* cend(const vector(T, allocator_t)* this)
+// {
+// 	return data(&this->storage) + this->size;
+// }
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/exception.c	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -23,5 +23,5 @@
 #include <stdio.h>
 #include <unwind.h>
-#include <bits/debug.h>
+#include <bits/debug.hfa>
 
 // FIX ME: temporary hack to keep ARM build working
Index: libcfa/src/fstream
===================================================================
--- libcfa/src/fstream	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,89 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// fstream --
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed May 27 17:56:53 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Jun  5 10:20:25 2018
-// Update Count     : 131
-//
-
-#pragma once
-
-#include "iostream"
-
-enum { sepSize = 16 };
-struct ofstream {
-	void * file;
-	_Bool sepDefault;
-	_Bool sepOnOff;
-	_Bool sawNL;
-	const char * sepCur;
-	char separator[sepSize];
-	char tupleSeparator[sepSize];
-}; // ofstream
-
-// private
-_Bool sepPrt( ofstream & );
-void sepReset( ofstream & );
-void sepReset( ofstream &, _Bool );
-const char * sepGetCur( ofstream & );
-void sepSetCur( ofstream &, const char * );
-_Bool getNL( ofstream & );
-void setNL( ofstream &, _Bool );
-
-// public
-void sepOn( ofstream & );
-void sepOff( ofstream & );
-_Bool sepDisable( ofstream & );
-_Bool sepEnable( ofstream & );
-
-const char * sepGet( ofstream & );
-void sepSet( ofstream &, const char * );
-const char * sepGetTuple( ofstream & );
-void sepSetTuple( ofstream &, const char * );
-
-int fail( ofstream & );
-int flush( ofstream & );
-void open( ofstream &, const char * name, const char * mode );
-void open( ofstream &, const char * name );
-void close( ofstream & );
-ofstream & write( ofstream &, const char * data, size_t size );
-int fmt( ofstream &, const char fmt[], ... );
-
-void ?{}( ofstream & os );
-void ?{}( ofstream & os, const char * name, const char * mode );
-void ?{}( ofstream & os, const char * name );
-
-extern ofstream & sout, & serr;
-
-
-struct ifstream {
-	void * file;
-}; // ifstream
-
-// public
-int fail( ifstream & is );
-int eof( ifstream & is );
-void open( ifstream & is, const char * name, const char * mode );
-void open( ifstream & is, const char * name );
-void close( ifstream & is );
-ifstream & read( ifstream & is, char * data, size_t size );
-ifstream & ungetc( ifstream & is, char c );
-int fmt( ifstream &, const char fmt[], ... );
-
-void ?{}( ifstream & is );
-void ?{}( ifstream & is, const char * name, const char * mode );
-void ?{}( ifstream & is, const char * name );
-
-extern ifstream & sin;
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/fstream.hfa
===================================================================
--- libcfa/src/fstream.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/fstream.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,89 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// fstream --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Jun  5 10:20:25 2018
+// Update Count     : 131
+//
+
+#pragma once
+
+#include "iostream"
+
+enum { sepSize = 16 };
+struct ofstream {
+	void * file;
+	_Bool sepDefault;
+	_Bool sepOnOff;
+	_Bool sawNL;
+	const char * sepCur;
+	char separator[sepSize];
+	char tupleSeparator[sepSize];
+}; // ofstream
+
+// private
+_Bool sepPrt( ofstream & );
+void sepReset( ofstream & );
+void sepReset( ofstream &, _Bool );
+const char * sepGetCur( ofstream & );
+void sepSetCur( ofstream &, const char * );
+_Bool getNL( ofstream & );
+void setNL( ofstream &, _Bool );
+
+// public
+void sepOn( ofstream & );
+void sepOff( ofstream & );
+_Bool sepDisable( ofstream & );
+_Bool sepEnable( ofstream & );
+
+const char * sepGet( ofstream & );
+void sepSet( ofstream &, const char * );
+const char * sepGetTuple( ofstream & );
+void sepSetTuple( ofstream &, const char * );
+
+int fail( ofstream & );
+int flush( ofstream & );
+void open( ofstream &, const char * name, const char * mode );
+void open( ofstream &, const char * name );
+void close( ofstream & );
+ofstream & write( ofstream &, const char * data, size_t size );
+int fmt( ofstream &, const char fmt[], ... );
+
+void ?{}( ofstream & os );
+void ?{}( ofstream & os, const char * name, const char * mode );
+void ?{}( ofstream & os, const char * name );
+
+extern ofstream & sout, & serr;
+
+
+struct ifstream {
+	void * file;
+}; // ifstream
+
+// public
+int fail( ifstream & is );
+int eof( ifstream & is );
+void open( ifstream & is, const char * name, const char * mode );
+void open( ifstream & is, const char * name );
+void close( ifstream & is );
+ifstream & read( ifstream & is, char * data, size_t size );
+ifstream & ungetc( ifstream & is, char c );
+int fmt( ifstream &, const char fmt[], ... );
+
+void ?{}( ifstream & is );
+void ?{}( ifstream & is, const char * name, const char * mode );
+void ?{}( ifstream & is, const char * name );
+
+extern ifstream & sin;
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/gmp
===================================================================
--- libcfa/src/gmp	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,275 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// gmp --
-//
-// Author           : Peter A. Buhr
-// Created On       : Tue Apr 19 08:43:43 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Dec  7 09:10:41 2017
-// Update Count     : 21
-//
-
-// https://gmplib.org/gmp-man-6.1.1.pdf
-
-#pragma once
-
-#include <gmp.h>										// GNU multi-precise integers
-#include <fstream>										// sout
-
-struct Int { mpz_t mpz; };								// wrap GMP implementation
-
-// constructor
-static inline void ?{}( Int & this ) { mpz_init( this.mpz ); }
-static inline void ?{}( Int & this, Int init ) { mpz_init_set( this.mpz, init.mpz ); }
-static inline void ?{}( Int & this, zero_t ) { mpz_init_set_si( this.mpz, 0 ); }
-static inline void ?{}( Int & this, one_t ) { mpz_init_set_si( this.mpz, 1 ); }
-static inline void ?{}( Int & this, signed long int init ) { mpz_init_set_si( this.mpz, init ); }
-static inline void ?{}( Int & this, unsigned long int init ) { mpz_init_set_ui( this.mpz, init ); }
-static inline void ?{}( Int & this, const char * val ) { if ( mpz_init_set_str( this.mpz, val, 0 ) ) abort(); }
-static inline void ^?{}( Int & this ) { mpz_clear( this.mpz ); }
-
-// literal
-static inline Int ?`mp( signed long int init ) { return (Int){ init }; }
-static inline Int ?`mp( unsigned long int init ) { return (Int){ init }; }
-static inline Int ?`mp( const char * init ) { return (Int){ init }; }
-
-// assignment
-static inline Int ?=?( Int & lhs, Int rhs ) { mpz_set( lhs.mpz, rhs.mpz ); return lhs; }
-static inline Int ?=?( Int & lhs, long int rhs ) { mpz_set_si( lhs.mpz, rhs ); return lhs; }
-static inline Int ?=?( Int & lhs, unsigned long int rhs ) { mpz_set_ui( lhs.mpz, rhs ); return lhs; }
-static inline Int ?=?( Int & lhs, const char * rhs ) { if ( mpz_set_str( lhs.mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return lhs; }
-
-static inline char ?=?( char & lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
-static inline short int ?=?( short int & lhs, Int rhs ) { short int val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
-static inline int ?=?( int & lhs, Int rhs ) { int val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
-static inline long int ?=?( long int & lhs, Int rhs ) { long int val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
-static inline unsigned char ?=?( unsigned char & lhs, Int rhs ) { unsigned char val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
-static inline unsigned short int ?=?( unsigned short int & lhs, Int rhs ) { unsigned short int val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
-static inline unsigned int ?=?( unsigned int & lhs, Int rhs ) { unsigned int val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
-static inline unsigned long int ?=?( unsigned long int & lhs, Int rhs ) { unsigned long int val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
-
-// conversions
-static inline long int narrow( Int val ) { return mpz_get_si( val.mpz ); }
-static inline unsigned long int narrow( Int val ) { return mpz_get_ui( val.mpz ); }
-
-// comparison
-static inline int ?==?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) == 0; }
-static inline int ?==?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }
-static inline int ?==?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }
-static inline int ?==?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }
-static inline int ?==?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }
-
-static inline int ?!=?( Int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
-static inline int ?!=?( Int oper1, long int oper2 ) { return ! ( oper1 == oper2 ); }
-static inline int ?!=?( long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
-static inline int ?!=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 == oper2 ); }
-static inline int ?!=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
-
-static inline int ?<?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) < 0; }
-static inline int ?<?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }
-static inline int ?<?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }
-static inline int ?<?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }
-static inline int ?<?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }
-
-static inline int ?<=?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) <= 0; }
-static inline int ?<=?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }
-static inline int ?<=?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }
-static inline int ?<=?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }
-static inline int ?<=?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }
-
-static inline int ?>?( Int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
-static inline int ?>?( Int oper1, long int oper2 ) { return ! ( oper1 <= oper2 ); }
-static inline int ?>?( long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
-static inline int ?>?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 <= oper2 ); }
-static inline int ?>?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
-
-static inline int ?>=?( Int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
-static inline int ?>=?( Int oper1, long int oper2 ) { return ! ( oper1 < oper2 ); }
-static inline int ?>=?( long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
-static inline int ?>=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 < oper2 ); }
-static inline int ?>=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
-
-// arithmetic
-static inline Int +?( Int oper ) { Int pos; mpz_set( pos.mpz, oper.mpz ); return pos; }
-static inline Int -?( Int oper ) { Int neg; mpz_neg( neg.mpz, oper.mpz ); return neg; }
-static inline Int ~?( Int oper ) { Int comp; mpz_com( comp.mpz, oper.mpz ); return comp; }
-
-static inline Int ?&?( Int oper1, Int oper2 ) { Int conjunction; mpz_and( conjunction.mpz, oper1.mpz, oper2.mpz ); return conjunction; }
-static inline Int ?&?( Int oper1, long int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; }
-static inline Int ?&?( long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; }
-static inline Int ?&?( Int oper1, unsigned long int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; }
-static inline Int ?&?( unsigned long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; }
-static inline Int ?&=?( Int & lhs, Int rhs ) { return lhs = lhs & rhs; }
-
-static inline Int ?|?( Int oper1, Int oper2 ) { Int disjunction; mpz_ior( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }
-static inline Int ?|?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
-static inline Int ?|?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
-static inline Int ?|?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
-static inline Int ?|?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
-static inline Int ?|=?( Int & lhs, Int rhs ) { return lhs = lhs | rhs; }
-
-static inline Int ?^?( Int oper1, Int oper2 ) { Int disjunction; mpz_xor( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }
-static inline Int ?^?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
-static inline Int ?^?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
-static inline Int ?^?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
-static inline Int ?^?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
-static inline Int ?^=?( Int & lhs, Int rhs ) { return lhs = lhs ^ rhs; }
-
-static inline Int ?+?( Int addend1, Int addend2 ) { Int sum; mpz_add( sum.mpz, addend1.mpz, addend2.mpz ); return sum; }
-static inline Int ?+?( Int addend1, long int addend2 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; }
-static inline Int ?+?( long int addend2, Int addend1 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; }
-static inline Int ?+?( Int addend1, unsigned long int addend2 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }
-static inline Int ?+?( unsigned long int addend2, Int addend1 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }
-static inline Int ?+=?( Int & lhs, Int rhs ) { return lhs = lhs + rhs; }
-static inline Int ?+=?( Int & lhs, long int rhs ) { return lhs = lhs + rhs; }
-static inline Int ?+=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs + rhs; }
-static inline Int ++?( Int & lhs ) { return lhs += 1; }
-static inline Int ?++( Int & lhs ) { Int ret = lhs; lhs += 1; return ret; }
-
-static inline Int ?-?( Int minuend, Int subtrahend ) { Int diff; mpz_sub( diff.mpz, minuend.mpz, subtrahend.mpz ); return diff; }
-static inline Int ?-?( Int minuend, long int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); else mpz_add_ui( diff.mpz, minuend.mpz, -subtrahend ); return diff; }
-static inline Int ?-?( long int minuend, Int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); else { mpz_add_ui( diff.mpz, subtrahend.mpz, -minuend ); mpz_neg( diff.mpz, diff.mpz ); } return diff; }
-static inline Int ?-?( Int minuend, unsigned long int subtrahend ) { Int diff; mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); return diff; }
-static inline Int ?-?( unsigned long int minuend, Int subtrahend ) { Int diff; mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); return diff; }
-static inline Int ?-=?( Int & lhs, Int rhs ) { return lhs = lhs - rhs; }
-static inline Int ?-=?( Int & lhs, long int rhs ) { return lhs = lhs - rhs; }
-static inline Int ?-=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs - rhs; }
-static inline Int --?( Int & lhs ) { return lhs -= 1; }
-static inline Int ?--( Int & lhs ) { Int ret = lhs; lhs -= 1; return ret; }
-
-static inline Int ?*?( Int multiplicator, Int multiplicand ) { Int product; mpz_mul( product.mpz, multiplicator.mpz, multiplicand.mpz ); return product; }
-static inline Int ?*?( Int multiplicator, long int multiplicand ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }
-static inline Int ?*?( long int multiplicand, Int multiplicator ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }
-static inline Int ?*?( Int multiplicator, unsigned long int multiplicand ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }
-static inline Int ?*?( unsigned long int multiplicand, Int multiplicator ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }
-static inline Int ?*=?( Int & lhs, Int rhs ) { return lhs = lhs * rhs; }
-static inline Int ?*=?( Int & lhs, long int rhs ) { return lhs = lhs * rhs; }
-static inline Int ?*=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs * rhs; }
-
-// some code for operators "/" and "%" taken from g++ gmpxx.h
-static inline Int ?/?( Int dividend, Int divisor ) { Int quotient; mpz_tdiv_q( quotient.mpz, dividend.mpz, divisor.mpz ); return quotient; }
-static inline Int ?/?( Int dividend, unsigned long int divisor ) { Int quotient; mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor ); return quotient; }
-static inline Int ?/?( unsigned long int dividend, Int divisor ) {
-	Int quotient;
-    if ( mpz_sgn( divisor.mpz ) >= 0 ) {
-		if ( mpz_fits_ulong_p( divisor.mpz ) )
-			mpz_set_ui( quotient.mpz, dividend / mpz_get_ui( divisor.mpz ) );
-		else
-			mpz_set_ui( quotient.mpz, 0 );
-	} else {
-		mpz_neg( quotient.mpz, divisor.mpz );
-		if ( mpz_fits_ulong_p( quotient.mpz ) ) {
-			mpz_set_ui( quotient.mpz, dividend / mpz_get_ui( quotient.mpz ) );
-			mpz_neg( quotient.mpz, quotient.mpz );
-		} else
-			mpz_set_ui( quotient.mpz, 0 );
-	} // if
-	return quotient;
-} // ?/?
-static inline Int ?/?( Int dividend, long int divisor ) {
-	Int quotient;
-    if ( divisor >= 0 )
-		mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor );
-    else {
-		mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, -divisor );
-		mpz_neg( quotient.mpz, quotient.mpz );
-	} // if
-	return quotient;
-} // ?/?
-static inline Int ?/?( long int dividend, Int divisor ) {
-	Int quotient;
-    if ( mpz_fits_slong_p( divisor.mpz ) )
-		mpz_set_si( quotient.mpz, dividend / mpz_get_si( divisor.mpz ) );
-    else {
-        // if divisor is bigger than a long then the quotient must be zero, unless dividend==LONG_MIN and
-        // dividend==-LONG_MIN in which case the quotient is -1
-        mpz_set_si( quotient.mpz, mpz_cmpabs_ui( divisor.mpz, (dividend >= 0 ? dividend : -dividend)) == 0 ? -1 : 0 );
-	} // if
-	return quotient;
-} // ?/?
-static inline Int ?/=?( Int & lhs, Int rhs ) { return lhs = lhs / rhs; }
-static inline Int ?/=?( Int & lhs, long int rhs ) { return lhs = lhs / rhs; }
-static inline Int ?/=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs / rhs; }
-
-static inline [ Int, Int ] div( Int dividend, Int divisor ) { Int quotient, remainder; mpz_fdiv_qr( quotient.mpz, remainder.mpz, dividend.mpz, divisor.mpz ); return [ quotient, remainder ]; }
-static inline [ Int, Int ] div( Int dividend, unsigned long int divisor ) { Int quotient, remainder; mpz_fdiv_qr_ui( quotient.mpz, remainder.mpz, dividend.mpz, divisor ); return [ quotient, remainder ]; }
-
-static inline Int ?%?( Int dividend, Int divisor ) { Int remainder; mpz_tdiv_r( remainder.mpz, dividend.mpz, divisor.mpz ); return remainder; }
-static inline Int ?%?( Int dividend, unsigned long int divisor ) { Int remainder; mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, divisor ); return remainder; }
-static inline Int ?%?( unsigned long int dividend, Int divisor ) {
-	Int remainder;
-    if ( mpz_sgn( divisor.mpz ) >= 0 ) {
-		if ( mpz_fits_ulong_p( divisor.mpz ) )
-			mpz_set_ui( remainder.mpz, dividend % mpz_get_ui( divisor.mpz ) );
-		else
-			mpz_set_ui( remainder.mpz, dividend );
-	} else {
-		mpz_neg( remainder.mpz, divisor.mpz );
-		if ( mpz_fits_ulong_p( remainder.mpz ) )
-			mpz_set_ui( remainder.mpz, dividend % mpz_get_ui( remainder.mpz ) );
-		else
-			mpz_set_ui( remainder.mpz, dividend );
-	} // if
-	return remainder;
-} // ?%?
-static inline Int ?%?( Int dividend, long int divisor ) {
-	Int remainder;
-    mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, (divisor >= 0 ? divisor : -divisor));
-	return remainder;
-} // ?%?
-static inline Int ?%?( long int dividend, Int divisor ) {
-	Int remainder;
-    if ( mpz_fits_slong_p( divisor.mpz ) )
-		mpz_set_si( remainder.mpz, dividend % mpz_get_si( divisor.mpz ) );
-	else {
-		// if divisor is bigger than a long then the remainder is dividend unchanged, unless dividend==LONG_MIN and
-		// dividend==-LONG_MIN in which case the remainder is 0
-        mpz_set_si( remainder.mpz, mpz_cmpabs_ui( divisor.mpz, (dividend >= 0 ? dividend : -dividend)) == 0 ? 0 : dividend);
-	} // if
-	return remainder;
-} // ?%?
-static inline Int ?%=?( Int & lhs, Int rhs ) { return lhs = lhs % rhs; }
-static inline Int ?%=?( Int & lhs, long int rhs ) { return lhs = lhs % rhs; }
-static inline Int ?%=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs % rhs; }
-
-static inline Int ?<<?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_mul_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }
-static inline Int ?<<=?( Int & lhs, mp_bitcnt_t shift ) { return lhs = lhs << shift; }
-static inline Int ?>>?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_fdiv_q_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }
-static inline Int ?>>=?( Int & lhs, mp_bitcnt_t shift ) { return lhs = lhs >> shift; }
-
-// number functions
-static inline Int abs( Int oper ) { Int positive; mpz_abs( positive.mpz, oper.mpz ); return positive; }
-static inline Int fact( unsigned long int N ) { Int factorial; mpz_fac_ui( factorial.mpz, N ); return factorial; }
-static inline Int gcd( Int oper1, Int oper2 ) { Int gcdret; mpz_gcd( gcdret.mpz, oper1.mpz, oper2.mpz ); return gcdret; }
-static inline Int pow( Int base, unsigned long int exponent ) { Int power; mpz_pow_ui( power.mpz, base.mpz, exponent ); return power; }
-static inline Int pow( unsigned long int base, unsigned long int exponent ) { Int power; mpz_ui_pow_ui( power.mpz, base, exponent ); return power; }
-static inline void srandom( gmp_randstate_t state ) { gmp_randinit_default( state ); }
-static inline Int random( gmp_randstate_t state, mp_bitcnt_t n ) { Int rand; mpz_urandomb( rand.mpz, state, n ); return rand; }
-static inline Int random( gmp_randstate_t state, Int n ) { Int rand; mpz_urandomm( rand.mpz, state, n.mpz ); return rand; }
-static inline Int random( gmp_randstate_t state, mp_size_t max_size ) { Int rand; mpz_random( rand.mpz, max_size ); return rand; }
-static inline int sgn( Int oper ) { return mpz_sgn( oper.mpz ); }
-static inline Int sqrt( Int oper ) { Int root; mpz_sqrt( root.mpz, oper.mpz ); return root; }
-
-// I/O
-static inline forall( dtype istype | istream( istype ) )
-istype & ?|?( istype & is, Int & mp ) {
- 	gmp_scanf( "%Zd", &mp );
- 	return is;
-} // ?|?
-
-static inline forall( dtype ostype | ostream( ostype ) )
-ostype & ?|?( ostype & os, Int mp ) {
-	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
-	gmp_printf( "%Zd", mp.mpz );
-	sepOn( os );
- 	return os;
-} // ?|?
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/gmp.hfa
===================================================================
--- libcfa/src/gmp.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/gmp.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,275 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// gmp --
+//
+// Author           : Peter A. Buhr
+// Created On       : Tue Apr 19 08:43:43 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Dec  7 09:10:41 2017
+// Update Count     : 21
+//
+
+// https://gmplib.org/gmp-man-6.1.1.pdf
+
+#pragma once
+
+#include <gmp.h>										// GNU multi-precise integers
+#include <fstream.hfa>										// sout
+
+struct Int { mpz_t mpz; };								// wrap GMP implementation
+
+// constructor
+static inline void ?{}( Int & this ) { mpz_init( this.mpz ); }
+static inline void ?{}( Int & this, Int init ) { mpz_init_set( this.mpz, init.mpz ); }
+static inline void ?{}( Int & this, zero_t ) { mpz_init_set_si( this.mpz, 0 ); }
+static inline void ?{}( Int & this, one_t ) { mpz_init_set_si( this.mpz, 1 ); }
+static inline void ?{}( Int & this, signed long int init ) { mpz_init_set_si( this.mpz, init ); }
+static inline void ?{}( Int & this, unsigned long int init ) { mpz_init_set_ui( this.mpz, init ); }
+static inline void ?{}( Int & this, const char * val ) { if ( mpz_init_set_str( this.mpz, val, 0 ) ) abort(); }
+static inline void ^?{}( Int & this ) { mpz_clear( this.mpz ); }
+
+// literal
+static inline Int ?`mp( signed long int init ) { return (Int){ init }; }
+static inline Int ?`mp( unsigned long int init ) { return (Int){ init }; }
+static inline Int ?`mp( const char * init ) { return (Int){ init }; }
+
+// assignment
+static inline Int ?=?( Int & lhs, Int rhs ) { mpz_set( lhs.mpz, rhs.mpz ); return lhs; }
+static inline Int ?=?( Int & lhs, long int rhs ) { mpz_set_si( lhs.mpz, rhs ); return lhs; }
+static inline Int ?=?( Int & lhs, unsigned long int rhs ) { mpz_set_ui( lhs.mpz, rhs ); return lhs; }
+static inline Int ?=?( Int & lhs, const char * rhs ) { if ( mpz_set_str( lhs.mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return lhs; }
+
+static inline char ?=?( char & lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
+static inline short int ?=?( short int & lhs, Int rhs ) { short int val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
+static inline int ?=?( int & lhs, Int rhs ) { int val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
+static inline long int ?=?( long int & lhs, Int rhs ) { long int val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
+static inline unsigned char ?=?( unsigned char & lhs, Int rhs ) { unsigned char val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
+static inline unsigned short int ?=?( unsigned short int & lhs, Int rhs ) { unsigned short int val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
+static inline unsigned int ?=?( unsigned int & lhs, Int rhs ) { unsigned int val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
+static inline unsigned long int ?=?( unsigned long int & lhs, Int rhs ) { unsigned long int val = mpz_get_ui( rhs.mpz ); lhs = val; return lhs; }
+
+// conversions
+static inline long int narrow( Int val ) { return mpz_get_si( val.mpz ); }
+static inline unsigned long int narrow( Int val ) { return mpz_get_ui( val.mpz ); }
+
+// comparison
+static inline int ?==?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) == 0; }
+static inline int ?==?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }
+static inline int ?==?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) == 0; }
+static inline int ?==?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }
+static inline int ?==?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) == 0; }
+
+static inline int ?!=?( Int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
+static inline int ?!=?( Int oper1, long int oper2 ) { return ! ( oper1 == oper2 ); }
+static inline int ?!=?( long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
+static inline int ?!=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 == oper2 ); }
+static inline int ?!=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 == oper2 ); }
+
+static inline int ?<?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) < 0; }
+static inline int ?<?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }
+static inline int ?<?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) < 0; }
+static inline int ?<?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }
+static inline int ?<?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) < 0; }
+
+static inline int ?<=?( Int oper1, Int oper2 ) { return mpz_cmp( oper1.mpz, oper2.mpz ) <= 0; }
+static inline int ?<=?( Int oper1, long int oper2 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }
+static inline int ?<=?( long int oper2, Int oper1 ) { return mpz_cmp_si( oper1.mpz, oper2 ) <= 0; }
+static inline int ?<=?( Int oper1, unsigned long int oper2 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }
+static inline int ?<=?( unsigned long int oper2, Int oper1 ) { return mpz_cmp_ui( oper1.mpz, oper2 ) <= 0; }
+
+static inline int ?>?( Int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
+static inline int ?>?( Int oper1, long int oper2 ) { return ! ( oper1 <= oper2 ); }
+static inline int ?>?( long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
+static inline int ?>?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 <= oper2 ); }
+static inline int ?>?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 <= oper2 ); }
+
+static inline int ?>=?( Int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
+static inline int ?>=?( Int oper1, long int oper2 ) { return ! ( oper1 < oper2 ); }
+static inline int ?>=?( long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
+static inline int ?>=?( Int oper1, unsigned long int oper2 ) { return ! ( oper1 < oper2 ); }
+static inline int ?>=?( unsigned long int oper1, Int oper2 ) { return ! ( oper1 < oper2 ); }
+
+// arithmetic
+static inline Int +?( Int oper ) { Int pos; mpz_set( pos.mpz, oper.mpz ); return pos; }
+static inline Int -?( Int oper ) { Int neg; mpz_neg( neg.mpz, oper.mpz ); return neg; }
+static inline Int ~?( Int oper ) { Int comp; mpz_com( comp.mpz, oper.mpz ); return comp; }
+
+static inline Int ?&?( Int oper1, Int oper2 ) { Int conjunction; mpz_and( conjunction.mpz, oper1.mpz, oper2.mpz ); return conjunction; }
+static inline Int ?&?( Int oper1, long int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; }
+static inline Int ?&?( long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; }
+static inline Int ?&?( Int oper1, unsigned long int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_and( conjunction.mpz, oper1.mpz, temp.mpz ); return conjunction; }
+static inline Int ?&?( unsigned long int oper1, Int oper2 ) { Int conjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_and( conjunction.mpz, temp.mpz, oper2.mpz ); return conjunction; }
+static inline Int ?&=?( Int & lhs, Int rhs ) { return lhs = lhs & rhs; }
+
+static inline Int ?|?( Int oper1, Int oper2 ) { Int disjunction; mpz_ior( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }
+static inline Int ?|?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
+static inline Int ?|?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
+static inline Int ?|?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
+static inline Int ?|?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
+static inline Int ?|=?( Int & lhs, Int rhs ) { return lhs = lhs | rhs; }
+
+static inline Int ?^?( Int oper1, Int oper2 ) { Int disjunction; mpz_xor( disjunction.mpz, oper1.mpz, oper2.mpz ); return disjunction; }
+static inline Int ?^?( Int oper1, long int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
+static inline Int ?^?( long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_si( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
+static inline Int ?^?( Int oper1, unsigned long int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper2 ); mpz_ior( disjunction.mpz, oper1.mpz, temp.mpz ); return disjunction; }
+static inline Int ?^?( unsigned long int oper1, Int oper2 ) { Int disjunction, temp; mpz_set_ui( temp.mpz, oper1 ); mpz_ior( disjunction.mpz, temp.mpz, oper2.mpz ); return disjunction; }
+static inline Int ?^=?( Int & lhs, Int rhs ) { return lhs = lhs ^ rhs; }
+
+static inline Int ?+?( Int addend1, Int addend2 ) { Int sum; mpz_add( sum.mpz, addend1.mpz, addend2.mpz ); return sum; }
+static inline Int ?+?( Int addend1, long int addend2 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; }
+static inline Int ?+?( long int addend2, Int addend1 ) { Int sum; if ( addend2 >= 0 ) mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); else mpz_sub_ui( sum.mpz, addend1.mpz, -addend2 ); return sum; }
+static inline Int ?+?( Int addend1, unsigned long int addend2 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }
+static inline Int ?+?( unsigned long int addend2, Int addend1 ) { Int sum; mpz_add_ui( sum.mpz, addend1.mpz, addend2 ); return sum; }
+static inline Int ?+=?( Int & lhs, Int rhs ) { return lhs = lhs + rhs; }
+static inline Int ?+=?( Int & lhs, long int rhs ) { return lhs = lhs + rhs; }
+static inline Int ?+=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs + rhs; }
+static inline Int ++?( Int & lhs ) { return lhs += 1; }
+static inline Int ?++( Int & lhs ) { Int ret = lhs; lhs += 1; return ret; }
+
+static inline Int ?-?( Int minuend, Int subtrahend ) { Int diff; mpz_sub( diff.mpz, minuend.mpz, subtrahend.mpz ); return diff; }
+static inline Int ?-?( Int minuend, long int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); else mpz_add_ui( diff.mpz, minuend.mpz, -subtrahend ); return diff; }
+static inline Int ?-?( long int minuend, Int subtrahend ) { Int diff; if ( subtrahend >= 0 ) mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); else { mpz_add_ui( diff.mpz, subtrahend.mpz, -minuend ); mpz_neg( diff.mpz, diff.mpz ); } return diff; }
+static inline Int ?-?( Int minuend, unsigned long int subtrahend ) { Int diff; mpz_sub_ui( diff.mpz, minuend.mpz, subtrahend ); return diff; }
+static inline Int ?-?( unsigned long int minuend, Int subtrahend ) { Int diff; mpz_ui_sub( diff.mpz, minuend, subtrahend.mpz ); return diff; }
+static inline Int ?-=?( Int & lhs, Int rhs ) { return lhs = lhs - rhs; }
+static inline Int ?-=?( Int & lhs, long int rhs ) { return lhs = lhs - rhs; }
+static inline Int ?-=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs - rhs; }
+static inline Int --?( Int & lhs ) { return lhs -= 1; }
+static inline Int ?--( Int & lhs ) { Int ret = lhs; lhs -= 1; return ret; }
+
+static inline Int ?*?( Int multiplicator, Int multiplicand ) { Int product; mpz_mul( product.mpz, multiplicator.mpz, multiplicand.mpz ); return product; }
+static inline Int ?*?( Int multiplicator, long int multiplicand ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }
+static inline Int ?*?( long int multiplicand, Int multiplicator ) { Int product; mpz_mul_si( product.mpz, multiplicator.mpz, multiplicand ); return product; }
+static inline Int ?*?( Int multiplicator, unsigned long int multiplicand ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }
+static inline Int ?*?( unsigned long int multiplicand, Int multiplicator ) { Int product; mpz_mul_ui( product.mpz, multiplicator.mpz, multiplicand ); return product; }
+static inline Int ?*=?( Int & lhs, Int rhs ) { return lhs = lhs * rhs; }
+static inline Int ?*=?( Int & lhs, long int rhs ) { return lhs = lhs * rhs; }
+static inline Int ?*=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs * rhs; }
+
+// some code for operators "/" and "%" taken from g++ gmpxx.h
+static inline Int ?/?( Int dividend, Int divisor ) { Int quotient; mpz_tdiv_q( quotient.mpz, dividend.mpz, divisor.mpz ); return quotient; }
+static inline Int ?/?( Int dividend, unsigned long int divisor ) { Int quotient; mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor ); return quotient; }
+static inline Int ?/?( unsigned long int dividend, Int divisor ) {
+	Int quotient;
+    if ( mpz_sgn( divisor.mpz ) >= 0 ) {
+		if ( mpz_fits_ulong_p( divisor.mpz ) )
+			mpz_set_ui( quotient.mpz, dividend / mpz_get_ui( divisor.mpz ) );
+		else
+			mpz_set_ui( quotient.mpz, 0 );
+	} else {
+		mpz_neg( quotient.mpz, divisor.mpz );
+		if ( mpz_fits_ulong_p( quotient.mpz ) ) {
+			mpz_set_ui( quotient.mpz, dividend / mpz_get_ui( quotient.mpz ) );
+			mpz_neg( quotient.mpz, quotient.mpz );
+		} else
+			mpz_set_ui( quotient.mpz, 0 );
+	} // if
+	return quotient;
+} // ?/?
+static inline Int ?/?( Int dividend, long int divisor ) {
+	Int quotient;
+    if ( divisor >= 0 )
+		mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, divisor );
+    else {
+		mpz_tdiv_q_ui( quotient.mpz, dividend.mpz, -divisor );
+		mpz_neg( quotient.mpz, quotient.mpz );
+	} // if
+	return quotient;
+} // ?/?
+static inline Int ?/?( long int dividend, Int divisor ) {
+	Int quotient;
+    if ( mpz_fits_slong_p( divisor.mpz ) )
+		mpz_set_si( quotient.mpz, dividend / mpz_get_si( divisor.mpz ) );
+    else {
+        // if divisor is bigger than a long then the quotient must be zero, unless dividend==LONG_MIN and
+        // dividend==-LONG_MIN in which case the quotient is -1
+        mpz_set_si( quotient.mpz, mpz_cmpabs_ui( divisor.mpz, (dividend >= 0 ? dividend : -dividend)) == 0 ? -1 : 0 );
+	} // if
+	return quotient;
+} // ?/?
+static inline Int ?/=?( Int & lhs, Int rhs ) { return lhs = lhs / rhs; }
+static inline Int ?/=?( Int & lhs, long int rhs ) { return lhs = lhs / rhs; }
+static inline Int ?/=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs / rhs; }
+
+static inline [ Int, Int ] div( Int dividend, Int divisor ) { Int quotient, remainder; mpz_fdiv_qr( quotient.mpz, remainder.mpz, dividend.mpz, divisor.mpz ); return [ quotient, remainder ]; }
+static inline [ Int, Int ] div( Int dividend, unsigned long int divisor ) { Int quotient, remainder; mpz_fdiv_qr_ui( quotient.mpz, remainder.mpz, dividend.mpz, divisor ); return [ quotient, remainder ]; }
+
+static inline Int ?%?( Int dividend, Int divisor ) { Int remainder; mpz_tdiv_r( remainder.mpz, dividend.mpz, divisor.mpz ); return remainder; }
+static inline Int ?%?( Int dividend, unsigned long int divisor ) { Int remainder; mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, divisor ); return remainder; }
+static inline Int ?%?( unsigned long int dividend, Int divisor ) {
+	Int remainder;
+    if ( mpz_sgn( divisor.mpz ) >= 0 ) {
+		if ( mpz_fits_ulong_p( divisor.mpz ) )
+			mpz_set_ui( remainder.mpz, dividend % mpz_get_ui( divisor.mpz ) );
+		else
+			mpz_set_ui( remainder.mpz, dividend );
+	} else {
+		mpz_neg( remainder.mpz, divisor.mpz );
+		if ( mpz_fits_ulong_p( remainder.mpz ) )
+			mpz_set_ui( remainder.mpz, dividend % mpz_get_ui( remainder.mpz ) );
+		else
+			mpz_set_ui( remainder.mpz, dividend );
+	} // if
+	return remainder;
+} // ?%?
+static inline Int ?%?( Int dividend, long int divisor ) {
+	Int remainder;
+    mpz_tdiv_r_ui( remainder.mpz, dividend.mpz, (divisor >= 0 ? divisor : -divisor));
+	return remainder;
+} // ?%?
+static inline Int ?%?( long int dividend, Int divisor ) {
+	Int remainder;
+    if ( mpz_fits_slong_p( divisor.mpz ) )
+		mpz_set_si( remainder.mpz, dividend % mpz_get_si( divisor.mpz ) );
+	else {
+		// if divisor is bigger than a long then the remainder is dividend unchanged, unless dividend==LONG_MIN and
+		// dividend==-LONG_MIN in which case the remainder is 0
+        mpz_set_si( remainder.mpz, mpz_cmpabs_ui( divisor.mpz, (dividend >= 0 ? dividend : -dividend)) == 0 ? 0 : dividend);
+	} // if
+	return remainder;
+} // ?%?
+static inline Int ?%=?( Int & lhs, Int rhs ) { return lhs = lhs % rhs; }
+static inline Int ?%=?( Int & lhs, long int rhs ) { return lhs = lhs % rhs; }
+static inline Int ?%=?( Int & lhs, unsigned long int rhs ) { return lhs = lhs % rhs; }
+
+static inline Int ?<<?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_mul_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }
+static inline Int ?<<=?( Int & lhs, mp_bitcnt_t shift ) { return lhs = lhs << shift; }
+static inline Int ?>>?( Int shiften, mp_bitcnt_t shift ) { Int shifted; mpz_fdiv_q_2exp( shifted.mpz, shiften.mpz, shift ); return shifted; }
+static inline Int ?>>=?( Int & lhs, mp_bitcnt_t shift ) { return lhs = lhs >> shift; }
+
+// number functions
+static inline Int abs( Int oper ) { Int positive; mpz_abs( positive.mpz, oper.mpz ); return positive; }
+static inline Int fact( unsigned long int N ) { Int factorial; mpz_fac_ui( factorial.mpz, N ); return factorial; }
+static inline Int gcd( Int oper1, Int oper2 ) { Int gcdret; mpz_gcd( gcdret.mpz, oper1.mpz, oper2.mpz ); return gcdret; }
+static inline Int pow( Int base, unsigned long int exponent ) { Int power; mpz_pow_ui( power.mpz, base.mpz, exponent ); return power; }
+static inline Int pow( unsigned long int base, unsigned long int exponent ) { Int power; mpz_ui_pow_ui( power.mpz, base, exponent ); return power; }
+static inline void srandom( gmp_randstate_t state ) { gmp_randinit_default( state ); }
+static inline Int random( gmp_randstate_t state, mp_bitcnt_t n ) { Int rand; mpz_urandomb( rand.mpz, state, n ); return rand; }
+static inline Int random( gmp_randstate_t state, Int n ) { Int rand; mpz_urandomm( rand.mpz, state, n.mpz ); return rand; }
+static inline Int random( gmp_randstate_t state, mp_size_t max_size ) { Int rand; mpz_random( rand.mpz, max_size ); return rand; }
+static inline int sgn( Int oper ) { return mpz_sgn( oper.mpz ); }
+static inline Int sqrt( Int oper ) { Int root; mpz_sqrt( root.mpz, oper.mpz ); return root; }
+
+// I/O
+static inline forall( dtype istype | istream( istype ) )
+istype & ?|?( istype & is, Int & mp ) {
+ 	gmp_scanf( "%Zd", &mp );
+ 	return is;
+} // ?|?
+
+static inline forall( dtype ostype | ostream( ostype ) )
+ostype & ?|?( ostype & os, Int mp ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	gmp_printf( "%Zd", mp.mpz );
+	sepOn( os );
+ 	return os;
+} // ?|?
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/heap.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -1,10 +1,10 @@
-// 
+//
 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
 //
 // The contents of this file are covered under the licence agreement in the
 // file "LICENCE" distributed with Cforall.
-// 
-// heap.c -- 
-// 
+//
+// heap.c --
+//
 // Author           : Peter A. Buhr
 // Created On       : Tue Dec 19 21:58:35 2017
@@ -12,5 +12,5 @@
 // Last Modified On : Tue Jul 31 18:08:50 2018
 // Update Count     : 470
-// 
+//
 
 #include <unistd.h>										// sbrk, sysconf
@@ -22,8 +22,8 @@
 } // extern "C"
 
-#include "bits/align.h"									// libPow2
-#include "bits/defs.h"									// likely, unlikely
-#include "bits/locks.h"									// __spinlock_t
-#include "startup.h"									// STARTUP_PRIORITY_MEMORY
+#include "bits/align.hfa"									// libPow2
+#include "bits/defs.hfa"									// likely, unlikely
+#include "bits/locks.hfa"									// __spinlock_t
+#include "startup.hfa"									// STARTUP_PRIORITY_MEMORY
 #include "stdlib"										// bsearchl
 #include "malloc.h"
@@ -283,5 +283,5 @@
 static void ?{}( HeapManager & manager ) with ( manager ) {
     pageSize = sysconf( _SC_PAGESIZE );
-    
+
     for ( unsigned int i = 0; i < NoBucketSizes; i += 1 ) { // initialize the free lists
 		freeLists[i].blockSize = bucketSizes[i];
@@ -760,5 +760,5 @@
 		_Bool mapped __attribute__(( unused )) = headers( "calloc", area, header, freeElem, asize, alignment );
 		#ifndef __CFA_DEBUG__
-		// Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero. 
+		// Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.
 		if ( ! mapped )
 		#endif // __CFA_DEBUG__
@@ -783,5 +783,5 @@
 		_Bool mapped __attribute__(( unused )) = headers( "cmemalign", area, header, freeElem, asize, alignment );
 		#ifndef __CFA_DEBUG__
-		// Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero. 
+		// Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.
 		if ( ! mapped )
 		#endif // __CFA_DEBUG__
@@ -828,5 +828,5 @@
 			_Bool mapped __attribute__(( unused )) = headers( "realloc", area, header, freeElem, asize, alignment );
 			#ifndef __CFA_DEBUG__
-			// Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero. 
+			// Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.
 			if ( ! mapped )
 			#endif // __CFA_DEBUG__
Index: libcfa/src/interpose.cfa
===================================================================
--- libcfa/src/interpose.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/interpose.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -18,5 +18,5 @@
 #include <unistd.h>										// _exit, getpid
 #define __USE_GNU
-#include <signal.h>
+#include <signal.hfa>
 #undef __USE_GNU
 extern "C" {
@@ -25,8 +25,8 @@
 }
 
-#include "bits/debug.h"
-#include "bits/defs.h"
-#include "bits/signal.h"								// sigHandler_?
-#include "startup.h"									// STARTUP_PRIORITY_CORE
+#include "bits/debug.hfa"
+#include "bits/defs.hfa"
+#include "bits/signal.hfa"								// sigHandler_?
+#include "startup.hfa"									// STARTUP_PRIORITY_CORE
 
 //=============================================================================================
Index: libcfa/src/iostream
===================================================================
--- libcfa/src/iostream	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/iostream	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -164,5 +164,5 @@
 
 
-#include <time_t.h>										// Duration (constructors) / Time (constructors)
+#include <time_t.hfa>										// Duration (constructors) / Time (constructors)
 
 forall( dtype ostype | ostream( ostype ) ) ostype & ?|?( ostype & os, Duration dur );
Index: libcfa/src/iterator
===================================================================
--- libcfa/src/iterator	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,48 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// iterator --
-//
-// Author           : Richard C. Bilson
-// Created On       : Wed May 27 17:56:53 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul  7 08:37:25 2017
-// Update Count     : 10
-//
-
-#pragma once
-
-// An iterator can be used to traverse a data structure.
-trait iterator( otype iterator_type, otype elt_type ) {
-	// point to the next element
-//	iterator_type ?++( iterator_type & );
-	iterator_type ++?( iterator_type & );
-	iterator_type --?( iterator_type & );
-
-	// can be tested for equality with other iterators
-	int ?==?( iterator_type, iterator_type );
-	int ?!=?( iterator_type, iterator_type );
-
-	// dereference to get the pointed-at element
-	elt_type & *?( iterator_type );
-};
-
-trait iterator_for( otype iterator_type, otype collection_type, otype elt_type | iterator( iterator_type, elt_type ) ) {
-//	[ iterator_type begin, iterator_type end ] get_iterators( collection_type );
-	iterator_type begin( collection_type );
-	iterator_type end( collection_type );
-};
-
-forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
-void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
-
-forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
-void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/iterator.hfa
===================================================================
--- libcfa/src/iterator.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/iterator.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,48 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// iterator --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Jul  7 08:37:25 2017
+// Update Count     : 10
+//
+
+#pragma once
+
+// An iterator can be used to traverse a data structure.
+trait iterator( otype iterator_type, otype elt_type ) {
+	// point to the next element
+//	iterator_type ?++( iterator_type & );
+	iterator_type ++?( iterator_type & );
+	iterator_type --?( iterator_type & );
+
+	// can be tested for equality with other iterators
+	int ?==?( iterator_type, iterator_type );
+	int ?!=?( iterator_type, iterator_type );
+
+	// dereference to get the pointed-at element
+	elt_type & *?( iterator_type );
+};
+
+trait iterator_for( otype iterator_type, otype collection_type, otype elt_type | iterator( iterator_type, elt_type ) ) {
+//	[ iterator_type begin, iterator_type end ] get_iterators( collection_type );
+	iterator_type begin( collection_type );
+	iterator_type end( collection_type );
+};
+
+forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
+void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
+
+forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) )
+void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/limits
===================================================================
--- libcfa/src/limits	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,151 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// limits --
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Apr  6 18:06:52 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Mar  1 16:20:54 2018
-// Update Count     : 13
-//
-
-#pragma once
-
-// Integral Constants
-
-extern const signed char MIN;
-extern const unsigned char MIN;
-extern const short int MIN;
-extern const unsigned short int MIN;
-extern const int MIN;
-extern const unsigned int MIN;
-extern const long int MIN;
-extern const unsigned long int MIN;
-extern const long long int MIN;
-extern const unsigned long long int MIN;
-
-extern const signed char MAX;
-extern const unsigned char MAX;
-extern const short int MAX;
-extern const unsigned short int MAX;
-extern const int MAX;
-extern const unsigned int MAX;
-extern const long int MAX;
-extern const unsigned long int MAX;
-extern const long long int MAX;
-extern const unsigned long long int MAX;
-
-// Floating-Point Constants
-
-extern const float MIN;
-extern const double MIN;
-extern const long double MIN;
-extern const float _Complex MIN;
-extern const double _Complex MIN;
-extern const long double _Complex MIN;
-
-extern const float MAX;
-extern const double MAX;
-extern const long double MAX;
-extern const float _Complex MAX;
-extern const double _Complex MAX;
-extern const long double _Complex MAX;
-
-extern const float PI;									// pi
-extern const float PI_2;								// pi / 2
-extern const float PI_4;								// pi / 4
-extern const float _1_PI;								// 1 / pi
-extern const float _2_PI;								// 2 / pi
-extern const float _2_SQRT_PI;							// 2 / sqrt(pi)
-
-extern const double PI;									// pi
-extern const double PI_2;								// pi / 2
-extern const double PI_4;								// pi / 4
-extern const double _1_PI;								// 1 / pi
-extern const double _2_PI;								// 2 / pi
-extern const double _2_SQRT_PI;							// 2 / sqrt(pi)
-
-extern const long double PI;							// pi
-extern const long double PI_2;							// pi / 2
-extern const long double PI_4;							// pi / 4
-extern const long double _1_PI;							// 1 / pi
-extern const long double _2_PI;							// 2 / pi
-extern const long double _2_SQRT_PI;					// 2 / sqrt(pi)
-
-extern const float _Complex PI;							// pi
-extern const float _Complex PI_2;						// pi / 2
-extern const float _Complex PI_4;						// pi / 4
-extern const float _Complex _1_PI;						// 1 / pi
-extern const float _Complex _2_PI;						// 2 / pi
-extern const float _Complex _2_SQRT_PI;					// 2 / sqrt(pi)
-
-extern const double _Complex PI;						// pi
-extern const double _Complex PI_2;						// pi / 2
-extern const double _Complex PI_4;						// pi / 4
-extern const double _Complex _1_PI;						// 1 / pi
-extern const double _Complex _2_PI;						// 2 / pi
-extern const double _Complex _2_SQRT_PI;				// 2 / sqrt(pi)
-
-extern const long double _Complex PI;					// pi
-extern const long double _Complex PI_2;					// pi / 2
-extern const long double _Complex PI_4;					// pi / 4
-extern const long double _Complex _1_PI;				// 1 / pi
-extern const long double _Complex _2_PI;				// 2 / pi
-extern const long double _Complex _2_SQRT_PI;			// 2 / sqrt(pi)
-
-extern const float E;									// e
-extern const float LOG2_E;								// log_2(e)
-extern const float LOG10_E;								// log_10(e)
-extern const float LN_2;								// log_e(2)
-extern const float LN_10;								// log_e(10)
-extern const float SQRT_2;								// sqrt(2)
-extern const float _1_SQRT_2;							// 1 / sqrt(2)
-
-extern const double E;									// e
-extern const double LOG2_E;								// log_2(e)
-extern const double LOG10_E;							// log_10(e)
-extern const double LN_2;								// log_e(2)
-extern const double LN_10;								// log_e(10)
-extern const double SQRT_2;								// sqrt(2)
-extern const double _1_SQRT_2;							// 1 / sqrt(2)
-
-extern const long double E;								// e
-extern const long double LOG2_E;						// log_2(e)
-extern const long double LOG10_E;						// log_10(e)
-extern const long double LN_2;							// log_e(2)
-extern const long double LN_10;							// log_e(10)
-extern const long double SQRT_2;						// sqrt(2)
-extern const long double _1_SQRT_2;						// 1/sqrt(2)
-
-extern const float _Complex E;							// e
-extern const float _Complex LOG2_E;						// log_2(e)
-extern const float _Complex LOG10_E;					// log_10(e)
-extern const float _Complex LN_2;						// log_e(2)
-extern const float _Complex LN_10;						// log_e(10)
-extern const float _Complex SQRT_2;						// sqrt(2)
-extern const float _Complex _1_SQRT_2;					// 1 / sqrt(2)
-
-extern const double _Complex E;							// e
-extern const double _Complex LOG2_E;					// log_2(e)
-extern const double _Complex LOG10_E;					// log_10(e)
-extern const double _Complex LN_2;						// log_e(2)
-extern const double _Complex LN_10;						// log_e(10)
-extern const double _Complex SQRT_2;					// sqrt(2)
-extern const double _Complex _1_SQRT_2;					// 1 / sqrt(2)
-
-extern const long double _Complex E;					// e
-extern const long double _Complex LOG2_E;				// log_2(e)
-extern const long double _Complex LOG10_E;				// log_10(e)
-extern const long double _Complex LN_2;					// log_e(2)
-extern const long double _Complex LN_10;				// log_e(10)
-extern const long double _Complex SQRT_2;				// sqrt(2)
-extern const long double _Complex _1_SQRT_2;			// 1 / sqrt(2)
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/limits.hfa
===================================================================
--- libcfa/src/limits.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/limits.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,151 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// limits --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 18:06:52 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Mar  1 16:20:54 2018
+// Update Count     : 13
+//
+
+#pragma once
+
+// Integral Constants
+
+extern const signed char MIN;
+extern const unsigned char MIN;
+extern const short int MIN;
+extern const unsigned short int MIN;
+extern const int MIN;
+extern const unsigned int MIN;
+extern const long int MIN;
+extern const unsigned long int MIN;
+extern const long long int MIN;
+extern const unsigned long long int MIN;
+
+extern const signed char MAX;
+extern const unsigned char MAX;
+extern const short int MAX;
+extern const unsigned short int MAX;
+extern const int MAX;
+extern const unsigned int MAX;
+extern const long int MAX;
+extern const unsigned long int MAX;
+extern const long long int MAX;
+extern const unsigned long long int MAX;
+
+// Floating-Point Constants
+
+extern const float MIN;
+extern const double MIN;
+extern const long double MIN;
+extern const float _Complex MIN;
+extern const double _Complex MIN;
+extern const long double _Complex MIN;
+
+extern const float MAX;
+extern const double MAX;
+extern const long double MAX;
+extern const float _Complex MAX;
+extern const double _Complex MAX;
+extern const long double _Complex MAX;
+
+extern const float PI;									// pi
+extern const float PI_2;								// pi / 2
+extern const float PI_4;								// pi / 4
+extern const float _1_PI;								// 1 / pi
+extern const float _2_PI;								// 2 / pi
+extern const float _2_SQRT_PI;							// 2 / sqrt(pi)
+
+extern const double PI;									// pi
+extern const double PI_2;								// pi / 2
+extern const double PI_4;								// pi / 4
+extern const double _1_PI;								// 1 / pi
+extern const double _2_PI;								// 2 / pi
+extern const double _2_SQRT_PI;							// 2 / sqrt(pi)
+
+extern const long double PI;							// pi
+extern const long double PI_2;							// pi / 2
+extern const long double PI_4;							// pi / 4
+extern const long double _1_PI;							// 1 / pi
+extern const long double _2_PI;							// 2 / pi
+extern const long double _2_SQRT_PI;					// 2 / sqrt(pi)
+
+extern const float _Complex PI;							// pi
+extern const float _Complex PI_2;						// pi / 2
+extern const float _Complex PI_4;						// pi / 4
+extern const float _Complex _1_PI;						// 1 / pi
+extern const float _Complex _2_PI;						// 2 / pi
+extern const float _Complex _2_SQRT_PI;					// 2 / sqrt(pi)
+
+extern const double _Complex PI;						// pi
+extern const double _Complex PI_2;						// pi / 2
+extern const double _Complex PI_4;						// pi / 4
+extern const double _Complex _1_PI;						// 1 / pi
+extern const double _Complex _2_PI;						// 2 / pi
+extern const double _Complex _2_SQRT_PI;				// 2 / sqrt(pi)
+
+extern const long double _Complex PI;					// pi
+extern const long double _Complex PI_2;					// pi / 2
+extern const long double _Complex PI_4;					// pi / 4
+extern const long double _Complex _1_PI;				// 1 / pi
+extern const long double _Complex _2_PI;				// 2 / pi
+extern const long double _Complex _2_SQRT_PI;			// 2 / sqrt(pi)
+
+extern const float E;									// e
+extern const float LOG2_E;								// log_2(e)
+extern const float LOG10_E;								// log_10(e)
+extern const float LN_2;								// log_e(2)
+extern const float LN_10;								// log_e(10)
+extern const float SQRT_2;								// sqrt(2)
+extern const float _1_SQRT_2;							// 1 / sqrt(2)
+
+extern const double E;									// e
+extern const double LOG2_E;								// log_2(e)
+extern const double LOG10_E;							// log_10(e)
+extern const double LN_2;								// log_e(2)
+extern const double LN_10;								// log_e(10)
+extern const double SQRT_2;								// sqrt(2)
+extern const double _1_SQRT_2;							// 1 / sqrt(2)
+
+extern const long double E;								// e
+extern const long double LOG2_E;						// log_2(e)
+extern const long double LOG10_E;						// log_10(e)
+extern const long double LN_2;							// log_e(2)
+extern const long double LN_10;							// log_e(10)
+extern const long double SQRT_2;						// sqrt(2)
+extern const long double _1_SQRT_2;						// 1/sqrt(2)
+
+extern const float _Complex E;							// e
+extern const float _Complex LOG2_E;						// log_2(e)
+extern const float _Complex LOG10_E;					// log_10(e)
+extern const float _Complex LN_2;						// log_e(2)
+extern const float _Complex LN_10;						// log_e(10)
+extern const float _Complex SQRT_2;						// sqrt(2)
+extern const float _Complex _1_SQRT_2;					// 1 / sqrt(2)
+
+extern const double _Complex E;							// e
+extern const double _Complex LOG2_E;					// log_2(e)
+extern const double _Complex LOG10_E;					// log_10(e)
+extern const double _Complex LN_2;						// log_e(2)
+extern const double _Complex LN_10;						// log_e(10)
+extern const double _Complex SQRT_2;					// sqrt(2)
+extern const double _Complex _1_SQRT_2;					// 1 / sqrt(2)
+
+extern const long double _Complex E;					// e
+extern const long double _Complex LOG2_E;				// log_2(e)
+extern const long double _Complex LOG10_E;				// log_10(e)
+extern const long double _Complex LN_2;					// log_e(2)
+extern const long double _Complex LN_10;				// log_e(10)
+extern const long double _Complex SQRT_2;				// sqrt(2)
+extern const long double _Complex _1_SQRT_2;			// 1 / sqrt(2)
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/math
===================================================================
--- libcfa/src/math	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,368 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// math --
-//
-// Author           : Peter A. Buhr
-// Created On       : Mon Apr 18 23:37:04 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 13 11:02:15 2018
-// Update Count     : 116
-//
-
-#pragma once
-
-#include <math.h>
-#include <complex.h>
-
-//---------------------- General ----------------------
-
-static inline float ?%?( float x, float y ) { return fmodf( x, y ); }
-static inline float fmod( float x, float y ) { return fmodf( x, y ); }
-static inline double ?%?( double x, double y ) { return fmod( x, y ); }
-// extern "C" { double fmod( double, double ); }
-static inline long double ?%?( long double x, long double y ) { return fmodl( x, y ); }
-static inline long double fmod( long double x, long double y ) { return fmodl( x, y ); }
-
-static inline float remainder( float x, float y ) { return remainderf( x, y ); }
-// extern "C" { double remainder( double, double ); }
-static inline long double remainder( long double x, long double y ) { return remainderl( x, y ); }
-
-static inline float remquo( float x, float y, int * quo ) { return remquof( x, y, quo ); }
-// extern "C" { double remquo( double x, double y, int * quo ); }
-static inline long double remquo( long double x, long double y, int * quo ) { return remquol( x, y, quo ); }
-static inline [ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
-static inline [ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
-static inline [ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
-
-static inline [ float, float ] div( float x, float y ) { y = modff( x / y, &x ); return [ x, y ]; }
-static inline [ double, double ] div( double x, double y ) { y = modf( x / y, &x ); return [ x, y ]; }
-static inline [ long double, long double ] div( long double x, long double y ) { y = modfl( x / y, &x ); return [ x, y ]; }
-
-static inline float fma( float x, float y, float z ) { return fmaf( x, y, z ); }
-// extern "C" { double fma( double, double, double ); }
-static inline long double fma( long double x, long double y, long double z ) { return fmal( x, y, z ); }
-
-static inline float fdim( float x, float y ) { return fdimf( x, y ); }
-// extern "C" { double fdim( double, double ); }
-static inline long double fdim( long double x, long double y ) { return fdiml( x, y ); }
-
-static inline float nan( const char * tag ) { return nanf( tag ); }
-// extern "C" { double nan( const char * ); }
-static inline long double nan( const char * tag ) { return nanl( tag ); }
-
-//---------------------- Exponential ----------------------
-
-static inline float exp( float x ) { return expf( x ); }
-// extern "C" { double exp( double ); }
-static inline long double exp( long double x ) { return expl( x ); }
-static inline float _Complex exp( float _Complex x ) { return cexpf( x ); }
-static inline double _Complex exp( double _Complex x ) { return cexp( x ); }
-static inline long double _Complex exp( long double _Complex x ) { return cexpl( x ); }
-
-static inline float exp2( float x ) { return exp2f( x ); }
-// extern "C" { double exp2( double ); }
-static inline long double exp2( long double x ) { return exp2l( x ); }
-//static inline float _Complex exp2( float _Complex x ) { return cexp2f( x ); }
-//static inline double _Complex exp2( double _Complex x ) { return cexp2( x ); }
-//static inline long double _Complex exp2( long double _Complex x ) { return cexp2l( x ); }
-
-static inline float expm1( float x ) { return expm1f( x ); }
-// extern "C" { double expm1( double ); }
-static inline long double expm1( long double x ) { return expm1l( x ); }
-
-static inline float pow( float x, float y ) { return powf( x, y ); }
-// extern "C" { double pow( double, double ); }
-static inline long double pow( long double x, long double y ) { return powl( x, y ); }
-static inline float _Complex pow( float _Complex x, float _Complex y ) { return cpowf( x, y ); }
-static inline double _Complex pow( double _Complex x, double _Complex y ) { return cpow( x, y ); }
-static inline long double _Complex pow( long double _Complex x, long double _Complex y ) { return cpowl( x, y ); }
-
-//---------------------- Logarithm ----------------------
-
-static inline float log( float x ) { return logf( x ); }
-// extern "C" { double log( double ); }
-static inline long double log( long double x ) { return logl( x ); }
-static inline float _Complex log( float _Complex x ) { return clogf( x ); }
-static inline double _Complex log( double _Complex x ) { return clog( x ); }
-static inline long double _Complex log( long double _Complex x ) { return clogl( x ); }
-
-static inline float log2( float x ) { return log2f( x ); }
-// extern "C" { double log2( double ); }
-static inline long double log2( long double x ) { return log2l( x ); }
-// static inline float _Complex log2( float _Complex x ) { return clog2f( x ); }
-// static inline double _Complex log2( double _Complex x ) { return clog2( x ); }
-// static inline long double _Complex log2( long double _Complex x ) { return clog2l( x ); }
-
-static inline float log10( float x ) { return log10f( x ); }
-// extern "C" { double log10( double ); }
-static inline long double log10( long double x ) { return log10l( x ); }
-// static inline float _Complex log10( float _Complex x ) { return clog10f( x ); }
-// static inline double _Complex log10( double _Complex x ) { return clog10( x ); }
-// static inline long double _Complex log10( long double _Complex x ) { return clog10l( x ); }
-
-static inline float log1p( float x ) { return log1pf( x ); }
-// extern "C" { double log1p( double ); }
-static inline long double log1p( long double x ) { return log1pl( x ); }
-
-static inline int ilogb( float x ) { return ilogbf( x ); }
-// extern "C" { int ilogb( double ); }
-static inline int ilogb( long double x ) { return ilogbl( x ); }
-
-static inline float logb( float x ) { return logbf( x ); }
-// extern "C" { double logb( double ); }
-static inline long double logb( long double x ) { return logbl( x ); }
-
-static inline float sqrt( float x ) { return sqrtf( x ); }
-// extern "C" { double sqrt( double ); }
-static inline long double sqrt( long double x ) { return sqrtl( x ); }
-static inline float _Complex sqrt( float _Complex x ) { return csqrtf( x ); }
-static inline double _Complex sqrt( double _Complex x ) { return csqrt( x ); }
-static inline long double _Complex sqrt( long double _Complex x ) { return csqrtl( x ); }
-
-static inline float cbrt( float x ) { return cbrtf( x ); }
-// extern "C" { double cbrt( double ); }
-static inline long double cbrt( long double x ) { return cbrtl( x ); }
-
-static inline float hypot( float x, float y ) { return hypotf( x, y ); }
-// extern "C" { double hypot( double, double ); }
-static inline long double hypot( long double x, long double y ) { return hypotl( x, y ); }
-
-//---------------------- Trigonometric ----------------------
-
-static inline float sin( float x ) { return sinf( x ); }
-// extern "C" { double sin( double ); }
-static inline long double sin( long double x ) { return sinl( x ); }
-static inline float _Complex sin( float _Complex x ) { return csinf( x ); }
-static inline double _Complex sin( double _Complex x ) { return csin( x ); }
-static inline long double _Complex sin( long double _Complex x ) { return csinl( x ); }
-
-static inline float cos( float x ) { return cosf( x ); }
-// extern "C" { double cos( double ); }
-static inline long double cos( long double x ) { return cosl( x ); }
-static inline float _Complex cos( float _Complex x ) { return ccosf( x ); }
-static inline double _Complex cos( double _Complex x ) { return ccos( x ); }
-static inline long double _Complex cos( long double _Complex x ) { return ccosl( x ); }
-
-static inline float tan( float x ) { return tanf( x ); }
-// extern "C" { double tan( double ); }
-static inline long double tan( long double x ) { return tanl( x ); }
-static inline float _Complex tan( float _Complex x ) { return ctanf( x ); }
-static inline double _Complex tan( double _Complex x ) { return ctan( x ); }
-static inline long double _Complex tan( long double _Complex x ) { return ctanl( x ); }
-
-static inline float asin( float x ) { return asinf( x ); }
-// extern "C" { double asin( double ); }
-static inline long double asin( long double x ) { return asinl( x ); }
-static inline float _Complex asin( float _Complex x ) { return casinf( x ); }
-static inline double _Complex asin( double _Complex x ) { return casin( x ); }
-static inline long double _Complex asin( long double _Complex x ) { return casinl( x ); }
-
-static inline float acos( float x ) { return acosf( x ); }
-// extern "C" { double acos( double ); }
-static inline long double acos( long double x ) { return acosl( x ); }
-static inline float _Complex acos( float _Complex x ) { return cacosf( x ); }
-static inline double _Complex acos( double _Complex x ) { return cacos( x ); }
-static inline long double _Complex acos( long double _Complex x ) { return cacosl( x ); }
-
-static inline float atan( float x ) { return atanf( x ); }
-// extern "C" { double atan( double ); }
-static inline long double atan( long double x ) { return atanl( x ); }
-static inline float _Complex atan( float _Complex x ) { return catanf( x ); }
-static inline double _Complex atan( double _Complex x ) { return catan( x ); }
-static inline long double _Complex atan( long double _Complex x ) { return catanl( x ); }
-
-static inline float atan2( float x, float y ) { return atan2f( x, y ); }
-// extern "C" { double atan2( double, double ); }
-static inline long double atan2( long double x, long double y ) { return atan2l( x, y ); }
-
-// alternative name for atan2
-static inline float atan( float x, float y ) { return atan2f( x, y ); }
-static inline double atan( double x, double y ) { return atan2( x, y ); }
-static inline long double atan( long double x, long double y ) { return atan2l( x, y ); }
-
-//---------------------- Hyperbolic ----------------------
-
-static inline float sinh( float x ) { return sinhf( x ); }
-// extern "C" { double sinh( double ); }
-static inline long double sinh( long double x ) { return sinhl( x ); }
-static inline float _Complex sinh( float _Complex x ) { return csinhf( x ); }
-static inline double _Complex sinh( double _Complex x ) { return csinh( x ); }
-static inline long double _Complex sinh( long double _Complex x ) { return csinhl( x ); }
-
-static inline float cosh( float x ) { return coshf( x ); }
-// extern "C" { double cosh( double ); }
-static inline long double cosh( long double x ) { return coshl( x ); }
-static inline float _Complex cosh( float _Complex x ) { return ccoshf( x ); }
-static inline double _Complex cosh( double _Complex x ) { return ccosh( x ); }
-static inline long double _Complex cosh( long double _Complex x ) { return ccoshl( x ); }
-
-static inline float tanh( float x ) { return tanhf( x ); }
-// extern "C" { double tanh( double ); }
-static inline long double tanh( long double x ) { return tanhl( x ); }
-static inline float _Complex tanh( float _Complex x ) { return ctanhf( x ); }
-static inline double _Complex tanh( double _Complex x ) { return ctanh( x ); }
-static inline long double _Complex tanh( long double _Complex x ) { return ctanhl( x ); }
-
-static inline float asinh( float x ) { return asinhf( x ); }
-// extern "C" { double asinh( double ); }
-static inline long double asinh( long double x ) { return asinhl( x ); }
-static inline float _Complex asinh( float _Complex x ) { return casinhf( x ); }
-static inline double _Complex asinh( double _Complex x ) { return casinh( x ); }
-static inline long double _Complex asinh( long double _Complex x ) { return casinhl( x ); }
-
-static inline float acosh( float x ) { return acoshf( x ); }
-// extern "C" { double acosh( double ); }
-static inline long double acosh( long double x ) { return acoshl( x ); }
-static inline float _Complex acosh( float _Complex x ) { return cacoshf( x ); }
-static inline double _Complex acosh( double _Complex x ) { return cacosh( x ); }
-static inline long double _Complex acosh( long double _Complex x ) { return cacoshl( x ); }
-
-static inline float atanh( float x ) { return atanhf( x ); }
-// extern "C" { double atanh( double ); }
-static inline long double atanh( long double x ) { return atanhl( x ); }
-static inline float _Complex atanh( float _Complex x ) { return catanhf( x ); }
-static inline double _Complex atanh( double _Complex x ) { return catanh( x ); }
-static inline long double _Complex atanh( long double _Complex x ) { return catanhl( x ); }
-
-//---------------------- Error / Gamma ----------------------
-
-static inline float erf( float x ) { return erff( x ); }
-// extern "C" { double erf( double ); }
-static inline long double erf( long double x ) { return erfl( x ); }
-// float _Complex erf( float _Complex );
-// double _Complex erf( double _Complex );
-// long double _Complex erf( long double _Complex );
-
-static inline float erfc( float x ) { return erfcf( x ); }
-// extern "C" { double erfc( double ); }
-static inline long double erfc( long double x ) { return erfcl( x ); }
-// float _Complex erfc( float _Complex );
-// double _Complex erfc( double _Complex );
-// long double _Complex erfc( long double _Complex );
-
-static inline float lgamma( float x ) { return lgammaf( x ); }
-// extern "C" { double lgamma( double ); }
-static inline long double lgamma( long double x ) { return lgammal( x ); }
-static inline float lgamma( float x, int * sign ) { return lgammaf_r( x, sign ); }
-static inline double lgamma( double x, int * sign ) { return lgamma_r( x, sign ); }
-static inline long double lgamma( long double x, int * sign ) { return lgammal_r( x, sign ); }
-
-static inline float tgamma( float x ) { return tgammaf( x ); }
-// extern "C" { double tgamma( double ); }
-static inline long double tgamma( long double x ) { return tgammal( x ); }
-
-//---------------------- Nearest Integer ----------------------
-
-static inline float floor( float x ) { return floorf( x ); }
-// extern "C" { double floor( double ); }
-static inline long double floor( long double x ) { return floorl( x ); }
-
-static inline float ceil( float x ) { return ceilf( x ); }
-// extern "C" { double ceil( double ); }
-static inline long double ceil( long double x ) { return ceill( x ); }
-
-static inline float trunc( float x ) { return truncf( x ); }
-// extern "C" { double trunc( double ); }
-static inline long double trunc( long double x ) { return truncl( x ); }
-
-static inline float rint( float x ) { return rintf( x ); }
-// extern "C" { double rint( double x ); }
-static inline long double rint( long double x ) { return rintl( x ); }
-static inline long int rint( float x ) { return lrintf( x ); }
-static inline long int rint( double x ) { return lrint( x ); }
-static inline long int rint( long double x ) { return lrintl( x ); }
-static inline long long int rint( float x ) { return llrintf( x ); }
-static inline long long int rint( double x ) { return llrint( x ); }
-static inline long long int rint( long double x ) { return llrintl( x ); }
-
-static inline long int lrint( float x ) { return lrintf( x ); }
-// extern "C" { long int lrint( double ); }
-static inline long int lrint( long double x ) { return lrintl( x ); }
-static inline long long int llrint( float x ) { return llrintf( x ); }
-// extern "C" { long long int llrint( double ); }
-static inline long long int llrint( long double x ) { return llrintl( x ); }
-
-static inline float nearbyint( float x ) { return nearbyintf( x ); }
-// extern "C" { double nearbyint( double ); }
-static inline long double nearbyint( long double x ) { return nearbyintl( x ); }
-
-static inline float round( float x ) { return roundf( x ); }
-// extern "C" { double round( double x ); }
-static inline long double round( long double x ) { return roundl( x ); }
-static inline long int round( float x ) { return lroundf( x ); }
-static inline long int round( double x ) { return lround( x ); }
-static inline long int round( long double x ) { return lroundl( x ); }
-static inline long long int round( float x ) { return llroundf( x ); }
-static inline long long int round( double x ) { return llround( x ); }
-static inline long long int round( long double x ) { return llroundl( x ); }
-
-static inline long int lround( float x ) { return lroundf( x ); }
-// extern "C" { long int lround( double ); }
-static inline long int lround( long double x ) { return lroundl( x ); }
-static inline long long int llround( float x ) { return llroundf( x ); }
-// extern "C" { long long int llround( double ); }
-static inline long long int llround( long double x ) { return llroundl( x ); }
-
-//---------------------- Manipulation ----------------------
-
-static inline float copysign( float x, float y ) { return copysignf( x, y ); }
-// extern "C" { double copysign( double, double ); }
-static inline long double copysign( long double x, long double y ) { return copysignl( x, y ); }
-
-static inline float frexp( float x, int * ip ) { return frexpf( x, ip ); }
-// extern "C" { double frexp( double, int * ); }
-static inline long double frexp( long double x, int * ip ) { return frexpl( x, ip ); }
-
-static inline float ldexp( float x, int exp2 ) { return ldexpf( x, exp2 ); }
-// extern "C" { double ldexp( double, int ); }
-static inline long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); }
-
-static inline [ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; }
-static inline float modf( float x, float * i ) { return modff( x, i ); }
-static inline [ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; }
-// extern "C" { double modf( double, double * ); }
-static inline [ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; }
-static inline long double modf( long double x, long double * i ) { return modfl( x, i ); }
-
-static inline float nextafter( float x, float y ) { return nextafterf( x, y ); }
-// extern "C" { double nextafter( double, double ); }
-static inline long double nextafter( long double x, long double y ) { return nextafterl( x, y ); }
-
-static inline float nexttoward( float x, long double y ) { return nexttowardf( x, y ); }
-// extern "C" { double nexttoward( double, long double ); }
-static inline long double nexttoward( long double x, long double y ) { return nexttowardl( x, y ); }
-
-static inline float scalbn( float x, int exp ) { return scalbnf( x, exp ); }
-// extern "C" { double scalbn( double, int ); }
-static inline long double scalbn( long double x, int exp ) { return scalbnl( x, exp ); }
-static inline float scalbn( float x, long int exp ) { return scalblnf( x, exp ); }
-static inline double scalbn( double x, long int exp ) { return scalbln( x, exp ); }
-static inline long double scalbn( long double x, long int exp ) { return scalblnl( x, exp ); }
-
-static inline float scalbln( float x, long int exp ) { return scalblnf( x, exp ); }
-// extern "C" { double scalbln( double, long int ); }
-static inline long double scalbln( long double x, long int exp ) { return scalblnl( x, exp ); }
-
-//---------------------------------------
-
-#include "common"
-
-//---------------------------------------
-
-forall( otype T | { void ?{}( T &, one_t ); T ?+?( T, T ); T ?-?( T, T );T ?*?( T, T ); } )
-T lerp( T x, T y, T a ) { return x * ((T){1} - a) + y * a; }
-
-forall( otype T | { void ?{}( T &, zero_t ); void ?{}( T &, one_t ); int ?<?( T, T ); } )
-T step( T edge, T x ) { return x < edge ? (T){0} : (T){1}; }
-
-forall( otype T | { void ?{}( T &, int ); T clamp( T, T, T ); T ?-?( T, T ); T ?*?( T, T ); T ?/?( T, T ); } )
-T smoothstep( T edge0, T edge1, T x ) { T t = clamp( (x - edge0) / (edge1 - edge0), (T){0}, (T){1} ); return t * t * ((T){3} - (T){2} * t); }
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/math.hfa
===================================================================
--- libcfa/src/math.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/math.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,368 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// math --
+//
+// Author           : Peter A. Buhr
+// Created On       : Mon Apr 18 23:37:04 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Jul 13 11:02:15 2018
+// Update Count     : 116
+//
+
+#pragma once
+
+#include <math.h>
+#include <complex.h>
+
+//---------------------- General ----------------------
+
+static inline float ?%?( float x, float y ) { return fmodf( x, y ); }
+static inline float fmod( float x, float y ) { return fmodf( x, y ); }
+static inline double ?%?( double x, double y ) { return fmod( x, y ); }
+// extern "C" { double fmod( double, double ); }
+static inline long double ?%?( long double x, long double y ) { return fmodl( x, y ); }
+static inline long double fmod( long double x, long double y ) { return fmodl( x, y ); }
+
+static inline float remainder( float x, float y ) { return remainderf( x, y ); }
+// extern "C" { double remainder( double, double ); }
+static inline long double remainder( long double x, long double y ) { return remainderl( x, y ); }
+
+static inline float remquo( float x, float y, int * quo ) { return remquof( x, y, quo ); }
+// extern "C" { double remquo( double x, double y, int * quo ); }
+static inline long double remquo( long double x, long double y, int * quo ) { return remquol( x, y, quo ); }
+static inline [ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
+static inline [ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
+static inline [ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
+
+static inline [ float, float ] div( float x, float y ) { y = modff( x / y, &x ); return [ x, y ]; }
+static inline [ double, double ] div( double x, double y ) { y = modf( x / y, &x ); return [ x, y ]; }
+static inline [ long double, long double ] div( long double x, long double y ) { y = modfl( x / y, &x ); return [ x, y ]; }
+
+static inline float fma( float x, float y, float z ) { return fmaf( x, y, z ); }
+// extern "C" { double fma( double, double, double ); }
+static inline long double fma( long double x, long double y, long double z ) { return fmal( x, y, z ); }
+
+static inline float fdim( float x, float y ) { return fdimf( x, y ); }
+// extern "C" { double fdim( double, double ); }
+static inline long double fdim( long double x, long double y ) { return fdiml( x, y ); }
+
+static inline float nan( const char * tag ) { return nanf( tag ); }
+// extern "C" { double nan( const char * ); }
+static inline long double nan( const char * tag ) { return nanl( tag ); }
+
+//---------------------- Exponential ----------------------
+
+static inline float exp( float x ) { return expf( x ); }
+// extern "C" { double exp( double ); }
+static inline long double exp( long double x ) { return expl( x ); }
+static inline float _Complex exp( float _Complex x ) { return cexpf( x ); }
+static inline double _Complex exp( double _Complex x ) { return cexp( x ); }
+static inline long double _Complex exp( long double _Complex x ) { return cexpl( x ); }
+
+static inline float exp2( float x ) { return exp2f( x ); }
+// extern "C" { double exp2( double ); }
+static inline long double exp2( long double x ) { return exp2l( x ); }
+//static inline float _Complex exp2( float _Complex x ) { return cexp2f( x ); }
+//static inline double _Complex exp2( double _Complex x ) { return cexp2( x ); }
+//static inline long double _Complex exp2( long double _Complex x ) { return cexp2l( x ); }
+
+static inline float expm1( float x ) { return expm1f( x ); }
+// extern "C" { double expm1( double ); }
+static inline long double expm1( long double x ) { return expm1l( x ); }
+
+static inline float pow( float x, float y ) { return powf( x, y ); }
+// extern "C" { double pow( double, double ); }
+static inline long double pow( long double x, long double y ) { return powl( x, y ); }
+static inline float _Complex pow( float _Complex x, float _Complex y ) { return cpowf( x, y ); }
+static inline double _Complex pow( double _Complex x, double _Complex y ) { return cpow( x, y ); }
+static inline long double _Complex pow( long double _Complex x, long double _Complex y ) { return cpowl( x, y ); }
+
+//---------------------- Logarithm ----------------------
+
+static inline float log( float x ) { return logf( x ); }
+// extern "C" { double log( double ); }
+static inline long double log( long double x ) { return logl( x ); }
+static inline float _Complex log( float _Complex x ) { return clogf( x ); }
+static inline double _Complex log( double _Complex x ) { return clog( x ); }
+static inline long double _Complex log( long double _Complex x ) { return clogl( x ); }
+
+static inline float log2( float x ) { return log2f( x ); }
+// extern "C" { double log2( double ); }
+static inline long double log2( long double x ) { return log2l( x ); }
+// static inline float _Complex log2( float _Complex x ) { return clog2f( x ); }
+// static inline double _Complex log2( double _Complex x ) { return clog2( x ); }
+// static inline long double _Complex log2( long double _Complex x ) { return clog2l( x ); }
+
+static inline float log10( float x ) { return log10f( x ); }
+// extern "C" { double log10( double ); }
+static inline long double log10( long double x ) { return log10l( x ); }
+// static inline float _Complex log10( float _Complex x ) { return clog10f( x ); }
+// static inline double _Complex log10( double _Complex x ) { return clog10( x ); }
+// static inline long double _Complex log10( long double _Complex x ) { return clog10l( x ); }
+
+static inline float log1p( float x ) { return log1pf( x ); }
+// extern "C" { double log1p( double ); }
+static inline long double log1p( long double x ) { return log1pl( x ); }
+
+static inline int ilogb( float x ) { return ilogbf( x ); }
+// extern "C" { int ilogb( double ); }
+static inline int ilogb( long double x ) { return ilogbl( x ); }
+
+static inline float logb( float x ) { return logbf( x ); }
+// extern "C" { double logb( double ); }
+static inline long double logb( long double x ) { return logbl( x ); }
+
+static inline float sqrt( float x ) { return sqrtf( x ); }
+// extern "C" { double sqrt( double ); }
+static inline long double sqrt( long double x ) { return sqrtl( x ); }
+static inline float _Complex sqrt( float _Complex x ) { return csqrtf( x ); }
+static inline double _Complex sqrt( double _Complex x ) { return csqrt( x ); }
+static inline long double _Complex sqrt( long double _Complex x ) { return csqrtl( x ); }
+
+static inline float cbrt( float x ) { return cbrtf( x ); }
+// extern "C" { double cbrt( double ); }
+static inline long double cbrt( long double x ) { return cbrtl( x ); }
+
+static inline float hypot( float x, float y ) { return hypotf( x, y ); }
+// extern "C" { double hypot( double, double ); }
+static inline long double hypot( long double x, long double y ) { return hypotl( x, y ); }
+
+//---------------------- Trigonometric ----------------------
+
+static inline float sin( float x ) { return sinf( x ); }
+// extern "C" { double sin( double ); }
+static inline long double sin( long double x ) { return sinl( x ); }
+static inline float _Complex sin( float _Complex x ) { return csinf( x ); }
+static inline double _Complex sin( double _Complex x ) { return csin( x ); }
+static inline long double _Complex sin( long double _Complex x ) { return csinl( x ); }
+
+static inline float cos( float x ) { return cosf( x ); }
+// extern "C" { double cos( double ); }
+static inline long double cos( long double x ) { return cosl( x ); }
+static inline float _Complex cos( float _Complex x ) { return ccosf( x ); }
+static inline double _Complex cos( double _Complex x ) { return ccos( x ); }
+static inline long double _Complex cos( long double _Complex x ) { return ccosl( x ); }
+
+static inline float tan( float x ) { return tanf( x ); }
+// extern "C" { double tan( double ); }
+static inline long double tan( long double x ) { return tanl( x ); }
+static inline float _Complex tan( float _Complex x ) { return ctanf( x ); }
+static inline double _Complex tan( double _Complex x ) { return ctan( x ); }
+static inline long double _Complex tan( long double _Complex x ) { return ctanl( x ); }
+
+static inline float asin( float x ) { return asinf( x ); }
+// extern "C" { double asin( double ); }
+static inline long double asin( long double x ) { return asinl( x ); }
+static inline float _Complex asin( float _Complex x ) { return casinf( x ); }
+static inline double _Complex asin( double _Complex x ) { return casin( x ); }
+static inline long double _Complex asin( long double _Complex x ) { return casinl( x ); }
+
+static inline float acos( float x ) { return acosf( x ); }
+// extern "C" { double acos( double ); }
+static inline long double acos( long double x ) { return acosl( x ); }
+static inline float _Complex acos( float _Complex x ) { return cacosf( x ); }
+static inline double _Complex acos( double _Complex x ) { return cacos( x ); }
+static inline long double _Complex acos( long double _Complex x ) { return cacosl( x ); }
+
+static inline float atan( float x ) { return atanf( x ); }
+// extern "C" { double atan( double ); }
+static inline long double atan( long double x ) { return atanl( x ); }
+static inline float _Complex atan( float _Complex x ) { return catanf( x ); }
+static inline double _Complex atan( double _Complex x ) { return catan( x ); }
+static inline long double _Complex atan( long double _Complex x ) { return catanl( x ); }
+
+static inline float atan2( float x, float y ) { return atan2f( x, y ); }
+// extern "C" { double atan2( double, double ); }
+static inline long double atan2( long double x, long double y ) { return atan2l( x, y ); }
+
+// alternative name for atan2
+static inline float atan( float x, float y ) { return atan2f( x, y ); }
+static inline double atan( double x, double y ) { return atan2( x, y ); }
+static inline long double atan( long double x, long double y ) { return atan2l( x, y ); }
+
+//---------------------- Hyperbolic ----------------------
+
+static inline float sinh( float x ) { return sinhf( x ); }
+// extern "C" { double sinh( double ); }
+static inline long double sinh( long double x ) { return sinhl( x ); }
+static inline float _Complex sinh( float _Complex x ) { return csinhf( x ); }
+static inline double _Complex sinh( double _Complex x ) { return csinh( x ); }
+static inline long double _Complex sinh( long double _Complex x ) { return csinhl( x ); }
+
+static inline float cosh( float x ) { return coshf( x ); }
+// extern "C" { double cosh( double ); }
+static inline long double cosh( long double x ) { return coshl( x ); }
+static inline float _Complex cosh( float _Complex x ) { return ccoshf( x ); }
+static inline double _Complex cosh( double _Complex x ) { return ccosh( x ); }
+static inline long double _Complex cosh( long double _Complex x ) { return ccoshl( x ); }
+
+static inline float tanh( float x ) { return tanhf( x ); }
+// extern "C" { double tanh( double ); }
+static inline long double tanh( long double x ) { return tanhl( x ); }
+static inline float _Complex tanh( float _Complex x ) { return ctanhf( x ); }
+static inline double _Complex tanh( double _Complex x ) { return ctanh( x ); }
+static inline long double _Complex tanh( long double _Complex x ) { return ctanhl( x ); }
+
+static inline float asinh( float x ) { return asinhf( x ); }
+// extern "C" { double asinh( double ); }
+static inline long double asinh( long double x ) { return asinhl( x ); }
+static inline float _Complex asinh( float _Complex x ) { return casinhf( x ); }
+static inline double _Complex asinh( double _Complex x ) { return casinh( x ); }
+static inline long double _Complex asinh( long double _Complex x ) { return casinhl( x ); }
+
+static inline float acosh( float x ) { return acoshf( x ); }
+// extern "C" { double acosh( double ); }
+static inline long double acosh( long double x ) { return acoshl( x ); }
+static inline float _Complex acosh( float _Complex x ) { return cacoshf( x ); }
+static inline double _Complex acosh( double _Complex x ) { return cacosh( x ); }
+static inline long double _Complex acosh( long double _Complex x ) { return cacoshl( x ); }
+
+static inline float atanh( float x ) { return atanhf( x ); }
+// extern "C" { double atanh( double ); }
+static inline long double atanh( long double x ) { return atanhl( x ); }
+static inline float _Complex atanh( float _Complex x ) { return catanhf( x ); }
+static inline double _Complex atanh( double _Complex x ) { return catanh( x ); }
+static inline long double _Complex atanh( long double _Complex x ) { return catanhl( x ); }
+
+//---------------------- Error / Gamma ----------------------
+
+static inline float erf( float x ) { return erff( x ); }
+// extern "C" { double erf( double ); }
+static inline long double erf( long double x ) { return erfl( x ); }
+// float _Complex erf( float _Complex );
+// double _Complex erf( double _Complex );
+// long double _Complex erf( long double _Complex );
+
+static inline float erfc( float x ) { return erfcf( x ); }
+// extern "C" { double erfc( double ); }
+static inline long double erfc( long double x ) { return erfcl( x ); }
+// float _Complex erfc( float _Complex );
+// double _Complex erfc( double _Complex );
+// long double _Complex erfc( long double _Complex );
+
+static inline float lgamma( float x ) { return lgammaf( x ); }
+// extern "C" { double lgamma( double ); }
+static inline long double lgamma( long double x ) { return lgammal( x ); }
+static inline float lgamma( float x, int * sign ) { return lgammaf_r( x, sign ); }
+static inline double lgamma( double x, int * sign ) { return lgamma_r( x, sign ); }
+static inline long double lgamma( long double x, int * sign ) { return lgammal_r( x, sign ); }
+
+static inline float tgamma( float x ) { return tgammaf( x ); }
+// extern "C" { double tgamma( double ); }
+static inline long double tgamma( long double x ) { return tgammal( x ); }
+
+//---------------------- Nearest Integer ----------------------
+
+static inline float floor( float x ) { return floorf( x ); }
+// extern "C" { double floor( double ); }
+static inline long double floor( long double x ) { return floorl( x ); }
+
+static inline float ceil( float x ) { return ceilf( x ); }
+// extern "C" { double ceil( double ); }
+static inline long double ceil( long double x ) { return ceill( x ); }
+
+static inline float trunc( float x ) { return truncf( x ); }
+// extern "C" { double trunc( double ); }
+static inline long double trunc( long double x ) { return truncl( x ); }
+
+static inline float rint( float x ) { return rintf( x ); }
+// extern "C" { double rint( double x ); }
+static inline long double rint( long double x ) { return rintl( x ); }
+static inline long int rint( float x ) { return lrintf( x ); }
+static inline long int rint( double x ) { return lrint( x ); }
+static inline long int rint( long double x ) { return lrintl( x ); }
+static inline long long int rint( float x ) { return llrintf( x ); }
+static inline long long int rint( double x ) { return llrint( x ); }
+static inline long long int rint( long double x ) { return llrintl( x ); }
+
+static inline long int lrint( float x ) { return lrintf( x ); }
+// extern "C" { long int lrint( double ); }
+static inline long int lrint( long double x ) { return lrintl( x ); }
+static inline long long int llrint( float x ) { return llrintf( x ); }
+// extern "C" { long long int llrint( double ); }
+static inline long long int llrint( long double x ) { return llrintl( x ); }
+
+static inline float nearbyint( float x ) { return nearbyintf( x ); }
+// extern "C" { double nearbyint( double ); }
+static inline long double nearbyint( long double x ) { return nearbyintl( x ); }
+
+static inline float round( float x ) { return roundf( x ); }
+// extern "C" { double round( double x ); }
+static inline long double round( long double x ) { return roundl( x ); }
+static inline long int round( float x ) { return lroundf( x ); }
+static inline long int round( double x ) { return lround( x ); }
+static inline long int round( long double x ) { return lroundl( x ); }
+static inline long long int round( float x ) { return llroundf( x ); }
+static inline long long int round( double x ) { return llround( x ); }
+static inline long long int round( long double x ) { return llroundl( x ); }
+
+static inline long int lround( float x ) { return lroundf( x ); }
+// extern "C" { long int lround( double ); }
+static inline long int lround( long double x ) { return lroundl( x ); }
+static inline long long int llround( float x ) { return llroundf( x ); }
+// extern "C" { long long int llround( double ); }
+static inline long long int llround( long double x ) { return llroundl( x ); }
+
+//---------------------- Manipulation ----------------------
+
+static inline float copysign( float x, float y ) { return copysignf( x, y ); }
+// extern "C" { double copysign( double, double ); }
+static inline long double copysign( long double x, long double y ) { return copysignl( x, y ); }
+
+static inline float frexp( float x, int * ip ) { return frexpf( x, ip ); }
+// extern "C" { double frexp( double, int * ); }
+static inline long double frexp( long double x, int * ip ) { return frexpl( x, ip ); }
+
+static inline float ldexp( float x, int exp2 ) { return ldexpf( x, exp2 ); }
+// extern "C" { double ldexp( double, int ); }
+static inline long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); }
+
+static inline [ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; }
+static inline float modf( float x, float * i ) { return modff( x, i ); }
+static inline [ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; }
+// extern "C" { double modf( double, double * ); }
+static inline [ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; }
+static inline long double modf( long double x, long double * i ) { return modfl( x, i ); }
+
+static inline float nextafter( float x, float y ) { return nextafterf( x, y ); }
+// extern "C" { double nextafter( double, double ); }
+static inline long double nextafter( long double x, long double y ) { return nextafterl( x, y ); }
+
+static inline float nexttoward( float x, long double y ) { return nexttowardf( x, y ); }
+// extern "C" { double nexttoward( double, long double ); }
+static inline long double nexttoward( long double x, long double y ) { return nexttowardl( x, y ); }
+
+static inline float scalbn( float x, int exp ) { return scalbnf( x, exp ); }
+// extern "C" { double scalbn( double, int ); }
+static inline long double scalbn( long double x, int exp ) { return scalbnl( x, exp ); }
+static inline float scalbn( float x, long int exp ) { return scalblnf( x, exp ); }
+static inline double scalbn( double x, long int exp ) { return scalbln( x, exp ); }
+static inline long double scalbn( long double x, long int exp ) { return scalblnl( x, exp ); }
+
+static inline float scalbln( float x, long int exp ) { return scalblnf( x, exp ); }
+// extern "C" { double scalbln( double, long int ); }
+static inline long double scalbln( long double x, long int exp ) { return scalblnl( x, exp ); }
+
+//---------------------------------------
+
+#include "common"
+
+//---------------------------------------
+
+forall( otype T | { void ?{}( T &, one_t ); T ?+?( T, T ); T ?-?( T, T );T ?*?( T, T ); } )
+T lerp( T x, T y, T a ) { return x * ((T){1} - a) + y * a; }
+
+forall( otype T | { void ?{}( T &, zero_t ); void ?{}( T &, one_t ); int ?<?( T, T ); } )
+T step( T edge, T x ) { return x < edge ? (T){0} : (T){1}; }
+
+forall( otype T | { void ?{}( T &, int ); T clamp( T, T, T ); T ?-?( T, T ); T ?*?( T, T ); T ?/?( T, T ); } )
+T smoothstep( T edge0, T edge1, T x ) { T t = clamp( (x - edge0) / (edge1 - edge0), (T){0}, (T){1} ); return t * t * ((T){3} - (T){2} * t); }
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/rational
===================================================================
--- libcfa/src/rational	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,107 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// rational -- Rational numbers are numbers written as a ratio, i.e., as a fraction, where the numerator (top number)
-//     and the denominator (bottom number) are whole numbers. When creating and computing with rational numbers, results
-//     are constantly reduced to keep the numerator and denominator as small as possible.
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Apr  6 17:56:25 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jun  2 09:10:01 2018
-// Update Count     : 105
-//
-
-#pragma once
-
-#include "iostream"
-
-trait scalar( otype T ) {
-};
-
-trait arithmetic( otype T | scalar( T ) ) {
-	int !?( T );
-	int ?==?( T, T );
-	int ?!=?( T, T );
-	int ?<?( T, T );
-	int ?<=?( T, T );
-	int ?>?( T, T );
-	int ?>=?( T, T );
-	void ?{}( T &, zero_t );
-	void ?{}( T &, one_t );
-	T +?( T );
-	T -?( T );
-	T ?+?( T, T );
-	T ?-?( T, T );
-	T ?*?( T, T );
-	T ?/?( T, T );
-	T ?%?( T, T );
-	T ?/=?( T &, T );
-	T abs( T );
-};
-
-// implementation
-
-forall( otype RationalImpl | arithmetic( RationalImpl ) ) {
-	struct Rational {
-		RationalImpl numerator, denominator;			// invariant: denominator > 0
-	}; // Rational
-
-	// constructors
-
-	void ?{}( Rational(RationalImpl) & r );
-	void ?{}( Rational(RationalImpl) & r, RationalImpl n );
-	void ?{}( Rational(RationalImpl) & r, RationalImpl n, RationalImpl d );
-	void ?{}( Rational(RationalImpl) & r, zero_t );
-	void ?{}( Rational(RationalImpl) & r, one_t );
-
-	// numerator/denominator getter
-
-	RationalImpl numerator( Rational(RationalImpl) r );
-	RationalImpl denominator( Rational(RationalImpl) r );
-	[ RationalImpl, RationalImpl ] ?=?( & [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src );
-
-	// numerator/denominator setter
-
-	RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n );
-	RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d );
-
-	// comparison
-
-	int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-
-	// arithmetic
-
-	Rational(RationalImpl) +?( Rational(RationalImpl) r );
-	Rational(RationalImpl) -?( Rational(RationalImpl) r );
-	Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-	Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r );
-
-	// I/O
-	forall( dtype istype | istream( istype ) | { istype & ?|?( istype &, RationalImpl & ); } )
-	istype & ?|?( istype &, Rational(RationalImpl) & );
-
-	forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } )
-	ostype & ?|?( ostype &, Rational(RationalImpl ) );
-} // distribution
-
-// conversion
-forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
-double widen( Rational(RationalImpl) r );
-forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
-Rational(RationalImpl) narrow( double f, RationalImpl md );
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/rational.hfa
===================================================================
--- libcfa/src/rational.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/rational.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,107 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// rational -- Rational numbers are numbers written as a ratio, i.e., as a fraction, where the numerator (top number)
+//     and the denominator (bottom number) are whole numbers. When creating and computing with rational numbers, results
+//     are constantly reduced to keep the numerator and denominator as small as possible.
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 17:56:25 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Jun  2 09:10:01 2018
+// Update Count     : 105
+//
+
+#pragma once
+
+#include "iostream"
+
+trait scalar( otype T ) {
+};
+
+trait arithmetic( otype T | scalar( T ) ) {
+	int !?( T );
+	int ?==?( T, T );
+	int ?!=?( T, T );
+	int ?<?( T, T );
+	int ?<=?( T, T );
+	int ?>?( T, T );
+	int ?>=?( T, T );
+	void ?{}( T &, zero_t );
+	void ?{}( T &, one_t );
+	T +?( T );
+	T -?( T );
+	T ?+?( T, T );
+	T ?-?( T, T );
+	T ?*?( T, T );
+	T ?/?( T, T );
+	T ?%?( T, T );
+	T ?/=?( T &, T );
+	T abs( T );
+};
+
+// implementation
+
+forall( otype RationalImpl | arithmetic( RationalImpl ) ) {
+	struct Rational {
+		RationalImpl numerator, denominator;			// invariant: denominator > 0
+	}; // Rational
+
+	// constructors
+
+	void ?{}( Rational(RationalImpl) & r );
+	void ?{}( Rational(RationalImpl) & r, RationalImpl n );
+	void ?{}( Rational(RationalImpl) & r, RationalImpl n, RationalImpl d );
+	void ?{}( Rational(RationalImpl) & r, zero_t );
+	void ?{}( Rational(RationalImpl) & r, one_t );
+
+	// numerator/denominator getter
+
+	RationalImpl numerator( Rational(RationalImpl) r );
+	RationalImpl denominator( Rational(RationalImpl) r );
+	[ RationalImpl, RationalImpl ] ?=?( & [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src );
+
+	// numerator/denominator setter
+
+	RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n );
+	RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d );
+
+	// comparison
+
+	int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+
+	// arithmetic
+
+	Rational(RationalImpl) +?( Rational(RationalImpl) r );
+	Rational(RationalImpl) -?( Rational(RationalImpl) r );
+	Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+	Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r );
+
+	// I/O
+	forall( dtype istype | istream( istype ) | { istype & ?|?( istype &, RationalImpl & ); } )
+	istype & ?|?( istype &, Rational(RationalImpl) & );
+
+	forall( dtype ostype | ostream( ostype ) | { ostype & ?|?( ostype &, RationalImpl ); } )
+	ostype & ?|?( ostype &, Rational(RationalImpl ) );
+} // distribution
+
+// conversion
+forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } )
+double widen( Rational(RationalImpl) r );
+forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl );  RationalImpl convert( double );} )
+Rational(RationalImpl) narrow( double f, RationalImpl md );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/startup.cfa
===================================================================
--- libcfa/src/startup.cfa	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ libcfa/src/startup.cfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -14,5 +14,5 @@
 //
 
-#include "startup.h"
+#include "startup.hfa"
 #include <unistd.h>
 
Index: libcfa/src/startup.h
===================================================================
--- libcfa/src/startup.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,39 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// startup.h --
-//
-// Author           : Thierry Delisle
-// Created On       : Wed Mar 29 15:56:41 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Jul 24 16:16:37 2018
-// Update Count     : 4
-//
-
-#pragma once
-
-#if GCC_VERSION > 50000
-extern "C" {
-	enum {
-		STARTUP_PRIORITY_MEMORY     = 101,
-		STARTUP_PRIORITY_CORE       = 102,
-		STARTUP_PRIORITY_KERNEL     = 103,
-		STARTUP_PRIORITY_IOSTREAM   = 104,
-		STARTUP_PRIORITY_APPREADY   = 105,
-	};
-}
-#else
-#define STARTUP_PRIORITY_MEMORY     101
-#define STARTUP_PRIORITY_CORE       102
-#define STARTUP_PRIORITY_KERNEL     103
-#define STARTUP_PRIORITY_IOSTREAM   104
-#define STARTUP_PRIORITY_APPREADY   105
-#endif
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/startup.hfa
===================================================================
--- libcfa/src/startup.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/startup.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,39 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// startup.hfa --
+//
+// Author           : Thierry Delisle
+// Created On       : Wed Mar 29 15:56:41 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Jul 24 16:16:37 2018
+// Update Count     : 4
+//
+
+#pragma once
+
+#if GCC_VERSION > 50000
+extern "C" {
+	enum {
+		STARTUP_PRIORITY_MEMORY     = 101,
+		STARTUP_PRIORITY_CORE       = 102,
+		STARTUP_PRIORITY_KERNEL     = 103,
+		STARTUP_PRIORITY_IOSTREAM   = 104,
+		STARTUP_PRIORITY_APPREADY   = 105,
+	};
+}
+#else
+#define STARTUP_PRIORITY_MEMORY     101
+#define STARTUP_PRIORITY_CORE       102
+#define STARTUP_PRIORITY_KERNEL     103
+#define STARTUP_PRIORITY_IOSTREAM   104
+#define STARTUP_PRIORITY_APPREADY   105
+#endif
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/stdlib
===================================================================
--- libcfa/src/stdlib	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,258 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// stdlib --
-//
-// Author           : Peter A. Buhr
-// Created On       : Thu Jan 28 17:12:35 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 27 07:21:36 2018
-// Update Count     : 345
-//
-
-#pragma once
-
-#include <stdlib.h>										// *alloc, strto*, ato*
-extern "C" {
-	void * memalign( size_t align, size_t size );		// malloc.h
-	void * memset( void * dest, int fill, size_t size ); // string.h
-	void * memcpy( void * dest, const void * src, size_t size ); // string.h
-    void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA
-} // extern "C"
-
-//---------------------------------------
-
-#ifndef EXIT_FAILURE
-#define	EXIT_FAILURE	1								// failing exit status
-#define	EXIT_SUCCESS	0								// successful exit status
-#endif // ! EXIT_FAILURE
-
-//---------------------------------------
-
-static inline forall( dtype T | sized(T) ) {
-	// C dynamic allocation
-
-	T * malloc( void ) {
-		return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
-	} // malloc
-
-	// T & malloc( void ) {
-	// 	int & p = *(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
-	// 	printf( "& malloc %p\n", &p );
-	// 	return p;
-	// 	//	return (T &)*(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
-	// } // malloc
-
-	T * calloc( size_t dim ) {
-		return (T *)(void *)calloc( dim, sizeof(T) );	// C calloc
-	} // calloc
-
-	T * realloc( T * ptr, size_t size ) {
-		return (T *)(void *)realloc( (void *)ptr, size );
-	} // realloc
-
-	T * memalign( size_t align ) {
-		return (T *)memalign( align, sizeof(T) );
-	} // memalign
-
-	T * aligned_alloc( size_t align ) {
-		return (T *)aligned_alloc( align, sizeof(T) );
-	} // aligned_alloc
-
-	int posix_memalign( T ** ptr, size_t align ) {
-		return posix_memalign( (void **)ptr, align, sizeof(T) ); // C posix_memalign
-	} // posix_memalign
-
-
-	// Cforall dynamic allocation
-
-	T * alloc( void ) {
-		return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
-	} // alloc
-
-	T * alloc( char fill ) {
-		T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) );	// C malloc
-		return (T *)memset( ptr, (int)fill, sizeof(T) );	// initial with fill value
-	} // alloc
-
-	T * alloc( size_t dim ) {
-		return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
-	} // alloc
-
-	T * alloc( size_t dim, char fill ) {
-		T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
-		return (T *)memset( ptr, (int)fill, dim * sizeof(T) );	  // initial with fill value
-	} // alloc
-
-	T * alloc( T ptr[], size_t dim ) {
-		return (T *)(void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc
-	} // alloc
-} // distribution
-
-
-forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
-
-
-static inline forall( dtype T | sized(T) ) {
-	T * align_alloc( size_t align ) {
-		return (T *)memalign( align, sizeof(T) );
-	} // align_alloc
-
-	T * align_alloc( size_t align, char fill ) {
-		T * ptr = (T *)memalign( align, sizeof(T) );
-		return (T *)memset( ptr, (int)fill, sizeof(T) );
-	} // align_alloc
-
-	T * align_alloc( size_t align, size_t dim ) {
-		return (T *)memalign( align, dim * sizeof(T) );
-	} // align_alloc
-
-	T * align_alloc( size_t align, size_t dim, char fill ) {
-		T * ptr;
-		if ( fill == '\0' ) {
-			ptr = (T *)cmemalign( align, dim, sizeof(T) );
-		} else {
-			ptr = (T *)memalign( align, dim * sizeof(T) );
-			return (T *)memset( ptr, (int)fill, dim * sizeof(T) );
-		} // if
-		return ptr;
-	} // align_alloc
-} // distribution
-
-
-static inline forall( dtype T | sized(T) ) {
-	// data, non-array types
-
-	T * memset( T * dest, char fill ) {
-		return (T *)memset( dest, fill, sizeof(T) );
-	} // memset
-
-	T * memcpy( T * dest, const T * src ) {
-		return (T *)memcpy( dest, src, sizeof(T) );
-	} // memcpy
-} // distribution
-
-static inline forall( dtype T | sized(T) ) {
-	// data, array types
-
-	T * amemset( T dest[], char fill, size_t dim ) {
-		return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset
-	} // amemset
-
-	T * amemcpy( T dest[], const T src[], size_t dim ) {
-		return (T *)(void *)memcpy( dest, src, dim * sizeof(T) ); // C memcpy
-	} // amemcpy
-} // distribution
-
-// allocation/deallocation and constructor/destructor, non-array types
-forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * new( Params p );
-forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void delete( T * ptr );
-forall( dtype T, ttype Params | sized(T) | { void ^?{}( T & ); void delete( Params ); } ) void delete( T * ptr, Params rest );
-
-// allocation/deallocation and constructor/destructor, array types
-forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * anew( size_t dim, Params p );
-forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( size_t dim, T arr[] );
-forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } ) void adelete( size_t dim, T arr[], Params rest );
-
-//---------------------------------------
-
-static inline {
-	int strto( const char * sptr, char ** eptr, int base ) { return (int)strtol( sptr, eptr, base ); }
-	unsigned int strto( const char * sptr, char ** eptr, int base ) { return (unsigned int)strtoul( sptr, eptr, base ); }
-	long int strto( const char * sptr, char ** eptr, int base ) { return strtol( sptr, eptr, base ); }
-	unsigned long int strto( const char * sptr, char ** eptr, int base ) { return strtoul( sptr, eptr, base ); }
-	long long int strto( const char * sptr, char ** eptr, int base ) { return strtoll( sptr, eptr, base ); }
-	unsigned long long int strto( const char * sptr, char ** eptr, int base ) { return strtoull( sptr, eptr, base ); }
-
-	float strto( const char * sptr, char ** eptr ) { return strtof( sptr, eptr ); }
-	double strto( const char * sptr, char ** eptr ) { return strtod( sptr, eptr ); }
-	long double strto( const char * sptr, char ** eptr ) { return strtold( sptr, eptr ); }
-} // distribution
-
-float _Complex strto( const char * sptr, char ** eptr );
-double _Complex strto( const char * sptr, char ** eptr );
-long double _Complex strto( const char * sptr, char ** eptr );
-
-static inline {
-	int ato( const char * sptr ) {return (int)strtol( sptr, 0, 10 ); }
-	unsigned int ato( const char * sptr ) { return (unsigned int)strtoul( sptr, 0, 10 ); }
-	long int ato( const char * sptr ) { return strtol( sptr, 0, 10 ); }
-	unsigned long int ato( const char * sptr ) { return strtoul( sptr, 0, 10 ); }
-	long long int ato( const char * sptr ) { return strtoll( sptr, 0, 10 ); }
-	unsigned long long int ato( const char * sptr ) { return strtoull( sptr, 0, 10 ); }
-
-	float ato( const char * sptr ) { return strtof( sptr, 0 ); }
-	double ato( const char * sptr ) { return strtod( sptr, 0 ); }
-	long double ato( const char * sptr ) { return strtold( sptr, 0 ); }
-
-	float _Complex ato( const char * sptr ) { return strto( sptr, NULL ); }
-	double _Complex ato( const char * sptr ) { return strto( sptr, NULL ); }
-	long double _Complex ato( const char * sptr ) { return strto( sptr, NULL ); }
-} // distribution
-
-//---------------------------------------
-
-forall( otype E | { int ?<?( E, E ); } ) {
-	E * bsearch( E key, const E * vals, size_t dim );
-	size_t bsearch( E key, const E * vals, size_t dim );
-	E * bsearchl( E key, const E * vals, size_t dim );
-	size_t bsearchl( E key, const E * vals, size_t dim );
-	E * bsearchu( E key, const E * vals, size_t dim );
-	size_t bsearchu( E key, const E * vals, size_t dim );
-} // distribution
-
-forall( otype K, otype E | { int ?<?( K, K ); K getKey( const E & ); } ) {
-	E * bsearch( K key, const E * vals, size_t dim );
-	size_t bsearch( K key, const E * vals, size_t dim );
-	E * bsearchl( K key, const E * vals, size_t dim );
-	size_t bsearchl( K key, const E * vals, size_t dim );
-	E * bsearchu( K key, const E * vals, size_t dim );
-	size_t bsearchu( K key, const E * vals, size_t dim );
-} // distribution
-
-forall( otype E | { int ?<?( E, E ); } ) {
-	void qsort( E * vals, size_t dim );
-} // distribution
-
-//---------------------------------------
-
-extern "C" {											// override C version
-	void srandom( unsigned int seed );
-	long int random( void );
-} // extern "C"
-
-static inline {
-	long int random( long int l, long int u ) { if ( u < l ) [u, l] = [l, u]; return lrand48() % (u - l) + l; } // [l,u)
-	long int random( long int u ) { if ( u < 0 ) return random( u, 0 ); else return random( 0, u ); } // [0,u)
-	unsigned long int random( void ) { return lrand48(); }
-	unsigned long int random( unsigned long int l, unsigned long int u ) { if ( u < l ) [u, l] = [l, u]; return lrand48() % (u - l) + l; } // [l,u)
-	unsigned long int random( unsigned long int u ) { return lrand48() % u; } // [0,u)
-
-	char random( void ) { return (unsigned long int)random(); }
-	char random( char u ) { return random( (unsigned long int)u ); } // [0,u)
-	char random( char l, char u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u)
-	int random( void ) { return (long int)random(); }
-	int random( int u ) { return random( (long int)u ); } // [0,u]
-	int random( int l, int u ) { return random( (long int)l, (long int)u ); } // [l,u)
-	unsigned int random( void ) { return (unsigned long int)random(); }
-	unsigned int random( unsigned int u ) { return random( (unsigned long int)u ); } // [0,u]
-	unsigned int random( unsigned int l, unsigned int u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u)
-} // distribution
-
-float random( void );									// [0.0, 1.0)
-double random( void );									// [0.0, 1.0)
-float _Complex random( void );							// [0.0, 1.0)+[0.0, 1.0)i
-double _Complex random( void );							// [0.0, 1.0)+[0.0, 1.0)i
-long double _Complex random( void );					// [0.0, 1.0)+[0.0, 1.0)i
-
-//---------------------------------------
-
-#include "common"
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/stdlib.hfa
===================================================================
--- libcfa/src/stdlib.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/stdlib.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,258 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// stdlib --
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu Jan 28 17:12:35 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Jul 27 07:21:36 2018
+// Update Count     : 345
+//
+
+#pragma once
+
+#include <stdlib.h>										// *alloc, strto*, ato*
+extern "C" {
+	void * memalign( size_t align, size_t size );		// malloc.h
+	void * memset( void * dest, int fill, size_t size ); // string.h
+	void * memcpy( void * dest, const void * src, size_t size ); // string.h
+    void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA
+} // extern "C"
+
+//---------------------------------------
+
+#ifndef EXIT_FAILURE
+#define	EXIT_FAILURE	1								// failing exit status
+#define	EXIT_SUCCESS	0								// successful exit status
+#endif // ! EXIT_FAILURE
+
+//---------------------------------------
+
+static inline forall( dtype T | sized(T) ) {
+	// C dynamic allocation
+
+	T * malloc( void ) {
+		return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
+	} // malloc
+
+	// T & malloc( void ) {
+	// 	int & p = *(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
+	// 	printf( "& malloc %p\n", &p );
+	// 	return p;
+	// 	//	return (T &)*(T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
+	// } // malloc
+
+	T * calloc( size_t dim ) {
+		return (T *)(void *)calloc( dim, sizeof(T) );	// C calloc
+	} // calloc
+
+	T * realloc( T * ptr, size_t size ) {
+		return (T *)(void *)realloc( (void *)ptr, size );
+	} // realloc
+
+	T * memalign( size_t align ) {
+		return (T *)memalign( align, sizeof(T) );
+	} // memalign
+
+	T * aligned_alloc( size_t align ) {
+		return (T *)aligned_alloc( align, sizeof(T) );
+	} // aligned_alloc
+
+	int posix_memalign( T ** ptr, size_t align ) {
+		return posix_memalign( (void **)ptr, align, sizeof(T) ); // C posix_memalign
+	} // posix_memalign
+
+
+	// Cforall dynamic allocation
+
+	T * alloc( void ) {
+		return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
+	} // alloc
+
+	T * alloc( char fill ) {
+		T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) );	// C malloc
+		return (T *)memset( ptr, (int)fill, sizeof(T) );	// initial with fill value
+	} // alloc
+
+	T * alloc( size_t dim ) {
+		return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
+	} // alloc
+
+	T * alloc( size_t dim, char fill ) {
+		T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
+		return (T *)memset( ptr, (int)fill, dim * sizeof(T) );	  // initial with fill value
+	} // alloc
+
+	T * alloc( T ptr[], size_t dim ) {
+		return (T *)(void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc
+	} // alloc
+} // distribution
+
+
+forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
+
+
+static inline forall( dtype T | sized(T) ) {
+	T * align_alloc( size_t align ) {
+		return (T *)memalign( align, sizeof(T) );
+	} // align_alloc
+
+	T * align_alloc( size_t align, char fill ) {
+		T * ptr = (T *)memalign( align, sizeof(T) );
+		return (T *)memset( ptr, (int)fill, sizeof(T) );
+	} // align_alloc
+
+	T * align_alloc( size_t align, size_t dim ) {
+		return (T *)memalign( align, dim * sizeof(T) );
+	} // align_alloc
+
+	T * align_alloc( size_t align, size_t dim, char fill ) {
+		T * ptr;
+		if ( fill == '\0' ) {
+			ptr = (T *)cmemalign( align, dim, sizeof(T) );
+		} else {
+			ptr = (T *)memalign( align, dim * sizeof(T) );
+			return (T *)memset( ptr, (int)fill, dim * sizeof(T) );
+		} // if
+		return ptr;
+	} // align_alloc
+} // distribution
+
+
+static inline forall( dtype T | sized(T) ) {
+	// data, non-array types
+
+	T * memset( T * dest, char fill ) {
+		return (T *)memset( dest, fill, sizeof(T) );
+	} // memset
+
+	T * memcpy( T * dest, const T * src ) {
+		return (T *)memcpy( dest, src, sizeof(T) );
+	} // memcpy
+} // distribution
+
+static inline forall( dtype T | sized(T) ) {
+	// data, array types
+
+	T * amemset( T dest[], char fill, size_t dim ) {
+		return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset
+	} // amemset
+
+	T * amemcpy( T dest[], const T src[], size_t dim ) {
+		return (T *)(void *)memcpy( dest, src, dim * sizeof(T) ); // C memcpy
+	} // amemcpy
+} // distribution
+
+// allocation/deallocation and constructor/destructor, non-array types
+forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * new( Params p );
+forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void delete( T * ptr );
+forall( dtype T, ttype Params | sized(T) | { void ^?{}( T & ); void delete( Params ); } ) void delete( T * ptr, Params rest );
+
+// allocation/deallocation and constructor/destructor, array types
+forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * anew( size_t dim, Params p );
+forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( size_t dim, T arr[] );
+forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } ) void adelete( size_t dim, T arr[], Params rest );
+
+//---------------------------------------
+
+static inline {
+	int strto( const char * sptr, char ** eptr, int base ) { return (int)strtol( sptr, eptr, base ); }
+	unsigned int strto( const char * sptr, char ** eptr, int base ) { return (unsigned int)strtoul( sptr, eptr, base ); }
+	long int strto( const char * sptr, char ** eptr, int base ) { return strtol( sptr, eptr, base ); }
+	unsigned long int strto( const char * sptr, char ** eptr, int base ) { return strtoul( sptr, eptr, base ); }
+	long long int strto( const char * sptr, char ** eptr, int base ) { return strtoll( sptr, eptr, base ); }
+	unsigned long long int strto( const char * sptr, char ** eptr, int base ) { return strtoull( sptr, eptr, base ); }
+
+	float strto( const char * sptr, char ** eptr ) { return strtof( sptr, eptr ); }
+	double strto( const char * sptr, char ** eptr ) { return strtod( sptr, eptr ); }
+	long double strto( const char * sptr, char ** eptr ) { return strtold( sptr, eptr ); }
+} // distribution
+
+float _Complex strto( const char * sptr, char ** eptr );
+double _Complex strto( const char * sptr, char ** eptr );
+long double _Complex strto( const char * sptr, char ** eptr );
+
+static inline {
+	int ato( const char * sptr ) {return (int)strtol( sptr, 0, 10 ); }
+	unsigned int ato( const char * sptr ) { return (unsigned int)strtoul( sptr, 0, 10 ); }
+	long int ato( const char * sptr ) { return strtol( sptr, 0, 10 ); }
+	unsigned long int ato( const char * sptr ) { return strtoul( sptr, 0, 10 ); }
+	long long int ato( const char * sptr ) { return strtoll( sptr, 0, 10 ); }
+	unsigned long long int ato( const char * sptr ) { return strtoull( sptr, 0, 10 ); }
+
+	float ato( const char * sptr ) { return strtof( sptr, 0 ); }
+	double ato( const char * sptr ) { return strtod( sptr, 0 ); }
+	long double ato( const char * sptr ) { return strtold( sptr, 0 ); }
+
+	float _Complex ato( const char * sptr ) { return strto( sptr, NULL ); }
+	double _Complex ato( const char * sptr ) { return strto( sptr, NULL ); }
+	long double _Complex ato( const char * sptr ) { return strto( sptr, NULL ); }
+} // distribution
+
+//---------------------------------------
+
+forall( otype E | { int ?<?( E, E ); } ) {
+	E * bsearch( E key, const E * vals, size_t dim );
+	size_t bsearch( E key, const E * vals, size_t dim );
+	E * bsearchl( E key, const E * vals, size_t dim );
+	size_t bsearchl( E key, const E * vals, size_t dim );
+	E * bsearchu( E key, const E * vals, size_t dim );
+	size_t bsearchu( E key, const E * vals, size_t dim );
+} // distribution
+
+forall( otype K, otype E | { int ?<?( K, K ); K getKey( const E & ); } ) {
+	E * bsearch( K key, const E * vals, size_t dim );
+	size_t bsearch( K key, const E * vals, size_t dim );
+	E * bsearchl( K key, const E * vals, size_t dim );
+	size_t bsearchl( K key, const E * vals, size_t dim );
+	E * bsearchu( K key, const E * vals, size_t dim );
+	size_t bsearchu( K key, const E * vals, size_t dim );
+} // distribution
+
+forall( otype E | { int ?<?( E, E ); } ) {
+	void qsort( E * vals, size_t dim );
+} // distribution
+
+//---------------------------------------
+
+extern "C" {											// override C version
+	void srandom( unsigned int seed );
+	long int random( void );
+} // extern "C"
+
+static inline {
+	long int random( long int l, long int u ) { if ( u < l ) [u, l] = [l, u]; return lrand48() % (u - l) + l; } // [l,u)
+	long int random( long int u ) { if ( u < 0 ) return random( u, 0 ); else return random( 0, u ); } // [0,u)
+	unsigned long int random( void ) { return lrand48(); }
+	unsigned long int random( unsigned long int l, unsigned long int u ) { if ( u < l ) [u, l] = [l, u]; return lrand48() % (u - l) + l; } // [l,u)
+	unsigned long int random( unsigned long int u ) { return lrand48() % u; } // [0,u)
+
+	char random( void ) { return (unsigned long int)random(); }
+	char random( char u ) { return random( (unsigned long int)u ); } // [0,u)
+	char random( char l, char u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u)
+	int random( void ) { return (long int)random(); }
+	int random( int u ) { return random( (long int)u ); } // [0,u]
+	int random( int l, int u ) { return random( (long int)l, (long int)u ); } // [l,u)
+	unsigned int random( void ) { return (unsigned long int)random(); }
+	unsigned int random( unsigned int u ) { return random( (unsigned long int)u ); } // [0,u]
+	unsigned int random( unsigned int l, unsigned int u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u)
+} // distribution
+
+float random( void );									// [0.0, 1.0)
+double random( void );									// [0.0, 1.0)
+float _Complex random( void );							// [0.0, 1.0)+[0.0, 1.0)i
+double _Complex random( void );							// [0.0, 1.0)+[0.0, 1.0)i
+long double _Complex random( void );					// [0.0, 1.0)+[0.0, 1.0)i
+
+//---------------------------------------
+
+#include "common"
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/time
===================================================================
--- libcfa/src/time	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,210 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// time --
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Mar 14 23:18:57 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jul  2 21:28:38 2018
-// Update Count     : 641
-//
-
-#pragma once
-
-// http://en.cppreference.com/w/cpp/header/chrono
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0355r5.html#refcc
-
-#include <time.h>										// timespec
-extern "C" {
-#include <sys/time.h>									// timeval
-}
-#include <time_t.h>										// Duration/Time types
-
-enum { TIMEGRAN = 1_000_000_000LL };					// nanosecond granularity, except for timeval
-
-//######################### Duration #########################
-
-static inline {
-	Duration ?=?( Duration & dur, zero_t ) { return dur{ 0 }; }
-
-	Duration +?( Duration rhs ) with( rhs ) {	return (Duration)@{ +tv }; }
-	Duration ?+?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tv + rhs.tv }; }
-	Duration ?+=?( Duration & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; }
-
-	Duration -?( Duration rhs ) with( rhs ) { return (Duration)@{ -tv }; }
-	Duration ?-?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tv - rhs.tv }; }
-	Duration ?-=?( Duration & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; }
-
-	Duration ?*?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tv * rhs }; }
-	Duration ?*?( int64_t lhs, Duration rhs ) { return (Duration)@{ lhs * rhs.tv }; }
-	Duration ?*=?( Duration & lhs, int64_t rhs ) { lhs = lhs * rhs; return lhs; }
-
-	int64_t ?/?( Duration lhs, Duration rhs ) { return lhs.tv / rhs.tv; }
-	Duration ?/?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tv / rhs }; }
-	Duration ?/=?( Duration & lhs, int64_t rhs ) { lhs = lhs / rhs; return lhs; }
-	double div( Duration lhs, Duration rhs ) { return (double)lhs.tv / (double)rhs.tv; }
-
-	Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tv % rhs.tv }; }
-	Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
-
-	_Bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; }
-	_Bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tv != rhs.tv; }
-	_Bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tv <  rhs.tv; }
-	_Bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tv <= rhs.tv; }
-	_Bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tv >  rhs.tv; }
-	_Bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tv >= rhs.tv; }
-
-	_Bool ?==?( Duration lhs, zero_t ) { return lhs.tv == 0; }
-	_Bool ?!=?( Duration lhs, zero_t ) { return lhs.tv != 0; }
-	_Bool ?<? ( Duration lhs, zero_t ) { return lhs.tv <  0; }
-	_Bool ?<=?( Duration lhs, zero_t ) { return lhs.tv <= 0; }
-	_Bool ?>? ( Duration lhs, zero_t ) { return lhs.tv >  0; }
-	_Bool ?>=?( Duration lhs, zero_t ) { return lhs.tv >= 0; }
-
-	Duration abs( Duration rhs ) { return rhs.tv >= 0 ? rhs : -rhs; }
-
-	Duration ?`ns( int64_t nsec ) { return (Duration)@{ nsec }; }
-	Duration ?`us( int64_t usec ) { return (Duration)@{ usec * (TIMEGRAN / 1_000_000LL) }; }
-	Duration ?`ms( int64_t msec ) { return (Duration)@{ msec * (TIMEGRAN / 1_000LL) }; }
-	Duration ?`s( int64_t sec ) { return (Duration)@{ sec * TIMEGRAN }; }
-	Duration ?`s( double sec ) { return (Duration)@{ sec * TIMEGRAN }; }
-	Duration ?`m( int64_t min ) { return (Duration)@{ min * (60LL * TIMEGRAN) }; }
-	Duration ?`m( double min ) { return (Duration)@{ min * (60LL * TIMEGRAN) }; }
-	Duration ?`h( int64_t hours ) { return (Duration)@{ hours * (60LL * 60LL * TIMEGRAN) }; }
-	Duration ?`h( double hours ) { return (Duration)@{ hours * (60LL * 60LL * TIMEGRAN) }; }
-	Duration ?`d( int64_t days ) { return (Duration)@{ days * (24LL * 60LL * 60LL * TIMEGRAN) }; }
-	Duration ?`d( double days ) { return (Duration)@{ days * (24LL * 60LL * 60LL * TIMEGRAN) }; }
-	Duration ?`w( int64_t weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
-	Duration ?`w( double weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
-
-	int64_t ?`ns( Duration dur ) { return dur.tv; }
-	int64_t ?`us( Duration dur ) { return dur.tv / (TIMEGRAN / 1_000_000LL); }
-	int64_t ?`ms( Duration dur ) { return dur.tv / (TIMEGRAN / 1_000LL); }
-	int64_t ?`s( Duration dur ) { return dur.tv / TIMEGRAN; }
-	int64_t ?`m( Duration dur ) { return dur.tv / (60LL * TIMEGRAN); }
-	int64_t ?`h( Duration dur ) { return dur.tv / (60LL * 60LL * TIMEGRAN); }
-	int64_t ?`d( Duration dur ) { return dur.tv / (24LL * 60LL * 60LL * TIMEGRAN); }
-	int64_t ?`w( Duration dur ) { return dur.tv / (7LL * 24LL * 60LL * 60LL * TIMEGRAN); }
-
-	Duration max( Duration lhs, Duration rhs ) { return  (lhs.tv < rhs.tv) ? rhs : lhs;}
-	Duration min( Duration lhs, Duration rhs ) { return !(rhs.tv < lhs.tv) ? lhs : rhs;}
-} // distribution
-
-//######################### C timeval #########################
-
-static inline {
-	void ?{}( timeval & t ) {}
-	void ?{}( timeval & t, time_t sec, suseconds_t usec ) { t.tv_sec = sec; t.tv_usec = usec; }
-	void ?{}( timeval & t, time_t sec ) { t{ sec, 0 }; }
-	void ?{}( timeval & t, zero_t ) { t{ 0, 0 }; }
-
-	timeval ?=?( timeval & t, zero_t ) { return t{ 0 }; }
-	timeval ?+?( timeval & lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_usec + rhs.tv_usec }; }
-	timeval ?-?( timeval & lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_usec - rhs.tv_usec }; }
-	_Bool ?==?( timeval lhs, timeval rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec; }
-	_Bool ?!=?( timeval lhs, timeval rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec; }
-} // distribution
-
-//######################### C timespec #########################
-
-static inline {
-	void ?{}( timespec & t ) {}
-	void ?{}( timespec & t, time_t sec, __syscall_slong_t nsec ) { t.tv_sec = sec; t.tv_nsec = nsec; }
-	void ?{}( timespec & t, time_t sec ) { t{ sec, 0}; }
-	void ?{}( timespec & t, zero_t ) { t{ 0, 0 }; }
-
-	timespec ?=?( timespec & t, zero_t ) { return t{ 0 }; }
-	timespec ?+?( timespec & lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec }; }
-	timespec ?-?( timespec & lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec }; }
-	_Bool ?==?( timespec lhs, timespec rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec; }
-	_Bool ?!=?( timespec lhs, timespec rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_nsec != rhs.tv_nsec; }
-} // distribution
-
-//######################### C itimerval #########################
-
-static inline {
-	void ?{}( itimerval & itv, Duration alarm ) with( itv ) {
-		// itimerval contains durations but but uses time data-structure timeval.
-		it_value{ alarm`s, (alarm % 1`s)`us };			// seconds, microseconds
-		it_interval{ 0 };								// 0 seconds, 0 microseconds
-	} // itimerval
-
-	void ?{}( itimerval & itv, Duration alarm, Duration interval ) with( itv ) {
-		// itimerval contains durations but but uses time data-structure timeval.
-		it_value{ alarm`s, (alarm % 1`s)`us };			// seconds, microseconds
-		it_interval{ interval`s, interval`us };			// seconds, microseconds
-	} // itimerval
-} // distribution
-
-//######################### Time #########################
-
-void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 );
-static inline {
-	Time ?=?( Time & time, zero_t ) { return time{ 0 }; }
-
-	void ?{}( Time & time, timeval t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
-	Time ?=?( Time & time, timeval t ) with( time ) {
-		tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
-		return time;
-	} // ?=?
-
-	void ?{}( Time & time, timespec t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
-	Time ?=?( Time & time, timespec t ) with( time ) {
-		tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
-		return time;
-	} // ?=?
-
-	Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.tv + rhs.tv }; }
-	Time ?+?( Duration lhs, Time rhs ) { return rhs + lhs; }
-	Time ?+=?( Time & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; }
-
-	Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.tv - rhs.tv }; }
-	Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tv - rhs.tv }; }
-	Time ?-=?( Time & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; }
-	_Bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; }
-	_Bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; }
-	_Bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; }
-	_Bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; }
-	_Bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; }
-	_Bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; }
-} // distribution
-
-char * yy_mm_dd( Time time, char * buf );
-static inline char * ?`ymd( Time time, char * buf ) {	// short form
-	return yy_mm_dd( time, buf );
-} // ymd
-
-char * mm_dd_yy( Time time, char * buf );
-static inline char * ?`mdy( Time time, char * buf ) {	// short form
-	return mm_dd_yy( time, buf );
-} // mdy
-
-char * dd_mm_yy( Time time, char * buf );
-static inline char * ?`dmy( Time time, char * buf ) {	// short form
-	return dd_mm_yy( time, buf );;
-} // dmy
-
-size_t strftime( char * buf, size_t size, const char * fmt, Time time );
-
-//------------------------- timeval (cont) -------------------------
-
-static inline void ?{}( timeval & t, Time time ) with( t, time ) {
-	tv_sec = tv / TIMEGRAN;								// seconds
-	tv_usec = tv % TIMEGRAN / (TIMEGRAN / 1_000_000LL);	// microseconds
-} // ?{}
-
-//------------------------- timespec (cont) -------------------------
-
-static inline void ?{}( timespec & t, Time time ) with( t, time ) {
-	tv_sec = tv / TIMEGRAN;								// seconds
-	tv_nsec = tv % TIMEGRAN;							// nanoseconds
-} // ?{}
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/time.hfa
===================================================================
--- libcfa/src/time.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/time.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,210 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// time --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Mar 14 23:18:57 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Mon Jul  2 21:28:38 2018
+// Update Count     : 641
+//
+
+#pragma once
+
+// http://en.cppreference.com/w/cpp/header/chrono
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0355r5.html#refcc
+
+#include <time.h>										// timespec
+extern "C" {
+#include <sys/time.h>									// timeval
+}
+#include <time_t.hfa>										// Duration/Time types
+
+enum { TIMEGRAN = 1_000_000_000LL };					// nanosecond granularity, except for timeval
+
+//######################### Duration #########################
+
+static inline {
+	Duration ?=?( Duration & dur, zero_t ) { return dur{ 0 }; }
+
+	Duration +?( Duration rhs ) with( rhs ) {	return (Duration)@{ +tv }; }
+	Duration ?+?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tv + rhs.tv }; }
+	Duration ?+=?( Duration & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; }
+
+	Duration -?( Duration rhs ) with( rhs ) { return (Duration)@{ -tv }; }
+	Duration ?-?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tv - rhs.tv }; }
+	Duration ?-=?( Duration & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; }
+
+	Duration ?*?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tv * rhs }; }
+	Duration ?*?( int64_t lhs, Duration rhs ) { return (Duration)@{ lhs * rhs.tv }; }
+	Duration ?*=?( Duration & lhs, int64_t rhs ) { lhs = lhs * rhs; return lhs; }
+
+	int64_t ?/?( Duration lhs, Duration rhs ) { return lhs.tv / rhs.tv; }
+	Duration ?/?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tv / rhs }; }
+	Duration ?/=?( Duration & lhs, int64_t rhs ) { lhs = lhs / rhs; return lhs; }
+	double div( Duration lhs, Duration rhs ) { return (double)lhs.tv / (double)rhs.tv; }
+
+	Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tv % rhs.tv }; }
+	Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
+
+	_Bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; }
+	_Bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tv != rhs.tv; }
+	_Bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tv <  rhs.tv; }
+	_Bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tv <= rhs.tv; }
+	_Bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tv >  rhs.tv; }
+	_Bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tv >= rhs.tv; }
+
+	_Bool ?==?( Duration lhs, zero_t ) { return lhs.tv == 0; }
+	_Bool ?!=?( Duration lhs, zero_t ) { return lhs.tv != 0; }
+	_Bool ?<? ( Duration lhs, zero_t ) { return lhs.tv <  0; }
+	_Bool ?<=?( Duration lhs, zero_t ) { return lhs.tv <= 0; }
+	_Bool ?>? ( Duration lhs, zero_t ) { return lhs.tv >  0; }
+	_Bool ?>=?( Duration lhs, zero_t ) { return lhs.tv >= 0; }
+
+	Duration abs( Duration rhs ) { return rhs.tv >= 0 ? rhs : -rhs; }
+
+	Duration ?`ns( int64_t nsec ) { return (Duration)@{ nsec }; }
+	Duration ?`us( int64_t usec ) { return (Duration)@{ usec * (TIMEGRAN / 1_000_000LL) }; }
+	Duration ?`ms( int64_t msec ) { return (Duration)@{ msec * (TIMEGRAN / 1_000LL) }; }
+	Duration ?`s( int64_t sec ) { return (Duration)@{ sec * TIMEGRAN }; }
+	Duration ?`s( double sec ) { return (Duration)@{ sec * TIMEGRAN }; }
+	Duration ?`m( int64_t min ) { return (Duration)@{ min * (60LL * TIMEGRAN) }; }
+	Duration ?`m( double min ) { return (Duration)@{ min * (60LL * TIMEGRAN) }; }
+	Duration ?`h( int64_t hours ) { return (Duration)@{ hours * (60LL * 60LL * TIMEGRAN) }; }
+	Duration ?`h( double hours ) { return (Duration)@{ hours * (60LL * 60LL * TIMEGRAN) }; }
+	Duration ?`d( int64_t days ) { return (Duration)@{ days * (24LL * 60LL * 60LL * TIMEGRAN) }; }
+	Duration ?`d( double days ) { return (Duration)@{ days * (24LL * 60LL * 60LL * TIMEGRAN) }; }
+	Duration ?`w( int64_t weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
+	Duration ?`w( double weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
+
+	int64_t ?`ns( Duration dur ) { return dur.tv; }
+	int64_t ?`us( Duration dur ) { return dur.tv / (TIMEGRAN / 1_000_000LL); }
+	int64_t ?`ms( Duration dur ) { return dur.tv / (TIMEGRAN / 1_000LL); }
+	int64_t ?`s( Duration dur ) { return dur.tv / TIMEGRAN; }
+	int64_t ?`m( Duration dur ) { return dur.tv / (60LL * TIMEGRAN); }
+	int64_t ?`h( Duration dur ) { return dur.tv / (60LL * 60LL * TIMEGRAN); }
+	int64_t ?`d( Duration dur ) { return dur.tv / (24LL * 60LL * 60LL * TIMEGRAN); }
+	int64_t ?`w( Duration dur ) { return dur.tv / (7LL * 24LL * 60LL * 60LL * TIMEGRAN); }
+
+	Duration max( Duration lhs, Duration rhs ) { return  (lhs.tv < rhs.tv) ? rhs : lhs;}
+	Duration min( Duration lhs, Duration rhs ) { return !(rhs.tv < lhs.tv) ? lhs : rhs;}
+} // distribution
+
+//######################### C timeval #########################
+
+static inline {
+	void ?{}( timeval & t ) {}
+	void ?{}( timeval & t, time_t sec, suseconds_t usec ) { t.tv_sec = sec; t.tv_usec = usec; }
+	void ?{}( timeval & t, time_t sec ) { t{ sec, 0 }; }
+	void ?{}( timeval & t, zero_t ) { t{ 0, 0 }; }
+
+	timeval ?=?( timeval & t, zero_t ) { return t{ 0 }; }
+	timeval ?+?( timeval & lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_usec + rhs.tv_usec }; }
+	timeval ?-?( timeval & lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_usec - rhs.tv_usec }; }
+	_Bool ?==?( timeval lhs, timeval rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec; }
+	_Bool ?!=?( timeval lhs, timeval rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec; }
+} // distribution
+
+//######################### C timespec #########################
+
+static inline {
+	void ?{}( timespec & t ) {}
+	void ?{}( timespec & t, time_t sec, __syscall_slong_t nsec ) { t.tv_sec = sec; t.tv_nsec = nsec; }
+	void ?{}( timespec & t, time_t sec ) { t{ sec, 0}; }
+	void ?{}( timespec & t, zero_t ) { t{ 0, 0 }; }
+
+	timespec ?=?( timespec & t, zero_t ) { return t{ 0 }; }
+	timespec ?+?( timespec & lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec }; }
+	timespec ?-?( timespec & lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec }; }
+	_Bool ?==?( timespec lhs, timespec rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec; }
+	_Bool ?!=?( timespec lhs, timespec rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_nsec != rhs.tv_nsec; }
+} // distribution
+
+//######################### C itimerval #########################
+
+static inline {
+	void ?{}( itimerval & itv, Duration alarm ) with( itv ) {
+		// itimerval contains durations but but uses time data-structure timeval.
+		it_value{ alarm`s, (alarm % 1`s)`us };			// seconds, microseconds
+		it_interval{ 0 };								// 0 seconds, 0 microseconds
+	} // itimerval
+
+	void ?{}( itimerval & itv, Duration alarm, Duration interval ) with( itv ) {
+		// itimerval contains durations but but uses time data-structure timeval.
+		it_value{ alarm`s, (alarm % 1`s)`us };			// seconds, microseconds
+		it_interval{ interval`s, interval`us };			// seconds, microseconds
+	} // itimerval
+} // distribution
+
+//######################### Time #########################
+
+void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 );
+static inline {
+	Time ?=?( Time & time, zero_t ) { return time{ 0 }; }
+
+	void ?{}( Time & time, timeval t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
+	Time ?=?( Time & time, timeval t ) with( time ) {
+		tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
+		return time;
+	} // ?=?
+
+	void ?{}( Time & time, timespec t ) with( time ) { tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
+	Time ?=?( Time & time, timespec t ) with( time ) {
+		tv = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
+		return time;
+	} // ?=?
+
+	Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.tv + rhs.tv }; }
+	Time ?+?( Duration lhs, Time rhs ) { return rhs + lhs; }
+	Time ?+=?( Time & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; }
+
+	Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.tv - rhs.tv }; }
+	Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tv - rhs.tv }; }
+	Time ?-=?( Time & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; }
+	_Bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; }
+	_Bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; }
+	_Bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; }
+	_Bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; }
+	_Bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; }
+	_Bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; }
+} // distribution
+
+char * yy_mm_dd( Time time, char * buf );
+static inline char * ?`ymd( Time time, char * buf ) {	// short form
+	return yy_mm_dd( time, buf );
+} // ymd
+
+char * mm_dd_yy( Time time, char * buf );
+static inline char * ?`mdy( Time time, char * buf ) {	// short form
+	return mm_dd_yy( time, buf );
+} // mdy
+
+char * dd_mm_yy( Time time, char * buf );
+static inline char * ?`dmy( Time time, char * buf ) {	// short form
+	return dd_mm_yy( time, buf );;
+} // dmy
+
+size_t strftime( char * buf, size_t size, const char * fmt, Time time );
+
+//------------------------- timeval (cont) -------------------------
+
+static inline void ?{}( timeval & t, Time time ) with( t, time ) {
+	tv_sec = tv / TIMEGRAN;								// seconds
+	tv_usec = tv % TIMEGRAN / (TIMEGRAN / 1_000_000LL);	// microseconds
+} // ?{}
+
+//------------------------- timespec (cont) -------------------------
+
+static inline void ?{}( timespec & t, Time time ) with( t, time ) {
+	tv_sec = tv / TIMEGRAN;								// seconds
+	tv_nsec = tv % TIMEGRAN;							// nanoseconds
+} // ?{}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: libcfa/src/time_t.h
===================================================================
--- libcfa/src/time_t.h	(revision 37fe3525f53534b29c07f4f1204c5f779836d193)
+++ 	(revision )
@@ -1,41 +1,0 @@
-// 
-// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-// 
-// time_t.h -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Tue Apr 10 14:42:03 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Apr 13 07:51:47 2018
-// Update Count     : 6
-// 
-
-#pragma once
-
-
-//######################### Duration #########################
-
-struct Duration {										// private
-	int64_t tv;											// nanoseconds
-}; // Duration
-
-static inline void ?{}( Duration & dur ) with( dur ) { tv = 0; }
-static inline void ?{}( Duration & dur, zero_t ) with( dur ) { tv = 0; }
-
-
-//######################### Time #########################
-
-struct Time {											// private
-	uint64_t tv;										// nanoseconds since UNIX epoch
-}; // Time
-
-static inline void ?{}( Time & time ) with( time ) { tv = 0; }
-static inline void ?{}( Time & time, zero_t ) with( time ) { tv = 0; }
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: libcfa/src/time_t.hfa
===================================================================
--- libcfa/src/time_t.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
+++ libcfa/src/time_t.hfa	(revision 73abe950d807eab747c9e14353b158fcca827308)
@@ -0,0 +1,41 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// time_t.hfa --
+//
+// Author           : Peter A. Buhr
+// Created On       : Tue Apr 10 14:42:03 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Apr 13 07:51:47 2018
+// Update Count     : 6
+//
+
+#pragma once
+
+
+//######################### Duration #########################
+
+struct Duration {										// private
+	int64_t tv;											// nanoseconds
+}; // Duration
+
+static inline void ?{}( Duration & dur ) with( dur ) { tv = 0; }
+static inline void ?{}( Duration & dur, zero_t ) with( dur ) { tv = 0; }
+
+
+//######################### Time #########################
+
+struct Time {											// private
+	uint64_t tv;										// nanoseconds since UNIX epoch
+}; // Time
+
+static inline void ?{}( Time & time ) with( time ) { tv = 0; }
+static inline void ?{}( Time & time, zero_t ) with( time ) { tv = 0; }
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
