Index: doc/refrat/refrat.tex
===================================================================
--- doc/refrat/refrat.tex	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ doc/refrat/refrat.tex	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -1,2 +1,18 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% 
+%% 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.
+%% 
+%% refrat.tex -- 
+%% 
+%% Author           : Peter A. Buhr
+%% Created On       : Wed Apr  6 14:52:25 2016
+%% Last Modified By : Peter A. Buhr
+%% Last Modified On : Wed Apr  6 21:57:27 2016
+%% Update Count     : 2
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 % requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended
 
@@ -5,5 +21,4 @@
 
 % Latex packages used in the document.
-
 \usepackage{fullpage,times}
 \usepackage{xspace}
@@ -23,5 +38,5 @@
 % Names used in the document.
 
-\newcommand{\CFA}{C$\forall$\xspace}	% set language symbolic name
+\newcommand{\CFA}{C$\mathbf\forall$\xspace}	% set language symbolic name
 \newcommand{\CFL}{Cforall\xspace}		% set language text name
 \newcommand{\CC}{C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name
@@ -151,7 +166,8 @@
 % CFA based on ANSI C
 \lstdefinelanguage{CFA}[ANSI]{C}%
-{morekeywords={asm,_Alignas,_Alignof,_At,_Atomic,_Bool,catch,catchResume,choose,_Complex,trait,disable,dtype,enable,
-	fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,lvalue,_Noreturn,otype,restrict,_Static_assert,
-	_Thread_local,throw,throwResume,try,},
+{morekeywords={_Alignas,_Alignof,__alignof,__alignof__,asm,__asm,__asm__,_At,_Atomic,__attribute,__attribute__,auto,
+    _Bool,catch,catchResume,choose,_Complex,__complex,__complex__,__const,__const__,disable,dtype,enable,__extension__,
+	fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,__label__,lvalue,_Noreturn,otype,restrict,_Static_assert,
+	_Thread_local,throw,throwResume,trait,try,typeof,__typeof,__typeof__,},
 }%
 
@@ -163,7 +179,10 @@
 xleftmargin=\parindent,
 escapechar=@,
+mathescape=true,
 keepspaces=true,
 showstringspaces=false,
 showlines=true,
+aboveskip=6pt,
+belowskip=4pt,
 }%
 
@@ -171,9 +190,12 @@
 % replace/adjust listings characters that look bad in sanserif
 \lst@CCPutMacro
-\lst@ProcessOther{"2D}{\lst@ttfamily{-{}}{{\ttfamily\upshape -}}} % replace minus
+\lst@ProcessOther{"22}{\lst@ttfamily{"}{\raisebox{0.3ex}{\ttfamily\upshape "}}} % replace double quote
+\lst@ProcessOther{"27}{\lst@ttfamily{'}{\raisebox{0.3ex}{\ttfamily\upshape '\hspace*{-2pt}}}} % replace single quote
+\lst@ProcessOther{"2D}{\lst@ttfamily{-}{\ttfamily\upshape -}} % replace minus
 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than
 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than
 \lst@ProcessOther{"5E}{\raisebox{0.4ex}{$\scriptstyle\land\,$}} % replace circumflex
-\lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
+\lst@ProcessOther{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
+\lst@ProcessOther{"60}{\lst@ttfamily{`}{\raisebox{0.3ex}{\ttfamily\upshape \hspace*{-2pt}`}}} % replace backquote
 \lst@ProcessOther{"7E}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}} % replace tilde
 %\lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde
@@ -3843,17 +3865,17 @@
 ``\lstinline$Safe_pointer$ acts like a pointer to \lstinline$int$''.
 \begin{lstlisting}
-trait ptr_to( type P | pointer( P ), otype T ) {@\impl{ptr_to}@@\use{pointer}@
+trait ptr_to( otype P | pointer( P ), otype T ) {@\impl{ptr_to}@@\use{pointer}@
 	lvalue T *?( P );
 	lvalue T ?[?]( P, long int );
 };
-trait ptr_to_const( type P | pointer( P ), otype T ) {@\impl{ptr_to_const}@
+trait ptr_to_const( otype P | pointer( P ), otype T ) {@\impl{ptr_to_const}@
 	const lvalue T *?( P );
 	const lvalue T ?[?]( P, long int );@\use{pointer}@
 };
-trait ptr_to_volatile( type P | pointer( P ), otype T ) }@\impl{ptr_to_volatile}@
+trait ptr_to_volatile( otype P | pointer( P ), otype T ) }@\impl{ptr_to_volatile}@
 	volatile lvalue T *?( P );
 	volatile lvalue T ?[?]( P, long int );@\use{pointer}@
 };
-trait ptr_to_const_volatile( type P | pointer( P ), otype T ) }@\impl{ptr_to_const_volatile}@
+trait ptr_to_const_volatile( otype P | pointer( P ), otype T ) }@\impl{ptr_to_const_volatile}@
 	const volatile lvalue T *?( P );@\use{pointer}@
 	const volatile lvalue T ?[?]( P, long int );
@@ -3865,18 +3887,18 @@
 ``\lstinline$ptr_to$'' specifications.
 \begin{lstlisting}
-trait m_l_ptr_to( type P | m_l_pointer( P ),@\use{m_l_pointer}@@\impl{m_l_ptr_to}@ otype T | ptr_to( P, T )@\use{ptr_to}@ {
+trait m_l_ptr_to( otype P | m_l_pointer( P ),@\use{m_l_pointer}@@\impl{m_l_ptr_to}@ otype T | ptr_to( P, T )@\use{ptr_to}@ {
 	P ?=?( P *, T * );
 	T * ?=?( T **, P );
 };
-trait m_l_ptr_to_const( type P | m_l_pointer( P ),@\use{m_l_pointer}@@\impl{m_l_ptr_to_const}@ otype T | ptr_to_const( P, T )@\use{ptr_to_const}@) {
+trait m_l_ptr_to_const( otype P | m_l_pointer( P ),@\use{m_l_pointer}@@\impl{m_l_ptr_to_const}@ otype T | ptr_to_const( P, T )@\use{ptr_to_const}@) {
 	P ?=?( P *, const T * );
 	const T * ?=?( const T **, P );
 };
-trait m_l_ptr_to_volatile( type P | m_l_pointer( P ),@\use{m_l_pointer}@@\impl{m_l_ptr_to_volatile}@ otype T | ptr_to_volatile( P, T )) {@\use{ptr_to_volatile}@
+trait m_l_ptr_to_volatile( otype P | m_l_pointer( P ),@\use{m_l_pointer}@@\impl{m_l_ptr_to_volatile}@ otype T | ptr_to_volatile( P, T )) {@\use{ptr_to_volatile}@
 	P ?=?( P *, volatile T * );
 	volatile T * ?=?( volatile T **, P );
 };
-trait m_l_ptr_to_const_volatile( type P | ptr_to_const_volatile( P ),@\use{ptr_to_const_volatile}@@\impl{m_l_ptr_to_const_volatile}@
-		type T | m_l_ptr_to_volatile( P, T ) | m_l_ptr_to_const( P )) {@\use{m_l_ptr_to_const}@@\use{m_l_ptr_to_volatile}@
+trait m_l_ptr_to_const_volatile( otype P | ptr_to_const_volatile( P ),@\use{ptr_to_const_volatile}@@\impl{m_l_ptr_to_const_volatile}@
+		otype T | m_l_ptr_to_volatile( P, T ) | m_l_ptr_to_const( P )) {@\use{m_l_ptr_to_const}@@\use{m_l_ptr_to_volatile}@
 	P ?=?( P *, const volatile T * );
 	const volatile T * ?=?( const volatile T **, P );
Index: doc/user/user.tex
===================================================================
--- doc/user/user.tex	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ doc/user/user.tex	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -1,2 +1,18 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% 
+%% 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.
+%% 
+%% user.tex -- 
+%% 
+%% Author           : Peter A. Buhr
+%% Created On       : Wed Apr  6 14:53:29 2016
+%% Last Modified By : Peter A. Buhr
+%% Last Modified On : Wed Apr  6 17:37:39 2016
+%% Update Count     : 34
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 % requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended
 
@@ -5,5 +21,8 @@
 
 % Latex packages used in the document.
-
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage[latin1]{inputenc}
+\usepackage{upquote}
 \usepackage{fullpage,times}
 \usepackage{xspace}
@@ -24,5 +43,5 @@
 % Names used in the document.
 
-\newcommand{\CFA}{C$\forall$\xspace}	% set language symbolic name
+\newcommand{\CFA}{C$\mathbf\forall$\xspace}	% set language symbolic name
 \newcommand{\CFL}{Cforall\xspace}		% set language text name
 \newcommand{\CC}{C\kern-.1em\hbox{+\kern-.25em+}\xspace} % CC symbolic name
@@ -160,7 +179,9 @@
 % CFA based on ANSI C
 \lstdefinelanguage{CFA}[ANSI]{C}%
-{morekeywords={asm,_Alignas,_Alignof,_At,_Atomic,_Bool,catch,catchResume,choose,_Complex,trait,disable,dtype,enable,
-	fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,lvalue,_Noreturn,otype,restrict,_Static_assert,
-	_Thread_local,throw,throwResume,try,},
+{morekeywords={_Alignas,_Alignof,__alignof,__alignof__,asm,__asm,__asm__,_At,_Atomic,__attribute,__attribute__,auto,
+    _Bool,catch,catchResume,choose,_Complex,__complex,__complex__,__const,__const__,disable,dtype,enable,__extension__,
+	fallthru,finally,forall,ftype,_Generic,_Imaginary,inline,__label__,lvalue,_Noreturn,otype,restrict,_Static_assert,
+	_Thread_local,throw,throwResume,trait,try,typeof,__typeof,__typeof__,},
+  moredelim=**[is][\color{red}]{`}{`},
 }%
 
@@ -176,4 +197,8 @@
 showstringspaces=false,
 showlines=true,
+aboveskip=6pt,
+belowskip=4pt,
+literate={\\`}{\raisebox{0.3ex}{\ttfamily\upshape \hspace*{-2pt}`}}1, % escape \`, otherwise used to highlight in red
+%extendedchars=true,
 }%
 
@@ -181,9 +206,12 @@
 % replace/adjust listings characters that look bad in sanserif
 \lst@CCPutMacro
-\lst@ProcessOther{"2D}{\lst@ttfamily{-{}}{{\ttfamily\upshape -}}} % replace minus
+\lst@ProcessOther{"22}{\lst@ttfamily{"}{\raisebox{0.3ex}{\ttfamily\upshape "}}} % replace double quote
+\lst@ProcessOther{"27}{\lst@ttfamily{'}{\raisebox{0.3ex}{\ttfamily\upshape '\hspace*{-2pt}}}} % replace single quote
+\lst@ProcessOther{"2D}{\lst@ttfamily{-}{\ttfamily\upshape -}} % replace minus
 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than
 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than
 \lst@ProcessOther{"5E}{\raisebox{0.4ex}{$\scriptstyle\land\,$}} % replace circumflex
-\lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
+\lst@ProcessOther{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore
+\lst@ProcessOther{"60}{\lst@ttfamily{`}{\raisebox{0.3ex}{\ttfamily\upshape \hspace*{-2pt}`}}} % replace backquote
 \lst@ProcessOther{"7E}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}} % replace tilde
 %\lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde
@@ -366,9 +394,15 @@
 
 The command \lstinline@cfa@ is used to compile \CFA program(s).
-This command works like the GNU \lstinline@gcc@ command, e.g.:
+This command works like the GNU \lstinline@gcc@\index{gcc} command, e.g.:
 \begin{lstlisting}
 cfa [ gcc-options ] C/@{\CFA}@-files [ assembler/loader-files ]
 \end{lstlisting}
-The following additional option is available:
+By default, \CFA programs having the following \lstinline@gcc@ flags turned on:
+\begin{description}
+\item
+\hspace*{-4pt}\lstinline@-std=gnu99@
+The 1999 C standard plus GNU extensions.
+\end{description}
+The following new \CFA option is available:
 \begin{description}
 \item
@@ -382,5 +416,5 @@
 Numeric constants are extended to allow \Index{underscore}s within constants\index{constant!underscore}, e.g.:
 \begin{lstlisting}
-2_147_483_648;				// decimal constant
+2`_`147`_`483`_`648;				// decimal constant
 56_ul;						// decimal unsigned long constant
 0_377;						// octal constant
@@ -451,5 +485,5 @@
 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}	& \multicolumn{1}{c}{\textbf{C}}	\\
 \begin{lstlisting}
-* int x, y;
+`* int x, y;`
 \end{lstlisting}
 &
@@ -571,5 +605,5 @@
 The point of the new syntax is to allow returning multiple values from a routine~\cite{CLU,Galletly96}, e.g.:
 \begin{lstlisting}
-[ int o1, int o2, char o3 ] f( int i1, char i2, char i3 ) {
+`[ int o1, int o2, char o3 ]` f( int i1, char i2, char i3 ) {
 	@\emph{routine body}@
 }
@@ -639,7 +673,7 @@
 Because the value in the return variable is automatically returned when a \CFA routine terminates, the \lstinline@return@ statement \emph{does not} contain an expression, as in:
 \begin{lstlisting}
-[ int x ] f() {
+`[ int x ]` f() {
 	... x = 0; ... x = y; ...
-	return; // implicitly return x
+	`return;` // implicitly return x
 }
 \end{lstlisting}
@@ -697,5 +731,5 @@
 for example, the following is incorrect:
 \begin{lstlisting}
-* [ int x ] f () fp;		// routine name ``f'' is not allowed
+* [ int x ] f () fp;		// routine name "f" is not allowed
 \end{lstlisting}
 
@@ -864,5 +898,5 @@
 \subsection{Type Nesting}
 
-C allows \Index{type nesting}, but the nested types are hoisted\index{type!hoisting} (refactored) into the enclosing scope.
+\CFA allows \Index{type nesting}, and type qualification of the nested types, where as C hoists\index{type!hoisting} (refactors) nested types into the enclosing scope and has no type qualification.
 \begin{quote2}
 \begin{tabular}{@{}l@{\hspace{30pt}}l|l@{}}
@@ -919,16 +953,14 @@
 
 int fred() {
-	s.t.c = S.R;
-	struct S.T t = { S.R, 1, 2 };
-	enum S.C c;
-	union S.T.U u;
+	s.t.c = `S.`R;	// type qualification
+	struct `S.`T t = { `S.`R, 1, 2 };
+	enum `S.`C c;
+	union `S.T.`U u;
 }
 \end{lstlisting}
 \end{tabular}
 \end{quote2}
-
-\CFA is C \emph{incompatible} on this issue, and provides semantics similar to \CC.
-Nested types are not hoisted and can be referenced using the field selection operator ``\lstinline@.@'', unlike the \CC scope-resolution operator ``\lstinline@::@''.
-Given that nested types in C are equivalent to not using them, i.e., they are essentially useless, it is unlikely there are any realistic usages that break because of this incompatibility.
+In the left example in C, types \lstinline@C@, \lstinline@U@ and \lstinline@T@ are implicitly hoisted outside of type \lstinline@S@ into the containing block scope.
+In the right example in \CFA, the types are not hoisted and accessed using the field-selection operator ``\lstinline@.@'' for type qualification, as does Java, rather than the \CC type-selection operator ``\lstinline@::@''.
 
 
@@ -944,12 +976,33 @@
 \begin{lstlisting}
 const unsigned int size = 10;
-int a[size];
-
-qsort( a, size );		// ascending order using built in ?<?
-{						// descending order by local redefinition
-	int ?<?( int a, int b ) { return a > b; } // nested routine
-	qsort( a, size );
-}
-\end{lstlisting}
+int ia[size];
+...						// assign values to array ia
+qsort( ia, size );		// sort ascending order using builtin ?<?
+{
+	`int ?<?( int x, int y ) { return x > y; }` // nested routine
+	qsort( ia, size );	// sort descending order by local redefinition
+}
+\end{lstlisting}
+
+Nested routines are not first-class, meaning a nested routine cannot be returned if it has references to variables in its enclosing blocks;
+the only exception is references to the external block of the translation unit, as these variables persist for the duration of the program.
+The following program in undefined in \CFA (and \lstinline@gcc@\index{gcc})
+\begin{lstlisting}
+[* [int]( int )] foo() {		// int (*foo())( int )
+	int `i` = 7;
+	int bar( int p ) {
+		`i` += 1;					// dependent on local variable
+		sout | `i` | endl;
+	}
+	return bar;					// undefined because of local dependence
+}
+int main() {
+	* [int](int) fp = foo();	// int (*fp)(int)
+    sout | fp( 3 ) | endl;
+}
+\end{lstlisting}
+because 
+
+Currently, there are no \Index{lambda} expressions, i.e., unnamed routines because routine names are very important to properly select the correct routine.
 
 
@@ -1013,11 +1066,15 @@
 
 \item
-Change: A struct is a scope in C++, not in C
-Rationale: Class scope is crucial to C++, and a struct is a class.
-Effect on original feature: Change to semantics of well-defined feature.
-Difficulty of converting: Semantic transformation.
-How widely used: C programs use struct extremely frequently, but the change is only noticeable when
-struct, enumeration, or enumerator names are referred to outside the struct. The latter is probably
-rare.
+Change: A struct is a scope in C++, not in C \\
+Rationale: Class scope is crucial to C++, and a struct is a class. \\
+Effect on original feature: Change to semantics of well-defined feature. \\
+Difficulty of converting: Semantic transformation. \\
+How widely used: C programs use struct extremely frequently, but the change is only noticeable when struct, enumeration, or enumerator names are referred to outside the struct.
+The latter is probably rare.
+
+\CFA is C \emph{incompatible} on this issue, and provides semantics similar to \CC.
+Nested types are not hoisted and can be referenced using the field selection operator ``\lstinline@.@'', unlike the \CC scope-resolution operator ``\lstinline@::@''.
+Given that nested types in C are equivalent to not using them, i.e., they are essentially useless, it is unlikely there are any realistic usages that break because of this incompatibility.
+
 
 \item
@@ -1185,5 +1242,5 @@
 First the right-hand tuple is flattened and then the values are assigned individually.
 Flattening is also performed on tuple types.
-For example, the type \lstinline@[ int, [ int, int ], int ]@ can be coerced, using flattening, into the type lstinline@[ int, int, int, int ]@.
+For example, the type \lstinline@[ int, [ int, int ], int ]@ can be coerced, using flattening, into the type \lstinline@[ int, int, int, int ]@.
 
 A \newterm{structuring coercion} is the opposite of flattening;
@@ -1352,10 +1409,10 @@
 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}	& \multicolumn{1}{c}{\textbf{C}}	\\
 \begin{lstlisting}
-L1: for ( ... ) {
-	L2: for ( ... ) {
-		L3: for ( ... ) {
-			... break L1; ...
-			... break L2; ...
-			... break L3; // or break
+`L1:` for ( ... ) {
+	`L2:` for ( ... ) {
+		`L3:` for ( ... ) {
+			... break `L1`; ...
+			... break `L2`; ...
+			... break `L3`; // or break
 		}
 	}
@@ -1382,10 +1439,10 @@
 \multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}	& \multicolumn{1}{c}{\textbf{C}}	\\
 \begin{lstlisting}
-L1: for ( ... ) {
-	L2: for ( ... ) {
-		L3: for ( ... ) {
-			... continue L1; ...
-			... continue L2; ...
-			... continue L3; ...
+`L1`: for ( ... ) {
+	`L2`: for ( ... ) {
+		`L3`: for ( ... ) {
+			... continue `L1`; ...
+			... continue `L2`; ...
+			... continue `L3`; ...
 
 		}
@@ -1623,7 +1680,7 @@
 \begin{lstlisting}
 switch ( i ) {
-  case 1, 3, 5:
+  `case 1, 3, 5`:
 	...
-  case 2, 4, 6:
+  `case 2, 4, 6`:
 	...
 }
@@ -1634,5 +1691,5 @@
   case 1: case 3 : case 5:
 	...
-  case 2: case 4 : case 6: /* even values */
+  case 2: case 4 : case 6:
 	...
 }
@@ -1655,7 +1712,7 @@
 \begin{lstlisting}
 switch ( i ) {
-  case 1~5
+  `case 1~5:`
 	...
-  case 10~15
+  `case 10~15:`
 	...
 }
@@ -1672,4 +1729,5 @@
 &
 \begin{lstlisting}
+
 // 1, 2, 3, 4, 5
 
@@ -2168,5 +2226,67 @@
 
 
-\section{Generics }
+\section{Auto Type-Inferencing}
+
+Auto type-inferencing occurs in a declaration where a variable's type is inferred from its initialization expression type.
+\begin{quote2}
+\begin{tabular}{@{}l@{\hspace{30pt}}ll@{}}
+\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CC}}	& \multicolumn{1}{c}{\lstinline@gcc@}\index{gcc} \\
+\begin{lstlisting}
+
+auto j = 3.0 * 4;
+int i;
+auto k = i;
+\end{lstlisting}
+&
+\begin{lstlisting}
+#define expr 3.0 * i
+typeof(expr) j = expr;
+int i;
+typeof(i) k = i;
+\end{lstlisting}
+&
+\begin{lstlisting}
+
+// use type of initialization expression
+
+// use type of primary variable
+\end{lstlisting}
+\end{tabular}
+\end{quote2}
+The two important capabilities are:
+\begin{itemize}
+\item
+preventing having to determine or write out long generic types,
+\item
+ensure secondary variables, related to a primary variable, always have the same type.
+\end{itemize}
+
+In \CFA, \lstinline@typedef@ provides a mechanism to alias long type names with short ones, both globally and locally, but not eliminate the use of the short name.
+\lstinline@gcc@ provides \lstinline@typeof@ to declare a secondary variable from a primary variable.
+\CFA also relies heavily on the specification of the left-hand side of assignment for type inferencing, so in many cases it is crucial to specify the type of the left-hand side to select the correct type of the right-hand expression.
+Only for overloaded routines with the same return type is variable type-inferencing possible.
+Finally, \lstinline@auto@ presents the programming problem of tracking down a type when the type is actually needed.
+For example, given
+\begin{lstlisting}
+auto j = `...`
+\end{lstlisting}
+and the need to write a routine to compute using \lstinline@j@
+\begin{lstlisting}
+void rtn( `...` parm );
+rtn( j );
+\end{lstlisting}
+A programmer must work backwards to determine the type of \lstinline@j@'s initialization expression, reconstructing the possibly long generic type-name.
+In this situation, having the type name or a short alias is very useful.
+
+There is also the conundrum in type inferencing of when to \emph{\Index{brand}} a type.
+That is, when is the type of the variable more important than the type of its initialization expression.
+For example, if a change is made in an initialization expression, it can cause hundreds or thousands of cascading type changes and/or errors.
+At some point, a programmer wants the type of the variable to remain constant and the expression to be in error when it changes.
+
+Given \lstinline@typedef@ and \lstinline@typeof@ in \CFA, and the strong need to use the type of left-hand side in inferencing, auto type-inferencing is not supported at this time.
+Should a significant need arise, this feature can be revisited.
+
+
+\section{Generics}
 
 \CFA supports parametric polymorphism to allow users to define generic functions and types.
@@ -2457,199 +2577,48 @@
 
 
-\section{I/O Library}
-\label{s:IOLibrary}
-
-The goal for \CFA I/O is to make I/O as simple as possible for the general case, while fully supporting polmorphism and user defined types in a consistent way.
-The general case is printing out a sequence of variables separated by whitespace.
-\begin{lstlisting}
-int x = 0, y = 1, z = 2;
-sout | x | y | z | endl;
-
-cout << x << " " << y << " " << z << endl;
-\end{lstlisting}
-The \CC form takes almost twice as many characters.
-
-The logical-or operator is used because it is the lowest priority overloadable operator, other than assignment.
-Therefore, most output expressions do not require parenthesis.
-\begin{lstlisting}
-int x = 0, y = 1, z = 2;
-sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
-
-cout << x * 3 << y + 1 << (z << 2) << (x == y) << (x | y) << (x || y) << (x > z ? 1 : 2) << endl;
-\end{lstlisting}
-
-Finally, the logical-or operator has a link with the Shell pipe-operator for moving data, although data flows in the opposite direction.
-
-\begin{figure}
-\begin{lstlisting}[mathescape=off]
-#include <fstream>
-
-int main() {
-	char c;
-	short int si;
-	unsigned short int usi;
-	int i;
-	unsigned int ui;
-	long int li;
-	unsigned long int uli;
-	long long int lli;
-	unsigned long long int ulli;
-	float f;
-	double d;
-	long double ld;
-	float _Complex fc;
-	double _Complex dc;
-	long double _Complex ldc;
-	char s1[10], s2[10];
-
-	ifstream in;
-	open( &in, "read.data", "r" );
-
-	&in | &c
-		| &si | &usi | &i | &ui | &li | &uli | &lli | &ulli
-		| &f | &d | &ld
-		| &fc | &dc | &ldc
-		| str( s1 ) | str( s2, 10 );
-
-	sout | c | ' ' | endl
-		 | si | usi | i | ui | li | uli | lli | ulli | endl
-		 | f | d | ld | endl
-		 | f | "" | d | "" | ld | endl;
-
-	sepSet( sout, ", $" );
-	sout | fc | dc | ldc | endl
-		 | sepOn | s1 | sepOff | s2 | endl
-		 | s1 | "" | s2 | endl;
-}
-
-$ cat read.data 
-A 1 2 3 4 5 6 7 8 1.1 1.2 1.3 1.1+2.3 1.1-2.3 1.1-2.3 abc xyz
-$ a.out
-A 
-1 2 3 4 5 6 7 8
-1.1 1.2 1.3
-1.11.21.3
-1.1+2.3i, $1.1-2.3i, $1.1-2.3i
-, $abcxyz
-abcxyz
-\end{lstlisting}
-\end{figure}
-
-
-\section{Standard Library}
-\label{s:StandardLibrary}
-
-The goal of the \CFA standard-library is to wrap many of the existing C library-routines that are explicitly polymorphic into implicitly polymorphic versions.
-
-
-\subsection{malloc}
-
-\begin{lstlisting}
-forall( otype T ) T * malloc( void );
-forall( otype T ) T * malloc( char fill );
-forall( otype T ) T * malloc( T * ptr, size_t size );
-forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
-forall( otype T ) T * calloc( size_t size );
-forall( otype T ) T * realloc( T * ptr, size_t size );
-forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
-
-forall( otype T ) T * aligned_alloc( size_t alignment );
-forall( otype T ) T * memalign( size_t alignment );		// deprecated
-forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
-
-forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
-forall( otype T ) T * memset( T * ptr );				// remove when default value available
-\end{lstlisting}
-
-
-\subsection{ato/strto}
-
-\begin{lstlisting}
-int ato( const char * ptr );
-unsigned int ato( const char * ptr );
-long int ato( const char * ptr );
-unsigned long int ato( const char * ptr );
-long long int ato( const char * ptr );
-unsigned long long int ato( const char * ptr );
-float ato( const char * ptr );
-double ato( const char * ptr );
-long double ato( const char * ptr );
-float _Complex ato( const char * ptr );
-double _Complex ato( const char * ptr );
-long double _Complex ato( const char * ptr );
-
-int strto( const char * sptr, char ** eptr, int base );
-unsigned int strto( const char * sptr, char ** eptr, int base );
-long int strto( const char * sptr, char ** eptr, int base );
-unsigned long int strto( const char * sptr, char ** eptr, int base );
-long long int strto( const char * sptr, char ** eptr, int base );
-unsigned long long int strto( const char * sptr, char ** eptr, int base );
-float strto( const char * sptr, char ** eptr );
-double strto( const char * sptr, char ** eptr );
-long double strto( const char * sptr, char ** eptr );
-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 );
-\end{lstlisting}
-
-
-\subsection{bsearch/qsort}
-
-\begin{lstlisting}
-forall( otype T | { int ?<?( T, T ); } )
-T * bsearch( const T key, const T * arr, size_t dimension );
-
-forall( otype T | { int ?<?( T, T ); } )
-void qsort( const T * arr, size_t dimension );
-\end{lstlisting}
-
-
-\subsection{abs}
-
-\begin{lstlisting}
-char abs( char );
-extern "C" {
-int abs( int );		// use default C routine for int
-} // extern
-long int abs( long int );
-long long int abs( long long int );
-float abs( float );
-double abs( double );
-long double abs( long double );
-float _Complex abs( float _Complex );
-double _Complex abs( double _Complex );
-long double _Complex abs( long double _Complex );
-\end{lstlisting}
-
-
-\subsection{random}
-
-\begin{lstlisting}
-void randseed( long int s );
-char random();
-int random();
-unsigned int random();
-long int random();
-unsigned long int random();
-float random();
-double random();
-float _Complex random();
-double _Complex random();
-long double _Complex random();
-\end{lstlisting}
-
-
-\subsection{min/max/swap}
-
-\begin{lstlisting}
-forall( otype T | { int ?<?( T, T ); } )
-T min( const T t1, const T t2 );
-
-forall( otype T | { int ?>?( T, T ); } )
-T max( const T t1, const T t2 );
-
-forall( otype T )
-void swap( T * t1, T * t2 );
-\end{lstlisting}
+\section{Syntactic Anomalies}
+
+The number 0 and 1 are treated specially in \CFA, and can be redefined as variables.
+One syntactic anomaly is when a field in an structure is names 0 or 1:
+\begin{lstlisting}
+struct S {
+	int 0, 1;
+} s;
+\end{lstlisting}
+The problem occurs in accesing these fields using the selection operation ``\lstinline@.@'':
+\begin{lstlisting}
+s.0 = 0;	// ambiguity with floating constant .0
+s.1 = 1;	// ambiguity with floating constant .1
+\end{lstlisting}
+To make this work, a space is required after the field selection:
+\begin{lstlisting}
+`s.@\textvisiblespace@0` = 0;
+`s.@\textvisiblespace@1` = 1;
+\end{lstlisting}
+While this sytact is awkward, it is unlikely many programers will name fields of a structure 0 or 1.
+Like the \CC lexical problem with closing template-syntax, e.g, \lstinline@Foo<Bar<int`>>`@, this issue can be solved with a more powerful lexer/parser.
+
+There are several ambiguous cases with operator identifiers, e.g., \lstinline@int *?*?()@, where the string \lstinline@*?*?@ can be lexed as \lstinline@*@/\lstinline@?*?@ or \lstinline@*?@/\lstinline@*?@.
+Since it is common practise to put a unary operator juxtaposed to an identifier, e.g., \lstinline@*i@, users will be annoyed if they cannot do this with respect to operator identifiers.
+Even with this special hack, there are 5 general cases that cannot be handled.
+The first case is for the function-call identifier \lstinline@?()@:
+\begin{lstlisting}
+int *@\textvisiblespace@?()();	// declaration: space required after '*'
+*@\textvisiblespace@?()();		// expression: space required after '*'
+\end{lstlisting}
+Without the space, the string \lstinline@*?()@ is ambiguous without N character look ahead;
+it requires scanning ahead to determine if there is a \lstinline@'('@, which is the start of an argument/parameter list.
+
+The 4 remaining cases occur in expressions:
+\begin{lstlisting}
+i++@\textvisiblespace@?i:0;		// space required before '?'
+i--@\textvisiblespace@?i:0;		// space required before '?'
+i@\textvisiblespace@?++i:0;		// space required after '?'
+i@\textvisiblespace@?--i:0;		// space required after '?'
+\end{lstlisting}
+In the first two cases, the string \lstinline@i++?@ is ambiguous, where this string can be lexed as \lstinline@i@ / \lstinline@++?@ or \lstinline@i++@ / \lstinline@?@;
+it requires scanning ahead to determine if there is a \lstinline@'('@, which is the start of an argument list.
+In the second two cases, the string \lstinline@?++x@ is ambiguous, where this string can be lexed as \lstinline@?++@ / \lstinline@x@ or \lstinline@?@ / y\lstinline@++x@;
+it requires scanning ahead to determine if there is a \lstinline@'('@, which is the start of an argument list.
 
 
@@ -2676,4 +2645,5 @@
 
 task creates a type with implicit locking, separate stack, and a thread
+
 
 \subsection{Monitors}
@@ -3775,5 +3745,5 @@
 \multicolumn{1}{c|}{\textbf{\CFA/\CC}} & \multicolumn{1}{c|}{\textbf{Go}} & \multicolumn{1}{c}{\textbf{Rust}}	\\
 \hline
-\begin{lstlisting}
+\begin{lstlisting}[boxpos=t]
 extern "C" {
 #include <sys/types.h>
@@ -3782,5 +3752,5 @@
 }
 size_t fileSize( const char *path ) {
-	stat s;
+	struct stat s;
 	stat(path, &s);
 	return s.st_size;
@@ -3788,5 +3758,5 @@
 \end{lstlisting}
 &
-\begin{lstlisting}
+\begin{lstlisting}[boxpos=t]
 /*
 #cgo
@@ -3807,8 +3777,6 @@
 \end{lstlisting}
 &
-\begin{lstlisting}
+\begin{lstlisting}[boxpos=t]
 use libc::{c_int, size_t};
-
-// The following declarations are
 // translated from sys/stat.h
 #[repr(C)]
@@ -3818,5 +3786,4 @@
 	...
 }
-
 #[link(name = "libc")]
 extern {
@@ -3824,11 +3791,10 @@
 	buf: *mut stat_t) -> c_int;
 }
-
 fn fileSize(path: *const u8) -> size_t
 {
 	unsafe {
-	let mut buf: stat_t = uninit();
-	stat(path, &mut buf);
-	buf.st_size
+		let mut buf: stat_t = uninit();
+		stat(path, &mut buf);
+		buf.st_size
 	}
 }
@@ -3953,4 +3919,5 @@
 
 
+\begin{comment}
 \subsubsection{Modules/Packages}
 
@@ -4032,4 +3999,6 @@
 }
 \end{lstlisting}
+\end{comment}
+
 
 \subsubsection{Parallel Tasks}
@@ -4187,4 +4156,7 @@
 \end{flushleft}
 
+\lstset{basicstyle=\sf\relsize{-1}}
+
+
 \subsection{Summary of Language Comparison}
 
@@ -4253,4 +4225,350 @@
 D does not have any built-in concurrency constructs in the
 language, though it does have a standard library for concurrency which includes the low-level primitives for concurrency.
+
+
+\appendix
+
+
+\section{I/O Library}
+\label{s:IOLibrary}
+\index{input/output library}
+
+The goal for \CFA I/O is to make I/O as simple as possible for the general case, while fully supporting polmorphism and user defined types in a consistent way.
+The general case is printing out a sequence of variables separated by whitespace.
+\begin{quote2}
+\begin{tabular}{@{}l@{\hspace{30pt}}l@{}}
+\multicolumn{1}{c@{\hspace{30pt}}}{\textbf{\CFA}}	& \multicolumn{1}{c}{\textbf{\CC}}	\\
+\begin{lstlisting}
+int x = 0, y = 1, z = 2;
+`sout` `|` x `|` y `|` z `| endl`;
+\end{lstlisting}
+&
+\begin{lstlisting}
+
+cout << x << " " << y << " " << z << endl;
+\end{lstlisting}
+\end{tabular}
+\end{quote2}
+The \CFA form is half as many characters, and is similar to Python I/O with respect to implicit separators.
+
+The logical-or operator is used because it is the lowest-priority overloadable operator, other than assignment.
+Therefore, fewer output expressions require parenthesis.
+\begin{quote2}
+\begin{tabular}{@{}ll@{}}
+\textbf{\CFA:}
+&
+\begin{lstlisting}
+sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
+\end{lstlisting}
+\\
+\textbf{\CC:}
+&
+\begin{lstlisting}
+cout << x * 3 << y + 1 << (z << 2) << (x == y) << (x | y) << (x || y) << (x > z ? 1 : 2) << endl;
+\end{lstlisting}
+\end{tabular}
+\end{quote2}
+Finally, the logical-or operator has a link with the Shell pipe-operator for moving data, although data flows in the opposite direction.
+
+The implicit seperator\index{I/O separator} character (space/blank) is a separator not a terminator.
+The rules for implicitly adding the separator are:
+\begin{enumerate}
+\item
+A seperator does not appear at the start or end of a line.
+\begin{lstlisting}[belowskip=0pt]
+sout 1 | 2 | 3 | endl;
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+1 2 3
+\end{lstlisting}
+\item
+A seperator does not appear before or after a character literal or variable.
+\begin{lstlisting}
+sout | '1' | '2' | '3' | endl;
+123
+\end{lstlisting}
+\item
+A seperator does not appear before or after a null (empty) C string
+\begin{lstlisting}
+sout | 1 | "" | 2 | "" | 3 | endl;
+123
+\end{lstlisting}
+which is a local mechanism to disable insertion of the separator character.
+\item
+A seperator does not appear before a C string starting with the \Index{extended ASCII}\index{ASCII} characters: \lstinline[mathescape=off]@([{$£¥¿«@
+%$
+\begin{lstlisting}[mathescape=off]
+sout | "x (" | 1 | "x [" | 2 | "x {" | 3 | "x $" | 4 | "x £" | 5 | "x ¥" | 6 | "x ¿" | 7 | "x «" | 8 | endl;
+\end{lstlisting}
+%$
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+x (1 x [2 x {3 x $4 x £5 x ¥6 x ¿7 x «8
+\end{lstlisting}
+%$
+\item
+A seperator does not appear after a C string ending with the extended ASCII characters: \lstinline@,.:;!?)]}%¢»@
+\begin{lstlisting}[belowskip=0pt]
+sout | 1 | ", x" | 2 | ". x" | 3 | ": x" | 4 | "; x" | 5 | "! x" | 6 | "? x" | 7 | ") x" | 8 | "] x" | 9 | "} x"
+	 | 10 | "% x" | 11 | L"¢ x" | 12 | L"» x" | endl;
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+1, x 2. x 3: x 4; x 5! x 6? x 7) x 8] x 9} x 10% x 11¢ 12»
+\end{lstlisting}
+\item
+A seperator does not appear before or after a C string begining/ending with the characters: \lstinline@\f\n\r\t\v\`'"@
+\begin{lstlisting}[belowskip=0pt]
+sout | "x '" | 1 | "' x \`" | 2 | "\` x \"" | 3 | "\" x" | endl;
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+x '1' x \`2\` x "3" x
+\end{lstlisting}
+\begin{lstlisting}[showtabs=true,aboveskip=0pt]
+sout | "x\t" | 1 | "\tx" | endl;
+x	1	x
+\end{lstlisting}
+\end{enumerate}
+The following \CC-style \Index{manipulator}s allow further control over implicit seperation.
+\begin{lstlisting}[mathescape=off,belowskip=0pt]
+sout | sepOn | 1 | 2 | 3 | sepOn | endl;	// separator at start of line
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+ 1 2 3
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
+sout | 1 | sepOff | 2 | 3 | endl;			// turn off implicit separator temporarily
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+12 3
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
+sout | sepDisable | 1 | 2 | 3 | endl;		// turn off implicit separation, affects all subsequent prints
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+123
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
+sout | 1 | sepOn | 2 | 3 | endl;			// turn on implicit separator temporarily
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+1 23
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,aboveskip=0pt,belowskip=0pt]
+sout | sepEnable | 1 | 2 | 3 | endl;		// turn on implicit separation, affects all subsequent prints
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
+1 2 3
+\end{lstlisting}
+\begin{lstlisting}[mathescape=off,aboveskip=0pt,aboveskip=0pt,belowskip=0pt]
+sepSet( sout, ", $" );						// change separator from " " to ", $"
+sout | 1 | 2 | 3 | endl;
+\end{lstlisting}
+%$
+\begin{lstlisting}[mathescape=off,showspaces=true,aboveskip=0pt]
+1, $2, $3
+\end{lstlisting}
+%$
+\VRef[Figure]{f:ExampleIO} shows an example of input and output I/O in \CFA.
+
+\begin{figure}
+\begin{lstlisting}[mathescape=off]
+#include <fstream>
+
+int main() {
+	char c;														// basic types
+	short int si;
+	unsigned short int usi;
+	int i;
+	unsigned int ui;
+	long int li;
+	unsigned long int uli;
+	long long int lli;
+	unsigned long long int ulli;
+	float f;
+	double d;
+	long double ld;
+	float _Complex fc;
+	double _Complex dc;
+	long double _Complex ldc;
+	char s1[10], s2[10];
+
+	ifstream in;												// create / open file
+	open( &in, "input.data", "r" );
+
+	&in | &c													// character
+		| &si | &usi | &i | &ui | &li | &uli | &lli | &ulli		// integral
+		| &f | &d | &ld											// floating point
+		| &fc | &dc | &ldc										// floating-point complex
+		| cstr( s1 ) | cstr( s2, 10 );							// C string, length unchecked and checked
+
+	sout | c | ' ' | endl										// character
+		 | si | usi | i | ui | li | uli | lli | ulli | endl		// integral
+		 | f | d | ld | endl									// floating point
+		 | fc | dc | ldc | endl;								// complex
+	sout | endl;
+	sout | f | "" | d | "" | ld | endl							// floating point without separator
+		 | sepDisable | fc | dc | ldc | sepEnable | endl		// complex without separator
+		 | sepOn | s1 | sepOff | s2 | endl						// local separator removal
+		 | s1 | "" | s2 | endl;									// C string withou separator
+	sout | endl;
+	sepSet( sout, ", $" );										// change separator, maximum of 15 characters
+	sout | f | d | ld | endl									// floating point without separator
+		 | fc | dc | ldc | endl									// complex without separator
+		 | s1 | s2 | endl;
+}
+
+$ cat input.data 
+A 1 2 3 4 5 6 7 8 1.1 1.2 1.3 1.1+2.3 1.1-2.3 1.1-2.3 abc xyz
+$ a.out
+A 
+1 2 3 4 5 6 7 8
+1.1 1.2 1.3
+1.1+2.3i 1.1-2.3i 1.1-2.3i
+
+1.11.21.3
+1.1+2.3i1.1-2.3i1.1-2.3i
+ abcxyz
+abcxyz
+
+1.1, $1.2, $1.3
+1.1+2.3i, $1.1-2.3i, $1.1-2.3i
+abc, $xyz
+\end{lstlisting}
+\caption{Example I/O}
+\label{f:ExampleIO}
+\end{figure}
+
+
+\section{Standard Library}
+\label{s:StandardLibrary}
+
+The goal of the \CFA standard-library is to wrap many of the existing C library-routines that are explicitly polymorphic into implicitly polymorphic versions.
+
+
+\subsection{malloc}
+
+\begin{lstlisting}
+forall( otype T ) T * malloc( void );
+forall( otype T ) T * malloc( char fill );
+forall( otype T ) T * malloc( T * ptr, size_t size );
+forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
+forall( otype T ) T * calloc( size_t size );
+forall( otype T ) T * realloc( T * ptr, size_t size );
+forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
+
+forall( otype T ) T * aligned_alloc( size_t alignment );
+forall( otype T ) T * memalign( size_t alignment );		// deprecated
+forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
+
+forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
+forall( otype T ) T * memset( T * ptr );				// remove when default value available
+\end{lstlisting}
+
+
+\subsection{ato/strto}
+
+\begin{lstlisting}
+int ato( const char * ptr );
+unsigned int ato( const char * ptr );
+long int ato( const char * ptr );
+unsigned long int ato( const char * ptr );
+long long int ato( const char * ptr );
+unsigned long long int ato( const char * ptr );
+float ato( const char * ptr );
+double ato( const char * ptr );
+long double ato( const char * ptr );
+float _Complex ato( const char * ptr );
+double _Complex ato( const char * ptr );
+long double _Complex ato( const char * ptr );
+
+int strto( const char * sptr, char ** eptr, int base );
+unsigned int strto( const char * sptr, char ** eptr, int base );
+long int strto( const char * sptr, char ** eptr, int base );
+unsigned long int strto( const char * sptr, char ** eptr, int base );
+long long int strto( const char * sptr, char ** eptr, int base );
+unsigned long long int strto( const char * sptr, char ** eptr, int base );
+float strto( const char * sptr, char ** eptr );
+double strto( const char * sptr, char ** eptr );
+long double strto( const char * sptr, char ** eptr );
+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 );
+\end{lstlisting}
+
+
+\subsection{bsearch/qsort}
+
+\begin{lstlisting}
+forall( otype T | { int ?<?( T, T ); } )
+T * bsearch( const T key, const T * arr, size_t dimension );
+
+forall( otype T | { int ?<?( T, T ); } )
+void qsort( const T * arr, size_t dimension );
+\end{lstlisting}
+
+
+\subsection{abs}
+
+\begin{lstlisting}
+char abs( char );
+extern "C" {
+int abs( int );				// use default C routine for int
+} // extern "C"
+long int abs( long int );
+long long int abs( long long int );
+float abs( float );
+double abs( double );
+long double abs( long double );
+float _Complex abs( float _Complex );
+double _Complex abs( double _Complex );
+long double _Complex abs( long double _Complex );
+\end{lstlisting}
+
+
+\subsection{floor/ceil}
+
+\begin{lstlisting}
+float floor( float );
+extern "C" {
+double floor( double );		// use C routine for double
+} // extern "C"
+long double floor( long double );
+
+float ceil( float );
+extern "C" {
+double ceil( double );		// use C routine for double
+} // extern "C"
+long double ceil( long double );
+\end{lstlisting}
+
+
+\subsection{random}
+
+\begin{lstlisting}
+void rand48seed( long int s );
+char rand48();
+int rand48();
+unsigned int rand48();
+long int rand48();
+unsigned long int rand48();
+float rand48();
+double rand48();
+float _Complex rand48();
+double _Complex rand48();
+long double _Complex rand48();
+\end{lstlisting}
+
+
+\subsection{min/max/swap}
+
+\begin{lstlisting}
+forall( otype T | { int ?<?( T, T ); } )
+T min( const T t1, const T t2 );
+
+forall( otype T | { int ?>?( T, T ); } )
+T max( const T t1, const T t2 );
+
+forall( otype T )
+void swap( T * t1, T * t2 );
+\end{lstlisting}
 
 
Index: src/driver/cfa.cc
===================================================================
--- src/driver/cfa.cc	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/driver/cfa.cc	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Tue Aug 20 13:44:49 2002
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jan 28 18:24:06 2016
-// Update Count     : 127
+// Last Modified On : Wed Apr  6 14:04:22 2016
+// Update Count     : 132
 //
 
@@ -165,5 +165,5 @@
 				nargs += 1;
 			} else if ( prefix( arg, "-std=" ) ) {
-				std_flag = true;						// std=XX provided
+				std_flag = true;						// -std=XX provided
 				args[nargs] = argv[i];					// pass the argument along
 				nargs += 1;
@@ -307,5 +307,5 @@
 		nargs += 1;
 		if ( ! std_flag ) {								// default c99, if none specified
-			args[nargs] = "-std=c99";
+			args[nargs] = "-std=gnu99";
 			nargs += 1;
 		} // if
Index: src/examples/io.c
===================================================================
--- src/examples/io.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/examples/io.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,66 @@
+//                               -*- Mode: C -*- 
+// 
+// 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.
+// 
+// io.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Mar  2 16:56:02 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 14:58:27 2016
+// Update Count     : 15
+// 
+
+#include <fstream>
+
+int main() {
+	char c;														// basic types
+	short int si;
+	unsigned short int usi;
+	int i;
+	unsigned int ui;
+	long int li;
+	unsigned long int uli;
+	long long int lli;
+	unsigned long long int ulli;
+	float f;
+	double d;
+	long double ld;
+	float _Complex fc;
+	double _Complex dc;
+	long double _Complex ldc;
+	char s1[10], s2[10];
+
+	ifstream in;												// create / open file
+	open( &in, "input.data", "r" );
+
+	&in | &c													// character
+		| &si | &usi | &i | &ui | &li | &uli | &lli | &ulli		// integral
+		| &f | &d | &ld											// floating point
+		| &fc | &dc | &ldc										// floating-point complex
+		| cstr( s1 ) | cstr( s2, 10 );							// C string, length unchecked and checked
+
+	sout | c | ' ' | endl										// character
+		 | si | usi | i | ui | li | uli | lli | ulli | endl		// integral
+		 | f | d | ld | endl									// floating point
+		 | fc | dc | ldc | endl;								// complex
+	sout | endl;
+	sout | f | "" | d | "" | ld | endl							// floating point without separator
+		 | sepDisable | fc | dc | ldc | sepEnable | endl		// complex without separator
+		 | sepOn | s1 | sepOff | s2 | endl						// local separator removal
+		 | s1 | "" | s2 | endl;									// C string withou separator
+	sout | endl;
+
+	sepSet( sout, ", $" );										// change separator, maximum of 15 characters
+	sout | f | d | ld | endl									// floating point without separator
+		 | fc | dc | ldc | endl									// complex without separator
+		 | s1 | s2 | endl;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa io.c" //
+// End: //
Index: src/examples/io.data
===================================================================
--- src/examples/io.data	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/examples/io.data	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,1 @@
+A 1 2 3 4 5 6 7 8 1.1 1.2 1.3 1.1+2.3 1.1-2.3 1.1-2.3 abc xyz
Index: src/examples/rational.c
===================================================================
--- src/examples/rational.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/examples/rational.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,92 @@
+//                               -*- Mode: C -*- 
+// 
+// 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.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Mon Mar 28 08:43:12 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 18:02:02 2016
+// Update Count     : 19
+// 
+
+#include <limits>
+#include <rational>
+
+int main() {
+	Rational a, b, c;
+	sout | "constructor" | endl;
+	a = rational( 3 );
+	b = rational( 4 );
+	c = rational();
+	sout | a | b | c | endl;
+	a = rational( 4, 8 );
+	b = rational( 5, 7 );
+	sout | a | b | endl;
+	a = rational( -2, -3 );
+	b = rational( 3, -2 );
+	sout | a | b | endl;
+	a = rational( -2, 3 );
+	b = rational( 3, 2 );
+	sout | a | b | endl;
+
+	sout | "logical" | endl;
+	a = rational( -2 );
+	b = rational( -3, 2 );
+	sout | a | b | endl;
+	sout | a == 1 | endl;
+	sout | a != b | endl;
+	sout | a <  b | endl;
+	sout | a <= b | endl;
+	sout | a >  b | endl;
+	sout | a >= b | endl;
+
+	sout | "arithmetic" | endl;
+	sout | a | b | endl;
+	sout | a + b | endl;
+	sout | a - b | endl;
+	sout | a * b | endl;
+	sout | a / b | endl;
+
+	sout | "conversion" | endl;
+	a = rational( 3, 4 );
+	sout | widen( a ) | endl;
+	a = rational( 1, 7 );
+	sout | widen( a ) | endl;
+	a = rational( 355, 113 );
+	sout | widen( a ) | endl;
+	sout | narrow( 0.75, 4 ) | endl;
+	sout | narrow( 0.14285714285714, 16 ) | endl;
+	sout | narrow( 3.14159265358979, 256 ) | endl;
+
+	Rational x, y;
+	x = rational( 1, 2 );
+	y = rational( 2 );
+	sout | x - y | endl;
+	sout | x > y | endl;
+	sout | x | numerator( x, 2 ) | x | endl;
+	sout | y | denominator( y, -2 ) | y | endl;
+
+	Rational z;
+	z = rational( 0, 5 );
+	sout | z | endl;
+
+	sout | x | numerator( x, 0 ) | x | endl;
+
+	x = rational( 1, MAX ) + rational( 1, MAX );
+	sout | x | endl;
+	x = rational( 3, MAX ) + rational( 2, MAX );
+	sout | x | endl;
+
+	sin | &a | &b;
+	sout | a | b | endl;
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa rational.c" //
+// End: //
Index: src/examples/rational.cc
===================================================================
--- src/examples/rational.cc	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/examples/rational.cc	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,198 @@
+#include "rationalnumber.h"
+
+#include <iostream>
+#include <cstdlib>					// exit
+using namespace std;
+
+static struct {
+    int gcd, con, copy, des, assn, rel, add, sub, mul, div, in, out;
+} stats;						// implicitly initialized to 0
+
+static int gcd( int a, int b ) {
+    for ( ;; ) {
+	int r = a % b;
+      if ( r == 0 ) break;
+	a = b;
+	b = r;
+    } // for
+    stats.gcd += 1;
+    return b;
+} // gcd
+
+void Rationalnumber::statistics() {
+    cerr
+	<< "gcd:"  << stats.gcd  << '\t'
+	<< "con:"  << stats.con  << '\t'
+	<< "copy:" << stats.copy << '\t'
+	<< "des:"  << stats.des  << '\t'
+	<< "assn:" << stats.assn << '\t'
+	<< "rel:"  << stats.rel  << '\t'
+	<< "add:"  << stats.add  << '\t'
+	<< "sub:"  << stats.sub  << '\t'
+	<< "mul:"  << stats.mul  << '\t'
+	<< "div:"  << stats.div  << '\t'
+	<< "in:"   << stats.in   << '\t'
+	<< "out:"  << stats.out
+	<< endl;
+} // Rationalnumber::statistics
+
+bool Rationalnumber::eq( Rationalnumber &r ) {
+    return num * r.denom == denom * r.num;
+} // Rationalnumber::Rationalnumber::eq
+
+bool Rationalnumber::lt( Rationalnumber &r ) {
+    //int temp1 = denom * r.denom, temp2 = num * r.denom, temp3 = denom * r.num;
+    //return temp1 > 0 && temp2 < temp3 || temp1 < 0 && temp2 > temp3;
+    // if denominator is always > 0, only this check is necessary
+    return num * r.denom < denom * r.num;
+} // Rationalnumber::Rationalnumber::lt
+
+void Rationalnumber::common1( int n, int d ) {
+    num = n;
+    denom = d;
+    stats.con += 1;
+} // Rationalnumber::common1
+
+int Rationalnumber::common2( int &n, int &d ) {
+    if ( d == 0 ) {
+	cerr << "Invalid rational number construction: denominator cannot be equal to 0." << endl;
+	exit( EXIT_FAILURE );
+    } // exit
+    if ( d < 0 ) { d = -d; n = -n; }			// move sign to numerator
+    return gcd( abs( n ), d );				// simplify
+} // Rationalnumber::common2
+
+Rationalnumber::Rationalnumber() {
+    common1( 0, 1 );
+} // Rationalnumber::Rationalnumber
+
+Rationalnumber::Rationalnumber( int n ) {
+    common1( n, 1 );
+} // Rationalnumber::Rationalnumber
+
+Rationalnumber::Rationalnumber( int n, int d ) {
+    int temp = common2( n, d );
+    common1( n / temp, d / temp );
+} // Rationalnumber::Rationalnumber
+
+Rationalnumber::Rationalnumber( const Rationalnumber &c ) {
+    num = c.num;
+    denom = c.denom;
+    stats.copy += 1;
+} // Rationalnumber::Rationalnumber
+
+Rationalnumber::~Rationalnumber() {
+    stats.des += 1;
+} // Rationalnumber::~Rationalnumber
+
+Rationalnumber &Rationalnumber::operator=( const Rationalnumber &r ) {
+    num = r.num;
+    denom = r.denom;
+    stats.assn += 1;
+    return *this;
+} // Rationalnumber::operator=
+
+int Rationalnumber::numerator() const {
+    return num;
+} // Rationalnumber::numerator
+
+int Rationalnumber::numerator( int n ) {
+    int prev = num;
+    int temp = gcd( abs( n ), denom );			// simplify
+    num = n / temp;
+    denom = denom / temp;
+    return prev;
+} // Rationalnumber::numerator
+		   
+int Rationalnumber::denominator() const {
+    return denom;
+} // Rationalnumber::denominator
+
+int Rationalnumber::denominator( int d ) {
+    int prev = denom;
+    int temp = common2( num, d );
+    num = num / temp;
+    denom = d / temp;
+    return prev;
+} // Rationalnumber::denominator
+
+bool operator==( Rationalnumber l, Rationalnumber r ) {
+    stats.rel += 1;
+    return l.eq( r );
+} // operator==
+
+bool operator!=( Rationalnumber l, Rationalnumber r ) {
+    stats.rel += 1;
+    return ! ( l.eq( r ) );
+} // operator!=
+
+bool operator<( Rationalnumber l, Rationalnumber r ) {
+    stats.rel += 1;
+    return l.lt( r );
+} // operator<
+
+bool operator<=( Rationalnumber l, Rationalnumber r ) {
+    stats.rel += 1;
+    return l.lt( r ) || l.eq( r );
+} // operator<=
+
+bool operator>( Rationalnumber l, Rationalnumber r ) {
+    stats.rel += 1;
+    return ! ( l.lt( r ) || l.eq( r ) );
+} // operator>
+
+bool operator>=( Rationalnumber l, Rationalnumber r ) {
+    stats.rel += 1;
+    return ! ( l.lt( r ) );
+} // operator>=
+
+Rationalnumber Rationalnumber::operator-() {
+    return Rationalnumber( -num, denom );
+} // Rationalnumber::operator-
+
+Rationalnumber operator+( Rationalnumber l, Rationalnumber r ) {
+    stats.add += 1;
+    if ( l.denom == r.denom ) {				// special case
+	return Rationalnumber( l.num + r.num, l.denom );
+    } else {
+	return Rationalnumber( l.num * r.denom + l.denom * r.num, l.denom * r.denom );
+    } // if
+} // operator+
+
+Rationalnumber operator-( Rationalnumber l, Rationalnumber r ) {
+    stats.sub += 1;
+    if ( l.denom == r.denom ) {				// special case
+	return Rationalnumber( l.num - r.num, l.denom );
+    } else {
+	return Rationalnumber( l.num * r.denom - l.denom * r.num, l.denom * r.denom );
+    } // if
+} // operator-
+
+Rationalnumber operator*( Rationalnumber l, Rationalnumber r ) {
+    stats.mul += 1;
+    return Rationalnumber( l.num * r.num, l.denom * r.denom );
+} // operator*
+
+Rationalnumber operator/( Rationalnumber l, Rationalnumber r ) {
+    stats.div += 1;
+    if ( r.num < 0 ) { r.num = -r.num; r.denom = -r.denom; }
+    return Rationalnumber( l.num * r.denom, l.denom * r.num );
+} // operator/
+
+istream &operator>>( istream &is, Rationalnumber &r ) {
+    stats.in += 1;
+    is >> r.num >> r.denom;
+    int temp = Rationalnumber::common2( r.num, r.denom );
+    r.num /= temp;
+    r.denom /= temp;
+    return is;
+} // operator>>
+
+ostream &operator<<( ostream &os, Rationalnumber r ) {
+    stats.out += 1;
+    return os << r.num << "/" << r.denom;
+} // operator<<
+
+// Local Variables: //
+// compile-command: "make rationalnumber" //
+// End: //
Index: c/examples/read.c
===================================================================
--- src/examples/read.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ 	(revision )
@@ -1,60 +1,0 @@
-//                               -*- Mode: C -*- 
-// 
-// 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.
-// 
-// read.c -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Wed Mar  2 16:56:02 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar  2 16:56:44 2016
-// Update Count     : 2
-// 
-
-#include <fstream>
-
-int main() {
-    char c;
-    short int si;
-    unsigned short int usi;
-    int i;
-    unsigned int ui;
-    long int li;
-    unsigned long int uli;
-    long long int lli;
-    unsigned long long int ulli;
-    float f;
-    double d;
-    long double ld;
-    float _Complex fc;
-    double _Complex dc;
-    long double _Complex ldc;
-    char s1[10], s2[10];
-
-    ifstream in;
-    open( &in, "read.data", "r" );
-
-    &in | &c
-	| &si | &usi | &i | &ui | &li | &uli | &lli | &ulli
-	| &f | &d | &ld
-	| &fc | &dc | &ldc
-	| str( s1 ) | str( s2, 10 );
-
-    sout | c | ' ' | endl
-	 | si | usi | i | ui | li | uli | lli | ulli | endl
-	 | f | d | ld | endl
-	 | f | "" | d | "" | ld | endl;
-
-    sepSet( sout, ", $" );
-    sout | fc | dc | ldc | endl
-	 | sepOn | s1 | sepOff | s2 | endl
-	 | s1 | "" | s2 | endl;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa read.c" //
-// End: //
Index: c/examples/read.data
===================================================================
--- src/examples/read.data	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ 	(revision )
@@ -1,1 +1,0 @@
-A 1 2 3 4 5 6 7 8 1.1 1.2 1.3 1.1+2.3 1.1-2.3 1.1-2.3 abc xyz
Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/Makefile.am	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -11,6 +11,6 @@
 ## Created On       : Sun May 31 08:54:01 2015
 ## Last Modified By : Peter A. Buhr
-## Last Modified On : Wed Mar  2 22:59:23 2016
-## Update Count     : 119
+## Last Modified On : Wed Apr  6 21:10:44 2016
+## Update Count     : 123
 ###############################################################################
 
@@ -60,9 +60,9 @@
 	${CC} ${CFLAGS} -c -o $@ $<
 
-libs = stdlib iostream fstream iterator
+libs = limits stdlib iostream fstream iterator rational
 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
 
-cheaders = #  expat
-cfaheaders = limits
+cheaders = # expat
+cfaheaders = # limits
 include_HEADERS = ${cheaders:=.h} ${libs} ${cfaheaders}
 
Index: src/libcfa/Makefile.in
===================================================================
--- src/libcfa/Makefile.in	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/Makefile.in	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -83,6 +83,6 @@
 libcfa_a_AR = $(AR) $(ARFLAGS)
 libcfa_a_LIBADD =
-am__objects_1 = stdlib.$(OBJEXT) iostream.$(OBJEXT) fstream.$(OBJEXT) \
-	iterator.$(OBJEXT)
+am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) iostream.$(OBJEXT) \
+	fstream.$(OBJEXT) iterator.$(OBJEXT) rational.$(OBJEXT)
 am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1)
 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
@@ -213,8 +213,8 @@
 MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} \
 	${addprefix ${libdir}/,${lib_LIBRARIES}} ${includedir}/*
-libs = stdlib iostream fstream iterator
+libs = limits stdlib iostream fstream iterator rational
 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
-cheaders = #  expat
-cfaheaders = limits
+cheaders = # expat
+cfaheaders = # limits
 include_HEADERS = ${cheaders:=.h} ${libs} ${cfaheaders}
 all: all-am
@@ -297,4 +297,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa-prelude.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rational.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@
 
Index: src/libcfa/fstream
===================================================================
--- src/libcfa/fstream	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/fstream	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar  2 15:08:14 2016
-// Update Count     : 78
+// Last Modified On : Tue Apr  5 22:37:12 2016
+// Update Count     : 82
 //
 
@@ -20,13 +20,20 @@
 
 enum { separateSize = 16 };
-struct ofstream { void *file; int separate; char separator[separateSize]; };
+struct ofstream {
+	void *file;
+	_Bool sepDefault;
+	_Bool sepOnOff;
+	char separator[separateSize];
+}; // ofstream
 
 _Bool sepPrt( ofstream * );
 void sepOn( ofstream * );
 void sepOff( ofstream * );
+void sepReset( ofstream * );
+void sepReset( ofstream *, _Bool );
 void sepSet( ofstream *, const char * );
 const char * sepGet( ofstream * );
-void sepDisable( ofstream * );
-void sepEnable( ofstream * );
+_Bool sepDisable( ofstream * );
+_Bool sepEnable( ofstream * );
 int fail( ofstream * );
 int flush( ofstream * );
@@ -39,5 +46,7 @@
 
 // implement context istream
-struct ifstream { void *file; };
+struct ifstream {
+	void *file;
+}; // ifstream
 
 int fail( ifstream * is );
Index: src/libcfa/fstream.c
===================================================================
--- src/libcfa/fstream.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/fstream.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Feb 29 18:41:10 2016
-// Update Count     : 162
+// Last Modified On : Wed Apr  6 17:55:27 2016
+// Update Count     : 176
 //
 
@@ -25,9 +25,11 @@
 }
 
-#define IO_MSG "I/O error "
+#define IO_MSG "I/O error: "
 
-_Bool sepPrt( ofstream * os ) { return os->separate == 1; }
-void sepOn( ofstream * os ) { if ( os->separate != 2 ) os->separate = 1; }
-void sepOff( ofstream * os ) { if ( os->separate != 2 ) os->separate = 0; }
+_Bool sepPrt( ofstream * os ) { return os->sepOnOff; }
+void sepOn( ofstream * os ) { os->sepOnOff = 1; }
+void sepOff( ofstream * os ) { os->sepOnOff = 0; }
+void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
+void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
 void sepSet( ofstream * os, const char * s ) {
 	strncpy( &(os->separator[0]), s, separateSize - 1 );
@@ -35,6 +37,16 @@
 } // sepSet
 const char * sepGet( ofstream * os ) { return &(os->separator[0]); }
-void sepDisable( ofstream *os ) { os->separate = 2; }
-void sepEnable( ofstream *os ) { os->separate = 0; }
+_Bool sepDisable( ofstream *os ) {
+	_Bool temp = os->sepDefault;
+	os->sepDefault = 0;
+	sepReset( os );
+	return temp;
+} // sepDisable
+_Bool sepEnable( ofstream *os ) {
+	_Bool temp = os->sepDefault;
+	os->sepDefault = 1;
+	sepReset( os );
+	return temp;
+} // sepEnable
 
 int fail( ofstream * os ) {
@@ -49,5 +61,6 @@
 	FILE *file = fopen( name, mode );
 	if ( file == 0 ) {									// do not change unless successful
-		perror( IO_MSG "open output" );
+		fprintf( stderr, IO_MSG "open output file \"%s\", ", name );
+		perror( 0 );
 		exit( EXIT_FAILURE );
 	} // if
@@ -94,7 +107,7 @@
 
 
-static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 0, { ' ', '\0' } };
+static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, { ' ', '\0' } };
 ofstream *sout = &soutFile;
-static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 0, { ' ', '\0' } };
+static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, { ' ', '\0' } };
 ofstream *serr = &serrFile;
 
@@ -114,5 +127,6 @@
 	FILE *t = fopen( name, mode );
 	if ( t == 0 ) {										// do not change unless successful
-		perror( IO_MSG "open input" );
+		fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
+		perror( 0 );
 		exit( EXIT_FAILURE );
 	} // if
@@ -175,4 +189,3 @@
 // Local Variables: //
 // tab-width: 4 //
-// compile-command: "cfa fstream.c" //
 // End: //
Index: src/libcfa/iostream
===================================================================
--- src/libcfa/iostream	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/iostream	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar  2 18:05:27 2016
-// Update Count     : 85
+// Last Modified On : Tue Apr  5 22:32:37 2016
+// Update Count     : 90
 //
 
@@ -23,8 +23,10 @@
 	void sepOn( ostype * );
 	void sepOff( ostype * );
+	void sepReset( ostype * );
+	void sepReset( ostype *, _Bool );
 	void sepSet( ostype *, const char * );
 	const char * sepGet( ostype * );
-	void sepDisable( ostype * );
-	void sepEnable( ostype * );
+	_Bool sepDisable( ostype * );
+	_Bool sepEnable( ostype * );
 	int fail( ostype * );
 	int flush( ostype * );
@@ -67,4 +69,6 @@
 forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
 forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * );
+forall( dtype ostype | ostream( ostype ) ) ostype * sepDisable( ostype * );
+forall( dtype ostype | ostream( ostype ) ) ostype * sepEnable( ostype * );
 
 // writes the range [begin, end) to the given stream
@@ -110,11 +114,11 @@
 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long double _Complex * );
 
-struct _Istream_str1 { char * s; };
-_Istream_str1 str( char * );
-forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str1 );
+struct _Istream_cstrUC { char * s; };
+_Istream_cstrUC cstr( char * );
+forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrUC );
 
-struct _Istream_str2 { char * s; int size; };
-_Istream_str2 str( char *, int size );
-forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str2 );
+struct _Istream_cstrC { char * s; int size; };
+_Istream_cstrC cstr( char *, int size );
+forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrC );
 
 #endif // __IOSTREAM_H__
Index: src/libcfa/iostream.c
===================================================================
--- src/libcfa/iostream.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/iostream.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Mar  7 13:51:23 2016
-// Update Count     : 227
+// Last Modified On : Wed Apr  6 16:13:29 2016
+// Update Count     : 278
 //
 
@@ -27,4 +27,5 @@
 ostype * ?|?( ostype *os, char c ) {
 	prtfmt( os, "%c", c );
+	sepOff( os );
 	return os;
 } // ?|?
@@ -32,5 +33,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, short int si ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%hd", si );
 	return os;
@@ -39,5 +41,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned short int usi ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%hu", usi );
 	return os;
@@ -46,5 +49,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, int i ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%d", i );
 	return os;
@@ -53,5 +57,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned int ui ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%u", ui );
 	return os;
@@ -60,5 +65,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, long int li ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%ld", li );
 	return os;
@@ -67,5 +73,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned long int uli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%lu", uli );
 	return os;
@@ -74,5 +81,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, long long int lli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%lld", lli );
 	return os;
@@ -81,5 +89,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned long long int ulli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%llu", ulli );
 	return os;
@@ -88,5 +97,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, float f ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%g", f );
 	return os;
@@ -95,5 +105,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, double d ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%.*lg", DBL_DIG, d );
 	return os;
@@ -102,5 +113,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, long double ld ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%.*Lg", LDBL_DIG, ld );
 	return os;
@@ -110,6 +122,8 @@
 ostype * ?|?( ostype *os, float _Complex fc ) {
 	os | crealf( fc );
-	if ( cimagf( fc ) >= 0 ) os | '+';
-	os | "" | cimagf( fc ) | 'i';
+	_Bool temp = sepDisable( os );						// disable separators within complex value
+	if ( cimagf( fc ) >= 0 ) os | '+';					// negative value prints '-'
+	os | cimagf( fc ) | 'i';
+	sepReset( os, temp );								// reset separator
 	return os;
 } // ?|?
@@ -118,6 +132,8 @@
 ostype * ?|?( ostype *os, double _Complex dc ) {
 	os | creal( dc );
-	if ( cimag( dc ) >= 0 ) os | '+';
-	os | "" | cimag( dc ) | 'i';
+	_Bool temp = sepDisable( os );						// disable separators within complex value
+	if ( cimag( dc ) >= 0 ) os | '+';					// negative value prints '-'
+	os | cimag( dc ) | 'i';
+	sepReset( os, temp );								// reset separator
 	return os;
 } // ?|?
@@ -126,6 +142,8 @@
 ostype * ?|?( ostype *os, long double _Complex ldc ) {
 	os | creall( ldc );
-	if ( cimagl( ldc ) >= 0 ) os | '+';
-	os | "" | cimagl( ldc ) | 'i';
+	_Bool temp = sepDisable( os );						// disable separators within complex value
+	if ( cimagl( ldc ) >= 0 ) os | '+';					// negative value prints '-'
+	os | cimagl( ldc ) | 'i';
+	sepReset( os, temp );								// reset separator
 	return os;
 } // ?|?
@@ -134,14 +152,15 @@
 ostype * ?|?( ostype *os, const char *cp ) {
 	enum { Open = 1, Close, OpenClose };
-	static const char mask[256] = {
+	static const unsigned char mask[256] = {
 		// opening delimiters
 		['('] : Open, ['['] : Open, ['{'] : Open,
-		['$'] : Open, [L'£'] : Open, [L'¥'] : Open, [L'¢'] : Open, [L'¿'] : Open, [L'«'] : Open,
+		['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
 		// closing delimiters
 		[','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
 		[')'] : Close, [']'] : Close, ['}'] : Close,
-		['%'] : Close, [L'»'] : Close,
+		['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
 		// opening-closing delimiters
 		['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
+		['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
 	}; // mask
 
@@ -149,11 +168,13 @@
 	// null string => no separator
   if ( len == 0 ) { sepOff( os ); return os; }
-	// first character NOT spacing or closing punctuation => add left separator
-	if ( sepPrt( os ) && isspace( cp[0] ) == 0 && mask[ cp[0] ] != Close && mask[ cp[0] ] != OpenClose ) {
+	// first character IS NOT spacing or closing punctuation => add left separator
+	unsigned char ch = cp[0];							// must make unsigned
+	if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
 		prtfmt( os, "%s", sepGet( os ) );
 	} // if
 	// last character IS spacing or opening punctuation => turn off separator for next item
 	unsigned int posn = len - 1;
-	if ( isspace( cp[posn] ) || mask[ cp[posn] ] == Open || mask[ cp[posn] ] == OpenClose ) {
+	ch = cp[posn];										// must make unsigned
+	if ( mask[ ch ] == Open || mask[ ch ] == OpenClose ) {
 		sepOff( os );
 	} else {
@@ -165,5 +186,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, const void *p ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%p", p );
 	return os;
@@ -196,4 +218,16 @@
 } // sepOff
 
+forall( dtype ostype | ostream( ostype ) ) 
+ostype * sepEnable( ostype * os ) {
+	sepEnable( os );
+	return os;
+} // sepEnable
+
+forall( dtype ostype | ostream( ostype ) ) 
+ostype * sepDisable( ostype * os ) {
+	sepDisable( os );
+	return os;
+} // sepDisable
+
 //---------------------------------------
 
@@ -310,19 +344,19 @@
 } // ?|?
 
-_Istream_str1 str( char * s ) { _Istream_str1 s = { s }; return s; }
-forall( dtype istype | istream( istype ) )
-istype * ?|?( istype * is, _Istream_str1 str ) {
-	scanfmt( is, "%s", str.s );
-	return is;
-} // str
-
-_Istream_str2 str( char * s, int size ) { _Istream_str2 s = { s, size }; return s; }
-forall( dtype istype | istream( istype ) )
-istype * ?|?( istype * is, _Istream_str2 str ) {
+_Istream_cstrUC cstr( char * s ) { _Istream_cstrUC s = { s }; return s; }
+forall( dtype istype | istream( istype ) )
+istype * ?|?( istype * is, _Istream_cstrUC cstr ) {
+	scanfmt( is, "%s", cstr.s );
+	return is;
+} // cstr
+
+_Istream_cstrC cstr( char * s, int size ) { _Istream_cstrC s = { s, size }; return s; }
+forall( dtype istype | istream( istype ) )
+istype * ?|?( istype * is, _Istream_cstrC cstr ) {
 	char buf[16];
-	sprintf( buf, "%%%ds", str.size );
-	scanfmt( is, buf, str.s );
-	return is;
-} // str
+	sprintf( buf, "%%%ds", cstr.size );
+	scanfmt( is, buf, cstr.s );
+	return is;
+} // cstr
 
 // Local Variables: //
Index: src/libcfa/limits
===================================================================
--- src/libcfa/limits	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/limits	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -1,92 +1,112 @@
+// 
+// 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 : Wed Apr  6 21:08:16 2016
+// Update Count     : 6
+// 
+
 // Integral Constants
 
-const short int MIN = -32768;
-const int MIN = -2147483648;
-const long int MIN = -9223372036854775807L - 1L;
-const long long int MIN = -9223372036854775807LL - 1LL;
+extern const short int MIN;
+extern const int MIN;
+extern const long int MIN;
+extern const long long int MIN;
 
-const short int MAX = 32767;
-const unsigned short int MAX = 65535;
-const int MAX = 2147483647;
-const unsigned int MAX = 4294967295_U;
-const long int MAX = 9223372036854775807_L;
-const unsigned long int MAX = 4294967295_U;
-const long long int MAX = 9223372036854775807_LL;
-const unsigned long long int MAX = 18446744073709551615_ULL;
+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
 
-const float PI = 3.141592_F;				// pi
-const float PI_2 = 1.570796_F;				// pi / 2
-const float PI_4 = 0.7853981_F;				// pi / 4
-const float _1_PI = 0.3183098_F;			// 1 / pi
-const float _2_PI = 0.6366197_F;			// 2 / pi
-const float _2_SQRT_PI = 1.128379_F;			// 2 / sqrt(pi)
+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)
 
-const double PI = 3.14159265358979323846_D;		// pi
-const double PI_2 = 1.57079632679489661923_D;		// pi / 2
-const double PI_4 = 0.78539816339744830962_D;		// pi / 4
-const double _1_PI = 0.31830988618379067154_D;		// 1 / pi
-const double _2_PI = 0.63661977236758134308_D;		// 2 / pi
-const double _2_SQRT_PI = 1.12837916709551257390_D;	// 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)
 
-const long double PI = 3.1415926535897932384626433832795029_DL; // pi
-const long double PI_2 = 1.5707963267948966192313216916397514_DL; // pi / 2
-const long double PI_4 = 0.7853981633974483096156608458198757_DL; // pi / 4
-const long double _1_PI = 0.3183098861837906715377675267450287_DL; // 1 / pi
-const long double _2_PI = 0.6366197723675813430755350534900574_DL; // 2 / pi
-const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 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)
 
-const _Complex PI = 3.14159265358979323846_D+0.0_iD;	// pi
-const _Complex PI_2 = 1.57079632679489661923_D+0.0_iD;	// pi / 2
-const _Complex PI_4 = 0.78539816339744830962_D+0.0_iD;	// pi / 4
-const _Complex _1_PI = 0.31830988618379067154_D+0.0_iD;	// 1 / pi
-const _Complex _2_PI = 0.63661977236758134308_D+0.0_iD;	// 2 / pi
-const _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
+extern const _Complex PI;								// pi
+extern const _Complex PI_2;								// pi / 2
+extern const _Complex PI_4;								// pi / 4
+extern const _Complex _1_PI;							// 1 / pi
+extern const _Complex _2_PI;							// 2 / pi
+extern const _Complex _2_SQRT_PI;						// 2 / sqrt(pi)
 
-const long _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
-const long _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
-const long _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
-const long _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
-const long _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
-const long _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
+extern const long _Complex PI;							// pi
+extern const long _Complex PI_2;						// pi / 2
+extern const long _Complex PI_4;						// pi / 4
+extern const long _Complex _1_PI;						// 1 / pi
+extern const long _Complex _2_PI;						// 2 / pi
+extern const long _Complex _2_SQRT_PI;					// 2 / sqrt(pi)
 
-const float E = 2.718281;				// e
-const float LOG2_E = 1.442695;				// log_2(e)
-const float LOG10_E = 0.4342944;			// log_10(e)
-const float LN_2 = 0.6931471;				// log_e(2)
-const float LN_10 = 2.302585;				// log_e(10)
-const float SQRT_2 = 1.414213;				// sqrt(2)
-const float _1_SQRT_2 = 0.7071067;			// 1 / sqrt(2)
+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)
 
-const double E = 2.7182818284590452354_D;		// e
-const double LOG2_E = 1.4426950408889634074_D;		// log_2(e)
-const double LOG10_E = 0.43429448190325182765_D;	// log_10(e)
-const double LN_2 = 0.69314718055994530942_D;		// log_e(2)
-const double LN_10 = 2.30258509299404568402_D;		// log_e(10)
-const double SQRT_2 = 1.41421356237309504880_D;		// sqrt(2)
-const double _1_SQRT_2 = 0.70710678118654752440_D;	// 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)
 
-const long double E = 2.7182818284590452353602874713526625_DL; // e
-const long double LOG2_E = 1.4426950408889634073599246810018921_DL; // log_2(e)
-const long double LOG10_E = 0.4342944819032518276511289189166051_DL; // log_10(e)
-const long double LN_2 = 0.6931471805599453094172321214581766_DL; // log_e(2)
-const long double LN_10 = 2.3025850929940456840179914546843642_DL; // log_e(10)
-const long double SQRT_2 = 1.4142135623730950488016887242096981_DL; // sqrt(2)
-const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 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)
 
-const _Complex E = 2.7182818284590452354_D+0.0_iD;	// e
-const _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD;	// log_2(e)
-const _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
-const _Complex LN_2 = 0.69314718055994530942_D+0.0_iD;	// log_e(2)
-const _Complex LN_10 = 2.30258509299404568402_D+0.0_iD;	// log_e(10)
-const _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD;	// sqrt(2)
-const _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
+extern const _Complex E;								// e
+extern const _Complex LOG2_E;							// log_2(e)
+extern const _Complex LOG10_E;							// log_10(e)
+extern const _Complex LN_2;								// log_e(2)
+extern const _Complex LN_10;							// log_e(10)
+extern const _Complex SQRT_2;							// sqrt(2)
+extern const _Complex _1_SQRT_2;						// 1 / sqrt(2)
 
-const long _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
-const long _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
-const long _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
-const long _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
-const long _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
-const long _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
-const long _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
+extern const long _Complex E;							// e
+extern const long _Complex LOG2_E;						// log_2(e)
+extern const long _Complex LOG10_E;						// log_10(e)
+extern const long _Complex LN_2;						// log_e(2)
+extern const long _Complex LN_10;						// log_e(10)
+extern const long _Complex SQRT_2;						// sqrt(2)
+extern const long _Complex _1_SQRT_2;					// 1 / sqrt(2)
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/limits.c
===================================================================
--- src/libcfa/limits.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/libcfa/limits.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -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.
+// 
+// limits.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 18:06:52 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:12:17 2016
+// Update Count     : 10
+// 
+
+#include <limits>
+
+// Integral Constants
+
+const short int MIN = -32768;
+const int MIN = -2147483648;
+const long int MIN = -9223372036854775807L - 1L;
+const long long int MIN = -9223372036854775807LL - 1LL;
+
+const short int MAX = 32767;
+const unsigned short int MAX = 65535;
+const int MAX = 2147483647;
+const unsigned int MAX = 4294967295_U;
+const long int MAX = 9223372036854775807_L;
+const unsigned long int MAX = 4294967295_U;
+const long long int MAX = 9223372036854775807_LL;
+const unsigned long long int MAX = 18446744073709551615_ULL;
+
+// Floating-Point Constants
+
+const float PI = 3.141592_F;							// pi
+const float PI_2 = 1.570796_F;							// pi / 2
+const float PI_4 = 0.7853981_F;							// pi / 4
+const float _1_PI = 0.3183098_F;						// 1 / pi
+const float _2_PI = 0.6366197_F;						// 2 / pi
+const float _2_SQRT_PI = 1.128379_F;					// 2 / sqrt(pi)
+
+const double PI = 3.14159265358979323846_D;				// pi
+const double PI_2 = 1.57079632679489661923_D;			// pi / 2
+const double PI_4 = 0.78539816339744830962_D;			// pi / 4
+const double _1_PI = 0.31830988618379067154_D;			// 1 / pi
+const double _2_PI = 0.63661977236758134308_D;			// 2 / pi
+const double _2_SQRT_PI = 1.12837916709551257390_D;		// 2 / sqrt(pi)
+
+const long double PI = 3.1415926535897932384626433832795029_DL; // pi
+const long double PI_2 = 1.5707963267948966192313216916397514_DL; // pi / 2
+const long double PI_4 = 0.7853981633974483096156608458198757_DL; // pi / 4
+const long double _1_PI = 0.3183098861837906715377675267450287_DL; // 1 / pi
+const long double _2_PI = 0.6366197723675813430755350534900574_DL; // 2 / pi
+const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 2 / sqrt(pi)
+
+const _Complex PI = 3.14159265358979323846_D+0.0_iD;	// pi
+const _Complex PI_2 = 1.57079632679489661923_D+0.0_iD;	// pi / 2
+const _Complex PI_4 = 0.78539816339744830962_D+0.0_iD;	// pi / 4
+const _Complex _1_PI = 0.31830988618379067154_D+0.0_iD;	// 1 / pi
+const _Complex _2_PI = 0.63661977236758134308_D+0.0_iD;	// 2 / pi
+const _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
+
+const long _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
+const long _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
+const long _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
+const long _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
+const long _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
+const long _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
+
+const float E = 2.718281;								// e
+const float LOG2_E = 1.442695;							// log_2(e)
+const float LOG10_E = 0.4342944;						// log_10(e)
+const float LN_2 = 0.6931471;							// log_e(2)
+const float LN_10 = 2.302585;							// log_e(10)
+const float SQRT_2 = 1.414213;							// sqrt(2)
+const float _1_SQRT_2 = 0.7071067;						// 1 / sqrt(2)
+
+const double E = 2.7182818284590452354_D;				// e
+const double LOG2_E = 1.4426950408889634074_D;			// log_2(e)
+const double LOG10_E = 0.43429448190325182765_D;		// log_10(e)
+const double LN_2 = 0.69314718055994530942_D;			// log_e(2)
+const double LN_10 = 2.30258509299404568402_D;			// log_e(10)
+const double SQRT_2 = 1.41421356237309504880_D;			// sqrt(2)
+const double _1_SQRT_2 = 0.70710678118654752440_D;		// 1 / sqrt(2)
+
+const long double E = 2.7182818284590452353602874713526625_DL; // e
+const long double LOG2_E = 1.4426950408889634073599246810018921_DL; // log_2(e)
+const long double LOG10_E = 0.4342944819032518276511289189166051_DL; // log_10(e)
+const long double LN_2 = 0.6931471805599453094172321214581766_DL; // log_e(2)
+const long double LN_10 = 2.3025850929940456840179914546843642_DL; // log_e(10)
+const long double SQRT_2 = 1.4142135623730950488016887242096981_DL; // sqrt(2)
+const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 1/sqrt(2)
+
+const _Complex E = 2.7182818284590452354_D+0.0_iD;		// e
+const _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD;	// log_2(e)
+const _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
+const _Complex LN_2 = 0.69314718055994530942_D+0.0_iD;	// log_e(2)
+const _Complex LN_10 = 2.30258509299404568402_D+0.0_iD;	// log_e(10)
+const _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD; // sqrt(2)
+const _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
+
+const long _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
+const long _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
+const long _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
+const long _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
+const long _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
+const long _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
+const long _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/rational
===================================================================
--- src/libcfa/rational	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/libcfa/rational	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,52 @@
+// 
+// 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 -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 17:56:25 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:51:42 2016
+// Update Count     : 8
+// 
+
+#include <fstream>
+
+struct Rational {
+	long int numerator, denominator;					// invariant: denominator > 0
+}; // Rational
+
+extern struct Rational 0;
+extern struct Rational 1;
+
+long int gcd( long int a, long int b );
+long int simplify( long int *n, long int *d );
+Rational rational();									// constructor
+Rational rational( long int n );						// constructor
+Rational rational( long int n, long int d );			// constructor
+long int numerator( Rational r );
+long int numerator( Rational r, long int n );
+long int denominator( Rational r, long int d );
+int ?==?( Rational l, Rational r );
+int ?!=?( Rational l, Rational r );
+int ?<?( Rational l, Rational r );
+int ?<=?( Rational l, Rational r );
+int ?>?( Rational l, Rational r );
+int ?>=?( Rational l, Rational r );
+Rational -?( Rational r );
+Rational ?+?( Rational l, Rational r );
+Rational ?-?( Rational l, Rational r );
+Rational ?*?( Rational l, Rational r );
+Rational ?/?( Rational l, Rational r );
+double widen( Rational r );
+Rational narrow( double f, long int md );
+ifstream * ?|?( ifstream *is, Rational *r );
+ofstream * ?|?( ofstream *os, Rational r );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/rational.c
===================================================================
--- src/libcfa/rational.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/libcfa/rational.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,205 @@
+//                               -*- Mode: C -*- 
+// 
+// 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.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 17:54:28 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:52:16 2016
+// Update Count     : 7
+// 
+
+#include "rational"
+#include <fstream>
+#include <stdlib>
+
+extern "C" {
+#include <stdlib.h>										// exit
+} // extern
+
+struct Rational 0 = {0, 1};
+struct Rational 1 = {1, 1};
+
+// Calculate the greatest common denominator of two numbers, the first of which may be negative.  It is used to reduce
+// rationals.
+
+long int gcd( long int a, long int b ) {
+    for ( ;; ) {										// Euclid's algorithm
+		long int r = a % b;
+	  if ( r == 0 ) break;
+		a = b;
+		b = r;
+    } // for
+	return b;
+} // gcd
+
+long int simplify( long int *n, long int *d ) {
+    if ( *d == 0 ) {
+		serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl;
+		exit( EXIT_FAILURE );
+    } // exit
+    if ( *d < 0 ) { *d = -*d; *n = -*n; }				// move sign to numerator
+    return gcd( abs( *n ), *d );						// simplify
+} // Rationalnumber::simplify
+
+Rational rational() {									// constructor
+//    r = (Rational){ 0, 1 };
+	Rational t = { 0, 1 };
+	return t;
+} // rational
+
+Rational rational( long int n ) {						// constructor
+//    r = (Rational){ n, 1 };
+	Rational t = { n, 1 };
+	return t;
+} // rational
+
+Rational rational( long int n, long int d ) {			// constructor
+    long int t = simplify( &n, &d );					// simplify
+//    r = (Rational){ n / t, d / t };
+	Rational t = { n / t, d / t };
+	return t;
+} // rational
+
+long int numerator( Rational r ) {
+    return r.numerator;
+} // numerator
+
+long int numerator( Rational r, long int n ) {
+    long int prev = r.numerator;
+    long int t = gcd( abs( n ), r.denominator );		// simplify
+    r.numerator = n / t;
+    r.denominator = r.denominator / t;
+    return prev;
+} // numerator
+
+long int denominator( Rational r, long int d ) {
+    long int prev = r.denominator;
+    long int t = simplify( &r.numerator, &d );			// simplify
+    r.numerator = r.numerator / t;
+    r.denominator = d / t;
+    return prev;
+} // denominator
+
+int ?==?( Rational l, Rational r ) {
+    return l.numerator * r.denominator == l.denominator * r.numerator;
+} // ?==?
+
+int ?!=?( Rational l, Rational r ) {
+    return ! ( l == r );
+} // ?!=?
+
+int ?<?( Rational l, Rational r ) {
+    return l.numerator * r.denominator < l.denominator * r.numerator;
+} // ?<?
+
+int ?<=?( Rational l, Rational r ) {
+    return l < r || l == r;
+} // ?<=?
+
+int ?>?( Rational l, Rational r ) {
+    return ! ( l <= r );
+} // ?>?
+
+int ?>=?( Rational l, Rational r ) {
+    return ! ( l < r );
+} // ?>=?
+
+Rational -?( Rational r ) {
+	Rational t = { -r.numerator, r.denominator };
+    return t;
+} // -?
+
+Rational ?+?( Rational l, Rational r ) {
+    if ( l.denominator == r.denominator ) {				// special case
+		Rational t = { l.numerator + r.numerator, l.denominator };
+		return t;
+    } else {
+		Rational t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator };
+		return t;
+    } // if
+} // ?+?
+
+Rational ?-?( Rational l, Rational r ) {
+    if ( l.denominator == r.denominator ) {				// special case
+		Rational t = { l.numerator - r.numerator, l.denominator };
+		return t;
+    } else {
+		Rational t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator };
+		return t;
+    } // if
+} // ?-?
+
+Rational ?*?( Rational l, Rational r ) {
+    Rational t = { l.numerator * r.numerator, l.denominator * r.denominator };
+	return t;
+} // ?*?
+
+Rational ?/?( Rational l, Rational r ) {
+    if ( r.numerator < 0 ) {
+		r.numerator = -r.numerator;
+		r.denominator = -r.denominator;
+	} // if
+	Rational t = { l.numerator * r.denominator, l.denominator * r.numerator };
+    return t;
+} // ?/?
+
+double widen( Rational r ) {
+	return (double)r.numerator / (double)r.denominator;
+} // widen
+
+// https://rosettacode.org/wiki/Convert_decimal_number_to_rational#C
+Rational narrow( double f, long int md ) {
+	if ( md <= 1 ) {									// maximum fractional digits too small?
+		Rational t = rational( f, 1 );					// truncate fraction
+		return t;
+	} // if
+
+	// continued fraction coefficients
+	long int a, h[3] = { 0, 1, 0 }, k[3] = { 1, 0, 0 };
+	long int x, d, n = 1;
+	int i, neg = 0;
+ 
+	if ( f < 0 ) { neg = 1; f = -f; }
+	while ( f != floor( f ) ) { n <<= 1; f *= 2; }
+	d = f;
+ 
+	// continued fraction and check denominator each step
+	for (i = 0; i < 64; i++) {
+		a = n ? d / n : 0;
+	  if (i && !a) break;
+		x = d; d = n; n = x % n;
+		x = a;
+		if (k[1] * a + k[0] >= md) {
+			x = (md - k[0]) / k[1];
+		  if ( ! (x * 2 >= a || k[1] >= md) ) break;
+			i = 65;
+		} // if
+		h[2] = x * h[1] + h[0]; h[0] = h[1]; h[1] = h[2];
+		k[2] = x * k[1] + k[0]; k[0] = k[1]; k[1] = k[2];
+	} // for
+	Rational t = rational( neg ? -h[1] : h[1], k[1] );
+	return t;
+} // narrow
+
+ifstream * ?|?( ifstream *is, Rational *r ) {
+	long int t;
+    is | &(r->numerator) | &(r->denominator);
+	t = simplify( &(r->numerator), &(r->denominator) );
+    r->numerator /= t;
+    r->denominator /= t;
+    return is;
+} // ?|?
+
+ofstream * ?|?( ofstream *os, Rational r ) {
+    return os | r.numerator | '/' | r.denominator;
+} // ?|?
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/stdlib
===================================================================
--- src/libcfa/stdlib	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/stdlib	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:12:35 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Mar 22 22:34:24 2016
-// Update Count     : 69
+// Last Modified On : Fri Apr  1 22:26:14 2016
+// Update Count     : 73
 //
 
@@ -18,4 +18,5 @@
 extern "C" {
 #include <stddef.h>										// size_t
+#include <math.h>										// floor
 } // extern "C"
 
@@ -80,6 +81,6 @@
 char abs( char );
 extern "C" {
-int abs( int );		// use default C routine for int
-} // extern
+int abs( int );				// use default C routine for int
+} // extern "C"
 long int abs( long int );
 long long int abs( long long int );
@@ -90,4 +91,18 @@
 double _Complex abs( double _Complex );
 long double _Complex abs( long double _Complex );
+
+//---------------------------------------
+
+float floor( float );
+extern "C" {
+double floor( double );		// use C routine for double
+} // extern "C"
+long double floor( long double );
+
+float ceil( float );
+extern "C" {
+double ceil( double );		// use C routine for double
+} // extern "C"
+long double ceil( long double );
 
 //---------------------------------------
Index: src/libcfa/stdlib.c
===================================================================
--- src/libcfa/stdlib.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/stdlib.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:10:29 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar 23 13:26:42 2016
-// Update Count     : 146
+// Last Modified On : Wed Mar 30 10:48:41 2016
+// Update Count     : 149
 //
 
@@ -243,4 +243,12 @@
 //---------------------------------------
 
+float floor( float v ) { return floorf( v ); }
+long double floor( long double v ) { return floorl( v ); }
+
+float ceil( float v ) { return ceilf( v ); }
+long double ceil( long double v ) { return ceill( v ); }
+
+//---------------------------------------
+
 void rand48seed( long int s ) { srand48( s ); }
 char rand48() { return mrand48(); }
