ExternalStream.st
branchjv
changeset 17976 50c2416f962a
parent 17938 e2aad1d7c317
child 17993 956342c369a2
--- a/ExternalStream.st	Mon Oct 29 17:05:17 2012 +0000
+++ b/ExternalStream.st	Mon Oct 29 22:07:56 2012 +0000
@@ -2273,27 +2273,27 @@
 !ExternalStream methodsFor:'error handling'!
 
 argumentMustBeCharacter
+    "report an error, that the argument must be a character in 0..FF"
+
     "{ Pragma: +optSpace }"
 
-    "report an error, that the argument must be a character in 0..FF"
-
-    ^ self error:'argument must be a single byte character'
+    ArgumentError raiseErrorString:' - argument must be a single byte character'
 !
 
 argumentMustBeInteger
+    "report an error, that the argument must be an integer"
+
     "{ Pragma: +optSpace }"
 
-    "report an error, that the argument must be an integer"
-
-    ^ self error:'argument must be an integer'
+    ArgumentError raiseErrorString:' - argument must be an integer'
 !
 
 argumentMustBeString
+    "report an error, that the argument must be a string"
+
     "{ Pragma: +optSpace }"
 
-    "report an error, that the argument must be a string"
-
-    ^ self error:'argument must be a string'
+    ArgumentError raiseErrorString:' - argument must be a string'
 !
 
 errorAlreadyOpen
@@ -2438,20 +2438,7 @@
 
     "{ Pragma: +optSpace }"
 
-    |exClass|
-
-    exClass := (lastErrorNumber == (OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND))
-        ifTrue:[ FileDoesNotExistException ]
-        ifFalse:[ OpenError ].
-
-    ^ exClass newException
-        errorCode:lastErrorNumber;
-        errorString:(' : ' , (OperatingSystem errorTextForNumber:lastErrorNumber));
-        parameter:self;
-        raiseRequest
-
-    "Modified: / 28-01-1998 / 14:37:42 / stefan"
-    "Modified: / 09-09-2011 / 09:16:40 / cg"
+    ^ self openError:lastErrorNumber.
 !
 
 openError:errorNumber
@@ -2461,7 +2448,7 @@
 
     |exClass|
 
-    exClass := (errorNumber == OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND)
+    exClass := (errorNumber == (OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND))
         ifTrue:[ FileDoesNotExistException ]
         ifFalse:[ OpenError ].
 
@@ -4445,36 +4432,36 @@
 # if 1
        f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
 # else
-	__BEGIN_INTERRUPTABLE__
-	do {
-	    f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
-	} while ((f == NULL) && (__threadErrno == EINTR));
-	__END_INTERRUPTABLE__
+        __BEGIN_INTERRUPTABLE__
+        do {
+            f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
+        } while ((f == NULL) && (__threadErrno == EINTR));
+        __END_INTERRUPTABLE__
 # endif
 #else /* UNIX */
-	__BEGIN_INTERRUPTABLE__
-	do {
-	    f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
-	} while ((f == NULL) && (__threadErrno == EINTR));
-	__END_INTERRUPTABLE__
+        __BEGIN_INTERRUPTABLE__
+        do {
+            f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
+        } while ((f == NULL) && (__threadErrno == EINTR));
+        __END_INTERRUPTABLE__
 #endif /* UNIX */
-	if (f == NULL) {
-	    __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
-	} else {
-	    if (@global(FileOpenTrace) == true) {
-		fprintf(stderr, "fopen %s [ExternalStream] -> %x\n", __stringVal(aPath), f);
-	    }
-	    fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
-	    __INST(handleType) = @symbol(filePointer);
-	    ok = true;
-	}
+        if (f == NULL) {
+            __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
+        } else {
+            if (@global(FileOpenTrace) == true) {
+                fprintf(stderr, "fopen %s [ExternalStream] -> %x\n", __stringVal(aPath), f);
+            }
+            fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
+            __INST(handleType) = @symbol(filePointer);
+            ok = true;
+        }
     }
 %}.
     ok ifFalse:[
-	"
-	 the open failed for some reason ...
-	"
-	^ self openError
+        "
+         the open failed for some reason ...
+        "
+        ^ self openError:lastErrorNumber.
     ].
     position := ZeroPosition.
     Lobby register:self.
@@ -5706,15 +5693,15 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.349 2012/03/26 17:02:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.351 2012/10/26 10:25:03 stefan Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.349 2012/03/26 17:02:56 cg Exp §'
+    ^ '§Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.351 2012/10/26 10:25:03 stefan Exp §'
 !
 
 version_SVN
-    ^ '$Id: ExternalStream.st 10804 2012-04-13 13:18:13Z vranyj1 $'
+    ^ '$Id: ExternalStream.st 10858 2012-10-29 22:07:56Z vranyj1 $'
 ! !
 
 ExternalStream initialize!