Index: doc/theses/jiada_liang_MMath/CFAenum.tex
===================================================================
--- doc/theses/jiada_liang_MMath/CFAenum.tex	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ doc/theses/jiada_liang_MMath/CFAenum.tex	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -471,14 +471,15 @@
 	E e;
 
-	for () {
-		try {
-			@sin | e@;
-		} catch( missing_data * ) {
-			sout | "missing data";
-			continue; // try again
+	try {
+		for () {
+			try {
+				@sin | e@;
+			} catch( missing_data * ) {
+				sout | "missing data";
+				continue; // try again
+			}
+			sout | e | "= " | value( e );
 		}
-	  if ( eof( sin ) ) break;
-		sout | e | "= " | value( e );
-	}
+	} catch( end_of_file ) {}
 }
 \end{cfa}
Index: doc/user/user.tex
===================================================================
--- doc/user/user.tex	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ doc/user/user.tex	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -11,6 +11,6 @@
 %% Created On       : Wed Apr  6 14:53:29 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Fri Jul 26 06:56:11 2024
-%% Update Count     : 6955
+%% Last Modified On : Thu Aug 15 22:23:30 2024
+%% Update Count     : 6957
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -4656,5 +4656,5 @@
 \VRef[Figure]{f:CFACommand-LineProcessing} demonstrates the file operations by showing the 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.
-\Textbf{All I/O errors are handled as exceptions}, but end-of-file is not an exception as C programmers are use to explicitly checking for it.
+\Textbf{All unusual I/O cases are handled as exceptions, including end-of-file.}
 
 \begin{figure}
@@ -4686,9 +4686,11 @@
 	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
+	try {
+		for () {							§\C{// read/write characters}§
+			in | ch;
+			out | ch;
+		} // for
+	} catch( end_of_file * ) {				§\C{// end-of-file raised}§
+	} // try
 } // main
 \end{cfa}
Index: libcfa/src/collections/string_res.cfa
===================================================================
--- libcfa/src/collections/string_res.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ libcfa/src/collections/string_res.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Fri Sep 03 11:00:00 2021
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Apr 15 21:56:27 2024
-// Update Count     : 85
+// Last Modified On : Sat Aug 17 14:08:01 2024
+// Update Count     : 86
 //
 
@@ -251,5 +251,5 @@
 
 ifstream & ?|?( ifstream & is, _Istream_Rquoted f ) with( f.rstr ) {
-	if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+	if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 	int args;
   fini: {
Index: libcfa/src/enum.cfa
===================================================================
--- libcfa/src/enum.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ libcfa/src/enum.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -40,5 +40,5 @@
 istype & ?|?( istype & is, E & e ) {
 //	fprintf( stderr, "here0\n" );
-	if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+	if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 
 	// Match longest input enumerator string to enumerator labels, where enumerator names are unique.
@@ -59,4 +59,6 @@
 
 	fmt( is, " " );										// skip optional whitespace
+	if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
+
 	for ( c; max ) {									// scan columns of the label matix (some columns missing)
 		int args = fmt( is, "%c", &ch );				// read character
Index: libcfa/src/iostream.cfa
===================================================================
--- libcfa/src/iostream.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ libcfa/src/iostream.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Aug  2 07:38:44 2024
-// Update Count     : 2021
+// Last Modified On : Sat Aug 17 12:31:47 2024
+// Update Count     : 2038
 //
 
@@ -777,7 +777,7 @@
 forall( istype & | basic_istream( istype ) ) {
 	istype & ?|?( istype & is, bool & b ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int len = -1;									// len not set if no match
-		// Optional leading whitespace at start of strings.
+		// remove optional leading whitespace at start of strings.
 		fmt( is, " " FALSE "%n", &len );				// try false
 		if ( len != sizeof( FALSE ) - 1 ) {				// -1 removes null terminate
@@ -792,12 +792,12 @@
 
 	istype & ?|?( istype & is, char & c ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		char temp;
 		for () {
 			int args = fmt( is, "%c", &temp );
-			if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
+			if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
+			assert( args == 1 );						// if not EOF => a single character must be read
 			// do not overwrite parameter with newline unless appropriate
 			if ( temp != '\n' || getANL$( is ) ) { c = temp; break; }
-			if ( eof( is ) ) break;
 		} // for
 		return is;
@@ -805,13 +805,13 @@
 
 	istype & ?|?( istype & is, signed char & sc ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
-		int args = fmt( is, "%hhi", &sc );
-		if ( args != 1 ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
+		int args = fmt( is, "%hhi", &sc );				// can be multiple characters (100)
+		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
 		return is;
 	} // ?|?
 
 	istype & ?|?( istype & is, unsigned char & usc ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
-		int args = fmt( is, "%hhi", &usc );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
+		int args = fmt( is, "%hhi", &usc );				// can be multiple characters (-100)
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
 		return is;
@@ -819,5 +819,5 @@
 
 	istype & ?|?( istype & is, short int & si ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%hi", &si );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -826,5 +826,5 @@
 
 	istype & ?|?( istype & is, unsigned short int & usi ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%hi", &usi );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -833,5 +833,5 @@
 
 	istype & ?|?( istype & is, int & i ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%i", &i );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -840,5 +840,5 @@
 
 	istype & ?|?( istype & is, unsigned int & ui ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%i", &ui );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -847,5 +847,5 @@
 
 	istype & ?|?( istype & is, long int & li ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%li", &li );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -854,5 +854,5 @@
 
 	istype & ?|?( istype & is, unsigned long int & ulli ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%li", &ulli );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -861,5 +861,5 @@
 
 	istype & ?|?( istype & is, long long int & lli ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%lli", &lli );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -868,5 +868,5 @@
 
 	istype & ?|?( istype & is, unsigned long long int & ulli ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%lli", &ulli );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -891,5 +891,5 @@
 			} // for
 			if ( sign ) ullli = -ullli;
-		} else if ( sign ) ungetc( '-', is );			// return minus when no digits
+		} // if
 		return is;
 	} // ?|?
@@ -897,5 +897,5 @@
 
 	istype & ?|?( istype & is, float & f ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%f", &f );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -904,5 +904,5 @@
 
 	istype & ?|?( istype & is, double & d ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%lf", &d );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -911,5 +911,5 @@
 
 	istype & ?|?( istype & is, long double & ld ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args = fmt( is, "%Lf", &ld );
 		if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
@@ -918,5 +918,5 @@
 
 	istype & ?|?( istype & is, float _Complex & fc ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		float re, im;
 		int args = fmt( is, "%f%fi", &re, &im );
@@ -927,5 +927,5 @@
 
 	istype & ?|?( istype & is, double _Complex & dc ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		double re, im;
 		int args = fmt( is, "%lf%lfi", &re, &im );
@@ -936,5 +936,5 @@
 
 	istype & ?|?( istype & is, long double _Complex & ldc ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		long double re, im;
 		int args = fmt( is, "%Lf%Lfi", &re, &im );
@@ -945,5 +945,5 @@
 
 	istype & ?|?( istype & is, const char fmt[] ) {		// match text
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		size_t len = strlen( fmt );
 		char fmtstr[len + 16];
@@ -953,5 +953,5 @@
 		// scanf cursor does not move if no match
 		fmt( is, fmtstr, &len );
-		if ( ! eof( is ) && len == -1 ) throwResume ExceptionInst( missing_data );
+		if ( len == -1 ) throwResume ExceptionInst( missing_data );
 		return is;
 	} // ?|?
@@ -987,5 +987,5 @@
 forall( istype & | basic_istream( istype ) ) {
 	istype & ?|?( istype & is, _Istream_Cskip f ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		if ( f.scanset ) {
 			int nscanset = strlen(f.scanset);
@@ -1000,5 +1000,5 @@
 			for ( f.wd ) {								// skip N characters
 				int args = fmt( is, "%c", &ch );
-				if ( args != 1 ) throwResume ExceptionInst( missing_data );
+				if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data );
 			} // for
 		} // if
@@ -1007,5 +1007,5 @@
 
 	istype & ?|?( istype & is, _Istream_Cquoted f ) with( f.cstr ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		int args;
 	  fini: {
@@ -1032,5 +1032,5 @@
 
 	istype & ?|?( istype & is, _Istream_Cstr f ) with( f.cstr ) {
-		if ( eof( is ) ) throwResume ExceptionInst( missing_data );
+		if ( eof( is ) ) throwResume ExceptionInst( end_of_file );
 		const char * scanset;
 		size_t nscanset = 0;
Index: libcfa/src/iostream.hfa
===================================================================
--- libcfa/src/iostream.hfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ libcfa/src/iostream.hfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Aug  2 07:37:57 2024
-// Update Count     : 760
+// Last Modified On : Thu Aug 15 18:21:22 2024
+// Update Count     : 761
 //
 
@@ -374,4 +374,5 @@
 // *********************************** exceptions ***********************************
 
+ExceptionDecl( end_of_file );							// read encounters end of file
 ExceptionDecl( missing_data );							// read finds no appropriate data
 ExceptionDecl( cstring_length );						// character string size exceeded
Index: libcfa/src/parseconfig.cfa
===================================================================
--- libcfa/src/parseconfig.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ libcfa/src/parseconfig.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -105,10 +105,15 @@
 
 static [ bool ] comments( & ifstream in, size_t size, [] char name ) {
-	while () {
-		in | wdi( size, name );
-	  if ( eof( in ) ) return true;
-	  if ( name[0] != '#' ) return false;
-		in | nl;										// ignore remainder of line
-	} // while
+	bool comment = false;
+	try {
+		while () {
+			in | wdi( size, name );
+			if ( name[0] != '#' ) break;
+			in | nl;									// ignore remainder of line
+		} // while
+	} catch( end_of_file * ) {
+		comment = true;
+	} // try
+	return comment;
 } // comments
 
@@ -125,15 +130,17 @@
 		[256] char value;
 
-		while () {										// parameter names can appear in any order
-		  	// NOTE: Must add check to see if already read in value for this key,
-			// once we switch to using hash table as intermediate storage
-		  if ( comments( in, 64, key ) ) break;			// eof ?
-			in | wdi( 256, value );
-
-			add_kv_pair( *kv_pairs, key, value );
-
-		  if ( eof( in ) ) break;
-			in | nl;									// ignore remainder of line
-		} // for
+		try {
+			while () {										// parameter names can appear in any order
+				// NOTE: Must add check to see if already read in value for this key,
+				// once we switch to using hash table as intermediate storage
+				if ( comments( in, 64, key ) ) break;			// eof ?
+				in | wdi( 256, value );
+
+				add_kv_pair( *kv_pairs, key, value );
+
+				in | nl;									// ignore remainder of line
+			} // while
+		} catch( end_of_file * ) {
+		} // try
 	} catch( open_failure * ex; ex->istream == &in ) {
 		delete( kv_pairs );
Index: tests/.expect/copyfile.txt
===================================================================
--- tests/.expect/copyfile.txt	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/.expect/copyfile.txt	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Fri Jun 19 13:44:05 2020
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jun  5 21:20:07 2023
-// Update Count     : 5
+// Last Modified On : Sat Aug 17 14:18:47 2024
+// Update Count     : 11
 // 
 
@@ -22,10 +22,10 @@
 
 	try {
-		choose ( argc ) {
-		  case 2, 3:
+		choose ( argc ) {								// terminate if command-line errors
+		  case 3, 2:
 			open( in, argv[1] );						// open input file first as output creates file
 			if ( argc == 3 ) open( out, argv[2] );		// do not create output unless input opens
 		  case 1: ;										// use default files
-		  default:
+		  default:										// wrong number of options
 			exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
 		} // choose
@@ -41,13 +41,10 @@
 
 	char ch;
-	for () {											// read all characters
-		in | ch;
-	  if ( eof( in ) ) break;							// eof ?
-		out | ch;
-	} //for
+	try {
+		for () {										// read all characters
+			in | ch;
+			out | ch;
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa copyfile.cfa" //
-// End: //
Index: tests/.in/copyfile.txt
===================================================================
--- tests/.in/copyfile.txt	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/.in/copyfile.txt	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Fri Jun 19 13:44:05 2020
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jun  5 21:20:07 2023
-// Update Count     : 5
+// Last Modified On : Sat Aug 17 14:18:47 2024
+// Update Count     : 11
 // 
 
@@ -22,10 +22,10 @@
 
 	try {
-		choose ( argc ) {
-		  case 2, 3:
+		choose ( argc ) {								// terminate if command-line errors
+		  case 3, 2:
 			open( in, argv[1] );						// open input file first as output creates file
 			if ( argc == 3 ) open( out, argv[2] );		// do not create output unless input opens
 		  case 1: ;										// use default files
-		  default:
+		  default:										// wrong number of options
 			exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
 		} // choose
@@ -41,13 +41,10 @@
 
 	char ch;
-	for () {											// read all characters
-		in | ch;
-	  if ( eof( in ) ) break;							// eof ?
-		out | ch;
-	} //for
+	try {
+		for () {										// read all characters
+			in | ch;
+			out | ch;
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa copyfile.cfa" //
-// End: //
Index: tests/concurrency/examples/quickSort.cfa
===================================================================
--- tests/concurrency/examples/quickSort.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/concurrency/examples/quickSort.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -11,6 +11,6 @@
 // Created On       : Wed Dec  6 12:15:52 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jan  1 12:07:59 2024
-// Update Count     : 188
+// Last Modified On : Sat Aug 17 13:59:15 2024
+// Update Count     : 199
 //
 
@@ -145,29 +145,33 @@
 
 	if ( size == -1 ) {									// generate output ?
-		for () {
-			unsortedfile | size;						// read number of elements in the list
-		  if ( eof( unsortedfile ) ) break;
-
-			int * values = aalloc( size );				// values to be sorted, too large to put on stack
-			for ( counter; size ) {						// read unsorted numbers
-				unsortedfile | values[counter];
-				if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
-				sortedfile | values[counter];
-				if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
+		int * values = 0p;
+		try {
+			for () {
+				unsortedfile | size;					// read number of elements in the list
+				values = aalloc( size );				// values to be sorted, too large to put on stack
+				for ( counter; size ) {					// read unsorted numbers
+					unsortedfile | values[counter];
+					if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
+					sortedfile | values[counter];
+					if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
+				} // for
+				sortedfile | nl;
+
+				if ( size > 0 ) {						// values to sort ?
+					Quicksort QS = { values, size - 1, 0 }; // sort values
+				} // wait until sort tasks terminate
+				for ( counter; size ) {					// print sorted list
+					if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
+					sortedfile | values[counter];
+					if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
+				} // for
+				sortedfile | nl | nl;
+
+				delete( values );
+				values = 0p;
 			} // for
-			sortedfile | nl;
-
-			if ( size > 0 ) {							// values to sort ?
-				Quicksort QS = { values, size - 1, 0 }; // sort values
-			} // wait until sort tasks terminate
-			for ( counter; size ) {						// print sorted list
-				if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
-				sortedfile | values[counter];
-				if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
-			} // for
-			sortedfile | nl | nl;
-
+		} catch( end_of_file * ) {
 			delete( values );
-		} // for
+		} // try
 	} else {											// timing
 		PRNG prng;										
Index: tests/copyfile.cfa
===================================================================
--- tests/copyfile.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/copyfile.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Fri Jun 19 13:44:05 2020
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jun  5 21:20:19 2023
-// Update Count     : 7
+// Last Modified On : Sat Aug 17 14:18:47 2024
+// Update Count     : 11
 // 
 
@@ -23,5 +23,5 @@
 	try {
 		choose ( argc ) {								// terminate if command-line errors
-		  case 2, 3:
+		  case 3, 2:
 			open( in, argv[1] );						// open input file first as output creates file
 			if ( argc == 3 ) open( out, argv[2] );		// do not create output unless input opens
@@ -41,13 +41,10 @@
 
 	char ch;
-	for () {											// read all characters
-		in | ch;
-	  if ( eof( in ) ) break;							// eof ?
-		out | ch;
-	} // for
+	try {
+		for () {										// read all characters
+			in | ch;
+			out | ch;
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa copyfile.cfa" //
-// End: //
Index: tests/coroutine/.expect/fmtLines.txt
===================================================================
--- tests/coroutine/.expect/fmtLines.txt	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/coroutine/.expect/fmtLines.txt	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -9,70 +9,73 @@
 E" d  istr  ibut  ed w  ith   
 Cfor  all.  ////   fmt  Line  
-s.cc   --/  ///   Auth  or    
-             : P  eter   A.   
-Buhr  // C  reat  ed O  n     
-      : Su  n Se  p 17   21:  
-56:1  5 20  17//   Las  t Mo  
-difi  ed B  y :   Pete  r A.  
- Buh  r//   Last   Mod  ifie  
-d On   : F  ri M  ar 2  2 13  
-:41:  03 2  019/  / Up  date  
- Cou  nt       :   33/  /#in  
-clud  e <f  stre  am.h  fa>#  
-incl  ude   <cor  outi  ne.h  
-fa>c  orou  tine   For  mat   
-{	ch  ar c  h;		  				  				  
-	//   used   for   com  muni  
-cati  on	i  nt g  , b;  				  
-				  			/  / gl  obal   bec  
-ause   use  d in   des  truc  
-tor}  ;voi  d ?{  }( F  orma  
-t &   fmt   ) {      r  esum  
-e( f  mt )  ;			  				  			/  
-/ st  art   coro  utin  e}vo  
-id ^  ?{}(   For  mat   & fm  
-t )   {      if   ( fm  t.g   
-!= 0   ||   fmt.  b !=   0 )  
- sou  t |   nl;}  void   mai  
-n( F  orma  t &   fmt   ) {	  
-for   ( ;;   ) {  				  				  
-		//   for   as   many   cha  
-ract  ers	  	for   ( f  mt.g  
- = 0  ; fm  t.g   < 5;   fmt  
-.g +  = 1   ) {	  	//   grou  
+s.cc   --   form  at c  hara  
+cter  s in  to b  lock  s of  
+ 4 a  nd g  roup  s of   5 b  
+lock  s pe  r li  ne//  // A  
+utho  r                 : Pe  
+ter   A. B  uhr/  / Cr  eate  
+d On           :   Sun   Sep  
+ 17   21:5  6:15   201  7//   
+Last   Mod  ifie  d By   : P  
+eter   A.   Buhr  // L  ast   
+Modi  fied   On   : Sa  t Au  
+g 17   14:  26:0  3 20  24//  
+ Upd  ate   Coun  t       :   
+60//  #inc  lude   <fs  trea  
+m.hf  a>#i  nclu  de <  coro  
+utin  e.hf  a>co  rout  ine   
+Form  at {  	cha  r ch  ;			  
+				  				  // u  sed   for   
+comm  unic  atio  n	in  t g,  
+ b;	  				  				  		//   glo  
+bal   beca  use   used   in   
+dest  ruct  or};  void   mai  
+n( F  orma  t &   fmt   ) wi  
+th(   fmt   ) {	  for   () {  
+				  				  			/  / fo  r as  
+ man  y ch  arac  ters  		fo  
+r (   g =   0; g   < 5  ; g   
++= 1   ) {  				  	//   grou  
 ps o  f 5   bloc  ks		  	for  
- ( f  mt.b   = 0  ; fm  t.b   
-< 4;   fmt  .b +  = 1   ) {	  
-// b  lock  s of   4 c  hara  
-cter  s			  	for   ( ;  ; )   
-{			  				  // f  or n  ewli  
-ne c  hara  cter  s			  		su  
-spen  d;		  			i  f (   fmt.  
-ch !  = '\  n' )   bre  ak;	  
-	//   igno  re n  ewli  ne		  
-		}   // f  or		  		so  ut |  
- fmt  .ch;  				  			/  / pr  
-int   char  acte  r			  } //  
- for  			s  out   | "    ";	  
-				  			/  / pr  int   bloc  
-k se  para  tor	  	} /  / fo  
-r		s  out   | nl  ;			  				  
-		//   pri  nt g  roup   sep  
-arat  or	}   //   for}   //   
-main  void   prt  ( Fo  rmat  
- & f  mt,   char   ch   ) {   
-   f  mt.c  h =   ch;      r  
-esum  e( f  mt )  ;} /  / pr  
-tint   mai  n()   {	Fo  rmat  
- fmt  ;	ch  ar c  h;	f  or (  
- ;;   ) {	  	sin   | c  h;		  
-				  				  // r  ead   one   
-char  acte  r	    if (   eof  
-( si  n )   ) br  eak;  				  
-			/  / eo  f ?	  	prt  ( fm  
-t, c  h );  	} /  / fo  r} /  
-/ ma  in//   Loc  al V  aria  
-bles  : //  // t  ab-w  idth  
-: 4   ////   com  pile  -com  
-mand  : "c  fa f  mtLi  nes.  
-cfa"   ///  / En  d: /  /
+ ( b   = 0  ; b   < 4;   b +  
+= 1   ) {	  			/  / bl  ocks  
+ of   4 ch  arac  ters  				  
+for   () {  				  				  // f  
+or n  ewli  ne c  hara  cter  
+s			  		su  spen  d;		  		    
+if (   ch   != '  \n'   ) br  
+eak;  				  // i  gnor  e ne  
+wlin  e			  	} /  / fo  r			  
+	sou  t |   ch;	  				  			/  
+/ pr  int   char  acte  r			  
+} //   for  			s  out   | "   
+ ";	  				  			/  / pr  int   
+bloc  k se  para  tor	  	} /  
+/ fo  r		s  out   | nl  ;			  
+				  			/  / pr  int   grou  
+p se  para  tor	  } //   for  
+} //   mai  nvoi  d ?{  }( F  
+orma  t &   fmt   ) {	  resu  
+me(   fmt   );		  				  				  
+// p  rime   (st  art)   cor  
+outi  ne}v  oid   ^?{}  ( Fo  
+rmat   & f  mt )   wit  h( f  
+mt )   {	i  f (   g !=   0 |  
+| b   != 0   ) s  out   | nl  
+;}vo  id f  orma  t( F  orma  
+t &   fmt   ) {	  resu  me(   
+fmt   );}   // f  orma  tint  
+ mai  n()   {	Fo  rmat   fmt  
+;	so  ut |   nlO  ff;	  				  
+				  	//   turn   off   aut  
+o ne  wlin  e	tr  y {	  	for  
+ ()   {			  				  			/  / re  
+ad u  ntil   end   of   file  
+			s  in |   fmt  .ch;  				  
+				  // r  ead   one   char  
+acte  r			  form  at(   fmt   
+);		  				  		//   pus  h ch  
+arac  ter   for   form  atti  
+ng		  } //   for  	} c  atch  
+( en  d_of  _fil  e *   ) {	  
+} //   try  } //   mai  n
Index: tests/coroutine/.in/fmtLines.txt
===================================================================
--- tests/coroutine/.in/fmtLines.txt	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/coroutine/.in/fmtLines.txt	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -5,11 +5,11 @@
 // file "LICENCE" distributed with Cforall.
 //
-// fmtLines.cc --
+// fmtLines.cc -- format characters into blocks of 4 and groups of 5 blocks per line
 //
 // Author           : Peter A. Buhr
 // Created On       : Sun Sep 17 21:56:15 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Mar 22 13:41:03 2019
-// Update Count     : 33
+// Last Modified On : Sat Aug 17 14:26:03 2024
+// Update Count     : 60
 //
 
@@ -22,46 +22,42 @@
 };
 
-void ?{}( Format & fmt ) {
-    resume( fmt );										// start coroutine
-}
-
-void ^?{}( Format & fmt ) {
-    if ( fmt.g != 0 || fmt.b != 0 ) sout | nl;
-}
-
-void main( Format & fmt ) {
-	for ( ;; ) {										// for as many characters
-		for ( fmt.g = 0; fmt.g < 5; fmt.g += 1 ) {		// groups of 5 blocks
-			for ( fmt.b = 0; fmt.b < 4; fmt.b += 1 ) {	// blocks of 4 characters
-				for ( ;; ) {							// for newline characters
+void main( Format & fmt ) with( fmt ) {
+	for () {											// for as many characters
+		for ( g = 0; g < 5; g += 1 ) {					// groups of 5 blocks
+			for ( b = 0; b < 4; b += 1 ) {				// blocks of 4 characters
+				for () {								// for newline characters
 					suspend;
-					if ( fmt.ch != '\n' ) break;		// ignore newline
+				  if ( ch != '\n' ) break;				// ignore newline
 				} // for
-				sout | fmt.ch;							// print character
+				sout | ch;								// print character
 			} // for
 			sout | "  ";								// print block separator
 		} // for
-		sout | nl;									// print group separator
+		sout | nl;										// print group separator
 	} // for
 } // main
 
-void prt( Format & fmt, char ch ) {
-    fmt.ch = ch;
-    resume( fmt );
-} // prt
+void ?{}( Format & fmt ) {
+	resume( fmt );										// prime (start) coroutine
+}
+
+void ^?{}( Format & fmt ) with( fmt ) {
+	if ( g != 0 || b != 0 ) sout | nl;
+}
+
+void format( Format & fmt ) {
+	resume( fmt );
+} // format
 
 int main() {
 	Format fmt;
-	char ch;
+	sout | nlOff;										// turn off auto newline
 
-	for ( ;; ) {
-		sin | ch;										// read one character
-	  if ( eof( sin ) ) break;							// eof ?
-		prt( fmt, ch );
-	} // for
+	try {
+		for () {										// read until end of file
+			sin | fmt.ch;								// read one character
+			format( fmt );								// push character for formatting
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fmtLines.cfa" //
-// End: //
Index: tests/coroutine/cntparens.cfa
===================================================================
--- tests/coroutine/cntparens.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/coroutine/cntparens.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Sat Apr 20 11:04:45 2019
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Apr 20 11:06:21 2019
-// Update Count     : 1
+// Last Modified On : Thu Aug 15 20:39:34 2024
+// Update Count     : 2
 //
 
@@ -46,11 +46,14 @@
 	char ch;
 
-	for () {											// read until end of file
-		sin | ch;										// read one character
-	  if ( eof( sin ) ) { sout | "Error"; break; }		// eof ?
-		Status ret = next( cpns, ch );					// push character for formatting
-	  if ( ret == Match ) { sout | "Match"; break; }
-	  if ( ret == Error ) { sout | "Error"; break; }
-	} // for
+	try {
+		for () {											// read until end of file
+			sin | ch;										// read one character
+			Status ret = next( cpns, ch );					// push character for formatting
+			if ( ret == Match ) { sout | "Match"; break; }
+			if ( ret == Error ) { sout | "Error"; break; }
+		} // for
+	} catch( end_of_file * ) {
+		sout | "Error";
+	} // try
 } // main
 
Index: tests/coroutine/devicedriver.cfa
===================================================================
--- tests/coroutine/devicedriver.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/coroutine/devicedriver.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Sat Mar 16 15:30:34 2019
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jun 17 09:11:56 2023
-// Update Count     : 94
+// Last Modified On : Thu Aug 15 18:45:45 2024
+// Update Count     : 96
 //
 
@@ -71,15 +71,17 @@
 
 	sin | nlOn;											// read newline (all) characters
-  eof: for () {											// read until end of file
-		sin | byte;										// read one character
-	  if ( eof( sin ) ) break eof;						// eof ?
-		choose( next( driver, byte ) ) {				// analyse character
-		  case CONT: ;
-		  case MSG: sout | "msg:" | msg;
-		  case ESTX: sout | "STX in message";
-		  case ELNTH: sout | "message too long";
-		  case ECRC: sout | "CRC failure";
-		} // choose
-	} // for
+	try {
+		for () {										// read until end of file
+			sin | byte;									// read one character
+			choose( next( driver, byte ) ) {			// analyse character
+			  case CONT: ;
+			  case MSG: sout | "msg:" | msg;
+			  case ESTX: sout | "STX in message";
+			  case ELNTH: sout | "message too long";
+			  case ECRC: sout | "CRC failure";
+			} // choose
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
 
Index: tests/coroutine/fmtLines.cfa
===================================================================
--- tests/coroutine/fmtLines.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/coroutine/fmtLines.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Sun Sep 17 21:56:15 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Mar 22 13:41:16 2019
-// Update Count     : 58
+// Last Modified On : Sat Aug 17 14:26:03 2024
+// Update Count     : 60
 //
 
@@ -54,13 +54,10 @@
 	sout | nlOff;										// turn off auto newline
 
-  eof: for () {											// read until end of file
-		sin | fmt.ch;									// read one character
-	  if ( eof( sin ) ) break eof;						// eof ?
-		format( fmt );									// push character for formatting
-	} // for
+	try {
+		for () {										// read until end of file
+			sin | fmt.ch;								// read one character
+			format( fmt );								// push character for formatting
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fmtLines.cfa" //
-// End: //
Index: tests/enum_tests/input.cfa
===================================================================
--- tests/enum_tests/input.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/enum_tests/input.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -6,13 +6,15 @@
 	E e;
 
-	for () {
-		try {
-			sin | e;
-		} catch( missing_data * ) {
-			sout | "missing data";
-			continue;									// try again
-		} // try
-	  if ( eof( sin ) ) break;
-		sout | e | "= " | value( e );
-	} // for
-}
+	try {
+		for () {
+			try {
+				sin | e;
+			} catch( missing_data * ) {
+				sout | "missing data";
+				continue;								// try again
+			} // try
+			sout | e | "= " | value( e );
+		} // for
+	} catch( end_of_file * ) {
+	} // try
+} // main
Index: tests/generator/.expect/fmtLines.txt
===================================================================
--- tests/generator/.expect/fmtLines.txt	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/generator/.expect/fmtLines.txt	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -9,70 +9,72 @@
 E" d  istr  ibut  ed w  ith   
 Cfor  all.  ////   fmt  Line  
-s.cc   --/  ///   Auth  or    
-             : P  eter   A.   
-Buhr  // C  reat  ed O  n     
-      : Su  n Se  p 17   21:  
-56:1  5 20  17//   Las  t Mo  
-difi  ed B  y :   Pete  r A.  
- Buh  r//   Last   Mod  ifie  
-d On   : F  ri M  ar 2  2 13  
-:41:  03 2  019/  / Up  date  
- Cou  nt       :   33/  /#in  
-clud  e <f  stre  am.h  fa>#  
-incl  ude   <cor  outi  ne.h  
-fa>c  orou  tine   For  mat   
-{	ch  ar c  h;		  				  				  
-	//   used   for   com  muni  
-cati  on	i  nt g  , b;  				  
-				  			/  / gl  obal   bec  
-ause   use  d in   des  truc  
-tor}  ;voi  d ?{  }( F  orma  
-t &   fmt   ) {      r  esum  
-e( f  mt )  ;			  				  			/  
-/ st  art   coro  utin  e}vo  
-id ^  ?{}(   For  mat   & fm  
-t )   {      if   ( fm  t.g   
-!= 0   ||   fmt.  b !=   0 )  
- sou  t |   nl;}  void   mai  
-n( F  orma  t &   fmt   ) {	  
-for   ( ;;   ) {  				  				  
-		//   for   as   many   cha  
-ract  ers	  	for   ( f  mt.g  
- = 0  ; fm  t.g   < 5;   fmt  
-.g +  = 1   ) {	  	//   grou  
-ps o  f 5   bloc  ks		  	for  
- ( f  mt.b   = 0  ; fm  t.b   
-< 4;   fmt  .b +  = 1   ) {	  
-// b  lock  s of   4 c  hara  
-cter  s			  	for   ( ;  ; )   
-{			  				  // f  or n  ewli  
-ne c  hara  cter  s			  		su  
-spen  d;		  			i  f (   fmt.  
-ch !  = '\  n' )   bre  ak;	  
-	//   igno  re n  ewli  ne		  
-		}   // f  or		  		so  ut |  
- fmt  .ch;  				  			/  / pr  
-int   char  acte  r			  } //  
- for  			s  out   | "    ";	  
-				  			/  / pr  int   bloc  
-k se  para  tor	  	} /  / fo  
-r		s  out   | nl  ;			  				  
-		//   pri  nt g  roup   sep  
-arat  or	}   //   for}   //   
-main  void   prt  ( Fo  rmat  
- & f  mt,   char   ch   ) {   
-   f  mt.c  h =   ch;      r  
-esum  e( f  mt )  ;} /  / pr  
-tint   mai  n()   {	Fo  rmat  
- fmt  ;	ch  ar c  h;	f  or (  
- ;;   ) {	  	sin   | c  h;		  
-				  				  // r  ead   one   
-char  acte  r	    if (   eof  
-( si  n )   ) br  eak;  				  
-			/  / eo  f ?	  	prt  ( fm  
-t, c  h );  	} /  / fo  r} /  
-/ ma  in//   Loc  al V  aria  
-bles  : //  // t  ab-w  idth  
-: 4   ////   com  pile  -com  
-mand  : "c  fa f  mtLi  nes.  
-cfa"   ///  / En  d: /  /
+s.cf  a --   for  mat   char  
+acte  rs i  nto   bloc  ks o  
+f 4   and   grou  ps o  f 5   
+bloc  ks p  er l  ine/  ///   
+Auth  or                 : T  
+hier  ry D  elis  le//   Cre  
+ated   On           :   Thu   
+Mar    5 1  6:09  :08   2020  
+// L  ast   Modi  fied   By   
+: Pe  ter   A. B  uhr/  / La  
+st M  odif  ied   On :   Sat  
+ Aug   17   14:2  1:28   202  
+4//   Upda  te C  ount        
+ : 5  //#i  nclu  de <  fstr  
+eam.  hfa>  gene  rato  r Fo  
+rmat   {	c  har   ch;	  				  
+				  		//   use  d fo  r co  
+mmun  icat  ion	  int   g, b  
+;			  				  				  // g  loba  
+l be  caus  e us  ed i  n de  
+stru  ctor  };vo  id m  ain(  
+ For  mat   & fm  t )   with  
+( fm  t )   {	fo  r ()   {		  
+				  				  	//   for   as m  
+any   char  acte  rs		  for   
+( g   = 0;   g <   5;   g +=  
+ 1 )   {		  			/  / gr  oups  
+ of   5 bl  ocks  			f  or (  
+ b =   0;   b <   4; b   +=   
+1 )   {			  	//   bloc  ks o  
+f 4   char  acte  rs		  		fo  
+r ()   {		  				  		//   for  
+ new  line   cha  ract  ers	  
+				  susp  end;  				    if  
+ ( c  h !=   '\n  ' )   brea  
+k;		  		//   ign  ore   newl  
+ine	  			}   //   for	  			s  
+out   | ch  ;			  				  	//   
+prin  t ch  arac  ter	  		}   
+// f  or		  	sou  t |   "  "  
+;			  				  	//   prin  t bl  
+ock   sepa  rato  r		}   //   
+for	  	sou  t |   nl;	  				  
+				  	//   prin  t gr  oup   
+sepa  rato  r	}   // f  or}   
+// m  ainv  oid   ?{}(   For  
+mat   & fm  t )   {	re  sume  
+( fm  t );  				  				  		//  
+ pri  me (  star  t) c  orou  
+tine  }voi  d ^?  {}(   Form  
+at &   fmt   ) w  ith(   fmt  
+ ) {  	if   ( g   != 0   ||   
+b !=   0 )   sou  t |   nl;}  
+void   for  mat(   For  mat   
+& fm  t )   {	re  sume  ( fm  
+t );  } //   for  mati  nt m  
+ain(  ) {	  Form  at f  mt;	  
+sout   | n  lOff  ;			  				  
+			/  / tu  rn o  ff a  uto   
+newl  ine	  try   {		f  or (  
+) {	  				  				  	//   read  
+ unt  il e  nd o  f fi  le		  
+	sin   | f  mt.c  h;		  				  
+		//   rea  d on  e ch  arac  
+ter	  		fo  rmat  ( fm  t );  
+				  				  // p  ush   char  
+acte  r fo  r fo  rmat  ting  
+		}   // f  or	}   cat  ch(   
+end_  of_f  ile   * )   {	}   
+// t  ry}   // m  ain
Index: tests/generator/.in/fmtLines.txt
===================================================================
--- tests/generator/.in/fmtLines.txt	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/generator/.in/fmtLines.txt	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -5,63 +5,58 @@
 // file "LICENCE" distributed with Cforall.
 //
-// fmtLines.cc --
+// fmtLines.cfa -- format characters into blocks of 4 and groups of 5 blocks per line
 //
-// Author           : Peter A. Buhr
-// Created On       : Sun Sep 17 21:56:15 2017
+// Author           : Thierry Delisle
+// Created On       : Thu Mar  5 16:09:08 2020
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Mar 22 13:41:03 2019
-// Update Count     : 33
+// Last Modified On : Sat Aug 17 14:21:28 2024
+// Update Count     : 5
 //
 
 #include <fstream.hfa>
-#include <coroutine.hfa>
 
-coroutine Format {
+generator Format {
 	char ch;											// used for communication
 	int g, b;											// global because used in destructor
 };
 
-void ?{}( Format & fmt ) {
-    resume( fmt );										// start coroutine
-}
-
-void ^?{}( Format & fmt ) {
-    if ( fmt.g != 0 || fmt.b != 0 ) sout | nl;
-}
-
-void main( Format & fmt ) {
-	for ( ;; ) {										// for as many characters
-		for ( fmt.g = 0; fmt.g < 5; fmt.g += 1 ) {		// groups of 5 blocks
-			for ( fmt.b = 0; fmt.b < 4; fmt.b += 1 ) {	// blocks of 4 characters
-				for ( ;; ) {							// for newline characters
+void main( Format & fmt ) with( fmt ) {
+	for () {											// for as many characters
+		for ( g = 0; g < 5; g += 1 ) {					// groups of 5 blocks
+			for ( b = 0; b < 4; b += 1 ) {				// blocks of 4 characters
+				for () {								// for newline characters
 					suspend;
-					if ( fmt.ch != '\n' ) break;		// ignore newline
+				  if ( ch != '\n' ) break;				// ignore newline
 				} // for
-				sout | fmt.ch;							// print character
+				sout | ch;								// print character
 			} // for
 			sout | "  ";								// print block separator
 		} // for
-		sout | nl;									// print group separator
+		sout | nl;										// print group separator
 	} // for
 } // main
 
-void prt( Format & fmt, char ch ) {
-    fmt.ch = ch;
-    resume( fmt );
-} // prt
+void ?{}( Format & fmt ) {
+	resume( fmt );										// prime (start) coroutine
+}
+
+void ^?{}( Format & fmt ) with( fmt ) {
+	if ( g != 0 || b != 0 ) sout | nl;
+}
+
+void format( Format & fmt ) {
+	resume( fmt );
+} // format
 
 int main() {
 	Format fmt;
-	char ch;
+	sout | nlOff;										// turn off auto newline
 
-	for ( ;; ) {
-		sin | ch;										// read one character
-	  if ( eof( sin ) ) break;							// eof ?
-		prt( fmt, ch );
-	} // for
+	try {
+		for () {										// read until end of file
+			sin | fmt.ch;								// read one character
+			format( fmt );								// push character for formatting
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fmtLines.cfa" //
-// End: //
Index: tests/generator/fmtLines.cfa
===================================================================
--- tests/generator/fmtLines.cfa	(revision afb15cfcfe805e4a6a4f0f183c6d2fcd6a5137bb)
+++ tests/generator/fmtLines.cfa	(revision 3ac5fd8bcb3728ce8676e2b55b9fd4f691a06719)
@@ -10,6 +10,6 @@
 // Created On       : Thu Mar  5 16:09:08 2020
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jun 10 21:56:22 2021
-// Update Count     : 2
+// Last Modified On : Sat Aug 17 14:21:28 2024
+// Update Count     : 5
 //
 
@@ -53,13 +53,10 @@
 	sout | nlOff;										// turn off auto newline
 
-  eof: for () {											// read until end of file
-		sin | fmt.ch;									// read one character
-	  if ( eof( sin ) ) break eof;						// eof ?
-		format( fmt );									// push character for formatting
-	} // for
+	try {
+		for () {										// read until end of file
+			sin | fmt.ch;								// read one character
+			format( fmt );								// push character for formatting
+		} // for
+	} catch( end_of_file * ) {
+	} // try
 } // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fmtLines.cfa" //
-// End: //
