Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 06 Jul 2015 06:06:17 +0100
branchjv
changeset 18556 2c67b0fa6ff5
parent 18555 7cc0ec139c8d (current diff)
parent 18554 ead4614d7aaa (diff)
child 18561 73656aba2c89
Merge
ObjectCoder.st
SmalltalkChunkFileSourceWriter.st
String.st
--- a/ObjectCoder.st	Sat Jul 04 11:52:42 2015 +0100
+++ b/ObjectCoder.st	Mon Jul 06 06:06:17 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2000 by eXept Software AG
               All Rights Reserved
@@ -11,6 +13,8 @@
 "
 "{ Package: 'stx:libbasic' }"
 
+"{ NameSpace: Smalltalk }"
+
 AspectVisitor subclass:#ObjectCoder
 	instanceVariableNames:'stream'
 	classVariableNames:''
@@ -104,19 +108,11 @@
 !
 
 encode:anObject on:aStream
-
-    |coder|
-
-    coder := self new stream:aStream.
-    anObject acceptVisitor:coder with:nil.
+    self encode:anObject on:aStream with:nil
 !
 
 encode:anObject on:aStream with:info
-
-    |coder|
-
-    coder := self new stream:aStream.
-    anObject acceptVisitor:coder with:info.
+    self new encode:anObject on:aStream with:info
 !
 
 encode:anObject with:aParameter
@@ -142,7 +138,7 @@
 
     <resource: #obsolete>
 
-    ^ self new encodingOf:anObject with:aParameter
+    ^ self encode:anObject with:aParameter
 ! !
 
 !ObjectCoder methodsFor:'accessing'!
@@ -165,6 +161,17 @@
 
 !ObjectCoder methodsFor:'encoding'!
 
+encode:anObject on:aStream 
+    self encode:anObject on:aStream with:nil
+!
+
+encode:anObject on:aStream with:info
+    self stream:aStream.
+    self startEncoding.
+    anObject acceptVisitor:self with:info.
+    self endEncoding.
+!
+
 encodingOf:anObject
     "answer the encoded argument anObject"
 
@@ -181,12 +188,19 @@
     ] ifFalse:[
         stream reset.
     ].
-
+    self startEncoding.
     anObject acceptVisitor:self with:aParameter.
+    self endEncoding.
 
     ^ stream contents.
 !
 
+endEncoding
+    "redefinable - allows subclass to create a file trailer or similar stuff"
+
+    "/ intentionally left blank here
+!
+
 nextPut:anObject
     "encode anObject onto my stream"
 
@@ -206,6 +220,12 @@
         self nextPut:o
     ]
 
+!
+
+startEncoding
+    "redefinable - allows subclass to create a file header or similar stuff"
+
+    "/ intentionally left blank here
 ! !
 
 !ObjectCoder methodsFor:'encoding-smalltalk types'!
@@ -261,5 +281,10 @@
 !ObjectCoder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ObjectCoder.st,v 1.17 2012-01-12 12:57:07 cg Exp $'
+    ^ '$Header$'
+!
+
+version_CVS
+    ^ '$Header$'
 ! !
+
--- a/SmalltalkChunkFileSourceWriter.st	Sat Jul 04 11:52:42 2015 +0100
+++ b/SmalltalkChunkFileSourceWriter.st	Mon Jul 06 06:06:17 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2004 by eXept Software AG
               All Rights Reserved
@@ -67,15 +69,15 @@
 
     |s|
 
-    s := TextStream on:''.
+    s := (TextStream ? WriteStream) on:''.
     s nextPutAll:
-'message selector and argument names
+'message "selector and argument names"
     "comment stating purpose of this message"
 
     |temporaries|
 
-    statement.
-    statement.
+    "statement."
+    "statement."
 
     "
      optional: comment giving example use
@@ -99,6 +101,11 @@
 
  Or clear this text, type in the method from scratch
  and install it with `accept''.
+
+ If you don''t like this method template to appear,
+ disable it either via the global or browser''s settings dialog,
+ or by evaluating:
+     UserPreferences current showMethodTemplate:false
 "
 '.
     ^ s contents
@@ -107,7 +114,7 @@
 versionMethodTemplateForCVS
     "careful to avoid expansion by cvs here!!"
 
-    ^ ('version\    ^ ''$' , 'Header$''') withCRs
+    ^ ('version_CVS\    ^ ''$' , 'Header$''') withCRs
 
     "Created: / 21-08-2012 / 11:52:27 / cg"
 ! !
@@ -711,11 +718,11 @@
 !SmalltalkChunkFileSourceWriter class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.30 2015-02-03 19:14:15 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.30 2015-02-03 19:14:15 cg Exp $'
+    ^ '$Header$'
 !
 
 version_HG
--- a/String.st	Sat Jul 04 11:52:42 2015 +0100
+++ b/String.st	Mon Jul 06 06:06:17 2015 +0100
@@ -825,7 +825,7 @@
 		    unsigned char c5 = matchP[4];
 		    unsigned char ch;
 
-		    while (ch = *cp++) {
+		    while ((ch = *cp++) != '\0') {
 			if ((ch == c1) || (ch == c2) || (ch == c3) || (ch == c4) || (ch == c5)) {
 			    RETURN ( true );
 			}
@@ -842,7 +842,7 @@
 		    unsigned char c4 = matchP[3];
 		    unsigned char ch;
 
-		    while (ch = *cp++) {
+		    while ((ch = *cp++) != '\0') {
 			if ((ch == c1) || (ch == c2) || (ch == c3) || (ch == c4)) {
 			    RETURN ( true );
 			}
@@ -858,7 +858,7 @@
 		    unsigned char c3 = matchP[2];
 		    unsigned char ch;
 
-		    while (ch = *cp++) {
+		    while ((ch = *cp++) != '\0') {
 			if ((ch == c1) || (ch == c2) || (ch == c3)) {
 			    RETURN ( true );
 			}
@@ -873,7 +873,7 @@
 		    unsigned char c2 = matchP[1];
 		    unsigned char ch;
 
-		    while (ch = *cp++) {
+		    while ((ch = *cp++) != '\0') {
 			if ((ch == c1) || (ch == c2)) {
 			    RETURN ( true );
 			}
@@ -895,7 +895,7 @@
 	{
 	    unsigned char ch;
 
-	    while (ch = *cp++) {
+	    while ((ch = *cp++) != '\0') {
 		if (strchr(matchP, ch)) {
 		    RETURN ( true );
 		}
@@ -1177,7 +1177,7 @@
 			RETURN ( __mkSmallInteger((ccp - cp) + index + 1) );
 		    }
 # else
-		    while (c = *cp++) {
+		    while ((c = *cp++) != '\0') {
 			if (c == m) {
 			    RETURN ( __mkSmallInteger(index) );
 			}
@@ -1192,7 +1192,7 @@
 		    unsigned char m1 = matchP[0];
 		    unsigned char m2 = matchP[1];
 
-		    while (c = *cp++) {
+		    while ((c = *cp++) != '\0') {
 			if ((c == m1) || (c == m2)) {
 			    RETURN ( __mkSmallInteger(index) );
 			}
@@ -1209,7 +1209,7 @@
 		    else if (c > max) max = c;
 		}
 
-		while (c = *cp++) {
+		while ((c = *cp++) != '\0') {
 		    if ((c >= min) && (c <= max)) {
 			for (ccp = matchP; *ccp ; ccp++) {
 			    if (*ccp == c) {
@@ -1235,7 +1235,7 @@
      'hello world' indexOfAny:'AOE' startingAt:1
      'hello world' indexOfAny:'o' startingAt:6
      'hello world' indexOfAny:'o' startingAt:6
-     'hello world§' indexOfAny:'#§$' startingAt:6
+     'hello world' indexOfAny:'#$' startingAt:6
     "
 !
 
@@ -1897,7 +1897,7 @@
     default:
 	for (cp0 = cp, cp += l - 1; cp >= cp0; cp--) {
 	    val = (val << 4) + *cp;
-	    if (g = (val & 0xF0000000)) {
+	    if ((g = (val & 0xF0000000)) != 0) {
 		val ^= g >> 24;
 		val ^= g;
 	    }
@@ -3022,7 +3022,7 @@
 
     "
      'abcde1234' utf8EncodedOn:('' writeStream)
-     'abcdeäöüß' utf8EncodedOn:('' writeStream)
+     'abcde' utf8EncodedOn:('' writeStream)
     "
 ! !
 
@@ -3491,8 +3491,8 @@
     "
       'hello world' asUnicode16String errorPrint
       (Character value:356) asString errorPrint
-      'Bönnigheim' errorPrint
-      'Bönnigheim' asUnicodeString errorPrint
+      'Bnnigheim' errorPrint
+      'Bnnigheim' asUnicodeString errorPrint
     "
 !
 
@@ -4016,7 +4016,7 @@
 
 	src1 = __stringVal(slf) + (len1 - len2);
 	src2 = __stringVal(aStringOrChar);
-	while (c = *src2++) {
+	while ((c = *src2++) != '\0') {
 	    if (c != *src1++) {
 		RETURN ( false );
 	    }
@@ -4076,10 +4076,10 @@
     }
 #  endif /* ascii */
 
-    while (c = *src++) {
-	if (c != ' ') {
-	    RETURN ( false );
-	}
+    while ((c = *src++) == ' ')
+	;; /* just walking along */ 
+    if (c != '\0') {
+	RETURN ( false );
     }
     RETURN ( true );
 # endif /* ! __SCHTEAM__ */
@@ -4324,7 +4324,7 @@
 	    src2 += sizeof(INT);
 	}
 
-	while (c = *src2++) {
+	while ((c = *src2++) != '\0') {
 	    if (c != *src1) {
 		RETURN ( false );
 	    }
@@ -4381,9 +4381,9 @@
 !String class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.342 2015-05-25 18:37:56 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.342 2015-05-25 18:37:56 cg Exp $'
+    ^ '$Header$'
 ! !