ExternalStream.st
changeset 16508 f2d6afb19d35
parent 16493 a5ca28db8d7d
child 16509 2cf139885242
--- a/ExternalStream.st	Fri May 30 12:42:53 2014 +0200
+++ b/ExternalStream.st	Mon Jun 02 13:24:26 2014 +0200
@@ -44,6 +44,10 @@
 # include <linuxIntern.h>
 #endif
 
+#if !defined(MSDOS_LIKE) && !defined(__openVMS__)
+# include <termios.h>
+#endif
+
 #ifdef hpux
 # define fileno(f)      ((f->__fileH << 8) | (f->__fileL))
 #endif
@@ -196,7 +200,7 @@
 # define DEBUGBUFFER(buf)  \
     if (((char *)(buf) >= __survStartPtr) \
      && ((char *)(buf) < __survEndPtr)) { \
-        __fatal0("read into survivor\n"); \
+	__fatal0("read into survivor\n"); \
     }
 
 #else
@@ -217,33 +221,33 @@
 
 #ifdef WIN32
 #  define READ(ret, f, cp, n, handleType) { \
-        if (handleType == @symbol(socketHandle)) { \
-          (ret) = __STX_WSA_NOINT_CALL4("recv", recv, (f), (cp), (n), 0); \
-        } else { \
-          HANDLE h = _get_osfhandle(fileno(f)); \
-          if (handleType == @symbol(socketFilePointer)) { \
-            (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\
-          } else { \
-            int __res; \
-            (ret) = __STX_API_NOINT_CALL5("ReadFile", ReadFile, h, (cp), (n), &__res, 0);\
-            (ret) = (ret) ? __res : -1; \
-          } \
-        } \
+	if (handleType == @symbol(socketHandle)) { \
+	  (ret) = __STX_WSA_NOINT_CALL4("recv", recv, (f), (cp), (n), 0); \
+	} else { \
+	  HANDLE h = _get_osfhandle(fileno(f)); \
+	  if (handleType == @symbol(socketFilePointer)) { \
+	    (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\
+	  } else { \
+	    int __res; \
+	    (ret) = __STX_API_NOINT_CALL5("ReadFile", ReadFile, h, (cp), (n), &__res, 0);\
+	    (ret) = (ret) ? __res : -1; \
+	  } \
+	} \
       }
 
 #  define WRITE(ret, f, cp, n, handleType) { \
-        if (handleType == @symbol(socketHandle)) { \
-          (ret) = __STX_WSA_NOINT_CALL4("send", send, (f), (cp), (n), 0); \
-        } else {\
-          HANDLE h = _get_osfhandle(fileno(f)); \
-          if (handleType == @symbol(socketFilePointer)) { \
-            (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\
-          } else {\
-            int __res; \
-            (ret) = __STX_API_NOINT_CALL5("WriteFile", WriteFile, h, (cp), (n), &__res, 0);\
-            (ret) = (ret) ? __res : -1; \
-          } \
-        } \
+	if (handleType == @symbol(socketHandle)) { \
+	  (ret) = __STX_WSA_NOINT_CALL4("send", send, (f), (cp), (n), 0); \
+	} else {\
+	  HANDLE h = _get_osfhandle(fileno(f)); \
+	  if (handleType == @symbol(socketFilePointer)) { \
+	    (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\
+	  } else {\
+	    int __res; \
+	    (ret) = __STX_API_NOINT_CALL5("WriteFile", WriteFile, h, (cp), (n), &__res, 0);\
+	    (ret) = (ret) ? __res : -1; \
+	  } \
+	} \
       }
 
 # define FFLUSH(fp)             fflush(fp)
@@ -254,56 +258,56 @@
 # define __READING__(f)                          \
     if ((__INST(didWrite) != false)              \
      && (__INST(mode) == @symbol(readwrite))) {  \
-        __INST(didWrite) = false;                \
-        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+	__INST(didWrite) = false;                \
+	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 # define __WRITING__(f)                          \
     if ((__INST(didWrite) != true)               \
      && (__INST(mode) == @symbol(readwrite))) {  \
-        __INST(didWrite) = true;                 \
-        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+	__INST(didWrite) = true;                 \
+	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 # define __UNGETC__(c, f, isBuffered)                   \
     if (isBuffered) {                                   \
-        ungetc((c), (f));                               \
+	ungetc((c), (f));                               \
     } else {                                            \
       __INST(readAhead) = __mkSmallInteger((c));        \
     }
 
 # define __READBYTE__(ret, f, buf, isBuffered, handleType) \
     if (isBuffered) {                                   \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) >= 0) {                           \
-                *(buf) = (ret);                         \
-                (ret) = 1;                              \
-            } else if (ferror(f)) {                     \
-                if (__threadErrno == EINTR) {           \
-                    clearerr(f);                        \
-                    continue;                           \
-                }                                       \
-            } else {                                    \
-                (ret) = 0;                              \
-            }                                           \
-            break;                                      \
-        }                                               \
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) >= 0) {                           \
+		*(buf) = (ret);                         \
+		(ret) = 1;                              \
+	    } else if (ferror(f)) {                     \
+		if (__threadErrno == EINTR) {           \
+		    clearerr(f);                        \
+		    continue;                           \
+		}                                       \
+	    } else {                                    \
+		(ret) = 0;                              \
+	    }                                           \
+	    break;                                      \
+	}                                               \
     } else {                                            \
-        OBJ rA = __INST(readAhead);                     \
-        if (rA != nil) {                                \
-            *(buf) = (char)__intVal(rA);                \
-            __INST(readAhead) = nil;                    \
-            (ret) = 1;                                  \
-        } else {                                        \
-            for (;;) {                                  \
-                CLEAR_ERRNO;                            \
-                READ((ret), f, buf, 1, handleType);       \
-                if ((ret) >= 0 || __threadErrno != EINTR) \
-                    break;                              \
-            }                                           \
-        }                                               \
+	OBJ rA = __INST(readAhead);                     \
+	if (rA != nil) {                                \
+	    *(buf) = (char)__intVal(rA);                \
+	    __INST(readAhead) = nil;                    \
+	    (ret) = 1;                                  \
+	} else {                                        \
+	    for (;;) {                                  \
+		CLEAR_ERRNO;                            \
+		READ((ret), f, buf, 1, handleType);       \
+		if ((ret) >= 0 || __threadErrno != EINTR) \
+		    break;                              \
+	    }                                           \
+	}                                               \
     }
 
   /*
@@ -313,110 +317,110 @@
 # define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType)    \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (__threadErrno == EINTR) {       \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            (buf)[__offs++] = (ret);                    \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (__threadErrno == EINTR) {       \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    (buf)[__offs++] = (ret);                    \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int __offs = 0;                                 \
-                                                        \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__offs] = __intVal(rA);           \
-                __INST(readAhead) = nil;                \
-                (ret) = 1;                              \
-            } else {                                    \
-                CLEAR_ERRNO;                            \
-                READ((ret), f, (buf)+__offs, (cnt)-__offs, handleType); \
-                if ((ret) <= 0) {                       \
-                    if ((ret) < 0 && __threadErrno == EINTR) {  \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                }                                       \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+							\
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__offs] = __intVal(rA);           \
+		__INST(readAhead) = nil;                \
+		(ret) = 1;                              \
+	    } else {                                    \
+		CLEAR_ERRNO;                            \
+		READ((ret), f, (buf)+__offs, (cnt)-__offs, handleType); \
+		if ((ret) <= 0) {                       \
+		    if ((ret) < 0 && __threadErrno == EINTR) {  \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		}                                       \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
    }
 
 # define __READAVAILBYTES__(ret, f, buf, cnt, isBuffered, handleType) \
   {                                                     \
     int __offs = 0;                                     \
     int oldFlags;                                       \
-                                                        \
+							\
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (__threadErrno == EINTR) {       \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            (buf)[__offs++] = (ret);                    \
-        }                                               \
-        (ret) = __offs;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (__threadErrno == EINTR) {       \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    (buf)[__offs++] = (ret);                    \
+	}                                               \
+	(ret) = __offs;                                 \
     } else {                                            \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__offs] = __intVal(rA);           \
-                __INST(readAhead) = nil;                \
-                (ret) = 1;                              \
-                __offs ++;                              \
-                continue;                               \
-            }                                           \
-            CLEAR_ERRNO;                                \
-            {                                           \
-              int res = 0;                              \
-              if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res), 1)) \
-                  || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \
-                  || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0), 1))) { \
-                  if (res > 0) {                        \
-                      if (res > ((cnt)-__offs))         \
-                          res = (cnt)-__offs;           \
-                      READ((ret), f, (buf)+__offs, res, handleType); \
-                  } else {                              \
-                      (ret) = 0;                        \
-                      break;                            \
-                  }                                     \
-              } else {                                  \
-                  READ((ret), f, (buf)+__offs, (cnt)-__offs, handleType); \
-              }                                         \
-            }                                           \
-            if ((ret) <= 0) {                           \
-                if (ret < 0 && __threadErrno == EINTR)  \
-                    continue;                           \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        (ret) = __offs;                                 \
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__offs] = __intVal(rA);           \
+		__INST(readAhead) = nil;                \
+		(ret) = 1;                              \
+		__offs ++;                              \
+		continue;                               \
+	    }                                           \
+	    CLEAR_ERRNO;                                \
+	    {                                           \
+	      int res = 0;                              \
+	      if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res), 1)) \
+		  || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \
+		  || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0), 1))) { \
+		  if (res > 0) {                        \
+		      if (res > ((cnt)-__offs))         \
+			  res = (cnt)-__offs;           \
+		      READ((ret), f, (buf)+__offs, res, handleType); \
+		  } else {                              \
+		      (ret) = 0;                        \
+		      break;                            \
+		  }                                     \
+	      } else {                                  \
+		  READ((ret), f, (buf)+__offs, (cnt)-__offs, handleType); \
+	      }                                         \
+	    }                                           \
+	    if ((ret) <= 0) {                           \
+		if (ret < 0 && __threadErrno == EINTR)  \
+		    continue;                           \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	(ret) = __offs;                                 \
     }                                                   \
   }
 
@@ -427,63 +431,63 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-                                                        \
+							\
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (__threadErrno == EINTR) {       \
-                        clearerr(f);                    \
-                        /* refetch */                   \
-                        buf = (char *)(obj);   \
-                        continue;                       \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            (buf)[__ooffs+__offs] = (ret);              \
-            __offs++;                                   \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (__threadErrno == EINTR) {       \
+			clearerr(f);                    \
+			/* refetch */                   \
+			buf = (char *)(obj);   \
+			continue;                       \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    (buf)[__ooffs+__offs] = (ret);              \
+	    __offs++;                                   \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        while (__offs < (cnt)) {                        \
-            char __buf[IO_BUFFER_SIZE];                 \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__ooffs+__offs] = __intVal(rA);   \
-                __INST(readAhead) = nil;                \
-                (ret) = 1;                              \
-            } else {                                    \
-                int l;                                  \
-                CLEAR_ERRNO;                            \
-                l = (cnt)-__offs;                       \
-                if ( l > IO_BUFFER_SIZE)                \
-                  l = IO_BUFFER_SIZE;                   \
-                READ((ret),f, __buf, l, handleType);                  \
-                if ((ret) <= 0) {                       \
-                    if ((ret) < 0 && __threadErrno == EINTR) {  \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                }                                       \
-            }                                           \
-            if ((ret) > 0 ) {                           \
-                /* refetch */                               \
-                buf = (char *)(obj);               \
-                memcpy((buf)+__ooffs+__offs,__buf,(ret));   \
-                __offs += (ret);                            \
-            } else {                                        \
-                (ret) = 0;                                  \
-            }                                               \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    char __buf[IO_BUFFER_SIZE];                 \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__ooffs+__offs] = __intVal(rA);   \
+		__INST(readAhead) = nil;                \
+		(ret) = 1;                              \
+	    } else {                                    \
+		int l;                                  \
+		CLEAR_ERRNO;                            \
+		l = (cnt)-__offs;                       \
+		if ( l > IO_BUFFER_SIZE)                \
+		  l = IO_BUFFER_SIZE;                   \
+		READ((ret),f, __buf, l, handleType);                  \
+		if ((ret) <= 0) {                       \
+		    if ((ret) < 0 && __threadErrno == EINTR) {  \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		}                                       \
+	    }                                           \
+	    if ((ret) > 0 ) {                           \
+		/* refetch */                               \
+		buf = (char *)(obj);               \
+		memcpy((buf)+__ooffs+__offs,__buf,(ret));   \
+		__offs += (ret);                            \
+	    } else {                                        \
+		(ret) = 0;                                  \
+	    }                                               \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -492,141 +496,141 @@
     int __ooffs = obj_offs;                          \
     int __offs = 0;                                  \
     char *buf = (char *)(obj);                       \
-                                                     \
+						     \
     (ret) = 0;                                       \
     if (isBuffered) {                                \
-        while (__offs < (cnt)) {                     \
-            CLEAR_ERRNO;                             \
-            (ret) = getc(f);                         \
-            if ((ret) < 0) {                         \
-                if (ferror(f)) {                     \
-                    if (__threadErrno == EINTR) {    \
-                        clearerr(f);                 \
-                        /* refetch */                \
-                        buf = (char *)(obj);\
-                        continue;                    \
-                    }                                \
-                } else {                             \
-                    (ret) = 0;                       \
-                }                                    \
-                break;                               \
-            }                                        \
-            (buf)[__ooffs+__offs] = (ret);           \
-            __offs++;                                \
-        }                                            \
-        if (__offs > 0)                              \
-            (ret) = __offs;                          \
+	while (__offs < (cnt)) {                     \
+	    CLEAR_ERRNO;                             \
+	    (ret) = getc(f);                         \
+	    if ((ret) < 0) {                         \
+		if (ferror(f)) {                     \
+		    if (__threadErrno == EINTR) {    \
+			clearerr(f);                 \
+			/* refetch */                \
+			buf = (char *)(obj);\
+			continue;                    \
+		    }                                \
+		} else {                             \
+		    (ret) = 0;                       \
+		}                                    \
+		break;                               \
+	    }                                        \
+	    (buf)[__ooffs+__offs] = (ret);           \
+	    __offs++;                                \
+	}                                            \
+	if (__offs > 0)                              \
+	    (ret) = __offs;                          \
     } else {                                         \
-        while (__offs < (cnt)) {                     \
-            char __buf[IO_BUFFER_SIZE];              \
-            OBJ rA = __INST(readAhead);              \
-            if (rA != nil) {                         \
-                (buf)[__ooffs+__offs] = __intVal(rA);\
-                __INST(readAhead) = nil;             \
-                (ret) = 1;                           \
-                __offs++;                            \
-                continue;                            \
-            }                                        \
-            {                                        \
-                int res = 0;                         \
-                int l = (cnt)-__offs;                \
-                CLEAR_ERRNO;                         \
-                if (l > IO_BUFFER_SIZE)              \
-                    l = IO_BUFFER_SIZE;              \
-                if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)), FIONREAD, &res), 1)) \
-                    || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \
-                    || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0,0,0,&res,0), 1))) { \
-                    if (res > 0) {                   \
-                        if (res > l) res = l;        \
-                        READ((ret), f, __buf, res, handleType); \
-                    } else {                         \
-                        (ret) = 0;                   \
-                        break;                       \
-                    }                                \
-                } else {                             \
-                    READ((ret), f, __buf, l, handleType); \
-                }                                     \
-                if ((ret) <= 0) {                     \
-                    if (ret < 0 && __threadErrno == EINTR) \
-                        continue;                       \
-                    break;                              \
-                }                                       \
-            }                                           \
-            if ((ret) > 0) {                            \
-                buf = (char *)(obj);                    \
-                memcpy((buf)+__ooffs+__offs, __buf, (ret)); \
-                __offs += (ret);                        \
-            } else {                                    \
-                (ret) = 0;                              \
-            }                                           \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                     \
+	    char __buf[IO_BUFFER_SIZE];              \
+	    OBJ rA = __INST(readAhead);              \
+	    if (rA != nil) {                         \
+		(buf)[__ooffs+__offs] = __intVal(rA);\
+		__INST(readAhead) = nil;             \
+		(ret) = 1;                           \
+		__offs++;                            \
+		continue;                            \
+	    }                                        \
+	    {                                        \
+		int res = 0;                         \
+		int l = (cnt)-__offs;                \
+		CLEAR_ERRNO;                         \
+		if (l > IO_BUFFER_SIZE)              \
+		    l = IO_BUFFER_SIZE;              \
+		if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)), FIONREAD, &res), 1)) \
+		    || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \
+		    || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0,0,0,&res,0), 1))) { \
+		    if (res > 0) {                   \
+			if (res > l) res = l;        \
+			READ((ret), f, __buf, res, handleType); \
+		    } else {                         \
+			(ret) = 0;                   \
+			break;                       \
+		    }                                \
+		} else {                             \
+		    READ((ret), f, __buf, l, handleType); \
+		}                                     \
+		if ((ret) <= 0) {                     \
+		    if (ret < 0 && __threadErrno == EINTR) \
+			continue;                       \
+		    break;                              \
+		}                                       \
+	    }                                           \
+	    if ((ret) > 0) {                            \
+		buf = (char *)(obj);                    \
+		memcpy((buf)+__ooffs+__offs, __buf, (ret)); \
+		__offs += (ret);                        \
+	    } else {                                    \
+		(ret) = 0;                              \
+	    }                                           \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
   }
 
 # define __WRITEBYTE__(ret, f, buf, isBuffered, handleType)         \
     if (isBuffered) {                                   \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            ret = putc(*(buf), f);                      \
-            if ((ret) >= 0) {                           \
-                (ret) = 1;                              \
-            } else if (ferror(f)) {                     \
-                if (__threadErrno == EINTR) {                   \
-                    clearerr(f);                        \
-                    continue;                           \
-                }                                       \
-            } else                                      \
-                (ret) = 0;                              \
-            break;                                      \
-        }                                               \
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    ret = putc(*(buf), f);                      \
+	    if ((ret) >= 0) {                           \
+		(ret) = 1;                              \
+	    } else if (ferror(f)) {                     \
+		if (__threadErrno == EINTR) {                   \
+		    clearerr(f);                        \
+		    continue;                           \
+		}                                       \
+	    } else                                      \
+		(ret) = 0;                              \
+	    break;                                      \
+	}                                               \
     } else {                                            \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            WRITE(ret,f, buf, 1, handleType);                       \
-            if ((ret) >= 0 || __threadErrno != EINTR)           \
-                break;                                  \
-        }                                               \
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    WRITE(ret,f, buf, 1, handleType);                       \
+	    if ((ret) >= 0 || __threadErrno != EINTR)           \
+		break;                                  \
+	}                                               \
    }
 
 # define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType)   \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
-            if ((ret) <= 0) {                           \
-                if (ferror(f)) {                        \
-                    if (__threadErrno == EINTR) {               \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
+	    if ((ret) <= 0) {                           \
+		if (ferror(f)) {                        \
+		    if (__threadErrno == EINTR) {               \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            WRITE(ret,f, (buf)+__offs, (cnt)-__offs, handleType);   \
-            if (ret <= 0) {                             \
-                if (ret < 0 && __threadErrno == EINTR) { \
-                    continue;                           \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    WRITE(ret,f, (buf)+__offs, (cnt)-__offs, handleType);   \
+	    if (ret <= 0) {                             \
+		if (ret < 0 && __threadErrno == EINTR) { \
+		    continue;                           \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
    }
 
 # define __WRITEBYTES_OBJ__(ret, f, obj, obj_offs, cnt, isBuffered, handleType) \
@@ -634,51 +638,51 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-                                                        \
+							\
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \
-            if ((ret) <= 0) {                           \
-                if (ferror(f)) {                        \
-                    if (__threadErrno == EINTR) {       \
-                        /* refetch */                   \
-                        buf = (char *)(obj);   \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \
+	    if ((ret) <= 0) {                           \
+		if (ferror(f)) {                        \
+		    if (__threadErrno == EINTR) {       \
+			/* refetch */                   \
+			buf = (char *)(obj);   \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        while (__offs < (cnt)) {                        \
-            char __buf[IO_BUFFER_SIZE];                 \
-            int l;                                      \
-            CLEAR_ERRNO;                                \
-            l = (cnt)-__offs;                           \
-            if ( l > IO_BUFFER_SIZE)                    \
-              l = IO_BUFFER_SIZE;                       \
-            /* refetch */                               \
-            buf = (char *)(obj);               \
-            memcpy(__buf,(buf)+__ooffs+__offs,l);       \
-            WRITE(ret,f, __buf, l, handleType);                     \
-            if (ret <= 0) {                             \
-                if (ret < 0 && __threadErrno == EINTR) {        \
-                    continue;                           \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    char __buf[IO_BUFFER_SIZE];                 \
+	    int l;                                      \
+	    CLEAR_ERRNO;                                \
+	    l = (cnt)-__offs;                           \
+	    if ( l > IO_BUFFER_SIZE)                    \
+	      l = IO_BUFFER_SIZE;                       \
+	    /* refetch */                               \
+	    buf = (char *)(obj);               \
+	    memcpy(__buf,(buf)+__ooffs+__offs,l);       \
+	    WRITE(ret,f, __buf, l, handleType);                     \
+	    if (ret <= 0) {                             \
+		if (ret < 0 && __threadErrno == EINTR) {        \
+		    continue;                           \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -689,15 +693,15 @@
 # define __READING__(f)                          \
     if ((__INST(didWrite) != false)              \
      && (__INST(mode) == @symbol(readwrite))) {  \
-        __INST(didWrite) = false;                \
-        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+	__INST(didWrite) = false;                \
+	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 # define __WRITING__(f)                          \
     if ((__INST(didWrite) != true)               \
      && (__INST(mode) == @symbol(readwrite))) {  \
-        __INST(didWrite) = true;                 \
-        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+	__INST(didWrite) = true;                 \
+	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 
@@ -707,73 +711,73 @@
 # else /* use STDIO */
 #  define __UNGETC__(c, f, isBuffered)                  \
     if (isBuffered) {                                   \
-        ungetc((c), (f));                               \
+	ungetc((c), (f));                               \
     } else {                                            \
-        __INST(readAhead) = __mkSmallInteger((c));          \
+	__INST(readAhead) = __mkSmallInteger((c));          \
     }
 # endif /* use STDIO */
 
 # ifdef NO_STDIO
 #  define __READBYTE__(ret, f, buf, isBuffered, handleType)         \
     {                                                   \
-        OBJ rA = __INST(readAhead);                     \
-        if (rA != nil) {                                \
-            *(buf) = __intVal(rA);                      \
-            DEBUGBUFFER(buf);                           \
-            __INST(readAhead) = nil;                    \
-            (ret) = 1;                                  \
-        } else {                                        \
-            for (;;) {                                  \
-                CLEAR_ERRNO;                            \
-                (ret) = READ(f, buf, 1, handleType);    \
-                DEBUGBUFFER(buf);                       \
-                if ((ret) >= 0) break;                  \
-                if (errno != EINTR) {                   \
-                    break;                              \
-                }                                       \
-                __HANDLE_INTERRUPTS__;                  \
-            }                                           \
-        }                                               \
+	OBJ rA = __INST(readAhead);                     \
+	if (rA != nil) {                                \
+	    *(buf) = __intVal(rA);                      \
+	    DEBUGBUFFER(buf);                           \
+	    __INST(readAhead) = nil;                    \
+	    (ret) = 1;                                  \
+	} else {                                        \
+	    for (;;) {                                  \
+		CLEAR_ERRNO;                            \
+		(ret) = READ(f, buf, 1, handleType);    \
+		DEBUGBUFFER(buf);                       \
+		if ((ret) >= 0) break;                  \
+		if (errno != EINTR) {                   \
+		    break;                              \
+		}                                       \
+		__HANDLE_INTERRUPTS__;                  \
+	    }                                           \
+	}                                               \
     }
 # else /* use STDIO */
 #  define __READBYTE__(ret, f, buf, isBuffered, handleType)         \
     if (isBuffered) {                                   \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) >= 0) {                           \
-                DEBUGBUFFER(buf);                       \
-                *(buf) = (ret);                         \
-                (ret) = 1;                              \
-            } else if (ferror(f)) {                     \
-                if (errno == EINTR) {                   \
-                    __HANDLE_INTERRUPTS__;              \
-                    clearerr(f);                        \
-                    continue;                           \
-                }                                       \
-            } else                                      \
-                (ret) = 0;                              \
-            break;                                      \
-        }                                               \
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) >= 0) {                           \
+		DEBUGBUFFER(buf);                       \
+		*(buf) = (ret);                         \
+		(ret) = 1;                              \
+	    } else if (ferror(f)) {                     \
+		if (errno == EINTR) {                   \
+		    __HANDLE_INTERRUPTS__;              \
+		    clearerr(f);                        \
+		    continue;                           \
+		}                                       \
+	    } else                                      \
+		(ret) = 0;                              \
+	    break;                                      \
+	}                                               \
     } else {                                            \
-        OBJ rA = __INST(readAhead);                     \
-        if (rA != nil) {                                \
-            *(buf) = __intVal(rA);                      \
-            DEBUGBUFFER(buf);                           \
-            __INST(readAhead) = nil;                    \
-            (ret) = 1;                                  \
-        } else {                                        \
-            for (;;) {                                  \
-                CLEAR_ERRNO;                            \
-                (ret) = read(fileno(f), buf, 1);        \
-                DEBUGBUFFER(buf);                       \
-                if ((ret) >= 0) break;                  \
-                if (errno != EINTR) {                   \
-                    break;                              \
-                }                                       \
-                __HANDLE_INTERRUPTS__;                  \
-            }                                           \
-        }                                               \
+	OBJ rA = __INST(readAhead);                     \
+	if (rA != nil) {                                \
+	    *(buf) = __intVal(rA);                      \
+	    DEBUGBUFFER(buf);                           \
+	    __INST(readAhead) = nil;                    \
+	    (ret) = 1;                                  \
+	} else {                                        \
+	    for (;;) {                                  \
+		CLEAR_ERRNO;                            \
+		(ret) = read(fileno(f), buf, 1);        \
+		DEBUGBUFFER(buf);                       \
+		if ((ret) >= 0) break;                  \
+		if (errno != EINTR) {                   \
+		    break;                              \
+		}                                       \
+		__HANDLE_INTERRUPTS__;                  \
+	    }                                           \
+	}                                               \
    }
 # endif /* use STDIO */
 
@@ -784,84 +788,84 @@
 # ifdef NO_STDIO
 #  define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType)   \
     {                                                   \
-        int __offs = 0, __cnt;                          \
-                                                        \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__offs] = __intVal(rA);           \
-                DEBUGBUFFER(buf);                       \
-                __INST(readAhead) = nil;                \
-                __offs++;                               \
-            } else {                                    \
-                CLEAR_ERRNO;                            \
-                __cnt = READ(f, (buf)+__offs, (cnt)-__offs, handleType); \
-                DEBUGBUFFER(buf);                       \
-                if (__cnt <= 0) {                       \
-                    if (__cnt < 0 && errno == EINTR) {  \
-                        __HANDLE_INTERRUPTS__;          \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                }                                       \
-                __offs += __cnt;                        \
-            }                                           \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0, __cnt;                          \
+							\
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__offs] = __intVal(rA);           \
+		DEBUGBUFFER(buf);                       \
+		__INST(readAhead) = nil;                \
+		__offs++;                               \
+	    } else {                                    \
+		CLEAR_ERRNO;                            \
+		__cnt = READ(f, (buf)+__offs, (cnt)-__offs, handleType); \
+		DEBUGBUFFER(buf);                       \
+		if (__cnt <= 0) {                       \
+		    if (__cnt < 0 && errno == EINTR) {  \
+			__HANDLE_INTERRUPTS__;          \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		}                                       \
+		__offs += __cnt;                        \
+	    }                                           \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
    }
 # else /* use STDIO */
 #  define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType)     \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (errno == EINTR) {               \
-                        __HANDLE_INTERRUPTS__;          \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            DEBUGBUFFER(buf);                           \
-            (buf)[__offs++] = (ret);                    \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (errno == EINTR) {               \
+			__HANDLE_INTERRUPTS__;          \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    DEBUGBUFFER(buf);                           \
+	    (buf)[__offs++] = (ret);                    \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int __offs = 0, __cnt;                          \
-        int fd = fileno(f);                             \
-                                                        \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                DEBUGBUFFER(buf);                       \
-                (buf)[__offs] = __intVal(rA);           \
-                __INST(readAhead) = nil;                \
-                __offs++;                               \
-            } else {                                    \
-                CLEAR_ERRNO;                            \
-                __cnt = read(fd, (buf)+__offs, (cnt)-__offs);  \
-                DEBUGBUFFER(buf);                       \
-                if (__cnt <= 0) {                       \
-                    if (__cnt < 0 && errno == EINTR) {  \
-                        __HANDLE_INTERRUPTS__;          \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                }                                       \
-                __offs += __cnt;                        \
-            }                                           \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0, __cnt;                          \
+	int fd = fileno(f);                             \
+							\
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		DEBUGBUFFER(buf);                       \
+		(buf)[__offs] = __intVal(rA);           \
+		__INST(readAhead) = nil;                \
+		__offs++;                               \
+	    } else {                                    \
+		CLEAR_ERRNO;                            \
+		__cnt = read(fd, (buf)+__offs, (cnt)-__offs);  \
+		DEBUGBUFFER(buf);                       \
+		if (__cnt <= 0) {                       \
+		    if (__cnt < 0 && errno == EINTR) {  \
+			__HANDLE_INTERRUPTS__;          \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		}                                       \
+		__offs += __cnt;                        \
+	    }                                           \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
    }
 
 
@@ -871,7 +875,7 @@
 
 #  if defined(F_GETFL) && defined(F_SETFL) && (defined(O_NONBLOCK) || defined(O_NDELAY) || defined(FNDELAY))
 #   define SETFLAGS(fd, flags) \
-        fcntl(fd, F_SETFL, flags)
+	fcntl(fd, F_SETFL, flags)
 
 #   if defined(O_NONBLOCK)
 #    define __STX_NONBLOCK_FLAG O_NONBLOCK
@@ -884,13 +888,13 @@
 #   endif
 
 #   define SETNONBLOCKING(fd, oldFlags) \
-        { \
-            int flags = fcntl(fd, F_GETFL, 0); \
-            if (flags >= 0) { \
-                fcntl(fd, F_SETFL, flags | __STX_NONBLOCK_FLAG); \
-            } \
-            oldFlags = flags; \
-        }
+	{ \
+	    int flags = fcntl(fd, F_GETFL, 0); \
+	    if (flags >= 0) { \
+		fcntl(fd, F_SETFL, flags | __STX_NONBLOCK_FLAG); \
+	    } \
+	    oldFlags = flags; \
+	}
 #  else
 #   define SETFLAGS(fd, flags) /* nothing */
 #   define SETNONBLOCKING(fd, oldFlags) /* nothing */
@@ -900,52 +904,52 @@
   {                                                     \
     int __offs = 0, __cnt;                              \
     int oldFlags;                                       \
-                                                        \
+							\
     (ret) = 0;                                          \
     SETNONBLOCKING(fileno(f), oldFlags);                \
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (errno == EINTR) {               \
-                        (ret) = 0;                      \
-                        clearerr(f);                    \
-                        break;                          \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            (buf)[__offs++] = (ret);                    \
-            DEBUGBUFFER(buf);                           \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (errno == EINTR) {               \
+			(ret) = 0;                      \
+			clearerr(f);                    \
+			break;                          \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    (buf)[__offs++] = (ret);                    \
+	    DEBUGBUFFER(buf);                           \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int fd = fileno(f);                             \
-                                                        \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__offs] = __intVal(rA);           \
-                DEBUGBUFFER(buf);                       \
-                __INST(readAhead) = nil;                \
-                __offs++;                               \
-                continue;                               \
-            }                                           \
-            CLEAR_ERRNO;                                \
-            __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \
-            DEBUGBUFFER(buf);                           \
-            if (__cnt > 0) {                            \
-                __offs += __cnt;                        \
-            }                                           \
-            break;                                      \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int fd = fileno(f);                             \
+							\
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__offs] = __intVal(rA);           \
+		DEBUGBUFFER(buf);                       \
+		__INST(readAhead) = nil;                \
+		__offs++;                               \
+		continue;                               \
+	    }                                           \
+	    CLEAR_ERRNO;                                \
+	    __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \
+	    DEBUGBUFFER(buf);                           \
+	    if (__cnt > 0) {                            \
+		__offs += __cnt;                        \
+	    }                                           \
+	    break;                                      \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
     SETFLAGS(fileno(f), oldFlags);                      \
   }
@@ -963,34 +967,34 @@
     int __offs = 0;                                     \
     int __cnt;                                          \
     char *buf = (char *)(obj);                          \
-                                                        \
+							\
     (ret) = 0;                                          \
     {                                                   \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__ooffs+__offs] = __intVal(rA);   \
-                DEBUGBUFFER(buf);                       \
-                __INST(readAhead) = nil;                \
-                __offs++;                               \
-            } else {                                    \
-                CLEAR_ERRNO;                            \
-                __cnt = READ(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
-                DEBUGBUFFER(buf);                       \
-                if (__cnt <= 0) {                       \
-                    if (__cnt < 0 && errno == EINTR) {  \
-                        __HANDLE_INTERRUPTS__;          \
-                        /* refetch */                   \
-                        buf = (char *)(obj);            \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                }                                       \
-                __offs += __cnt;                        \
-            }                                           \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__ooffs+__offs] = __intVal(rA);   \
+		DEBUGBUFFER(buf);                       \
+		__INST(readAhead) = nil;                \
+		__offs++;                               \
+	    } else {                                    \
+		CLEAR_ERRNO;                            \
+		__cnt = READ(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
+		DEBUGBUFFER(buf);                       \
+		if (__cnt <= 0) {                       \
+		    if (__cnt < 0 && errno == EINTR) {  \
+			__HANDLE_INTERRUPTS__;          \
+			/* refetch */                   \
+			buf = (char *)(obj);            \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		}                                       \
+		__offs += __cnt;                        \
+	    }                                           \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -1002,61 +1006,61 @@
     int __offs = 0;                                     \
     int __cnt;                                          \
     char *buf = (char *)(obj);                          \
-                                                        \
+							\
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (errno == EINTR) {               \
-                        __HANDLE_INTERRUPTS__;          \
-                        clearerr(f);                    \
-                        /* refetch */                   \
-                        buf = (char *)(obj);            \
-                        DEBUGBUFFER(buf);               \
-                        continue;                       \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            (buf)[__ooffs+__offs] = (ret);              \
-            DEBUGBUFFER(buf);                           \
-            __offs++;                                   \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (errno == EINTR) {               \
+			__HANDLE_INTERRUPTS__;          \
+			clearerr(f);                    \
+			/* refetch */                   \
+			buf = (char *)(obj);            \
+			DEBUGBUFFER(buf);               \
+			continue;                       \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    (buf)[__ooffs+__offs] = (ret);              \
+	    DEBUGBUFFER(buf);                           \
+	    __offs++;                                   \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int fd = fileno(f);                             \
-                                                        \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__ooffs+__offs] = __intVal(rA);   \
-                DEBUGBUFFER(buf);                       \
-                __INST(readAhead) = nil;                \
-                __offs++;                               \
-            } else {                                    \
-                CLEAR_ERRNO;                            \
-                __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
-                DEBUGBUFFER(buf);                       \
-                if (__cnt <= 0) {                       \
-                    if (__cnt < 0 && errno == EINTR) {  \
-                        __HANDLE_INTERRUPTS__;          \
-                        /* refetch */                   \
-                        buf = (char *)(obj);            \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                }                                       \
-                __offs += __cnt;                        \
-            }                                           \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int fd = fileno(f);                             \
+							\
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__ooffs+__offs] = __intVal(rA);   \
+		DEBUGBUFFER(buf);                       \
+		__INST(readAhead) = nil;                \
+		__offs++;                               \
+	    } else {                                    \
+		CLEAR_ERRNO;                            \
+		__cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
+		DEBUGBUFFER(buf);                       \
+		if (__cnt <= 0) {                       \
+		    if (__cnt < 0 && errno == EINTR) {  \
+			__HANDLE_INTERRUPTS__;          \
+			/* refetch */                   \
+			buf = (char *)(obj);            \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		}                                       \
+		__offs += __cnt;                        \
+	    }                                           \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -1067,56 +1071,56 @@
     int __cnt;                                          \
     char *buf = (char *)(obj);                          \
     int oldFlags;                                       \
-                                                        \
+							\
     (ret) = 0;                                          \
     SETNONBLOCKING(fileno(f), oldFlags);                \
-                                                        \
+							\
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = getc(f);                            \
-            if ((ret) < 0) {                            \
-                if (ferror(f)) {                        \
-                    if (errno == EINTR) {               \
-                        clearerr(f);                    \
-                        /* refetch */                   \
-                        buf = (char *)(obj);            \
-                        (ret) = 0;                      \
-                        break;                          \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            (buf)[__ooffs+__offs] = (ret);              \
-            DEBUGBUFFER(buf);                           \
-            __offs++;                                   \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = getc(f);                            \
+	    if ((ret) < 0) {                            \
+		if (ferror(f)) {                        \
+		    if (errno == EINTR) {               \
+			clearerr(f);                    \
+			/* refetch */                   \
+			buf = (char *)(obj);            \
+			(ret) = 0;                      \
+			break;                          \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    (buf)[__ooffs+__offs] = (ret);              \
+	    DEBUGBUFFER(buf);                           \
+	    __offs++;                                   \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int fd = fileno(f);                             \
-                                                        \
-        while (__offs < (cnt)) {                        \
-            OBJ rA = __INST(readAhead);                 \
-            if (rA != nil) {                            \
-                (buf)[__ooffs+__offs] = __intVal(rA);   \
-                DEBUGBUFFER(buf);                       \
-                __INST(readAhead) = nil;                \
-                __offs++;                               \
-                continue;                               \
-            }                                           \
-            CLEAR_ERRNO;                                \
-            __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
-            DEBUGBUFFER(buf);                           \
-            if (__cnt > 0) {                            \
-                __offs += __cnt;                        \
-            }                                           \
-            break;                                      \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int fd = fileno(f);                             \
+							\
+	while (__offs < (cnt)) {                        \
+	    OBJ rA = __INST(readAhead);                 \
+	    if (rA != nil) {                            \
+		(buf)[__ooffs+__offs] = __intVal(rA);   \
+		DEBUGBUFFER(buf);                       \
+		__INST(readAhead) = nil;                \
+		__offs++;                               \
+		continue;                               \
+	    }                                           \
+	    CLEAR_ERRNO;                                \
+	    __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
+	    DEBUGBUFFER(buf);                           \
+	    if (__cnt > 0) {                            \
+		__offs += __cnt;                        \
+	    }                                           \
+	    break;                                      \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
     SETFLAGS(fileno(f), oldFlags);                      \
   }
@@ -1126,44 +1130,44 @@
 
 # ifdef NO_STDIO
 #  define __WRITEBYTE__(ret, f, buf, isBuffered, handleType)          \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            (ret) = WRITE(f, buf, 1, handleType);       \
-            if ((ret) >= 0) break;                      \
-            if (errno != EINTR) {                       \
-                break;                                  \
-            }                                           \
-            __HANDLE_INTERRUPTS__;                      \
-        }
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    (ret) = WRITE(f, buf, 1, handleType);       \
+	    if ((ret) >= 0) break;                      \
+	    if (errno != EINTR) {                       \
+		break;                                  \
+	    }                                           \
+	    __HANDLE_INTERRUPTS__;                      \
+	}
 # else /* use STDIO */
 #  define __WRITEBYTE__(ret, f, buf, isBuffered, handleType)        \
     if (isBuffered) {                                   \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            ret = putc(*(buf), f);                      \
-            if ((ret) >= 0) {                           \
-                (ret) = 1;                              \
-            } else if (ferror(f)) {                     \
-                /* SOLARIS/SPARC (2.6) generates spurious errors with errno = 0 */ \
-                if (errno == EINTR || errno == 0) {     \
-                    __HANDLE_INTERRUPTS__;              \
-                    clearerr(f);                        \
-                    continue;                           \
-                }                                       \
-            } else                                      \
-                (ret) = 0;                              \
-            break;                                      \
-        }                                               \
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    ret = putc(*(buf), f);                      \
+	    if ((ret) >= 0) {                           \
+		(ret) = 1;                              \
+	    } else if (ferror(f)) {                     \
+		/* SOLARIS/SPARC (2.6) generates spurious errors with errno = 0 */ \
+		if (errno == EINTR || errno == 0) {     \
+		    __HANDLE_INTERRUPTS__;              \
+		    clearerr(f);                        \
+		    continue;                           \
+		}                                       \
+	    } else                                      \
+		(ret) = 0;                              \
+	    break;                                      \
+	}                                               \
     } else {                                            \
-        for (;;) {                                      \
-            CLEAR_ERRNO;                                \
-            (ret) = write(fileno(f), buf, 1);           \
-            if ((ret) >= 0) break;                      \
-            if (errno != EINTR) {                       \
-                break;                                  \
-            }                                           \
-            __HANDLE_INTERRUPTS__;                      \
-        }                                               \
+	for (;;) {                                      \
+	    CLEAR_ERRNO;                                \
+	    (ret) = write(fileno(f), buf, 1);           \
+	    if ((ret) >= 0) break;                      \
+	    if (errno != EINTR) {                       \
+		break;                                  \
+	    }                                           \
+	    __HANDLE_INTERRUPTS__;                      \
+	}                                               \
    }
 # endif /* use STDIO */
 
@@ -1175,64 +1179,64 @@
 #  define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType)    \
     (ret) = 0;                                          \
     {                                                   \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            ret = WRITE(f, (buf)+__offs, (cnt)-__offs, handleType); \
-            if (ret <= 0) {                             \
-                if (ret < 0 && errno == EINTR) {        \
-                    __HANDLE_INTERRUPTS__;              \
-                    continue;                           \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    ret = WRITE(f, (buf)+__offs, (cnt)-__offs, handleType); \
+	    if (ret <= 0) {                             \
+		if (ret < 0 && errno == EINTR) {        \
+		    __HANDLE_INTERRUPTS__;              \
+		    continue;                           \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
    }
 # else /* use STDIO */
 #  define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType)    \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
-            if ((ret) <= 0) {                            \
-                if (ferror(f)) {                        \
-                    if (errno == EINTR) {               \
-                        __HANDLE_INTERRUPTS__;          \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
+	    if ((ret) <= 0) {                            \
+		if (ferror(f)) {                        \
+		    if (errno == EINTR) {               \
+			__HANDLE_INTERRUPTS__;          \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     } else {                                            \
-        int __offs = 0;                                 \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = write(fileno(f), (buf)+__offs, (cnt)-__offs);\
-            if ((ret) <= 0) {                           \
-                if ((ret) < 0) {                        \
-                    if (errno == EINTR) {               \
-                        __HANDLE_INTERRUPTS__;          \
-                        continue;                       \
-                    }                                   \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	int __offs = 0;                                 \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = write(fileno(f), (buf)+__offs, (cnt)-__offs);\
+	    if ((ret) <= 0) {                           \
+		if ((ret) < 0) {                        \
+		    if (errno == EINTR) {               \
+			__HANDLE_INTERRUPTS__;          \
+			continue;                       \
+		    }                                   \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
    }
 # endif /* use STDIO */
 
@@ -1246,25 +1250,25 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-                                                        \
+							\
     (ret) = 0;                                          \
     {                                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            ret = WRITE(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
-            if (ret <= 0) {                             \
-                if (ret < 0 && errno == EINTR) {        \
-                    __HANDLE_INTERRUPTS__;              \
-                    /* refetch */                       \
-                    buf = (char *)(obj);                \
-                    continue;                           \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
-        if (__offs > 0)                                 \
-            (ret) = __offs;                             \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    ret = WRITE(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
+	    if (ret <= 0) {                             \
+		if (ret < 0 && errno == EINTR) {        \
+		    __HANDLE_INTERRUPTS__;              \
+		    /* refetch */                       \
+		    buf = (char *)(obj);                \
+		    continue;                           \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
+	if (__offs > 0)                                 \
+	    (ret) = __offs;                             \
     }                                                   \
   }
 # else /* use STDIO */
@@ -1273,48 +1277,48 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-                                                        \
+							\
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f);  \
-            if ((ret) <= 0) {                           \
-                if (ferror(f)) {                        \
-                    if (errno == EINTR) {               \
-                        __HANDLE_INTERRUPTS__;          \
-                        /* refetch */                   \
-                        buf = (char *)(obj);            \
-                        clearerr(f);                    \
-                        continue;                       \
-                    }                                   \
-                    break;                              \
-                } else {                                \
-                    (ret) = 0;                          \
-                }                                       \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f);  \
+	    if ((ret) <= 0) {                           \
+		if (ferror(f)) {                        \
+		    if (errno == EINTR) {               \
+			__HANDLE_INTERRUPTS__;          \
+			/* refetch */                   \
+			buf = (char *)(obj);            \
+			clearerr(f);                    \
+			continue;                       \
+		    }                                   \
+		    break;                              \
+		} else {                                \
+		    (ret) = 0;                          \
+		}                                       \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
     } else {                                            \
-        while (__offs < (cnt)) {                        \
-            CLEAR_ERRNO;                                \
-            (ret) = write(fileno(f), (buf)+__ooffs+__offs, (cnt)-__offs); \
-            if ((ret) <= 0) {                           \
-                if ((ret) < 0) {                        \
-                    if (errno == EINTR){                \
-                        __HANDLE_INTERRUPTS__;          \
-                        /* refetch */                   \
-                        buf = (char *)(obj);            \
-                        continue;                       \
-                    }                                   \
-                }                                       \
-                break;                                  \
-            }                                           \
-            __offs += (ret);                            \
-        }                                               \
+	while (__offs < (cnt)) {                        \
+	    CLEAR_ERRNO;                                \
+	    (ret) = write(fileno(f), (buf)+__ooffs+__offs, (cnt)-__offs); \
+	    if ((ret) <= 0) {                           \
+		if ((ret) < 0) {                        \
+		    if (errno == EINTR){                \
+			__HANDLE_INTERRUPTS__;          \
+			/* refetch */                   \
+			buf = (char *)(obj);            \
+			continue;                       \
+		    }                                   \
+		}                                       \
+		break;                                  \
+	    }                                           \
+	    __offs += (ret);                            \
+	}                                               \
     }                                                   \
     if (__offs > 0)                                     \
-        (ret) = __offs;                                 \
+	(ret) = __offs;                                 \
   }
 # endif /* use STDIO */
 #endif /* unix */
@@ -1376,37 +1380,37 @@
 
     [Instance variables:]
 
-        handleType      <Symbol>        desribes what handle is:
-                                            win32: #fileHandle, #socketHandle,
-                                                   #filePointer, #socketFilePointer, #pipeFilePointer
-                                            unix: #filePointer, #socketFilePointer, #pipeFilePointer
-                                        needed for win32, which uses different APIs for the different handles (sigh)
-        handle          <Integer>       used to be always a filePointer somehow mapped to an integer (FILE* - not the fd);
-                                        now, either a filePointer or a handle (win32)
-        mode            <Symbol>        #readwrite, #readonly or #writeonly
-        buffered        <Boolean>       true, if buffered (i.e. collects characters - does
-                                        not output immediately)
-        binary          <Boolean>       true if in binary mode (reads bytes instead of chars)
-        eolMode         <Symbol>        one of nil, #cr or #crlf.
-                                        determines how lines should be terminated.
-                                        nil -> newLine (as in Unix);
-                                        #crlf -> with cr-lf (as in MSDOS)
-                                        #cr -> with cr (as in VMS)
-        hitEOF          <Boolean>       true, if EOF was reached
-
-        lastErrorNumber <Integer>       the value of errno (only valid right after the error -
-                                        updated with next i/o operation)
+	handleType      <Symbol>        desribes what handle is:
+					    win32: #fileHandle, #socketHandle,
+						   #filePointer, #socketFilePointer, #pipeFilePointer
+					    unix: #filePointer, #socketFilePointer, #pipeFilePointer
+					needed for win32, which uses different APIs for the different handles (sigh)
+	handle          <Integer>       used to be always a filePointer somehow mapped to an integer (FILE* - not the fd);
+					now, either a filePointer or a handle (win32)
+	mode            <Symbol>        #readwrite, #readonly or #writeonly
+	buffered        <Boolean>       true, if buffered (i.e. collects characters - does
+					not output immediately)
+	binary          <Boolean>       true if in binary mode (reads bytes instead of chars)
+	eolMode         <Symbol>        one of nil, #cr or #crlf.
+					determines how lines should be terminated.
+					nil -> newLine (as in Unix);
+					#crlf -> with cr-lf (as in MSDOS)
+					#cr -> with cr (as in VMS)
+	hitEOF          <Boolean>       true, if EOF was reached
+
+	lastErrorNumber <Integer>       the value of errno (only valid right after the error -
+					updated with next i/o operation)
 
     [Class variables:]
-        Lobby           <Registry>      keeps track of used ext-streams (to free up FILE*'s)
-
-        StreamErrorSignal       <Signal> parent of all stream errors (see Stream class)
-        InvalidReadSignal       <Signal> raised on read from writeonly stream
-        InvalidWriteSignal      <Signal> raised on write to readonly stream
-        InvalidModeSignal       <Signal> raised on text I/O with binary-stream
-                                         or binary I/O with text-stream
-        OpenErrorSignal         <Signal> raised if open fails
-        StreamNotOpenSignal     <Signal> raised on I/O with non-open stream
+	Lobby           <Registry>      keeps track of used ext-streams (to free up FILE*'s)
+
+	StreamErrorSignal       <Signal> parent of all stream errors (see Stream class)
+	InvalidReadSignal       <Signal> raised on read from writeonly stream
+	InvalidWriteSignal      <Signal> raised on write to readonly stream
+	InvalidModeSignal       <Signal> raised on text I/O with binary-stream
+					 or binary I/O with text-stream
+	OpenErrorSignal         <Signal> raised if open fails
+	StreamNotOpenSignal     <Signal> raised on I/O with non-open stream
 
     Additional notes:
       This class is implemented using the underlying stdio-c library package, which
@@ -1425,7 +1429,7 @@
       completely, to NOT use any stdio stuff (and do its buffering itself).
 
       Notice that typical stdio's use a single errno global variable to return an error code,
-      this was bad design in the stdio lib (right from the very beginning), since its much
+      this was bad design in the stdio lib (right from the very beginning), since it's much
       harder to deal with this in the presence of lightweight processes, where errno gets
       overwritten by an I/O operation done in another thread. (stdio should have been written
       to return errno as a negative number ...).
@@ -1440,12 +1444,12 @@
       fread/fgetc and fwrite/putc respectively.
 
     [author:]
-        Claus Gittinger
-        Stefan Vogel (many, many fixes ...)
+	Claus Gittinger
+	Stefan Vogel (many, many fixes ...)
 
     [see also:]
-        FileStream Socket PipeStream
-        Filename OperatingSystem
+	FileStream Socket PipeStream
+	Filename OperatingSystem
 "
 !
 
@@ -2041,14 +2045,14 @@
     OBJ _handle  = __INST(handle);
 
     if (_handle != nil) {
-        if (__INST(handleType) == @symbol(socketHandle)) {
-            RETURN (_handle);
-        } else if ((__INST(handleType) == nil)
-                     || (__INST(handleType) == @symbol(filePointer))
-                     || (__INST(handleType) == @symbol(socketFilePointer))
-                     || (__INST(handleType) == @symbol(pipeFilePointer))) {
-            RETURN ( __MKINT(fileno(__FILEVal(_handle))));
-        }
+	if (__INST(handleType) == @symbol(socketHandle)) {
+	    RETURN (_handle);
+	} else if ((__INST(handleType) == nil)
+		     || (__INST(handleType) == @symbol(filePointer))
+		     || (__INST(handleType) == @symbol(socketFilePointer))
+		     || (__INST(handleType) == @symbol(pipeFilePointer))) {
+	    RETURN ( __MKINT(fileno(__FILEVal(_handle))));
+	}
     }
 %}.
     handle isNil ifTrue:[^ self errorNotOpen].
@@ -2072,19 +2076,19 @@
     OBJ _handle  = __INST(handle);
 
     if (_handle != nil) {
-        if ((__INST(handleType) == @symbol(fileHandle)) 
-            || (__INST(handleType) == @symbol(socketHandle))) {
-            RETURN (_handle);
-        } else if ((__INST(handleType) == nil)
-                     || (__INST(handleType) == @symbol(filePointer))
-                     || (__INST(handleType) == @symbol(socketFilePointer))
-                     || (__INST(handleType) == @symbol(pipeFilePointer))) {
+	if ((__INST(handleType) == @symbol(fileHandle))
+	    || (__INST(handleType) == @symbol(socketHandle))) {
+	    RETURN (_handle);
+	} else if ((__INST(handleType) == nil)
+		     || (__INST(handleType) == @symbol(filePointer))
+		     || (__INST(handleType) == @symbol(socketFilePointer))
+		     || (__INST(handleType) == @symbol(pipeFilePointer))) {
 #ifdef WIN32
-            RETURN(__MKEXTERNALADDRESS(_get_osfhandle(fileno(__FILEVal(_handle)))));
+	    RETURN(__MKEXTERNALADDRESS(_get_osfhandle(fileno(__FILEVal(_handle)))));
 #else
-            RETURN (__MKINT(fileno(__FILEVal(_handle))));
+	    RETURN (__MKINT(fileno(__FILEVal(_handle))));
 #endif
-        }
+	}
     }
 %}.
     handle isNil ifTrue:[^ self errorNotOpen].
@@ -2496,7 +2500,7 @@
     "read the next line (characters up to newline).
      Return a string containing those characters excluding the newline.
      If the previous-to-last character is a cr, this is also removed,
-     so its possible to read alien (i.e. ms-dos) text as well.
+     so it's possible to read alien (i.e. ms-dos) text as well.
      The line must be shorter than 32K characters - otherwise an error is signalled."
 
     |line error|
@@ -2519,129 +2523,129 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-            && (__INST(binary) != true)
-        ) {
-            f = __FILEVal(fp);
-            buffer[0] = '\0';
-
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f);
-            }
-
-            rslt = nextPtr = buffer;
-            limit = buffer + sizeof(buffer) - 2;
-
-            for (;;) {
-                __READBYTE__(ret, f, nextPtr, _buffered, __INST(handleType));
-                if (ret <= 0) {
-                    if (nextPtr == buffer)
-                        rslt = NULL;
-                    if (ret == 0) {
-                        __INST(hitEOF) = true;
-                        break;
-                    } else {
-                        error = __mkSmallInteger(__threadErrno);
-                        goto err;
-                    }
-                }
-
-                if (*nextPtr == '\n') {
-                    cutOff = 1;
-                    *nextPtr = '\0';
-                    break;
-                }
-                if (*nextPtr == '\r') {
-                    char peekChar;
-
-                    /*
-                     * peek ahead for a newLine ...
-                     */
-                    __READBYTE__(ret, f, &peekChar, _buffered, __INST(handleType));
-                    if (ret <= 0) {
-                        cutOff = 1;
-                        *nextPtr = '\0';
-                        if (ret == 0) {
-                            __INST(hitEOF) = true;
-                            break;
-                        }
-                        error = __mkSmallInteger(__threadErrno);
-                        goto err;
-                    }
-
-                    if (peekChar == '\n') {
-                        cutOff = 2;
-                        *nextPtr = '\0';
-                        break;
-                    }
-
-                    __UNGETC__(peekChar, f, _buffered);
-
-                    cutOff = 1;
-                    *nextPtr = '\0';
-                    break;
-                }
-
-                nextPtr++;
-                if (nextPtr >= limit) {
-                    *nextPtr = '\0';
-                    lineTooLong = 1;
-                    if (@global(InfoPrinting) == true) {
-                        fprintf(stderr, "ExtStream [warning]: line truncated in nextLine\n");
-                    }
-                    break;
-                }
-            }
-
-            if (rslt != NULL) {
-                len = nextPtr-buffer;
-
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + len + cutOff;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                /* remove any EOL character */
-                if (len != 0) {
-                    if (buffer[len-1] == '\n') {
-                        buffer[--len] = '\0';
-                    }
-                    if ((len != 0) && (buffer[len-1] == '\r')) {
-                        buffer[--len] = '\0';
-                    }
-                }
-                line = __MKSTRING_L(buffer, len);
-                if (! lineTooLong) {
-                    RETURN ( line );
-                }
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	    && (__INST(binary) != true)
+	) {
+	    f = __FILEVal(fp);
+	    buffer[0] = '\0';
+
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f);
+	    }
+
+	    rslt = nextPtr = buffer;
+	    limit = buffer + sizeof(buffer) - 2;
+
+	    for (;;) {
+		__READBYTE__(ret, f, nextPtr, _buffered, __INST(handleType));
+		if (ret <= 0) {
+		    if (nextPtr == buffer)
+			rslt = NULL;
+		    if (ret == 0) {
+			__INST(hitEOF) = true;
+			break;
+		    } else {
+			error = __mkSmallInteger(__threadErrno);
+			goto err;
+		    }
+		}
+
+		if (*nextPtr == '\n') {
+		    cutOff = 1;
+		    *nextPtr = '\0';
+		    break;
+		}
+		if (*nextPtr == '\r') {
+		    char peekChar;
+
+		    /*
+		     * peek ahead for a newLine ...
+		     */
+		    __READBYTE__(ret, f, &peekChar, _buffered, __INST(handleType));
+		    if (ret <= 0) {
+			cutOff = 1;
+			*nextPtr = '\0';
+			if (ret == 0) {
+			    __INST(hitEOF) = true;
+			    break;
+			}
+			error = __mkSmallInteger(__threadErrno);
+			goto err;
+		    }
+
+		    if (peekChar == '\n') {
+			cutOff = 2;
+			*nextPtr = '\0';
+			break;
+		    }
+
+		    __UNGETC__(peekChar, f, _buffered);
+
+		    cutOff = 1;
+		    *nextPtr = '\0';
+		    break;
+		}
+
+		nextPtr++;
+		if (nextPtr >= limit) {
+		    *nextPtr = '\0';
+		    lineTooLong = 1;
+		    if (@global(InfoPrinting) == true) {
+			fprintf(stderr, "ExtStream [warning]: line truncated in nextLine\n");
+		    }
+		    break;
+		}
+	    }
+
+	    if (rslt != NULL) {
+		len = nextPtr-buffer;
+
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + len + cutOff;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		/* remove any EOL character */
+		if (len != 0) {
+		    if (buffer[len-1] == '\n') {
+			buffer[--len] = '\0';
+		    }
+		    if ((len != 0) && (buffer[len-1] == '\r')) {
+			buffer[--len] = '\0';
+		    }
+		}
+		line = __MKSTRING_L(buffer, len);
+		if (! lineTooLong) {
+		    RETURN ( line );
+		}
+	    }
+	}
     }
 err: ;
 %}.
     line notNil ifTrue:[
-        "/ the line as read is longer than 32k characters (boy - what a line)
-        "/ The exception could be handled by reading more and returning the
-        "/ concatenation in your exception handler (the receiver and the partial
-        "/ line are passed as parameter)
-
-        LineTooLongErrorSignal isHandled ifTrue:[
-            ^ LineTooLongErrorSignal
-                raiseRequestWith:(Array with:self with:line)
-                     errorString:('line too long read error')
-        ].
-        ^ line , self nextLine
+	"/ the line as read is longer than 32k characters (boy - what a line)
+	"/ The exception could be handled by reading more and returning the
+	"/ concatenation in your exception handler (the receiver and the partial
+	"/ line are passed as parameter)
+
+	LineTooLongErrorSignal isHandled ifTrue:[
+	    ^ LineTooLongErrorSignal
+		raiseRequestWith:(Array with:self with:line)
+		     errorString:('line too long read error')
+	].
+	^ line , self nextLine
     ].
 
     (hitEOF == true) ifTrue:[^ self pastEndRead].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error
+	lastErrorNumber := error.
+	^ self readError:error
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
@@ -2667,66 +2671,66 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-            && (__INST(binary) != true)
-            && __isStringLike(aString)
-        ) {
-            f = __FILEVal(fp);
-            len = __stringSize(aString);
-
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	    && (__INST(binary) != true)
+	    && __isStringLike(aString)
+	) {
+	    f = __FILEVal(fp);
+	    len = __stringSize(aString);
+
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
 #ifdef WIN32
-            if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                cnt = __win32_fwrite(__stringVal(aString), 1, len, f);
-            } else
+	    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+		cnt = __win32_fwrite(__stringVal(aString), 1, len, f);
+	    } else
 #endif
-            {
-                o_offs = (char *)__stringVal(aString)-(char *)aString;
-                __WRITEBYTES_OBJ__(cnt, f, aString, o_offs, len, _buffered, __INST(handleType));
-            }
-            if (cnt == len) {
-                OBJ mode = __INST(eolMode);
-
-                len1 = len;
-
-                if (mode == @symbol(cr)) {
-                    cp = "\r"; len = 1;
-                } else if (mode == @symbol(crlf)) {
-                    cp = "\r\n"; len = 2;
-                } else {
-                    cp = "\n"; len = 1;
-                }
+	    {
+		o_offs = (char *)__stringVal(aString)-(char *)aString;
+		__WRITEBYTES_OBJ__(cnt, f, aString, o_offs, len, _buffered, __INST(handleType));
+	    }
+	    if (cnt == len) {
+		OBJ mode = __INST(eolMode);
+
+		len1 = len;
+
+		if (mode == @symbol(cr)) {
+		    cp = "\r"; len = 1;
+		} else if (mode == @symbol(crlf)) {
+		    cp = "\r\n"; len = 2;
+		} else {
+		    cp = "\n"; len = 1;
+		}
 #ifdef WIN32
-                if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                    cnt = __win32_fwrite(cp, 1, len, f);
-                } else
+		if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+		    cnt = __win32_fwrite(cp, 1, len, f);
+		} else
 #endif
-                {
-                    __WRITEBYTES__(cnt, f, cp, len, _buffered, __INST(handleType));
-                }
-                if (cnt > 0) {
-                    if (__isSmallInteger(__INST(position))) {
-                        INT np = __intVal(__INST(position)) + cnt;
-                        OBJ t;
-
-                        t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                    } else {
-                        __INST(position) = nil; /* i.e. do not know */
-                    }
-                    RETURN ( self );
-                }
-            }
-            error = __mkSmallInteger(__threadErrno);
-        }
+		{
+		    __WRITEBYTES__(cnt, f, cp, len, _buffered, __INST(handleType));
+		}
+		if (cnt > 0) {
+		    if (__isSmallInteger(__INST(position))) {
+			INT np = __intVal(__INST(position)) + cnt;
+			OBJ t;
+
+			t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		    } else {
+			__INST(position) = nil; /* i.e. do not know */
+		    }
+		    RETURN ( self );
+		}
+	    }
+	    error = __mkSmallInteger(__threadErrno);
+	}
     }
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
     super nextPutLine:aString.
 !
@@ -2905,8 +2909,8 @@
      Since the type of the argument depends on the ioctl being
      performed, different arg types are allowed here.
      If the argument is nil, an ioctl without argument is performed.
-     If the argument is an integral number, its directly passed;
-     if its a kind of ByteArray (ByteArray, String or Structure),
+     If the argument is an integral number, it's directly passed;
+     if it's a kind of ByteArray (ByteArray, String or Structure),
      or external data (ExternalBytes or ExternalAddress),
      a pointer to the data is passed.
      This allows performing most ioctls
@@ -2924,54 +2928,54 @@
     OBJ fp = __INST(handle);
 
     if (fp == nil)
-        goto out;
+	goto out;
 
     if (!__isInteger(ioctlNumber)
-         || (!__isInteger(arg)
-             && (arg != nil)
-             && !__isBytes(arg)
-             && !__isExternalBytesLike(arg)
-             && !__isExternalAddress(arg))) {
-        error = @symbol(badArgument);
-        goto out;
+	 || (!__isInteger(arg)
+	     && (arg != nil)
+	     && !__isBytes(arg)
+	     && !__isExternalBytesLike(arg)
+	     && !__isExternalAddress(arg))) {
+	error = @symbol(badArgument);
+	goto out;
     }
 
     if (__INST(handleType) == @symbol(socketHandle)) {
-        fd = __FILEVal(fp);
+	fd = __FILEVal(fp);
     } else if ((__INST(handleType) == nil)
-         || (__INST(handleType) == @symbol(filePointer))
-         || (__INST(handleType) == @symbol(socketFilePointer))
-         || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        fd = fileno(__FILEVal(fp));
+	 || (__INST(handleType) == @symbol(filePointer))
+	 || (__INST(handleType) == @symbol(socketFilePointer))
+	 || (__INST(handleType) == @symbol(pipeFilePointer))) {
+	fd = fileno(__FILEVal(fp));
     } else {
-        error = @symbol(badHandleType);
-        goto out;
+	error = @symbol(badHandleType);
+	goto out;
     }
-    
+
     ioNum = __unsignedLongIntVal(ioctlNumber);
 
     __BEGIN_INTERRUPTABLE__
     do {
-        __threadErrno = 0;
-        if (arg == nil) {
-            ioArg = 0;
-        } else if (__isSmallInteger(arg)) {
-            ioArg = __intVal(arg);
-        } else if (__isInteger(arg)) {
-            ioArg = __unsignedLongIntVal(arg);
-        } else if (__isExternalBytesLike(arg)) {
-            ioArg = (INT)(__externalBytesAddress(arg));
-        } else if (__isExternalAddress(arg)) {
-            ioArg = (INT)(__externalAddressVal(arg));
-        } else {
-            ioArg = (INT)(__ByteArrayInstPtr(arg)->ba_element);
-        }
-        ret = ioctl(fd, ioNum, ioArg);
+	__threadErrno = 0;
+	if (arg == nil) {
+	    ioArg = 0;
+	} else if (__isSmallInteger(arg)) {
+	    ioArg = __intVal(arg);
+	} else if (__isInteger(arg)) {
+	    ioArg = __unsignedLongIntVal(arg);
+	} else if (__isExternalBytesLike(arg)) {
+	    ioArg = (INT)(__externalBytesAddress(arg));
+	} else if (__isExternalAddress(arg)) {
+	    ioArg = (INT)(__externalAddressVal(arg));
+	} else {
+	    ioArg = (INT)(__ByteArrayInstPtr(arg)->ba_element);
+	}
+	ret = ioctl(fd, ioNum, ioArg);
     } while (ret < 0 && __threadErrno == EINTR);
     __END_INTERRUPTABLE__
 
     if (ret >= 0) {
-        RETURN ( __mkSmallInteger(ret) );
+	RETURN ( __mkSmallInteger(ret) );
     }
     error = __mkSmallInteger(__threadErrno);
 #endif
@@ -2979,8 +2983,8 @@
 out:;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self ioError:error.
+	lastErrorNumber := error.
+	^ self ioError:error.
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
 
@@ -2988,6 +2992,199 @@
     ^ self errorUnsupportedOperation
 !
 
+tcgetattr
+    "unix only:
+     provide the information of a tcgetattr call as a dictionary.
+     This provides terminal setting values of a tty or pty.
+     Used by terminal emulators.
+     On non-unix systems, an unsupported operation error is raised"
+
+    |error ret
+     iflags "/ input flags
+     ignbrk brkint ignpar parmrk inpck istrip inlcr igncr
+     icrnl ixon ixoff ixany imaxbel iutf8
+     oflags "/ output flags
+     opost onlcr ocrnl olcuc onocr onlret oxtabs onoteot
+     cflags "/ control flags
+     csize cstopb cread parenb parodd hupcl clocal
+     lflags "/ local flags
+     echoke echoe echok echo echonl echoprt echoctl
+     isig icanon altwerase iexten extproc tostop
+     |
+
+%{
+#if !defined(MSDOS_LIKE) && !defined(__openVMS__)
+    int fd;
+    int _ret;
+    OBJ fp = __INST(handle);
+    struct termios t;
+    int sz;
+
+    if (fp == nil)
+	goto out;
+
+    if (__INST(handleType) == @symbol(socketHandle)) {
+	fd = __FILEVal(fp);
+    } else if ((__INST(handleType) == nil)
+	 || (__INST(handleType) == @symbol(filePointer))
+	 || (__INST(handleType) == @symbol(socketFilePointer))
+	 || (__INST(handleType) == @symbol(pipeFilePointer))) {
+	fd = fileno(__FILEVal(fp));
+    } else {
+	error = @symbol(badHandleType);
+	goto out;
+    }
+
+    __BEGIN_INTERRUPTABLE__
+    do {
+	__threadErrno = 0;
+	_ret = tcgetattr(fd, &t);
+    } while (_ret < 0 && __threadErrno == EINTR);
+    __END_INTERRUPTABLE__
+
+    if (_ret < 0) {
+	error = __mkSmallInteger(__threadErrno);
+    }
+    ignbrk = t.c_iflag & IGNBRK ? true : false;
+    brkint = t.c_iflag & BRKINT ? true : false;
+    ignpar = t.c_iflag & IGNPAR ? true : false;
+    parmrk = t.c_iflag & PARMRK ? true : false;
+    inpck = t.c_iflag & INPCK ? true : false;
+    istrip = t.c_iflag & ISTRIP ? true : false;
+    inlcr = t.c_iflag & INLCR ? true : false;
+    ixon = t.c_iflag & IXON ? true : false;
+    ixoff = t.c_iflag & IXOFF ? true : false;
+    ixany = t.c_iflag & IXANY ? true : false;
+#ifdef IMAXBEL
+    imaxbel = t.c_iflag & IMAXBEL ? true : false;
+#endif
+#ifdef IUCLC
+    iuclc = t.c_iflag & IUCLC ? true : false;
+#endif
+
+    opost = t.c_oflag & OPOST ? true : false;
+    onlcr = t.c_oflag & ONLCR ? true : false;
+#ifdef OXTABS
+    oxtabs = t.c_oflag & OXTABS ? true : false;
+#endif
+#ifdef ONOTEOT
+    onoteot = t.c_oflag & ONOTEOT ? true : false;
+#endif
+    ocrnl = t.c_oflag & OCRNL ? true : false;
+#ifdef OLCUC
+    olcuc = t.c_oflag & OLCUC ? true : false;
+#endif
+    onocr = t.c_oflag & ONOCR ? true : false;
+    onlret = t.c_oflag & ONLRET ? true : false;
+
+    sz = t.c_cflag & CSIZE;
+    switch (sz) {
+	case CS5:
+	    csize = @symbol(cs5);
+	    break;
+	case CS6:
+	    csize = @symbol(cs6);
+	    break;
+	case CS7:
+	    csize = @symbol(cs7);
+	    break;
+	case CS8:
+	    csize = @symbol(cs8);
+	    break;
+    }
+    cstopb = t.c_cflag & CSTOPB ? true : false;
+    cread = t.c_cflag & CREAD ? true : false;
+    parenb = t.c_cflag & PARENB ? true : false;
+    parodd = t.c_cflag & PARODD ? true : false;
+    hupcl = t.c_cflag & HUPCL ? true : false;
+    clocal = t.c_cflag & CLOCAL ? true : false;
+
+    echoke = t.c_lflag & ECHOKE ? true : false;
+    echoe = t.c_lflag & ECHOE ? true : false;
+    echo = t.c_lflag & ECHO ? true : false;
+    echonl = t.c_lflag & ECHONL ? true : false;
+    echoctl = t.c_lflag & ECHOCTL ? true : false;
+    isig = t.c_lflag & ISIG ? true : false;
+    icanon = t.c_lflag & ICANON ? true : false;
+#ifdef ALTWERASE
+    altwerase = t.c_lflag & ALTWERASE ? true : false;
+#endif
+#ifdef IEXTEN
+    iexten = t.c_lflag & IEXTEN ? true : false;
+#endif
+#ifdef EXTPROC
+    extproc = t.c_lflag & EXTPROC ? true : false;
+#endif
+#ifdef TOSTOP
+    tostop = t.c_lflag & TOSTOP ? true : false;
+#endif
+
+#else
+    error = @symbol(unsupportedOperation);
+#endif
+
+out:;
+%}.
+    error notNil ifTrue:[
+	error == #unsupportedOperation ifTrue:[
+	    "/ the system does not support tcgetattr
+	    ^ self errorUnsupportedOperation
+	].
+	lastErrorNumber := error.
+	^ self ioError:error.
+    ].
+    handle isNil ifTrue:[^ self errorNotOpen].
+
+    "/ construct a dictionary...
+    ret := Dictionary new.
+    ret at:#iflags put:(iflags := Dictionary new).
+    ret at:#oflags put:(oflags := Dictionary new).
+    ret at:#cflags put:(cflags := Dictionary new).
+    ret at:#lflags put:(lflags := Dictionary new).
+    iflags at:#ignbrk put:ignbrk.
+    iflags at:#brkint put:brkint.
+    iflags at:#ignpar put:ignpar.
+    iflags at:#parmrk put:parmrk.
+    iflags at:#inpck put:inpck.
+    iflags at:#istrip put:istrip.
+    iflags at:#inlcr put:inlcr.
+    iflags at:#igncr put:igncr.
+    iflags at:#icrnl put:icrnl.
+    iflags at:#ixon put:ixon.
+    iflags at:#ixoff put:ixoff.
+    iflags at:#ixany put:ixany.
+    iflags at:#imaxbel put:imaxbel.
+    iflags at:#iutf8 put:iutf8.
+
+    oflags at:#opost put:opost.
+    oflags at:#onlcr put:onlcr.
+    oflags at:#oxtabs put:oxtabs.
+    oflags at:#onoteot put:onoteot.
+
+    cflags at:#csize put:csize.
+    cflags at:#cstopb put:cstopb.
+    cflags at:#cread put:cread.
+    cflags at:#parenb put:parenb.
+    cflags at:#parodd put:parodd.
+    cflags at:#hupcl put:hupcl.
+    cflags at:#clocal put:clocal.
+
+    lflags at:#echoke put:echoke.
+    lflags at:#echoe put:echoe.
+    lflags at:#echok put:echok.
+    lflags at:#echo put:echo.
+    lflags at:#echonl put:echonl.
+    lflags at:#echoprt put:echoprt.
+    lflags at:#echoctl put:echoctl.
+    lflags at:#isig put:isig.
+    lflags at:#icanon put:icanon.
+    lflags at:#altwerase put:altwerase.
+    lflags at:#iexten put:iexten.
+    lflags at:#extproc put:extproc.
+    lflags at:#tostop put:tostop.
+    ^ ret
+!
+
 reset
     "set the read position to the beginning of the collection"
 
@@ -3014,35 +3211,35 @@
     OBJ fp = __INST(handle);
 
     if (fp == nil)
-        goto out;
+	goto out;
 
     if (__INST(handleType) == @symbol(socketHandle)) {
-        fd = __FILEVal(fp);
+	fd = __FILEVal(fp);
     } else if ((__INST(handleType) == nil)
-               || (__INST(handleType) == @symbol(filePointer))
-               || (__INST(handleType) == @symbol(socketFilePointer))
-               || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        fd = fileno(__FILEVal(fp));
+	       || (__INST(handleType) == @symbol(filePointer))
+	       || (__INST(handleType) == @symbol(socketFilePointer))
+	       || (__INST(handleType) == @symbol(pipeFilePointer))) {
+	fd = fileno(__FILEVal(fp));
     } else {
-        error = @symbol(badHandleType);
-        goto out;
+	error = @symbol(badHandleType);
+	goto out;
     }
-        
+
 #ifdef WIN32
      __threadErrno = 0;
      ret = __STX_API_NOINT_CALL1( "FlushFileBuffers", FlushFileBuffers, _get_osfhandle(fd));
      if (ret) {
-         RETURN (self);
+	 RETURN (self);
      }
 #else
      __BEGIN_INTERRUPTABLE__
      do {
-         ret = fsync(fd);
+	 ret = fsync(fd);
      } while ((ret < 0) && (__threadErrno == EINTR));
      __END_INTERRUPTABLE__
 
      if (ret >= 0) {
-         RETURN (self);
+	 RETURN (self);
      }
 #endif /* ! WIN32 */
      error = __mkSmallInteger(__threadErrno);
@@ -3050,16 +3247,16 @@
 out:;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self ioError:error.
-        ^ self.
+	lastErrorNumber := error.
+	self ioError:error.
+	^ self.
     ].
     handle isNil ifTrue:[self errorNotOpen].
 
     "
-        |f|
-        f := 'x' asFilename writeStream.
-        f nextPutAll:'hallo'; sync; syncData; close
+	|f|
+	f := 'x' asFilename writeStream.
+	f nextPutAll:'hallo'; sync; syncData; close
     "
 !
 
@@ -3079,35 +3276,35 @@
     OBJ fp = __INST(handle);
 
     if (fp == nil)
-        goto out;
+	goto out;
 
     if (__INST(handleType) == @symbol(socketHandle)) {
-        fd = __FILEVal(fp);
+	fd = __FILEVal(fp);
     } else if ((__INST(handleType) == nil)
-               || (__INST(handleType) == @symbol(filePointer))
-               || (__INST(handleType) == @symbol(socketFilePointer))
-               || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        fd = fileno(__FILEVal(fp));
+	       || (__INST(handleType) == @symbol(filePointer))
+	       || (__INST(handleType) == @symbol(socketFilePointer))
+	       || (__INST(handleType) == @symbol(pipeFilePointer))) {
+	fd = fileno(__FILEVal(fp));
     } else {
-        error = @symbol(badHandleType);
-        goto out;
+	error = @symbol(badHandleType);
+	goto out;
     }
 
 #ifdef WIN32
      __threadErrno = 0;
      ret = __STX_API_NOINT_CALL1( "FlushFileBuffers", FlushFileBuffers, _get_osfhandle(fd));
      if (ret) {
-         RETURN (self);
+	 RETURN (self);
      }
 #else
      __BEGIN_INTERRUPTABLE__
      do {
-         ret = fdatasync(fd);
+	 ret = fdatasync(fd);
      } while ((ret < 0) && (__threadErrno == EINTR));
      __END_INTERRUPTABLE__
 
      if (ret >= 0) {
-         RETURN (self);
+	 RETURN (self);
      }
 #endif /* ! WIN32 */
      error = __mkSmallInteger(__threadErrno);
@@ -3116,9 +3313,9 @@
 %}.
 
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self ioError:error.
-        ^ self.
+	lastErrorNumber := error.
+	self ioError:error.
+	^ self.
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
 
@@ -3126,9 +3323,9 @@
     self sync.
 
     "
-        |f|
-        f := 'x' asFilename writeStream.
-        f nextPutAll:'hallo'; sync; syncData; close
+	|f|
+	f := 'x' asFilename writeStream.
+	f nextPutAll:'hallo'; sync; syncData; close
     "
 ! !
 
@@ -3236,99 +3433,99 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-            && __bothSmallInteger(count, start)
-        ) {
-            f = __FILEVal(fp);
-
-            cnt = __intVal(count);
-            offs = __intVal(start) - 1;
-
-            if (__isExternalBytesLike(anObject)) {
-                OBJ sz;
-
-                nInstBytes = 0;
-                extPtr = (char *)(__externalBytesAddress(anObject));
-                if (extPtr == NULL) goto bad;
-                sz = __externalBytesSize(anObject);
-                if (__isSmallInteger(sz)) {
-                    objSize = __intVal(sz);
-                } else {
-                    objSize = 0; /* unknown */
-                }
-            } else {
-                OBJ oClass = __Class(anObject);
-                int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
-
-                nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
-
-                switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
-                    case BYTEARRAY:
-                    case WORDARRAY:
-                    case LONGARRAY:
-                    case SWORDARRAY:
-                    case SLONGARRAY:
-                    case FLOATARRAY:
-                        break;
-                    case DOUBLEARRAY:
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	    && __bothSmallInteger(count, start)
+	) {
+	    f = __FILEVal(fp);
+
+	    cnt = __intVal(count);
+	    offs = __intVal(start) - 1;
+
+	    if (__isExternalBytesLike(anObject)) {
+		OBJ sz;
+
+		nInstBytes = 0;
+		extPtr = (char *)(__externalBytesAddress(anObject));
+		if (extPtr == NULL) goto bad;
+		sz = __externalBytesSize(anObject);
+		if (__isSmallInteger(sz)) {
+		    objSize = __intVal(sz);
+		} else {
+		    objSize = 0; /* unknown */
+		}
+	    } else {
+		OBJ oClass = __Class(anObject);
+		int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
+
+		nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
+
+		switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
+		    case BYTEARRAY:
+		    case WORDARRAY:
+		    case LONGARRAY:
+		    case SWORDARRAY:
+		    case SLONGARRAY:
+		    case FLOATARRAY:
+			break;
+		    case DOUBLEARRAY:
 #ifdef __NEED_DOUBLE_ALIGN
-                        nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
+			nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
 #endif
-                        break;
-                    case LONGLONGARRAY:
-                    case SLONGLONGARRAY:
+			break;
+		    case LONGLONGARRAY:
+		    case SLONGLONGARRAY:
 #ifdef __NEED_LONGLONG_ALIGN
-                        nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
+			nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
 #endif
-                        break;
-                    default:
-                        goto bad;
-                }
-                extPtr = (char *)0;
-                objSize = __Size(anObject) - nInstBytes;
-            }
-
-            if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) {
-                _buffered = (__INST(buffered) == true);
-                if (_buffered) {
-                    __READING__(f);
-                }
-
-                if (extPtr) {
-                    __READAVAILBYTES__(ret, f, extPtr+offs, cnt, _buffered, __INST(handleType));
-                } else {
-                    /*
-                     * on interrupt, anObject may be moved to another location.
-                     * So we pass (char *)__InstPtr(anObject) + nInstBytes + offs to the macro __READ_BYTES__,
-                     * to get a new address.
-                     */
-                    offs += nInstBytes;
-                    __READAVAILBYTES_OBJ__(ret, f, anObject, offs, cnt, _buffered, __INST(handleType));
-                }
-                /* 0 is NOT an EOF condition here ... */
-                if (ret >= 0) {
-                    if (__isSmallInteger(__INST(position))) {
-                        INT np = __intVal(__INST(position)) + ret;
-                        OBJ t;
-
-                        t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                    } else {
-                        __INST(position) = nil; /* i.e. do not know */
-                    }
-                    RETURN (__mkSmallInteger(ret));
-                }
-                __INST(position) = nil;
-                error = __mkSmallInteger(__threadErrno);
-            }
-        }
+			break;
+		    default:
+			goto bad;
+		}
+		extPtr = (char *)0;
+		objSize = __Size(anObject) - nInstBytes;
+	    }
+
+	    if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) {
+		_buffered = (__INST(buffered) == true);
+		if (_buffered) {
+		    __READING__(f);
+		}
+
+		if (extPtr) {
+		    __READAVAILBYTES__(ret, f, extPtr+offs, cnt, _buffered, __INST(handleType));
+		} else {
+		    /*
+		     * on interrupt, anObject may be moved to another location.
+		     * So we pass (char *)__InstPtr(anObject) + nInstBytes + offs to the macro __READ_BYTES__,
+		     * to get a new address.
+		     */
+		    offs += nInstBytes;
+		    __READAVAILBYTES_OBJ__(ret, f, anObject, offs, cnt, _buffered, __INST(handleType));
+		}
+		/* 0 is NOT an EOF condition here ... */
+		if (ret >= 0) {
+		    if (__isSmallInteger(__INST(position))) {
+			INT np = __intVal(__INST(position)) + ret;
+			OBJ t;
+
+			t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		    } else {
+			__INST(position) = nil; /* i.e. do not know */
+		    }
+		    RETURN (__mkSmallInteger(ret));
+		}
+		__INST(position) = nil;
+		error = __mkSmallInteger(__threadErrno);
+	    }
+	}
     }
 bad: ;
 %}.
     (hitEOF and:[self pastEndRead isNil]) ifTrue:[^ 0].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error
+	lastErrorNumber := error.
+	^ self readError:error
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
@@ -3356,40 +3553,40 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-         && (__INST(mode) != @symbol(writeonly))) {
-            f = __FILEVal(fp);
-
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTE__(ret, f, &byte, _buffered, __INST(handleType));
-            if (ret > 0) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 1;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                RETURN (__mkSmallInteger(byte));
-            }
-
-            if (ret == 0) {
-                __INST(hitEOF) = true;
-            } else /* ret < 0 */ {
-                __INST(position) = nil;
-                error = __mkSmallInteger(__threadErrno);
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	 && (__INST(mode) != @symbol(writeonly))) {
+	    f = __FILEVal(fp);
+
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTE__(ret, f, &byte, _buffered, __INST(handleType));
+	    if (ret > 0) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 1;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		RETURN (__mkSmallInteger(byte));
+	    }
+
+	    if (ret == 0) {
+		__INST(hitEOF) = true;
+	    } else /* ret < 0 */ {
+		__INST(position) = nil;
+		error = __mkSmallInteger(__threadErrno);
+	    }
+	}
     }
 %}.
     hitEOF ifTrue:[^ self pastEndRead].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error
+	lastErrorNumber := error.
+	^ self readError:error
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     ^ self errorWriteOnly
@@ -3434,98 +3631,98 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-            && __bothSmallInteger(count, start)
-        ) {
-            f = __FILEVal(fp);
-
-            cnt = __intVal(count);
-            offs = __intVal(start) - 1;
-
-            if (__isExternalBytesLike(anObject)) {
-                OBJ sz;
-
-                nInstBytes = 0;
-                extPtr = (char *)(__externalBytesAddress(anObject));
-                if (extPtr == NULL) goto bad;
-                sz = __externalBytesSize(anObject);
-                if (__isSmallInteger(sz)) {
-                    objSize = __intVal(sz);
-                } else {
-                    objSize = 0; /* unknown */
-                }
-            } else {
-                OBJ oClass = __Class(anObject);
-                int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
-
-                nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
-                switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
-                    case BYTEARRAY:
-                    case WORDARRAY:
-                    case LONGARRAY:
-                    case SWORDARRAY:
-                    case SLONGARRAY:
-                    case FLOATARRAY:
-                        break;
-                    case DOUBLEARRAY:
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	    && __bothSmallInteger(count, start)
+	) {
+	    f = __FILEVal(fp);
+
+	    cnt = __intVal(count);
+	    offs = __intVal(start) - 1;
+
+	    if (__isExternalBytesLike(anObject)) {
+		OBJ sz;
+
+		nInstBytes = 0;
+		extPtr = (char *)(__externalBytesAddress(anObject));
+		if (extPtr == NULL) goto bad;
+		sz = __externalBytesSize(anObject);
+		if (__isSmallInteger(sz)) {
+		    objSize = __intVal(sz);
+		} else {
+		    objSize = 0; /* unknown */
+		}
+	    } else {
+		OBJ oClass = __Class(anObject);
+		int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
+
+		nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
+		switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
+		    case BYTEARRAY:
+		    case WORDARRAY:
+		    case LONGARRAY:
+		    case SWORDARRAY:
+		    case SLONGARRAY:
+		    case FLOATARRAY:
+			break;
+		    case DOUBLEARRAY:
 #ifdef __NEED_DOUBLE_ALIGN
-                        nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
+			nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
 #endif
-                        break;
-                    case LONGLONGARRAY:
-                    case SLONGLONGARRAY:
+			break;
+		    case LONGLONGARRAY:
+		    case SLONGLONGARRAY:
 #ifdef __NEED_LONGLONG_ALIGN
-                        nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
+			nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
 #endif
-                        break;
-                    default:
-                        goto bad;
-                }
-                extPtr = (char *)0;
-                objSize = __Size(anObject) - nInstBytes;
-            }
-            if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) {
-                _buffered = (__INST(buffered) == true);
-                if (_buffered) {
-                    __READING__(f);
-                }
-
-                if (extPtr) {
-                    __READBYTES__(ret, f, extPtr+offs, cnt, _buffered, __INST(handleType));
-                } else {
-                    /*
-                     * on interrupt, anObject may be moved to another location.
-                     * So we pass anObject, and the offset to the __READBYTES_OBJ__ macro.
-                     */
-                    offs += nInstBytes;
-                    __READBYTES_OBJ__(ret, f, anObject, offs, cnt, _buffered, __INST(handleType));
-                }
-
-                if (ret > 0) {
-                    if (__isSmallInteger(__INST(position))) {
-                        INT np = __intVal(__INST(position)) + ret;
-                        OBJ t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                    } else {
-                        __INST(position) = nil; /* i.e. do not know */
-                    }
-                    RETURN (__mkSmallInteger(ret));
-                }
-                if (ret == 0) {
-                    __INST(hitEOF) = true;
-                } else /* ret < 0 */ {
-                    __INST(position) = nil;
-                    error = __mkSmallInteger(__threadErrno);
-                }
-            }
-        }
+			break;
+		    default:
+			goto bad;
+		}
+		extPtr = (char *)0;
+		objSize = __Size(anObject) - nInstBytes;
+	    }
+	    if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) {
+		_buffered = (__INST(buffered) == true);
+		if (_buffered) {
+		    __READING__(f);
+		}
+
+		if (extPtr) {
+		    __READBYTES__(ret, f, extPtr+offs, cnt, _buffered, __INST(handleType));
+		} else {
+		    /*
+		     * on interrupt, anObject may be moved to another location.
+		     * So we pass anObject, and the offset to the __READBYTES_OBJ__ macro.
+		     */
+		    offs += nInstBytes;
+		    __READBYTES_OBJ__(ret, f, anObject, offs, cnt, _buffered, __INST(handleType));
+		}
+
+		if (ret > 0) {
+		    if (__isSmallInteger(__INST(position))) {
+			INT np = __intVal(__INST(position)) + ret;
+			OBJ t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		    } else {
+			__INST(position) = nil; /* i.e. do not know */
+		    }
+		    RETURN (__mkSmallInteger(ret));
+		}
+		if (ret == 0) {
+		    __INST(hitEOF) = true;
+		} else /* ret < 0 */ {
+		    __INST(position) = nil;
+		    error = __mkSmallInteger(__threadErrno);
+		}
+	    }
+	}
     }
 bad: ;
 %}.
     (hitEOF and:[self pastEndRead isNil]) ifTrue:[^ 0].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error
+	lastErrorNumber := error.
+	^ self readError:error
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
@@ -3561,69 +3758,69 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            FILEPOINTER f;
-            int ret, _buffered;
-            int value;
-            union {
-                unsigned char buffer[4];
-                int intVal;
-            } u;
-
-            f = __FILEVal(fp);
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTES__(ret, f, u.buffer, 4, _buffered, __INST(handleType));
-
-            if (ret == 4) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 4;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                if (msbFlag == true) {
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    FILEPOINTER f;
+	    int ret, _buffered;
+	    int value;
+	    union {
+		unsigned char buffer[4];
+		int intVal;
+	    } u;
+
+	    f = __FILEVal(fp);
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTES__(ret, f, u.buffer, 4, _buffered, __INST(handleType));
+
+	    if (ret == 4) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 4;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		if (msbFlag == true) {
 #if defined(__MSBFIRST__)
-                    value = u.intVal;
+		    value = u.intVal;
 #else
-                    value = (u.buffer[0] & 0xFF);
-                    value = (value << 8) | (u.buffer[1] & 0xFF);
-                    value = (value << 8) | (u.buffer[2] & 0xFF);
-                    value = (value << 8) | (u.buffer[3] & 0xFF);
+		    value = (u.buffer[0] & 0xFF);
+		    value = (value << 8) | (u.buffer[1] & 0xFF);
+		    value = (value << 8) | (u.buffer[2] & 0xFF);
+		    value = (value << 8) | (u.buffer[3] & 0xFF);
 #endif
-                } else {
+		} else {
 #if defined(__LSBFIRST__)
-                    value = u.intVal;
+		    value = u.intVal;
 #else
-                    value = (u.buffer[3] & 0xFF);
-                    value = (value << 8) | (u.buffer[2] & 0xFF);
-                    value = (value << 8) | (u.buffer[1] & 0xFF);
-                    value = (value << 8) | (u.buffer[0] & 0xFF);
+		    value = (u.buffer[3] & 0xFF);
+		    value = (value << 8) | (u.buffer[2] & 0xFF);
+		    value = (value << 8) | (u.buffer[1] & 0xFF);
+		    value = (value << 8) | (u.buffer[0] & 0xFF);
 #endif
-                }
+		}
 #if __POINTER_SIZE__ == 8
-                RETURN ( __mkSmallInteger(value));
+		RETURN ( __mkSmallInteger(value));
 #else
-                if ((value >= _MIN_INT) && (value <= _MAX_INT)) {
-                    RETURN ( __mkSmallInteger(value));
-                }
-                RETURN ( __MKLARGEINT(value) );
+		if ((value >= _MIN_INT) && (value <= _MAX_INT)) {
+		    RETURN ( __mkSmallInteger(value));
+		}
+		RETURN ( __MKLARGEINT(value) );
 #endif
-            }
-
-            if (ret < 0) {
-                __INST(position) = nil;
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+	    }
+
+	    if (ret < 0) {
+		__INST(position) = nil;
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF ifTrue:[^ self pastEndRead].
@@ -3650,56 +3847,56 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            FILEPOINTER f;
-            int ret, _buffered;
-            short value;
-            union {
-                unsigned char buffer[2];
-                short shortVal;
-            } u;
-
-            f = __FILEVal(fp);
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTES__(ret, f, u.buffer, 2, _buffered, __INST(handleType));
-
-            if (ret == 2) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 2;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                if (msbFlag == true) {
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    FILEPOINTER f;
+	    int ret, _buffered;
+	    short value;
+	    union {
+		unsigned char buffer[2];
+		short shortVal;
+	    } u;
+
+	    f = __FILEVal(fp);
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTES__(ret, f, u.buffer, 2, _buffered, __INST(handleType));
+
+	    if (ret == 2) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 2;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		if (msbFlag == true) {
 #if defined(__MSBFIRST__)
-                    value = u.shortVal;
+		    value = u.shortVal;
 #else
-                    value = ((u.buffer[0] & 0xFF) << 8) | (u.buffer[1] & 0xFF);
+		    value = ((u.buffer[0] & 0xFF) << 8) | (u.buffer[1] & 0xFF);
 #endif
-                } else {
+		} else {
 #if defined(__LSBFIRST__)
-                    value = u.shortVal;
+		    value = u.shortVal;
 #else
-                    value = ((u.buffer[1] & 0xFF) << 8) | (u.buffer[0] & 0xFF);
+		    value = ((u.buffer[1] & 0xFF) << 8) | (u.buffer[0] & 0xFF);
 #endif
-                }
-                RETURN (__mkSmallInteger(value));
-            }
-
-            if (ret < 0) {
-                __INST(position) = nil; /* i.e. do not know */
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+		}
+		RETURN (__mkSmallInteger(value));
+	    }
+
+	    if (ret < 0) {
+		__INST(position) = nil; /* i.e. do not know */
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF ifTrue:[^ self pastEndRead].
@@ -3727,70 +3924,70 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            FILEPOINTER f;
-            int ret, _buffered;
-            unsigned INT value;
-            union {
-                unsigned char buffer[4];
-                unsigned int intVal;
-            } u;
-
-            f = __FILEVal(fp);
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTES__(ret, f, u.buffer, 4, _buffered, __INST(handleType));
-
-            if (ret == 4) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 4;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                if (msbFlag == true) {
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    FILEPOINTER f;
+	    int ret, _buffered;
+	    unsigned INT value;
+	    union {
+		unsigned char buffer[4];
+		unsigned int intVal;
+	    } u;
+
+	    f = __FILEVal(fp);
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTES__(ret, f, u.buffer, 4, _buffered, __INST(handleType));
+
+	    if (ret == 4) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 4;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		if (msbFlag == true) {
 #if defined(__MSBFIRST__)
-                    value = u.intVal;
+		    value = u.intVal;
 #else
-                    value = u.buffer[0];
-                    value = (value << 8) | u.buffer[1];
-                    value = (value << 8) | u.buffer[2];
-                    value = (value << 8) | u.buffer[3];
+		    value = u.buffer[0];
+		    value = (value << 8) | u.buffer[1];
+		    value = (value << 8) | u.buffer[2];
+		    value = (value << 8) | u.buffer[3];
 #endif
-                } else {
+		} else {
 #if defined(__LSBFIRST__)
-                    value = u.intVal;
+		    value = u.intVal;
 #else
-                    value = u.buffer[3];
-                    value = (value << 8) | u.buffer[2];
-                    value = (value << 8) | u.buffer[1];
-                    value = (value << 8) | u.buffer[0];
+		    value = u.buffer[3];
+		    value = (value << 8) | u.buffer[2];
+		    value = (value << 8) | u.buffer[1];
+		    value = (value << 8) | u.buffer[0];
 #endif
-                }
+		}
 #if __POINTER_SIZE__ == 8
-                value &= 0xFFFFFFFF;
-                RETURN (__mkSmallInteger(value));
+		value &= 0xFFFFFFFF;
+		RETURN (__mkSmallInteger(value));
 #else
-                if (value <= _MAX_INT) {
-                    RETURN (__mkSmallInteger(value));
-                }
-                RETURN (__MKULARGEINT(value) );
+		if (value <= _MAX_INT) {
+		    RETURN (__mkSmallInteger(value));
+		}
+		RETURN (__MKULARGEINT(value) );
 #endif
-            }
-
-            if (ret < 0) {
-                __INST(position) = nil; /* i.e. do not know */
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+	    }
+
+	    if (ret < 0) {
+		__INST(position) = nil; /* i.e. do not know */
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF ifTrue:[^ self pastEndRead].
@@ -3817,56 +4014,56 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            FILEPOINTER f;
-            int ret, _buffered;
-            unsigned int value;
-            union {
-                unsigned char buffer[2];
-                unsigned short shortVal;
-            } u;
-
-            f = __FILEVal(fp);
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTES__(ret, f, u.buffer, 2, _buffered, __INST(handleType));
-
-            if (ret == 2) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 2;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                if (msbFlag == true) {
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    FILEPOINTER f;
+	    int ret, _buffered;
+	    unsigned int value;
+	    union {
+		unsigned char buffer[2];
+		unsigned short shortVal;
+	    } u;
+
+	    f = __FILEVal(fp);
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTES__(ret, f, u.buffer, 2, _buffered, __INST(handleType));
+
+	    if (ret == 2) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 2;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		if (msbFlag == true) {
 #if defined(__MSBFIRST__)
-                    value = u.shortVal;
+		    value = u.shortVal;
 #else
-                    value = (u.buffer[0] << 8) | u.buffer[1];
+		    value = (u.buffer[0] << 8) | u.buffer[1];
 #endif
-                } else {
+		} else {
 #if defined(__LSBFIRST__)
-                    value = u.shortVal;
+		    value = u.shortVal;
 #else
-                    value = (u.buffer[1] << 8) | u.buffer[0];
+		    value = (u.buffer[1] << 8) | u.buffer[0];
 #endif
-                }
-                RETURN (__mkSmallInteger(value));
-            }
-
-            if (ret < 0) {
-                __INST(position) = nil; /* i.e. do not know */
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+		}
+		RETURN (__mkSmallInteger(value));
+	    }
+
+	    if (ret < 0) {
+		__INST(position) = nil; /* i.e. do not know */
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF ifTrue:[^ self pastEndRead].
@@ -3912,40 +4109,40 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-            && __isSmallInteger(aByteValue)
-
-        ) {
-            c = __intVal(aByteValue);
-            f = __FILEVal(fp);
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	    && __isSmallInteger(aByteValue)
+
+	) {
+	    c = __intVal(aByteValue);
+	    f = __FILEVal(fp);
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
 #ifdef WIN32
-            if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                cnt = __win32_fwrite(&c, 1, 1, f);
-            } else
+	    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+		cnt = __win32_fwrite(&c, 1, 1, f);
+	    } else
 #endif
-            {
-                __WRITEBYTE__(cnt, f, &c, _buffered, __INST(handleType));
-            }
-            if (cnt == 1) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 1;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                RETURN (self);
-            }
-            if (cnt < 0) {
-                __INST(position) = nil; /* i.e. do not know */
-            }
-            error = __mkSmallInteger(__threadErrno);
-        }
+	    {
+		__WRITEBYTE__(cnt, f, &c, _buffered, __INST(handleType));
+	    }
+	    if (cnt == 1) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 1;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		RETURN (self);
+	    }
+	    if (cnt < 0) {
+		__INST(position) = nil; /* i.e. do not know */
+	    }
+	    error = __mkSmallInteger(__threadErrno);
+	}
     }
 %}.
     handle isNil ifTrue:[self errorNotOpen. ^ self].
@@ -3963,9 +4160,9 @@
 
      Use with care - non object oriented i/o.
      Warning:
-        in general, you cannot use this method to pass non-byte data to other
-        architectures (unless you prepared the buffer with care),
-        since it does not care for byte order or float representation."
+	in general, you cannot use this method to pass non-byte data to other
+	architectures (unless you prepared the buffer with care),
+	since it does not care for byte order or float representation."
 
     |error|
 
@@ -3982,103 +4179,103 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-            && __bothSmallInteger(count, start)
-        ) {
-            len = __intVal(count);
-            offs = __intVal(start) - 1;
-            f = __FILEVal(fp);
-
-            if (__isExternalBytesLike(anObject)) {
-                OBJ sz;
-
-                nInstBytes = 0;
-                extPtr = (char *)__externalBytesAddress(anObject);
-                if (extPtr == NULL) goto bad;
-                sz = __externalBytesSize(anObject);
-                if (__isSmallInteger(sz)) {
-                    objSize = __intVal(sz);
-                } else {
-                    objSize = 0; /* unknown */
-                }
-            } else {
-                OBJ oClass = __Class(anObject);
-                int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
-
-                nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
-                switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
-                    case BYTEARRAY:
-                    case WORDARRAY:
-                    case LONGARRAY:
-                    case SWORDARRAY:
-                    case SLONGARRAY:
-                    case FLOATARRAY:
-                        break;
-                    case DOUBLEARRAY:
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	    && __bothSmallInteger(count, start)
+	) {
+	    len = __intVal(count);
+	    offs = __intVal(start) - 1;
+	    f = __FILEVal(fp);
+
+	    if (__isExternalBytesLike(anObject)) {
+		OBJ sz;
+
+		nInstBytes = 0;
+		extPtr = (char *)__externalBytesAddress(anObject);
+		if (extPtr == NULL) goto bad;
+		sz = __externalBytesSize(anObject);
+		if (__isSmallInteger(sz)) {
+		    objSize = __intVal(sz);
+		} else {
+		    objSize = 0; /* unknown */
+		}
+	    } else {
+		OBJ oClass = __Class(anObject);
+		int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
+
+		nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
+		switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
+		    case BYTEARRAY:
+		    case WORDARRAY:
+		    case LONGARRAY:
+		    case SWORDARRAY:
+		    case SLONGARRAY:
+		    case FLOATARRAY:
+			break;
+		    case DOUBLEARRAY:
 #ifdef __NEED_DOUBLE_ALIGN
-                        nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
+			nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
 #endif
-                        break;
-                    case LONGLONGARRAY:
-                    case SLONGLONGARRAY:
+			break;
+		    case LONGLONGARRAY:
+		    case SLONGLONGARRAY:
 #ifdef __NEED_LONGLONG_ALIGN
-                        nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
+			nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
 #endif
-                        break;
-                    default:
-                        goto bad;
-                }
-                extPtr = (char *)0;
-                objSize = __Size(anObject) - nInstBytes;
-            }
-            if ( (offs >= 0) && (len >= 0) && (objSize >= (len + offs)) ) {
-                if (_buffered = (__INST(buffered) == true)) {
-                    __WRITING__(f)
-                }
-
-                if (extPtr) {
-                    __WRITEBYTES__(cnt, f, extPtr+offs, len, _buffered, __INST(handleType));
-                } else {
-                    /*
-                     * on interrupt, anObject may be moved to another location.
-                     * So we pass anObject, and the offset to the __WRITEBYTES_OBJ__ macro.
-                     */
-                    offs += nInstBytes;
-                    __WRITEBYTES_OBJ__(cnt, f, anObject, offs, len, _buffered, __INST(handleType));
-                }
-
-                if (cnt >= 0) {
-                    if (__isSmallInteger(__INST(position))) {
-                        INT np = __intVal(__INST(position)) + cnt;
-                        OBJ t;
-
-                        t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                    } else {
-                        __INST(position) = nil; /* i.e. do not know */
-                    }
-                    RETURN ( __mkSmallInteger(cnt) );
-                } else /* cnt < 0 */ {
-                    if (
+			break;
+		    default:
+			goto bad;
+		}
+		extPtr = (char *)0;
+		objSize = __Size(anObject) - nInstBytes;
+	    }
+	    if ( (offs >= 0) && (len >= 0) && (objSize >= (len + offs)) ) {
+		if (_buffered = (__INST(buffered) == true)) {
+		    __WRITING__(f)
+		}
+
+		if (extPtr) {
+		    __WRITEBYTES__(cnt, f, extPtr+offs, len, _buffered, __INST(handleType));
+		} else {
+		    /*
+		     * on interrupt, anObject may be moved to another location.
+		     * So we pass anObject, and the offset to the __WRITEBYTES_OBJ__ macro.
+		     */
+		    offs += nInstBytes;
+		    __WRITEBYTES_OBJ__(cnt, f, anObject, offs, len, _buffered, __INST(handleType));
+		}
+
+		if (cnt >= 0) {
+		    if (__isSmallInteger(__INST(position))) {
+			INT np = __intVal(__INST(position)) + cnt;
+			OBJ t;
+
+			t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		    } else {
+			__INST(position) = nil; /* i.e. do not know */
+		    }
+		    RETURN ( __mkSmallInteger(cnt) );
+		} else /* cnt < 0 */ {
+		    if (
 #ifdef EWOULDBLOCK
-                        (__threadErrno == EWOULDBLOCK) ||
+			(__threadErrno == EWOULDBLOCK) ||
 #endif
-                        (__threadErrno == EAGAIN)
-                    ) {
-                        RETURN ( __mkSmallInteger(0) );
-                    }
-                    __INST(position) = nil; /* i.e. do not know */
-                    error = __mkSmallInteger(__threadErrno);
-                }
-            }
-        }
+			(__threadErrno == EAGAIN)
+		    ) {
+			RETURN ( __mkSmallInteger(0) );
+		    }
+		    __INST(position) = nil; /* i.e. do not know */
+		    error = __mkSmallInteger(__threadErrno);
+		}
+	    }
+	}
     }
 bad: ;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #readonly) ifTrue:[^ self errorReadOnly].
@@ -4096,8 +4293,8 @@
 %{
     int num;
     union {
-        char bytes[4];
-        int intVal;
+	char bytes[4];
+	int intVal;
     } u;
     FILEPOINTER f;
     int cnt, _buffered;
@@ -4105,21 +4302,21 @@
 
     __INST(lastErrorNumber) = nil;
     if (__isSmallInteger(aNumber)) {
-        num = __intVal(aNumber);
+	num = __intVal(aNumber);
     } else {
 #if __POINTER_SIZE__ == 8
-        goto badArg;
+	goto badArg;
 #else
-        num = __longIntVal(aNumber);
-        if (num == 0) {
-            num = __signedLongIntVal(aNumber);
-            if (num == 0) {
-                /* bad arg or out-of-range integer
-                 * (handled by the fallBack code)
-                 */
-                goto badArg;
-            }
-        }
+	num = __longIntVal(aNumber);
+	if (num == 0) {
+	    num = __signedLongIntVal(aNumber);
+	    if (num == 0) {
+		/* bad arg or out-of-range integer
+		 * (handled by the fallBack code)
+		 */
+		goto badArg;
+	    }
+	}
 #endif
     }
 
@@ -4128,62 +4325,62 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-         && (__INST(mode) != @symbol(readonly))
-        ) {
-            if (msbFlag == true) {
+	if (((fp = __INST(handle)) != nil)
+	 && (__INST(mode) != @symbol(readonly))
+	) {
+	    if (msbFlag == true) {
 #if defined(__MSBFIRST__)
-                u.intVal = num;
+		u.intVal = num;
 #else
-                u.bytes[0] = (num >> 24) & 0xFF;
-                u.bytes[1] = (num >> 16) & 0xFF;
-                u.bytes[2] = (num >> 8) & 0xFF;
-                u.bytes[3] = num & 0xFF;
+		u.bytes[0] = (num >> 24) & 0xFF;
+		u.bytes[1] = (num >> 16) & 0xFF;
+		u.bytes[2] = (num >> 8) & 0xFF;
+		u.bytes[3] = num & 0xFF;
 #endif
-            } else {
+	    } else {
 #if defined(__LSBFIRST__)
-                u.intVal = num;
+		u.intVal = num;
 #else
-                u.bytes[3] = (num >> 24) & 0xFF;
-                u.bytes[2] = (num >> 16) & 0xFF;
-                u.bytes[1] = (num >> 8) & 0xFF;
-                u.bytes[0] = num & 0xFF;
+		u.bytes[3] = (num >> 24) & 0xFF;
+		u.bytes[2] = (num >> 16) & 0xFF;
+		u.bytes[1] = (num >> 8) & 0xFF;
+		u.bytes[0] = num & 0xFF;
 #endif
-            }
-
-            f = __FILEVal(fp);
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
-            __WRITEBYTES__(cnt, f, u.bytes, 4, _buffered, __INST(handleType));
-
-            if (cnt == 4) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 4;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                RETURN ( self );
-            }
-            __INST(position) = nil; /* i.e. do not know */
-            error = __mkSmallInteger(__threadErrno);
-        }
+	    }
+
+	    f = __FILEVal(fp);
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
+	    __WRITEBYTES__(cnt, f, u.bytes, 4, _buffered, __INST(handleType));
+
+	    if (cnt == 4) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 4;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		RETURN ( self );
+	    }
+	    __INST(position) = nil; /* i.e. do not know */
+	    error = __mkSmallInteger(__threadErrno);
+	}
     }
 badArg: ;
 %}.
     handle isNil ifTrue:[self errorNotOpen. ^ self].
     (mode == #readonly) ifTrue:[self errorReadOnly. ^ self].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
 
     aNumber isInteger ifTrue:[
-        ^ super nextPutLong:aNumber MSB:msbFlag
+	^ super nextPutLong:aNumber MSB:msbFlag
     ].
     self argumentMustBeInteger
 !
@@ -4198,8 +4395,8 @@
 %{
     int num;
     union {
-        char bytes[2];
-        short shortVal;
+	char bytes[2];
+	short shortVal;
     } u;
 
     FILEPOINTER f;
@@ -4212,59 +4409,59 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-        ) {
-            if (__isSmallInteger(anIntegerOrCharacter)) {
-                num = __intVal(anIntegerOrCharacter);
-            } else if (__isCharacter(anIntegerOrCharacter)) {
-                num = __smallIntegerVal(__characterVal(anIntegerOrCharacter));
-            } else
-                goto out;
-
-            if (msbFlag == true) {
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	) {
+	    if (__isSmallInteger(anIntegerOrCharacter)) {
+		num = __intVal(anIntegerOrCharacter);
+	    } else if (__isCharacter(anIntegerOrCharacter)) {
+		num = __smallIntegerVal(__characterVal(anIntegerOrCharacter));
+	    } else
+		goto out;
+
+	    if (msbFlag == true) {
 #if defined(__MSBFIRST__)
-                u.shortVal = num;
+		u.shortVal = num;
 #else
-                u.bytes[0] = (num >> 8) & 0xFF;
-                u.bytes[1] = num & 0xFF;
+		u.bytes[0] = (num >> 8) & 0xFF;
+		u.bytes[1] = num & 0xFF;
 #endif
-            } else {
+	    } else {
 #if defined(__LSBFIRST__)
-                u.shortVal = num;
+		u.shortVal = num;
 #else
-                u.bytes[1] = (num >> 8) & 0xFF;
-                u.bytes[0] = num & 0xFF;
+		u.bytes[1] = (num >> 8) & 0xFF;
+		u.bytes[0] = num & 0xFF;
 #endif
-            }
-
-            f = __FILEVal(fp);
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
-            __WRITEBYTES__(cnt, f, u.bytes, 2, _buffered, __INST(handleType));
-
-            if (cnt == 2) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + 2;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                RETURN ( self );
-            }
-            __INST(position) = nil; /* i.e. do not know */
-            error = __mkSmallInteger(__threadErrno);
-        }
+	    }
+
+	    f = __FILEVal(fp);
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
+	    __WRITEBYTES__(cnt, f, u.bytes, 2, _buffered, __INST(handleType));
+
+	    if (cnt == 2) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + 2;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		RETURN ( self );
+	    }
+	    __INST(position) = nil; /* i.e. do not know */
+	    error = __mkSmallInteger(__threadErrno);
+	}
     }
 out:;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
     handle isNil ifTrue:[self errorNotOpen. ^ self].
     (mode == #readonly) ifTrue:[self errorReadOnly. ^ self].
@@ -4311,65 +4508,65 @@
     int rslt;
 
     if (fp == nil) {
-        error = @symbol(errorNotOpen);
-        goto out;
+	error = @symbol(errorNotOpen);
+	goto out;
     }
-        
+
     if (__INST(handleType) == @symbol(socketHandle)) {
-        SOCKET sock = __FILEVal(fp);
-
-        if (@global(FileOpenTrace) == true) {
-            fprintf(stderr, "close socket [ExternalStream] %"_lx_"\n", sock);
-        }
-
-        // whether the close() will be successful or not - the handle is invalid now!
-        __INST(handle) = nil;
-        do {
+	SOCKET sock = __FILEVal(fp);
+
+	if (@global(FileOpenTrace) == true) {
+	    fprintf(stderr, "close socket [ExternalStream] %"_lx_"\n", (INT)sock);
+	}
+
+	// whether the close() will be successful or not - the handle is invalid now!
+	__INST(handle) = nil;
+	do {
 #ifdef WIN32
-            rslt = __STX_WSA_NOINT_CALL1("closesocket", closesocket, sock);
+	    rslt = __STX_WSA_NOINT_CALL1("closesocket", closesocket, sock);
 #else
-            rslt = close(sock);
+	    rslt = close(sock);
 #endif
-        } while((rslt < 0) && (__threadErrno == EINTR));
+	} while((rslt < 0) && (__threadErrno == EINTR));
     } else if ((__INST(handleType) == nil)
-               || (__INST(handleType) == @symbol(filePointer))
-               || (__INST(handleType) == @symbol(socketFilePointer))
-               || (__INST(handleType) == @symbol(pipeFilePointer)))
+	       || (__INST(handleType) == @symbol(filePointer))
+	       || (__INST(handleType) == @symbol(socketFilePointer))
+	       || (__INST(handleType) == @symbol(pipeFilePointer)))
     {
-        FILEPOINTER f = __FILEVal(fp);
-
-        if (@global(FileOpenTrace) == true) {
-            fprintf(stderr, "fclose [ExternalStream] %"_lx_"\n", f);
-        }
-        // whether the close() will be successful or not - the handle is invalid now!
-        __INST(handle) = nil;
+	FILEPOINTER f = __FILEVal(fp);
+
+	if (@global(FileOpenTrace) == true) {
+	    fprintf(stderr, "fclose [ExternalStream] %"_lx_"\n", (INT)f);
+	}
+	// whether the close() will be successful or not - the handle is invalid now!
+	__INST(handle) = nil;
 
 #ifdef WIN32
-        if (__INST(mode) != @symbol(readonly) && __INST(buffered) != false) {
-            // do a fflush() first, so that fclose() doesn't block
-            // we suspect, that EINTR causes problems in fclose()
-            do {
-                __threadErrno = 0;
-                rslt = __STX_C_CALL1("fflush", fflush, f);
-            } while((rslt < 0) && (__threadErrno == EINTR));
-        }
-        do {
-            __threadErrno = 0;
-            rslt = __STX_C_NOINT_CALL1("fclose", fclose, f);
-        } while((rslt < 0) && (__threadErrno == EINTR));
+	if (__INST(mode) != @symbol(readonly) && __INST(buffered) != false) {
+	    // do a fflush() first, so that fclose() doesn't block
+	    // we suspect, that EINTR causes problems in fclose()
+	    do {
+		__threadErrno = 0;
+		rslt = __STX_C_CALL1("fflush", fflush, f);
+	    } while((rslt < 0) && (__threadErrno == EINTR));
+	}
+	do {
+	    __threadErrno = 0;
+	    rslt = __STX_C_NOINT_CALL1("fclose", fclose, f);
+	} while((rslt < 0) && (__threadErrno == EINTR));
 #else
-        __BEGIN_INTERRUPTABLE__
-        rslt = fclose(f);
-        __END_INTERRUPTABLE__
+	__BEGIN_INTERRUPTABLE__
+	rslt = fclose(f);
+	__END_INTERRUPTABLE__
 #endif
     } else {
-        error = @symbol(badHandleType);
-        goto out;
+	error = @symbol(badHandleType);
+	goto out;
     }
 
     if (rslt < 0) {
-        error = __mkSmallInteger(__threadErrno);
-        goto out;
+	error = __mkSmallInteger(__threadErrno);
+	goto out;
     }
     RETURN (self);
 
@@ -4377,24 +4574,24 @@
 %}.
 
     error notNil ifTrue:[
-        error == #errorNotOpen ifTrue:[
-            self errorNotOpen.
-        ].
-        error isInteger ifTrue:[
-            lastErrorNumber := error.
-            self writeError:error.
-            ^ self.
-        ].
-        self primitiveFailed:error.
-        ^ self.
+	error == #errorNotOpen ifTrue:[
+	    self errorNotOpen.
+	].
+	error isInteger ifTrue:[
+	    lastErrorNumber := error.
+	    self writeError:error.
+	    ^ self.
+	].
+	self primitiveFailed:error.
+	^ self.
     ].
 
     "/ fallback for rel5
 
     fp := handle.
     fp notNil ifTrue:[
-        handle := nil.
-        self closeFile:fp
+	handle := nil.
+	self closeFile:fp
     ]
 ! !
 
@@ -4454,7 +4651,7 @@
 	    error =__mkSmallInteger(__threadErrno);
 	} else {
 	    if (@global(FileOpenTrace) == true) {
-		fprintf(stderr, "fdopen [ExternalStream] %d (%"_lx_") -> %x\n", fd, fd, (INT)f);
+		fprintf(stderr, "fdopen [ExternalStream] %"_ld_" (%"_lx_") -> %"_lx_"\n", (INT)fd, (INT)fd, (INT)f);
 	    }
 
 	    fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
@@ -4696,26 +4893,26 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            f = __FILEVal(fp);
-
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTE__(ret, f, &ch, _buffered, __INST(handleType));
-
-            if (ret > 0) {
-                RETURN(nil)
-            }
-            if (ret < 0) {
-                RETURN(__mkSmallInteger(__threadErrno));
-            } else /* ret == 0 */ {
-                RETURN(__mkSmallInteger(0)); /* EOF */
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    f = __FILEVal(fp);
+
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTE__(ret, f, &ch, _buffered, __INST(handleType));
+
+	    if (ret > 0) {
+		RETURN(nil)
+	    }
+	    if (ret < 0) {
+		RETURN(__mkSmallInteger(__threadErrno));
+	    } else /* ret == 0 */ {
+		RETURN(__mkSmallInteger(0)); /* EOF */
+	    }
+	}
     }
 %}.
 !
@@ -4735,15 +4932,15 @@
     int success = 0;
 
     if (__INST(handleType) == @symbol(socketHandle)) {
-        success = ioctlsocket((SOCKET)__externalAddressVal(fd), FIONREAD, &res) == 0;
+	success = ioctlsocket((SOCKET)__externalAddressVal(fd), FIONREAD, &res) == 0;
     } else if (__INST(handleType) == @symbol(socketFilePointer)) {
-        success = ioctlsocket((SOCKET)_get_osfhandle(__intVal(fd)), FIONREAD, &res) == 0;
+	success = ioctlsocket((SOCKET)_get_osfhandle(__intVal(fd)), FIONREAD, &res) == 0;
     } else if (__INST(handleType) == @symbol(pipeFilePointer)) {
-        success = PeekNamedPipe((HANDLE)_get_osfhandle(__intVal(fd)),0,0,0,&res,0);
+	success = PeekNamedPipe((HANDLE)_get_osfhandle(__intVal(fd)),0,0,0,&res,0);
     }
     if (success) {
-        if (__INST(readAhead) != nil) res++;
-        RETURN(__mkSmallInteger(res));
+	if (__INST(readAhead) != nil) res++;
+	RETURN(__mkSmallInteger(res));
     }
 #endif
 %}.
@@ -4775,60 +4972,60 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            f = __FILEVal(fp);
-
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTE__(ret, f, &ch, _buffered, __INST(handleType));
-
-            if (ret > 0) {
-                pos = __INST(position);
-                if (__isSmallInteger(pos)) {
-                    OBJ t;
-
-                    t = __MKINT(__intVal(pos) + 1); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                if (__INST(binary) == true) {
-                    RETURN ( __mkSmallInteger(ch) );
-                }
-                RETURN ( __MKCHARACTER(ch) );
-            }
-
-            __INST(position) = nil;
-            if (ret < 0) {
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    f = __FILEVal(fp);
+
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTE__(ret, f, &ch, _buffered, __INST(handleType));
+
+	    if (ret > 0) {
+		pos = __INST(position);
+		if (__isSmallInteger(pos)) {
+		    OBJ t;
+
+		    t = __MKINT(__intVal(pos) + 1); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		if (__INST(binary) == true) {
+		    RETURN ( __mkSmallInteger(ch) );
+		}
+		RETURN ( __MKCHARACTER(ch) );
+	    }
+
+	    __INST(position) = nil;
+	    if (ret < 0) {
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF == true ifTrue:[^ self pastEndRead].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error
+	lastErrorNumber := error.
+	^ self readError:error
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
 
     readAhead notNil ifTrue:[
-        c := readAhead.
-        readAhead := nil.
-        ^ c.
+	c := readAhead.
+	readAhead := nil.
+	^ c.
     ].
     c := self nextByteFromFile:handle.
     c isNil ifTrue:[
-        ^ self pastEndRead.
+	^ self pastEndRead.
     ].
     binary == true ifTrue:[
-        ^ c
+	^ c
     ].
     ^ Character value:c
 !
@@ -4876,60 +5073,60 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            f = __FILEVal(fp);
-
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTE__(ret, f, &ch, _buffered, __INST(handleType));
-
-            if (ret > 0) {
-                pos = __INST(position);
-                if (__isSmallInteger(pos)) {
-                    OBJ t;
-
-                    t = __MKINT(__intVal(pos) + 1); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                if (__INST(binary) == true) {
-                    RETURN ( __mkSmallInteger(ch) );
-                }
-                RETURN ( __MKCHARACTER(ch) );
-            }
-
-            __INST(position) = nil;
-            if (ret < 0) {
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    f = __FILEVal(fp);
+
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTE__(ret, f, &ch, _buffered, __INST(handleType));
+
+	    if (ret > 0) {
+		pos = __INST(position);
+		if (__isSmallInteger(pos)) {
+		    OBJ t;
+
+		    t = __MKINT(__intVal(pos) + 1); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		if (__INST(binary) == true) {
+		    RETURN ( __mkSmallInteger(ch) );
+		}
+		RETURN ( __MKCHARACTER(ch) );
+	    }
+
+	    __INST(position) = nil;
+	    if (ret < 0) {
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF == true ifTrue:[^ nil].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error.
+	lastErrorNumber := error.
+	^ self readError:error.
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
 
     readAhead notNil ifTrue:[
-        c := readAhead.
-        readAhead := nil.
-        ^ c.
+	c := readAhead.
+	readAhead := nil.
+	^ c.
     ].
     c := self nextByteFromFile:handle.
     c isNil ifTrue:[
-        ^ nil.
+	^ nil.
     ].
     binary == true ifTrue:[
-        ^ c
+	^ c
     ].
     ^ Character value:c
 !
@@ -4949,11 +5146,11 @@
     OBJ ra;
 
     if ((ra = __INST(readAhead)) != nil) {
-        if (__INST(binary) == true) {
-            RETURN ( ra );
-        }
-        c = __intVal(ra);
-        RETURN ( __MKCHARACTER(c) );
+	if (__INST(binary) == true) {
+	    RETURN ( ra );
+	}
+	c = __intVal(ra);
+	RETURN ( __MKCHARACTER(c) );
     }
 
     __INST(lastErrorNumber) = nil;
@@ -4963,45 +5160,45 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            f = __FILEVal(fp);
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
-
-            if (ret > 0) {
-                __UNGETC__(c, f, _buffered);
-
-                if (__INST(binary) == true) {
-                    RETURN ( __mkSmallInteger(c) );
-                }
-                RETURN ( __MKCHARACTER(c) );
-            }
-            if (ret < 0) {
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    f = __FILEVal(fp);
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
+
+	    if (ret > 0) {
+		__UNGETC__(c, f, _buffered);
+
+		if (__INST(binary) == true) {
+		    RETURN ( __mkSmallInteger(c) );
+		}
+		RETURN ( __MKCHARACTER(c) );
+	    }
+	    if (ret < 0) {
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF == true ifTrue:[^ self pastEndRead].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error.
+	lastErrorNumber := error.
+	^ self readError:error.
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
 
     readAhead isNil ifTrue:[
-        readAhead := self nextOrNil.
-        readAhead isNil ifTrue:[
-            ^ self pastEndRead.
-        ].
+	readAhead := self nextOrNil.
+	readAhead isNil ifTrue:[
+	    ^ self pastEndRead.
+	].
     ].
     ^ readAhead
 !
@@ -5021,11 +5218,11 @@
     OBJ ra;
 
     if ((ra = __INST(readAhead)) != nil) {
-        if (__INST(binary) == true) {
-            RETURN ( ra );
-        }
-        c = __intVal(ra);
-        RETURN ( __MKCHARACTER(c) );
+	if (__INST(binary) == true) {
+	    RETURN ( ra );
+	}
+	c = __intVal(ra);
+	RETURN ( __MKCHARACTER(c) );
     }
 
     __INST(lastErrorNumber) = nil;
@@ -5035,42 +5232,42 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(writeonly))
-        ) {
-            f = __FILEVal(fp);
-            _buffered = (__INST(buffered) == true);
-            if (_buffered) {
-                __READING__(f)
-            }
-            __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
-
-            if (ret > 0) {
-                __UNGETC__(c, f, _buffered);
-
-                if (__INST(binary) == true) {
-                    RETURN ( __mkSmallInteger(c) );
-                }
-                RETURN ( __MKCHARACTER(c) );
-            }
-            if (ret < 0) {
-                error = __mkSmallInteger(__threadErrno);
-            } else /* ret == 0 */ {
-                __INST(hitEOF) = true;
-            }
-        }
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(writeonly))
+	) {
+	    f = __FILEVal(fp);
+	    _buffered = (__INST(buffered) == true);
+	    if (_buffered) {
+		__READING__(f)
+	    }
+	    __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
+
+	    if (ret > 0) {
+		__UNGETC__(c, f, _buffered);
+
+		if (__INST(binary) == true) {
+		    RETURN ( __mkSmallInteger(c) );
+		}
+		RETURN ( __MKCHARACTER(c) );
+	    }
+	    if (ret < 0) {
+		error = __mkSmallInteger(__threadErrno);
+	    } else /* ret == 0 */ {
+		__INST(hitEOF) = true;
+	    }
+	}
     }
 %}.
     hitEOF == true ifTrue:[^ nil].
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        ^ self readError:error.
+	lastErrorNumber := error.
+	^ self readError:error.
     ].
     handle isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
 
     readAhead isNil ifTrue:[
-        readAhead := self nextOrNil.
+	readAhead := self nextOrNil.
     ].
     ^ readAhead
 !
@@ -5136,19 +5333,19 @@
     int ret, _buffered;
 
     if (__INST(hitEOF) == true) {
-        RETURN (true);
+	RETURN (true);
     }
     pos = __INST(position);
     lim = __INST(readLimit);
     if (lim != nil) {
-        off_t _pos, _readLimit;
-
-        _pos = __signedLongIntVal(pos);
-        _pos = _pos - __intVal( @global(PositionableStream:ZeroPosition)) + 1;
-        _readLimit = __signedLongIntVal(lim);
-        if (_pos > _readLimit) {
-            RETURN (true);
-        }
+	off_t _pos, _readLimit;
+
+	_pos = __signedLongIntVal(pos);
+	_pos = _pos - __intVal( @global(PositionableStream:ZeroPosition)) + 1;
+	_readLimit = __signedLongIntVal(lim);
+	if (_pos > _readLimit) {
+	    RETURN (true);
+	}
     }
 
     __INST(lastErrorNumber) = nil;
@@ -5158,60 +5355,60 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if ((fp = __INST(handle)) != nil) {
-            f = __FILEVal(fp);
-            if (_buffered = (__INST(buffered) == true)) {
-                __READING__(f);
-            } else {
-                if (__INST(readAhead) != nil) {
-                    RETURN (false);
-                }
-            }
-
-            /*
-             * read ahead ...
-             */
-            do {
+	if ((fp = __INST(handle)) != nil) {
+	    f = __FILEVal(fp);
+	    if (_buffered = (__INST(buffered) == true)) {
+		__READING__(f);
+	    } else {
+		if (__INST(readAhead) != nil) {
+		    RETURN (false);
+		}
+	    }
+
+	    /*
+	     * read ahead ...
+	     */
+	    do {
 #ifdef WIN32
 # if 1
-                __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
+		__READBYTE__(ret, f, &c, _buffered, __INST(handleType));
 
 # else
-                __BEGIN_INTERRUPTABLE__
-                __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
-                __END_INTERRUPTABLE__
+		__BEGIN_INTERRUPTABLE__
+		__READBYTE__(ret, f, &c, _buffered, __INST(handleType));
+		__END_INTERRUPTABLE__
 # endif
 #else /* not WIN32 */
-                __BEGIN_INTERRUPTABLE__
-                __READBYTE__(ret, f, &c, _buffered, __INST(handleType));
-                __END_INTERRUPTABLE__
+		__BEGIN_INTERRUPTABLE__
+		__READBYTE__(ret, f, &c, _buffered, __INST(handleType));
+		__END_INTERRUPTABLE__
 #endif
-            } while ((ret < 0) && (__threadErrno == EINTR));
+	    } while ((ret < 0) && (__threadErrno == EINTR));
 
 #if defined(WIN32) && defined(EPIPE)
-            if (ret < 0) {
-                if (__threadErrno == EPIPE) {
-                    ret = 0;
-                    __threadErrno = 0;
-                }
-                if (__threadErrno == 0) {
-                    ret = 0;   /* how comes ? */
-                }
-            }
+	    if (ret < 0) {
+		if (__threadErrno == EPIPE) {
+		    ret = 0;
+		    __threadErrno = 0;
+		}
+		if (__threadErrno == 0) {
+		    ret = 0;   /* how comes ? */
+		}
+	    }
 #endif
-            if (ret > 0) {
-                __UNGETC__(c&0xff, f, _buffered);
-                RETURN (false);
-            }
-
-            if (ret == 0) {
-                __INST(hitEOF) = true;
-                RETURN (true);
-            }
-
-            /* ret < 0 */
-            __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
-        }
+	    if (ret > 0) {
+		__UNGETC__(c&0xff, f, _buffered);
+		RETURN (false);
+	    }
+
+	    if (ret == 0) {
+		__INST(hitEOF) = true;
+		RETURN (true);
+	    }
+
+	    /* ret < 0 */
+	    __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
+	}
     }
 %}.
     lastErrorNumber notNil ifTrue:[^ self readError].
@@ -5221,7 +5418,7 @@
 
     "/ migration support
     ^ self
-        atEndFile:handle
+	atEndFile:handle
 
     "Modified: / 30.10.1998 / 20:16:06 / cg"
 !
@@ -5334,19 +5531,19 @@
     wasBlocked := OperatingSystem blockInterrupts.
     inputSema := Semaphore new name:'readWait'.
     [
-        timeout notNil ifTrue:[
-            Processor signal:inputSema afterMilliseconds:timeout.
-        ].
-        Processor signal:inputSema onInput:fd.
-        Processor activeProcess state:#ioWait.
-        inputSema wait.
-        hasTimedout := timeout notNil and:[(OperatingSystem readCheck:fd) not].
+	timeout notNil ifTrue:[
+	    Processor signal:inputSema afterMilliseconds:timeout.
+	].
+	Processor signal:inputSema onInput:fd.
+	Processor activeProcess state:#ioWait.
+	inputSema wait.
+	hasTimedout := timeout notNil and:[(OperatingSystem readCheck:fd) not].
     ] ifCurtailed:[
-        Processor disableSemaphore:inputSema.
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	Processor disableSemaphore:inputSema.
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ].
     timeout notNil ifTrue:[
-        Processor disableSemaphore:inputSema.
+	Processor disableSemaphore:inputSema.
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ^ hasTimedout
@@ -5362,7 +5559,7 @@
     |fd sema hasTimedout wasBlocked|
 
     handle isNil ifTrue:[
-        ^ self errorNotOpen
+	^ self errorNotOpen
     ].
 
     fd := self fileDescriptor.
@@ -5371,20 +5568,20 @@
     wasBlocked := OperatingSystem blockInterrupts.
     sema := Semaphore new name:'readWriteWait'.
     [
-        timeout notNil ifTrue:[
-            Processor signal:sema afterMilliseconds:timeout
-        ].
-        Processor signal:sema onOutput:fd.
-        Processor signal:sema onInput:fd.
-        Processor activeProcess state:#ioWait.
-        sema wait.
-        hasTimedout := timeout notNil and:[(OperatingSystem readWriteCheck:fd) not].
+	timeout notNil ifTrue:[
+	    Processor signal:sema afterMilliseconds:timeout
+	].
+	Processor signal:sema onOutput:fd.
+	Processor signal:sema onInput:fd.
+	Processor activeProcess state:#ioWait.
+	sema wait.
+	hasTimedout := timeout notNil and:[(OperatingSystem readWriteCheck:fd) not].
     ] ifCurtailed:[
-        Processor disableSemaphore:sema.
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	Processor disableSemaphore:sema.
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ].
     timeout notNil ifTrue:[
-        Processor disableSemaphore:sema.
+	Processor disableSemaphore:sema.
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ^ hasTimedout
@@ -5400,10 +5597,10 @@
     |fd outputSema hasTimedout wasBlocked|
 
     handle isNil ifTrue:[
-        ^ self errorNotOpen
+	^ self errorNotOpen
     ].
     mode == #readonly ifTrue:[
-        ^ self errorReadOnly
+	^ self errorReadOnly
     ].
 
     fd := self fileDescriptor.
@@ -5412,19 +5609,19 @@
     wasBlocked := OperatingSystem blockInterrupts.
     outputSema := Semaphore new name:'writeWait'.
     [
-        timeout notNil ifTrue:[
-            Processor signal:outputSema afterMilliseconds:timeout
-        ].
-        Processor signal:outputSema onOutput:fd.
-        Processor activeProcess state:#ioWait.
-        outputSema wait.
-        hasTimedout := timeout notNil and:[(OperatingSystem writeCheck:fd) not].
+	timeout notNil ifTrue:[
+	    Processor signal:outputSema afterMilliseconds:timeout
+	].
+	Processor signal:outputSema onOutput:fd.
+	Processor activeProcess state:#ioWait.
+	outputSema wait.
+	hasTimedout := timeout notNil and:[(OperatingSystem writeCheck:fd) not].
     ] ifCurtailed:[
-        Processor disableSemaphore:outputSema.
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+	Processor disableSemaphore:outputSema.
+	wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ].
     timeout notNil ifTrue:[
-        Processor disableSemaphore:outputSema.
+	Processor disableSemaphore:outputSema.
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ^ hasTimedout
@@ -5447,48 +5644,48 @@
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        __INST(lastErrorNumber) = nil;
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-            && (__INST(binary) != true)
-        ) {
-            f = __FILEVal(fp);
-
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
-            {
-                OBJ mode = __INST(eolMode);
-
-                if (mode == @symbol(cr)) {
-                    cp = "\r"; len = 1;
-                } else if (mode == @symbol(crlf)) {
-                    cp = "\r\n"; len = 2;
-                } else {
-                    cp = "\n"; len = 1;
-                }
-            }
+	__INST(lastErrorNumber) = nil;
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	    && (__INST(binary) != true)
+	) {
+	    f = __FILEVal(fp);
+
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
+	    {
+		OBJ mode = __INST(eolMode);
+
+		if (mode == @symbol(cr)) {
+		    cp = "\r"; len = 1;
+		} else if (mode == @symbol(crlf)) {
+		    cp = "\r\n"; len = 2;
+		} else {
+		    cp = "\n"; len = 1;
+		}
+	    }
 #ifdef WIN32
-            if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                cnt = __win32_fwrite(cp, 1, len, f);
-            } else
+	    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+		cnt = __win32_fwrite(cp, 1, len, f);
+	    } else
 #endif
-            {
-                __WRITEBYTES__(cnt, f, cp, len, _buffered, __INST(handleType));
-            }
-            if (cnt == len) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + len;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e: dont know */
-                }
-                RETURN ( self );
-            }
-            __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
-        }
+	    {
+		__WRITEBYTES__(cnt, f, cp, len, _buffered, __INST(handleType));
+	    }
+	    if (cnt == len) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + len;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e: dont know */
+		}
+		RETURN ( self );
+	    }
+	    __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
+	}
     }
 %}.
     lastErrorNumber notNil ifTrue:[self writeError. ^ self].
@@ -5559,78 +5756,78 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-        ) {
-            if (__INST(binary) != true) {
-                if (__isCharacter(aCharacter)) {
-                    codePoint = __intVal(__characterVal(aCharacter));
-                    if (codePoint <= 0xFF) {
-                        c = codePoint;
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	) {
+	    if (__INST(binary) != true) {
+		if (__isCharacter(aCharacter)) {
+		    codePoint = __intVal(__characterVal(aCharacter));
+		    if (codePoint <= 0xFF) {
+			c = codePoint;
     doWrite:
-                        f = __FILEVal(fp);
-                        if (! f) {
-                            fprintf(stderr, "oops - fileHandle is NULL in nextPut:\n");
-                            __INST(handle) = nil;
-                            goto out;
-                        }
-
-                        if (_buffered = (__INST(buffered) == true)) {
-                            __WRITING__(f)
-                        }
+			f = __FILEVal(fp);
+			if (! f) {
+			    fprintf(stderr, "oops - fileHandle is NULL in nextPut:\n");
+			    __INST(handle) = nil;
+			    goto out;
+			}
+
+			if (_buffered = (__INST(buffered) == true)) {
+			    __WRITING__(f)
+			}
 #ifdef WIN32
-                        if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                            cnt = __win32_fwrite(&c, 1, 1, f);
-                        } else
+			if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+			    cnt = __win32_fwrite(&c, 1, 1, f);
+			} else
 #endif
-                        __WRITEBYTE__(cnt, f, &c, _buffered, __INST(handleType));
-                        if (cnt == 1) {
-                            if (__isSmallInteger(__INST(position))) {
-                                INT np = __intVal(__INST(position)) + 1;
-                                OBJ t;
-
-                                t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                            } else {
-                                __INST(position) = nil; /* i.e. do not know */
-                            }
-                            RETURN ( self );
-                        }
-                        error = __mkSmallInteger(__threadErrno);
-                    }
-                }
-            } else {
-                if (__isSmallInteger(aCharacter)) {
-                    c = __intVal(aCharacter);
-                    goto doWrite;
-                }
-            }
-        }
+			__WRITEBYTE__(cnt, f, &c, _buffered, __INST(handleType));
+			if (cnt == 1) {
+			    if (__isSmallInteger(__INST(position))) {
+				INT np = __intVal(__INST(position)) + 1;
+				OBJ t;
+
+				t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+			    } else {
+				__INST(position) = nil; /* i.e. do not know */
+			    }
+			    RETURN ( self );
+			}
+			error = __mkSmallInteger(__threadErrno);
+		    }
+		}
+	    } else {
+		if (__isSmallInteger(aCharacter)) {
+		    c = __intVal(aCharacter);
+		    goto doWrite;
+		}
+	    }
+	}
     }
 out: ;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
     handle isNil ifTrue:[self errorNotOpen. ^ self].
     (mode == #readonly) ifTrue:[self errorReadOnly. ^ self].
     binary == true ifFalse:[
-        (aCharacter isCharacter not
-        or:[aCharacter codePoint > 16rFF]) ifTrue:[
-            self argumentMustBeCharacter.
-            ^ self.
-        ].
+	(aCharacter isCharacter not
+	or:[aCharacter codePoint > 16rFF]) ifTrue:[
+	    self argumentMustBeCharacter.
+	    ^ self.
+	].
     ] ifTrue:[
-        aCharacter isInteger ifFalse:[
-            self argumentMustBeInteger.
-            ^ self.
-        ].
+	aCharacter isInteger ifFalse:[
+	    self argumentMustBeInteger.
+	    ^ self.
+	].
     ].
     "/ migration support
     self
-        nextPutByte:aCharacter asInteger
-        toFile:handle
+	nextPutByte:aCharacter asInteger
+	toFile:handle
 !
 
 nextPutAll:aCollection
@@ -5653,76 +5850,76 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-        ) {
-            f = __FILEVal(fp);
-            if (! f) {
-                fprintf(stderr, "oops - fileHandle is NULL in nextPutAll:\n");
-                __INST(handle) = nil;
-                goto out;
-            }
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
-
-            if (__isStringLike(aCollection)) {
-                len = __stringSize(aCollection);
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	) {
+	    f = __FILEVal(fp);
+	    if (! f) {
+		fprintf(stderr, "oops - fileHandle is NULL in nextPutAll:\n");
+		__INST(handle) = nil;
+		goto out;
+	    }
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
+
+	    if (__isStringLike(aCollection)) {
+		len = __stringSize(aCollection);
 #ifdef WIN32
-                if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                    cnt = __win32_fwrite(__stringVal(aCollection), 1, len, f);
-                } else
+		if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+		    cnt = __win32_fwrite(__stringVal(aCollection), 1, len, f);
+		} else
 #endif
-                {
-                    o_offs = (char *)__stringVal(aCollection)-(char *)__InstPtr(aCollection);
-                    __WRITEBYTES_OBJ__(cnt, f, aCollection, o_offs, len, _buffered, __INST(handleType));
-                }
-            } else {
-                if (__INST(binary) == true) {
-                    INT offs;
-
-                    if (__isByteArrayLike(aCollection)) {
-                        offs = 0;
-                        len = __byteArraySize(aCollection);
-                    } else if (__isBytes(aCollection)) {
-                        offs = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(aCollection))->c_ninstvars));
-                        len = __byteArraySize(aCollection) - offs;
-                    } else
-                        goto out;
+		{
+		    o_offs = (char *)__stringVal(aCollection)-(char *)__InstPtr(aCollection);
+		    __WRITEBYTES_OBJ__(cnt, f, aCollection, o_offs, len, _buffered, __INST(handleType));
+		}
+	    } else {
+		if (__INST(binary) == true) {
+		    INT offs;
+
+		    if (__isByteArrayLike(aCollection)) {
+			offs = 0;
+			len = __byteArraySize(aCollection);
+		    } else if (__isBytes(aCollection)) {
+			offs = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(aCollection))->c_ninstvars));
+			len = __byteArraySize(aCollection) - offs;
+		    } else
+			goto out;
 #ifdef WIN32
-                    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                        cnt = __win32_fwrite(__stringVal(aCollection), 1, len, f);
-                    } else
+		    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+			cnt = __win32_fwrite(__stringVal(aCollection), 1, len, f);
+		    } else
 #endif
-                    {
-                        o_offs = (char *)(__ByteArrayInstPtr(aCollection)->ba_element) - (char *)__InstPtr(aCollection);
-                        o_offs += offs;
-                        __WRITEBYTES_OBJ__(cnt, f, aCollection, o_offs, len, _buffered, __INST(handleType));
-                    }
-                } else
-                    goto out;
-            }
-
-            if (cnt == len) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + len;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                RETURN (self);
-            }
-            error = __mkSmallInteger(__threadErrno);
-        }
+		    {
+			o_offs = (char *)(__ByteArrayInstPtr(aCollection)->ba_element) - (char *)__InstPtr(aCollection);
+			o_offs += offs;
+			__WRITEBYTES_OBJ__(cnt, f, aCollection, o_offs, len, _buffered, __INST(handleType));
+		    }
+		} else
+		    goto out;
+	    }
+
+	    if (cnt == len) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + len;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		RETURN (self);
+	    }
+	    error = __mkSmallInteger(__threadErrno);
+	}
     }
 out: ;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
     handle isNil ifTrue:[self errorNotOpen. ^ self].
     (mode == #readonly) ifTrue:[self errorReadOnly. ^ self].
@@ -5749,88 +5946,88 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-        if (((fp = __INST(handle)) != nil)
-            && (__INST(mode) != @symbol(readonly))
-            && __bothSmallInteger(start, stop)
-        ) {
-            f = __FILEVal(fp);
-            if (_buffered = (__INST(buffered) == true)) {
-                __WRITING__(f)
-            }
-            iStart = __intVal(start);
-            iStop = __intVal(stop);
-            if ((iStart < 1) || (iStop < iStart)) {
-                RETURN(self);
-            }
-            if (__isStringLike(aCollection)) {
-                len = __stringSize(aCollection);
-                if (iStop > len) {
-                    RETURN(self);
-                }
-                if (iStop > len)
-                    iStop = len;
-                len = iStop - iStart + 1;
+	if (((fp = __INST(handle)) != nil)
+	    && (__INST(mode) != @symbol(readonly))
+	    && __bothSmallInteger(start, stop)
+	) {
+	    f = __FILEVal(fp);
+	    if (_buffered = (__INST(buffered) == true)) {
+		__WRITING__(f)
+	    }
+	    iStart = __intVal(start);
+	    iStop = __intVal(stop);
+	    if ((iStart < 1) || (iStop < iStart)) {
+		RETURN(self);
+	    }
+	    if (__isStringLike(aCollection)) {
+		len = __stringSize(aCollection);
+		if (iStop > len) {
+		    RETURN(self);
+		}
+		if (iStop > len)
+		    iStop = len;
+		len = iStop - iStart + 1;
 #ifdef WIN32
-                if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                    cnt = __win32_fwrite(__stringVal(aCollection)+iStart-1, 1, len, f);
-                } else
+		if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+		    cnt = __win32_fwrite(__stringVal(aCollection)+iStart-1, 1, len, f);
+		} else
 #endif
-                {
-                    o_offs = (char *)__stringVal(aCollection)-(char *)__InstPtr(aCollection);
-                    __WRITEBYTES_OBJ__(cnt, f, aCollection, o_offs+iStart-1, len, _buffered, __INST(handleType));
-                }
-            } else {
-                if (__INST(binary) == true) {
-                    int offs;
-
-                    if (__isByteArrayLike(aCollection)) {
-                        offs = 0;
-                        len = __byteArraySize(aCollection);
-                    } else if (__isBytes(aCollection)) {
-                        offs = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(aCollection))->c_ninstvars));
-                        len = __byteArraySize(aCollection) - offs;
-                    } else
-                        goto out;
-
-                    if (iStop > len) {
-                        RETURN(self);
-                    }
-                    if (iStop > len)
-                        iStop = len;
-                    len = iStop - iStart + 1;
-                    offs += iStart - 1;
+		{
+		    o_offs = (char *)__stringVal(aCollection)-(char *)__InstPtr(aCollection);
+		    __WRITEBYTES_OBJ__(cnt, f, aCollection, o_offs+iStart-1, len, _buffered, __INST(handleType));
+		}
+	    } else {
+		if (__INST(binary) == true) {
+		    int offs;
+
+		    if (__isByteArrayLike(aCollection)) {
+			offs = 0;
+			len = __byteArraySize(aCollection);
+		    } else if (__isBytes(aCollection)) {
+			offs = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(aCollection))->c_ninstvars));
+			len = __byteArraySize(aCollection) - offs;
+		    } else
+			goto out;
+
+		    if (iStop > len) {
+			RETURN(self);
+		    }
+		    if (iStop > len)
+			iStop = len;
+		    len = iStop - iStart + 1;
+		    offs += iStart - 1;
 #ifdef WIN32
-                    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
-                        cnt = __win32_fwrite(__stringVal(aCollection)+iStart-1, 1, len, f);
-                    } else
+		    if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+			cnt = __win32_fwrite(__stringVal(aCollection)+iStart-1, 1, len, f);
+		    } else
 #endif
-                    {
-                        o_offs = (char *)(__ByteArrayInstPtr(aCollection)->ba_element)-(char *)__InstPtr(aCollection);
-                        __WRITEBYTES_OBJ__(cnt, f,  aCollection, o_offs+offs, len, _buffered, __INST(handleType));
-                    }
-                } else
-                    goto out;
-            }
-            if (cnt == len) {
-                if (__isSmallInteger(__INST(position))) {
-                    INT np = __intVal(__INST(position)) + len;
-                    OBJ t;
-
-                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-                } else {
-                    __INST(position) = nil; /* i.e. do not know */
-                }
-                RETURN (self);
-            }
-            error = __mkSmallInteger(__threadErrno);
-        }
+		    {
+			o_offs = (char *)(__ByteArrayInstPtr(aCollection)->ba_element)-(char *)__InstPtr(aCollection);
+			__WRITEBYTES_OBJ__(cnt, f,  aCollection, o_offs+offs, len, _buffered, __INST(handleType));
+		    }
+		} else
+		    goto out;
+	    }
+	    if (cnt == len) {
+		if (__isSmallInteger(__INST(position))) {
+		    INT np = __intVal(__INST(position)) + len;
+		    OBJ t;
+
+		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+		} else {
+		    __INST(position) = nil; /* i.e. do not know */
+		}
+		RETURN (self);
+	    }
+	    error = __mkSmallInteger(__threadErrno);
+	}
     }
 out: ;
 %}.
     error notNil ifTrue:[
-        lastErrorNumber := error.
-        self writeError:error.
-        ^ self
+	lastErrorNumber := error.
+	self writeError:error.
+	^ self
     ].
     ^ super nextPutAll:aCollection startingAt:start to:stop
 !
@@ -5890,11 +6087,11 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.390 2014-05-27 05:31:58 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.391 2014-06-02 11:24:26 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.390 2014-05-27 05:31:58 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.391 2014-06-02 11:24:26 cg Exp $'
 ! !