oops - handling of exclas within primitives was wrong
authorClaus Gittinger <cg@exept.de>
Mon, 04 Dec 1995 11:51:47 +0100
changeset 673 2c3a4a536cd1
parent 672 964a9e78398a
child 674 fba47329ac9d
oops - handling of exclas within primitives was wrong
ExtStream.st
ExternalStream.st
--- a/ExtStream.st	Mon Dec 04 11:25:22 1995 +0100
+++ b/ExtStream.st	Mon Dec 04 11:51:47 1995 +0100
@@ -177,7 +177,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.73 1995-12-04 10:21:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.74 1995-12-04 10:51:47 cg Exp $'
 ! !
 
 !ExternalStream class methodsFor:'initialization'!
@@ -2302,7 +2302,7 @@
      */
     FILE *f;
     int done = 0;
-    REGISTER int c;
+    REGISTER int c, lastC;
     int peekC;
     char *bufferPtr = (char *)0;
     char fastBuffer[7000];
@@ -2324,7 +2324,10 @@
     /*
      * skip spaces
      */
+    c = '\n';
     while (! done) {
+	lastC = c;
+
 	__BEGIN_INTERRUPTABLE__
 	do {
 	    c = getc(f);
@@ -2334,8 +2337,6 @@
 	atBeginOfLine = 0;
 	switch (c) {
 	    case '\n':
-		atBeginOfLine = 1;
-		/* fall into */
 	    case ' ':
 	    case '\t':
 	    case '\r':
@@ -2352,6 +2353,7 @@
 		RETURN (nil);
 
 	    default:
+		atBeginOfLine = (lastC == '\n');
 		ungetc(c, f);
 		done = 1;
 		break;
--- a/ExternalStream.st	Mon Dec 04 11:25:22 1995 +0100
+++ b/ExternalStream.st	Mon Dec 04 11:51:47 1995 +0100
@@ -177,7 +177,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.73 1995-12-04 10:21:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.74 1995-12-04 10:51:47 cg Exp $'
 ! !
 
 !ExternalStream class methodsFor:'initialization'!
@@ -2302,7 +2302,7 @@
      */
     FILE *f;
     int done = 0;
-    REGISTER int c;
+    REGISTER int c, lastC;
     int peekC;
     char *bufferPtr = (char *)0;
     char fastBuffer[7000];
@@ -2324,7 +2324,10 @@
     /*
      * skip spaces
      */
+    c = '\n';
     while (! done) {
+	lastC = c;
+
 	__BEGIN_INTERRUPTABLE__
 	do {
 	    c = getc(f);
@@ -2334,8 +2337,6 @@
 	atBeginOfLine = 0;
 	switch (c) {
 	    case '\n':
-		atBeginOfLine = 1;
-		/* fall into */
 	    case ' ':
 	    case '\t':
 	    case '\r':
@@ -2352,6 +2353,7 @@
 		RETURN (nil);
 
 	    default:
+		atBeginOfLine = (lastC == '\n');
 		ungetc(c, f);
 		done = 1;
 		break;