B4A

sábado, marzo 15, 2008

Monticello Backport to Squeak 3.4

To the work I'm doing to BluePlane, the company of Tansel Ersavas and John Magnifico I backported Monticello to run on a Squeak 3.4 image.

The easy way to have it running is download the .cs and install it on a clean stock 3.4 Squeak image.

When installing, you must respond with "yes" when ask to create the pool dictionary MCMockClassPoolRepository and press "ok" when inform about an "Erased Method".

If all goes ok, then you will have Monticello running on your 3.4 image (On the World Menu --> open --> Monticello Browser), as in the pic:


If you are interested in the details of the backport, they are:

1. Filein the source code from PackageInfo (Taken from PackageInfo-Base-avi.18.mcz).

2. When the walback with the DNU error of the TheWorldMenu appear, go to the #initialize method in the debugger, erase the line:

TheWorldMenu registerOpenCommand: {'Package List'. {self. #open}}

and replace it with something as self inform: 'Erased Method' (just a flag).

3. Filein PluggableButtonMorph (Taken from a stock 3.4 image).

4. Modify FileList of 3.4 image:

a- Adding FileReaderRegistry class variable
b- Adding on the class category "file reader registration", the method:

registeredFileReaderClasses

FileReaderRegistry ifNil: [FileReaderRegistry _ OrderedCollection new].
^ FileReaderRegistry

c- Adding on the class category "file reader registration", the method:

registerFileReader: aProviderClass
"register the given class as providing services for reading files"

| registeredReaders |
registeredReaders := self registeredFileReaderClasses.
(registeredReaders includes: aProviderClass)
ifFalse: [ registeredReaders addLast: aProviderClass ]

5. Filein the sources from from Monticello-avi.59.mcz
(Press close if a warning appear)

6. Add at CompileMethod "source code management" category, the method:

getPreambleFrom: aFileStream at: position
| writeStream |
writeStream _ String new writeStream.
position
to: 0
by: -1
do: [:p |
| c |
aFileStream position: p.
c _ aFileStream basicNext.
c == $!
ifTrue: [^ writeStream contents reverse]
ifFalse: [writeStream nextPut: c]]

7. Add at CompileMethod priting category, the method:

timeStamp
"Answer the authoring time-stamp for the given method, retrieved from the sources or changes file. Answer the empty string if no time stamp is available."

"(CompiledMethod compiledMethodAt: #timeStamp) timeStamp"

| file preamble stamp tokens tokenCount |
self fileIndex == 0 ifTrue: [^ String new]. "no source pointer for this method"
file _ SourceFiles at: self fileIndex.
file ifNil: [^ String new]. "sources file not available"
"file does not exist happens in secure mode"
file _ [file readOnlyCopy] on: FileDoesNotExistException do:[:ex| nil].
file ifNil: [^ String new].
preamble _ self getPreambleFrom: file at: (0 max: self filePosition - 3).
stamp _ String new.
tokens _ (preamble findString: 'methodsFor:' startingAt: 1) > 0
ifTrue: [Scanner new scanTokens: preamble]
ifFalse: [Array new "ie cant be back ref"].
(((tokenCount _ tokens size) between: 7 and: 8) and: [(tokens at: tokenCount - 5) = #methodsFor:])
ifTrue:
[(tokens at: tokenCount - 3) = #stamp:
ifTrue: ["New format gives change stamp and unified prior pointer"
stamp _ tokens at: tokenCount - 2]].
((tokenCount between: 5 and: 6) and: [(tokens at: tokenCount - 3) = #methodsFor:])
ifTrue:
[(tokens at: tokenCount - 1) = #stamp:
ifTrue: ["New format gives change stamp and unified prior pointer"
stamp _ tokens at: tokenCount]].
file close.
^ stamp

8. Add commentStamp accessor to class ClassOrganizer.

And in the the WorldMenu now exist the "Monticello Browser" option.

If not, may be some differences between images, that may generate other behaviours, and the need of patch some code from a stock 3.9 image.

If the World Menu don't have the option, you can open the Monticello Browser evaluating on a workspace: "MCWorkingCopyBrowser open".

No hay comentarios.: