String.st
changeset 4205 56d69caa8f92
parent 4154 6938d9274ee4
child 4247 42504c49fe2a
--- a/String.st	Wed May 19 14:29:49 1999 +0200
+++ b/String.st	Wed May 19 15:06:02 1999 +0200
@@ -871,20 +871,20 @@
 
     index = __intVal(start);
     if (index <= 0) {
-        index = 1;
+	index = 1;
     }
     if ((cls = __qClass(self)) != String)
-        index += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	index += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
     len = __stringSize(self);
     cpEnd = __stringVal(self) + len;
     cp = __stringVal(self) + index - 1;
     if (cp < cpEnd) {
-        while (cp < cpEnd) {
-            if (*cp++ < ' ') {
-                RETURN ( __MKSMALLINT(cp - __stringVal(self)) );
-            }
-        }
-        RETURN ( __MKSMALLINT(0) );
+	while (cp < cpEnd) {
+	    if (*cp++ < ' ') {
+		RETURN ( __MKSMALLINT(cp - __stringVal(self)) );
+	    }
+	}
+	RETURN ( __MKSMALLINT(0) );
     }
 #endif
 %}.
@@ -1029,89 +1029,89 @@
     INT addrDelta;
 
     if (s == self) {
-        RETURN ( true );
+	RETURN ( true );
     }
     if (! __isNonNilObject(s)) {
-        RETURN ( false );
+	RETURN ( false );
     }
 
     cls = __qClass(s);
     myCls = __qClass(self);
 
     if ((cls == String) || (cls == Symbol) || (cls == myCls)) {
-        cp2 = __stringVal(s);
-        l2 = __stringSize(s);
-        /*
-         * care for instances of subclasses ...
-         */
-        if (cls != String) {
-            int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-
-            cp2 += n;
-            l2 -= n;
-        }
-
-        cp1 = __stringVal(self);
-        l1 = __stringSize(self);
-        /*
-         * care for instances of subclasses ...
-         */
-        if (myCls != String) {
-            int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(myCls)->c_ninstvars));
-
-            cp1 += n;
-            l1 -= n;
-        }
-
-        if (l1 != l2) {
-            RETURN ( false );
-        }
+	cp2 = __stringVal(s);
+	l2 = __stringSize(s);
+	/*
+	 * care for instances of subclasses ...
+	 */
+	if (cls != String) {
+	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+
+	    cp2 += n;
+	    l2 -= n;
+	}
+
+	cp1 = __stringVal(self);
+	l1 = __stringSize(self);
+	/*
+	 * care for instances of subclasses ...
+	 */
+	if (myCls != String) {
+	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(myCls)->c_ninstvars));
+
+	    cp1 += n;
+	    l1 -= n;
+	}
+
+	if (l1 != l2) {
+	    RETURN ( false );
+	}
 #undef FAST_STRNCMP
 #ifdef FAST_STRNCMP
-        RETURN ( (strncmp(cp1, cp2, l1) == 0) ? true : false );
+	RETURN ( (strncmp(cp1, cp2, l1) == 0) ? true : false );
 #else
-        addrDelta = cp2 - cp1;
+	addrDelta = cp2 - cp1;
 # ifdef UNROLL_LOOPS
-        while (l1 >= (sizeof(unsigned INT)*4)) {
-            if (((unsigned INT *)cp1)[0] != ((unsigned INT *)(cp1+addrDelta))[0]) {
-                RETURN (false);
-            }
-            if (((unsigned INT *)cp1)[1] != ((unsigned INT *)(cp1+addrDelta))[1]) {
-                RETURN (false);
-            }
-            if (((unsigned INT *)cp1)[2] != ((unsigned INT *)(cp1+addrDelta))[2]) {
-                RETURN (false);
-            }
-            if (((unsigned INT *)cp1)[3] != ((unsigned INT *)(cp1+addrDelta))[3]) {
-                RETURN (false);
-            }
-            l1 -= (sizeof(unsigned INT) * 4);
-            cp1 += (sizeof(unsigned INT) * 4);
-        }
+	while (l1 >= (sizeof(unsigned INT)*4)) {
+	    if (((unsigned INT *)cp1)[0] != ((unsigned INT *)(cp1+addrDelta))[0]) {
+		RETURN (false);
+	    }
+	    if (((unsigned INT *)cp1)[1] != ((unsigned INT *)(cp1+addrDelta))[1]) {
+		RETURN (false);
+	    }
+	    if (((unsigned INT *)cp1)[2] != ((unsigned INT *)(cp1+addrDelta))[2]) {
+		RETURN (false);
+	    }
+	    if (((unsigned INT *)cp1)[3] != ((unsigned INT *)(cp1+addrDelta))[3]) {
+		RETURN (false);
+	    }
+	    l1 -= (sizeof(unsigned INT) * 4);
+	    cp1 += (sizeof(unsigned INT) * 4);
+	}
 # endif /* UNROLL_LOOPS */
-        while (l1 >= sizeof(unsigned INT)) {
-            if (*((unsigned INT *)cp1) != *((unsigned INT *)(cp1+addrDelta))) {
-                RETURN (false);
-            }
-            l1 -= sizeof(unsigned INT);
-            cp1 += sizeof(unsigned INT);
-        }
-        if (l1 >= sizeof(unsigned short)) {
-            if (*((unsigned short *)cp1) != *((unsigned short *)(cp1+addrDelta))) {
-                RETURN (false);
-            }
-            l1 -= sizeof(unsigned short);
-            cp1 += sizeof(unsigned short);
-        }
-        while (l1) {
-            if (*cp1 != *(cp1+addrDelta)) {
-                RETURN (false);
-            }
-            l1--;
-            cp1++;
-        }
-
-        RETURN (true);
+	while (l1 >= sizeof(unsigned INT)) {
+	    if (*((unsigned INT *)cp1) != *((unsigned INT *)(cp1+addrDelta))) {
+		RETURN (false);
+	    }
+	    l1 -= sizeof(unsigned INT);
+	    cp1 += sizeof(unsigned INT);
+	}
+	if (l1 >= sizeof(unsigned short)) {
+	    if (*((unsigned short *)cp1) != *((unsigned short *)(cp1+addrDelta))) {
+		RETURN (false);
+	    }
+	    l1 -= sizeof(unsigned short);
+	    cp1 += sizeof(unsigned short);
+	}
+	while (l1) {
+	    if (*cp1 != *(cp1+addrDelta)) {
+		RETURN (false);
+	    }
+	    l1--;
+	    cp1++;
+	}
+
+	RETURN (true);
 #endif
     }
 %}.
@@ -1289,89 +1289,89 @@
     INT addrDelta;
 
     if (s == self) {
-        RETURN ( false );
+	RETURN ( false );
     }
     if (! __isNonNilObject(s)) {
-        RETURN ( true );
+	RETURN ( true );
     }
 
     cls = __qClass(s);
     myCls = __qClass(self);
 
     if ((cls == String) || (cls == Symbol) || (cls == myCls)) {
-        cp1 = __stringVal(self);
-        l1 = __stringSize(self);
-        /*
-         * care for instances of subclasses ...
-         */
-        if (myCls != String) {
-            int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(myCls)->c_ninstvars));
-
-            cp1 += n;
-            l1 -= n;
-        }
-
-        cp2 = __stringVal(s);
-        l2 = __stringSize(s);
-        /*
-         * care for instances of subclasses ...
-         */
-        if (cls != String) {
-            int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-
-            cp2 += n;
-            l2 -= n;
-        }
-
-        if (l1 != l2) {
-            RETURN ( true );
-        }
+	cp1 = __stringVal(self);
+	l1 = __stringSize(self);
+	/*
+	 * care for instances of subclasses ...
+	 */
+	if (myCls != String) {
+	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(myCls)->c_ninstvars));
+
+	    cp1 += n;
+	    l1 -= n;
+	}
+
+	cp2 = __stringVal(s);
+	l2 = __stringSize(s);
+	/*
+	 * care for instances of subclasses ...
+	 */
+	if (cls != String) {
+	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+
+	    cp2 += n;
+	    l2 -= n;
+	}
+
+	if (l1 != l2) {
+	    RETURN ( true );
+	}
 
 #undef FAST_STRNCMP
 #ifdef FAST_STRNCMP
-        RETURN ( (strncmp(cp1, cp2, l1) == 0) ? false : true );
+	RETURN ( (strncmp(cp1, cp2, l1) == 0) ? false : true );
 #else
-        addrDelta = cp2 - cp1;
+	addrDelta = cp2 - cp1;
 # ifdef UNROLL_LOOPS
-        while (l1 >= (sizeof(unsigned INT)*4)) {
-            if (((unsigned INT *)cp1)[0] != ((unsigned INT *)(cp1+addrDelta))[0]) {
-                RETURN (true);
-            }
-            if (((unsigned INT *)cp1)[1] != ((unsigned INT *)(cp1+addrDelta))[1]) {
-                RETURN (true);
-            }
-            if (((unsigned INT *)cp1)[2] != ((unsigned INT *)(cp1+addrDelta))[2]) {
-                RETURN (true);
-            }
-            if (((unsigned INT *)cp1)[3] != ((unsigned INT *)(cp1+addrDelta))[3]) {
-                RETURN (true);
-            }
-            l1 -= (sizeof(unsigned INT) * 4);
-            cp1 += (sizeof(unsigned INT) * 4);
-        }
+	while (l1 >= (sizeof(unsigned INT)*4)) {
+	    if (((unsigned INT *)cp1)[0] != ((unsigned INT *)(cp1+addrDelta))[0]) {
+		RETURN (true);
+	    }
+	    if (((unsigned INT *)cp1)[1] != ((unsigned INT *)(cp1+addrDelta))[1]) {
+		RETURN (true);
+	    }
+	    if (((unsigned INT *)cp1)[2] != ((unsigned INT *)(cp1+addrDelta))[2]) {
+		RETURN (true);
+	    }
+	    if (((unsigned INT *)cp1)[3] != ((unsigned INT *)(cp1+addrDelta))[3]) {
+		RETURN (true);
+	    }
+	    l1 -= (sizeof(unsigned INT) * 4);
+	    cp1 += (sizeof(unsigned INT) * 4);
+	}
 # endif /* UNROLL_LOOPS */
-        while (l1 >= sizeof(unsigned INT)) {
-            if (*((unsigned INT *)cp1) != *((unsigned INT *)(cp1+addrDelta))) {
-                RETURN (true);
-            }
-            l1 -= sizeof(unsigned INT);
-            cp1 += sizeof(unsigned INT);
-        }
-        if (l1 >= sizeof(unsigned short)) {
-            if (*((unsigned short *)cp1) != *((unsigned short *)(cp1+addrDelta))) {
-                RETURN (true);
-            }
-            l1 -= sizeof(unsigned short);
-            cp1 += sizeof(unsigned short);
-        }
-        while (l1) {
-            if (*cp1 != *(cp1+addrDelta)) {
-                RETURN (true);
-            }
-            l1--;
-            cp1++;
-        }
-        RETURN (false);
+	while (l1 >= sizeof(unsigned INT)) {
+	    if (*((unsigned INT *)cp1) != *((unsigned INT *)(cp1+addrDelta))) {
+		RETURN (true);
+	    }
+	    l1 -= sizeof(unsigned INT);
+	    cp1 += sizeof(unsigned INT);
+	}
+	if (l1 >= sizeof(unsigned short)) {
+	    if (*((unsigned short *)cp1) != *((unsigned short *)(cp1+addrDelta))) {
+		RETURN (true);
+	    }
+	    l1 -= sizeof(unsigned short);
+	    cp1 += sizeof(unsigned short);
+	}
+	while (l1) {
+	    if (*cp1 != *(cp1+addrDelta)) {
+		RETURN (true);
+	    }
+	    l1--;
+	    cp1++;
+	}
+	RETURN (false);
 #endif
     }
 %}.
@@ -1403,13 +1403,13 @@
 
     cls = __qClass(self);
     if (cls != String) {
-        indx = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	indx = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
     } else {
-        indx = 0;
+	indx = 0;
     }
     newSymbol = __MKSYMBOL(__stringVal(self) + indx, (OBJ *)0);
     if (newSymbol) {
-        RETURN ( newSymbol);
+	RETURN ( newSymbol);
     }
 %}.
     ^ ObjectMemory allocationFailureSignal raise.
@@ -1423,7 +1423,7 @@
     "if a symbol with the receivers characters is already known, return it.
      Otherwise, return nil. This can be used to query for an existing
      symbol and is the same as
-        self knownAsSymbol ifTrue:[self asSymbol] ifFalse:[nil]
+	self knownAsSymbol ifTrue:[self asSymbol] ifFalse:[nil]
      but slightly faster, since the symbol lookup operation is only
      performed once."
 
@@ -1433,9 +1433,9 @@
 
     cls = __qClass(self);
     if (cls != String) {
-        indx = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	indx = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
     } else {
-        indx = 0;
+	indx = 0;
     }
     RETURN ( __SYMBOL_OR_NIL(__stringVal(self) + indx));
 %}
@@ -1585,41 +1585,41 @@
     OBJ myClass, argClass, newString;
 
     if (__isNonNilObject(s)) {
-        myClass = __qClass(self);
-        argClass = __qClass(s);
-        /*
-         * can do it here if both are Strings/Symbols:
-         */
-        if (((myClass == _string) || (myClass == Symbol))
-         && ((argClass == _string) || (argClass == Symbol))) {
-            l1 = __stringSize(self);
-            l2 = __stringSize(s);
-
-            sz = OHDR_SIZE + l1 + l2 + 1;
-            __qNew(newString, sz);      /* OBJECT ALLOCATION */
-            if (newString != nil) {
-                char *cp1, *cp2;
-                REGISTER unsigned char *dstp;
-
-                __InstPtr(newString)->o_class = String;
-                dstp = __stringVal(newString);
-                cp1 = (char *) __stringVal(self);
-                cp2 = (char *) __stringVal(aString);
+	myClass = __qClass(self);
+	argClass = __qClass(s);
+	/*
+	 * can do it here if both are Strings/Symbols:
+	 */
+	if (((myClass == _string) || (myClass == Symbol))
+	 && ((argClass == _string) || (argClass == Symbol))) {
+	    l1 = __stringSize(self);
+	    l2 = __stringSize(s);
+
+	    sz = OHDR_SIZE + l1 + l2 + 1;
+	    __qNew(newString, sz);      /* OBJECT ALLOCATION */
+	    if (newString != nil) {
+		char *cp1, *cp2;
+		REGISTER unsigned char *dstp;
+
+		__InstPtr(newString)->o_class = String;
+		dstp = __stringVal(newString);
+		cp1 = (char *) __stringVal(self);
+		cp2 = (char *) __stringVal(aString);
 
 #ifdef bcopy4
-                /* knowing that allocation is 4-byte aligned and
-                 * size rounded up to next 4-byte, the first copy
-                 * can be done word-wise.
-                 * that speeds up size-10-string , size-10-string 
-                 * by 10% on a P5/200.
-                 */
-                {
-                    int nw = l1 >> 2;
-
-                    if (l1 & 3) nw++;
-                    bcopy4(cp1, dstp, nw);
+		/* knowing that allocation is 4-byte aligned and
+		 * size rounded up to next 4-byte, the first copy
+		 * can be done word-wise.
+		 * that speeds up size-10-string , size-10-string 
+		 * by 10% on a P5/200.
+		 */
+		{
+		    int nw = l1 >> 2;
+
+		    if (l1 & 3) nw++;
+		    bcopy4(cp1, dstp, nw);
 		    dstp += l1;
-                }
+		}
 #else
 # ifdef FAST_MEMCPY
 		bcopy(cp1, dstp, l1);
@@ -1640,31 +1640,31 @@
 #endif
 
 #ifdef bcopy4
-	   	if (((INT)dstp & 3) == 0) {
+		if (((INT)dstp & 3) == 0) {
 		    int nw = l2 >> 2;
 
 		    if (l2 & 3) nw++;
 		    bcopy4(cp2, dstp, nw);
 		    *(dstp + l2) = '\0';
-                    RETURN ( newString );
+		    RETURN ( newString );
 		}
 #endif
-		    
+                    
 #ifdef FAST_MEMCPY
-                bcopy(cp2, dstp, l2+1);
-                dstp[l2] = '\0';
+		bcopy(cp2, dstp, l2+1);
+		dstp[l2] = '\0';
 #else
 # ifdef FAST_STRCPY
-                strncpy(dstp, cp2, l2);
-                dstp[l2] = '\0';
+		strncpy(dstp, cp2, l2);
+		dstp[l2] = '\0';
 # else
-                while (l2--) *dstp++ = *cp2++;
-                *dstp = '\0';
+		while (l2--) *dstp++ = *cp2++;
+		*dstp = '\0';
 # endif
 #endif
-                RETURN ( newString );
-            }
-        }
+		RETURN ( newString );
+	    }
+	}
     }
 %}.
     ^ super , aString
@@ -2072,72 +2072,72 @@
     REGISTER int byteValue;
 
     if (__isCharacter(aCharacter) && __isString(self)) {
-        byteValue = __intVal(_characterVal(aCharacter));
+	byteValue = __intVal(_characterVal(aCharacter));
 
 #ifdef FAST_MEMSET 
-        memset(__stringVal(self), byteValue, __stringSize(self));
+	memset(__stringVal(self), byteValue, __stringSize(self));
 #else
-        {
-            INT v;
-
-            v = (byteValue << 8) | byteValue;
-            v = (v << 16) | v;
-
-            dst = __stringVal(self);
-            l = __stringSize(self);
+	{
+	    INT v;
+
+	    v = (byteValue << 8) | byteValue;
+	    v = (v << 16) | v;
+
+	    dst = __stringVal(self);
+	    l = __stringSize(self);
 
 # ifdef FAST_MEMSET4 /* sorry intel: your stosd instruction is slower ... */
-            memset4(dst, v, l>>2);
-            l = l & 3;
+	    memset4(dst, v, l>>2);
+	    l = l & 3;
 # else
 #  ifdef UINT64
-            v = (v << 32) | v;
-            while (l >= 8) {
-                ((UINT64 *)dst)[0] = v;
-                dst += 8;
-                l -= 8;
-            }
+	    v = (v << 32) | v;
+	    while (l >= 8) {
+		((UINT64 *)dst)[0] = v;
+		dst += 8;
+		l -= 8;
+	    }
 #  else /* no UINT64 */
-            while (l >= 16) {
-                ((int *)dst)[0] = v;
-                ((int *)dst)[1] = v;
-                ((int *)dst)[2] = v;
-                ((int *)dst)[3] = v;
-                dst += 16;
-                l -= 16;
-            }
-            if (l >= 8) {
-                ((int *)dst)[0] = v;
-                ((int *)dst)[1] = v;
-                dst += 8;
-                l -= 8;
-            }
-            if (l >= 4) {
-                ((int *)dst)[0] = v;
-                dst += 4;
-                l -= 4;
-            }
+	    while (l >= 16) {
+		((int *)dst)[0] = v;
+		((int *)dst)[1] = v;
+		((int *)dst)[2] = v;
+		((int *)dst)[3] = v;
+		dst += 16;
+		l -= 16;
+	    }
+	    if (l >= 8) {
+		((int *)dst)[0] = v;
+		((int *)dst)[1] = v;
+		dst += 8;
+		l -= 8;
+	    }
+	    if (l >= 4) {
+		((int *)dst)[0] = v;
+		dst += 4;
+		l -= 4;
+	    }
 #   if 0
-            if (l >= 2) {
-                ((short *)dst)[0] = v;
-                dst += 2;
-                l -= 2;
-            }
+	    if (l >= 2) {
+		((short *)dst)[0] = v;
+		dst += 2;
+		l -= 2;
+	    }
 #   endif
 
 #  endif
 # endif
-        }
-
-        /*
-         * remaining bytes
-         */
-        while (l--)
-            *dst++ = byteValue;
+	}
+
+	/*
+	 * remaining bytes
+	 */
+	while (l--)
+	    *dst++ = byteValue;
 
 #endif /* no FAST_MEMSET */
 
-        RETURN ( self );
+	RETURN ( self );
     }
 %}.
     ^ super atAllPut:aCharacter
@@ -2163,18 +2163,18 @@
     if (__isCharacter(oldCharacter)
      && __isCharacter(newCharacter)
      && __isString(self)) {
-        srcp = (unsigned char *)__stringVal(self);
-        oldVal = __intVal(_characterVal(oldCharacter));
-        newVal = __intVal(_characterVal(newCharacter));
-
-        cNext = *srcp;
-        while ((c = cNext) != '\0') {
-            cNext = srcp[1];
-            if (c == oldVal)
-                *srcp = newVal;
-            srcp++;
-        }
-        RETURN ( self );
+	srcp = (unsigned char *)__stringVal(self);
+	oldVal = __intVal(_characterVal(oldCharacter));
+	newVal = __intVal(_characterVal(newCharacter));
+
+	cNext = *srcp;
+	while ((c = cNext) != '\0') {
+	    cNext = srcp[1];
+	    if (c == oldVal)
+		*srcp = newVal;
+	    srcp++;
+	}
+	RETURN ( self );
     }
 %}.
     ^ super replaceAll:oldCharacter with:newCharacter
@@ -2482,11 +2482,11 @@
 
     if (__qClass(self) == String) {
 #ifdef WIN32
-        __win32_fprintf(stdout, "%s" , __stringVal(self));
+	fprintf(stdout, "%s" , __stringVal(self));
 #else
-        fputs(__stringVal(self), stdout); fflush(stdout);
+	fputs(__stringVal(self), stdout); fflush(stdout);
 #endif
-        RETURN (self);
+	RETURN (self);
     }
 %}.
     ^ super print
@@ -2501,11 +2501,11 @@
 
     if (__qClass(self) == String) {
 #ifdef WIN32
-        __win32_fprintf(stderr, "%s\n" , __stringVal(self));
+	fprintf(stderr, "%s\n" , __stringVal(self));
 #else
-        fputs(__stringVal(self), stdout); fputs("\n", stdout); fflush(stdout);
+	fputs(__stringVal(self), stdout); fputs("\n", stdout); fflush(stdout);
 #endif
-        RETURN (self);
+	RETURN (self);
     }
 %}.
     ^ super printCR
@@ -2562,9 +2562,9 @@
 
     aStream nextPut: $'.
     (self includes:$') ifTrue:[
-        self printWithQuotesDoubledOn:aStream
+	self printWithQuotesDoubledOn:aStream
     ] ifFalse:[
-        aStream nextPutAll:self
+	aStream nextPutAll:self
     ].
     aStream nextPut:$'
 
@@ -2632,9 +2632,9 @@
 
     cls = __qClass(self);
     if (cls != String) {
-        indx = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	indx = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
     } else {
-        indx = 0;
+	indx = 0;
     }
     RETURN ( __KNOWNASSYMBOL(__stringVal(self) + indx) );
 %}
@@ -2709,32 +2709,32 @@
 
     if ((__isString(slf) || __isSymbol(slf))
      && (__isString(aStringOrChar) || __isSymbol(aStringOrChar))) {
-        len1 = __qSize(slf);
-        len2 = __qSize(aStringOrChar);
-        if (len1 < len2) {
-            RETURN ( false );
-        }
-
-        src1 = __stringVal(slf) + (len1 - len2);
-        src2 = __stringVal(aStringOrChar);
-        while (c = *src2++) {
-            if (c != *src1++) {
-                RETURN ( false );
-            }
-        }
-        RETURN (true);
+	len1 = __qSize(slf);
+	len2 = __qSize(aStringOrChar);
+	if (len1 < len2) {
+	    RETURN ( false );
+	}
+
+	src1 = __stringVal(slf) + (len1 - len2);
+	src2 = __stringVal(aStringOrChar);
+	while (c = *src2++) {
+	    if (c != *src1++) {
+		RETURN ( false );
+	    }
+	}
+	RETURN (true);
     }
     if (__isCharacter(aStringOrChar)) {
-        int val;
-
-        val = __intVal(_characterVal(aStringOrChar));
-        if ((unsigned)val <= 255) {
-            len1 = __stringSize(slf);
-            if (len1 > 0) {
-                RETURN ( (__stringVal(slf)[len1-1] == val) ? true : false);
-            }
-        }
-        RETURN ( false );
+	int val;
+
+	val = __intVal(_characterVal(aStringOrChar));
+	if ((unsigned)val <= 255) {
+	    len1 = __stringSize(slf);
+	    if (len1 > 0) {
+		RETURN ( (__stringVal(slf)[len1-1] == val) ? true : false);
+	    }
+	}
+	RETURN ( false );
     }
 %}.
     ^ super endsWith:aStringOrChar
@@ -2761,24 +2761,24 @@
 
     src = __stringVal(self);
     if ((cls = __qClass(self)) != String)
-        src += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	src += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
 
 #ifndef NON_ASCII
 # ifdef UINT64
     while (*((UINT64 *)src) == 0x2020202020202020L) {
-        src += 8;
+	src += 8;
     }
 # endif /* UINT64 */
 
     while (*((unsigned *)src) == 0x20202020) {
-        src += 4;
+	src += 4;
     }
 #endif /* ascii */
 
     while (c = *src++) {
-        if (c != ' ') {
-            RETURN ( false );
-        }
+	if (c != ' ') {
+	    RETURN ( false );
+	}
     }
 %}.
     ^ true
@@ -2900,57 +2900,57 @@
     if (((__qClass(slf)==String) || (__qClass(slf)==Symbol))
      && __isNonNilObject(aStringOrChar)
      && ((__qClass(aStringOrChar)==String) || (__qClass(aStringOrChar)==Symbol))) {
-        src1 = __stringVal(slf);
-        src2 = __stringVal(aStringOrChar);
-        if (src1[0] != src2[0]) {
-            RETURN ( false );
-        }
-
-        len1 = __qSize(slf);
-        len2 = __qSize(aStringOrChar);
-        if (len1 < len2) {
-            RETURN ( false );
-        }
+	src1 = __stringVal(slf);
+	src2 = __stringVal(aStringOrChar);
+	if (src1[0] != src2[0]) {
+	    RETURN ( false );
+	}
+
+	len1 = __qSize(slf);
+	len2 = __qSize(aStringOrChar);
+	if (len1 < len2) {
+	    RETURN ( false );
+	}
 
 # ifdef UINT64
-        while (len2 > (OHDR_SIZE+sizeof(UINT64))) {
-            if ( *((unsigned UINT64 *)src1) != *((unsigned UINT64 *)src2) ) {
-                RETURN (false);
-            }
-            len2 -= sizeof(UINT64);
-            src1 += sizeof(UINT64);
-            src2 += sizeof(UINT64);
-        }
+	while (len2 > (OHDR_SIZE+sizeof(UINT64))) {
+	    if ( *((unsigned UINT64 *)src1) != *((unsigned UINT64 *)src2) ) {
+		RETURN (false);
+	    }
+	    len2 -= sizeof(UINT64);
+	    src1 += sizeof(UINT64);
+	    src2 += sizeof(UINT64);
+	}
 # endif /* UINT64 */
 
-        while (len2 > (OHDR_SIZE+sizeof(INT))) {
-            if ( *((unsigned INT *)src1) != *((unsigned INT *)src2) ) {
-                RETURN (false);
-            }
-            len2 -= sizeof(INT);
-            src1 += sizeof(INT);
-            src2 += sizeof(INT);
-        }
-
-        while (c = *src2++) {
-            if (c != *src1) {
-                RETURN ( false );
-            }
-            src1++;
-        }
-        RETURN (true);
+	while (len2 > (OHDR_SIZE+sizeof(INT))) {
+	    if ( *((unsigned INT *)src1) != *((unsigned INT *)src2) ) {
+		RETURN (false);
+	    }
+	    len2 -= sizeof(INT);
+	    src1 += sizeof(INT);
+	    src2 += sizeof(INT);
+	}
+
+	while (c = *src2++) {
+	    if (c != *src1) {
+		RETURN ( false );
+	    }
+	    src1++;
+	}
+	RETURN (true);
     }
     if (__isCharacter(aStringOrChar)) {
-        int val;
-
-        val = __intVal(_characterVal(aStringOrChar));
-        if ((unsigned)val <= 255) {
-            len1 = __stringSize(slf);
-            if (len1 > 0) {
-                RETURN ( (__stringVal(slf)[0] == val) ? true : false);
-            }
-        }
-        RETURN ( false );
+	int val;
+
+	val = __intVal(_characterVal(aStringOrChar));
+	if ((unsigned)val <= 255) {
+	    len1 = __stringSize(slf);
+	    if (len1 > 0) {
+		RETURN ( (__stringVal(slf)[0] == val) ? true : false);
+	    }
+	}
+	RETURN ( false );
     }
 %}.
     ^ super startsWith:aStringOrChar
@@ -2970,5 +2970,5 @@
 !String class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.136 1999-05-08 13:22:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.137 1999-05-19 13:06:02 cg Exp $'
 ! !