String.st
changeset 1134 7cb7cd7ebeb8
parent 1019 db8afc103e37
child 1138 993e6ffdbf51
equal deleted inserted replaced
1133:961f2b095c22 1134:7cb7cd7ebeb8
    87     REGISTER unsigned char *cp;
    87     REGISTER unsigned char *cp;
    88     REGISTER OBJ *op;
    88     REGISTER OBJ *op;
    89     int nInstVars, instsize;
    89     int nInstVars, instsize;
    90 
    90 
    91     if (__isSmallInteger(anInteger)) {
    91     if (__isSmallInteger(anInteger)) {
    92 	len = _intVal(anInteger);
    92 	len = __intVal(anInteger);
    93 	if (len >= 0) {
    93 	if (len >= 0) {
    94 	    if (self == String) {
    94 	    if (self == String) {
    95 		instsize = OHDR_SIZE + len + 1;
    95 		instsize = OHDR_SIZE + len + 1;
    96 		if (__CanDoQuickNew(instsize)) {
    96 		if (__CanDoQuickNew(instsize)) {
    97 		    /*
    97 		    /*
    98 		     * the most common case
    98 		     * the most common case
    99 		     */
    99 		     */
   100 		    __qCheckedNew(newString, instsize);
   100 		    __qCheckedNew(newString, instsize);
   101 		    _InstPtr(newString)->o_class = self;
   101 		    __InstPtr(newString)->o_class = self;
   102 		    __qSTORE(newString, self);
   102 		    __qSTORE(newString, self);
   103 
   103 
   104 		    cp = _stringVal(newString);
   104 		    cp = __stringVal(newString);
   105 #if defined(memset4) && !defined(NON_ASCII)
   105 #if defined(memset4) && !defined(NON_ASCII)
   106 		    instsize = len >> 2;
   106 		    instsize = len >> 2;
   107 		    if (len & 3) instsize++;
   107 		    if (len & 3) instsize++;
   108 		    memset4(cp, 0x20202020, instsize);
   108 		    memset4(cp, 0x20202020, instsize);
   109 		    *(cp + len) = '\0';
   109 		    *(cp + len) = '\0';
   130 #endif
   130 #endif
   131 		    RETURN (newString);
   131 		    RETURN (newString);
   132 		}
   132 		}
   133 		nInstVars = 0;
   133 		nInstVars = 0;
   134 	    } else {
   134 	    } else {
   135 		nInstVars = _intVal(_ClassInstPtr(self)->c_ninstvars);
   135 		nInstVars = __intVal(__ClassInstPtr(self)->c_ninstvars);
   136 		instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars) + len + 1;
   136 		instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars) + len + 1;
   137 	    }
   137 	    }
   138 
   138 
   139 	    __PROTECT_CONTEXT__
   139 	    __PROTECT_CONTEXT__
   140 	    __qNew(newString, instsize, SENDER);
   140 	    __qNew(newString, instsize, SENDER);
   141 	    __UNPROTECT_CONTEXT__
   141 	    __UNPROTECT_CONTEXT__
   142 	    if (newString == nil) goto fail;
   142 	    if (newString == nil) goto fail;
   143 	    _InstPtr(newString)->o_class = self;
   143 	    __InstPtr(newString)->o_class = self;
   144 	    __qSTORE(newString, self);
   144 	    __qSTORE(newString, self);
   145 
   145 
   146 	    if (nInstVars) {
   146 	    if (nInstVars) {
   147 #if defined(memset4)
   147 #if defined(memset4)
   148 		memset4(_InstPtr(newString)->i_instvars, nil, nInstVars);
   148 		memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
   149 #else
   149 #else
   150 # if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
   150 # if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
   151 		/*
   151 		/*
   152 		 * knowing that nil is 0
   152 		 * knowing that nil is 0
   153 		 */
   153 		 */
   154 		memset(_InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
   154 		memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
   155 # else
   155 # else
   156 		op = _InstPtr(newString)->i_instvars;
   156 		op = __InstPtr(newString)->i_instvars;
   157 		do {
   157 		do {
   158 		    *op++ = nil;
   158 		    *op++ = nil;
   159 		} while (--nInstVars);
   159 		} while (--nInstVars);
   160 # endif
   160 # endif
   161 #endif
   161 #endif
   162 		cp = _stringVal(newString) + __OBJS2BYTES__(nInstVars);
   162 		cp = __stringVal(newString) + __OBJS2BYTES__(nInstVars);
   163 	    } else {
   163 	    } else {
   164 		cp = _stringVal(newString);
   164 		cp = __stringVal(newString);
   165 	    }
   165 	    }
   166 
   166 
   167 #ifdef FAST_MEMSET
   167 #ifdef FAST_MEMSET
   168 	    memset(cp, ' ', len);
   168 	    memset(cp, ' ', len);
   169 	    *(cp + len) = '\0';
   169 	    *(cp + len) = '\0';
   280 
   280 
   281     REGISTER int indx;
   281     REGISTER int indx;
   282     REGISTER OBJ cls;
   282     REGISTER OBJ cls;
   283 
   283 
   284     if (__isSmallInteger(index)) {
   284     if (__isSmallInteger(index)) {
   285 	indx = _intVal(index);
   285 	indx = __intVal(index);
   286 	if (indx > 0) {
   286 	if (indx > 0) {
   287 	    cls = __qClass(self);
   287 	    cls = __qClass(self);
   288 	    if (cls != String)
   288 	    if (cls != String)
   289 		indx += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   289 		indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   290 	    if (indx <= (_stringSize(self))) {
   290 	    if (indx <= (__stringSize(self))) {
   291 		RETURN ( _MKCHARACTER(_stringVal(self)[indx-1] & 0xFF) );
   291 		RETURN ( __MKCHARACTER(__stringVal(self)[indx-1] & 0xFF) );
   292 	    }
   292 	    }
   293 	}
   293 	}
   294     }
   294     }
   295 %}.
   295 %}.
   296     ^ self subscriptBoundsError:index
   296     ^ self subscriptBoundsError:index
   306 
   306 
   307     REGISTER int value, indx;
   307     REGISTER int value, indx;
   308 
   308 
   309     if (__isString(self)) {
   309     if (__isString(self)) {
   310 	if (__isCharacter(aCharacter)) {
   310 	if (__isCharacter(aCharacter)) {
   311 	    value = _intVal(_characterVal(aCharacter));
   311 	    value = __intVal(_characterVal(aCharacter));
   312 #ifdef OLD
   312 #ifdef OLD
   313 	    if ((value > 0) 
   313 	    if ((value > 0) 
   314 	     && (value <= 255)
   314 	     && (value <= 255)
   315 #else
   315 #else
   316 	    if (((value & ~0xFF) == 0)
   316 	    if (((value & ~0xFF) == 0)
   317 #endif
   317 #endif
   318 	     && __isSmallInteger(index)) {
   318 	     && __isSmallInteger(index)) {
   319 		indx = _intVal(index);
   319 		indx = __intVal(index);
   320 		if (indx > 0) {
   320 		if (indx > 0) {
   321 		    if (indx <= (_stringSize(self))) {
   321 		    if (indx <= (__stringSize(self))) {
   322 			_stringVal(self)[indx-1] = value;
   322 			__stringVal(self)[indx-1] = value;
   323 			RETURN ( aCharacter );
   323 			RETURN ( aCharacter );
   324 		    }
   324 		    }
   325 		}
   325 		}
   326 	    }
   326 	    }
   327 	}
   327 	}
   357 
   357 
   358     REGISTER int indx;
   358     REGISTER int indx;
   359     REGISTER OBJ cls;
   359     REGISTER OBJ cls;
   360 
   360 
   361     if (__isSmallInteger(index)) {
   361     if (__isSmallInteger(index)) {
   362 	indx = _intVal(index);
   362 	indx = __intVal(index);
   363 	if (indx > 0) {
   363 	if (indx > 0) {
   364 	    cls = __qClass(self);
   364 	    cls = __qClass(self);
   365 	    if (cls != String)
   365 	    if (cls != String)
   366 		indx += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   366 		indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   367 	    if (indx <= (_stringSize(self))) {
   367 	    if (indx <= (__stringSize(self))) {
   368 		RETURN ( _MKCHARACTER(_stringVal(self)[indx-1] & 0xFF) );
   368 		RETURN ( __MKCHARACTER(__stringVal(self)[indx-1] & 0xFF) );
   369 	    }
   369 	    }
   370 	}
   370 	}
   371     }
   371     }
   372 %}.
   372 %}.
   373     ^ self subscriptBoundsError:index
   373     ^ self subscriptBoundsError:index
   382 
   382 
   383     REGISTER int value, indx;
   383     REGISTER int value, indx;
   384 
   384 
   385     if (__isString(self)) {
   385     if (__isString(self)) {
   386 	if (__isCharacter(aCharacter)) {
   386 	if (__isCharacter(aCharacter)) {
   387 	    value = _intVal(_characterVal(aCharacter));
   387 	    value = __intVal(_characterVal(aCharacter));
   388 	    if ((value > 0) 
   388 	    if ((value > 0) 
   389 	     && (value <= 255)
   389 	     && (value <= 255)
   390 	     && __isSmallInteger(index)) {
   390 	     && __isSmallInteger(index)) {
   391 		indx = _intVal(index);
   391 		indx = __intVal(index);
   392 		if (indx > 0) {
   392 		if (indx > 0) {
   393 		    if (indx <= (_stringSize(self))) {
   393 		    if (indx <= (__stringSize(self))) {
   394 			_stringVal(self)[indx-1] = value;
   394 			__stringVal(self)[indx-1] = value;
   395 			RETURN ( aCharacter );
   395 			RETURN ( aCharacter );
   396 		    }
   396 		    }
   397 		}
   397 		}
   398 	    }
   398 	    }
   399 	}
   399 	}
   428 %{  /* NOCONTEXT */
   428 %{  /* NOCONTEXT */
   429     REGISTER OBJ cls;
   429     REGISTER OBJ cls;
   430 
   430 
   431     cls = __qClass(self);
   431     cls = __qClass(self);
   432     if (cls == String) {
   432     if (cls == String) {
   433 	RETURN ( _MKSMALLINT(_stringSize(self)) );
   433 	RETURN ( __MKSMALLINT(__stringSize(self)) );
   434     }
   434     }
   435     RETURN ( _MKSMALLINT(_stringSize(self)
   435     RETURN ( __MKSMALLINT(__stringSize(self)
   436 			 - __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars))));
   436 			 - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
   437 %}
   437 %}
   438 !
   438 !
   439 
   439 
   440 size
   440 size
   441     "return the number of characters in myself.
   441     "return the number of characters in myself.
   446 %{  /* NOCONTEXT */
   446 %{  /* NOCONTEXT */
   447     REGISTER OBJ cls;
   447     REGISTER OBJ cls;
   448 
   448 
   449     cls = __qClass(self);
   449     cls = __qClass(self);
   450     if (cls == String) {
   450     if (cls == String) {
   451 	RETURN ( _MKSMALLINT(_stringSize(self)) );
   451 	RETURN ( __MKSMALLINT(__stringSize(self)) );
   452     }
   452     }
   453     RETURN ( _MKSMALLINT(_stringSize(self)
   453     RETURN ( __MKSMALLINT(__stringSize(self)
   454 			 - __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars))));
   454 			 - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
   455 %}
   455 %}
   456 ! !
   456 ! !
   457 
   457 
   458 !String ignoredMethodsFor:'binary storage'!
   458 !String ignoredMethodsFor:'binary storage'!
   459 
   459 
   487     REGISTER unsigned char *cp;
   487     REGISTER unsigned char *cp;
   488     REGISTER int byteValue;
   488     REGISTER int byteValue;
   489     OBJ cls;
   489     OBJ cls;
   490 
   490 
   491     if (__isCharacter(aCharacter)) {
   491     if (__isCharacter(aCharacter)) {
   492 	byteValue = _intVal(_characterVal(aCharacter));
   492 	byteValue = __intVal(_characterVal(aCharacter));
   493 	cp = _stringVal(self);
   493 	cp = __stringVal(self);
   494 	if ((cls = __qClass(self)) != String)
   494 	if ((cls = __qClass(self)) != String)
   495 	    cp += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   495 	    cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   496 #ifdef FAST_STRCHR
   496 #ifdef FAST_STRCHR
   497 	cp = (unsigned char *) strchr(cp, _intVal(_characterVal(aCharacter)));
   497 	cp = (unsigned char *) strchr(cp, __intVal(_characterVal(aCharacter)));
   498 	if (cp) {
   498 	if (cp) {
   499 	    RETURN ( true );
   499 	    RETURN ( true );
   500 	}
   500 	}
   501 #else
   501 #else
   502 	while (*cp) {
   502 	while (*cp) {
   529     REGISTER unsigned char *cp;
   529     REGISTER unsigned char *cp;
   530     REGISTER unsigned char *matchP;
   530     REGISTER unsigned char *matchP;
   531     OBJ cls;
   531     OBJ cls;
   532 
   532 
   533     if (__isString(aCollection)) {
   533     if (__isString(aCollection)) {
   534 	matchP = _stringVal(aCollection);
   534 	matchP = __stringVal(aCollection);
   535 	cp = _stringVal(self);
   535 	cp = __stringVal(self);
   536 	if ((cls = __qClass(self)) != String)
   536 	if ((cls = __qClass(self)) != String)
   537 	    cp += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   537 	    cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   538 
   538 
   539 	while (*cp) {
   539 	while (*cp) {
   540 	    if (strchr(matchP, *cp)) {
   540 	    if (strchr(matchP, *cp)) {
   541 		RETURN ( true );
   541 		RETURN ( true );
   542 	    }
   542 	    }
   572     char c;
   572     char c;
   573 #endif
   573 #endif
   574     OBJ cls;
   574     OBJ cls;
   575 
   575 
   576     if (__isCharacter(aCharacter)) {
   576     if (__isCharacter(aCharacter)) {
   577 	cp = _stringVal(self);
   577 	cp = __stringVal(self);
   578 	if ((cls = __qClass(self)) != String)
   578 	if ((cls = __qClass(self)) != String)
   579 	    cp += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   579 	    cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   580 #ifdef FAST_STRCHR
   580 #ifdef FAST_STRCHR
   581 	cp = (unsigned char *) strchr(cp, _intVal(_characterVal(aCharacter)));
   581 	cp = (unsigned char *) strchr(cp, __intVal(_characterVal(aCharacter)));
   582 	if (cp) {
   582 	if (cp) {
   583 	    RETURN ( _MKSMALLINT(cp - _stringVal(self) + 1) );
   583 	    RETURN ( __MKSMALLINT(cp - __stringVal(self) + 1) );
   584 	}
   584 	}
   585 #else
   585 #else
   586 	byteValue = _intVal(_characterVal(aCharacter));
   586 	byteValue = __intVal(_characterVal(aCharacter));
   587 	index = 1;
   587 	index = 1;
   588 	while (c = *cp++) {
   588 	while (c = *cp++) {
   589 	    if (c == byteValue) { RETURN ( _MKSMALLINT(index) ); }
   589 	    if (c == byteValue) { RETURN ( __MKSMALLINT(index) ); }
   590 	    index++;
   590 	    index++;
   591 	}
   591 	}
   592 #endif
   592 #endif
   593     }
   593     }
   594 %}.
   594 %}.
   618     int len;
   618     int len;
   619     OBJ cls;
   619     OBJ cls;
   620 
   620 
   621     if (__isSmallInteger(start)) {
   621     if (__isSmallInteger(start)) {
   622 	if (__isCharacter(aCharacter)) {
   622 	if (__isCharacter(aCharacter)) {
   623 	    byteValue = _intVal(_characterVal(aCharacter));
   623 	    byteValue = __intVal(_characterVal(aCharacter));
   624 	    index = _intVal(start);
   624 	    index = __intVal(start);
   625 	    if (index <= 0)
   625 	    if (index <= 0)
   626 		index = 1;
   626 		index = 1;
   627 	    if ((cls = __qClass(self)) != String)
   627 	    if ((cls = __qClass(self)) != String)
   628 		index += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   628 		index += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   629 	    len = _stringSize(self);
   629 	    len = __stringSize(self);
   630 	    if (index <= len) {
   630 	    if (index <= len) {
   631 		cp = _stringVal(self) + index - 1;
   631 		cp = __stringVal(self) + index - 1;
   632 #ifdef FAST_STRCHR
   632 #ifdef FAST_STRCHR
   633 		cp = (unsigned char *) strchr(cp, byteValue);
   633 		cp = (unsigned char *) strchr(cp, byteValue);
   634 		if (cp) {
   634 		if (cp) {
   635 		    RETURN ( _MKSMALLINT(cp - _stringVal(self) + 1) );
   635 		    RETURN ( __MKSMALLINT(cp - __stringVal(self) + 1) );
   636 		}
   636 		}
   637 #else
   637 #else
   638 		while (c = *cp++) {
   638 		while (c = *cp++) {
   639 		    if (c == byteValue) {
   639 		    if (c == byteValue) {
   640 			RETURN ( _MKSMALLINT(index) );
   640 			RETURN ( __MKSMALLINT(index) );
   641 		    }
   641 		    }
   642 		    index++;
   642 		    index++;
   643 		}
   643 		}
   644 #endif
   644 #endif
   645 	    }
   645 	    }
   646 	}
   646 	}
   647 	RETURN ( _MKSMALLINT(0) );
   647 	RETURN ( __MKSMALLINT(0) );
   648     }
   648     }
   649 %}.
   649 %}.
   650     ^ super indexOf:aCharacter startingAt:start
   650     ^ super indexOf:aCharacter startingAt:start
   651 
   651 
   652     "
   652     "
   671     OBJ cls;
   671     OBJ cls;
   672 
   672 
   673     if (__isSmallInteger(start)
   673     if (__isSmallInteger(start)
   674      && __isString(aCollectionOfCharacters)) {
   674      && __isString(aCollectionOfCharacters)) {
   675 	matchP = __stringVal(aCollectionOfCharacters);
   675 	matchP = __stringVal(aCollectionOfCharacters);
   676 	index = _intVal(start);
   676 	index = __intVal(start);
   677 	if (index <= 0)
   677 	if (index <= 0)
   678 	    index = 1;
   678 	    index = 1;
   679 	if ((cls = __qClass(self)) != String)
   679 	if ((cls = __qClass(self)) != String)
   680 	    index += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   680 	    index += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   681 	len = _stringSize(self);
   681 	len = __stringSize(self);
   682 	if (index <= len) {
   682 	if (index <= len) {
   683 	    cp = _stringVal(self) + index - 1;
   683 	    cp = __stringVal(self) + index - 1;
   684 	    while (c = *cp++) {
   684 	    while (c = *cp++) {
   685 		for (ccp = matchP; *ccp ; ccp++) {
   685 		for (ccp = matchP; *ccp ; ccp++) {
   686 		    if (*ccp == c) {
   686 		    if (*ccp == c) {
   687 			RETURN ( _MKSMALLINT(index) );
   687 			RETURN ( __MKSMALLINT(index) );
   688 		    }
   688 		    }
   689 		}
   689 		}
   690 		index++;
   690 		index++;
   691 	    }
   691 	    }
   692 	}
   692 	}
   693 	RETURN ( _MKSMALLINT(0) );
   693 	RETURN ( __MKSMALLINT(0) );
   694     }
   694     }
   695 %}.
   695 %}.
   696     "/
   696     "/
   697     "/ fallback: 1st argument not a string or error
   697     "/ fallback: 1st argument not a string or error
   698     "/
   698     "/
   713     REGISTER unsigned char *cp;
   713     REGISTER unsigned char *cp;
   714     REGISTER char c;
   714     REGISTER char c;
   715     int len, index;
   715     int len, index;
   716     OBJ cls;
   716     OBJ cls;
   717 
   717 
   718     index = _intVal(start);
   718     index = __intVal(start);
   719     if (index <= 0) {
   719     if (index <= 0) {
   720 	index = 1;
   720 	index = 1;
   721     }
   721     }
   722     if ((cls = __qClass(self)) != String)
   722     if ((cls = __qClass(self)) != String)
   723 	index += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   723 	index += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   724     len = _stringSize(self);
   724     len = __stringSize(self);
   725     if (index > len) {
   725     if (index > len) {
   726 	RETURN ( _MKSMALLINT(0) );
   726 	RETURN ( __MKSMALLINT(0) );
   727     }
   727     }
   728     cp = _stringVal(self) + index - 1;
   728     cp = __stringVal(self) + index - 1;
   729     while (c = *cp++) {
   729     while (c = *cp++) {
   730 #ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
   730 #ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
   731 	if (c <= ' ')
   731 	if (c <= ' ')
   732 #endif
   732 #endif
   733 	if ((c == ' ') || (c == '\t') || (c == '\n')
   733 	if ((c == ' ') || (c == '\t') || (c == '\n')
   734 	 || (c == '\r') || (c == '\f')) {
   734 	 || (c == '\r') || (c == '\f')) {
   735 	    RETURN ( _MKSMALLINT(cp - _stringVal(self)) );
   735 	    RETURN ( __MKSMALLINT(cp - __stringVal(self)) );
   736 	}
   736 	}
   737     }
   737     }
   738 %}
   738 %}
   739 .
   739 .
   740     ^ 0
   740     ^ 0
   756     REGISTER int count;
   756     REGISTER int count;
   757     OBJ cls;
   757     OBJ cls;
   758 
   758 
   759     if (__isCharacter(aCharacter)) {
   759     if (__isCharacter(aCharacter)) {
   760 	count = 0;
   760 	count = 0;
   761 	byteValue = _intVal(_characterVal(aCharacter));
   761 	byteValue = __intVal(_characterVal(aCharacter));
   762 	cp = _stringVal(self);
   762 	cp = __stringVal(self);
   763 	if ((cls = __qClass(self)) != String)
   763 	if ((cls = __qClass(self)) != String)
   764 	    cp += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   764 	    cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   765 	while (*cp) {
   765 	while (*cp) {
   766 	    if (*cp++ == byteValue) count++;
   766 	    if (*cp++ == byteValue) count++;
   767 	}
   767 	}
   768 	RETURN ( _MKSMALLINT(count) );
   768 	RETURN ( __MKSMALLINT(count) );
   769     }
   769     }
   770 %}.
   770 %}.
   771     ^ 0
   771     ^ 0
   772 
   772 
   773     "
   773     "
   800     if (! __isNonNilObject(s)) {
   800     if (! __isNonNilObject(s)) {
   801 	RETURN ( false );
   801 	RETURN ( false );
   802     }
   802     }
   803 
   803 
   804     if (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self))) {
   804     if (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self))) {
   805 	cp1 = (char *) _stringVal(self);
   805 	cp1 = (char *) __stringVal(self);
   806 	l1 = _stringSize(self);
   806 	l1 = __stringSize(self);
   807 	/*
   807 	/*
   808 	 * care for instances of subclasses ...
   808 	 * care for instances of subclasses ...
   809 	 */
   809 	 */
   810 	if (__qClass(self) != String) {
   810 	if (__qClass(self) != String) {
   811 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
   811 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
   812 
   812 
   813 	    cp1 += n;
   813 	    cp1 += n;
   814 	    l1 -= n;
   814 	    l1 -= n;
   815 	}
   815 	}
   816 
   816 
   817 	cp2 = (char *) _stringVal(s);
   817 	cp2 = (char *) __stringVal(s);
   818 	l2 = _stringSize(s);
   818 	l2 = __stringSize(s);
   819 	/*
   819 	/*
   820 	 * care for instances of subclasses ...
   820 	 * care for instances of subclasses ...
   821 	 */
   821 	 */
   822 	if (cls != String) {
   822 	if (cls != String) {
   823 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   823 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   824 
   824 
   825 	    cp2 += n;
   825 	    cp2 += n;
   826 	    l2 -= n;
   826 	    l2 -= n;
   827 	}
   827 	}
   828 
   828 
   856     char *cp1, *cp2;
   856     char *cp1, *cp2;
   857     OBJ cls;
   857     OBJ cls;
   858 
   858 
   859     if (__isNonNilObject(s)
   859     if (__isNonNilObject(s)
   860      && (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self)))) {
   860      && (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self)))) {
   861 	cp1 = (char *) _stringVal(self);
   861 	cp1 = (char *) __stringVal(self);
   862 	len1 = _stringSize(self);
   862 	len1 = __stringSize(self);
   863 
   863 
   864 	/*
   864 	/*
   865 	 * care for instances of subclasses ...
   865 	 * care for instances of subclasses ...
   866 	 */
   866 	 */
   867 	if (__qClass(self) != String) {
   867 	if (__qClass(self) != String) {
   868 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
   868 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
   869 
   869 
   870 	    cp1 += n;
   870 	    cp1 += n;
   871 	    len1 -= n;
   871 	    len1 -= n;
   872 	}
   872 	}
   873 
   873 
   874 	cp2 = (char *) _stringVal(s);
   874 	cp2 = (char *) __stringVal(s);
   875 	len2 = _stringSize(s);
   875 	len2 = __stringSize(s);
   876 	/*
   876 	/*
   877 	 * care for instances of subclasses ...
   877 	 * care for instances of subclasses ...
   878 	 */
   878 	 */
   879 	if (cls != String) {
   879 	if (cls != String) {
   880 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   880 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   881 
   881 
   882 	    cp2 += n;
   882 	    cp2 += n;
   883 	    len2 -= n;
   883 	    len2 -= n;
   884 	}
   884 	}
   885 
   885 
   914     char *cp1, *cp2;
   914     char *cp1, *cp2;
   915     OBJ cls;
   915     OBJ cls;
   916 
   916 
   917     if (__isNonNilObject(s)
   917     if (__isNonNilObject(s)
   918      && (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self)))) {
   918      && (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self)))) {
   919 	cp1 = (char *) _stringVal(self);
   919 	cp1 = (char *) __stringVal(self);
   920 
   920 
   921 	/*
   921 	/*
   922 	 * care for instances of subclasses ...
   922 	 * care for instances of subclasses ...
   923 	 */
   923 	 */
   924 	if (__qClass(self) != String) {
   924 	if (__qClass(self) != String) {
   925 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
   925 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
   926 
   926 
   927 	    cp1 += n;
   927 	    cp1 += n;
   928 	}
   928 	}
   929 
   929 
   930 	cp2 = (char *) _stringVal(s);
   930 	cp2 = (char *) __stringVal(s);
   931 	/*
   931 	/*
   932 	 * care for instances of subclasses ...
   932 	 * care for instances of subclasses ...
   933 	 */
   933 	 */
   934 	if (cls != String) {
   934 	if (cls != String) {
   935 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   935 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   936 
   936 
   937 	    cp2 += n;
   937 	    cp2 += n;
   938 	}
   938 	}
   939 
   939 
   940 #ifdef HAS_STRCOLL
   940 #ifdef HAS_STRCOLL
   973     }
   973     }
   974     if (! __isNonNilObject(s)) {
   974     if (! __isNonNilObject(s)) {
   975 	RETURN ( true );
   975 	RETURN ( true );
   976     }
   976     }
   977     if (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self))) {
   977     if (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self))) {
   978 	cp1 = (char *) _stringVal(self);
   978 	cp1 = (char *) __stringVal(self);
   979 	l1 = _stringSize(self);
   979 	l1 = __stringSize(self);
   980 	/*
   980 	/*
   981 	 * care for instances of subclasses ...
   981 	 * care for instances of subclasses ...
   982 	 */
   982 	 */
   983 	if (__qClass(self) != String) {
   983 	if (__qClass(self) != String) {
   984 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
   984 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
   985 
   985 
   986 	    cp1 += n;
   986 	    cp1 += n;
   987 	    l1 -= n;
   987 	    l1 -= n;
   988 	}
   988 	}
   989 
   989 
   990 	cp2 = (char *) _stringVal(s);
   990 	cp2 = (char *) __stringVal(s);
   991 	l2 = _stringSize(s);
   991 	l2 = __stringSize(s);
   992 	/*
   992 	/*
   993 	 * care for instances of subclasses ...
   993 	 * care for instances of subclasses ...
   994 	 */
   994 	 */
   995 	if (cls != String) {
   995 	if (cls != String) {
   996 	    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
   996 	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
   997 
   997 
   998 	    cp2 += n;
   998 	    cp2 += n;
   999 	    l2 -= n;
   999 	    l2 -= n;
  1000 	}
  1000 	}
  1001 
  1001 
  1017      not allowed."
  1017      not allowed."
  1018 %{
  1018 %{
  1019     OBJ newSymbol;
  1019     OBJ newSymbol;
  1020 
  1020 
  1021     if (__qClass(self) == String) {
  1021     if (__qClass(self) == String) {
  1022 	newSymbol = _MKSYMBOL(_stringVal(self), (OBJ *)0, __context);
  1022 	newSymbol = __MKSYMBOL(__stringVal(self), (OBJ *)0, __context);
  1023 	if (newSymbol) {
  1023 	if (newSymbol) {
  1024 	    RETURN ( newSymbol);
  1024 	    RETURN ( newSymbol);
  1025 	}
  1025 	}
  1026     }
  1026     }
  1027 %}.
  1027 %}.
  1046 
  1046 
  1047 %{  /* NOCONTEXT */
  1047 %{  /* NOCONTEXT */
  1048     OBJ __SYMBOL_OR_NIL();
  1048     OBJ __SYMBOL_OR_NIL();
  1049 
  1049 
  1050     if (__qClass(self) == String) {
  1050     if (__qClass(self) == String) {
  1051 	RETURN ( __SYMBOL_OR_NIL(_stringVal(self)));
  1051 	RETURN ( __SYMBOL_OR_NIL(__stringVal(self)));
  1052     }
  1052     }
  1053 %}.
  1053 %}.
  1054     self primitiveFailed
  1054     self primitiveFailed
  1055 !
  1055 !
  1056 
  1056 
  1136 	 * get the string
  1136 	 * get the string
  1137 	 */
  1137 	 */
  1138 	sz = OHDR_SIZE + sz + 1;
  1138 	sz = OHDR_SIZE + sz + 1;
  1139 	__qNew(newString, sz, __context);
  1139 	__qNew(newString, sz, __context);
  1140 	if (newString != nil) {
  1140 	if (newString != nil) {
  1141 	    _InstPtr(newString)->o_class = String;
  1141 	    __InstPtr(newString)->o_class = String;
  1142 
  1142 
  1143 	    /*
  1143 	    /*
  1144 	     * expand
  1144 	     * expand
  1145 	     */
  1145 	     */
  1146 	    idx = 1;
  1146 	    idx = 1;
  1190 	 * either same class or both Strings/Symbols:
  1190 	 * either same class or both Strings/Symbols:
  1191 	 */
  1191 	 */
  1192 	if ((myClass == argClass)
  1192 	if ((myClass == argClass)
  1193 	 || (((myClass == _string) || (myClass == Symbol))
  1193 	 || (((myClass == _string) || (myClass == Symbol))
  1194 	     && ((argClass == _string) || (argClass == Symbol)))) {
  1194 	     && ((argClass == _string) || (argClass == Symbol)))) {
  1195 		cp1 = (char *) _stringVal(self);
  1195 		cp1 = (char *) __stringVal(self);
  1196 		l1 = _stringSize(self);
  1196 		l1 = __stringSize(self);
  1197 		if (myClass != _string) {
  1197 		if (myClass != _string) {
  1198 		    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
  1198 		    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
  1199 
  1199 
  1200 		    cp1 += n;
  1200 		    cp1 += n;
  1201 		    l1 -= n;
  1201 		    l1 -= n;
  1202 		}
  1202 		}
  1203 
  1203 
  1204 		cp2 = (char *) _stringVal(s);
  1204 		cp2 = (char *) __stringVal(s);
  1205 		l2 = _stringSize(s);
  1205 		l2 = __stringSize(s);
  1206 		if (argClass != _string) {
  1206 		if (argClass != _string) {
  1207 		    int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(s))->c_ninstvars));
  1207 		    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(s))->c_ninstvars));
  1208 
  1208 
  1209 		    cp2 += n;
  1209 		    cp2 += n;
  1210 		    l2 -= n;
  1210 		    l2 -= n;
  1211 		}
  1211 		}
  1212 
  1212 
  1213 		sz = OHDR_SIZE + l1 + l2 + 1;
  1213 		sz = OHDR_SIZE + l1 + l2 + 1;
  1214 		__qNew(newString, sz, __context);
  1214 		__qNew(newString, sz, __context);
  1215 		if (newString != nil) {
  1215 		if (newString != nil) {
  1216 		    _InstPtr(newString)->o_class = String;
  1216 		    __InstPtr(newString)->o_class = String;
  1217 		    dstp = _stringVal(newString);
  1217 		    dstp = __stringVal(newString);
  1218 		    /*
  1218 		    /*
  1219 		     * refetch in case of a GC
  1219 		     * refetch in case of a GC
  1220 		     */
  1220 		     */
  1221 		    cp1 = (char *) _stringVal(self);
  1221 		    cp1 = (char *) __stringVal(self);
  1222 		    cp2 = (char *) _stringVal(aString);
  1222 		    cp2 = (char *) __stringVal(aString);
  1223 #ifdef FAST_MEMCPY
  1223 #ifdef FAST_MEMCPY
  1224 		    bcopy(cp1, dstp, l1);
  1224 		    bcopy(cp1, dstp, l1);
  1225 		    bcopy(cp2, dstp + l1, l2+1);
  1225 		    bcopy(cp2, dstp + l1, l2+1);
  1226 #else
  1226 #else
  1227 # ifdef FAST_STRCPY
  1227 # ifdef FAST_STRCPY
  1255     REGISTER unsigned char *dstp;
  1255     REGISTER unsigned char *dstp;
  1256 
  1256 
  1257     if ((__isString(self) || __isSymbol(self))
  1257     if ((__isString(self) || __isSymbol(self))
  1258      && (__isString(string1) || __isSymbol(string1))
  1258      && (__isString(string1) || __isSymbol(string1))
  1259      && (__isString(string2) || __isSymbol(string2))) {
  1259      && (__isString(string2) || __isSymbol(string2))) {
  1260 	len1 = _stringSize(self);
  1260 	len1 = __stringSize(self);
  1261 	len2 = _stringSize(string1);
  1261 	len2 = __stringSize(string1);
  1262 	len3 = _stringSize(string2);
  1262 	len3 = __stringSize(string2);
  1263 	sz = OHDR_SIZE + len1 + len2 + len3 + 1;
  1263 	sz = OHDR_SIZE + len1 + len2 + len3 + 1;
  1264 	__qNew(newString, sz, __context);
  1264 	__qNew(newString, sz, __context);
  1265 	if (newString != nil) {
  1265 	if (newString != nil) {
  1266 	    _InstPtr(newString)->o_class = String;
  1266 	    __InstPtr(newString)->o_class = String;
  1267 	    dstp = _stringVal(newString);
  1267 	    dstp = __stringVal(newString);
  1268 #ifdef FAST_MEMCPY
  1268 #ifdef FAST_MEMCPY
  1269 	    bcopy(_stringVal(self), dstp, len1);
  1269 	    bcopy(__stringVal(self), dstp, len1);
  1270 	    bcopy(_stringVal(string1), dstp + len1, len2);
  1270 	    bcopy(__stringVal(string1), dstp + len1, len2);
  1271 	    bcopy(_stringVal(string2), dstp + len1 + len2, len3+1);
  1271 	    bcopy(__stringVal(string2), dstp + len1 + len2, len3+1);
  1272 #else
  1272 #else
  1273 # ifdef FAST_STRCPY
  1273 # ifdef FAST_STRCPY
  1274 	    strcpy(dstp, _stringVal(self));
  1274 	    strcpy(dstp, __stringVal(self));
  1275 	    strcpy(dstp + len1, _stringVal(string1));
  1275 	    strcpy(dstp + len1, __stringVal(string1));
  1276 	    strcpy(dstp + len1 + len2, _stringVal(string2));
  1276 	    strcpy(dstp + len1 + len2, __stringVal(string2));
  1277 # else
  1277 # else
  1278 	    srcp = _stringVal(self);
  1278 	    srcp = __stringVal(self);
  1279 	    while ((*dstp++ = *srcp++) != '\0') ;
  1279 	    while ((*dstp++ = *srcp++) != '\0') ;
  1280 	    dstp--;
  1280 	    dstp--;
  1281 	    srcp = _stringVal(string1);
  1281 	    srcp = __stringVal(string1);
  1282 	    while ((*dstp++ = *srcp++) != '\0') ;
  1282 	    while ((*dstp++ = *srcp++) != '\0') ;
  1283 	    dstp--;
  1283 	    dstp--;
  1284 	    srcp = _stringVal(string2);
  1284 	    srcp = __stringVal(string2);
  1285 	    while ((*dstp++ = *srcp++) != '\0') ;
  1285 	    while ((*dstp++ = *srcp++) != '\0') ;
  1286 # endif
  1286 # endif
  1287 #endif
  1287 #endif
  1288 	    RETURN ( newString );
  1288 	    RETURN ( newString );
  1289 	}
  1289 	}
  1307 
  1307 
  1308     if ((__isString(self) || __isSymbol(self))
  1308     if ((__isString(self) || __isSymbol(self))
  1309      && (__isString(string1) || __isSymbol(string1))
  1309      && (__isString(string1) || __isSymbol(string1))
  1310      && (__isString(string2) || __isSymbol(string2))
  1310      && (__isString(string2) || __isSymbol(string2))
  1311      && (__isString(string3) || __isSymbol(string3))) {
  1311      && (__isString(string3) || __isSymbol(string3))) {
  1312 	len1 = _stringSize(self);
  1312 	len1 = __stringSize(self);
  1313 	len2 = _stringSize(string1);
  1313 	len2 = __stringSize(string1);
  1314 	len3 = _stringSize(string2);
  1314 	len3 = __stringSize(string2);
  1315 	len4 = _stringSize(string3);
  1315 	len4 = __stringSize(string3);
  1316 	sz = OHDR_SIZE + len1 + len2 + len3 + len4 + 1;
  1316 	sz = OHDR_SIZE + len1 + len2 + len3 + len4 + 1;
  1317 	__qNew(newString, sz, __context);
  1317 	__qNew(newString, sz, __context);
  1318 	if (newString != nil) {
  1318 	if (newString != nil) {
  1319 	    _InstPtr(newString)->o_class = String;
  1319 	    __InstPtr(newString)->o_class = String;
  1320 	    dstp = _stringVal(newString);
  1320 	    dstp = __stringVal(newString);
  1321 #ifdef FAST_MEMCPY
  1321 #ifdef FAST_MEMCPY
  1322 	    bcopy(_stringVal(self), dstp, len1);
  1322 	    bcopy(__stringVal(self), dstp, len1);
  1323 	    bcopy(_stringVal(string1), dstp + len1, len2);
  1323 	    bcopy(__stringVal(string1), dstp + len1, len2);
  1324 	    bcopy(_stringVal(string2), dstp + len1 + len2, len3);
  1324 	    bcopy(__stringVal(string2), dstp + len1 + len2, len3);
  1325 	    bcopy(_stringVal(string3), dstp + len1 + len2 + len3, len4+1);
  1325 	    bcopy(__stringVal(string3), dstp + len1 + len2 + len3, len4+1);
  1326 #else
  1326 #else
  1327 # ifdef FAST_STRCPY
  1327 # ifdef FAST_STRCPY
  1328 	    strcpy(dstp, _stringVal(self));
  1328 	    strcpy(dstp, __stringVal(self));
  1329 	    strcpy(dstp + len1, _stringVal(string1));
  1329 	    strcpy(dstp + len1, __stringVal(string1));
  1330 	    strcpy(dstp + len1 + len2, _stringVal(string2));
  1330 	    strcpy(dstp + len1 + len2, __stringVal(string2));
  1331 	    strcpy(dstp + len1 + len2 + len3, _stringVal(string3));
  1331 	    strcpy(dstp + len1 + len2 + len3, __stringVal(string3));
  1332 # else
  1332 # else
  1333 	    srcp = _stringVal(self);
  1333 	    srcp = __stringVal(self);
  1334 	    while ((*dstp++ = *srcp++) != '\0') ;
  1334 	    while ((*dstp++ = *srcp++) != '\0') ;
  1335 	    dstp--;
  1335 	    dstp--;
  1336 	    srcp = _stringVal(string1);
  1336 	    srcp = __stringVal(string1);
  1337 	    while ((*dstp++ = *srcp++) != '\0') ;
  1337 	    while ((*dstp++ = *srcp++) != '\0') ;
  1338 	    dstp--;
  1338 	    dstp--;
  1339 	    srcp = _stringVal(string2);
  1339 	    srcp = __stringVal(string2);
  1340 	    while ((*dstp++ = *srcp++) != '\0') ;
  1340 	    while ((*dstp++ = *srcp++) != '\0') ;
  1341 	    dstp--;
  1341 	    dstp--;
  1342 	    srcp = _stringVal(string3);
  1342 	    srcp = __stringVal(string3);
  1343 	    while ((*dstp++ = *srcp++) != '\0') ;
  1343 	    while ((*dstp++ = *srcp++) != '\0') ;
  1344 # endif
  1344 # endif
  1345 #endif
  1345 #endif
  1346 	    RETURN ( newString );
  1346 	    RETURN ( newString );
  1347 	}
  1347 	}
  1365     REGISTER int count;
  1365     REGISTER int count;
  1366     int len, index1, sz;
  1366     int len, index1, sz;
  1367     OBJ newString;
  1367     OBJ newString;
  1368 
  1368 
  1369     if (__isSmallInteger(start)) {
  1369     if (__isSmallInteger(start)) {
  1370 	len = _stringSize(self);
  1370 	len = __stringSize(self);
  1371 	index1 = _intVal(start);
  1371 	index1 = __intVal(start);
  1372 	if (index1 > 0) {
  1372 	if (index1 > 0) {
  1373 	    if (__qClass(self) != String) {
  1373 	    if (__qClass(self) != String) {
  1374 		int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
  1374 		int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
  1375 
  1375 
  1376 		index1 += n;
  1376 		index1 += n;
  1377 	    }
  1377 	    }
  1378 	    if (index1 <= len) {
  1378 	    if (index1 <= len) {
  1379 		count = len - index1 + 1;
  1379 		count = len - index1 + 1;
  1380 		__PROTECT_CONTEXT__
  1380 		__PROTECT_CONTEXT__
  1381 		sz = OHDR_SIZE + count + 1;
  1381 		sz = OHDR_SIZE + count + 1;
  1382 		__qNew(newString, sz, SENDER);
  1382 		__qNew(newString, sz, SENDER);
  1383 		__UNPROTECT_CONTEXT__
  1383 		__UNPROTECT_CONTEXT__
  1384 		if (newString != nil) {
  1384 		if (newString != nil) {
  1385 		    _InstPtr(newString)->o_class = String;
  1385 		    __InstPtr(newString)->o_class = String;
  1386 		    dstp = _stringVal(newString);
  1386 		    dstp = __stringVal(newString);
  1387 #ifdef FAST_MEMCPY
  1387 #ifdef FAST_MEMCPY
  1388 		    bcopy(_stringVal(self) + index1 - 1, dstp, count);
  1388 		    bcopy(__stringVal(self) + index1 - 1, dstp, count);
  1389 		    dstp[count] = '\0';
  1389 		    dstp[count] = '\0';
  1390 #else
  1390 #else
  1391 # ifdef FAST_STRCPY
  1391 # ifdef FAST_STRCPY
  1392 		    strncpy(dstp, _stringVal(self) + index1 - 1, count);
  1392 		    strncpy(dstp, __stringVal(self) + index1 - 1, count);
  1393 		    dstp[count] = '\0';
  1393 		    dstp[count] = '\0';
  1394 # else
  1394 # else
  1395 		    srcp = _stringVal(self) + index1 - 1;
  1395 		    srcp = __stringVal(self) + index1 - 1;
  1396 		    while (count--) {
  1396 		    while (count--) {
  1397 			*dstp++ = *srcp++;
  1397 			*dstp++ = *srcp++;
  1398 		    }
  1398 		    }
  1399 		    *dstp = '\0';
  1399 		    *dstp = '\0';
  1400 # endif
  1400 # endif
  1426     REGISTER int count;
  1426     REGISTER int count;
  1427     int len, sz, index1, index2;
  1427     int len, sz, index1, index2;
  1428     OBJ newString;
  1428     OBJ newString;
  1429 
  1429 
  1430     if (__bothSmallInteger(start, stop)) {
  1430     if (__bothSmallInteger(start, stop)) {
  1431 	len = _stringSize(self);
  1431 	len = __stringSize(self);
  1432 	index1 = _intVal(start);
  1432 	index1 = __intVal(start);
  1433 	index2 = _intVal(stop);
  1433 	index2 = __intVal(stop);
  1434 
  1434 
  1435 	if ((index1 <= index2) && (index1 > 0)) {
  1435 	if ((index1 <= index2) && (index1 > 0)) {
  1436 	    if (__qClass(self) != String) {
  1436 	    if (__qClass(self) != String) {
  1437 		int n = __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
  1437 		int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
  1438 
  1438 
  1439 		index1 += n;
  1439 		index1 += n;
  1440 		index2 += n;
  1440 		index2 += n;
  1441 	    }
  1441 	    }
  1442 	    if (index2 <= len) {
  1442 	    if (index2 <= len) {
  1444 		__PROTECT_CONTEXT__
  1444 		__PROTECT_CONTEXT__
  1445 		sz = OHDR_SIZE + count + 1;
  1445 		sz = OHDR_SIZE + count + 1;
  1446 		__qNew(newString, sz, SENDER);
  1446 		__qNew(newString, sz, SENDER);
  1447 		__UNPROTECT_CONTEXT__
  1447 		__UNPROTECT_CONTEXT__
  1448 		if (newString != nil) {
  1448 		if (newString != nil) {
  1449 		    _InstPtr(newString)->o_class = String;
  1449 		    __InstPtr(newString)->o_class = String;
  1450 		    dstp = _stringVal(newString);
  1450 		    dstp = __stringVal(newString);
  1451 #ifdef FAST_MEMCPY
  1451 #ifdef FAST_MEMCPY
  1452 		    bcopy(_stringVal(self) + index1 - 1, dstp, count);
  1452 		    bcopy(__stringVal(self) + index1 - 1, dstp, count);
  1453 		    dstp[count] = '\0';
  1453 		    dstp[count] = '\0';
  1454 #else
  1454 #else
  1455 # ifdef FAST_STRCPY
  1455 # ifdef FAST_STRCPY
  1456 		    strncpy(dstp, _stringVal(self) + index1 - 1, count);
  1456 		    strncpy(dstp, __stringVal(self) + index1 - 1, count);
  1457 		    dstp[count] = '\0';
  1457 		    dstp[count] = '\0';
  1458 # else
  1458 # else
  1459 		    srcp = _stringVal(self) + index1 - 1;
  1459 		    srcp = __stringVal(self) + index1 - 1;
  1460 		    while (count--) {
  1460 		    while (count--) {
  1461 			*dstp++ = *srcp++;
  1461 			*dstp++ = *srcp++;
  1462 		    }
  1462 		    }
  1463 		    *dstp = '\0';
  1463 		    *dstp = '\0';
  1464 # endif
  1464 # endif
  1473 	if (index1 > index2) {
  1473 	if (index1 > index2) {
  1474 	    __PROTECT_CONTEXT__
  1474 	    __PROTECT_CONTEXT__
  1475 	    __qNew(newString, OHDR_SIZE+1, SENDER);
  1475 	    __qNew(newString, OHDR_SIZE+1, SENDER);
  1476 	    __UNPROTECT_CONTEXT__
  1476 	    __UNPROTECT_CONTEXT__
  1477 	    if (newString != nil) {
  1477 	    if (newString != nil) {
  1478 		_InstPtr(newString)->o_class = String;
  1478 		__InstPtr(newString)->o_class = String;
  1479 		__stringVal(newString)[0] = '\0';
  1479 		__stringVal(newString)[0] = '\0';
  1480 		RETURN ( newString );
  1480 		RETURN ( newString );
  1481 	    }
  1481 	    }
  1482 	}
  1482 	}
  1483     }
  1483     }
  1503     OBJ cls, newString;
  1503     OBJ cls, newString;
  1504 
  1504 
  1505     if (__isCharacter(aCharacter)) {
  1505     if (__isCharacter(aCharacter)) {
  1506 	sz = __qSize(self) + 1;
  1506 	sz = __qSize(self) + 1;
  1507 	if ((cls = __qClass(self)) != String) {
  1507 	if ((cls = __qClass(self)) != String) {
  1508 	    offs = __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
  1508 	    offs = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  1509 	    sz -= offs;
  1509 	    sz -= offs;
  1510 	} else
  1510 	} else
  1511 	    offs = 0;
  1511 	    offs = 0;
  1512 
  1512 
  1513 	__PROTECT_CONTEXT__
  1513 	__PROTECT_CONTEXT__
  1514 	__qNew(newString, sz, SENDER);
  1514 	__qNew(newString, sz, SENDER);
  1515 	__UNPROTECT_CONTEXT__
  1515 	__UNPROTECT_CONTEXT__
  1516 	if (newString) {
  1516 	if (newString) {
  1517 	    _InstPtr(newString)->o_class = String;
  1517 	    __InstPtr(newString)->o_class = String;
  1518 	    dstp = _stringVal(newString);
  1518 	    dstp = __stringVal(newString);
  1519 #ifdef FAST_MEMCPY
  1519 #ifdef FAST_MEMCPY
  1520 	    sz = sz - OHDR_SIZE - 1 - 1;
  1520 	    sz = sz - OHDR_SIZE - 1 - 1;
  1521 	    bcopy(_stringVal(self) + offs, dstp, sz);
  1521 	    bcopy(__stringVal(self) + offs, dstp, sz);
  1522 	    dstp += sz;
  1522 	    dstp += sz;
  1523 #else
  1523 #else
  1524 # ifdef FAST_STRCPY
  1524 # ifdef FAST_STRCPY
  1525 	    strcpy(dstp, _stringVal(self) + offs);
  1525 	    strcpy(dstp, __stringVal(self) + offs);
  1526 	    dstp += sz - OHDR_SIZE - 1 - 1;
  1526 	    dstp += sz - OHDR_SIZE - 1 - 1;
  1527 # else
  1527 # else
  1528 	    {
  1528 	    {
  1529 		REGISTER unsigned char *srcp;
  1529 		REGISTER unsigned char *srcp;
  1530 
  1530 
  1531 		srcp = _stringVal(self) + offs;
  1531 		srcp = __stringVal(self) + offs;
  1532 		while ((*dstp = *srcp++) != '\0')
  1532 		while ((*dstp = *srcp++) != '\0')
  1533 		    dstp++;
  1533 		    dstp++;
  1534 	    }
  1534 	    }
  1535 # endif
  1535 # endif
  1536 #endif
  1536 #endif
  1537 	    *dstp++ = _intVal(_characterVal(aCharacter));
  1537 	    *dstp++ = __intVal(_characterVal(aCharacter));
  1538 	    *dstp = '\0';
  1538 	    *dstp = '\0';
  1539 	    RETURN (newString );
  1539 	    RETURN (newString );
  1540 	}
  1540 	}
  1541     }
  1541     }
  1542 %}.
  1542 %}.
  1607     REGISTER int l;
  1607     REGISTER int l;
  1608 #endif
  1608 #endif
  1609     REGISTER int byteValue;
  1609     REGISTER int byteValue;
  1610 
  1610 
  1611     if (__isCharacter(aCharacter) && __isString(self)) {
  1611     if (__isCharacter(aCharacter) && __isString(self)) {
  1612 	byteValue = _intVal(_characterVal(aCharacter));
  1612 	byteValue = __intVal(_characterVal(aCharacter));
  1613 #ifdef FAST_MEMSET
  1613 #ifdef FAST_MEMSET
  1614 	memset(_stringVal(self), byteValue, __qSize(self) - OHDR_SIZE - 1);
  1614 	memset(__stringVal(self), byteValue, __qSize(self) - OHDR_SIZE - 1);
  1615 #else
  1615 #else
  1616 	dst = _stringVal(self);
  1616 	dst = __stringVal(self);
  1617 	l = __qSize(self) - OHDR_SIZE - 1;
  1617 	l = __qSize(self) - OHDR_SIZE - 1;
  1618 	while (l >= 8) {
  1618 	while (l >= 8) {
  1619 	    dst[0] = dst[1] = dst[2] = dst[3] = byteValue;
  1619 	    dst[0] = dst[1] = dst[2] = dst[3] = byteValue;
  1620 	    dst[4] = dst[5] = dst[6] = dst[7] = byteValue;
  1620 	    dst[4] = dst[5] = dst[6] = dst[7] = byteValue;
  1621 	    dst += 8;
  1621 	    dst += 8;
  1645     REGISTER unsigned oldVal, newVal;
  1645     REGISTER unsigned oldVal, newVal;
  1646 
  1646 
  1647     if (__isCharacter(oldCharacter)
  1647     if (__isCharacter(oldCharacter)
  1648      && __isCharacter(newCharacter)
  1648      && __isCharacter(newCharacter)
  1649      && __isString(self)) {
  1649      && __isString(self)) {
  1650 	srcp = (unsigned char *)_stringVal(self);
  1650 	srcp = (unsigned char *)__stringVal(self);
  1651 	oldVal = _intVal(_characterVal(oldCharacter));
  1651 	oldVal = __intVal(_characterVal(oldCharacter));
  1652 	newVal = _intVal(_characterVal(newCharacter));
  1652 	newVal = __intVal(_characterVal(newCharacter));
  1653 	while (*srcp) {
  1653 	while (*srcp) {
  1654 	    if (*srcp == oldVal)
  1654 	    if (*srcp == oldVal)
  1655 		*srcp = newVal;
  1655 		*srcp = newVal;
  1656 	    srcp++;
  1656 	    srcp++;
  1657 	}
  1657 	}
  1680     int repLen, repIndex;
  1680     int repLen, repIndex;
  1681 
  1681 
  1682     if ((__isString(aString) || __isSymbol(aString))
  1682     if ((__isString(aString) || __isSymbol(aString))
  1683      && __isString(self)
  1683      && __isString(self)
  1684      && __bothSmallInteger(start, stop)) {
  1684      && __bothSmallInteger(start, stop)) {
  1685 	len = _stringSize(self);
  1685 	len = __stringSize(self);
  1686 	index1 = _intVal(start);
  1686 	index1 = __intVal(start);
  1687 	index2 = _intVal(stop);
  1687 	index2 = __intVal(stop);
  1688 	count = index2 - index1 + 1;
  1688 	count = index2 - index1 + 1;
  1689 	if (count <= 0) {
  1689 	if (count <= 0) {
  1690 	     RETURN (self);
  1690 	     RETURN (self);
  1691 	}
  1691 	}
  1692 	if ((index2 <= len) && (index1 > 0)) {
  1692 	if ((index2 <= len) && (index1 > 0)) {
  1693 	    repLen = _stringSize(aString);
  1693 	    repLen = __stringSize(aString);
  1694 	    repIndex = _intVal(repStart);
  1694 	    repIndex = __intVal(repStart);
  1695 	    if ((repIndex > 0) && ((repIndex + count - 1) <= repLen)) {
  1695 	    if ((repIndex > 0) && ((repIndex + count - 1) <= repLen)) {
  1696 		srcp = _stringVal(aString) + repIndex - 1;
  1696 		srcp = __stringVal(aString) + repIndex - 1;
  1697 		dstp = _stringVal(self) + index1 - 1;
  1697 		dstp = __stringVal(self) + index1 - 1;
  1698 		if (aString == self) {
  1698 		if (aString == self) {
  1699 		    /* take care of overlapping copy */
  1699 		    /* take care of overlapping copy */
  1700 		    if (srcp < dstp) {
  1700 		    if (srcp < dstp) {
  1701 			/* must do a reverse copy */
  1701 			/* must do a reverse copy */
  1702 			srcp += count;
  1702 			srcp += count;
  1732 
  1732 
  1733     REGISTER char c;
  1733     REGISTER char c;
  1734     REGISTER unsigned char *hip, *lowp;
  1734     REGISTER unsigned char *hip, *lowp;
  1735 
  1735 
  1736     if (__isString(self)) {
  1736     if (__isString(self)) {
  1737 	lowp = _stringVal(self);
  1737 	lowp = __stringVal(self);
  1738 	hip = lowp + _stringSize(self) - 1;
  1738 	hip = lowp + __stringSize(self) - 1;
  1739 	while (lowp < hip) {
  1739 	while (lowp < hip) {
  1740 	    c = *lowp;
  1740 	    c = *lowp;
  1741 	    *lowp = *hip;
  1741 	    *lowp = *hip;
  1742 	    *hip = c;
  1742 	    *hip = c;
  1743 	    lowp++;
  1743 	    lowp++;
  1764     REGISTER unsigned char *cp;
  1764     REGISTER unsigned char *cp;
  1765     REGISTER unsigned char c;
  1765     REGISTER unsigned char c;
  1766 
  1766 
  1767     /* ignore instances of subclasses ... */
  1767     /* ignore instances of subclasses ... */
  1768     if (__qClass(self) == String) {
  1768     if (__qClass(self) == String) {
  1769 	cp = cp0 = _stringVal(self);
  1769 	cp = cp0 = __stringVal(self);
  1770 	while ((c = *cp)
  1770 	while ((c = *cp)
  1771 #ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
  1771 #ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
  1772 	 && (c <= ' ')
  1772 	 && (c <= ' ')
  1773 #endif
  1773 #endif
  1774 	 && ((c == ' ') || (c == '\n') || (c == '\t')
  1774 	 && ((c == ' ') || (c == '\n') || (c == '\t')
  1775 			|| (c == '\r') || (c == '\f'))
  1775 			|| (c == '\r') || (c == '\f'))
  1776 	) {
  1776 	) {
  1777 	    cp++;
  1777 	    cp++;
  1778 	}
  1778 	}
  1779 	startIndex = _MKSMALLINT(cp - cp0 + 1);
  1779 	startIndex = __MKSMALLINT(cp - cp0 + 1);
  1780 	cp = cp + strlen(cp) - 1;
  1780 	cp = cp + strlen(cp) - 1;
  1781 	while ((cp >= cp0) && (*cp == ' ')) cp--;
  1781 	while ((cp >= cp0) && (*cp == ' ')) cp--;
  1782 	c = *cp;
  1782 	c = *cp;
  1783 	while ((cp >= cp0) &&
  1783 	while ((cp >= cp0) &&
  1784 #ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
  1784 #ifndef NON_ASCII       /* i.e. EBCDIC ;-) */
  1787 	       ((c == ' ') || (c == '\n') || (c == '\t')
  1787 	       ((c == ' ') || (c == '\n') || (c == '\t')
  1788 			   || (c == '\r') || (c == '\f'))) {
  1788 			   || (c == '\r') || (c == '\f'))) {
  1789 	    cp--;
  1789 	    cp--;
  1790 	    c = *cp;
  1790 	    c = *cp;
  1791 	}
  1791 	}
  1792 	endIndex = _MKSMALLINT(cp - cp0 + 1);
  1792 	endIndex = __MKSMALLINT(cp - cp0 + 1);
  1793     }
  1793     }
  1794 %}.
  1794 %}.
  1795     startIndex == 0 ifTrue:[^ super withoutSeparators].
  1795     startIndex == 0 ifTrue:[^ super withoutSeparators].
  1796 
  1796 
  1797     startIndex > endIndex ifTrue:[^ ''].
  1797     startIndex > endIndex ifTrue:[^ ''].
  1812     REGISTER unsigned char *cp0;
  1812     REGISTER unsigned char *cp0;
  1813     REGISTER unsigned char *cp;
  1813     REGISTER unsigned char *cp;
  1814 
  1814 
  1815     /* ignore instances of subclasses ... */
  1815     /* ignore instances of subclasses ... */
  1816     if (__qClass(self) == String) {
  1816     if (__qClass(self) == String) {
  1817 	cp = cp0 = _stringVal(self);
  1817 	cp = cp0 = __stringVal(self);
  1818 	while (*cp == ' ') cp++;
  1818 	while (*cp == ' ') cp++;
  1819 	startIndex = _MKSMALLINT(cp - cp0 + 1);
  1819 	startIndex = __MKSMALLINT(cp - cp0 + 1);
  1820 	cp = cp + strlen(cp) - 1;
  1820 	cp = cp + strlen(cp) - 1;
  1821 	while ((cp >= cp0) && (*cp == ' ')) cp--;
  1821 	while ((cp >= cp0) && (*cp == ' ')) cp--;
  1822 	endIndex = _MKSMALLINT(cp - cp0 + 1);
  1822 	endIndex = __MKSMALLINT(cp - cp0 + 1);
  1823     }
  1823     }
  1824 %}.
  1824 %}.
  1825     startIndex == 0 ifTrue:[^ super withoutSpaces].
  1825     startIndex == 0 ifTrue:[^ super withoutSpaces].
  1826 
  1826 
  1827     startIndex > endIndex ifTrue:[^ ''].
  1827     startIndex > endIndex ifTrue:[^ ''].
  1846 	len2 = __qSize(aString);
  1846 	len2 = __qSize(aString);
  1847 	if (len1 < len2) {
  1847 	if (len1 < len2) {
  1848 	    RETURN ( false );
  1848 	    RETURN ( false );
  1849 	}
  1849 	}
  1850 
  1850 
  1851 	src1 = _stringVal(self) + len1 - len2;
  1851 	src1 = __stringVal(self) + len1 - len2;
  1852 	src2 = _stringVal(aString);
  1852 	src2 = __stringVal(aString);
  1853 	while (c = *src2++) {
  1853 	while (c = *src2++) {
  1854 	    if (c != *src1++) {
  1854 	    if (c != *src1++) {
  1855 		RETURN ( false );
  1855 		RETURN ( false );
  1856 	    }
  1856 	    }
  1857 	}
  1857 	}
  1887 	len2 = __qSize(aString);
  1887 	len2 = __qSize(aString);
  1888 	if (len1 < len2) {
  1888 	if (len1 < len2) {
  1889 	    RETURN ( false );
  1889 	    RETURN ( false );
  1890 	}
  1890 	}
  1891 
  1891 
  1892 	src1 = _stringVal(self);
  1892 	src1 = __stringVal(self);
  1893 	src2 = _stringVal(aString);
  1893 	src2 = __stringVal(aString);
  1894 	while (c = *src2++) {
  1894 	while (c = *src2++) {
  1895 	    if (c != *src1++) {
  1895 	    if (c != *src1++) {
  1896 		RETURN ( false );
  1896 		RETURN ( false );
  1897 	    }
  1897 	    }
  1898 	}
  1898 	}
  1928      even in case of emergency."
  1928      even in case of emergency."
  1929 
  1929 
  1930 %{  /* NOCONTEXT */
  1930 %{  /* NOCONTEXT */
  1931 
  1931 
  1932     if (__qClass(self) == String) {
  1932     if (__qClass(self) == String) {
  1933 	fputs(_stringVal(self), stdout); fflush(stdout);
  1933 	fputs(__stringVal(self), stdout); fflush(stdout);
  1934 	RETURN (self);
  1934 	RETURN (self);
  1935     }
  1935     }
  1936 %}
  1936 %}
  1937 .
  1937 .
  1938     ^ super print
  1938     ^ super print
  1957 	 * actually only needed on sparc: since thisContext is
  1957 	 * actually only needed on sparc: since thisContext is
  1958 	 * in a global register, which gets destroyed by printf,
  1958 	 * in a global register, which gets destroyed by printf,
  1959 	 * manually save it here - very stupid ...
  1959 	 * manually save it here - very stupid ...
  1960 	 */
  1960 	 */
  1961 
  1961 
  1962 	cp = (char *)_stringVal(self);
  1962 	cp = (char *)__stringVal(self);
  1963 	if (__qClass(self) != String)
  1963 	if (__qClass(self) != String)
  1964 	    cp += __OBJS2BYTES__(_intVal(_ClassInstPtr(__qClass(self))->c_ninstvars));
  1964 	    cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
  1965 
  1965 
  1966 	__BEGIN_PROTECT_REGISTERS__
  1966 	__BEGIN_PROTECT_REGISTERS__
  1967 
  1967 
  1968 	sprintf(buffer, (char *)_stringVal(formatString), cp);
  1968 	sprintf(buffer, (char *)__stringVal(formatString), cp);
  1969 
  1969 
  1970 	__END_PROTECT_REGISTERS__
  1970 	__END_PROTECT_REGISTERS__
  1971 
  1971 
  1972 	s = __MKSTRING(buffer COMMA_SND);
  1972 	s = __MKSTRING(buffer COMMA_SND);
  1973 	if (s != nil) {
  1973 	if (s != nil) {
  2042 %{  /* NOCONTEXT */
  2042 %{  /* NOCONTEXT */
  2043     OBJ cls;
  2043     OBJ cls;
  2044 
  2044 
  2045     cls = __qClass(self);
  2045     cls = __qClass(self);
  2046     if ((cls == String) || (cls == Symbol)) {
  2046     if ((cls == String) || (cls == Symbol)) {
  2047 	RETURN ( (_stringSize(self) == 0) ? true : false);
  2047 	RETURN ( (__stringSize(self) == 0) ? true : false);
  2048     }
  2048     }
  2049 %}
  2049 %}
  2050 .
  2050 .
  2051     ^ super isEmpty
  2051     ^ super isEmpty
  2052 !
  2052 !
  2054 knownAsSymbol
  2054 knownAsSymbol
  2055     "return true, if there is a symbol with same characters in the
  2055     "return true, if there is a symbol with same characters in the
  2056      system - use to check for existance of a symbol without creating one"
  2056      system - use to check for existance of a symbol without creating one"
  2057 
  2057 
  2058 %{  /* NOCONTEXT */
  2058 %{  /* NOCONTEXT */
  2059     RETURN ( __KNOWNASSYMBOL(_stringVal(self)) );
  2059     RETURN ( __KNOWNASSYMBOL(__stringVal(self)) );
  2060 %}
  2060 %}
  2061 ! !
  2061 ! !
  2062 
  2062 
  2063 !String methodsFor:'testing'!
  2063 !String methodsFor:'testing'!
  2064 
  2064 
  2070 
  2070 
  2071     REGISTER unsigned char *src;
  2071     REGISTER unsigned char *src;
  2072     REGISTER unsigned char c;
  2072     REGISTER unsigned char c;
  2073     OBJ cls;
  2073     OBJ cls;
  2074 
  2074 
  2075     src = _stringVal(self);
  2075     src = __stringVal(self);
  2076     if ((cls = __qClass(self)) != String)
  2076     if ((cls = __qClass(self)) != String)
  2077 	src += __OBJS2BYTES__(_intVal(_ClassInstPtr(cls)->c_ninstvars));
  2077 	src += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  2078 
  2078 
  2079 #ifndef NON_ASCII
  2079 #ifndef NON_ASCII
  2080     while (*((unsigned *)src) == 0x20202020) {
  2080     while (*((unsigned *)src) == 0x20202020) {
  2081 	src += 4;
  2081 	src += 4;
  2082     }
  2082     }
  2115 
  2115 
  2116     if ((__isString(self) || __isSymbol(self))
  2116     if ((__isString(self) || __isSymbol(self))
  2117      && (__isString(aString) || __isSymbol(aString))
  2117      && (__isString(aString) || __isSymbol(aString))
  2118      && __bothSmallInteger(insrtWeight, caseWeight)
  2118      && __bothSmallInteger(insrtWeight, caseWeight)
  2119      && __bothSmallInteger(substWeight, deleteWeight)) {
  2119      && __bothSmallInteger(substWeight, deleteWeight)) {
  2120 	iW = _intVal(insrtWeight);
  2120 	iW = __intVal(insrtWeight);
  2121 	cW = _intVal(caseWeight);
  2121 	cW = __intVal(caseWeight);
  2122 	sW = _intVal(substWeight);
  2122 	sW = __intVal(substWeight);
  2123 	dW = _intVal(deleteWeight);
  2123 	dW = __intVal(deleteWeight);
  2124 	s1 = _stringVal(self);
  2124 	s1 = __stringVal(self);
  2125 	s2 = _stringVal(aString);
  2125 	s2 = __stringVal(aString);
  2126 	l1 = strlen(s1);
  2126 	l1 = strlen(s1);
  2127 	l2 = strlen(s2);
  2127 	l2 = strlen(s2);
  2128 
  2128 
  2129 	sz = (l1 < l2) ? l2 : l1;
  2129 	sz = (l1 < l2) ? l2 : l1;
  2130 	delta = sz + 1;
  2130 	delta = sz + 1;
  2173 	    }
  2173 	    }
  2174 	}
  2174 	}
  2175 	m = data[l1 * delta + l2];
  2175 	m = data[l1 * delta + l2];
  2176 	if (sz > FASTSIZE) 
  2176 	if (sz > FASTSIZE) 
  2177 	    free(data);
  2177 	    free(data);
  2178 	RETURN ( _MKSMALLINT(m) );
  2178 	RETURN ( __MKSMALLINT(m) );
  2179     }
  2179     }
  2180 mallocFailed: ;
  2180 mallocFailed: ;
  2181 }
  2181 }
  2182 %}.
  2182 %}.
  2183 
  2183 
  2193 ! !
  2193 ! !
  2194 
  2194 
  2195 !String class methodsFor:'documentation'!
  2195 !String class methodsFor:'documentation'!
  2196 
  2196 
  2197 version
  2197 version
  2198     ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.65 1996-02-26 13:13:34 cg Exp $'
  2198     ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.66 1996-04-02 22:08:52 cg Exp $'
  2199 ! !
  2199 ! !