A new version of OrphanageTest-Test1 was added to project Monticello Public:
http://www.squeaksource.com/mc/OrphanageTest-Test1-mtf.8.mcz
==================== Summary ====================
Name: OrphanageTest-Test1-mtf.8
Author: mtf
Time: 19 August 2009, 9:57:53 am
UUID: fcf25b52-dd27-406f-ace7-003ad3e1a214
Ancestors: OrphanageTest-Test1-kph.7
Made a change in order to provide a test case for http://bugs.squeak.org/view.php?id=7387
=============== Diff against OrphanageTest-Test1-kph.7 ===============
Item was changed:
----- Method: OrphanageTest2>>extensionMethodFromTest1 (in category '*orphanagetest-test1') -----
extensionMethodFromTest1
+ "from test1" "changed in version 8"!
- "from test1"!
A new version of Monticello.impl was added to project Monticello Public:
http://www.squeaksource.com/mc/Monticello.impl-mtf.647.mcz
==================== Summary ====================
Name: Monticello.impl-mtf.647
Author: mtf
Time: 10 August 2009, 8:52:13 am
UUID: 5bf7cbb6-f075-46c4-9a72-ae9da5aac6cf
Ancestors: Monticello.impl-damiencassou.646
Gave Monticello the ability to automatically fix underscore assignments if they are an issue, and made syntax error handling in general a bit smarter.
Experimental; not yet tested.
Only works in MC1.5 (MCPackageLoader1b)
=============== Diff against Monticello.impl-damiencassou.646 ===============
Item was changed:
Object subclass: #MCPackageLoader1b
+ instanceVariableNames: 'requirements unloadableDefinitions obsoletions additions removals errorDefinitions modifiedDefinitions provisions isUnloading isMultiplePackage'
- instanceVariableNames: 'requirements unloadableDefinitions obsoletions additions removals errorDefinitions provisions isUnloading isMultiplePackage'
classVariableNames: ''
poolDictionaries: ''
category: 'Monticello-Base-Loading'!
!MCPackageLoader1b commentStamp: 'kph 5/25/2007 04:43' prior: 0!
MCPackageLoader1b - Attempt to improve loading with a number of tricks
In #basicLoad the loading process starts with a collection of definitions
in #additions, and another in #removals. #analyse should have sorted these so that
dependencies shouldnt cause errors.
The load sequence sent to each addidion is: #preLoadOver: [ #install #postinstall ] #postloadOver:
The load sequence sent to each removal is [ #unload ]
The brackets above mark the fact that the 'load' itself which is perfromed by #install/#postinstall and #unload are performed in a tight loop and this is our attempt at atomicity.
For methods, #preloadOver:, and #postloadOver: obsoletions are supplied, being the original item being overwritten.
InstVar #defn is the currently loading definition. This allows error handlers to know what was being processed when the error occured.
-----
Note that to support loading this Monicello over a version which does not support atomic loading, soe things have to remain in place that are otherwise obsolete.
MCDefinition-#loadOver:
MCPackageLoader instVar's errorDefinitions, addtions, removals cant be renamed.
!
Item was added:
+ ----- Method: MCPackageLoader1b>>warnAboutModifications: (in category 'private') -----
+ warnAboutModifications: modifications
+ modifications isEmpty ifFalse: [ self notify: (self modifiedDefinitionWarning: modifications) ]
+ !
Item was added:
+ ----- Method: MCPackageLoader1b>>shouldWarnAboutModifications (in category 'private') -----
+ shouldWarnAboutModifications
+ ^ true "should make this a preference"!
Item was changed:
----- Method: MCMethodDefinition>>ensuredCreateCompiledMethod (in category 'compiling') -----
ensuredCreateCompiledMethod
"Create the compiled method from my source, or from user-provided source in the event of a syntax error"
+ | newSource |
[ self createCompiledMethod ] on: SyntaxErrorNotification do: [ :ex |
+ "first, see if it's an underscore issue"
+ newSource := FixUnderscores2 new fixUnderscores: source.
+ (newSource notNil and: [newSource ~= source]) ifTrue: [
+ source := newSource.
+ self sourceChangedBecause: 'Convert _ to :='.
+ ex retry].
+
+ "If not, poppup a syntax error dialog"
+ ex outer.
- "Let the user install the fixed code into the system"
- ex defaultAction.
"Now fetch and use that code instead"
source := theClass sourceCodeAt: self selector ifAbsent: [^ nil].
+ self sourceChangedBecause: 'Syntax Error'.
+ ex retry]!
- self createCompiledMethod]!
Item was changed:
----- Method: MCPackageLoader1b>>basicLoad (in category 'private') -----
basicLoad
additions do: [:ea | ea preloadOver: (self obsoletionFor: ea). ] displayingProgress: 'Loading...'.
self shouldWarnAboutErrors ifTrue: [ self warnAboutErrors: errorDefinitions ].
(1 to: 2) do: [:ea | ] displayingProgress: (self isUnloading ifFalse: [ 'Installing...' ]
ifTrue: [ 'Unloading...' ]).
"begin the psuedo atomic bit"
removals do: [:ea | ea unload ].
additions do: [:ea | ea install ].
additions do: [:ea | ea postinstall ].
"end the psuedo atomic bit"
additions reverse do: [:ea |
ea postloadOver: (self obsoletionFor: ea).
self successfullyLoaded: ea.
] displayingProgress: 'Integration...'.
+
+ self shouldWarnAboutModifications ifTrue: [self warnAboutModifications: modifiedDefinitions].
!
Item was added:
+ ----- Method: MCMethodDefinition>>sourceChangedBecause: (in category 'compiling') -----
+ sourceChangedBecause: aString
+ self because: aString.
+ ^ (SourceChangedDuringLoad method: self reason: aString) signal!
Item was added:
+ ----- Method: MCPackageLoader1b>>modifiedDefinitionWarning: (in category 'private') -----
+ modifiedDefinitionWarning: modifiedDefns
+ ^ String streamContents: [:s |
+ s nextPutAll: 'The following definitions were modified during the load. You should review the changes and save the package. Press Proceed to finish loading'; cr.
+ modifiedDefns do: [:ea |
+ s space; space;
+ nextPutAll: ea summary;
+ space;
+ nextPutAll: (ea because ifNil: [ '' ]); cr]] !
Item was changed:
----- Method: MCVersionLoader>>loadWithNameLike: (in category 'loading') -----
loadWithNameLike: aString
| loader |
self checkForModifications.
loader := MCPackageLoader newCurrent.
versions size > 1 ifTrue: [ loader beMultiplePackage ].
versions do: [:ea |
ea canOptimizeLoading
ifTrue: [ea patch applyTo: loader]
ifFalse: [loader updatePackage: ea package withSnapshot: ea snapshot
]
].
loader installOrphanage;
loadWithNameLike: aString.
+ versions do: [:ea | ea workingCopy loaded: ea].
+
+ loader modifiedDefinitions ifNotEmpty: [
+ versions do: [:ea | ea workingCopy modified: true].
+ "Since the versions were modified directly, they are stale"
+ MCFileBasedRepository flushAllCaches].!
- versions do: [:ea | ea workingCopy loaded: ea]!
Item was added:
+ ----- Method: MCPackageLoader1b>>modifiedDefinitions (in category 'public') -----
+ modifiedDefinitions
+ "Answer a list of method definitions whose source was modified as part of the load, due to syntax error or other reasons. Only intended to be called after load"
+
+ ^ modifiedDefinitions!
Item was changed:
----- Method: MCPackageLoader1b>>protectedLoad (in category 'private') -----
protectedLoad
+ errorDefinitions := OrderedCollection new.
+ modifiedDefinitions := OrderedCollection new.
+ [[[[self basicLoad]
+ on: InMidstOfFileinNotification do: [:n | n resume: true]]
+ ensure: [self flushChangesFile]]
+ on: MCOrphanedNotification do: [:ex |
+ additions remove: ex orphan ifAbsent: [].
+ errorDefinitions add: ex orphan.
+ ex resume]]
+ on: SourceChangedDuringLoad do: [:ex |
+ modifiedDefinitions add: ex method.
+ ex pass]!
- errorDefinitions := OrderedCollection new.
- [
- [
- [ self basicLoad ] on: InMidstOfFileinNotification do: [:n | n resume: true]
-
- ] ensure: [self flushChangesFile].
-
- ] on: MCOrphanedNotification do: [ :ex | additions remove: ex orphan ifAbsent: [].
- errorDefinitions add: ex orphan.
- ex resume. ]
- !
A new version of FixUnderscores2 was added to project Monticello Public:
http://www.squeaksource.com/mc/FixUnderscores2-mtf.1.mcz
==================== Summary ====================
Name: FixUnderscores2-mtf.1
Author: mtf
Time: 10 August 2009, 8:47:44 am
UUID: 3936eb7c-5df4-4877-bd6e-f61ad581fb4d
Ancestors:
A tool to help monticello load packages with underscore assignments in Croquet, where they are illegal
==================== Snapshot ====================
SystemOrganization addCategory: #FixUnderscores2!
----- Method: WriteStream>>replaceFrom:to:with: (in category '*fixunderscores2') -----
replaceFrom: start to: stop with: aCollection
"replace a section of my backing collection, without moving the cursor"
| delta oldSize |
oldSize := stop - start + 1.
delta := aCollection size - oldSize.
readLimit > stop ifTrue: [readLimit := readLimit + delta].
writeLimit > stop ifTrue: [writeLimit := writeLimit + delta].
position > stop ifTrue: [position := position + delta].
collection := collection copyReplaceFrom: start to: stop with: aCollection!
Notification subclass: #SourceChangedDuringLoad
instanceVariableNames: 'method'
classVariableNames: ''
poolDictionaries: ''
category: 'FixUnderscores2'!
!SourceChangedDuringLoad commentStamp: '<historical>' prior: 0!
If signalled, the source code that Monticello ultimately loaded into the system is different from the code it was asked to load, due to one of two things:
- the presented code had syntax errors that the user corrected at load time
- the presented code had underscore assignments that were changed to := at load time
method: something to describe the method that changed. For MCPackageLoader1b, it is an MCMethodDefinition. For MCPackageLoader2, it is a MethodEditor!
----- Method: SourceChangedDuringLoad class>>method:reason: (in category 'as yet unclassified') -----
method: anObject reason: aString
^ self new method: anObject; message: aString; yourself!
----- Method: SourceChangedDuringLoad>>method (in category 'accessing') -----
method
"Answer the value of method"
^ method!
----- Method: SourceChangedDuringLoad>>method: (in category 'accessing') -----
method: anObject
"Set the value of method"
method := anObject!
Scanner subclass: #FixUnderscores2
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'FixUnderscores2'!
!FixUnderscores2 commentStamp: '<historical>' prior: 0!
I am a utility to change underscore assignments to :=. I only understand source strings for now, and don't yet work on already loaded code. I will probably be moved to another package later (like SystemEditor)!
----- Method: FixUnderscores2 class>>test1 (in category 'as yet unclassified') -----
test1
self assert: (self new fixUnderscores: self testString1) = self testString1Ans!
----- Method: FixUnderscores2 class>>testString1 (in category 'as yet unclassified') -----
testString1
^ 'whoisSelectedUser
"I_AM_NOT_Illegal"
| who msg |
who _ self channelUser.
who isNil
ifTrue: [^ nil].
msg := IRCProtocolMessage
command: ''W_H_O_I_S''
arguments: (Array with: self channelName with: who asString).
connection sendMessage: msg'!
----- Method: FixUnderscores2 class>>testString1Ans (in category 'as yet unclassified') -----
testString1Ans
^ 'whoisSelectedUser
"I_AM_NOT_Illegal"
| who msg |
who := self channelUser.
who isNil
ifTrue: [^ nil].
msg := IRCProtocolMessage
command: ''W_H_O_I_S''
arguments: (Array with: self channelName with: who asString).
connection sendMessage: msg'!
----- Method: FixUnderscores2>>fixUnderscores: (in category 'as yet unclassified') -----
fixUnderscores: aString
"Answer aString with _ assignments replaced with :=. Answers nil if aString has syntax errors other than underscre assignments"
[
self scan: (ReadWriteStream with: aString) reset.
[tokenType = #doIt] whileFalse: [
(tokenType = #leftArrow and: [token == #'_'])
ifTrue: [self replaceTokenWith: ':='].
self scanToken].
^ source contents
] on: SyntaxErrorNotification do: [^ nil]!
----- Method: FixUnderscores2>>replaceFrom:to:with: (in category 'as yet unclassified') -----
replaceFrom: start to: stop with: aCollection
"replace a section of my source stream with aCollection"
| delta oldSize |
oldSize := stop - start + 1.
delta := aCollection size - oldSize.
mark > stop ifTrue: [mark := mark + delta].
source replaceFrom: start to: stop with: aCollection!
----- Method: FixUnderscores2>>replaceTokenWith: (in category 'as yet unclassified') -----
replaceTokenWith: aText
"replace the current token with another"
self replaceFrom: mark
to: mark + token size - 1
with: aText!
----- Method: FixUnderscores2>>xUnderscore (in category 'as yet unclassified') -----
xUnderscore
"Do nothing special on underscore assignment. xUnderscore only exists in the croquet scanner"
tokenType := #leftArrow.
^ token := self step asSymbol!