--- a/String.st Fri Apr 24 14:17:11 2015 +0200
+++ b/String.st Sun Apr 26 13:18:39 2015 +0200
@@ -598,7 +598,7 @@
if (index.isSmallInteger()) {
int idx1Based = index.intValue(); // st index is 1 based
- self.basicAt_put_(idx1Based, aCharacter );
+ self.basicAt_put(idx1Based, aCharacter );
return context.RETURN( aCharacter );
}
#else
@@ -673,7 +673,7 @@
if (index.isSmallInteger()) {
int idx1Based = index.intValue(); // st index is 1 based
- self.basicAt_put_(idx1Based, aCharacter );
+ self.basicAt_put(idx1Based, aCharacter );
return context.RETURN( aCharacter );
}
#else
@@ -2276,7 +2276,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- return context._RETURN( self.asSTSymbol() );
+ return context._RETURN( STSymbol._new(self.asString()) );
#else
OBJ newSymbol;
OBJ cls;
@@ -2467,6 +2467,19 @@
- reimplemented here for speed"
%{
+#ifdef __SCHTEAM__
+ if ( aString.isStringLike() && self.isStringLike() ) {
+ STString me = self.asSTString();
+ STString other = aString.asSTString();
+ int myLength = me.characters.length;
+ int otherLength = other.characters.length;
+
+ char[] newChars = new char[myLength + otherLength];
+ System.arraycopy(me.characters, 0, newChars, 0, myLength);
+ System.arraycopy(other.characters, 0, newChars, myLength, otherLength);
+ return context._RETURN( new STString( newChars ));
+ }
+#else
int l1, l2, sz;
OBJ newString;
@@ -2540,6 +2553,7 @@
}
}
}
+#endif /* not SCHTEAM */
%}.
^ super , aString
@@ -3106,13 +3120,39 @@
- reimplemented here for speed"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if ( aString.isStringLike()
+ && self.isStringLike()
+ && start.isSmallInteger()
+ && stop.isSmallInteger()
+ && repStart.isSmallInteger()) {
+ STString me = self.asSTString();
+ STString other = aString.asSTString();
+ int _start = start.intValue() - 1;
+ int _stop = stop.intValue() - 1;
+ int _repStart = repStart.intValue() - 1;
+ int mySize = me.characters.length;
+ int otherSize = other.characters.length;
+ int count = _stop - _start + 1;
+
+ if (_start >= 0
+ && _repStart >= 0
+ && _stop < mySize
+ && (_repStart + count) <= otherSize) {
+ if (count > 0) {
+ System.arraycopy(other.characters, _repStart, me.characters, _start, count);
+ }
+ return context._RETURN(self);
+ }
+ }
+#else
REGISTER unsigned char *srcp, *dstp;
REGISTER int count;
int len, index1, index2;
int repLen, repIndex;
-#ifndef NO_PRIM_STRING
+# ifndef NO_PRIM_STRING
if (__isStringLike(aString)
&& __isString(self)
&& __bothSmallInteger(start, stop)) {
@@ -3141,7 +3181,7 @@
RETURN (self);
}
}
-#ifdef bcopy4
+# ifdef bcopy4
/* copy quadbytes if pointers are aligned */
/*
* no sizeof(int) here please -
@@ -3162,10 +3202,10 @@
while (count-- > 0) {
*dstp++ = *srcp++;
}
-#else
-# ifdef FAST_MEMCPY
+# else
+# ifdef FAST_MEMCPY
bcopy(srcp, dstp, count);
-# else
+# else
/* copy longs if pointers are aligned */
if ((((unsigned INT)srcp & (sizeof(INT)-1)) == 0)
&& (((unsigned INT)dstp & (sizeof(INT)-1)) == 0)) {
@@ -3179,13 +3219,14 @@
while (count-- > 0) {
*dstp++ = *srcp++;
}
-# endif
-#endif
+# endif
+# endif
RETURN (self);
}
}
}
-#endif
+# endif
+#endif /* not SCHTEAM */
%}.
^ super replaceFrom:start to:stop with:aString startingAt:repStart
!
@@ -3371,7 +3412,14 @@
(but only, as long as Stderr is nil, which is set later after startup)."
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (@global(Stderr) == STObject.Nil) {
+ if (self.isStringLike()) {
+ System.err.print(self.asString());
+ return context._RETURN(self);
+ }
+ }
+#else
if (@global(Stderr) == nil) {
if (__qIsStringLike(self)) {
console_fprintf(stderr, "%s" , __stringVal(self));
@@ -3379,6 +3427,7 @@
RETURN (self);
}
}
+#endif /* not SCHTEAM */
%}.
super errorPrint
@@ -3399,7 +3448,14 @@
(but only, as long as Stderr is nil, which is set later after startup)."
%{ /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+ if (@global(Stderr) == STObject.Nil) {
+ if (self.isStringLike()) {
+ System.err.println(self.asString());
+ return context._RETURN(self);
+ }
+ }
+#else
if (@global(Stderr) == nil) {
if (__qIsStringLike(self)) {
console_fprintf(stderr, "%s\n" , __stringVal(self));
@@ -3407,6 +3463,7 @@
RETURN (self);
}
}
+#endif
%}.
super errorPrintCR
!
@@ -3421,7 +3478,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- if (Smalltalk.getBindingOrNull(STSymbol._new("Stdout")) == null) {
+ if (SmalltalkEnvironment.getBindingOrNull(STSymbol._new("Stdout")) == null) {
System.out.print(self.toString());
return context._RETURN(self);
}
@@ -3448,7 +3505,7 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
- if (Smalltalk.getBindingOrNull(STSymbol._new("Stdout")) == null) {
+ if (SmalltalkEnvironment.getBindingOrNull(STSymbol._new("Stdout")) == null) {
System.out.println(self.toString());
return context._RETURN(self);
}
@@ -4253,9 +4310,9 @@
!String class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.335 2015-04-20 10:48:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.336 2015-04-26 11:18:39 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.335 2015-04-20 10:48:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.336 2015-04-26 11:18:39 cg Exp $'
! !