[squeak-dev] The Trunk: Collections-fbs.514.mcz

Eliot Miranda eliot.miranda at gmail.com
Fri Apr 26 20:48:16 UTC 2013


Tghe problem is a missing flush.  Putting it in nextChunkPut: is a hack.
 Putting it in clients is more work, but the correct place. So e.g.

classComment: aString stamp: aStamp
"Store the comment, aString or Text or RemoteString, associated with the
class we are organizing.  Empty string gets stored only if had a non-empty
one before."

| ptr header file oldCommentRemoteStr |
(aString isKindOf: RemoteString) ifTrue:
[SystemChangeNotifier uniqueInstance classCommented: self.
^ self organization classComment: aString stamp: aStamp].

oldCommentRemoteStr := self organization commentRemoteStr.
(aString size = 0) & (oldCommentRemoteStr == nil) ifTrue: [^ self
organization classComment: nil].
"never had a class comment, no need to write empty string out"

ptr := oldCommentRemoteStr ifNil: [0] ifNotNil: [oldCommentRemoteStr
sourcePointer].
SourceFiles ifNotNil: [(file := SourceFiles at: 2) ifNotNil:
[file setToEnd; cr; nextPut: $!. "directly"
"Should be saying (file command: 'H3') for HTML, but ignoring it here"
header := String streamContents: [:strm | strm nextPutAll: self name;
nextPutAll: ' commentStamp: '.
aStamp storeOn: strm.
strm nextPutAll: ' prior: '; nextPutAll: ptr printString].
file nextChunkPut: header]].
self organization classComment: (RemoteString newString: aString
onFileNumber: 2) stamp: aStamp.
SystemChangeNotifier uniqueInstance classCommented: self.

needs to read

classComment: aString stamp: aStamp
"Store the comment, aString or Text or RemoteString, associated with the
class we are organizing.  Empty string gets stored only if had a non-empty
one before."

| ptr header file oldCommentRemoteStr |
(aString isKindOf: RemoteString) ifTrue:
[SystemChangeNotifier uniqueInstance classCommented: self.
^ self organization classComment: aString stamp: aStamp].

oldCommentRemoteStr := self organization commentRemoteStr.
(aString size = 0) & (oldCommentRemoteStr == nil) ifTrue: [^ self
organization classComment: nil].
"never had a class comment, no need to write empty string out"

ptr := oldCommentRemoteStr ifNil: [0] ifNotNil: [oldCommentRemoteStr
sourcePointer].
SourceFiles ifNotNil: [(file := SourceFiles at: 2) ifNotNil:
[file setToEnd; cr; nextPut: $!. "directly"
"Should be saying (file command: 'H3') for HTML, but ignoring it here"
header := String streamContents: [:strm | strm nextPutAll: self name;
nextPutAll: ' commentStamp: '.
aStamp storeOn: strm.
strm nextPutAll: ' prior: '; nextPutAll: ptr printString].
file nextChunkPut: header; flush]].
self organization classComment: (RemoteString newString: aString
onFileNumber: 2) stamp: aStamp.
SystemChangeNotifier uniqueInstance classCommented: self.

i.e. file nextChunkPut: header => file nextChunkPut: header; flush

On Fri, Apr 26, 2013 at 1:30 PM, <commits at source.squeak.org> wrote:

> Frank Shearar uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-fbs.514.mcz
>
> ==================== Summary ====================
>
> Name: Collections-fbs.514
> Author: fbs
> Time: 26 April 2013, 9:30:07.501 pm
> UUID: 26b584d4-1ad3-40b0-b9b1-d888e122116e
> Ancestors: Collections-fbs.513
>
> Revert the over-eager (attempt at a) fix.
>
> =============== Diff against Collections-fbs.513 ===============
>
> Item was changed:
>   ----- Method: WriteStream>>nextChunkPut: (in category 'fileIn/Out') -----
>   nextChunkPut: aString
>         "Append the argument, aString, to the receiver, doubling embedded
> terminators."
>
>         | i remainder terminator |
>         terminator := $!!.
>         remainder := aString.
>         [(i := remainder indexOf: terminator) = 0] whileFalse:
>                 [self nextPutAll: (remainder copyFrom: 1 to: i).
>                 self nextPut: terminator.  "double imbedded terminators"
>                 remainder := remainder copyFrom: i+1 to: remainder size].
>         self nextPutAll: remainder.
>         aString includesUnifiedCharacter ifTrue: [
>                 self nextPut: terminator.
>                 self nextPutAll: ']lang['.
>                 aString writeLeadingCharRunsOn: self.
>         ].
>         self nextPut: terminator.
> -       self flush.
>   !
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130426/7197ecc8/attachment-0001.htm


More information about the Squeak-dev mailing list