--- a/HistMgr.st Sat Jan 27 19:33:42 1996 +0100
+++ b/HistMgr.st Fri Feb 02 17:25:01 1996 +0100
@@ -112,18 +112,25 @@
activate
self new "/ creating an instance activates me
+
+ "
+ HistoryManager activate
+ "
!
deactivate
+ |mgr|
+
+ mgr := TheOneAndOnlyInstance.
Smalltalk allClassesDo:[:aClass |
- aClass removeDependent:TheOneAndOnlyInstance.
- aClass class removeDependent:TheOneAndOnlyInstance.
+ aClass removeDependent:mgr.
+ aClass class removeDependent:mgr.
].
TheOneAndOnlyInstance := nil.
-"
- HistoryManager release
-"
+ "
+ HistoryManager deactivate
+ "
! !
!HistoryManager class methodsFor:'change and update'!
@@ -243,7 +250,7 @@
historyMode := true.
exclusionlist := self exclude.
- Smalltalk allClasses do:[:aClass|
+ Smalltalk allClassesDo:[:aClass|
"all classes should send a notification if changed"
"aClass = self " false ifFalse: [
(exclusionlist includes: aClass) ifFalse:[
@@ -271,26 +278,26 @@
"Check whether we want a history to be added"
historyMode ifFalse:[
- ^ someString
+ ^ someString
].
previousHistories := self class getAllHistoriesFrom:someString.
"extract source body."
previousHistories isEmpty ifTrue: [
- sourceCode := someString withoutSeparators.
- forceModification ifTrue:[
- newLine := (HistoryLine new)
- ] ifFalse:[
- newLine := (HistoryLine newCreated).
- ]
+ sourceCode := someString withoutSeparators.
+ forceModification ifTrue:[
+ newLine := (HistoryLine new)
+ ] ifFalse:[
+ newLine := (HistoryLine newCreated).
+ ]
] ifFalse: [
- pos := (previousHistories first) firstPositionInSourceCode.
- sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
- forceCreation ifTrue:[
- newLine := (HistoryLine newCreated).
- ] ifFalse:[
- newLine := (HistoryLine new)
- ]
+ pos := (previousHistories first) firstPositionInSourceCode.
+ sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
+ forceCreation ifTrue:[
+ newLine := (HistoryLine newCreated).
+ ] ifFalse:[
+ newLine := (HistoryLine new)
+ ]
].
"add the actual user's historyLine."
@@ -320,17 +327,17 @@
|cls historyMethod oldSource newSource|
aClass isMeta ifFalse:[
- cls := aClass class.
+ cls := aClass class.
] ifTrue:[
- cls := aClass
+ cls := aClass
].
historyMethod := cls compiledMethodAt: #history.
historyMethod notNil ifTrue:[
- oldSource := historyMethod source.
- oldSource notNil ifTrue:[
- newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false.
- historyMethod source:newSource.
- ]
+ oldSource := historyMethod source.
+ oldSource notNil ifTrue:[
+ newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false.
+ historyMethod source:newSource.
+ ]
]
"Modified: 13.12.1995 / 14:05:30 / cg"
@@ -355,94 +362,94 @@
fileInOrRecompiling ifFalse:[
"/ Transcript showCr: '* noChange in history'.
- ^ self
+ ^ self
].
historyMode ifFalse:[
- ^ self
+ ^ self
].
"
Class Variables
"
(something == #definition) ifTrue:[
- "add handling for classes here ..."
- "/ self addHistoryToHistoryMethodOf:changedObject.
+ "add handling for classes here ..."
+ "/ self addHistoryToHistoryMethodOf:changedObject.
].
"this is a sub item of #definition"
(something == #classVariables) ifTrue:[
- "
- Transcript showCr: 'classVariables changed'.
- "
- "/ does not yet work;
- "/ (someArgument does not contain the class we are interested in)
+ "
+ Transcript showCr: 'classVariables changed'.
+ "
+ "/ does not yet work;
+ "/ (someArgument does not contain the class we are interested in)
- self addHistoryToHistoryMethodOf:changedObject.
- ^ self
+ self addHistoryToHistoryMethodOf:changedObject.
+ ^ self
].
"
new Class creation
"
((changedObject == Smalltalk) and:[something == #newClass]) ifTrue:[
- "/
- "/ add myself as dependents in order to get future change notifications
- "/
- someArgument addDependent: self.
- someArgument class addDependent: self. "for class methods"
- someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false). "append historyString for new class"
+ "/
+ "/ add myself as dependents in order to get future change notifications
+ "/
+ someArgument addDependent: self.
+ someArgument class addDependent: self. "for class methods"
+ someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false). "append historyString for new class"
].
"
changed methods
"
changedObject isBehavior ifTrue:[
- something = #methodDictionary ifTrue:[
- someArgument isArray ifTrue:[
- selector := someArgument at:1.
- oldMethod := someArgument at:2
- ] ifFalse:[
- selector := someArgument
- ].
+ something = #methodDictionary ifTrue:[
+ someArgument isArray ifTrue:[
+ selector := someArgument at:1.
+ oldMethod := someArgument at:2
+ ] ifFalse:[
+ selector := someArgument
+ ].
- "/
- "/ fetch sourceString of the method
- "/
- sourceCode := changedObject sourceCodeAt:selector.
- sourceCode isNil ifTrue:[
- "method has been deleted"
+ "/
+ "/ fetch sourceString of the method
+ "/
+ sourceCode := changedObject sourceCodeAt:selector.
+ sourceCode isNil ifTrue:[
+ "method has been deleted"
"/ Transcript showCr: 'method has been deleted'.
- ] ifFalse:[
- newMethod := changedObject compiledMethodAt:selector.
+ ] ifFalse:[
+ newMethod := changedObject compiledMethodAt:selector.
- oldMethod notNil ifTrue:[
- (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
- "/ no change (accepted same code again ?)
- ^ self
- ].
- ].
+ oldMethod notNil ifTrue:[
+ (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
+ "/ no change (accepted same code again ?)
+ ^ self
+ ].
+ ].
- "/
- "/ dont add historylines to documentation methods ...
- "/
- (changedObject isMeta not
- or:[newMethod category ~= 'documentation']) ifTrue:[
- sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil).
- newMethod source: sourceCode.
+ "/
+ "/ dont add historylines to documentation methods ...
+ "/
+ (changedObject isMeta not
+ or:[newMethod category ~= 'documentation']) ifTrue:[
+ sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil).
+ newMethod source: sourceCode.
"/ Transcript showCr: 'history updated / added'.
- ]
- ].
- ^self
- ].
+ ]
+ ].
+ ^self
+ ].
- something == #comment ifTrue:[
- "in someArgument steht jetzt der alte kommentar"
- ^ self.
- ] ifFalse:[
- "it is a class definition"
+ something == #comment ifTrue:[
+ "in someArgument steht jetzt der alte kommentar"
+ ^ self.
+ ] ifFalse:[
+ "it is a class definition"
"/ Transcript show: 'Class definition: ', changedObject printString;cr.
- self addHistoryToHistoryMethodOf:changedObject.
- ].
+ self addHistoryToHistoryMethodOf:changedObject.
+ ].
].
^self
@@ -454,6 +461,6 @@
!HistoryManager class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/Attic/HistMgr.st,v 1.18 1995-12-15 12:09:05 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/Attic/HistMgr.st,v 1.19 1996-02-02 16:25:01 cg Exp $'
! !
HistoryManager initialize!
--- a/HistoryManager.st Sat Jan 27 19:33:42 1996 +0100
+++ b/HistoryManager.st Fri Feb 02 17:25:01 1996 +0100
@@ -112,18 +112,25 @@
activate
self new "/ creating an instance activates me
+
+ "
+ HistoryManager activate
+ "
!
deactivate
+ |mgr|
+
+ mgr := TheOneAndOnlyInstance.
Smalltalk allClassesDo:[:aClass |
- aClass removeDependent:TheOneAndOnlyInstance.
- aClass class removeDependent:TheOneAndOnlyInstance.
+ aClass removeDependent:mgr.
+ aClass class removeDependent:mgr.
].
TheOneAndOnlyInstance := nil.
-"
- HistoryManager release
-"
+ "
+ HistoryManager deactivate
+ "
! !
!HistoryManager class methodsFor:'change and update'!
@@ -243,7 +250,7 @@
historyMode := true.
exclusionlist := self exclude.
- Smalltalk allClasses do:[:aClass|
+ Smalltalk allClassesDo:[:aClass|
"all classes should send a notification if changed"
"aClass = self " false ifFalse: [
(exclusionlist includes: aClass) ifFalse:[
@@ -271,26 +278,26 @@
"Check whether we want a history to be added"
historyMode ifFalse:[
- ^ someString
+ ^ someString
].
previousHistories := self class getAllHistoriesFrom:someString.
"extract source body."
previousHistories isEmpty ifTrue: [
- sourceCode := someString withoutSeparators.
- forceModification ifTrue:[
- newLine := (HistoryLine new)
- ] ifFalse:[
- newLine := (HistoryLine newCreated).
- ]
+ sourceCode := someString withoutSeparators.
+ forceModification ifTrue:[
+ newLine := (HistoryLine new)
+ ] ifFalse:[
+ newLine := (HistoryLine newCreated).
+ ]
] ifFalse: [
- pos := (previousHistories first) firstPositionInSourceCode.
- sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
- forceCreation ifTrue:[
- newLine := (HistoryLine newCreated).
- ] ifFalse:[
- newLine := (HistoryLine new)
- ]
+ pos := (previousHistories first) firstPositionInSourceCode.
+ sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
+ forceCreation ifTrue:[
+ newLine := (HistoryLine newCreated).
+ ] ifFalse:[
+ newLine := (HistoryLine new)
+ ]
].
"add the actual user's historyLine."
@@ -320,17 +327,17 @@
|cls historyMethod oldSource newSource|
aClass isMeta ifFalse:[
- cls := aClass class.
+ cls := aClass class.
] ifTrue:[
- cls := aClass
+ cls := aClass
].
historyMethod := cls compiledMethodAt: #history.
historyMethod notNil ifTrue:[
- oldSource := historyMethod source.
- oldSource notNil ifTrue:[
- newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false.
- historyMethod source:newSource.
- ]
+ oldSource := historyMethod source.
+ oldSource notNil ifTrue:[
+ newSource := self addHistoryTo:oldSource forceModification:false forceCreation:false.
+ historyMethod source:newSource.
+ ]
]
"Modified: 13.12.1995 / 14:05:30 / cg"
@@ -355,94 +362,94 @@
fileInOrRecompiling ifFalse:[
"/ Transcript showCr: '* noChange in history'.
- ^ self
+ ^ self
].
historyMode ifFalse:[
- ^ self
+ ^ self
].
"
Class Variables
"
(something == #definition) ifTrue:[
- "add handling for classes here ..."
- "/ self addHistoryToHistoryMethodOf:changedObject.
+ "add handling for classes here ..."
+ "/ self addHistoryToHistoryMethodOf:changedObject.
].
"this is a sub item of #definition"
(something == #classVariables) ifTrue:[
- "
- Transcript showCr: 'classVariables changed'.
- "
- "/ does not yet work;
- "/ (someArgument does not contain the class we are interested in)
+ "
+ Transcript showCr: 'classVariables changed'.
+ "
+ "/ does not yet work;
+ "/ (someArgument does not contain the class we are interested in)
- self addHistoryToHistoryMethodOf:changedObject.
- ^ self
+ self addHistoryToHistoryMethodOf:changedObject.
+ ^ self
].
"
new Class creation
"
((changedObject == Smalltalk) and:[something == #newClass]) ifTrue:[
- "/
- "/ add myself as dependents in order to get future change notifications
- "/
- someArgument addDependent: self.
- someArgument class addDependent: self. "for class methods"
- someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false). "append historyString for new class"
+ "/
+ "/ add myself as dependents in order to get future change notifications
+ "/
+ someArgument addDependent: self.
+ someArgument class addDependent: self. "for class methods"
+ someArgument history:(self addHistoryTo:String new forceModification:false forceCreation:false). "append historyString for new class"
].
"
changed methods
"
changedObject isBehavior ifTrue:[
- something = #methodDictionary ifTrue:[
- someArgument isArray ifTrue:[
- selector := someArgument at:1.
- oldMethod := someArgument at:2
- ] ifFalse:[
- selector := someArgument
- ].
+ something = #methodDictionary ifTrue:[
+ someArgument isArray ifTrue:[
+ selector := someArgument at:1.
+ oldMethod := someArgument at:2
+ ] ifFalse:[
+ selector := someArgument
+ ].
- "/
- "/ fetch sourceString of the method
- "/
- sourceCode := changedObject sourceCodeAt:selector.
- sourceCode isNil ifTrue:[
- "method has been deleted"
+ "/
+ "/ fetch sourceString of the method
+ "/
+ sourceCode := changedObject sourceCodeAt:selector.
+ sourceCode isNil ifTrue:[
+ "method has been deleted"
"/ Transcript showCr: 'method has been deleted'.
- ] ifFalse:[
- newMethod := changedObject compiledMethodAt:selector.
+ ] ifFalse:[
+ newMethod := changedObject compiledMethodAt:selector.
- oldMethod notNil ifTrue:[
- (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
- "/ no change (accepted same code again ?)
- ^ self
- ].
- ].
+ oldMethod notNil ifTrue:[
+ (oldMethod source asString withTabsExpanded = sourceCode asString withTabsExpanded) ifTrue:[
+ "/ no change (accepted same code again ?)
+ ^ self
+ ].
+ ].
- "/
- "/ dont add historylines to documentation methods ...
- "/
- (changedObject isMeta not
- or:[newMethod category ~= 'documentation']) ifTrue:[
- sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil).
- newMethod source: sourceCode.
+ "/
+ "/ dont add historylines to documentation methods ...
+ "/
+ (changedObject isMeta not
+ or:[newMethod category ~= 'documentation']) ifTrue:[
+ sourceCode := self addHistoryTo:sourceCode forceModification:(oldMethod notNil) forceCreation:(oldMethod isNil).
+ newMethod source: sourceCode.
"/ Transcript showCr: 'history updated / added'.
- ]
- ].
- ^self
- ].
+ ]
+ ].
+ ^self
+ ].
- something == #comment ifTrue:[
- "in someArgument steht jetzt der alte kommentar"
- ^ self.
- ] ifFalse:[
- "it is a class definition"
+ something == #comment ifTrue:[
+ "in someArgument steht jetzt der alte kommentar"
+ ^ self.
+ ] ifFalse:[
+ "it is a class definition"
"/ Transcript show: 'Class definition: ', changedObject printString;cr.
- self addHistoryToHistoryMethodOf:changedObject.
- ].
+ self addHistoryToHistoryMethodOf:changedObject.
+ ].
].
^self
@@ -454,6 +461,6 @@
!HistoryManager class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.18 1995-12-15 12:09:05 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.19 1996-02-02 16:25:01 cg Exp $'
! !
HistoryManager initialize!