FileStream.st
changeset 7872 634e73a5cdd9
parent 7871 5c357f1ba0c9
child 7874 5e0319ca5e60
--- a/FileStream.st	Thu Feb 05 12:52:51 2004 +0100
+++ b/FileStream.st	Thu Feb 05 12:57:29 2004 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -13,10 +13,10 @@
 "{ Package: 'stx:libbasic' }"
 
 ExternalStream subclass:#FileStream
-        instanceVariableNames:'pathName canPosition removeOnClose'
-        classVariableNames:'UserInitiatedFileSaveQuerySignal'
-        poolDictionaries:''
-        category:'Streams-External'
+	instanceVariableNames:'pathName canPosition removeOnClose'
+	classVariableNames:'UserInitiatedFileSaveQuerySignal'
+	poolDictionaries:''
+	category:'Streams-External'
 !
 
 !FileStream primitiveDefinitions!
@@ -200,7 +200,7 @@
 copyright
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
-              All Rights Reserved
+	      All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -231,14 +231,14 @@
     I know, this is ugly, but what else could we do ?
 
     [instance variables:]
-        pathName        <String>        the files path (if known)
-        canPosition     <Boolean>       positionable - read above comment
+	pathName        <String>        the files path (if known)
+	canPosition     <Boolean>       positionable - read above comment
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [see also:]
-        Filename DirectoryStream PipeStream Socket
+	Filename DirectoryStream PipeStream Socket
 "
 !
 
@@ -253,11 +253,11 @@
     For example, to create a file with fixed records and recordLength of 100,
     use:
 
-        |newFile|
+	|newFile|
 
-        newFile := FileStream new pathName:'<nameOfFile>'.
-        newFile setMode:#writeonly.
-        newFile openWithMode:'w' attributes:#('rfm=fix' 'fsz=100').
+	newFile := FileStream new pathName:'<nameOfFile>'.
+	newFile setMode:#writeonly.
+	newFile openWithMode:'w' attributes:#('rfm=fix' 'fsz=100').
 
     since all of the above is private protocol, and it is considered bad style to
     access these from user programs, we recommend subclassing FileStream as
@@ -513,9 +513,9 @@
 
     s := self readOnlyFileNamed:filename.
     text ifTrue:[
-        s text
+	s text
     ] ifFalse:[
-        s binary
+	s binary
     ].
     ^ s
 !
@@ -544,11 +544,11 @@
 
     s := self newFileNamed:filename.
     s notNil ifTrue:[
-        textModeBoolean ifTrue:[
-            s text
-        ] ifFalse:[
-            s binary
-        ]
+	textModeBoolean ifTrue:[
+	    s text
+	] ifFalse:[
+	    s binary
+	]
     ].
     ^ s
 ! !
@@ -666,7 +666,7 @@
 
     super closeFile.
     removeOnClose == true ifTrue:[
-        pathName asFilename remove.
+	pathName asFilename remove.
     ]
 
     "Created: / 13.8.1998 / 12:11:22 / cg"
@@ -680,7 +680,7 @@
 %{
 
     HFILE f;
-    long currentPosition;
+    off_t currentPosition;
 
     if (__INST(filePointer) != nil) {
         do {
@@ -717,7 +717,14 @@
         } while ((currentPosition < 0) && (__threadErrno == EINTR));
 
         if (currentPosition >= 0) {
-            RETURN ( __MKINT(currentPosition) );
+            OBJ rslt;
+
+            if (sizeof(currentPosition) == 8) {
+                rslt = __MKINT64 (&currentPosition);
+            } else {
+                rslt = __MKINT(currentPosition);
+            }
+            RETURN ( rslt );
         }
         __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
     }
@@ -854,29 +861,29 @@
     long ret;
 
     if (__INST(filePointer) != nil) {
-        f = __FILEVal(__INST(filePointer));
-        __INST(position) = nil;    /* i.e. unknown */
-        do {
+	f = __FILEVal(__INST(filePointer));
+	__INST(position) = nil;    /* i.e. unknown */
+	do {
 #ifdef WIN32
-            __threadErrno = 0;
-            if (__INST(buffered) == true) {                                            
-                ret = STX_C_CALL3( "fseek", fseek, f, 0L, SEEK_END);    
-            } else {                                                   
-                __INST(readAhead) = nil;                           
-                ret = STX_C_CALL3( "lseek", lseek, fileno(f), 0L, SEEK_END);
-            }
+	    __threadErrno = 0;
+	    if (__INST(buffered) == true) {                                            
+		ret = STX_C_CALL3( "fseek", fseek, f, 0L, SEEK_END);    
+	    } else {                                                   
+		__INST(readAhead) = nil;                           
+		ret = STX_C_CALL3( "lseek", lseek, fileno(f), 0L, SEEK_END);
+	    }
 #else
-            if (__INST(buffered) == true) {
-                ret = fseek(f, 0L, SEEK_END);
-            } else {
-                ret = lseek(fileno(f), 0L, SEEK_END);
-            }
+	    if (__INST(buffered) == true) {
+		ret = fseek(f, 0L, SEEK_END);
+	    } else {
+		ret = lseek(fileno(f), 0L, SEEK_END);
+	    }
 #endif
-        } while ((ret < 0) && (__threadErrno == EINTR));
-        if (ret >= 0) {
-            RETURN ( self );
-        }
-        __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
+	} while ((ret < 0) && (__threadErrno == EINTR));
+	if (ret >= 0) {
+	    RETURN ( self );
+	}
+	__INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
     }
 %}.
     lastErrorNumber notNil ifTrue:[^ self ioError].
@@ -947,8 +954,8 @@
     aStream nextPutAll:'(FileStream oldFileNamed:'.
     aStream nextPutAll:pathName storeString.
     (self position ~~ ZeroPosition) ifTrue:[
-        aStream nextPutAll:'; position:'.
-        self position storeOn:aStream
+	aStream nextPutAll:'; position:'.
+	self position storeOn:aStream
     ].
     aStream nextPut:$)
 
@@ -979,12 +986,12 @@
 
     pathName isNil ifTrue:[^nil].
     (mode == #readonly) ifTrue: [
-        didWrite := false.
-        ^ self openWithMode:ReadMode
+	didWrite := false.
+	^ self openWithMode:ReadMode
     ].
     (mode == #writeonly) ifTrue: [
-        didWrite := true.
-        ^ self openWithMode:WriteMode
+	didWrite := true.
+	^ self openWithMode:WriteMode
     ].
     ^ self openWithMode:ReadWriteMode
 !
@@ -1015,213 +1022,213 @@
 retry:
     if (__isNonNilObject(pathName) && (__qClass(pathName)==String)) {
 #ifdef __VMS__
-        do {
-            /*
-             * allow passing additional RMS arguments.
-             * stupid: DEC does not seem to offer an interface for passing a char **.
-             */
-            __threadErrno = 0;
+	do {
+	    /*
+	     * allow passing additional RMS arguments.
+	     * stupid: DEC does not seem to offer an interface for passing a char **.
+	     */
+	    __threadErrno = 0;
 
-            {
-                if (__isArray(attributeSpec)) {
-                    OBJ *ap = __ArrayInstPtr(attributeSpec)->a_element;
-                    int numAttrib = 0;
-                    int i;
+	    {
+		if (__isArray(attributeSpec)) {
+		    OBJ *ap = __ArrayInstPtr(attributeSpec)->a_element;
+		    int numAttrib = 0;
+		    int i;
 
-                    numAttrib = __arraySize(attributeSpec);
-                    for (i=0; i<numAttrib;i++) {
-                        if (! __isString(ap[i])) {
-                            f = NULL;
-                            __threadErrno = EINVAL; /* invalid argument */
-                            goto getOutOfHere;
-                        }
-                    }
-                    switch (numAttrib) {
-                        case 0:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 1:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 2:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 3:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 4:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 5:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]), __stringVal(ap[4]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 6:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 7:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-                                      __stringVal(ap[6]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 8:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-                                      __stringVal(ap[6]), __stringVal(ap[7]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 9:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-                                      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        case 10:
-                            __BEGIN_INTERRUPTABLE__
-                            f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
-                                      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
-                                      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
-                                      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]),
-                                      __stringVal(ap[9]));
-                            __END_INTERRUPTABLE__
-                            break;
-                        default:
-                            f = NULL;
-                            __threadErrno = E2BIG; /* too many args */
-                            goto getOutOfHere;
-                    }
-                } else if (attributeSpec != nil) {
-                    f = NULL;
-                    __threadErrno = EINVAL; /* invalid argument */
-                    goto getOutOfHere;
-                } else {
-                    /*
-                     * create file as sequential streamLF by default.
-                     */
-                    __BEGIN_INTERRUPTABLE__
-                    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode), "rfm=stmlf");
-                    __END_INTERRUPTABLE__
-                }
-            }
-        } while ((f == NULL) && (__threadErrno == EINTR));
+		    numAttrib = __arraySize(attributeSpec);
+		    for (i=0; i<numAttrib;i++) {
+			if (! __isString(ap[i])) {
+			    f = NULL;
+			    __threadErrno = EINVAL; /* invalid argument */
+			    goto getOutOfHere;
+			}
+		    }
+		    switch (numAttrib) {
+			case 0:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 1:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 2:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 3:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 4:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 5:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]), __stringVal(ap[4]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 6:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 7:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+				      __stringVal(ap[6]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 8:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+				      __stringVal(ap[6]), __stringVal(ap[7]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 9:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+				      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]));
+			    __END_INTERRUPTABLE__
+			    break;
+			case 10:
+			    __BEGIN_INTERRUPTABLE__
+			    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode),
+				      __stringVal(ap[0]), __stringVal(ap[1]), __stringVal(ap[2]),
+				      __stringVal(ap[3]), __stringVal(ap[4]), __stringVal(ap[5]),
+				      __stringVal(ap[6]), __stringVal(ap[7]), __stringVal(ap[8]),
+				      __stringVal(ap[9]));
+			    __END_INTERRUPTABLE__
+			    break;
+			default:
+			    f = NULL;
+			    __threadErrno = E2BIG; /* too many args */
+			    goto getOutOfHere;
+		    }
+		} else if (attributeSpec != nil) {
+		    f = NULL;
+		    __threadErrno = EINVAL; /* invalid argument */
+		    goto getOutOfHere;
+		} else {
+		    /*
+		     * create file as sequential streamLF by default.
+		     */
+		    __BEGIN_INTERRUPTABLE__
+		    f = fopen((char *)__stringVal(pathName), (char *)__stringVal(openmode), "rfm=stmlf");
+		    __END_INTERRUPTABLE__
+		}
+	    }
+	} while ((f == NULL) && (__threadErrno == EINTR));
 
 #else /* not VMS */
 
 # ifdef WIN32
 
-        do {
-            __threadErrno = 0;
-            f = STX_C_CALL2( "fopen", fopen, (char *)__stringVal(pathName), (char *)__stringVal(openmode));
-            if (__threadErrno == EINTR) {
-                f = NULL;
-            }
-        } while ((f == NULL) && (__threadErrno == EINTR));
+	do {
+	    __threadErrno = 0;
+	    f = STX_C_CALL2( "fopen", fopen, (char *)__stringVal(pathName), (char *)__stringVal(openmode));
+	    if (__threadErrno == EINTR) {
+		f = NULL;
+	    }
+	} while ((f == NULL) && (__threadErrno == EINTR));
 
 # else /* not WIN32 */
 
-        do {
-            __BEGIN_INTERRUPTABLE__
+	do {
+	    __BEGIN_INTERRUPTABLE__
 #  ifdef LINUX
-            /* 
-             * LINUX may ret a non-NULL f even when interrupted.
-             * Therefore, check errno and fake a null-ret.
-             */
-            __threadErrno = 0;
-            f = fopen((char *) __stringVal(pathName), (char *) __stringVal(openmode));
-            if (__threadErrno == EINTR)
-                f = NULL;
+	    /* 
+	     * LINUX may ret a non-NULL f even when interrupted.
+	     * Therefore, check errno and fake a null-ret.
+	     */
+	    __threadErrno = 0;
+	    f = fopen((char *) __stringVal(pathName), (char *) __stringVal(openmode));
+	    if (__threadErrno == EINTR)
+		f = NULL;
 #  else /* not LINUX */
-            f = fopen((char *) __stringVal(pathName), (char *) __stringVal(openmode));
+	    f = fopen((char *) __stringVal(pathName), (char *) __stringVal(openmode));
 #  endif /* not LINUX */
-            __END_INTERRUPTABLE__
-        } while ((f == NULL) && (__threadErrno == EINTR));
+	    __END_INTERRUPTABLE__
+	} while ((f == NULL) && (__threadErrno == EINTR));
 
 # endif /* not WIN32 */
 #endif /* not VMS */
 
-        if (f == NULL) {
-            /*
-             * If no filedescriptors available, try to finalize
-             * possibly collected fd's and try again.
-             */
-            if (pass == 0 && (__threadErrno == ENFILE || __threadErrno == EMFILE)) {
-                pass = 1;
-                __SSEND0(@global(ObjectMemory), @symbol(scavenge), 0);
-                __SSEND0(@global(ObjectMemory), @symbol(finalize), 0);
-                goto retry;
-            }
-        getOutOfHere: ;
-            __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
-            __INST(position) = nil;
-        } else {
+	if (f == NULL) {
+	    /*
+	     * If no filedescriptors available, try to finalize
+	     * possibly collected fd's and try again.
+	     */
+	    if (pass == 0 && (__threadErrno == ENFILE || __threadErrno == EMFILE)) {
+		pass = 1;
+		__SSEND0(@global(ObjectMemory), @symbol(scavenge), 0);
+		__SSEND0(@global(ObjectMemory), @symbol(finalize), 0);
+		goto retry;
+	    }
+	getOutOfHere: ;
+	    __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
+	    __INST(position) = nil;
+	} else {
 #ifdef __VMS__
-            /*
-             * check to see if this is positionable ...
-             */
-            __INST(canPosition) = false;
+	    /*
+	     * check to see if this is positionable ...
+	     */
+	    __INST(canPosition) = false;
 # ifndef _POSIX_C_SOURCE
-            {
-                struct stat statBuffer;
+	    {
+		struct stat statBuffer;
 
-                if (fstat(fileno(f), &statBuffer) >= 0) {
-                    switch (statBuffer.st_fab_rfm) {
-                        case FAB$C_UDF: /* undefined (also stream binary)   */
-                        case FAB$C_VAR: /* variable length records          */
-                        case FAB$C_VFC: /* variable fixed control           */
-                        case FAB$C_STM: /* RMS-11 stream (valid only for sequen> */
-                        default:
-                            __INST(canPosition) = false;
-                            break;
+		if (fstat(fileno(f), &statBuffer) >= 0) {
+		    switch (statBuffer.st_fab_rfm) {
+			case FAB$C_UDF: /* undefined (also stream binary)   */
+			case FAB$C_VAR: /* variable length records          */
+			case FAB$C_VFC: /* variable fixed control           */
+			case FAB$C_STM: /* RMS-11 stream (valid only for sequen> */
+			default:
+			    __INST(canPosition) = false;
+			    break;
 
-                        case FAB$C_FIX: /* fixed length records             */
-                        case FAB$C_STMLF: /* LF stream (valid only for sequential> */
-                        case FAB$C_STMCR: /* CR stream (valid only for sequential> */
-                            __INST(canPosition) = true;
-                            break;
-                    }
-                }
-            }
+			case FAB$C_FIX: /* fixed length records             */
+			case FAB$C_STMLF: /* LF stream (valid only for sequential> */
+			case FAB$C_STMCR: /* CR stream (valid only for sequential> */
+			    __INST(canPosition) = true;
+			    break;
+		    }
+		}
+	    }
 # endif 
 #else /* not VMS */
-            __INST(canPosition) = true;
+	    __INST(canPosition) = true;
 #endif /* poor VMS */
 
-            if (@global(FileOpenTrace) == true) {
-                fprintf(stderr, "fopen %s [FileStream] -> %x\n", __stringVal(pathName), f);
-            }
+	    if (@global(FileOpenTrace) == true) {
+		fprintf(stderr, "fopen %s [FileStream] -> %x\n", __stringVal(pathName), f);
+	    }
 
-            filePointer = __MKOBJ((INT)f); 
-            __INST(position) = @global(PositionableStream:ZeroPosition);
-        }
+	    filePointer = __MKOBJ((INT)f); 
+	    __INST(position) = @global(PositionableStream:ZeroPosition);
+	}
     }
 %}.
     ^ filePointer
@@ -1296,10 +1303,10 @@
 
     filePointer := self openFile:pathName withMode:openmode attributes:attributeSpec.
     filePointer isNil ifTrue:[
-        "
-         the open failed for some reason ...
-        "
-        ^ self openError
+	"
+	 the open failed for some reason ...
+	"
+	^ self openError
     ].
     position := ZeroPosition.
     buffered := true.       "default is buffered"
@@ -1328,21 +1335,21 @@
     |oldPos|
 
     filePointer notNil ifTrue:[
-        "it was open, when snapped-out"
-        filePointer := nil.
-        Lobby unregister:self.
-        oldPos := position.
-        self open.
-        filePointer isNil ifTrue:[
-            "/ this happens, if after a restart, 
-            "/ the file is no longer present or accessable ..."
+	"it was open, when snapped-out"
+	filePointer := nil.
+	Lobby unregister:self.
+	oldPos := position.
+	self open.
+	filePointer isNil ifTrue:[
+	    "/ this happens, if after a restart, 
+	    "/ the file is no longer present or accessable ..."
 
-            (self class name , ' [warning]: could not reOpen file: ', pathName) errorPrintCR.
-        ] ifFalse:[
-            oldPos notNil ifTrue:[
-                self position:oldPos.
-            ]
-        ]
+	    (self class name , ' [warning]: could not reOpen file: ', pathName) errorPrintCR.
+	] ifFalse:[
+	    oldPos notNil ifTrue:[
+		self position:oldPos.
+	    ]
+	]
     ]
 
     "Modified: 10.1.1997 / 17:50:51 / cg"
@@ -1365,10 +1372,10 @@
     int size;
 
     if (__INST(filePointer) != nil) {
-        f = __FILEVal(__INST(filePointer));
-        if ((size = filesize(fileno(f))) >= 0) {
-            RETURN ( __MKSMALLINT(size) );
-        }
+	f = __FILEVal(__INST(filePointer));
+	if ((size = filesize(fileno(f))) >= 0) {
+	    RETURN ( __MKSMALLINT(size) );
+	}
     }
 #else
     struct stat buf;
@@ -1376,26 +1383,26 @@
     int fd;
 
     if (__INST(filePointer) != nil) {
-        f = __FILEVal(__INST(filePointer));
-        fd = fileno(f);
-        do {
-            ret = fstat(fd, &buf);
-        } while ((ret < 0) && (__threadErrno == EINTR));
-        if (ret >= 0) {
-            RETURN ( __MKSMALLINT( (int)(buf.st_size) ) );
-        }
-        __INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
+	f = __FILEVal(__INST(filePointer));
+	fd = fileno(f);
+	do {
+	    ret = fstat(fd, &buf);
+	} while ((ret < 0) && (__threadErrno == EINTR));
+	if (ret >= 0) {
+	    RETURN ( __MKSMALLINT( (int)(buf.st_size) ) );
+	}
+	__INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
     }
 #endif
 %}.
 
     "could add a fall-back here:
 
-        oldPosition := self position.
-        self setToEnd.
-        sz := self position.
-        self position:oldPosition.
-        ^ sz
+	oldPosition := self position.
+	self setToEnd.
+	sz := self position.
+	self position:oldPosition.
+	^ sz
     "
     lastErrorNumber notNil ifTrue:[^ self ioError].
     filePointer isNil ifTrue:[^ self errorNotOpen].
@@ -1434,7 +1441,7 @@
 !FileStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.99 2004-02-05 11:52:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.100 2004-02-05 11:57:29 cg Exp $'
 ! !
 
 FileStream initialize!