--- a/Array.st Tue Jul 13 09:37:43 2004 +0200
+++ b/Array.st Tue Jul 13 09:38:50 2004 +0200
@@ -1625,6 +1625,63 @@
"Modified: 12.9.1997 / 22:03:18 / cg"
!
+printOn:aStream
+
+ self isLiteral ifTrue:[
+ |limit firstOne s|
+
+ thisContext isRecursive ifTrue:[
+ 'Array [error]: printOn: of self referencing collection.' errorPrintCR.
+ aStream nextPutAll:'#("recursive")'.
+ ^ self
+ ].
+
+ aStream nextPutAll:'#('.
+ firstOne := true.
+
+ "
+ if aStream is not positionable, create an temporary positionable stream
+ (needed for limit calculation)
+ "
+ aStream isPositionable ifTrue:[
+ s := aStream.
+ ] ifFalse:[
+ s := WriteStream on:(String uninitializedNew:50).
+ ].
+ limit := s position1Based + self maxPrint.
+
+ self printElementsDo:[:element |
+ firstOne ifFalse:[
+ s space
+ ] ifTrue:[
+ firstOne := false
+ ].
+ (s position1Based >= limit) ifTrue:[
+ s ~~ aStream ifTrue:[
+ aStream nextPutAll:(s contents).
+ ].
+ aStream nextPutAll:'...etc...)'.
+ ^ self
+ ] ifFalse:[
+ element printOn:s.
+ ].
+ ].
+ s ~~ aStream ifTrue:[
+ aStream nextPutAll:(s contents).
+ ].
+ aStream nextPut:$)
+ ] ifFalse:[
+ super printOn:aStream
+ ]
+
+ "
+ #(1 2 $a 'hello' sym kewordSymbol:with: #'funny symbol') printString
+ #(1 2 $a [1 2 3] true false nil #true #false #nil) printString
+ "
+
+ "Created: 20.11.1995 / 11:16:58 / cg"
+!
+
storeArrayElementOn:aStream
"Store as element of an array. Omit the leading '#'"
@@ -2435,5 +2492,5 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.133 2004-05-27 14:27:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.134 2004-07-13 07:38:50 stefan Exp $'
! !