David T. Lewis uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-dtl.715.mcz ==================== Summary ==================== Name: Collections-dtl.715 Author: dtl Time: 27 August 2016, 11:16:53.919203 pm UUID: 7d00851c-8dae-4128-9550-138e30c644f5 Ancestors: Collections-ul.714 When the redirectToStdOut preference is enabled, let the standard output stream be a view on the Transcript. Flush output to stdout on endEntry. Make cr and lf work for the stdout view. Permit other views to continue functioning normally in the image, with the standard output as an additional view. =============== Diff against Collections-ul.714 =============== Item was changed: ----- Method: TranscriptStream class>>redirectToStdOut: (in category 'preferences') ----- redirectToStdOut: aBoolean + (RedirectToStdOut := aBoolean) + ifTrue: [Transcript addDependent: FileStream stdout] + ifFalse: [Transcript removeDependent: FileStream stdout].! - RedirectToStdOut := aBoolean.! Item was added: + ----- Method: TranscriptStream>>nextPut: (in category 'stream extensions') ----- + nextPut: anObject + self target == self ifFalse: [self target nextPut: anObject]. "delegated to stdout" + ^ super nextPut: anObject.! Item was added: + ----- Method: TranscriptStream>>nextPutAll: (in category 'stream extensions') ----- + nextPutAll: aCollection + self target == self ifFalse: [self target nextPutAll: aCollection]. "delegated to stdout" + ^ super nextPutAll: aCollection.! Item was changed: ----- Method: TranscriptStream>>show: (in category 'stream extensions') ----- show: anObject "TextCollector compatibility" [ + self nextPutAll: anObject asString. - self target nextPutAll: anObject asString. self endEntry ] on: FileWriteError do: [self class redirectToStdOut: false].! Item was changed: ----- Method: TranscriptStream>>showln: (in category 'stream extensions') ----- showln: anObject "TextCollector compatibility. Ensure a new line before inserting a message." [ + self - self target cr; nextPutAll: anObject asString. self endEntry. ] on: FileWriteError do: [self class redirectToStdOut: false].! Item was removed: - ----- Method: WriteStream>>flush (in category 'accessing') ----- - flush! |
Files-dtl.163 and Collections-dtl.715 permit the Transcript to be redirected
to stdout in a more useful way, particularly for VMs that use stdio (not Windows HANDLE) for file streams. With these updates, the redirectToStdOut preference may be left enabled without affecting normal transcript displays in the image. The stdout output will be flushed as expected, and cr and lf output will work on stdout. If no objections I will move to trunk in a day or so. Dave On Sun, Aug 28, 2016 at 03:16:54AM +0000, [hidden email] wrote: > David T. Lewis uploaded a new version of Collections to project The Inbox: > http://source.squeak.org/inbox/Collections-dtl.715.mcz > > ==================== Summary ==================== > > Name: Collections-dtl.715 > Author: dtl > Time: 27 August 2016, 11:16:53.919203 pm > UUID: 7d00851c-8dae-4128-9550-138e30c644f5 > Ancestors: Collections-ul.714 > > When the redirectToStdOut preference is enabled, let the standard output stream be a view on the Transcript. Flush output to stdout on endEntry. Make cr and lf work for the stdout view. Permit other views to continue functioning normally in the image, with the standard output as an additional view. > > =============== Diff against Collections-ul.714 =============== > > Item was changed: > ----- Method: TranscriptStream class>>redirectToStdOut: (in category 'preferences') ----- > redirectToStdOut: aBoolean > > + (RedirectToStdOut := aBoolean) > + ifTrue: [Transcript addDependent: FileStream stdout] > + ifFalse: [Transcript removeDependent: FileStream stdout].! > - RedirectToStdOut := aBoolean.! > > Item was added: > + ----- Method: TranscriptStream>>nextPut: (in category 'stream extensions') ----- > + nextPut: anObject > + self target == self ifFalse: [self target nextPut: anObject]. "delegated to stdout" > + ^ super nextPut: anObject.! > > Item was added: > + ----- Method: TranscriptStream>>nextPutAll: (in category 'stream extensions') ----- > + nextPutAll: aCollection > + self target == self ifFalse: [self target nextPutAll: aCollection]. "delegated to stdout" > + ^ super nextPutAll: aCollection.! > > Item was changed: > ----- Method: TranscriptStream>>show: (in category 'stream extensions') ----- > show: anObject > "TextCollector compatibility" > > [ > + self nextPutAll: anObject asString. > - self target nextPutAll: anObject asString. > self endEntry > ] on: FileWriteError do: [self class redirectToStdOut: false].! > > Item was changed: > ----- Method: TranscriptStream>>showln: (in category 'stream extensions') ----- > showln: anObject > "TextCollector compatibility. Ensure a new line before inserting a message." > > [ > + self > - self target > cr; > nextPutAll: anObject asString. > self endEntry. > ] on: FileWriteError do: [self class redirectToStdOut: false].! > > Item was removed: > - ----- Method: WriteStream>>flush (in category 'accessing') ----- > - flush! > |
Free forum by Nabble | Edit this page |