Index: doc/LaTeXmacros/common.tex
===================================================================
--- doc/LaTeXmacros/common.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/LaTeXmacros/common.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -11,6 +11,6 @@
 %% Created On       : Sat Apr  9 10:06:17 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Sun Feb 14 15:52:46 2021
-%% Update Count     : 524
+%% Last Modified On : Tue Apr 27 12:03:17 2021
+%% Update Count     : 539
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -102,4 +102,5 @@
 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.5ex \@plus -1ex \@minus -.2ex}{1.0ex \@plus .2ex}{\normalfont\normalsize\bfseries}}
 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.0ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries}}
+\renewcommand\subparagraph{\@startsection{subparagraph}{4}{\z@}{-1.5ex \@plus -1ex \@minus -.2ex}{-1em}{\normalfont\normalsize\bfseries\itshape}}
 
 % index macros
@@ -284,5 +285,5 @@
 showlines=true,							% show blank lines at end of code
 aboveskip=4pt,							% spacing above/below code block
-belowskip=0pt,
+belowskip=2pt,
 numberstyle=\footnotesize\sf,			% numbering style
 % replace/adjust listing characters that look bad in sanserif
@@ -297,6 +298,6 @@
 \lstset{
 language=CFA,
-moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
-%moredelim=**[is][\color{red}]{®}{®},	% red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
+%moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+moredelim=**[is][\color{red}]{®}{®},	% red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
 %moredelim=**[is][\color{blue}]{ß}{ß},	% blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
 %moredelim=**[is][\color{OliveGreen}]{¢}{¢}, % green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
Index: doc/theses/andrew_beach_MMath/Makefile
===================================================================
--- doc/theses/andrew_beach_MMath/Makefile	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/Makefile	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -34,5 +34,4 @@
 	${LATEX} ${BASE}
 	${BIBTEX} ${BUILD}/${BASE}
-	${LATEX} ${BASE}
 	${GLOSSARY} ${BUILD}/${BASE}
 	${LATEX} ${BASE}
Index: doc/theses/andrew_beach_MMath/cfalab.sty
===================================================================
--- doc/theses/andrew_beach_MMath/cfalab.sty	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/cfalab.sty	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -10,7 +10,13 @@
 
 % Other packages required.
+%
+% Access to new basic LaTeX tools and other low level commands.
 \RequirePackage{etoolbox}
+% Code formatting tools and environments.
 \RequirePackage{listings}
+% Automatically adds spaces.
 \RequirePackage{xspace}
+% Improved reference tools.
+\RequirePackage[nospace]{varioref}
 
 % Symbols: All symbols are zero argument robust commands with special rules
@@ -20,5 +26,5 @@
 
 % \newsymbolcmd{<command>}{<replacement text>}
-%     Defines <command> to be a symbol that has the given <replacement text>.
+% Defines <command> to be a symbol that has the given <replacement text>.
 \newrobustcmd*\newsymbolcmd[2]{\newrobustcmd{#1}{\cfalab@symbol{#2}}}
 \def\cfalab@symbol#1{\@ifnextchar*{#1\cfalab@eatstar}{#1\xspace}}
@@ -28,7 +34,8 @@
 \newsymbolcmd\CFA{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}}
 % C++ with kerning. (No standard number support.)
-\newsymbolcmd\CPP{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}
+\newsymbolcmd\Cpp{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}
 
-% This is executed very early in the \begin{document} code.
+% This is executed very early in the \begin{document} code, before the
+% document's contents but after packages are loaded.
 \AtEndPreamble{
   \@ifpackageloaded{hyperref}{
@@ -36,8 +43,34 @@
     \pdfstringdefDisableCommands{
       \def\CFA{CFA}
-      \def\CPP{C++}
+      \def\Cpp{C++}
+      \def\lstinline{}
     }
   }{}
 }
+
+% \colour{<colour>}{<text>}
+% Just \color but using the LaTeX style instead of TeX style command.
+\newcommand*\colour[2]{{\color{#1}#2}}
+
+% \code*{<code>}
+% Use the listings package to format a snipit of <code>.
+\newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}}
+\newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}}
+\newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}}
+\newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}}
+
+% Use the listings package to format a block of CFA code.
+% Extra listings options can be passed in as an optional argument.
+\lstnewenvironment{cfa}[1][]{\lstset{language=CFA}\lstset{#1}}{}
+
+% \settextunderscore{(new|old)}
+% Redefines the underscore either as a new repersentation or the old one.
+% Not that some other packages (ex. hyperref) can override this. Set it up
+% after loading them.
+\let\cfalab@textunderscore@old=\textunderscore
+\newcommand\cfalab@textunderscore@new{%
+    \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
+\newcommand\settextunderscore[1]{%
+    \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
 
 % The CFA listings language. Based off of ANCI C and including GCC extensions.
@@ -61,27 +94,63 @@
 \lstset{defaultdialect={[UW]CFA}}
 
-% The cfalab style defines some common settings useful in different languages.
-\lstdefinestyle{cfalab}{%
-    columns=fullflexible,
-    basicstyle=\linespread{0.9}\tt,
-    stringstyle=\tt,
+% Create an internal paragraph indent amount. This is used internally to
+% mimic the standard indent even when it has been overriden in the document.
+\newlength\cfalab@parindent
+\deflength\cfalab@parindent{\parindent}
+
+% The cfacommon style has many useful defaults for CFA and other types of
+% code. Use the listings option "style=cfacommon" to load them.
+\lstdefinestyle{cfacommon}{
+  columns=fullflexible,
+  basicstyle=\linespread{0.9}\sf,
+  stringstyle=\tt,
+  tabsize=5,
+  % Indent code to paragraph indentation.
+  xleftmargin=\cfalab@parindent,
+  % Allow ASCII characters in the range 128-255.
+  extendedchars=true,
+  % This allows you to use "math mode" to insert LaTeX into the code.
+  % Use \( and \) if you need to insert math mode inside that code.
+  escapechar=\$,
+  % Disable LaTeX math escape in CFA code $...$
+  mathescape=false,
+  keepspaces=true,
+  % Do not show spaces with cup.
+  showstringspaces=false,
+  % Show blank lines at end of code.
+  showlines=true,
+  % Spacing above/below code block.
+  aboveskip=4pt,belowskip=0pt,
+  numberstyle=\footnotesize\sf,
+  % Replace/adjust listing characters that look bad in sanserif.
+  literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
+    {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
+    {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
+    {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2
+    {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
 }
 
-% \code*[<escape character>]{<code>}
-%     Use the listings package to format a snipit of <code>.
-%     The <escape character> must be a character that does not appear in
-%     <code> and defaults to a backtick.
-\newcommand*\codeC[2][\`]{\lstinline[language=C]#1#2#1}
-\newcommand*\codeCFA[2][\`]{\lstinline[language=CFA]#1#2#1}
+% common.tex Compatablity ===================================================
+% Below this line is for compatability with the old common.tex file.
 
-% \settextunderscore{(new|old)}
-%     Redefines the underscore either as a new repersentation or the old one.
-%     Not that some other packages (ex. hyperref) can override this. Set it
-%     up after loading them.
-\let\cfalab@textunderscore@old=\textunderscore
-\newcommand\cfalab@textunderscore@new{%
-    \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
-\newcommand\settextunderscore[1]{%
-    \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
+% Backwards compatable way to activate the cfacommon style.
+\newcommand{\CFAStyle}{\lstset{style=cfacommon}}
+
+% A couple of abbreviations are provided. Just ones someone liked.
+%
+% Abbreviation formatting commands (renew to customize):
+\newcommand{\abbrevFont}{\textit}
+%
+% Abbreviations that, if not followed by a comma or colon, add a comma.
+\newrobustcmd*\cfalab@abbrev@comma{%
+  \@ifnextchar{,}{}{\@ifnextchar{:}{}{,\xspace}}}
+\providerobustcmd*\eg{\abbrevFont{e}.\abbrevFont{g}.\cfalab@abbrev@comma}
+\providerobustcmd*\ie{\abbrevFont{i}.\abbrevFont{e}.\cfalab@abbrev@comma}
+%
+% Abbreviations that, if not followed by a period, add a period.
+\newrobustcmd*\cfalab@abbrev@period{\@ifnextchar{.}{}{.\xspace}}
+\providerobustcmd*\etc{\abbrevFont{etc}\cfalab@abbrev@period}
+\providerobustcmd*\etal{\abbrevFont{et}~\abbrevFont{al}\cfalab@abbrev@period}
+\providerobustcmd*\viz{\abbrevFont{viz}\cfalab@abbrev@period}
 
 \endinput
Index: doc/theses/andrew_beach_MMath/existing.tex
===================================================================
--- doc/theses/andrew_beach_MMath/existing.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/existing.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -16,7 +16,7 @@
 to be defined~\cite{Moss18}.
 \begin{cfa}
-char i; int i; double i;			$\C[3.75in]{// variable overload}$
-int f(); double f();				$\C{// return overload}$
-void g( int ); void g( double );	$\C{// parameter overload}\CRT$
+char i; int i; double i;
+int f(); double f();
+void g( int ); void g( double );
 \end{cfa}
 This feature requires name mangling so the assembly symbols are unique for
@@ -26,14 +26,14 @@
 mangling is:
 \begin{cfa}
-// name mangling
+// name mangling on by default
 int i; // _X1ii_1
-@extern "C"@ {  // no name mangling
+extern "C" {  // disables name mangling
 	int j; // j
-	@extern "Cforall"@ {  // name mangling
+	extern "Cforall" {  // enables name mangling
 		int k; // _X1ki_1
 	}
-	// no name mangling
-}
-// name mangling
+	// revert to no name mangling
+}
+// revert to name mangling
 \end{cfa}
 Both forms of @extern@ affect all the declarations within their nested lexical
@@ -50,7 +50,7 @@
 \begin{cfa}
 int i, j;
-int @&@ ri = i, @&&@ rri = ri;
+int & ri = i, && rri = ri;
 rri = 3;  // auto-dereference assign to i
-@&@ri = @&@j; // rebindable
+&ri = &j; // rebindable
 ri = 5;   // assign to j
 \end{cfa}
@@ -64,30 +64,48 @@
 
 In general, operator names in \CFA are constructed by bracketing an operator
-token with @?@, which indicates the position of the arguments. For example, infixed
-multiplication is @?*?@ while prefix dereference is @*?@. This syntax make it
-easy to tell the difference between prefix operations (such as @++?@) and
-post-fix operations (@?++@).
+token with @?@, which indicates the position of the arguments. For example,
+infixed multiplication is @?*?@ while prefix dereference is @*?@.
+This syntax make it easy to tell the difference between prefix operations
+(such as @++?@) and post-fix operations (@?++@).
 
 The special name for a constructor is @?{}@, which comes from the
-initialization syntax in C. The special name for a destructor is @^{}@, where
-the @^@ has no special meaning.
+initialization syntax in C. That initialation syntax is also the operator
+form. \CFA will generate a constructor call each time a variable is declared,
+passing the initialization arguments to the constructort.
+\begin{cfa}
+struct Example { ... };
+void ?{}(Example & this) { ... }
+{
+	Example a;
+	Example b = {};
+}
+void ?{}(Example & this, char first, int num) { ... }
+{
+	Example c = {'a', 2};
+}
+\end{cfa}
+Both @a@ and @b@ will be initalized with the first constructor (there is no
+general way to skip initialation) while @c@ will be initalized with the
+second.
+
 % I don't like the \^{} symbol but $^\wedge$ isn't better.
-\begin{cfa}
-struct T { ... };
-void ?@{}@(@T &@ this, ...) { ... }  // constructor
-void ?@^{}@(@T &@ this, ...) { ... } // destructor
+Similarly destructors use the special name @^?{}@ (the @^@ has no special
+meaning). They can be called explicatly as well but normally they are
+implicitly called on a variable when it goes out of scope.
+\begin{cfa}
+void ^?{}(Example & this) { ... }
 {
-	T s = @{@ ... @}@;  // same constructor/initialization braces
-} // destructor call automatically generated
-\end{cfa}
-The first parameter is a reference parameter to the type for the
-constructor/destructor. Destructors may have multiple parameters.  The compiler
-implicitly matches an overloaded constructor @void ^?{}(T &, ...);@ to an
-object declaration with associated initialization, and generates a construction
-call after the object is allocated. When an object goes out of scope, the
-matching overloaded destructor @void ^?{}(T &);@ is called.  Without explicit
-definition, \CFA creates a default and copy constructor, destructor and
-assignment (like \Cpp). It is possible to define constructors/destructors for
-basic and existing types (unlike \Cpp).
+    Example d;
+} // <- implicit destructor call
+\end{cfa}
+No operator name is restricted in what function signatures they may be bound
+to although most of the forms cannot be called in operator form. Some
+``near-misses" will generate warnings.
+
+Whenever a type is defined, \CFA will create a default zero-argument
+constructor, a copy constructor, a series of argument-per-field constructors
+and a destructor. All user constructors are defined after this.
+Because operators are never part of the type definition they may be added
+at any time, including on built-in types.
 
 \section{Polymorphism}
@@ -105,7 +123,11 @@
 works on any type @T@:
 \begin{cfa}
-@forall( T )@ @T@ identity( @T@ val ) { return val; }
-int forty_two = identity( 42 ); // T bound to int, forty_two == 42
-\end{cfa}
+forall( T ) T identity( T val ) { return val; }
+int forty_two = identity( 42 );
+char capital_a = identity( 'A' );
+\end{cfa}
+Each use of a polymorphic declaration will resolve its polymorphic parameters
+(in this case, just @T@) to concrete types (@int@ in the first use and @char@
+in the second).
 
 To allow a polymorphic function to be separately compiled, the type @T@ must be
@@ -115,15 +137,10 @@
 types used in a function, \eg:
 \begin{cfa}
-forall( T @| { void do_once(T); }@) // assertion
+forall( T | { void do_once(T); })
 void do_twice(T value) {
 	do_once(value);
 	do_once(value);
 }
-void do_once(@int@ i) { ... }  // provide assertion
-@int@ i;
-do_twice(i); // implicitly pass assertion do_once to do_twice
-\end{cfa}
-Any object with a type fulfilling the assertion may be passed as an argument to
-a @do_twice@ call.
+\end{cfa}
 
 A polymorphic function can be used in the same way as a normal function.  The
@@ -132,4 +149,11 @@
 all the variables replaced with the concrete types from the arguments) is
 defined at a call site.
+\begin{cfa}
+void do_once(int i) { ... }
+int i;
+do_twice(i);
+\end{cfa}
+Any object with a type fulfilling the assertion may be passed as an argument to
+a @do_twice@ call.
 
 Note, a function named @do_once@ is not required in the scope of @do_twice@ to
@@ -138,8 +162,8 @@
 call.
 \begin{cfa}
-void do_once(double y) { ... } // global
+void do_once(double y) { ... }
 int quadruple(int x) {
-	void do_once(int y) { y = y * 2; } // local
-	do_twice(x); // using local "do_once"
+	void do_once(int y) { y = y * 2; }
+	do_twice(x);
 	return x;
 }
@@ -150,4 +174,5 @@
 function. The matched assertion function is then passed as a function pointer
 to @do_twice@ and called within it.
+The global definition of @do_once@ is ignored.
 
 To avoid typing long lists of assertions, constraints can be collect into
@@ -161,5 +186,5 @@
 and the @forall@ list in the previous example is replaced with the trait.
 \begin{cfa}
-forall(dtype T | @done_once(T)@)
+forall(dtype T | done_once(T))
 \end{cfa}
 In general, a trait can contain an arbitrary number of assertions, both
@@ -172,13 +197,13 @@
 declarations instead of parameters, returns, and local variable declarations.
 \begin{cfa}
-forall(dtype @T@)
+forall(dtype T)
 struct node {
-	node(@T@) * next;  // generic linked node
-	@T@ * data;
-}
-node(@int@) inode;
-\end{cfa}
-The generic type @node(T)@ is an example of a polymorphic-type usage.  Like \Cpp
-template usage, a polymorphic-type usage must specify a type parameter.
+	node(T) * next;  // generic linked node
+	T * data;
+}
+node(int) inode;
+\end{cfa}
+The generic type @node(T)@ is an example of a polymorphic type usage.  Like \Cpp
+template usage, a polymorphic type usage must specify a type parameter.
 
 There are many other polymorphism features in \CFA but these are the ones used
@@ -219,11 +244,9 @@
 Each coroutine has a @main@ function, which takes a reference to a coroutine
 object and returns @void@.
-\begin{cfa}[numbers=left]
-void main(@CountUp & this@) { // argument matches trait is_coroutine
-	unsigned int up = 0;  // retained between calls
-	while (true) {
-		next = up; // make "up" available outside function
-		@suspend;@$\label{suspend}$
-		up += 1;
+\begin{cfa}
+void main(CountUp & this) {
+    for (unsigned int next = 0 ; true ; ++next) {
+		next = up;
+		suspend;$\label{suspend}$
 	}
 }
@@ -254,5 +277,5 @@
 @mutex@.
 \begin{cfa}
-void example(MonitorA & @mutex@ argA, MonitorB & @mutex@ argB);
+void example(MonitorA & mutex argA, MonitorB & mutex argB);
 \end{cfa}
 When the function is called, it implicitly acquires the monitor lock for all of
Index: doc/theses/andrew_beach_MMath/features.tex
===================================================================
--- doc/theses/andrew_beach_MMath/features.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/features.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -20,5 +20,5 @@
 \subparagraph{Raise}
 The raise is the starting point for exception handling. It marks the beginning
-of exception handling by \newterm{raising} an excepion, which passes it to
+of exception handling by raising an excepion, which passes it to
 the EHM.
 
@@ -101,5 +101,5 @@
 between different sub-hierarchies.
 This design is used in \CFA even though it is not a object-orientated
-language using different tools to create the hierarchy.
+language; so different tools are used to create the hierarchy.
 
 % Could I cite the rational for the Python IO exception rework?
@@ -123,9 +123,16 @@
 \section{Virtuals}
 Virtual types and casts are not part of \CFA's EHM nor are they required for
-any EHM. But \CFA uses a hierarchial system of exceptions and this feature
-is leveraged to create that.
-
-% Maybe talk about why the virtual system is so minimal.
-% Created for but not a part of the exception system.
+any EHM.
+However the \CFA uses a hierarchy built with the virtual system as the basis
+for exceptions and exception matching.
+
+The virtual system would have ideally been part of \CFA before the work
+on exception handling began, but unfortunately it was not.
+Because of this only the features and framework needed for the EHM were
+designed and implemented. Other features were considered to ensure that
+the structure could accomidate other desirable features but they were not
+implemented.
+The rest of this section will only discuss the finalized portion of the
+virtual system.
 
 The virtual system supports multiple ``trees" of types. Each tree is
@@ -175,5 +182,5 @@
 While much of the virtual infrastructure is created, it is currently only used
 internally for exception handling. The only user-level feature is the virtual
-cast, which is the same as the \Cpp \lstinline[language=C++]|dynamic_cast|.
+cast, which is the same as the \Cpp \codeCpp{dynamic_cast}.
 \label{p:VirtualCast}
 \begin{cfa}
@@ -197,23 +204,15 @@
 \begin{cfa}
 trait is_exception(exceptT &, virtualT &) {
-	virtualT const & get_exception_vtable(exceptT *);
+	// Numerous imaginary assertions.
 };
 \end{cfa}
 The trait is defined over two types, the exception type and the virtual table
-type. This should be one-to-one: each exception type has only one virtual
-table type and vice versa. The only assertion in the trait is
-@get_exception_vtable@, which takes a pointer of the exception type and
-returns a reference to the virtual table type instance.
-
-% TODO: This section, and all references to get_exception_vtable, are
-% out-of-data. Perhaps wait until the update is finished before rewriting it.
-The function @get_exception_vtable@ is actually a constant function.
-Regardless of the value passed in (including the null pointer) it should
-return a reference to the virtual table instance for that type.
-The reason it is a function instead of a constant is that it make type
-annotations easier to write as you can use the exception type instead of the
-virtual table type; which usually has a mangled name.
-% Also \CFA's trait system handles functions better than constants and doing
-% it this way reduce the amount of boiler plate we need.
+type. Each exception type should have but a single virtual table type.
+Now there are no actual assertions in this trait because the trait system
+actually can't express them (adding such assertions would be part of
+completing the virtual system). The imaginary assertions would probably come
+from a trait defined by the virtual system, and state that the exception type
+is a virtual type, is a decendent of @exception_t@ (the base exception type)
+and note its virtual table type.
 
 % I did have a note about how it is the programmer's responsibility to make
@@ -235,5 +234,5 @@
 Both traits ensure a pair of types are an exception type and its virtual table
 and defines one of the two default handlers. The default handlers are used
-as fallbacks and are discussed in detail in \VRef{s:ExceptionHandling}.
+as fallbacks and are discussed in detail in \vref{s:ExceptionHandling}.
 
 However, all three of these traits can be tricky to use directly.
@@ -351,5 +350,5 @@
 for particular exception type.
 The global default termination handler performs a cancellation
-\see{\VRef{s:Cancellation}} on the current stack with the copied exception.
+(see \vref{s:Cancellation}) on the current stack with the copied exception.
 
 \subsection{Resumption}
@@ -426,4 +425,5 @@
 
 \subsubsection{Resumption Marking}
+\label{s:ResumptionMarking}
 A key difference between resumption and termination is that resumption does
 not unwind the stack. A side effect that is that when a handler is matched
@@ -472,5 +472,5 @@
 The symmetry between resumption termination is why this pattern was picked.
 Other patterns, such as marking just the handlers that caught, also work but
-lack the symmetry means there are less rules to remember.
+lack the symmetry means there are more rules to remember.
 
 \section{Conditional Catch}
@@ -557,6 +557,6 @@
 \end{cfa}
 If there are further handlers after this handler only the first version will
-check them. If multiple handlers on a single try block could handle the same
-exception the translations get more complex but they are equivilantly
+check them. If multiple handlers on a single try block that could handle the
+same exception the translations get more complex but they are equivilantly
 powerful.
 
@@ -633,6 +633,6 @@
 and the current stack is
 unwound. After that it depends one which stack is being cancelled.
-\begin{description}
-\item[Main Stack:]
+
+\paragraph{Main Stack}
 The main stack is the one used by the program main at the start of execution,
 and is the only stack in a sequential program.
@@ -645,5 +645,5 @@
 to, so it would have be explicitly managed.
 
-\item[Thread Stack:]
+\paragraph{Thread Stack}
 A thread stack is created for a \CFA @thread@ object or object that satisfies
 the @is_thread@ trait.
@@ -671,5 +671,5 @@
 Also you can always add an explicit join if that is the desired behaviour.
 
-\item[Coroutine Stack:]
+\paragraph{Coroutine Stack}
 A coroutine stack is created for a @coroutine@ object or object that
 satisfies the @is_coroutine@ trait.
@@ -685,3 +685,2 @@
 (in terms of coroutine state) called resume on this coroutine, so the message
 is passed to the latter.
-\end{description}
Index: doc/theses/andrew_beach_MMath/future.tex
===================================================================
--- doc/theses/andrew_beach_MMath/future.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/future.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -110,5 +110,5 @@
 \section{Zero-Cost Try}
 \CFA does not have zero-cost try-statements because the compiler generates C
-code rather than assembler code \see{\VPageref{p:zero-cost}}. When the compiler
+code rather than assembler code (see \vpageref{p:zero-cost}). When the compiler
 does create its own assembly (or LLVM byte-code), then zero-cost try-statements
 are possible. The downside of zero-cost try-statements is the LSDA complexity,
Index: doc/theses/andrew_beach_MMath/implement.tex
===================================================================
--- doc/theses/andrew_beach_MMath/implement.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/implement.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -9,7 +9,7 @@
 % Virtual table rules. Virtual tables, the pointer to them and the cast.
 While the \CFA virtual system currently has only one public feature, virtual
-cast \see{\VPageref{p:VirtualCast}}, substantial structure is required to
-support it, and provide features for exception handling and the standard
-library.
+cast (see the virtual cast feature \vpageref{p:VirtualCast}),
+substantial structure is required to support it,
+and provide features for exception handling and the standard library.
 
 \subsection{Virtual Type}
@@ -215,5 +215,5 @@
 \subsection{libunwind Usage}
 Libunwind, accessed through @unwind.h@ on most platforms, is a C library that
-provides \CC-style stack-unwinding. Its operation is divided into two phases:
+provides \Cpp-style stack-unwinding. Its operation is divided into two phases:
 search and cleanup. The dynamic target search -- phase 1 -- is used to scan the
 stack and decide where unwinding should stop (but no unwinding occurs). The
@@ -291,5 +291,5 @@
 @_UA_FORCE_UNWIND@ specifies a forced unwind call. Forced unwind only performs
 the cleanup phase and uses a different means to decide when to stop
-\see{\VRef{s:ForcedUnwind}}.
+(see \vref{s:ForcedUnwind}).
 \end{enumerate}
 
@@ -400,5 +400,5 @@
 
 Termination exceptions use libunwind heavily because it matches the intended
-use from \CC exceptions closely. The main complication for \CFA is that the
+use from \Cpp exceptions closely. The main complication for \CFA is that the
 compiler generates C code, making it very difficult to generate the assembly to
 form the LSDA for try blocks or destructors.
@@ -509,5 +509,6 @@
 
 % Recursive Resumption Stuff:
-Search skipping \see{\VPageref{p:searchskip}}, which ignores parts of the stack
+Search skipping (see \vpageref{s:ResumptionMarking}), which ignores parts of
+the stack
 already examined, is accomplished by updating the front of the list as the
 search continues. Before the handler at a node is called the head of the list
@@ -554,5 +555,5 @@
 Cancellation also uses libunwind to do its stack traversal and unwinding,
 however it uses a different primary function @_Unwind_ForcedUnwind@. Details
-of its interface can be found in the \VRef{s:ForcedUnwind}.
+of its interface can be found in the \vref{s:ForcedUnwind}.
 
 The first step of cancellation is to find the cancelled stack and its type:
Index: doc/theses/andrew_beach_MMath/uw-ethesis.tex
===================================================================
--- doc/theses/andrew_beach_MMath/uw-ethesis.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/theses/andrew_beach_MMath/uw-ethesis.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -66,10 +66,4 @@
 % Tip: Photographs should be cropped and compressed so as not to be too large.
 
-% To create a PDF output that is optimized for double-sided printing:
-% 1) comment-out the \documentclass statement in the preamble below, and
-%    un-comment the second \documentclass line.
-% 2) change the value assigned below to the boolean variable "PrintVersion"
-%    from "false" to "true".
-
 % ======================================================================
 %   D O C U M E N T   P R E A M B L E
@@ -87,12 +81,6 @@
 }
 
-% Some LaTeX commands I define for my own nomenclature.
-% If you have to, it's easier to make changes to nomenclature once here than
-% in a million places throughout your thesis!
-\newcommand{\package}[1]{\textbf{#1}} % package names in bold text
-\newcommand{\cmmd}[1]{\textbackslash\texttt{#1}} % command name in tt font
-\newcommand{\href}[1]{#1} % does nothing, but defines the command so the
-% print-optimized version will ignore \href tags (redefined by hyperref pkg).
-% Anything defined here may be redefined by packages added below...
+% Does nothing, ignores \href tags (redefined by hyperref package).
+\newcommand{\href}[1]{#1}
 
 % For a nomenclature (optional; available from ctan.org)
@@ -107,4 +95,6 @@
 % Adds todos (Must be included after comment.)
 \usepackage{todonotes}
+% cfa macros used in the document
+\usepackage{cfalab}
 
 % Hyperlinks make it very easy to navigate an electronic document.
@@ -208,29 +198,8 @@
 \makeglossaries
 
-% cfa macros used in the document
-%\usepackage{cfalab}
-% I'm going to bring back eventually.
-\makeatletter
-% Combines all \CC* commands:
-\newrobustcmd*\Cpp[1][\xspace]{\cfalab@Cpp#1}
-\newcommand\cfalab@Cpp{C\kern-.1em\hbox{+\kern-.25em+}}
-% Optional arguments do not work with pdf string. (Some fix-up required.)
-\pdfstringdefDisableCommands{\def\Cpp{C++}}
-
-% Wrappers for inline code snippits.
-\newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}}
-\newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}}
-\newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}}
-\newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}}
-
-% Colour text, formatted in LaTeX style instead of TeX style.
-\newcommand*\colour[2]{{\color{#1}#2}}
-\makeatother
-
-\input{common}
-% CFA code-style for all languages
-\CFAStyle
-% CFA default lnaguage
-\lstset{language=CFA,basicstyle=\linespread{0.9}\tt}
+% listings package configuation:
+\lstMakeShortInline@
+\lstset{language=CFA,style=cfacommon,basicstyle=\linespread{0.9}\tt}
+\lstset{moredelim=**[is][\protect\color{red}]{@}{@}}
 % Annotations from Peter:
 \newcommand{\PAB}[1]{{\color{blue}PAB: #1}}
Index: doc/user/user.tex
===================================================================
--- doc/user/user.tex	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ doc/user/user.tex	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -11,6 +11,6 @@
 %% Created On       : Wed Apr  6 14:53:29 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Sun Apr 25 19:03:03 2021
-%% Update Count     : 4951
+%% Last Modified On : Wed Apr 28 21:48:59 2021
+%% Update Count     : 5051
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -3312,4 +3312,5 @@
 
 \section{Tuples}
+\label{tuples}
 
 In C and \CFA, lists of elements appear in several contexts, such as the parameter list for a routine call.
@@ -3420,4 +3421,5 @@
 
 \subsection{Tuple Coercions}
+\label{tuple coercions}\label{coercions!tuple}
 
 There are four coercions that can be performed on tuples and tuple variables: closing, opening, flattening and structuring.
@@ -3464,4 +3466,5 @@
 
 \subsection{Mass Assignment}
+\label{mass assignment}\label{assignment!mass}
 
 \CFA permits assignment to several variables at once using mass assignment~\cite{CLU}.
@@ -3504,4 +3507,5 @@
 
 \subsection{Multiple Assignment}
+\label{multiple assignment}\label{assignment!multiple}
 
 \CFA also supports the assignment of several values at once, known as multiple assignment~\cite{CLU,Galletly96}.
@@ -3545,4 +3549,5 @@
 
 \subsection{Cascade Assignment}
+\index{cascade assignment}\index{assignment!cascade}
 
 As in C, \CFA mass and multiple assignments can be cascaded, producing cascade assignment.
@@ -3564,12 +3569,12 @@
 \section{Stream I/O Library}
 \label{s:StreamIOLibrary}
-\index{input/output stream library}
-\index{stream library}
+\index{input}\index{output}
+\index{stream library}\index{library!stream}
 
 The goal of \CFA stream input/output (I/O) is to simplify the common cases\index{I/O!common case}, while fully supporting polymorphism and user defined types in a consistent way.
 Stream I/O can be implicitly or explicitly formatted.
-Implicit formatting means \CFA selects the output or input format for values that match with the type of a variable.
+Implicit formatting means \CFA selects the output or input format for values that matches the variable's type.
 Explicit formatting means additional information is specified to augment how an output or input of value is interpreted.
-\CFA formatting is a cross between C ©printf© and \CC ©cout© manipulators, and Python implicit spacing and newline.
+\CFA formatting incorporates ideas from C ©printf©, \CC ©stream© manipulators, and Python implicit spacing and newline.
 Specifically:
 \begin{itemize}
@@ -3584,9 +3589,21 @@
 Hence, it is common programming practice to toggle manipulators on and then back to the default to prevent downstream side-effects.
 Without this programming style, errors occur when moving prints, as manipulator effects incorrectly flow into the new location.
-(To guarantee no side-effects, manipulator values must be saved and restored across function calls.)
-\item
-\CFA has more sophisticated implicit spacing between values than Python, plus implicit newline at the end of a print.
+Furthermore, to guarantee no side-effects, manipulator values must be saved and restored across function calls.
+\item
+\CFA has more sophisticated implicit value spacing than Python, plus implicit newline at the end of a print.
 \end{itemize}
+
+The standard polymorphic I/Os stream are ©stdin©/©sin© (input), ©stdout©/©sout© and ©stderr©/©serr© (output) (like C++ ©cin©/©cout©/©cerr©).
+Polymorphic streams ©exit© and ©abort© provide implicit program termination without and with generating a stack trace and core file.
+Stream ©exit© implicitly returns ©EXIT_FAILURE© to the shell.
+\begin{cfa}
+®exit®   | "x (" | x | ") negative value."; // terminate and return EXIT_FAILURE to shell
+®abort® | "x (" | x | ") negative value."; // terminate and generate stack trace and core file
+\end{cfa}
+Note, \CFA stream variables ©stdin©, ©stdout©, ©stderr©, ©exit©, and ©abort© overload C variables ©stdin©, ©stdout©, ©stderr©, and functions ©exit© and ©abort©, respectively.
 The \CFA header file for the I/O library is \Indexc{fstream.hfa}.
+
+
+\subsection{Basic I/O}
 
 For implicit formatted output, the common case is printing a series of variables separated by whitespace.
@@ -3601,5 +3618,5 @@
 \begin{cfa}
 
-cout << x ®<< " "® << y ®<< " "® << z << endl;
+cout  <<  x  ®<< " "®  <<  y  ®<< " "®  <<  z  << endl;
 \end{cfa}
 &
@@ -3653,5 +3670,5 @@
 \end{tabular}
 \end{cquote}
-Input and output use a uniform operator, ©|©, rather than separate operators, as in ©>>© and ©<<© for \CC.
+Input and output use a uniform operator, ©|©, rather than \CC's ©>>© and ©<<© input/output operators.
 There is a weak similarity between the \CFA logical-or operator and the \Index{Shell pipe-operator} for moving data, where data flows in the correct direction for input but the opposite direction for output.
 
@@ -3698,4 +3715,113 @@
 \end{cquote}
 
+\VRef[Figure]{f:CFACommand-LineProcessing} shows idiomatic \CFA command-line processing and copying an input file to an output file.
+Note, a stream variable may be copied because it is a reference to an underlying stream data-structures.
+All I/O errors are handles as exceptions, but end-of-file is not an exception as C programmers are use to explicitly checking for it.
+
+\begin{figure}
+\begin{cfa}
+#include ®<fstream.hfa>®
+
+int main( int argc, char * argv[] ) {
+	®ifstream® in  = stdin;					$\C{// copy default files}$
+	®ofstream® out = stdout;
+
+	try {
+		choose ( argc ) {
+		  case 2, 3:
+			®open®( in, argv[1] );			$\C{// open input file first as output creates file}$
+			if ( argc == 3 ) ®open®( out, argv[2] ); $\C{// do not create output unless input opens}$
+		  case 1: ;							$\C{// use default files}$
+		  default:
+			®exit® | "Usage" | argv[0] | "[ input-file (default stdin) "
+				   "[ output-file (default stdout) ] ]";
+		} // choose
+	} catch( ®Open_Failure® * ex; ex->istream == &in ) {
+		®exit® | "Unable to open input file" | argv[1];
+	} catch( ®Open_Failure® * ex; ex->ostream == &out ) {
+		®close®( in );						$\C{// optional}$
+		®exit® | "Unable to open output file" | argv[2];
+	} // try
+
+	out | nlOff;							$\C{// turn off auto newline}$
+	in | nlOn;								$\C{// turn on reading newline}$
+	char ch;
+	for () {								$\C{// read/write characters}$
+		in | ch;
+	  if ( eof( in ) ) break;				$\C{// eof ?}$
+		out | ch;
+	} // for
+} // main
+\end{cfa}
+\caption{\CFA Command-Line Processing}
+\label{f:CFACommand-LineProcessing}
+\end{figure}
+
+\VRef[Figure]{f:StreamFunctions} shows the stream operations.
+\begin{itemize}[topsep=4pt,itemsep=2pt,parsep=0pt]
+\item
+\Indexc{fail} tests the stream error-indicator, returning nonzero if it is set.
+\item
+\Indexc{clear} resets the stream error-indicator.
+\item
+\Indexc{flush} (©ofstream© only) causes any unwritten data for a stream to be written to the file.
+\item
+\Indexc{eof} (©ifstream© only) tests the end-of-file indicator for the stream pointed to by stream.
+Returns true if the end-of-file indicator is set, otherwise false.
+\item
+\Indexc{open} binds the file with ©name© to a stream accessed with ©mode© (see ©fopen©).
+\item
+\Indexc{close} flushes the stream and closes the file.
+\item
+\Indexc{write} (©ofstream© only) write ©size© bytes to the stream.
+The bytes are written lazily to file when internal buffers fill.
+Eager buffer writes are done with ©flush©
+\item
+\Indexc{read} (©ifstream© only) read ©size© bytes to the stream.
+\item
+\Indexc{ungetc} (©ifstream© only) pushes the character back to the input stream.
+Pushed-back characters returned by subsequent reads in the reverse order of pushing.
+\end{itemize}
+The constructor functions:
+\begin{itemize}[topsep=4pt,itemsep=2pt,parsep=0pt]
+\item
+create an unbound stream, which is subsequently bound to a file with ©open©.
+\item
+create a bound stream to the associated file with given ©mode©.
+\end{itemize}
+The destructor closes the stream.
+
+\begin{figure}
+\begin{cfa}
+// *********************************** ofstream ***********************************
+
+bool fail( ofstream & );$\indexc{fail}\index{ofstream@©ofstream©!©fail©}$
+void clear( ofstream & );$\indexc{clear}\index{ofstream@©ofstream©!©clear©}$
+int flush( ofstream & );$\indexc{flush}\index{ofstream@©ofstream©!©flush©}$
+void open( ofstream &, const char name[], const char mode[] = "w" );$\indexc{open}\index{ofstream@©ofstream©!©open©}$
+void close( ofstream & );$\indexc{close}\index{ofstream@©ofstream©!©close©}$
+ofstream & write( ofstream &, const char data[], size_t size );$\indexc{write}\index{ofstream@©ofstream©!©write©}$
+
+void ?{}( ofstream & );$\index{ofstream@©ofstream©!©?{}©}$
+void ?{}( ofstream &, const char name[], const char mode[] = "w" );
+void ^?{}( ofstream & );$\index{ofstream@©ofstream©!©^?{}©}$
+
+// *********************************** ifstream ***********************************
+
+bool fail( ifstream & is );$\indexc{fail}\index{ifstream@©ifstream©!©fail©}$
+void clear( ifstream & );$\indexc{clear}\index{ifstream@©ifstream©!©clear©}$
+bool eof( ifstream & is );$\indexc{eof}\index{ifstream@©ifstream©!©eof©}$
+void open( ifstream & is, const char name[], const char mode[] = "r" );$\indexc{open}\index{ifstream@©ifstream©!©open©}$
+void close( ifstream & is );$\indexc{close}\index{ifstream@©ifstream©!©close©}$
+ifstream & read( ifstream & is, char data[], size_t size );$\indexc{read}\index{ifstream@©ifstream©!©read©}$
+ifstream & ungetc( ifstream & is, char c );$\indexc{unget}\index{ifstream@©ifstream©!©unget©}$
+
+void ?{}( ifstream & is );$\index{ifstream@©ifstream©!©?{}©}$
+void ?{}( ifstream & is, const char name[], const char mode[] = "r" );
+void ^?{}( ifstream & is );$\index{ifstream@©ifstream©!©^?{}©}$
+\end{cfa}
+\caption{Stream Functions}
+\label{f:StreamFunctions}
+\end{figure}
 
 
@@ -4030,5 +4156,5 @@
 sout | wd( 4, "ab" ) | wd( 3, "ab" ) | wd( 2, "ab" );
 \end{cfa}
-\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
+\begin{cfa}[showspaces=true,aboveskip=0pt]
 ®  ®34 ® ®34 34
 ®  ®4.000000 ® ®4.000000 4.000000
@@ -4378,11 +4504,62 @@
 \end{cfa}
 
-\Textbf{WARNING:} ©printf©\index{printf@©printf©}, ©scanf©\index{scanf@©scanf©} and their derivatives are unsafe when used with user-level threading, as in \CFA.
-These stream routines use kernel-thread locking (©futex©\index{futex@©futex©}), which block kernel threads, to prevent interleaving of I/O.
-However, the following simple example illustrates how a deadlock can occur (other complex scenarios are possible).
-Assume a single kernel thread and two user-level threads calling ©printf©.
-One user-level thread acquires the I/O lock and is time-sliced while performing ©printf©.
-The other user-level thread then starts execution, calls ©printf©, and blocks the only kernel thread because it cannot acquire the I/O lock.
-It does not help if the kernel lock is multiple acquisition, \ie, the lock owner can acquire it multiple times, because it then results in two user threads in the ©printf© critical section, corrupting the stream.
+
+\section{String Stream}
+
+All the stream formatting capabilities are available to format text to/from a C string rather than to a stream file.
+\VRef[Figure]{f:StringStreamProcessing} shows writing (output) and reading (input) from a C string.
+\begin{figure}
+\begin{cfa}
+#include <fstream.hfa>
+#include <strstream.hfa>
+
+int main() {
+	enum { size = 256 };
+	char buf[size]; $\C{// output buffer}$
+	®ostrstream osstr = { buf, size };® $\C{// bind output buffer/size}$
+	int i = 3, j = 5, k = 7;
+	double x = 12345678.9, y = 98765.4321e-11;
+
+	osstr | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y)); $\C{// same lines of output}$
+	write( osstr );
+	printf( "%s", buf );
+	sout | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
+
+	char buf2[] = "12 14 15 3.5 7e4"; $\C{// input buffer}$
+	®istrstream isstr = { buf2 };®
+	isstr | i | j | k | x | y;
+	sout | i | j | k | x | y;
+}
+\end{cfa}
+\caption{String Stream Processing}
+\label{f:StringStreamProcessing}
+\end{figure}
+
+\VRef[Figure]{f:StringStreamFunctions} shows the string stream operations.
+\begin{itemize}[topsep=4pt,itemsep=2pt,parsep=0pt]
+\item
+\Indexc{write} (©ostrstream© only) writes all the buffered characters to the specified stream (©stdout© default).
+\end{itemize}
+The constructor functions:
+\begin{itemize}[topsep=4pt,itemsep=2pt,parsep=0pt]
+\item
+create a bound stream to a write buffer (©ostrstream©) of ©size© or a read buffer (©istrstream©) containing a C string terminated with ©'\0'©.
+\end{itemize}
+
+\begin{figure}
+\begin{cfa}
+// *********************************** ostrstream ***********************************
+
+ostrstream & write( ostrstream & os, FILE * stream = stdout );
+
+void ?{}( ostrstream &, char buf[], size_t size );
+
+// *********************************** istrstream ***********************************
+
+void ?{}( istrstream & is, char buf[] );
+\end{cfa}
+\caption{String Stream Functions}
+\label{f:StringStreamFunctions}
+\end{figure}
 
 
@@ -8111,8 +8288,8 @@
 \begin{cquote}
 \begin{tabular}{@{}l@{\hspace{\parindentlnth}}|@{\hspace{\parindentlnth}}l@{}}
-\multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{\CFA}}	& \multicolumn{1}{@{\hspace{\parindentlnth}}c}{\textbf{C}@{}}	\\
+\multicolumn{1}{@{}c|@{\hspace{\parindentlnth}}}{\textbf{\CFA}}	& \multicolumn{1}{@{\hspace{\parindentlnth}}c@{}}{\textbf{C}}	\\
 \hline
 \begin{cfa}
-#include <gmp>$\indexc{gmp}$
+#include <gmp.hfa>$\indexc{gmp}$
 int main( void ) {
 	sout | "Factorial Numbers";
Index: libcfa/src/fstream.cfa
===================================================================
--- libcfa/src/fstream.cfa	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ libcfa/src/fstream.cfa	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Apr 27 22:08:57 2021
-// Update Count     : 442
+// Last Modified On : Wed Apr 28 20:37:53 2021
+// Update Count     : 445
 //
 
@@ -114,4 +114,8 @@
 } // fail
 
+void clear( ofstream & os ) {
+	clearerr( (FILE *)(os.file$) );
+} // clear
+
 int flush( ofstream & os ) {
 	return fflush( (FILE *)(os.file$) );
@@ -207,4 +211,5 @@
 } // nl
 
+
 // *********************************** ifstream ***********************************
 
@@ -240,9 +245,13 @@
 } // fail
 
+void clear( ifstream & is ) {
+	clearerr( (FILE *)(is.file$) );
+} // clear
+
 void ends( ifstream & is ) {
 	if ( is.acquired$ ) { is.acquired$ = false; release( is ); }
 } // ends
 
-int eof( ifstream & is ) {
+bool eof( ifstream & is ) {
 	return feof( (FILE *)(is.file$) );
 } // eof
@@ -273,5 +282,5 @@
 } // close
 
-ifstream & read( ifstream & is, char * data, size_t size ) {
+ifstream & read( ifstream & is, char data[], size_t size ) {
 	if ( fail( is ) ) {
 		abort | IO_MSG "attempt read I/O on failed stream";
Index: libcfa/src/fstream.hfa
===================================================================
--- libcfa/src/fstream.hfa	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ libcfa/src/fstream.hfa	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Apr 27 22:00:30 2021
-// Update Count     : 226
+// Last Modified On : Wed Apr 28 20:37:57 2021
+// Update Count     : 230
 //
 
@@ -70,4 +70,5 @@
 
 bool fail( ofstream & );
+void clear( ofstream & );
 int flush( ofstream & );
 void open( ofstream &, const char name[], const char mode[] ); // FIX ME: use default = "w"
@@ -119,9 +120,10 @@
 
 bool fail( ifstream & is );
-int eof( ifstream & is );
+void clear( ifstream & );
+bool eof( ifstream & is );
 void open( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r"
 void open( ifstream & is, const char name[] );
 void close( ifstream & is );
-ifstream & read( ifstream & is, char * data, size_t size );
+ifstream & read( ifstream & is, char data[], size_t size );
 ifstream & ungetc( ifstream & is, char c );
 
Index: libcfa/src/iostream.hfa
===================================================================
--- libcfa/src/iostream.hfa	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ libcfa/src/iostream.hfa	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Apr 27 17:59:21 2021
-// Update Count     : 398
+// Last Modified On : Wed Apr 28 20:37:56 2021
+// Update Count     : 401
 //
 
@@ -52,6 +52,7 @@
 	
 trait ostream( ostype & | basic_ostream( ostype ) ) {
+	bool fail( ostype & );								// operation failed?
+	void clear( ostype & );
 	int flush( ostype & );
-	bool fail( ostype & );								// operation failed?
 	void open( ostype &, const char name[], const char mode[] );
 	void close( ostype & );
@@ -302,12 +303,13 @@
 	int fmt( istype &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
 	istype & ungetc( istype &, char );
-	int eof( istype & );
+	bool eof( istype & );
 }; // basic_istream
 
 trait istream( istype & | basic_istream( istype ) ) {
 	bool fail( istype & );
+	void clear( istype & );
 	void open( istype & is, const char name[] );
 	void close( istype & is );
-	istype & read( istype &, char *, size_t );
+	istype & read( istype &, char [], size_t );
 	void acquire( istype & );							// concurrent access
 }; // istream
Index: tests/strstream.cfa
===================================================================
--- tests/strstream.cfa	(revision c993b1521e96d36bed6b395f8eec5284bc85f5f5)
+++ tests/strstream.cfa	(revision 3eb55f9806679f91fcafa686a33e6c8fdb6a1639)
@@ -1,20 +1,37 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2021 University of Waterloo
+// 
+// strstream.cfa -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr 28 21:47:35 2021
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr 28 21:50:02 2021
+// Update Count     : 3
+// 
+
 #include <fstream.hfa>
 #include <strstream.hfa>
 
 int main() {
-    enum { size = 256 };
-    char buf[size];
-    ostrstream osstr = { buf, size };
-    int i = 3, j = 5, k = 7;
-    double x = 12345678.9, y = 98765.4321e-11;
+	enum { size = 256 };
+	char buf[size];										// output buffer
+	ostrstream osstr = { buf, size };					// bind output buffer/size
+	int i = 3, j = 5, k = 7;
+	double x = 12345678.9, y = 98765.4321e-11;
 
-    osstr | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
-    write( osstr );
-    printf( "%s", buf );
-    sout | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
+	osstr | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y)); // same lines of output
+	write( osstr );
+	printf( "%s", buf );
+	sout | i | hex(j) | wd(10, k) | sci(x) | unit(eng(y));
 
-    // char buf2[] = "12 14 15 3.5 7e4";
-    // istrstream isstr = { buf2 };
-    // isstr | i | j | k | x | y;
-    // sout | i | j | k | x | y;
+	// char buf2[] = "12 14 15 3.5 7e4";					// input buffer
+	// istrstream isstr = { buf2 };
+	// isstr | i | j | k | x | y;
+	// sout | i | j | k | x | y;
 }
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa strstream.cfa" //
+// End: //
