FileStream.st
changeset 7051 984d8271d06b
parent 6798 cc084e7ecc88
child 7053 13e04c48e23c
--- a/FileStream.st	Mon Feb 24 18:01:32 2003 +0100
+++ b/FileStream.st	Tue Feb 25 10:05:53 2003 +0100
@@ -697,9 +697,9 @@
 
 	if (currentPosition >= 0) {
 	    /*
-	     * notice: Smalltalk index starts at 1
+	     * notice: Smalltalk index starts at ZeroPosition
 	     */
-	    RETURN ( __MKSMALLINT(currentPosition + 1) );
+	    RETURN ( __MKSMALLINT(currentPosition + __intVal( @global(PositionableStream:ZeroPosition) )) );
 	}
 	__INST(lastErrorNumber) = __MKSMALLINT(__threadErrno);
     }
@@ -728,9 +728,9 @@
 		nP = (long)__intVal(newPos);
 
 		/*
-		 * notice: Smalltalk index starts at 1
+		 * notice: Smalltalk index starts at ZeroPosition
 		 */
-		nP--;
+		nP = nP - __intVal( @global(PositionableStream:ZeroPosition));
 
 		do {
 #ifdef WIN32
@@ -793,7 +793,7 @@
 
     if (__INST(filePointer) != nil) {
 	f = __FILEVal(__INST(filePointer));
-	__INST(position) = nil;
+	__INST(position) = nil;    /* i.e. unknown */
 	do {
 #ifdef WIN32
 	    __threadErrno = 0;
@@ -871,7 +871,7 @@
 
     aStream nextPutAll:'(FileStream oldFileNamed:'.
     aStream nextPutAll:pathName storeString.
-    (self position ~~ 1) ifTrue:[
+    (self position ~~ ZeroPosition) ifTrue:[
 	aStream nextPutAll:'; position:'.
 	self position storeOn:aStream
     ].
@@ -1145,7 +1145,7 @@
 	    }
 
 	    filePointer = __MKOBJ((INT)f); 
-	    __INST(position) = __MKSMALLINT(1);
+	    __INST(position) = @global(PositionableStream:ZeroPosition);
 	}
     }
 %}.
@@ -1226,7 +1226,7 @@
 	"
 	^ self openError
     ].
-    position := 1.
+    position := ZeroPosition.
     buffered := true.       "default is buffered"
     Lobby register:self.
 !
@@ -1345,8 +1345,6 @@
     "for migration to rel5 only"
 
     self primitiveFailed
-
-
 ! !
 
 !FileStream methodsFor:'testing'!
@@ -1361,7 +1359,7 @@
 !FileStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.88 2002-10-14 09:19:45 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.89 2003-02-25 09:05:53 cg Exp $'
 ! !
 
 FileStream initialize!