Index: libcfa/src/fstream.cfa
===================================================================
--- libcfa/src/fstream.cfa	(revision a51a02de31d78381190b6b5aafa5260020147369)
+++ libcfa/src/fstream.cfa	(revision a2e4b0cd8f28d66ff183eebe6d8cf6d6d3858dd9)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Sep 21 21:51:38 2021
-// Update Count     : 460
+// Last Modified On : Sun Oct 10 11:23:05 2021
+// Update Count     : 512
 //
 
@@ -28,5 +28,6 @@
 #define IO_MSG "I/O error: "
 
-void ?{}( ofstream & os, void * file ) with(os) {
+// private
+void ?{}( ofstream & os, void * file ) with( os ) {
 	file$ = file;
 	sepDefault$ = true;
@@ -35,5 +36,4 @@
 	prt$ = false;
 	sawNL$ = false;
-	acquired$ = false;
 	sepSetCur$( os, sepGet( os ) );
 	sepSet( os, " " );
@@ -41,30 +41,23 @@
 } // ?{}
 
-// private
-bool sepPrt$( ofstream & os ) { setNL$( os, false ); return os.sepOnOff$; }
-void sepReset$( ofstream & os ) { os.sepOnOff$ = os.sepDefault$; }
-void sepReset$( ofstream & os, bool reset ) { os.sepDefault$ = reset; os.sepOnOff$ = os.sepDefault$; }
-const char * sepGetCur$( ofstream & os ) { return os.sepCur$; }
-void sepSetCur$( ofstream & os, const char sepCur[] ) { os.sepCur$ = sepCur; }
-bool getNL$( ofstream & os ) { return os.sawNL$; }
-void setNL$( ofstream & os, bool state ) { os.sawNL$ = state; }
-bool getANL$( ofstream & os ) { return os.nlOnOff$; }
-bool getPrt$( ofstream & os ) { return os.prt$; }
-void setPrt$( ofstream & os, bool state ) { os.prt$ = state; }
+inline bool sepPrt$( ofstream & os ) { setNL$( os, false ); return os.sepOnOff$; }
+inline void sepReset$( ofstream & os ) { os.sepOnOff$ = os.sepDefault$; }
+inline void sepReset$( ofstream & os, bool reset ) { os.sepDefault$ = reset; os.sepOnOff$ = os.sepDefault$; }
+inline const char * sepGetCur$( ofstream & os ) { return os.sepCur$; }
+inline void sepSetCur$( ofstream & os, const char sepCur[] ) { os.sepCur$ = sepCur; }
+inline bool getNL$( ofstream & os ) { return os.sawNL$; }
+inline void setNL$( ofstream & os, bool state ) { os.sawNL$ = state; }
+inline bool getANL$( ofstream & os ) { return os.nlOnOff$; }
+inline bool getPrt$( ofstream & os ) { return os.prt$; }
+inline void setPrt$( ofstream & os, bool state ) { os.prt$ = state; }
+
+inline void lock( ofstream & os ) with( os ) {	lock( os.lock$ ); }
+inline void unlock( ofstream & os ) { unlock( os.lock$ ); }
 
 // public
 void ?{}( ofstream & os ) { os.file$ = 0p; }
-
-void ?{}( ofstream & os, const char name[], const char mode[] ) {
-	open( os, name, mode );
-} // ?{}
-
-void ?{}( ofstream & os, const char name[] ) {
-	open( os, name, "w" );
-} // ?{}
-
-void ^?{}( ofstream & os ) {
-	close( os );
-} // ^?{}
+void ?{}( ofstream & os, const char name[], const char mode[] ) { open( os, name, mode ); }
+void ?{}( ofstream & os, const char name[] ) { open( os, name, "w" ); }
+void ^?{}( ofstream & os ) { close( os ); }
 
 void sepOn( ofstream & os ) { os.sepOnOff$ = ! getNL$( os ); }
@@ -107,21 +100,18 @@
 	if ( &os == &exit ) exit( EXIT_FAILURE );
 	if ( &os == &abort ) abort();
-	if ( os.acquired$ ) { os.acquired$ = false; release( os ); }
 } // ends
 
-bool fail( ofstream & os ) {
-	return os.file$ == 0 || ferror( (FILE *)(os.file$) );
-} // fail
-
-void clear( ofstream & os ) {
-	clearerr( (FILE *)(os.file$) );
-} // clear
-
-int flush( ofstream & os ) {
-	return fflush( (FILE *)(os.file$) );
-} // flush
+bool fail( ofstream & os ) { return os.file$ == 0 || ferror( (FILE *)(os.file$) ); }
+void clear( ofstream & os ) { clearerr( (FILE *)(os.file$) ); }
+int flush( ofstream & os ) { return fflush( (FILE *)(os.file$) ); }
 
 void open( ofstream & os, const char name[], const char mode[] ) {
-	FILE * file = fopen( name, mode );
+	FILE * file;
+    for ( cnt; 10 ) {
+		errno = 0;
+		file = fopen( name, mode );
+	  if ( file != 0p || errno != EINTR ) break;		// timer interrupt ?
+	  if ( cnt == 9 ) abort( "ofstream open EINTR spinning exceeded" );
+    } // for
 	if ( file == 0p ) {
 		throw (Open_Failure){ os };
@@ -131,17 +121,22 @@
 } // open
 
-void open( ofstream & os, const char name[] ) {
-	open( os, name, "w" );
-} // open
-
-void close( ofstream & os ) with(os) {
+void open( ofstream & os, const char name[] ) { open( os, name, "w" ); }
+
+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 ) {
+	int ret;
+    for ( cnt; 10 ) {
+		errno = 0;
+		ret = fclose( (FILE *)(file$) );
+	  if ( ret != EOF || errno != EINTR ) break;		// timer interrupt ?
+	  if ( cnt == 9 ) abort( "ofstream open EINTR spinning exceeded" );
+    } // for
+	if ( ret == EOF ) {
 		throw (Close_Failure){ os };
 		// abort | IO_MSG "close output" | nl | strerror( errno );
 	} // if
-	file$ = 0p;
+	file$ = 0p;											// safety after close
 } // close
 
@@ -162,5 +157,12 @@
 	va_list args;
 	va_start( args, format );
-	int len = vfprintf( (FILE *)(os.file$), format, args );
+		
+	int len;
+    for ( cnt; 10 ) {
+		errno = 0;
+		len = vfprintf( (FILE *)(os.file$), format, args );
+	  if ( len != EOF || errno != EINTR ) break;		// timer interrupt ?
+	  if ( cnt == 9 ) abort( "ofstream fmt EINTR spinning exceeded" );
+    } // for
 	if ( len == EOF ) {
 		if ( ferror( (FILE *)(os.file$) ) ) {
@@ -175,4 +177,5 @@
 } // fmt
 
+<<<<<<< HEAD
 inline void acquire( ofstream & os ) with(os) {
 	lock( lock$ );										// may increase recursive lock
@@ -191,4 +194,6 @@
 void ^?{}( osacquire & acq ) { release( acq.os ); }
 
+=======
+>>>>>>> 15885de998d9500373efda8e609b893c87e6363a
 static ofstream soutFile = { (FILE *)stdout };
 ofstream & sout = soutFile, & stdout = soutFile;
@@ -208,9 +213,4 @@
 	flush( os );
 	return os;
-	// (ofstream &)(os | '\n');
-	// setPrt$( os, false );							// turn off
-	// setNL$( os, true );
-	// flush( os );
-	// return sepOff( os );							// prepare for next line
 } // nl
 
@@ -220,47 +220,38 @@
 
 // private
-void ?{}( ifstream & is, void * file ) with(is) {
+void ?{}( ifstream & is, void * file ) with( is ) {
 	file$ = file;
 	nlOnOff$ = false;
-	acquired$ = false;
-} // ?{}
+} // ?{}
+
+bool getANL$( ifstream & os ) { return os.nlOnOff$; }
+
+inline void lock( ifstream & os ) with( os ) { lock( os.lock$ ); }
+inline void unlock( ifstream & os ) { unlock( os.lock$ ); }
 
 // public
 void ?{}( ifstream & is ) { is.file$ = 0p; }
-
-void ?{}( ifstream & is, const char name[], const char mode[] ) {
-	open( is, name, mode );
-} // ?{}
-
-void ?{}( ifstream & is, const char name[] ) {
-	open( is, name, "r" );
-} // ?{}
-
-void ^?{}( ifstream & is ) {
-	close( is );
-} // ^?{}
+void ?{}( ifstream & is, const char name[], const char mode[] ) { open( is, name, mode ); }
+void ?{}( ifstream & is, const char name[] ) { open( is, name, "r" ); }
+void ^?{}( ifstream & is ) { close( is ); }
+
+bool fail( ifstream & is ) { return is.file$ == 0p || ferror( (FILE *)(is.file$) ); }
+void clear( ifstream & is ) { clearerr( (FILE *)(is.file$) ); }
 
 void nlOn( ifstream & os ) { os.nlOnOff$ = true; }
 void nlOff( ifstream & os ) { os.nlOnOff$ = false; }
-bool getANL( ifstream & os ) { return os.nlOnOff$; }
-
-bool fail( ifstream & is ) {
-	return is.file$ == 0p || ferror( (FILE *)(is.file$) );
-} // fail
-
-void clear( ifstream & is ) {
-	clearerr( (FILE *)(is.file$) );
-} // clear
-
-void ends( ifstream & is ) {
-	if ( is.acquired$ ) { is.acquired$ = false; release( is ); }
-} // ends
-
-bool eof( ifstream & is ) {
-	return feof( (FILE *)(is.file$) );
-} // eof
+
+void ends( ifstream & is ) {}
+
+bool eof( ifstream & is ) { return feof( (FILE *)(is.file$) ) != 0; }
 
 void open( ifstream & is, const char name[], const char mode[] ) {
-	FILE * file = fopen( name, mode );
+	FILE * file;
+    for ( cnt; 10 ) {
+		errno = 0;
+		file = fopen( name, mode );
+	  if ( file != 0p || errno != EINTR ) break;		// timer interrupt ?
+	  if ( cnt == 9 ) abort( "ifstream open EINTR spinning exceeded" );
+    } // for
 	if ( file == 0p ) {
 		throw (Open_Failure){ is };
@@ -270,17 +261,22 @@
 } // open
 
-void open( ifstream & is, const char name[] ) {
-	open( is, name, "r" );
-} // open
-
-void close( ifstream & is ) with(is) {
+void open( ifstream & is, const char name[] ) { open( is, name, "r" ); }
+
+void close( ifstream & is ) with( is ) {
   if ( (FILE *)(file$) == 0p ) return;
   if ( (FILE *)(file$) == (FILE *)stdin ) return;
 
-	if ( fclose( (FILE *)(file$) ) == EOF ) {
+	int ret;
+    for ( cnt; 10 ) {
+		errno = 0;
+		ret = fclose( (FILE *)(file$) );
+	  if ( ret != EOF || errno != EINTR ) break;		// timer interrupt ?
+	  if ( cnt == 9 ) abort( "ifstream close EINTR spinning exceeded" );
+    } // for
+	if ( ret == EOF ) {
 		throw (Close_Failure){ is };
 		// abort | IO_MSG "close input" | nl | strerror( errno );
 	} // if
-	file$ = 0p;
+	file$ = 0p;											// safety after close
 } // close
 
@@ -311,7 +307,12 @@
 int fmt( ifstream & is, const char format[], ... ) {
 	va_list args;
-
 	va_start( args, format );
-	int len = vfscanf( (FILE *)(is.file$), format, args );
+
+	int len;
+    for () {											// no check for EINTR limit waiting for keyboard input
+		errno = 0;
+		len = vfscanf( (FILE *)(is.file$), format, args );
+	  if ( len != EOF || errno != EINTR ) break;		// timer interrupt ?
+    } // for
 	if ( len == EOF ) {
 		if ( ferror( (FILE *)(is.file$) ) ) {
@@ -322,17 +323,4 @@
 	return len;
 } // fmt
-
-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
-
-inline void release( ifstream & is ) {
-	unlock( is.lock$ );
-} // release
-
-void ?{}( isacquire & acq, ifstream & is ) { lock( is.lock$ ); &acq.is = &is; }
-void ^?{}( isacquire & acq ) { release( acq.is ); }
 
 static ifstream sinFile = { (FILE *)stdin };
