[squeak-dev] Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Andreas Raab andreas.raab at gmx.de
Thu Feb 25 22:54:17 UTC 2010

I did a quick test, and I think this should work:

	license := 'Put your license text here'.
	stream nextChunkPut: license storeString.
	".... Continue with condense changes ...."

What it does is storing the license as a string literal (#storeString) 
so that the sources file will begin with the license as string and 
consequently the license can be read back in and parsed via:

	license := Compiler evaluate: ((Smalltalk sourcesFile) position: 0; 

If you didn't use storeString you might have problems with utilities 
that try to parse the sources file, i.e., ChangeList and friends.

   - Andreas

Ronald Spengler wrote:
> I have a change in place for condenseSources   My question was really
> about how to put the license at the top in a way that can be written.
> I want to be sure though, is there a particular method which should be
> called within condenseSources to add comment text to the top?
> My (perhaps naive) implementation is doing something like:
> f nextPutall: license
> On Thursday, February 25, 2010, Bert Freudenberg <bert at freudenbergs.de> wrote:
>> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>>>>>>>> "Ronald" == Ronald Spengler <ron.spengler at gmail.com> writes:
>>> Ronald> Good people of Squeak,
>>> Ronald> We need to have a license statement at the top of our sources file for
>>> Ronald> the 4.0 release. I've been futsing with it without success.
>>> Ronald> I've tried:
>>> Ronald> 'foo'!
>>> Ronald> 'foo'!!
>>> Ronald> !'foo'!
>>> (I think) The sources file is always accessed according to byte offsets.  Look
>>> at the code for #condenseSources, and make sure the first thing it does is
>>> write the license before rewriting everything else.
>> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>> - Bert -

More information about the Squeak-dev mailing list