Merge jv
authorMerge Script
Thu, 01 Oct 2015 06:52:24 +0200
branchjv
changeset 18786 237a87b4fe8f
parent 18773 4f6a5cbce3a9 (current diff)
parent 18785 5b58b205c252 (diff)
child 18800 02724cc719b6
Merge
DirectoryStream.st
ExternalStream.st
FileStream.st
ObjectMemory.st
PipeStream.st
ProcessorScheduler.st
--- a/DirectoryStream.st	Wed Sep 30 07:05:15 2015 +0200
+++ b/DirectoryStream.st	Thu Oct 01 06:52:24 2015 +0200
@@ -583,135 +583,135 @@
 
     ok = false;
     if (__INST(dirPointer) == nil) {
-	if (__isStringLike(encodedPathName)) {
-	    __BEGIN_INTERRUPTABLE__
-	    __threadErrno = 0;
-	    do {
-		d = opendir((char *) __stringVal(encodedPathName));
-	    } while ((d == NULL) && (__threadErrno == EINTR));
-	    __END_INTERRUPTABLE__
+        if (__isStringLike(encodedPathName)) {
+            __BEGIN_INTERRUPTABLE__
+            __threadErrno = 0;
+            do {
+                d = opendir((char *) __stringVal(encodedPathName));
+            } while ((d == NULL) && (__threadErrno == EINTR));
+            __END_INTERRUPTABLE__
 
-	    if (d == NULL) {
-		error = __mkSmallInteger(__threadErrno);
-	    } else {
-		dp = __MKEXTERNALADDRESS(d); __INST(dirPointer) = dp; __STORE(self, dp);
-		ok = true;
-	    }
-	}
+            if (d == NULL) {
+                error = __mkSmallInteger(__threadErrno);
+            } else {
+                dp = __MKEXTERNALADDRESS(d); __INST(dirPointer) = dp; __STORE(self, dp);
+                ok = true;
+            }
+        }
     }
 #else
 #ifdef WIN32
     HANDLE d;
     OBJ path, dp;
     union {
-	char pattern[MAXPATHLEN];
-	wchar_t wpattern[MAXPATHLEN];
+        char pattern[MAXPATHLEN];
+        wchar_t wpattern[MAXPATHLEN];
     } uP;
     union {
-	WIN32_FIND_DATAA data;
-	WIN32_FIND_DATAW wdata;
+        WIN32_FIND_DATAA data;
+        WIN32_FIND_DATAW wdata;
     } uD;
 
     ok = false;
     if (__INST(dirPointer) == nil) {
-	path = __INST(pathName);
-	if (__isStringLike(path)) {
-	    int l = __stringSize(path);
+        path = __INST(pathName);
+        if (__isStringLike(path)) {
+            int l = __stringSize(path);
 
-	    if (l < (MAXPATHLEN-4)) {
-		strncpy(uP.pattern, __stringVal(path), l);
-		strcpy(uP.pattern+l, "\\*");
+            if (l < (MAXPATHLEN-4)) {
+                strncpy(uP.pattern, __stringVal(path), l);
+                strcpy(uP.pattern+l, "\\*");
 
-		do {
-		    __threadErrno = 0;
-		    d = STX_API_NOINT_CALL2( "FindFirstFileA", FindFirstFileA, uP.pattern, &uD.data );
-		} while ((d < 0) && (__threadErrno == EINTR));
+                do {
+                    __threadErrno = 0;
+                    d = STX_API_NOINT_CALL2( "FindFirstFileA", FindFirstFileA, uP.pattern, &uD.data );
+                } while ((d < 0) && (__threadErrno == EINTR));
 
-		if (d == INVALID_HANDLE_VALUE) {
-		    error = __mkSmallInteger(GetLastError());
-		} else {
-		    dp = __MKEXTERNALADDRESS(d); __INST(dirPointer) = dp; __STORE(self, dp);
+                if (d == INVALID_HANDLE_VALUE) {
+                    error = __mkSmallInteger(GetLastError());
+                } else {
+                    dp = __MKEXTERNALADDRESS(d); __INST(dirPointer) = dp; __STORE(self, dp);
 
-		    fileSize   = __MKLARGEINT64(1, uD.data.nFileSizeLow, uD.data.nFileSizeHigh );
-		    osPathname = __MKSTRING( uD.data.cFileName );
-		    osFileAttributes = __mkSmallInteger( uD.data.dwFileAttributes );
+                    fileSize   = __MKLARGEINT64(1, uD.data.nFileSizeLow, uD.data.nFileSizeHigh );
+                    osPathname = __MKSTRING( uD.data.cFileName );
+                    osFileAttributes = __mkSmallInteger( uD.data.dwFileAttributes );
 
-		    osCrtTime = FileTimeToOsTime(&uD.data.ftCreationTime);
-		    osAccTime = FileTimeToOsTime(&uD.data.ftLastAccessTime);
-		    osModTime = FileTimeToOsTime(&uD.data.ftLastWriteTime);
-		    ok = true;
-		}
-	    }
-	}
-	else if (__isUnicode16String(path)) {
-	    int l = __unicode16StringSize(path);
-	    int i;
+                    osCrtTime = FileTimeToOsTime(&uD.data.ftCreationTime);
+                    osAccTime = FileTimeToOsTime(&uD.data.ftLastAccessTime);
+                    osModTime = FileTimeToOsTime(&uD.data.ftLastWriteTime);
+                    ok = true;
+                }
+            }
+        }
+        else if (__isUnicode16String(path)) {
+            int l = __unicode16StringSize(path);
+            int i;
 
-	    if (l < (MAXPATHLEN-4)) {
-		for (i=0; i<l; i++) {
-		    uP.wpattern[i] = __unicode16StringVal(path)[i];
-		}
-		uP.wpattern[i++] = '\\';
-		uP.wpattern[i++] = '*';
-		uP.wpattern[i] = 0;
+            if (l < (MAXPATHLEN-4)) {
+                for (i=0; i<l; i++) {
+                    uP.wpattern[i] = __unicode16StringVal(path)[i];
+                }
+                uP.wpattern[i++] = '\\';
+                uP.wpattern[i++] = '*';
+                uP.wpattern[i] = 0;
 
-		do {
-		    __threadErrno = 0;
-		    d = STX_API_NOINT_CALL2( "FindFirstFileW", FindFirstFileW, uP.wpattern, &uD.wdata );
-		} while ((d < 0) && (__threadErrno == EINTR));
+                do {
+                    __threadErrno = 0;
+                    d = STX_API_NOINT_CALL2( "FindFirstFileW", FindFirstFileW, uP.wpattern, &uD.wdata );
+                } while ((d < 0) && (__threadErrno == EINTR));
 
-		if (d == INVALID_HANDLE_VALUE) {
-		    error = __mkSmallInteger(GetLastError());
-		} else {
-		    dp = __MKEXTERNALADDRESS(d); __INST(dirPointer) = dp; __STORE(self, dp);
+                if (d == INVALID_HANDLE_VALUE) {
+                    error = __mkSmallInteger(GetLastError());
+                } else {
+                    dp = __MKEXTERNALADDRESS(d); __INST(dirPointer) = dp; __STORE(self, dp);
 
-		    fileSize   = __MKLARGEINT64(1, uD.wdata.nFileSizeLow, uD.wdata.nFileSizeHigh );
-		    osPathname = __MKU16STRING( uD.wdata.cFileName );
-		    osFileAttributes = __mkSmallInteger( uD.data.dwFileAttributes );
+                    fileSize   = __MKLARGEINT64(1, uD.wdata.nFileSizeLow, uD.wdata.nFileSizeHigh );
+                    osPathname = __MKU16STRING( uD.wdata.cFileName );
+                    osFileAttributes = __mkSmallInteger( uD.data.dwFileAttributes );
 
-		    osCrtTime = FileTimeToOsTime(&uD.wdata.ftCreationTime);
-		    osAccTime = FileTimeToOsTime(&uD.wdata.ftLastAccessTime);
-		    osModTime = FileTimeToOsTime(&uD.wdata.ftLastWriteTime);
-		    ok = true;
-		}
-	    }
-	}
+                    osCrtTime = FileTimeToOsTime(&uD.wdata.ftCreationTime);
+                    osAccTime = FileTimeToOsTime(&uD.wdata.ftLastAccessTime);
+                    osModTime = FileTimeToOsTime(&uD.wdata.ftLastWriteTime);
+                    ok = true;
+                }
+            }
+        }
     }
 #endif
 #endif
 %}.
 
     ok == true ifTrue:[
-	Lobby register:self.
-	osPathname isNil ifTrue:[
-	    "UNIX: does not automatically provide the first entry"
+        self registerForFinalization.
+        osPathname isNil ifTrue:[
+            "UNIX: does not automatically provide the first entry"
 
-	    StreamError handle:[:ex |
-		self close.
-		ex reject.
-	    ] do:[
-		readAheadEntry := OperatingSystem nextLinkInfoFrom:self dirPointer:dirPointer.
-	    ].
-	] ifFalse:[
-	    "Windows already provides the first entry's info"
+            StreamError handle:[:ex |
+                self close.
+                ex reject.
+            ] do:[
+                readAheadEntry := OperatingSystem nextLinkInfoFrom:self dirPointer:dirPointer.
+            ].
+        ] ifFalse:[
+            "Windows already provides the first entry's info"
 
-	    readAheadEntry := OperatingSystem
-		linkInfoFor:osPathname
-		fileSize:fileSize
-		fileAttributes:osFileAttributes
-		osCrtTime:osCrtTime
-		osAccTime:osAccTime
-		osModTime:osModTime
-	].
+            readAheadEntry := OperatingSystem
+                linkInfoFor:osPathname
+                fileSize:fileSize
+                fileAttributes:osFileAttributes
+                osCrtTime:osCrtTime
+                osAccTime:osAccTime
+                osModTime:osModTime
+        ].
 
-	^ self
+        ^ self
     ].
 
     ok notNil ifTrue:[
-	dirPointer notNil ifTrue:[^ self errorAlreadyOpen].
+        dirPointer notNil ifTrue:[^ self errorAlreadyOpen].
     ].
     error notNil ifTrue:[
-	^ self openError:(lastErrorNumber := error).
+        ^ self openError:(lastErrorNumber := error).
     ].
     ^ nil
 !
@@ -762,10 +762,10 @@
 !DirectoryStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.87 2015-01-15 15:24:41 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.87 2015-01-15 15:24:41 cg Exp $'
+    ^ '$Header$'
 ! !
 
--- a/ExternalStream.st	Wed Sep 30 07:05:15 2015 +0200
+++ b/ExternalStream.st	Thu Oct 01 06:52:24 2015 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -2207,8 +2205,8 @@
      No error of the stream is not open."
 
     self isOpen ifTrue:[
-	Lobby unregister:self.
-	self closeFile.
+        self unregisterForFinalization.
+        self closeFile.
     ].
 !
 
@@ -2217,8 +2215,8 @@
      see comment there"
 
     self isOpen ifTrue:[
-	Lobby unregister:self.
-	self closeFile
+        self unregisterForFinalization.
+        self closeFile
     ]
 
     "Modified: 30.8.1996 / 00:39:21 / cg"
@@ -2234,7 +2232,7 @@
 
     copy := super copy.
     copy dupFd.
-    Lobby register:copy.
+    copy registerForFinalization.
     ^ copy
 
     "
@@ -2521,6 +2519,23 @@
     [
 	self closeFile
     ] valueWithTimeout:30 seconds.
+!
+
+reRegisterForFinalization
+    Lobby registerChange:self.
+!
+
+registerForFinalization
+
+    "keep myself in newSpace, so it will be finalized early"
+    ObjectMemory preventTenureOf:self. 
+    Lobby register:self.
+!
+
+unregisterForFinalization
+    Lobby unregister:self.
+     "probably the object will be collected soon..."
+    ObjectMemory setAgeOf:self to:0.
 ! !
 
 !ExternalStream methodsFor:'initialization'!
@@ -4595,59 +4610,59 @@
 
     if (__isStringLike(openmode)) {
 #ifdef WIN32
-	__stxWrapApiEnterCritical();
+        __stxWrapApiEnterCritical();
 #endif
-	if (__isSmallInteger(aFileDescriptor)) {
-	    fd = __intVal(aFileDescriptor);
-	}
+        if (__isSmallInteger(aFileDescriptor)) {
+            fd = __intVal(aFileDescriptor);
+        }
 #ifdef WIN32
-	else if (__isExternalAddressLike(aFileDescriptor)) {
-	    fd = _open_osfhandle((long)__externalAddressVal(aFileDescriptor), O_BINARY);
-	    if (fd < 0) {
-		if (__threadErrno == 0) {
-		    // no more file descriptors
-		    __threadErrno = EMFILE;
-		}
-		error = __mkSmallInteger(__threadErrno);
-		__stxWrapApiLeaveCritical();
-		goto out;
-	    }
-	}
+        else if (__isExternalAddressLike(aFileDescriptor)) {
+            fd = _open_osfhandle((long)__externalAddressVal(aFileDescriptor), O_BINARY);
+            if (fd < 0) {
+                if (__threadErrno == 0) {
+                    // no more file descriptors
+                    __threadErrno = EMFILE;
+                }
+                error = __mkSmallInteger(__threadErrno);
+                __stxWrapApiLeaveCritical();
+                goto out;
+            }
+        }
 #endif
-	f = (FILEPOINTER) fdopen(fd, (char *)__stringVal(openmode));
+        f = (FILEPOINTER) fdopen(fd, (char *)__stringVal(openmode));
 #ifdef WIN32
-	__stxWrapApiLeaveCritical();
+        __stxWrapApiLeaveCritical();
 #endif
-	if (f == NULL) {
-	    error =__mkSmallInteger(__threadErrno);
-	} else {
-	    if (@global(FileOpenTrace) == true) {
-		fprintf(stderr, "fdopen [ExternalStream] %"_ld_" (%"_lx_") -> %"_lx_"\n", (INT)fd, (INT)fd, (INT)f);
-	    }
-
-	    fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
-	    retVal = self;
-	}
+        if (f == NULL) {
+            error =__mkSmallInteger(__threadErrno);
+        } else {
+            if (@global(FileOpenTrace) == true) {
+                fprintf(stderr, "fdopen [ExternalStream] %"_ld_" (%"_lx_") -> %"_lx_"\n", (INT)fd, (INT)fd, (INT)f);
+            }
+
+            fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
+            retVal = self;
+        }
     }
 out:;
 %}.
     retVal notNil ifTrue:[
-	position := 0.
-	buffered isNil ifTrue:[
-	    buffered := true.       "default is buffered"
-	].
-	handleType := handleTypeSymbol.
-	Lobby register:self.
-	^ retVal
+        position := 0.
+        buffered isNil ifTrue:[
+            buffered := true.       "default is buffered"
+        ].
+        handleType := handleTypeSymbol.
+        self registerForFinalization.
+        ^ retVal
     ].
     error notNil ifTrue:[
-	OperatingSystem closeFd:aFileDescriptor.
-	lastErrorNumber := error.
-	position := nil.
-	"
-	 the open failed for some reason ...
-	"
-	^ self openError:error
+        OperatingSystem closeFd:aFileDescriptor.
+        lastErrorNumber := error.
+        position := nil.
+        "
+         the open failed for some reason ...
+        "
+        ^ self openError:error
     ].
 !
 
@@ -4696,42 +4711,42 @@
 # if 1
        f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
 # else
-	__BEGIN_INTERRUPTABLE__
-	do {
-	    f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
-	} while ((f == NULL) && (__threadErrno == EINTR));
-	__END_INTERRUPTABLE__
+        __BEGIN_INTERRUPTABLE__
+        do {
+            f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
+        } while ((f == NULL) && (__threadErrno == EINTR));
+        __END_INTERRUPTABLE__
 # endif
 #else /* UNIX */
-	__BEGIN_INTERRUPTABLE__
-	do {
-	    f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
-	} while ((f == NULL) && (__threadErrno == EINTR));
-	__END_INTERRUPTABLE__
+        __BEGIN_INTERRUPTABLE__
+        do {
+            f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
+        } while ((f == NULL) && (__threadErrno == EINTR));
+        __END_INTERRUPTABLE__
 #endif /* UNIX */
-	if (f == NULL) {
-	    error = __mkSmallInteger(__threadErrno);
-	} else {
-	    if (@global(FileOpenTrace) == true) {
-		fprintf(stderr, "fopen %s [ExternalStream] -> %"_lx_"\n", __stringVal(aPath), (INT)f);
-	    }
-	    fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
-	    __INST(handleType) = @symbol(filePointer);
-	    ok = true;
-	}
+        if (f == NULL) {
+            error = __mkSmallInteger(__threadErrno);
+        } else {
+            if (@global(FileOpenTrace) == true) {
+                fprintf(stderr, "fopen %s [ExternalStream] -> %"_lx_"\n", __stringVal(aPath), (INT)f);
+            }
+            fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
+            __INST(handleType) = @symbol(filePointer);
+            ok = true;
+        }
     }
 %}.
     ok ifTrue:[
-	position := 0.
-	Lobby register:self.
-	^ self.
+        position := 0.
+        self registerForFinalization.
+        ^ self.
     ].
     error notNil ifTrue:[
-	"
-	 the open failed for some reason ...
-	"
-	lastErrorNumber := error.
-	self openError:error.
+        "
+         the open failed for some reason ...
+        "
+        lastErrorNumber := error.
+        self openError:error.
     ].
     self primitiveFailed.
 !
@@ -4743,7 +4758,7 @@
 
     self class name errorPrint. ' [warning]: automatic reOpen not supported - stream closed' errorPrintCR.
     handle := nil.
-    Lobby unregister:self.
+    self unregisterForFinalization.
 
     "Modified: 10.1.1997 / 17:50:44 / cg"
 !
@@ -6276,7 +6291,7 @@
     ].
 
     "
-	'Bönnigheim' asUnicode16String errorPrintCR
+	'Bönnigheim' asUnicode16String errorPrintCR
     "
 !
 
@@ -6477,7 +6492,7 @@
     "
 	(FileStream newTemporary
 	    nextPutUtf16:$B;
-	    nextPutUtf16:$Ä;
+	    nextPutUtf16:$Ä;
 	    nextPutUtf16:(Character codePoint:16r10CCCC);
 	    reset;
 	    binary;
--- a/FileStream.st	Wed Sep 30 07:05:15 2015 +0200
+++ b/FileStream.st	Thu Oct 01 06:52:24 2015 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -828,7 +826,7 @@
      to other systems."
 
     removeOnClose := aBoolean.
-    Lobby registerChange:self.
+    self reRegisterForFinalization.
 
     "Modified: / 13.8.1998 / 12:10:07 / cg"
 !
@@ -1362,369 +1360,369 @@
     int pass = 0;
 
     if (!__isNonNilObject(encodedPathName)
-	|| !(__isStringLike(openmode) || __isArrayLike(openmode)))
-	    goto badArgument;
+        || !(__isStringLike(openmode) || __isArrayLike(openmode)))
+            goto badArgument;
 
 retry:
 #ifdef __VMS__
       if (__isStringLike(encodedPathName)) {
-	do {
-	    /*
-	     * allow passing additional RMS arguments.
-	     * stupid: DEC does not seem to offer an interface for passing a char **.
-	     */
-	    __threadErrno = 0;
+        do {
+            /*
+             * allow passing additional RMS arguments.
+             * stupid: DEC does not seem to offer an interface for passing a char **.
+             */
+            __threadErrno = 0;
 
-	    {
-		if (__isArray(attributeSpec)) {
-		    OBJ *ap = __ArrayInstPtr(attributeSpec)->a_element;
-		    int numAttrib = 0;
-		    int i;
+            {
+                if (__isArray(attributeSpec)) {
+                    OBJ *ap = __ArrayInstPtr(attributeSpec)->a_element;
+                    int numAttrib = 0;
+                    int i;
 
-		    numAttrib = __arraySize(attributeSpec);
-		    for (i=0; i<numAttrib;i++) {
-			if (! __isStringLike(ap[i])) {
-			    __threadErrno = EINVAL; /* invalid argument */
-			    goto getOutOfHere;
-			}
-		    }
-		    switch (numAttrib) {
-			case 0:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 1:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 2:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 3:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 4:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 5:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]), __stringVal(ap[4]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 6:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 7:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-				      __stringVal(ap[6]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 8:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-				      __stringVal(ap[6]), __stringVal(ap[7]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 9:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-				      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]));
-			    __END_INTERRUPTABLE__
-			    break;
-			case 10:
-			    __BEGIN_INTERRUPTABLE__
-			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-				      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]),
-				      __stringVal(ap[9]));
-			    __END_INTERRUPTABLE__
-			    break;
-			default:
-			    __threadErrno = E2BIG; /* too many args */
-			    goto getOutOfHere;
-		    }
-		} else if (attributeSpec != nil) {
-		    __threadErrno = EINVAL; /* invalid argument */
-		    goto getOutOfHere;
-		} else {
-		    /*
-		     * create file as sequential streamLF by default.
-		     */
-		    __BEGIN_INTERRUPTABLE__
-		    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode), "rfm=stmlf");
-		    __END_INTERRUPTABLE__
-		}
-	    }
-	} while ((f == NULL) && (__threadErrno == EINTR));
+                    numAttrib = __arraySize(attributeSpec);
+                    for (i=0; i<numAttrib;i++) {
+                        if (! __isStringLike(ap[i])) {
+                            __threadErrno = EINVAL; /* invalid argument */
+                            goto getOutOfHere;
+                        }
+                    }
+                    switch (numAttrib) {
+                        case 0:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 1:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 2:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 3:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 4:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 5:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]), __stringVal(ap[4]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 6:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 7:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+                                      __stringVal(ap[6]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 8:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+                                      __stringVal(ap[6]), __stringVal(ap[7]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 9:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+                                      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        case 10:
+                            __BEGIN_INTERRUPTABLE__
+                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+                                      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]),
+                                      __stringVal(ap[9]));
+                            __END_INTERRUPTABLE__
+                            break;
+                        default:
+                            __threadErrno = E2BIG; /* too many args */
+                            goto getOutOfHere;
+                    }
+                } else if (attributeSpec != nil) {
+                    __threadErrno = EINVAL; /* invalid argument */
+                    goto getOutOfHere;
+                } else {
+                    /*
+                     * create file as sequential streamLF by default.
+                     */
+                    __BEGIN_INTERRUPTABLE__
+                    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode), "rfm=stmlf");
+                    __END_INTERRUPTABLE__
+                }
+            }
+        } while ((f == NULL) && (__threadErrno == EINTR));
       }
 #else /* not VMS */
 
 # ifdef WIN32
     {
-	  DWORD share = 0, access = 0, create = 0, attr = 0;
-	  char * __openmode;
-	  HANDLE handle;
-	  SECURITY_ATTRIBUTES sa;
+          DWORD share = 0, access = 0, create = 0, attr = 0;
+          char * __openmode;
+          HANDLE handle;
+          SECURITY_ATTRIBUTES sa;
 
-	  if (__isStringLike(openmode)) {
-	      share = FILE_SHARE_READ|FILE_SHARE_WRITE;
-	      __openmode = __stringVal(openmode);
-	      if (strcmp(__openmode, "rb") == 0) {
-		  access = GENERIC_READ;
-		  create = OPEN_EXISTING;
-	      } else if (strcmp(__openmode, "rb+") == 0) {
-		  access = GENERIC_READ | GENERIC_WRITE;
-		  create = OPEN_EXISTING;
-	      } else if (strcmp(__openmode, "wb") == 0) {
-		  access = GENERIC_WRITE;
-		  create = CREATE_ALWAYS;
-	      } else if (strcmp(__openmode, "wb+") == 0) {
-		  access = GENERIC_READ | GENERIC_WRITE;
-		  create = CREATE_ALWAYS;
-	      } else if (strcmp(__openmode, "ab") == 0) {
-		  access = FILE_APPEND_DATA|FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|
-				STANDARD_RIGHTS_WRITE|SYNCHRONIZE;
-		  create = OPEN_ALWAYS;
-	      } else if (strcmp(__openmode, "ab+") == 0) {
-		  access = GENERIC_READ |FILE_APPEND_DATA|FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|
-				STANDARD_RIGHTS_WRITE|SYNCHRONIZE;
-		  create = OPEN_ALWAYS;
-	      } else {
-		  console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
-	      }
-	  } else if (__isArrayLike(openmode)) {
-	      OBJ *ap = __arrayVal(openmode);
-	      int numAttrib = __arraySize(openmode);
-	      int i;
+          if (__isStringLike(openmode)) {
+              share = FILE_SHARE_READ|FILE_SHARE_WRITE;
+              __openmode = __stringVal(openmode);
+              if (strcmp(__openmode, "rb") == 0) {
+                  access = GENERIC_READ;
+                  create = OPEN_EXISTING;
+              } else if (strcmp(__openmode, "rb+") == 0) {
+                  access = GENERIC_READ | GENERIC_WRITE;
+                  create = OPEN_EXISTING;
+              } else if (strcmp(__openmode, "wb") == 0) {
+                  access = GENERIC_WRITE;
+                  create = CREATE_ALWAYS;
+              } else if (strcmp(__openmode, "wb+") == 0) {
+                  access = GENERIC_READ | GENERIC_WRITE;
+                  create = CREATE_ALWAYS;
+              } else if (strcmp(__openmode, "ab") == 0) {
+                  access = FILE_APPEND_DATA|FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|
+                                STANDARD_RIGHTS_WRITE|SYNCHRONIZE;
+                  create = OPEN_ALWAYS;
+              } else if (strcmp(__openmode, "ab+") == 0) {
+                  access = GENERIC_READ |FILE_APPEND_DATA|FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|
+                                STANDARD_RIGHTS_WRITE|SYNCHRONIZE;
+                  create = OPEN_ALWAYS;
+              } else {
+                  console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
+              }
+          } else if (__isArrayLike(openmode)) {
+              OBJ *ap = __arrayVal(openmode);
+              int numAttrib = __arraySize(openmode);
+              int i;
 
-	      __openmode = "rb+";
+              __openmode = "rb+";
 
-	      for (i=0; i<numAttrib; i++) {
-		  OBJ attrSym = ap[i];
+              for (i=0; i<numAttrib; i++) {
+                  OBJ attrSym = ap[i];
 
-		  if (attrSym == @symbol(FILE_SHARE_READ)) {
-		      share |= FILE_SHARE_READ;
-		  } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
-		      share |= FILE_SHARE_WRITE;
+                  if (attrSym == @symbol(FILE_SHARE_READ)) {
+                      share |= FILE_SHARE_READ;
+                  } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
+                      share |= FILE_SHARE_WRITE;
 
-		  } else if (attrSym == @symbol(GENERIC_READ)) {
-		      access |= GENERIC_READ;
-		  } else if (attrSym == @symbol(GENERIC_WRITE)) {
-		      access |= GENERIC_WRITE;
-		  } else if (attrSym == @symbol(GENERIC_READ_WRITE)) {
-		      access |= GENERIC_READ|GENERIC_WRITE;
+                  } else if (attrSym == @symbol(GENERIC_READ)) {
+                      access |= GENERIC_READ;
+                  } else if (attrSym == @symbol(GENERIC_WRITE)) {
+                      access |= GENERIC_WRITE;
+                  } else if (attrSym == @symbol(GENERIC_READ_WRITE)) {
+                      access |= GENERIC_READ|GENERIC_WRITE;
 
-		  } else if (attrSym == @symbol(CREATE_NEW)) {
-		      create |= CREATE_NEW;
-		  } else if (attrSym == @symbol(CREATE_ALWAYS)) {
-		      create |= CREATE_ALWAYS;
-		  } else if (attrSym == @symbol(OPEN_EXISTING)) {
-		      create |= OPEN_EXISTING;
-		  } else if (attrSym == @symbol(OPEN_ALWAYS)) {
-		      create |= OPEN_ALWAYS;
-		  } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
-		      create |= TRUNCATE_EXISTING;
+                  } else if (attrSym == @symbol(CREATE_NEW)) {
+                      create |= CREATE_NEW;
+                  } else if (attrSym == @symbol(CREATE_ALWAYS)) {
+                      create |= CREATE_ALWAYS;
+                  } else if (attrSym == @symbol(OPEN_EXISTING)) {
+                      create |= OPEN_EXISTING;
+                  } else if (attrSym == @symbol(OPEN_ALWAYS)) {
+                      create |= OPEN_ALWAYS;
+                  } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
+                      create |= TRUNCATE_EXISTING;
 
-		  } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
-		      attr |= FILE_ATTRIBUTE_HIDDEN;
-		  } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
-		      attr |= FILE_ATTRIBUTE_READONLY;
-		  } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
-		      attr |= FILE_FLAG_WRITE_THROUGH;
-		  } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
-		      attr |= FILE_FLAG_SEQUENTIAL_SCAN;
-		  } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
-		      attr |= FILE_FLAG_DELETE_ON_CLOSE;
-		  } else if (!__isSymbol(attrSym) && __isStringLike(attrSym)) {
-		      __openmode = __stringVal(attrSym);
-		  } else {
-		      console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
-		  }
-	      }
-	  }
-	  if (create == 0) {
+                  } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
+                      attr |= FILE_ATTRIBUTE_HIDDEN;
+                  } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
+                      attr |= FILE_ATTRIBUTE_READONLY;
+                  } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
+                      attr |= FILE_FLAG_WRITE_THROUGH;
+                  } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
+                      attr |= FILE_FLAG_SEQUENTIAL_SCAN;
+                  } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
+                      attr |= FILE_FLAG_DELETE_ON_CLOSE;
+                  } else if (!__isSymbol(attrSym) && __isStringLike(attrSym)) {
+                      __openmode = __stringVal(attrSym);
+                  } else {
+                      console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
+                  }
+              }
+          }
+          if (create == 0) {
 //              argumentError = @symbol(missingCreateMode);
-	      goto badArgument;
-	  }
-	  if (attr == 0) {
-	      attr = FILE_ATTRIBUTE_NORMAL;
-	  }
+              goto badArgument;
+          }
+          if (attr == 0) {
+              attr = FILE_ATTRIBUTE_NORMAL;
+          }
 
-	  /*
-	   * create security attributes - make handle inheritable by subprocesses
-	   */
-	  memset(&sa, 0, sizeof (sa));
-	  sa.nLength = sizeof( sa );
-	  // sa.bInheritHandle = TRUE;
-	  sa.bInheritHandle = FALSE;
+          /*
+           * create security attributes - make handle inheritable by subprocesses
+           */
+          memset(&sa, 0, sizeof (sa));
+          sa.nLength = sizeof( sa );
+          // sa.bInheritHandle = TRUE;
+          sa.bInheritHandle = FALSE;
 
-	  if (__isStringLike(pathName)) {
-		char _aPathName[MAXPATHLEN];
+          if (__isStringLike(pathName)) {
+                char _aPathName[MAXPATHLEN];
 
-		strncpy(_aPathName, __stringVal(pathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
-		do {
-		    __threadErrno = 0;
-		    handle = STX_API_NOINT_CALL7( "CreateFileA", CreateFileA, _aPathName, access, share, &sa, create, attr, 0 /* hTempl */);
-		    if (__threadErrno == EINTR) {
-			handle = INVALID_HANDLE_VALUE;
-		    }
-		} while ((handle == INVALID_HANDLE_VALUE) && (__threadErrno == EINTR));
-	  } else if (__isUnicode16String(pathName)) {
-		wchar_t _aPathName[MAXPATHLEN+1];
-		int i, l;
+                strncpy(_aPathName, __stringVal(pathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+                do {
+                    __threadErrno = 0;
+                    handle = STX_API_NOINT_CALL7( "CreateFileA", CreateFileA, _aPathName, access, share, &sa, create, attr, 0 /* hTempl */);
+                    if (__threadErrno == EINTR) {
+                        handle = INVALID_HANDLE_VALUE;
+                    }
+                } while ((handle == INVALID_HANDLE_VALUE) && (__threadErrno == EINTR));
+          } else if (__isUnicode16String(pathName)) {
+                wchar_t _aPathName[MAXPATHLEN+1];
+                int i, l;
 
-		l = __unicode16StringSize(pathName);
-		if (l > MAXPATHLEN) l = MAXPATHLEN;
-		for (i=0; i<l; i++) {
-		    _aPathName[i] = __unicode16StringVal(pathName)[i];
-		}
-		_aPathName[i] = 0;
+                l = __unicode16StringSize(pathName);
+                if (l > MAXPATHLEN) l = MAXPATHLEN;
+                for (i=0; i<l; i++) {
+                    _aPathName[i] = __unicode16StringVal(pathName)[i];
+                }
+                _aPathName[i] = 0;
 
-		do {
-		    __threadErrno = 0;
-		    handle = STX_API_NOINT_CALL7( "CreateFileW", CreateFileW, _aPathName, access, share, &sa, create, attr, 0 /* hTempl */);
-		    if (__threadErrno == EINTR) {
-			handle = INVALID_HANDLE_VALUE;
-		    }
-		} while ((handle == INVALID_HANDLE_VALUE) && (__threadErrno == EINTR));
-	  }
-	  if (handle != INVALID_HANDLE_VALUE) {
-	      int fd;
-	      extern void __stxWrapApiEnterCritical(), __stxWrapApiLeaveCritical();
+                do {
+                    __threadErrno = 0;
+                    handle = STX_API_NOINT_CALL7( "CreateFileW", CreateFileW, _aPathName, access, share, &sa, create, attr, 0 /* hTempl */);
+                    if (__threadErrno == EINTR) {
+                        handle = INVALID_HANDLE_VALUE;
+                    }
+                } while ((handle == INVALID_HANDLE_VALUE) && (__threadErrno == EINTR));
+          }
+          if (handle != INVALID_HANDLE_VALUE) {
+              int fd;
+              extern void __stxWrapApiEnterCritical(), __stxWrapApiLeaveCritical();
 
-	      __stxWrapApiEnterCritical();
-	      fd = _open_osfhandle((long)handle, O_BINARY);
-	      if (fd < 0) {
-		  if (__threadErrno == 0) {
-		      // no more file descriptors
-		      __threadErrno = EMFILE;
-		  }
-		  CloseHandle(handle);
-	      } else {
-		  f = fdopen(fd, __openmode);
-	      }
-	      __stxWrapApiLeaveCritical();
-	  }  else {
-	    __threadErrno = __WIN32_ERR(GetLastError());
-	  }
+              __stxWrapApiEnterCritical();
+              fd = _open_osfhandle((long)handle, O_BINARY);
+              if (fd < 0) {
+                  if (__threadErrno == 0) {
+                      // no more file descriptors
+                      __threadErrno = EMFILE;
+                  }
+                  CloseHandle(handle);
+              } else {
+                  f = fdopen(fd, __openmode);
+              }
+              __stxWrapApiLeaveCritical();
+          }  else {
+            __threadErrno = __WIN32_ERR(GetLastError());
+          }
       }
 # else /* not WIN32 */
 
       if (__isStringLike(encodedPathName)) {
-	  int accessMode = 0666;        // default access mode of fopen(), relies on umask()
-	  int flags = 0;
-	  int fd;
-	  char * __openmode;
+          int accessMode = 0666;        // default access mode of fopen(), relies on umask()
+          int flags = 0;
+          int fd;
+          char * __openmode;
 
-	  if (__isStringLike(openmode)) {
-	      __openmode = __stringVal(openmode);
-	      if (strcmp(__openmode, "r") == 0) {
-		  flags = O_RDONLY;
-	      } else if (strcmp(__openmode, "r+") == 0) {
-		  flags = O_RDWR;
-	      } else if (strcmp(__openmode, "w") == 0) {
-		  flags = O_WRONLY | O_CREAT | O_TRUNC;
-	      } else if (strcmp(__openmode, "w+") == 0) {
-		  flags = O_RDWR | O_CREAT | O_TRUNC;
-	      } else if (strcmp(__openmode, "a") == 0) {
-		  flags = O_WRONLY | O_CREAT | O_APPEND;
-	      } else if (strcmp(__openmode, "a+") == 0) {
-		  flags = O_RDWR | O_CREAT| O_APPEND;
-	      } else {
-		  console_fprintf(stderr, "UNIXOS [warning]: unsupported open mode\n");
-	      }
-	  } else if (__isArrayLike(openmode)) {
-	      OBJ *ap = __arrayVal(openmode);
-	      int numAttrib = __arraySize(openmode);
-	      int i;
+          if (__isStringLike(openmode)) {
+              __openmode = __stringVal(openmode);
+              if (strcmp(__openmode, "r") == 0) {
+                  flags = O_RDONLY;
+              } else if (strcmp(__openmode, "r+") == 0) {
+                  flags = O_RDWR;
+              } else if (strcmp(__openmode, "w") == 0) {
+                  flags = O_WRONLY | O_CREAT | O_TRUNC;
+              } else if (strcmp(__openmode, "w+") == 0) {
+                  flags = O_RDWR | O_CREAT | O_TRUNC;
+              } else if (strcmp(__openmode, "a") == 0) {
+                  flags = O_WRONLY | O_CREAT | O_APPEND;
+              } else if (strcmp(__openmode, "a+") == 0) {
+                  flags = O_RDWR | O_CREAT| O_APPEND;
+              } else {
+                  console_fprintf(stderr, "UNIXOS [warning]: unsupported open mode\n");
+              }
+          } else if (__isArrayLike(openmode)) {
+              OBJ *ap = __arrayVal(openmode);
+              int numAttrib = __arraySize(openmode);
+              int i;
 
-	      __openmode = "r+";
+              __openmode = "r+";
 
-	      for (i=0; i<numAttrib; i++) {
-		  OBJ attrSym = ap[i];
+              for (i=0; i<numAttrib; i++) {
+                  OBJ attrSym = ap[i];
 
-		  if (attrSym == @symbol(FILE_SHARE_READ)) {
-		      // ignore
-		  } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
-		     // ignore
-		  } else if (attrSym == @symbol(GENERIC_READ)) {
-		      flags |= O_RDONLY;
-		  } else if (attrSym == @symbol(GENERIC_WRITE)) {
-		      flags |= O_WRONLY;
-		  } else if (attrSym == @symbol(GENERIC_READ_WRITE)) {
-		      flags |= O_RDWR;
+                  if (attrSym == @symbol(FILE_SHARE_READ)) {
+                      // ignore
+                  } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
+                     // ignore
+                  } else if (attrSym == @symbol(GENERIC_READ)) {
+                      flags |= O_RDONLY;
+                  } else if (attrSym == @symbol(GENERIC_WRITE)) {
+                      flags |= O_WRONLY;
+                  } else if (attrSym == @symbol(GENERIC_READ_WRITE)) {
+                      flags |= O_RDWR;
 
-		  } else if (attrSym == @symbol(CREATE_NEW)) {
-		      flags |= O_CREAT|O_EXCL;
-		      accessMode = 0600;     // simulate mkstemp()
-		  } else if (attrSym == @symbol(CREATE_ALWAYS)) {
-		      flags |= O_CREAT|O_TRUNC;
-		  } else if (attrSym == @symbol(OPEN_EXISTING)) {
-		      // nothing to be set
-		  } else if (attrSym == @symbol(OPEN_ALWAYS)) {
-		      flags |= O_CREAT;
-		  } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
-		      flags |= O_TRUNC;
+                  } else if (attrSym == @symbol(CREATE_NEW)) {
+                      flags |= O_CREAT|O_EXCL;
+                      accessMode = 0600;     // simulate mkstemp()
+                  } else if (attrSym == @symbol(CREATE_ALWAYS)) {
+                      flags |= O_CREAT|O_TRUNC;
+                  } else if (attrSym == @symbol(OPEN_EXISTING)) {
+                      // nothing to be set
+                  } else if (attrSym == @symbol(OPEN_ALWAYS)) {
+                      flags |= O_CREAT;
+                  } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
+                      flags |= O_TRUNC;
 
-		  } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
-		      // ignore
-		  } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
-		      accessMode &= 0444;
-		  } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
+                  } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
+                      // ignore
+                  } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
+                      accessMode &= 0444;
+                  } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
 #ifdef O_DIRECT
-		      flags |= O_DIRECT;
+                      flags |= O_DIRECT;
 #endif
-		  } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
-		      // ignore
-		  } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
-		      // ignore;
-		  } else if (!__isSymbol(attrSym) && __isStringLike(attrSym)) {
-		      __openmode = __stringVal(attrSym);
-		  } else {
-		      console_fprintf(stderr, "UNIXOS [warning]: unsupported open mode\n");
-		  }
-	      }
-	  }
-	  do {
-	      __BEGIN_INTERRUPTABLE__
-	      fd = open((char *) __stringVal(encodedPathName), flags, accessMode);
-	      __END_INTERRUPTABLE__
-	  } while ((fd < 0) && (__threadErrno == EINTR));
+                  } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
+                      // ignore
+                  } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
+                      // ignore;
+                  } else if (!__isSymbol(attrSym) && __isStringLike(attrSym)) {
+                      __openmode = __stringVal(attrSym);
+                  } else {
+                      console_fprintf(stderr, "UNIXOS [warning]: unsupported open mode\n");
+                  }
+              }
+          }
+          do {
+              __BEGIN_INTERRUPTABLE__
+              fd = open((char *) __stringVal(encodedPathName), flags, accessMode);
+              __END_INTERRUPTABLE__
+          } while ((fd < 0) && (__threadErrno == EINTR));
 
-	  if (fd >= 0) {
-	      __threadErrno = 0;
-	      f = fdopen(fd, __openmode);
-	      if (f == NULL) {
-		  close(fd);            // fdopen failed, close before retry.
-	      }
-	  }
+          if (fd >= 0) {
+              __threadErrno = 0;
+              f = fdopen(fd, __openmode);
+              if (f == NULL) {
+                  close(fd);            // fdopen failed, close before retry.
+              }
+          }
       }
 
 # endif /* not WIN32 */
@@ -1732,86 +1730,86 @@
 
 
     if (f == NULL) {
-	/*
-	 * If no filedescriptors available, try to finalize
-	 * possibly collected fd's and try again.
-	 */
-	if ((__threadErrno == ENFILE || __threadErrno == EMFILE) && pass == 0) {
-	    pass = 1;
-	    __SSEND0(@global(ObjectMemory), @symbol(scavenge), 0);
-	    __SSEND0(@global(ObjectMemory), @symbol(finalize), 0);
-	    goto retry;
-	}
+        /*
+         * If no filedescriptors available, try to finalize
+         * possibly collected fd's and try again.
+         */
+        if ((__threadErrno == ENFILE || __threadErrno == EMFILE) && pass == 0) {
+            pass = 1;
+            __SSEND0(@global(ObjectMemory), @symbol(scavenge), 0);
+            __SSEND0(@global(ObjectMemory), @symbol(finalize), 0);
+            goto retry;
+        }
     badArgument:
     getOutOfHere:
-	error = __mkSmallInteger(__threadErrno);
-	__INST(position) = nil;
+        error = __mkSmallInteger(__threadErrno);
+        __INST(position) = nil;
     } else {
 #ifdef __VMS__
-	/*
-	 * check to see if this is positionable ...
-	 */
-	__INST(canPosition) = false;
+        /*
+         * check to see if this is positionable ...
+         */
+        __INST(canPosition) = false;
 # ifndef _POSIX_C_SOURCE
-	{
-	    struct stat statBuffer;
+        {
+            struct stat statBuffer;
 
-	    if (fstat(fileno(f), &statBuffer) >= 0) {
-		switch (statBuffer.st_fab_rfm) {
-		    case FAB$C_UDF: /* undefined (also stream binary)   */
-		    case FAB$C_VAR: /* variable length records          */
-		    case FAB$C_VFC: /* variable fixed control           */
-		    case FAB$C_STM: /* RMS-11 stream (valid only for sequen) */
-		    default:
-			__INST(canPosition) = false;
-			break;
+            if (fstat(fileno(f), &statBuffer) >= 0) {
+                switch (statBuffer.st_fab_rfm) {
+                    case FAB$C_UDF: /* undefined (also stream binary)   */
+                    case FAB$C_VAR: /* variable length records          */
+                    case FAB$C_VFC: /* variable fixed control           */
+                    case FAB$C_STM: /* RMS-11 stream (valid only for sequen) */
+                    default:
+                        __INST(canPosition) = false;
+                        break;
 
-		    case FAB$C_FIX: /* fixed length records             */
-		    case FAB$C_STMLF: /* LF stream (valid only for sequential) */
-		    case FAB$C_STMCR: /* CR stream (valid only for sequential) */
-			__INST(canPosition) = true;
-			break;
-		}
-	    }
-	}
+                    case FAB$C_FIX: /* fixed length records             */
+                    case FAB$C_STMLF: /* LF stream (valid only for sequential) */
+                    case FAB$C_STMCR: /* CR stream (valid only for sequential) */
+                        __INST(canPosition) = true;
+                        break;
+                }
+            }
+        }
 # endif
 #else /* not VMS */
-	__INST(canPosition) = true;
+        __INST(canPosition) = true;
 #endif /* not VMS */
 
-	if (@global(FileOpenTrace) == true) {
-	    console_fprintf(stderr, "fopen %s [FileStream] -> %"_lx_"\n", __stringVal(pathName), (INT)f);
-	}
-	if (f != NULL) {
-	    OBJ fp;
+        if (@global(FileOpenTrace) == true) {
+            console_fprintf(stderr, "fopen %s [FileStream] -> %"_lx_"\n", __stringVal(pathName), (INT)f);
+        }
+        if (f != NULL) {
+            OBJ fp;
 
-	    wasBlocked = __BLOCKINTERRUPTS();
+            wasBlocked = __BLOCKINTERRUPTS();
 #if 0
-	    // The original code was:
-	    __INST(handle) = fp = __MKEXTERNALADDRESS(f); __STORE(self, fp);
-	    // but for that, gcc generates wrong code, which loads self (volatile) into
-	    // a register (bp), then calls __MKEXTERNALADDRESS, then stores indirect bp.
-	    // That is wrong if a scavenge occurs in __MKEXTERNALADDRESS, as bp is now still pointing to the old
-	    // object.
+            // The original code was:
+            __INST(handle) = fp = __MKEXTERNALADDRESS(f); __STORE(self, fp);
+            // but for that, gcc generates wrong code, which loads self (volatile) into
+            // a register (bp), then calls __MKEXTERNALADDRESS, then stores indirect bp.
+            // That is wrong if a scavenge occurs in __MKEXTERNALADDRESS, as bp is now still pointing to the old
+            // object.
 #else
-	    fp = __MKEXTERNALADDRESS(f);
-	    __INST(handle) = fp;
-	    __STORE(self, fp);
+            fp = __MKEXTERNALADDRESS(f);
+            __INST(handle) = fp;
+            __STORE(self, fp);
 #endif
-	}
+        }
     }
 %}.
     error notNil ifTrue:[
-	lastErrorNumber := error.
-	^ self openError:error.
+        lastErrorNumber := error.
+        ^ self openError:error.
     ].
     handle isNil ifTrue:[
-	^ self openError:0.
+        ^ self openError:0.
     ].
 
     position := 0.
     handleType := #filePointer.
-    Lobby register:self.
+    self registerForFinalization.
     wasBlocked == false ifTrue:[OperatingSystem unblockInterrupts].
     ^ handle
 !
@@ -1916,37 +1914,37 @@
      sent after snapin to reopen streams."
 
     handle notNil ifTrue:[
-	"it was open, when snapped-out"
-	handle := nil.
-	Lobby unregister:self.
-	pathName isNil ifTrue:[
-	    ^ self.
-	].
-	[
-	    |oldPos|
+        "it was open, when snapped-out"
+        handle := nil.
+        self unregisterForFinalization.
+        pathName isNil ifTrue:[
+            ^ self.
+        ].
+        [
+            |oldPos|
 
-	    "should take care of appending files and open them for
-	     append / position them to the end"
+            "should take care of appending files and open them for
+             append / position them to the end"
 
-	    oldPos := position.
+            oldPos := position.
 
-	    mode == #readonly ifTrue: [
-		self openForReading
-	    ] ifFalse:[mode == #writeonly ifTrue: [
-		self openForWriting.
-	    ] ifFalse:[
-		self openForReadWrite.
-	    ]].
+            mode == #readonly ifTrue: [
+                self openForReading
+            ] ifFalse:[mode == #writeonly ifTrue: [
+                self openForWriting.
+            ] ifFalse:[
+                self openForReadWrite.
+            ]].
 
-	    oldPos notNil ifTrue:[
-		self position:oldPos.
-	    ]
-	] on:OpenError do:[:ex|
-	    "this happens, if after a restart,
-	     the file is no longer present or accessable ..."
+            oldPos notNil ifTrue:[
+                self position:oldPos.
+            ]
+        ] on:OpenError do:[:ex|
+            "this happens, if after a restart,
+             the file is no longer present or accessable ..."
 
-	    (self class name , ' [warning]: could not reopen file: ', pathName) errorPrintCR.
-	].
+            (self class name , ' [warning]: could not reopen file: ', pathName) errorPrintCR.
+        ].
     ]
 
     "Modified: 10.1.1997 / 17:50:51 / cg"
--- a/ObjectMemory.st	Wed Sep 30 07:05:15 2015 +0200
+++ b/ObjectMemory.st	Thu Oct 01 06:52:24 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -3472,6 +3474,86 @@
     "
 !
 
+preventTenureOf:anObject
+    "set the age of anObject to the never-tenure special age. 
+     This prevents the object from ever going out of the new space,
+     and if used without care may lead to a filling of th newspace to a point,
+     where the system becomes inoperable.
+     Therefore it should only be used in very special situations.
+     One such situation may be to ensure that an object is finalized early by the next
+     scavenge, and not by a (possibly late) old space collect.
+     To undo this setup (i.e. to allow the object to tenure again), set its age back to
+     any value with the seatAgeOf:to: message.
+     If the object is already old, this call has no effect.
+     WARNING: this method is for ST/X experts only
+              it is dangerous, should be used with care
+              and it may be removed without notice"
+
+%{  /* NOCONTEXT */
+#ifndef __SCHTEAM__
+    if (__isNonNilObject(anObject)) {
+        _SET_AGE(anObject, NO_TENURE_AGE);
+    }    
+#endif
+%}
+    "
+    |p|
+    p := Point new.
+    Transcript showCR:(ObjectMemory preventTenureOf:p).
+    ObjectMemory tenuringScavenge.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenure.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenure.
+    ObjectMemory tenure.
+    ObjectMemory tenure.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory setAgeOf:p to:30.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenure.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenure.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    "
+!
+
+setAgeOf:anObject to:newAge
+    "change the age of anObject. 
+     This counts the number of scavenges that an object has survived in new space.
+     For old space objects, this is a no-op.
+     WARNING: this method is for ST/X debugging only
+              it may be removed without notice"
+
+%{  /* NOCONTEXT */
+#ifndef __SCHTEAM__
+    if (__isNonNilObject(anObject) && __isSmallInteger(newAge)) {
+        int age = __intVal(newAge);
+
+        if (age < 0) age = 0;
+        else if (age > AGE_MAX) age = AGE_MAX;
+        _SET_AGE(anObject, age);
+    }    
+#endif
+%}
+    "
+    |p|
+    p := Point new.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenuringScavenge.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenuringScavenge.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenuringScavenge.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenuringScavenge.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory setAgeOf:p to:0.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    ObjectMemory tenuringScavenge.
+    Transcript showCR:(ObjectMemory ageOf:p).
+    "
+!
+
 tenureParameters:magic
     "this is pure magic and not for public eyes ...
      This method allows fine tuning the scavenger internals,
@@ -5834,11 +5916,11 @@
 !ObjectMemory class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.287 2015-05-24 12:52:28 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.287 2015-05-24 12:52:28 cg Exp $'
+    ^ '$Header$'
 !
 
 version_SVN
--- a/PipeStream.st	Wed Sep 30 07:05:15 2015 +0200
+++ b/PipeStream.st	Thu Oct 01 06:52:24 2015 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -220,7 +218,7 @@
 	|p|
 
 	p := PipeStream bidirectionalFor:'cat -u'.
-	p nextPutAll:'Wer ist der Bürgermeister von Wesel'; cr.
+	p nextPutAll:'Wer ist der Bürgermeister von Wesel'; cr.
 	Transcript showCR:p nextLine.
 	p close
     "
@@ -488,13 +486,14 @@
 shutDown
     "close the Stream and terminate the command"
 
-    Lobby unregister:self.
+    self unregisterForFinalization
+       "terminate first under windows".
 
     "terminate first under windows"
     OperatingSystem isMSDOSlike ifTrue:[
-	self terminatePipeCommand.
-	self closeFileDescriptor.
-	^ self.
+        self terminatePipeCommand.
+        self closeFileDescriptor.
+        ^ self.
     ].
 
     "terminate last under unix"
@@ -612,17 +611,17 @@
      realCmd execDirectory tmpComFile nullOutput resultPid errorNumber|
 
     handle notNil ifTrue:[
-	"the pipe was already open ...
-	 this should (can) not happen."
-	^ self errorAlreadyOpen
+        "the pipe was already open ...
+         this should (can) not happen."
+        ^ self errorAlreadyOpen
     ].
 
     rwMode = #r ifTrue:[
-	mode := #readonly. didWrite := false.
+        mode := #readonly. didWrite := false.
     ] ifFalse:[rwMode = #'r+' ifTrue:[
-	mode := #readwrite. didWrite := true.
+        mode := #readwrite. didWrite := true.
     ] ifFalse:[
-	mode := #writeonly. didWrite := true.
+        mode := #writeonly. didWrite := true.
     ]].
 
     lastErrorNumber := nil.
@@ -634,79 +633,79 @@
     execFdArray := #(0 1 2) copy.
 
     OperatingSystem isVMSlike ifTrue:[
-	"/
-	"/ the generated COM-file includes a 'set default'
-	"/
-	tmpComFile := OperatingSystem createCOMFileForVMSCommand:aCommandString in:aDirectory.
-	realCmd := '@' , tmpComFile osName.
-	execDirectory := nil.
+        "/
+        "/ the generated COM-file includes a 'set default'
+        "/
+        tmpComFile := OperatingSystem createCOMFileForVMSCommand:aCommandString in:aDirectory.
+        realCmd := '@' , tmpComFile osName.
+        execDirectory := nil.
 
-	mbx := OperatingSystem createMailBox.
-	mbx isNil ifTrue:[
-	    lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber.
-	    tmpComFile delete.
-	    ^ self openError:errorNumber.
-	].
-	mbxName := OperatingSystem mailBoxNameOf:mbx.
+        mbx := OperatingSystem createMailBox.
+        mbx isNil ifTrue:[
+            lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber.
+            tmpComFile delete.
+            ^ self openError:errorNumber.
+        ].
+        mbxName := OperatingSystem mailBoxNameOf:mbx.
 
-	"/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR.
-	shellPath := ''.
-	shellArgs := realCmd.
+        "/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR.
+        shellPath := ''.
+        shellArgs := realCmd.
 
-	rwMode = #r ifTrue:[
-	    "redirect stdout of subprocess to write to mailbox"
-	    execFdArray at:2 put:mbx.
-	] ifFalse:[
-	    "redirect stdin of subprocess to read from mailbox"
-	    execFdArray at:1 put:mbx.
-	].
+        rwMode = #r ifTrue:[
+            "redirect stdout of subprocess to write to mailbox"
+            execFdArray at:2 put:mbx.
+        ] ifFalse:[
+            "redirect stdin of subprocess to read from mailbox"
+            execFdArray at:1 put:mbx.
+        ].
     ] ifFalse:[
-	shellAndArgs := OperatingSystem commandAndArgsForOSCommand:realCmd.
-	shellPath := shellAndArgs at:1.
-	shellArgs := shellAndArgs at:2.
+        shellAndArgs := OperatingSystem commandAndArgsForOSCommand:realCmd.
+        shellPath := shellAndArgs at:1.
+        shellArgs := shellAndArgs at:2.
 
-	mode == #readwrite ifTrue:[
-	    pipeFdArray := OperatingSystem makeBidirectionalPipe.
-	    pipeFdArray isNil ifTrue:[
-		lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber.
-		^ self openError:errorNumber.
-	    ].
-	    myFd := pipeFdArray at:1.
-	    execFd := pipeFdArray at:2.
-	    execFdArray at:1 put:execFd.
-	    execFdArray at:2 put:execFd.
-	] ifFalse:[
-	    pipeFdArray := OperatingSystem makePipe.
-	    pipeFdArray isNil ifTrue:[
-		lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber.
-		^ self openError:errorNumber.
-	    ].
+        mode == #readwrite ifTrue:[
+            pipeFdArray := OperatingSystem makeBidirectionalPipe.
+            pipeFdArray isNil ifTrue:[
+                lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber.
+                ^ self openError:errorNumber.
+            ].
+            myFd := pipeFdArray at:1.
+            execFd := pipeFdArray at:2.
+            execFdArray at:1 put:execFd.
+            execFdArray at:2 put:execFd.
+        ] ifFalse:[
+            pipeFdArray := OperatingSystem makePipe.
+            pipeFdArray isNil ifTrue:[
+                lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber.
+                ^ self openError:errorNumber.
+            ].
 
-	    mode == #readonly ifTrue:[
-		"redirect stdout of subprocess to write to pipe"
-		myFd := pipeFdArray at:1.
-		execFd := pipeFdArray at:2.
-		execFdArray at:2 put:execFd.
-	    ] ifFalse:[
-		"redirect stdin of subprocess to read from pipe"
-		myFd := pipeFdArray at:2.
-		execFd := pipeFdArray at:1.
-		execFdArray at:1 put:execFd.
-	    ].
-	].
+            mode == #readonly ifTrue:[
+                "redirect stdout of subprocess to write to pipe"
+                myFd := pipeFdArray at:1.
+                execFd := pipeFdArray at:2.
+                execFdArray at:2 put:execFd.
+            ] ifFalse:[
+                "redirect stdin of subprocess to read from pipe"
+                myFd := pipeFdArray at:2.
+                execFd := pipeFdArray at:1.
+                execFdArray at:1 put:execFd.
+            ].
+        ].
     ].
 
     errorDisposition == #discard ifTrue:[
-	nullOutput := Filename nullDevice writeStream.
-	execFdArray at:3 put:nullOutput fileDescriptor
+        nullOutput := Filename nullDevice writeStream.
+        execFdArray at:3 put:nullOutput fileDescriptor
     ] ifFalse:[
-	(errorDisposition == #inline or:[errorDisposition == #stdout]) ifTrue:[
-	    execFdArray at:3 put:1
-	] ifFalse:[
+        (errorDisposition == #inline or:[errorDisposition == #stdout]) ifTrue:[
+            execFdArray at:3 put:1
+        ] ifFalse:[
 "/            errorDisposition isStream ifTrue:[
 "/self halt.
 "/            ].
-	].
+        ].
     ].
 
     "/ must block here, to avoid races due to early finishing
@@ -716,84 +715,84 @@
 
     "beware: pid may change if subprocess is fast"
     pid := resultPid :=  Processor
-	       monitor:[
-		  OperatingSystem
-		      exec:shellPath
-		      withArguments:shellArgs
-		      environment:nil
-		      fileDescriptors:execFdArray
-		      fork:true
-		      newPgrp:true
-		      inDirectory:execDirectory.
-	       ]
-	       action:[:status |
-		  status stillAlive ifFalse:[
-		      exitStatus := status.
+               monitor:[
+                  OperatingSystem
+                      exec:shellPath
+                      withArguments:shellArgs
+                      environment:nil
+                      fileDescriptors:execFdArray
+                      fork:true
+                      newPgrp:true
+                      inDirectory:execDirectory.
+               ]
+               action:[:status |
+                  status stillAlive ifFalse:[
+                      exitStatus := status.
 
-		      "writing doesn't make sense - there is no reader any longer"
-		      mode == #readwrite ifTrue:[
-			  "... but allow to read the rest of the command's output"
-			  self shutDownOutput.
-		      ] ifFalse:[mode == #writeonly ifTrue:[
-			  self closeFileDescriptor.
-		      ]].
+                      "writing doesn't make sense - there is no reader any longer"
+                      mode == #readwrite ifTrue:[
+                          "... but allow to read the rest of the command's output"
+                          self shutDownOutput.
+                      ] ifFalse:[mode == #writeonly ifTrue:[
+                          self closeFileDescriptor.
+                      ]].
 
-		      OperatingSystem closePid:pid.
-		      pid := nil.
-		      exitSema signal.
-		  ].
-	       ].
+                      OperatingSystem closePid:pid.
+                      pid := nil.
+                      exitSema signal.
+                  ].
+               ].
 
     "subprocess has been created.
      close unused filedescriptors"
 
     execFd notNil ifTrue:[
-	OperatingSystem closeFd:execFd.
+        OperatingSystem closeFd:execFd.
     ].
 
     nullOutput notNil ifTrue:[
-	nullOutput close
+        nullOutput close
     ].
 
     resultPid notNil ifTrue:[
-	"successfull creation of subprocesss"
-	OperatingSystem isVMSlike ifTrue:[
-	    "/
-	    "/ reopen the mailbox as a file ...
-	    "/
-	    mbxName := OperatingSystem mailBoxNameOf:mbx.
-	    mbxName notNil ifTrue:[
-		super open:mbxName withMode:rwMode.
-		exitAction := [tmpComFile delete].
-	    ].
-	] ifFalse:[
-	    self setFileDescriptor:myFd mode:rwMode.
-	    handleType := #pipeFilePointer.
-	]
+        "successfull creation of subprocesss"
+        OperatingSystem isVMSlike ifTrue:[
+            "/
+            "/ reopen the mailbox as a file ...
+            "/
+            mbxName := OperatingSystem mailBoxNameOf:mbx.
+            mbxName notNil ifTrue:[
+                super open:mbxName withMode:rwMode.
+                exitAction := [tmpComFile delete].
+            ].
+        ] ifFalse:[
+            self setFileDescriptor:myFd mode:rwMode.
+            handleType := #pipeFilePointer.
+        ]
     ] ifFalse:[
-	"creation of subprocesss failed"
-	lastErrorNumber := OperatingSystem currentErrorNumber.
-	OperatingSystem isVMSlike ifTrue:[
-	    OperatingSystem destroyMailBox:mbx.
-	    tmpComFile delete.
-	] ifFalse:[
-	    OperatingSystem closeFd:myFd.
-	].
+        "creation of subprocesss failed"
+        lastErrorNumber := OperatingSystem currentErrorNumber.
+        OperatingSystem isVMSlike ifTrue:[
+            OperatingSystem destroyMailBox:mbx.
+            tmpComFile delete.
+        ] ifFalse:[
+            OperatingSystem closeFd:myFd.
+        ].
     ].
 
     blocked ifFalse:[
-	OperatingSystem unblockInterrupts
+        OperatingSystem unblockInterrupts
     ].
 
     (resultPid isNil or:[lastErrorNumber notNil]) ifTrue:[
-	"
-	 the pipe open failed for some reason ...
-	 ... this may be either due to an invalid command string,
-	 or due to the system running out of memory (when forking
-	 the unix process)
-	"
-	exitAction value.
-	^ self openError:lastErrorNumber.
+        "
+         the pipe open failed for some reason ...
+         ... this may be either due to an invalid command string,
+         or due to the system running out of memory (when forking
+         the unix process)
+        "
+        exitAction value.
+        ^ self openError:lastErrorNumber.
     ].
 
     commandString := realCmd.
@@ -804,7 +803,7 @@
     position := 0.
     hitEOF := false.
     binary := false.
-    Lobby register:self.
+    self registerForFinalization.
 
     "Modified: / 23.4.1996 / 17:05:59 / stefan"
     "Modified: / 28.1.1998 / 14:47:34 / md"
--- a/ProcessorScheduler.st	Wed Sep 30 07:05:15 2015 +0200
+++ b/ProcessorScheduler.st	Thu Oct 01 06:52:24 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -3059,6 +3061,34 @@
     "Modified: 23.9.1996 / 14:35:09 / cg"
 !
 
+removeTimeoutWithID:anID object:aBlockOrSemaphore
+    "remove the timeOut with anID (as returned by #addTimedBlock)
+     from the list of time-scheduled-blocks.
+     If aBlockOrSempahore is not nil, check if the id is really for the block
+     or for the semphore."
+
+    |index "{ Class: SmallInteger }"
+     wasBlocked|
+
+    index := anID.
+    (anID notNil and:[index > 0]) ifTrue:[
+        wasBlocked := OperatingSystem blockInterrupts.
+
+        (aBlockOrSemaphore notNil 
+          and:[(timeoutActionArray at:index ifAbsent:[]) ~~ aBlockOrSemaphore
+          and:[(timeoutSemaphoreArray at:index ifAbsent:[]) ~~ aBlockOrSemaphore]]) ifTrue:[
+            'Processor: trying to remove stale timeout id - ignored' errorPrintCR.
+        ] ifFalse:[
+            timeoutArray at:index put:nil.
+            timeoutActionArray at:index put:nil.
+            timeoutSemaphoreArray at:index put:nil.
+            timeoutProcessArray at:index put:nil.
+        ].
+
+        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+    ]
+!
+
 timeoutHandlerProcess
     (timeoutHandlerProcess isNil or:[timeoutHandlerProcess isDead]) ifTrue:[
 	timeoutHandlerProcess :=