*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 14 Jan 1997 12:49:01 +0100
changeset 2161 0472a226a714
parent 2160 ae0c0525ff2d
child 2162 7e1601f633b6
*** empty log message ***
FileStr.st
FileStream.st
--- a/FileStr.st	Mon Jan 13 17:27:03 1997 +0100
+++ b/FileStr.st	Tue Jan 14 12:49:01 1997 +0100
@@ -86,10 +86,10 @@
     For best results, open files either readonly or writeonly.
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [see also:]
-        Filename DirectoryStream PipeStream Socket
+	Filename DirectoryStream PipeStream Socket
 "
 ! !
 
@@ -432,51 +432,50 @@
 retry:
     path = __INST(pathName);
     if (__isNonNilObject(path) && (__qClass(path)==String)) {
-        __BEGIN_INTERRUPTABLE__
-        do {
+	__BEGIN_INTERRUPTABLE__
+	do {
 #ifdef LINUX
-            /* LINUX returns a non-NULL f even when interrupted */
-            errno = 0;
-            f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
-            if (errno == EINTR)
-                f = NULL;
+	    /* LINUX returns a non-NULL f even when interrupted */
+	    errno = 0;
+	    f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
+	    if (errno == EINTR)
+		f = NULL;
 #else
 
-            f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
+	    f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
 #endif
-        } while ((f == NULL) && (errno == EINTR));
-        __END_INTERRUPTABLE__
-        if (f == NULL) {
-            /*
-             * If no filedescriptors available, try to finalize
-             * possibly collected fd's and try again.
-             */
+	} while ((f == NULL) && (errno == EINTR));
+	__END_INTERRUPTABLE__
+	if (f == NULL) {
+	    /*
+	     * If no filedescriptors available, try to finalize
+	     * possibly collected fd's and try again.
+	     */
 
-            if (pass == 0 && (errno == ENFILE || errno == EMFILE)) {
-                pass = 1;
-%}.
-                ObjectMemory scavenge; finalize.
-%{
-                goto retry;
-            }
-            __INST(lastErrorNumber) = __MKSMALLINT(errno);
-            __INST(position) = nil;
-        } else {
-            __INST(filePointer) = fp = __MKOBJ((int)f); __STORE(self, fp);
-            __INST(position) = __MKSMALLINT(1);
-            retVal = self;
-        }
+	    if (pass == 0 && (errno == ENFILE || errno == EMFILE)) {
+		pass = 1;
+		__SSEND0(@global(ObjectMemory), @symbol(scavenge), 0);
+		__SSEND0(@global(ObjectMemory), @symbol(finalize), 0);
+		goto retry;
+	    }
+	    __INST(lastErrorNumber) = __MKSMALLINT(errno);
+	    __INST(position) = nil;
+	} else {
+	    __INST(filePointer) = fp = __MKOBJ((int)f); __STORE(self, fp);
+	    __INST(position) = __MKSMALLINT(1);
+	    retVal = self;
+	}
     }
 %}.
     retVal notNil ifTrue:[
-        buffered := true.       "default is buffered"
-        Lobby register:self.
-        ^ retVal
+	buffered := true.       "default is buffered"
+	Lobby register:self.
+	^ retVal
     ] ifFalse:[
-        "
-         the open failed for some reason ...
-        "
-        ^ self openError
+	"
+	 the open failed for some reason ...
+	"
+	^ self openError
     ].
 
 !
@@ -508,18 +507,18 @@
     |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 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 accessable ..."
 
-            (self class name , ' [warning]: could not reOpen file: ', pathName) errorPrintCR.
-        ] ifFalse:[
-            self position:oldPos.
-        ]
+	    (self class name , ' [warning]: could not reOpen file: ', pathName) errorPrintCR.
+	] ifFalse:[
+	    self position:oldPos.
+	]
     ]
 
     "Modified: 10.1.1997 / 17:50:51 / cg"
@@ -686,5 +685,5 @@
 !FileStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/FileStr.st,v 1.35 1997-01-10 18:00:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/FileStr.st,v 1.36 1997-01-14 11:49:01 cg Exp $'
 ! !
--- a/FileStream.st	Mon Jan 13 17:27:03 1997 +0100
+++ b/FileStream.st	Tue Jan 14 12:49:01 1997 +0100
@@ -86,10 +86,10 @@
     For best results, open files either readonly or writeonly.
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [see also:]
-        Filename DirectoryStream PipeStream Socket
+	Filename DirectoryStream PipeStream Socket
 "
 ! !
 
@@ -432,51 +432,50 @@
 retry:
     path = __INST(pathName);
     if (__isNonNilObject(path) && (__qClass(path)==String)) {
-        __BEGIN_INTERRUPTABLE__
-        do {
+	__BEGIN_INTERRUPTABLE__
+	do {
 #ifdef LINUX
-            /* LINUX returns a non-NULL f even when interrupted */
-            errno = 0;
-            f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
-            if (errno == EINTR)
-                f = NULL;
+	    /* LINUX returns a non-NULL f even when interrupted */
+	    errno = 0;
+	    f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
+	    if (errno == EINTR)
+		f = NULL;
 #else
 
-            f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
+	    f = (FILE *) fopen((char *) __stringVal(path), (char *) __stringVal(openmode));
 #endif
-        } while ((f == NULL) && (errno == EINTR));
-        __END_INTERRUPTABLE__
-        if (f == NULL) {
-            /*
-             * If no filedescriptors available, try to finalize
-             * possibly collected fd's and try again.
-             */
+	} while ((f == NULL) && (errno == EINTR));
+	__END_INTERRUPTABLE__
+	if (f == NULL) {
+	    /*
+	     * If no filedescriptors available, try to finalize
+	     * possibly collected fd's and try again.
+	     */
 
-            if (pass == 0 && (errno == ENFILE || errno == EMFILE)) {
-                pass = 1;
-%}.
-                ObjectMemory scavenge; finalize.
-%{
-                goto retry;
-            }
-            __INST(lastErrorNumber) = __MKSMALLINT(errno);
-            __INST(position) = nil;
-        } else {
-            __INST(filePointer) = fp = __MKOBJ((int)f); __STORE(self, fp);
-            __INST(position) = __MKSMALLINT(1);
-            retVal = self;
-        }
+	    if (pass == 0 && (errno == ENFILE || errno == EMFILE)) {
+		pass = 1;
+		__SSEND0(@global(ObjectMemory), @symbol(scavenge), 0);
+		__SSEND0(@global(ObjectMemory), @symbol(finalize), 0);
+		goto retry;
+	    }
+	    __INST(lastErrorNumber) = __MKSMALLINT(errno);
+	    __INST(position) = nil;
+	} else {
+	    __INST(filePointer) = fp = __MKOBJ((int)f); __STORE(self, fp);
+	    __INST(position) = __MKSMALLINT(1);
+	    retVal = self;
+	}
     }
 %}.
     retVal notNil ifTrue:[
-        buffered := true.       "default is buffered"
-        Lobby register:self.
-        ^ retVal
+	buffered := true.       "default is buffered"
+	Lobby register:self.
+	^ retVal
     ] ifFalse:[
-        "
-         the open failed for some reason ...
-        "
-        ^ self openError
+	"
+	 the open failed for some reason ...
+	"
+	^ self openError
     ].
 
 !
@@ -508,18 +507,18 @@
     |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 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 accessable ..."
 
-            (self class name , ' [warning]: could not reOpen file: ', pathName) errorPrintCR.
-        ] ifFalse:[
-            self position:oldPos.
-        ]
+	    (self class name , ' [warning]: could not reOpen file: ', pathName) errorPrintCR.
+	] ifFalse:[
+	    self position:oldPos.
+	]
     ]
 
     "Modified: 10.1.1997 / 17:50:51 / cg"
@@ -686,5 +685,5 @@
 !FileStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.35 1997-01-10 18:00:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.36 1997-01-14 11:49:01 cg Exp $'
 ! !