--- a/FileStream.st Wed Feb 15 12:29:34 1995 +0100
+++ b/FileStream.st Thu Feb 16 03:58:55 1995 +0100
@@ -12,7 +12,7 @@
ExternalStream subclass:#FileStream
instanceVariableNames:'pathName'
- classVariableNames:'OpenErrorSignal'
+ classVariableNames:''
poolDictionaries:''
category:'Streams-External'
!
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.19 1995-02-15 10:22:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.20 1995-02-16 02:58:34 claus Exp $
'!
!FileStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.19 1995-02-15 10:22:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.20 1995-02-16 02:58:34 claus Exp $
"
!
@@ -98,18 +98,6 @@
%}
! !
-!FileStream class methodsFor:'initialization'!
-
-initialize
- OpenErrorSignal isNil ifTrue:[
- super initialize.
-
- OpenErrorSignal := StreamErrorSignal newSignalMayProceed:true.
- OpenErrorSignal nameClass:self message:#openErrorSignal.
- OpenErrorSignal notifierString:'open error'.
- ].
-! !
-
!FileStream class methodsFor:'instance creation'!
newFileNamed:filename
@@ -285,22 +273,16 @@
!FileStream methodsFor:'error handling'!
-errorOpen
- "report an error, that the stream is already opened"
-
- ^ StreamErrorSignal
- raiseRequestWith:self
- errorString:(self class name , ' is already open')
-!
-
openError
"report an error, that file open failed"
+ "/
+ "/ for now, do not raise any signal (see super>>openError).
+ "/ Its not yet handled anywhere. Instead, senders of open
+ "/ check for nil return value (which is a historic leftover)
+ "/
LastErrorNumber := lastErrorNumber.
-^nil.
- ^ OpenErrorSignal
- raiseRequestWith:self
- errorString:('error on open: ' , self lastErrorString)
+ ^ nil.
! !
!FileStream methodsFor:'accessing'!
@@ -397,29 +379,27 @@
FILE *f;
OBJ path;
- if (_INST(filePointer) == nil) {
- path = _INST(pathName);
- if (_isNonNilObject(path) && (_qClass(path)==String)) {
- do {
+ path = _INST(pathName);
+ if (_isNonNilObject(path) && (_qClass(path)==String)) {
+ 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));
- if (f == NULL) {
- _INST(lastErrorNumber) = _MKSMALLINT(errno);
- _INST(position) = nil;
- } else {
- _INST(filePointer) = MKOBJ((int)f);
- _INST(position) = _MKSMALLINT(1);
- retVal = self;
- }
+ } while ((f == NULL) && (errno == EINTR));
+ if (f == NULL) {
+ _INST(lastErrorNumber) = _MKSMALLINT(errno);
+ _INST(position) = nil;
+ } else {
+ _INST(filePointer) = MKOBJ((int)f);
+ _INST(position) = _MKSMALLINT(1);
+ retVal = self;
}
}
%}.
@@ -427,7 +407,12 @@
buffered := true. "default is buffered"
Lobby register:self
].
- lastErrorNumber notNil ifTrue:[^ self openError].
+ lastErrorNumber notNil ifTrue:[
+ "
+ the open failed for some reason ...
+ "
+ ^ self openError
+ ].
^ retVal
!
@@ -502,7 +487,7 @@
filePointer isNil ifTrue:[
"this happens, if after a restart, the file is no longer accessable ..."
- ('could not reopen file: ', pathName) errorPrintNewline.
+ ('could not reopen file: ', pathName) errorPrintNL.
] ifFalse:[
self position:oldPos.
]