Index: doc/uC++toCFA/uC++toCFA.tex
===================================================================
--- doc/uC++toCFA/uC++toCFA.tex	(revision f04623f4acaafe652dba5a6f437094cbc21c5695)
+++ doc/uC++toCFA/uC++toCFA.tex	(revision de8a028648afb4f162e05619a68ce70b9eb807a6)
@@ -11,6 +11,6 @@
 %% Created On       : Wed Apr  6 14:53:29 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Mon Sep  8 18:10:30 2025
-%% Update Count     : 6534
+%% Last Modified On : Mon Nov 17 11:14:48 2025
+%% Update Count     : 6677
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -345,9 +345,10 @@
 
 \begin{cquote}
+\setlength{\tabcolsep}{5pt}
 \begin{tabular}{@{}l|ll@{}}
 \begin{uC++}
 
 
-void main() {
+void Coroutine::main() {
 	try {
 		_Enable {
@@ -357,4 +358,5 @@
 	  catch( E & ) { ... }
 }
+void Coroutine::mem() { resume(); }
 \end{uC++}
 &
@@ -362,5 +364,5 @@
 #define resumePoll( coroutine ) resume( coroutine ); poll()
 #define suspendPoll suspend; poll()
-void main() {
+void main( Coroutine & cor ) {
 	try {
 		enable_ehm();
@@ -370,4 +372,5 @@
 	  catch( E & ) { ... }
 }
+void mem( Coroutine & cor ) { resumePoll(); }
 \end{cfa}
 \end{tabular}
@@ -429,4 +432,117 @@
 \end{tabular}
 \end{cquote}
+
+
+\section{Time}
+
+\begin{cquote}
+\setlength{\tabcolsep}{5pt}
+\begin{tabular}{@{}l|l@{}}
+\begin{uC++}
+
+uTime start = uClock::currTime();
+...
+cout << "duration " << uClock::currTime() - start
+	<< " sec." << endl;
+\end{uC++}
+&
+\begin{cfa}
+#include <clock.hfa>
+Time start = timeHiRes(); // time with nanoseconds
+...
+sout | "duration " | timeHiRes() - start | " sec.";
+
+\end{cfa}
+\end{tabular}
+\end{cquote}
+
+
+\section{Constructor / Destructor}
+
+A constructor/destructor must have its structure type as the first parameter and be a reference.
+\begin{cquote}
+\begin{tabular}{@{}l|l@{}}
+\begin{uC++}
+
+struct S {
+	int i, j;
+	@S@() { i = j = 3; }
+	@S@( int i, int j ) { S::i = i; S::j = j; }
+	@S@( const S & s ) { *this = s; }
+	@~S@() {}
+};
+S s0, s1 = { 1, 2 };
+
+S * s2 = new S{ 1, 2 };   delete s2;
+s2 = new S{ 1, 2 };   delete s2;
+S & s3 = *new S{ 1, 2 };   delete &s3;
+s3 = *new S{ 1, 2 };   delete &s3;
+\end{uC++}
+&
+\begin{cfa}
+#include <stdlib.hfa> // new (malloc)
+struct S { int i, j; };
+
+void @?{}@( @S & s@ ) { s.i = s.j = 3; } $\C[3in]{// default}$
+void @?{}@( @S & s@, int i, int j ) { s.i = i; s.j = j; } $\C{// initializer}$
+void @?{}@( @S & s@, const S rhs ) { ?{}( s, rhs.i, rhs.j ); } $\C{// copy}$
+void @^?{}@( @S & s@ ) { s.i = 0; s.j = 0; } $\C{// destructor}\CRT$
+
+S s0, s1 = { 1, 2 };
+// bug, cannot use 0/1 (zero_t/one_t) with "new"
+S * s2 = new( 0@n@, 2 );   /* suffix n => (natural int) */  delete( s2 );
+s2 = new( 1@n@, 2 );   delete( s2 );
+S & s3 = *new( 2, 2 );   delete( &s3 );
+&s3 = &*new( 3, 2 );   delete( &s3 );
+\end{cfa}
+\end{tabular}
+\end{cquote}
+
+
+\section{\texorpdfstring{Structures (object-oriented \protect\vs routine style)}{Structures (object-oriented vs. routine style)}}
+
+\CFA is NOT an object-oriented programming-language, so there is no receiver (\lstinline[language=c++]{this}) or nested structure routines.
+The equivalent of a \emph{member} routine has an explicit structure parameter in any parameter position (often the first).
+\begin{cquote}
+\begin{tabular}{@{}l|l@{}}
+\begin{uC++}
+struct S {
+	int i = 0;  // cheat, implicit default constructor
+	int setter( int j ) { int t = i; i = j; return t; }
+	int getter() { return i; }
+};
+S s;
+@s.@setter( 3 );  // object calls
+int k = @s.@getter();
+\end{uC++}
+&
+\begin{cfa}
+struct S {  int i;  };
+void ?{}( S & s ) { s.i = 0; } // explicit default constructor
+int setter( @S & s,@ int j ) @with( s )@ { int t = i; i = j; return t; }
+int getter( @S & s@ ) @with( s )@ { return i; }
+
+S s;
+setter( @s,@ 3 );  // normal calls
+int k = getter( @s@ );
+\end{cfa}
+\end{tabular}
+\end{cquote}
+Aggregate qualification is reduced or eliminated by opening scopes using the @with@ clause.
+\begin{cfa}
+struct S { int i; int j; double m; };  // field i has same type in structures S and T
+struct T { int i; int k; int m; };
+void foo( S s, T t ) @with( s, t )@ {   // open structure scope s and t in parallel
+	j + k;				$\C[1.6in]{// unambiguous, s.j + t.k}$
+	m = 5.0;			$\C{// unambiguous, s.m = 5.0}$
+	m = 1;				$\C{// unambiguous, t.m = 1}$
+	int a = m;			$\C{// unambiguous, a = t.m}$
+	double b = m;		$\C{// unambiguous, b = s.m}$
+	int c = s.i + t.i;	$\C{// unambiguous with qualification}$
+	(double)m;			$\C{// unambiguous with cast s.m}\CRT$
+}
+\end{cfa}
+\noindent
+In subsequent code examples, the left example is \CC/\uC and the right example is \CFA.
 
 
@@ -474,4 +590,5 @@
 
 
+\enlargethispage{1000pt}
 \section{\texorpdfstring{\lstinline{uArray}}{uArray}}
 
@@ -525,99 +642,89 @@
 \end{cquote}
 
-
-\section{\texorpdfstring{Structures (object-oriented \protect\vs routine style)}{Structures (object-oriented vs. routine style)}}
-
-\CFA is NOT an object-oriented programming-language, so there is no receiver (\lstinline[language=c++]{this}) or nested structure routines.
-The equivalent of a \emph{member} routine has an explicit structure parameter in any parameter position (often the first).
-\begin{cquote}
-\begin{tabular}{@{}l|l@{}}
+\newpage
+
+
+\section{Doubly-Linked Intrusive List}
+
+\begin{cquote}
+\setlength{\tabcolsep}{10pt}
+\begin{tabular}{@{}l|l@{}}
+\begin{uC++}
+#include <iostream>
+using namespace std;
+struct Node : @public uSeqable@ {
+	int i;
+	Node( int i ) : i( i ) {}
+};
+
+
+int main() {
+	@uSequence<Node> dlist;@
+	Node n1{ 1 }, n2{ 2 }, n3{ 3 };
+	dlist.addTail( &n1 );
+	dlist.addHead( &n2 );  // out of order
+	dlist.insertAft( &n1, &n3 );  // insertBef
+	for ( Node * it = dlist.head(); it; it = dlist.succ( it ) ) {
+		cout << it->i << endl;
+	}
+	dlist.remove( &n3 );  // shorten list
+	dlist.dropTail();  // dropHead
+	Node * it;
+	for ( uSeqIter<Node> seqit(dlist);  // uSeqIterRev
+			  seqit >> it; ) {
+		cout << it->i << endl;
+	}
+}
+\end{uC++}
+&
+\begin{cfa}
+#include <fstream.hfa>
+#include <list.hfa>
+struct Node {
+	@inline dlink( Node );@
+	int i;
+};
+@P9_EMBEDDED( Node, dlink( Node ) );@  // magic
+void ?{}( Node & node, int i ) { node.i = i; }
+int main() {
+	@dlist( Node ) dlist;@
+	Node n1{ 1 }, n2{ 2 }, n3{ 3 };
+	insert_last( dlist, n1 );
+	insert_first( dlist, n2 );  // out of order
+	insert_after( n1, n3 );  // insert_before
+	for ( Node & it = first( dlist ); &it; &it = &next( it ) ) {
+		sout | it.i;
+	}
+	remove( n3 );  // shorten list
+	remove_last( dlist );  // remove_first
+
+	FOREACH( dlist, it ) {  // FOREACH_REV
+
+		sout | it.i;
+	}
+}
+\end{cfa}
+\end{tabular}
+\end{cquote}
+
+
+\section{RAII Dynamic Allocation}
+
+\begin{cquote}
+\begin{tabular}{@{}l|ll@{}}
 \begin{uC++}
 struct S {
-	int i = 0;  // cheat, implicit default constructor
-	int setter( int j ) { int t = i; i = j; return t; }
-	int getter() { return i; }
-};
-S s;
-@s.@setter( 3 );  // object calls
-int k = @s.@getter();
-\end{uC++}
-&
-\begin{cfa}
-struct S {  int i;  };
-void ?{}( S & s ) { s.i = 0; } // explicit default constructor
-int setter( @S & s,@ int j ) @with( s )@ { int t = i; i = j; return t; }
-int getter( @S & s@ ) @with( s )@ { return i; }
-
-S s;
-setter( @s,@ 3 );  // normal calls
-int k = getter( @s@ );
-\end{cfa}
-\end{tabular}
-\end{cquote}
-Aggregate qualification is reduced or eliminated by opening scopes using the @with@ clause.
-\begin{cfa}
-struct S { int i; int j; double m; };  // field i has same type in structures S and T
-struct T { int i; int k; int m; };
-void foo( S s, T t ) @with( s, t )@ {   // open structure scope s and t in parallel
-	j + k;				$\C[1.6in]{// unambiguous, s.j + t.k}$
-	m = 5.0;			$\C{// unambiguous, s.m = 5.0}$
-	m = 1;				$\C{// unambiguous, t.m = 1}$
-	int a = m;			$\C{// unambiguous, a = t.m}$
-	double b = m;		$\C{// unambiguous, b = s.m}$
-	int c = s.i + t.i;	$\C{// unambiguous with qualification}$
-	(double)m;			$\C{// unambiguous with cast s.m}\CRT$
-}
-\end{cfa}
-\noindent
-In subsequent code examples, the left example is \CC/\uC and the right example is \CFA.
-
-
-\section{Constructor / Destructor}
-
-A constructor/destructor must have its structure type as the first parameter and be a reference.
-\begin{cquote}
-\begin{tabular}{@{}l|l@{}}
-\begin{uC++}
-
-struct S {
-	int i, j;
-	@S@() { i = j = 3; }
-	@S@( int i, int j ) { S::i = i; S::j = j; }
-	@S@( const S & s ) { *this = s; }
-	@~S@() {}
-};
-S s0;
-S s1 = { 1, 2 };
-
-S * s2 = new S{ 1, 2 };
-delete s2;
-s2 = new S{ 1, 2 };
-delete s2;
-S & s3 = *new S{ 1, 2 };
-delete &s3;
-s3 = *new S{ 1, 2 };
-delete &s3;
-\end{uC++}
-&
-\begin{cfa}
-#include <stdlib.hfa> // new (malloc)
-struct S { int i, j; };
-
-void @?{}@( @S & s@ ) { s.i = s.j = 3; } $\C[3in]{// default}$
-void @?{}@( @S & s@, int i, int j ) { s.i = i; s.j = j; } $\C{// initializer}$
-void @?{}@( @S & s@, const S rhs ) { ?{}( s, rhs.i, rhs.j ); } $\C{// copy}$
-void @^?{}@( @S & s@ ) { s.i = 0; s.j = 0; } $\C{// destructor}\CRT$
-
-S s0;
-S s1 = { 1, 2 };
-// bug, cannot use 0/1 (zero_t/one_t) with "new"
-S * s2 = new( 0@n@, 2 ); // suffix n => (natural int)
-delete( s2 );
-s2 = new( 1@n@, 2 );
-delete( s2 );
-S & s3 = *new( 2, 2 );
-delete( &s3 );
-&s3 = &*new( 3, 2 );
-delete( &s3 );
+	...    S() { ... }    ~S() { ... }   // ctor / dtor
+};
+S * s = new S;             delete s;
+S * sa = new S[10];     delete [] sa;
+\end{uC++}
+&
+\begin{cfa}
+#include <stdlib.hfa>
+struct S { ... };
+void ?{}( S & ) { ... }    void ^?{}( S & ) { ... }   // ctor / dtor
+S * s = new();        delete( s );
+S * sa = anew( 10 );    adelete( sa );
 \end{cfa}
 \end{tabular}
@@ -660,6 +767,4 @@
 }
 \end{cfa}
-\\
-\multicolumn{2}{@{}l@{}}{\lstinline{C c;}}
 \end{tabular}
 \end{cquote}
@@ -708,4 +813,5 @@
 
 \begin{cquote}
+\setlength{\tabcolsep}{10pt}
 \begin{tabular}{@{}l|ll@{}}
 \begin{uC++}
@@ -738,6 +844,5 @@
 }
 \end{cfa}
-\end{tabular}
-\begin{tabular}{@{}l|ll@{}}
+\\
 \begin{uC++}
 _Actor Hello { ${\color{red}\LstCommentStyle{// : public uActor}}$
@@ -829,7 +934,7 @@
 
 uOwnerLock m;
-uCondLock s;
+uCondLock c;
 m.acquire();
-if ( ! s.empty() ) s.wait( m );
+if ( ! c.empty() ) c.wait( m );
 else {
 	m.release();
@@ -841,7 +946,7 @@
 #include <locks.hfa>
 owner_lock m;
-cond_lock( owner_lock ) s;  // generic type on mutex lock
+cond_lock( owner_lock ) c;  // generic type on mutex lock
 lock( m );
-if ( ! empty( s ) ) wait( s, m );
+if ( ! empty( c ) ) wait( c, m );
 else {
 	unlock( m );
@@ -852,4 +957,30 @@
 \end{cquote}
 
+\begin{cquote}
+\begin{tabular}{@{}l|ll@{}}
+\begin{uC++}
+
+uSemaphore m, c;
+m.P();
+if ( ! c.empty() ) c.P( m );
+else {
+	m.V();
+}
+\end{uC++}
+&
+\begin{cfa}
+#include <locks.hfa>
+semaphore m, c;
+P( m );
+if ( ! empty( c ) ) P( c, m );
+else {
+	V( m );
+}
+\end{cfa}
+\end{tabular}
+\end{cquote}
+
+
+\enlargethispage{1000pt}
 
 \section{Barrier}
@@ -888,14 +1019,14 @@
 #include <mutex_stmt.hfa>
 struct Barrier {
-	@barrier b;@			// containment
+	@inline barrier;@
 	int total;
 
 };
-void ?{}( Barrier & B, unsigned int group ) with(B) {
-	@?{}( b, group );@		// initialize barrier
+void ?{}( Barrier & b, unsigned int group ) with( b ) {
+	@(b){ group };@		// initialize barrier
 	total = 0;
 }
-unsigned int block( Barrier & B, int subtotal ) with(B) {
-	void @last@() { sout | total; }	// called by Gth arriving thread
+unsigned int block( Barrier & b, int subtotal ) with( b ) {
+	void @last@(...) { sout | total; }	// called by Gth arriving thread
 	@mutex( b )@ {  // use barrier's mutual exclusion
 		total += subtotal;
@@ -909,4 +1040,5 @@
 \end{cquote}
 
+\newpage
 
 \enlargethispage{1000pt}
@@ -916,4 +1048,5 @@
 Internal Scheduling
 \begin{cquote}
+\setlength{\tabcolsep}{5pt}
 \begin{tabular}{@{}l|ll@{}}
 \begin{uC++}
@@ -979,8 +1112,9 @@
 \end{cquote}
 
-\newpage
+\bigskip
 \noindent
 External Scheduling
 \begin{cquote}
+\setlength{\tabcolsep}{5pt}
 \begin{tabular}{@{}l|ll@{}}
 \begin{uC++}
@@ -1039,5 +1173,79 @@
 
 
-\input{uC++toCFA.ind}
+\newpage
+
+\section{Futures (reference counting)}
+
+
+{\lstset{tabsize=3}
+\setlength{\tabcolsep}{5pt}
+\begin{tabular}{@{}l|ll@{}}
+\begin{uC++}
+#include <uFuture.h>
+@Future_ISM@<int> fi;
+@Future_ISM@<double> fd;
+struct Msg { int i, j; }; @Future_ISM@<Msg> fm;
+struct Stop {}; @Future_ISM@<Stop> fs;
+struct Cont {}; @Future_ISM@<Cont> fc;
+
+_Task Worker {
+	void main() {
+
+		for ( ;; ) {
+			_Select( fi ) { cout << fi() << endl; fi.reset(); }
+			and _Select( fd ) { cout << fd() << endl; fd.reset(); }
+			and _Select( fm ) {
+				cout << fm().i << " " << fm().j << endl; fm.reset();
+			} or _Select( fs ) { cout << "stop" << endl; break; }
+			fc.delivery( (Cont){} );	// synchronize
+		}
+	}
+
+};
+int main() {
+	Worker worker;
+	for ( int i = 0; i < 10; i += 1 ) {
+		fi( i );   fd( i + 2.5 );   fm( (Msg){ i, 2 } ); // fulfil
+		fc(); fc.reset();				// synchronize
+	}
+	fs( (Stop){} );
+} // wait for worker to terminate
+\end{uC++}
+&
+\begin{cfa}
+#include <future.hfa>
+@future_rc@(int) fi;
+@future_rc@(double) fd;
+struct Msg { int i, j; }; @future_rc@(Msg) fm;
+struct Stop {}; @future_rc@(Stop) fs;
+struct Cont {}; @future_rc@(Cont) fc;
+ExceptionDecl( Break );
+thread Worker {};
+void main( Worker & ) {
+	try {
+		for () {
+			waituntil( fi ) { sout | fi(); reset( fi ); }
+			and waituntil( fd ) { sout | fd(); reset( fd ); }
+			and waituntil( fm ) { sout | fm().i | fm().j; reset( fm ); }
+			or waituntil( fs ) { sout | "stop";
+				throw ExceptionInst( Break );
+			}
+			fc( (Cont){} );		// synchronize
+		}
+	} catch( Break * ) {}
+}
+int main() {
+	Worker worker;
+	for ( i; 10 ) {
+		fi( i );   fd( i + 2.5 );   fm( (Msg){ i, 2 } ); // fulfil
+		fc(); reset( fc );		// synchronize
+	}
+	fs( (Stop){} );
+} // wait for worker to terminate
+\end{cfa}
+\end{tabular}
+}%
+
+%\input{uC++toCFA.ind}
 
 % \bibliographystyle{plain}
