--- a/String.st Thu Jul 05 11:45:05 2012 +0100
+++ b/String.st Wed Jul 18 17:55:48 2012 +0100
@@ -11,7 +11,7 @@
"
"{ Package: 'stx:libbasic' }"
-CharacterArray variableByteSubclass:#String
+CharacterArray subclass:#String
instanceVariableNames:''
classVariableNames:'CRLF LF'
poolDictionaries:''
@@ -44,55 +44,6 @@
%}
! !
-!String primitiveFunctions!
-%{
-
-static int
-nextOnKeyboard(char1, char2)
-{
- /* compare two characters if they are next to each other on a (US-) keyboard */
-
- static char *us_keys[] = { "1234567890-",
- "*qwertyuiop",
- "**asdfghjkl:",
- "***zxcvbnm",
- 0 };
- static char *de_keys[] = { "1234567890-",
- "*qwertzuiop",
- "**asdfghjkl:",
- "***yxcvbnm",
- 0 };
- char **keys = us_keys;
- char **line1, **line2;
- char *col1, *col2;
- int diff;
-
- for (line1 = keys; *line1 != 0; line1++) {
- for (col1 = *line1; *col1 != 0 && *col1 != char1; col1++)
- continue;
- }
- if (*col1 == 0)
- return(0);
-
- for (line2 = keys; *line2 != 0; line2++) {
- for (col2 = *line2; *col2 != 0 && *col2 != char2; col2++)
- continue;
- }
- if (*col2 == 0)
- return(0);
-
- diff = col1 - col2;
- if (diff > 1 || diff < -1)
- return(0);
-
- diff = line1 - line2;
- if (diff > 1 || diff < -1)
- return(0);
- return(1);
-}
-%}
-! !
-
!String class methodsFor:'documentation'!
copyright
@@ -487,8 +438,6 @@
^ Character tab asString
! !
-
-
!String class methodsFor:'queries'!
defaultPlatformClass
@@ -508,12 +457,6 @@
"Modified: 23.4.1996 / 16:00:38 / cg"
! !
-
-
-
-
-
-
!String methodsFor:'Compatibility-VW5.4'!
asGUID
@@ -707,7 +650,6 @@
"
! !
-
!String methodsFor:'character searching'!
identityIndexOf:aCharacter
@@ -2639,7 +2581,6 @@
^ super simpleDeepCopy
! !
-
!String methodsFor:'filling & replacing'!
atAllPut:aCharacter
@@ -3035,6 +2976,42 @@
!String methodsFor:'printing & storing'!
+errorPrint
+ "print the receiver on standard output.
+ This method does NOT (by purpose) use the stream classes and
+ will therefore work even in case of emergency (but only, if Stdout is nil)."
+
+%{ /* NOCONTEXT */
+
+ if (__isStringLike(self) == String) {
+ if (@global(Stderr) == nil) {
+ console_fprintf(stderr, "%s" , __stringVal(self));
+ console_fflush(stderr);
+ RETURN (self);
+ }
+ }
+%}.
+ ^ super errorPrint
+!
+
+errorPrintCR
+ "print the receiver on standard output, followed by a cr.
+ This method does NOT (by purpose) use the stream classes and
+ will therefore work even in case of emergency (but only, if Stdout is nil)."
+
+%{ /* NOCONTEXT */
+
+ if (__isStringLike(self) == String) {
+ if (@global(Stderr) == nil) {
+ console_fprintf(stderr, "%s\n" , __stringVal(self));
+ console_fflush(stderr);
+ RETURN (self);
+ }
+ }
+%}.
+ ^ super errorPrintCR
+!
+
print
"print the receiver on standard output.
This method does NOT (by purpose) use the stream classes and
@@ -3042,12 +3019,12 @@
%{ /* NOCONTEXT */
- if (__qClass(self) == String) {
- if (@global(Stdout) == nil) {
- console_fprintf(stdout, "%s" , __stringVal(self));
- console_fflush(stdout);
- RETURN (self);
- }
+ if (__isStringLike(self)) {
+ if (@global(Stdout) == nil) {
+ console_fprintf(stdout, "%s" , __stringVal(self));
+ console_fflush(stdout);
+ RETURN (self);
+ }
}
%}.
^ super print
@@ -3060,12 +3037,12 @@
%{ /* NOCONTEXT */
- if (__qClass(self) == String) {
- if (@global(Stdout) == nil) {
- console_fprintf(stdout, "%s\n" , __stringVal(self));
- console_fflush(stdout);
- RETURN (self);
- }
+ if (__isStringLike(self)) {
+ if (@global(Stdout) == nil) {
+ console_fprintf(stdout, "%s\n" , __stringVal(self));
+ console_fflush(stdout);
+ RETURN (self);
+ }
}
%}.
^ super printCR
@@ -3310,7 +3287,6 @@
^ String
! !
-
!String methodsFor:'sorting & reordering'!
reverse
@@ -3341,7 +3317,6 @@
^ super reverse
! !
-
!String methodsFor:'substring searching'!
indexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue caseSensitive:caseSensitive
@@ -3805,10 +3780,9 @@
!String class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.282 2012/06/05 12:16:22 vrany Exp $'
-
+ ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.285 2012/07/11 17:07:34 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.282 2012/06/05 12:16:22 vrany Exp $'
+ ^ '§Header: /cvs/stx/stx/libbasic/String.st,v 1.285 2012/07/11 17:07:34 stefan Exp §'
! !