fileStream
"Answer the file stream with position set at the beginning of my string. Answer a read only copy to avoid syntax errors when accessed via multiple processes." | theFile | (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^ nil]. theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. theFile position: filePositionHi. ^ theFile string "Answer the receiver's string if remote files are enabled. Use a read only copy to avoid syntax errors when accessed via multiple processes." | theFile | (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^'']. theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. ^[theFile position: filePositionHi. theFile nextChunk] ensure: [theFile close] text "Answer the receiver's string asText if remote files are enabled. Use a read only copy to avoid syntax errors when accessed via multiple processes." | theFile | (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^ nil]. theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. ^[theFile position: filePositionHi. theFile position > theFile size ifTrue: [ self error: 'RemoteString past end of file' ]. theFile nextChunkText] ensure: [theFile close] I imagine a good soul could fix that and nicely published in the inbox :) Stef Did I say something negative about the past :) _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
http://code.google.com/p/pharo/issues/detail?id=2228
of course! Stef On Mar 28, 2010, at 9:18 PM, Stéphane Ducasse wrote: > fileStream > "Answer the file stream with position set at the beginning of my string. > Answer a read only copy to avoid syntax errors when accessed via > multiple processes." > > | theFile | > (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^ nil]. > theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. > theFile position: filePositionHi. > ^ theFile > > string > "Answer the receiver's string if remote files are enabled. > Use a read only copy to avoid syntax errors when accessed via > multiple processes." > > | theFile | > (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^'']. > theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. > ^[theFile position: filePositionHi. > theFile nextChunk] ensure: [theFile close] > > > text > "Answer the receiver's string asText if remote files are enabled. > Use a read only copy to avoid syntax errors when accessed via > multiple processes." > > | theFile | > (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^ nil]. > theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. > ^[theFile position: filePositionHi. > theFile position > theFile size ifTrue: [ > self error: 'RemoteString past end of file' ]. > theFile nextChunkText] ensure: [theFile close] > > I imagine a good soul could fix that and nicely published in the inbox :) > > Stef Did I say something negative about the past :) > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
And here I was, thinking you were talking of copy-pasted code instead
of reuse ;P Btw, there's no way that test should be true unless you have a messed up changes file caused by a botched truncate or something... Cheers, Henry Den 28. mars 2010 kl. 21.20 skrev Stéphane Ducasse <[hidden email] r>: > http://code.google.com/p/pharo/issues/detail?id=2228 > of course! > Stef > > On Mar 28, 2010, at 9:18 PM, Stéphane Ducasse wrote: > >> fileStream >> "Answer the file stream with position set at the beginning of my >> string. >> Answer a read only copy to avoid syntax errors when accessed via >> multiple processes." >> >> | theFile | >> (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) >> == nil]) ifTrue: [^ nil]. >> theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. >> theFile position: filePositionHi. >> ^ theFile >> >> string >> "Answer the receiver's string if remote files are enabled. >> Use a read only copy to avoid syntax errors when accessed via >> multiple processes." >> >> | theFile | >> (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) >> == nil]) ifTrue: [^'']. >> theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. >> ^[theFile position: filePositionHi. >> theFile nextChunk] ensure: [theFile close] >> >> >> text >> "Answer the receiver's string asText if remote files are enabled. >> Use a read only copy to avoid syntax errors when accessed via >> multiple processes." >> >> | theFile | >> (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) >> == nil]) ifTrue: [^ nil]. >> theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. >> ^[theFile position: filePositionHi. >> theFile position > theFile size ifTrue: [ >> self error: 'RemoteString past end of file' ]. >> theFile nextChunkText] ensure: [theFile close] >> >> I imagine a good soul could fix that and nicely published in the >> inbox :) >> >> Stef Did I say something negative about the past :) >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
2010/3/28 Henrik Johansen <[hidden email]>:
> And here I was, thinking you were talking of copy-pasted code instead of > reuse ;P > > Btw, there's no way that test should be true unless you have a messed up > changes file caused by a botched truncate or something... > something like a registered BlockClosure action retaining some obsolete sourcePointer after a condenseChanges ? Nicolas > Cheers, > Henry > > Den 28. mars 2010 kl. 21.20 skrev Stéphane Ducasse > <[hidden email]>: > >> http://code.google.com/p/pharo/issues/detail?id=2228 >> of course! >> Stef >> >> On Mar 28, 2010, at 9:18 PM, Stéphane Ducasse wrote: >> >>> fileStream >>> "Answer the file stream with position set at the beginning of my >>> string. >>> Answer a read only copy to avoid syntax errors when accessed via >>> multiple processes." >>> >>> | theFile | >>> (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == >>> nil]) ifTrue: [^ nil]. >>> theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. >>> theFile position: filePositionHi. >>> ^ theFile >>> >>> string >>> "Answer the receiver's string if remote files are enabled. >>> Use a read only copy to avoid syntax errors when accessed via >>> multiple processes." >>> >>> | theFile | >>> (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == >>> nil]) ifTrue: [^'']. >>> theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. >>> ^[theFile position: filePositionHi. >>> theFile nextChunk] ensure: [theFile close] >>> >>> >>> text >>> "Answer the receiver's string asText if remote files are enabled. >>> Use a read only copy to avoid syntax errors when accessed via >>> multiple processes." >>> >>> | theFile | >>> (sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == >>> nil]) ifTrue: [^ nil]. >>> theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy. >>> ^[theFile position: filePositionHi. >>> theFile position > theFile size ifTrue: [ >>> self error: 'RemoteString past end of file' ]. >>> theFile nextChunkText] ensure: [theFile close] >>> >>> I imagine a good soul could fix that and nicely published in the inbox :) >>> >>> Stef Did I say something negative about the past :) >>> _______________________________________________ >>> Pharo-project mailing list >>> [hidden email] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |