Index: libcfa/src/fstream.cfa
===================================================================
--- libcfa/src/fstream.cfa	(revision 0156cdd391a7fe6202bdfbd1d050279980599e97)
+++ libcfa/src/fstream.cfa	(revision 949339bcf1a4b73094f56400ac11f28f3946ade1)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jul 29 22:34:10 2021
-// Update Count     : 454
+// Last Modified On : Tue Sep 21 21:51:38 2021
+// Update Count     : 460
 //
 
@@ -28,12 +28,12 @@
 #define IO_MSG "I/O error: "
 
-void ?{}( ofstream & os, void * file ) {
-	os.file$ = file;
-	os.sepDefault$ = true;
-	os.sepOnOff$ = false;
-	os.nlOnOff$ = true;
-	os.prt$ = false;
-	os.sawNL$ = false;
-	os.acquired$ = false;
+void ?{}( ofstream & os, void * file ) with(os) {
+	file$ = file;
+	sepDefault$ = true;
+	sepOnOff$ = false;
+	nlOnOff$ = true;
+	prt$ = false;
+	sawNL$ = false;
+	acquired$ = false;
 	sepSetCur$( os, sepGet( os ) );
 	sepSet( os, " " );
@@ -124,11 +124,9 @@
 void open( ofstream & os, const char name[], const char mode[] ) {
 	FILE * file = fopen( name, mode );
-	// #ifdef __CFA_DEBUG__
 	if ( file == 0p ) {
 		throw (Open_Failure){ os };
 		// abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
 	} // if
-	// #endif // __CFA_DEBUG__
-	(os){ file };
+	(os){ file };										// initialize 
 } // open
 
@@ -137,13 +135,13 @@
 } // open
 
-void close( ofstream & os ) {
-  if ( (FILE *)(os.file$) == 0p ) return;
-  if ( (FILE *)(os.file$) == (FILE *)stdout || (FILE *)(os.file$) == (FILE *)stderr ) return;
-
-	if ( fclose( (FILE *)(os.file$) ) == EOF ) {
+void close( ofstream & os ) with(os) {
+  if ( (FILE *)(file$) == 0p ) return;
+  if ( (FILE *)(file$) == (FILE *)stdout || (FILE *)(file$) == (FILE *)stderr ) return;
+
+	if ( fclose( (FILE *)(file$) ) == EOF ) {
 		throw (Close_Failure){ os };
 		// abort | IO_MSG "close output" | nl | strerror( errno );
 	} // if
-	os.file$ = 0p;
+	file$ = 0p;
 } // close
 
@@ -177,8 +175,8 @@
 } // fmt
 
-inline void acquire( ofstream & os ) {
-	lock( os.lock$ );
-	if ( ! os.acquired$ ) os.acquired$ = true;
-	else unlock( os.lock$ );
+inline void acquire( ofstream & os ) with(os) {
+	lock( lock$ );										// may increase recursive lock
+	if ( ! acquired$ ) acquired$ = true;				// not locked ?
+	else unlock( lock$ );								// unwind recursive lock at start
 } // acquire
 
@@ -187,5 +185,5 @@
 } // release
 
-void ?{}( osacquire & acq, ofstream & os ) { &acq.os = &os; lock( os.lock$ ); }
+void ?{}( osacquire & acq, ofstream & os ) { lock( os.lock$ ); &acq.os = &os; }
 void ^?{}( osacquire & acq ) { release( acq.os ); }
 
@@ -219,8 +217,8 @@
 
 // private
-void ?{}( ifstream & is, void * file ) {
-	is.file$ = file;
-	is.nlOnOff$ = false;
-	is.acquired$ = false;
+void ?{}( ifstream & is, void * file ) with(is) {
+	file$ = file;
+	nlOnOff$ = false;
+	acquired$ = false;
 } // ?{}
 
@@ -262,11 +260,9 @@
 void open( ifstream & is, const char name[], const char mode[] ) {
 	FILE * file = fopen( name, mode );
-	// #ifdef __CFA_DEBUG__
 	if ( file == 0p ) {
 		throw (Open_Failure){ is };
 		// abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
 	} // if
-	// #endif // __CFA_DEBUG__
-	is.file$ = file;
+	(is){ file };										// initialize 
 } // open
 
@@ -275,13 +271,13 @@
 } // open
 
-void close( ifstream & is ) {
-  if ( (FILE *)(is.file$) == 0p ) return;
-  if ( (FILE *)(is.file$) == (FILE *)stdin ) return;
-
-	if ( fclose( (FILE *)(is.file$) ) == EOF ) {
+void close( ifstream & is ) with(is) {
+  if ( (FILE *)(file$) == 0p ) return;
+  if ( (FILE *)(file$) == (FILE *)stdin ) return;
+
+	if ( fclose( (FILE *)(file$) ) == EOF ) {
 		throw (Close_Failure){ is };
 		// abort | IO_MSG "close input" | nl | strerror( errno );
 	} // if
-	is.file$ = 0p;
+	file$ = 0p;
 } // close
 
@@ -324,8 +320,8 @@
 } // fmt
 
-inline void acquire( ifstream & is ) {
-	lock( is.lock$ );
-	if ( ! is.acquired$ ) is.acquired$ = true;
-	else unlock( is.lock$ );
+inline void acquire( ifstream & is ) with(is) {
+	lock( lock$ );										// may increase recursive lock
+	if ( ! acquired$ ) acquired$ = true;				// not locked ?
+	else unlock( lock$ );								// unwind recursive lock at start
 } // acquire
 
@@ -334,5 +330,5 @@
 } // release
 
-void ?{}( isacquire & acq, ifstream & is ) { &acq.is = &is; lock( is.lock$ ); }
+void ?{}( isacquire & acq, ifstream & is ) { lock( is.lock$ ); &acq.is = &is; }
 void ^?{}( isacquire & acq ) { release( acq.is ); }
 
@@ -347,14 +343,14 @@
 
 // exception I/O constructors
-void ?{}( Open_Failure & this, ofstream & ostream ) {
-	this.virtual_table = &Open_Failure_vt;
-	this.ostream = &ostream;
-	this.tag = 1;
-} // ?{}
-
-void ?{}( Open_Failure & this, ifstream & istream ) {
-	this.virtual_table = &Open_Failure_vt;
-	this.istream = &istream;
-	this.tag = 0;
+void ?{}( Open_Failure & ex, ofstream & ostream ) with(ex) {
+	virtual_table = &Open_Failure_vt;
+	ostream = &ostream;
+	tag = 1;
+} // ?{}
+
+void ?{}( Open_Failure & ex, ifstream & istream ) with(ex) {
+	virtual_table = &Open_Failure_vt;
+	istream = &istream;
+	tag = 0;
 } // ?{}
 
@@ -363,14 +359,14 @@
 
 // exception I/O constructors
-void ?{}( Close_Failure & this, ofstream & ostream ) {
-	this.virtual_table = &Close_Failure_vt;
-	this.ostream = &ostream;
-	this.tag = 1;
-} // ?{}
-
-void ?{}( Close_Failure & this, ifstream & istream ) {
-	this.virtual_table = &Close_Failure_vt;
-	this.istream = &istream;
-	this.tag = 0;
+void ?{}( Close_Failure & ex, ofstream & ostream ) with(ex) {
+	virtual_table = &Close_Failure_vt;
+	ostream = &ostream;
+	tag = 1;
+} // ?{}
+
+void ?{}( Close_Failure & ex, ifstream & istream ) with(ex) {
+	virtual_table = &Close_Failure_vt;
+	istream = &istream;
+	tag = 0;
 } // ?{}
 
@@ -379,14 +375,14 @@
 
 // exception I/O constructors
-void ?{}( Write_Failure & this, ofstream & ostream ) {
-	this.virtual_table = &Write_Failure_vt;
-	this.ostream = &ostream;
-	this.tag = 1;
-} // ?{}
-
-void ?{}( Write_Failure & this, ifstream & istream ) {
-	this.virtual_table = &Write_Failure_vt;
-	this.istream = &istream;
-	this.tag = 0;
+void ?{}( Write_Failure & ex, ofstream & ostream ) with(ex) {
+	virtual_table = &Write_Failure_vt;
+	ostream = &ostream;
+	tag = 1;
+} // ?{}
+
+void ?{}( Write_Failure & ex, ifstream & istream ) with(ex) {
+	virtual_table = &Write_Failure_vt;
+	istream = &istream;
+	tag = 0;
 } // ?{}
 
@@ -395,14 +391,14 @@
 
 // exception I/O constructors
-void ?{}( Read_Failure & this, ofstream & ostream ) {
-	this.virtual_table = &Read_Failure_vt;
-	this.ostream = &ostream;
-	this.tag = 1;
-} // ?{}
-
-void ?{}( Read_Failure & this, ifstream & istream ) {
-	this.virtual_table = &Read_Failure_vt;
-	this.istream = &istream;
-	this.tag = 0;
+void ?{}( Read_Failure & ex, ofstream & ostream ) with(ex) {
+	virtual_table = &Read_Failure_vt;
+	ostream = &ostream;
+	tag = 1;
+} // ?{}
+
+void ?{}( Read_Failure & ex, ifstream & istream ) with(ex) {
+	virtual_table = &Read_Failure_vt;
+	istream = &istream;
+	tag = 0;
 } // ?{}
 
