[Newbies] Display artifacts in comments/desc.

Bert Freudenberg bert at freudenbergs.de
Mon May 7 19:11:46 UTC 2007

On May 7, 2007, at 14:47 , subbukk wrote:

> On Monday 07 May 2007 10:53 pm, Bert Freudenberg wrote:
>>> Squeak3.9 handling of CRLF sequences in sources file is defective.
>> I do not think it is.
> SqueakV39.sources contains the following sequence as seen in a  
> hexeditor for
> DateAndTime commentStamp:
> I have zero duration\r\n\r\n\r\n
> When I browse this class and inspect the Text object in the  
> annotation pane,
> the same sequence shows up in its string variable. Since  
> annotations are read
> in as line-oriented text from files

They are not. The sources and changes file is *not* a text file even  
though it might look like one to the uninitiated. It's a database of  
data chunks and the image actually stores byte offsets into this  
file. When you move the file to a different platform you *must not*  
change the line ending convention.

> , the CRLFs should have been replaced with
> CRs. Of course, we could take a stance that the sources files is  
> corrupt
> since it uses mixed line endings, but then what about text read in  
> from a
> changes file or from a filein that came thru email?

We might be more tolerant when filing in, this is true. But this  
should be an explicit action because there actually are file-ins that  
contain binary data which we do *no* want to mess with.

>>> Squeak3.8
>>> image correctly strips of LF in CRLF while reading in text from
>>> SqueakV3.sources file. For instance, editStartPage method in
>>> Scamper uses
>>> CRLF in SqueakV3.sources file but its Text in codepane strips out  
>>> LF.
>> I do not think this is the case.
> SqueakV3.sources contains the sequence:
> editStartPage\r\n\t
> But the Text object in the codepane shows the sequence:
> editStartPage\r\t

Let's see.

	(Scamper>>#editStartPage) fileIndex "2"

which means it is in the changes file, not the sources file.

	(Scamper>>#editStartPage) filePosition "10310306"

which tells you the file offset

	(Scamper>>#editStartPage) getSourceFromFile asString asByteArray
		"a ByteArray(101 100 105 116 83 116 97 114 116 80 97 103 101 13  
9 ...)"

which is the source code as retrieved by the browser, note there only  
is a 13 (CR) no LF (10).

	| f | [(f := FileStream readOnlyFileNamed: Smalltalk changesName)  
		position: 10310306; next: 40] ensure: [f close]

	"a ByteArray(101 100 105 116 83 116 97 114 116 80 97 103 101 13 9 ...)

which confirms that this is actually in the file.

- Bert -

More information about the Squeak-dev mailing list