--- a/HistoryManager.st Thu Sep 07 14:05:49 1995 +0200
+++ b/HistoryManager.st Fri Sep 08 21:06:02 1995 +0200
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.4 1995-09-07 12:05:49 claus Exp $
+$Header: /cvs/stx/stx/libbasic3/HistoryManager.st,v 1.5 1995-09-08 19:06:02 claus Exp $
"
!
@@ -153,6 +153,63 @@
"
! !
+!HistoryManager class methodsFor:'helpers'!
+
+getAllHistoriesFrom:someString
+ "returns anArray of HistoryLines"
+
+ |position aReadWriteStream firstFound nextFound aHistoryString rcOC h|
+
+ "read begining from the end and look there for the first comment character. If there's none return"
+
+ rcOC := OrderedCollection new.
+ position := someString size.
+ firstFound := false.
+ nextFound := false.
+
+ someString reverseDo:[ :aChar|
+ position := position - 1.
+ aChar = $" ifTrue:[
+ firstFound ifTrue:[
+ firstFound := false.
+ nextFound := true.
+ ] ifFalse:[
+ aReadWriteStream := ReadWriteStream on: String new.
+ firstFound := true.
+ nextFound := false.
+ ].
+ ].
+ (firstFound and: [nextFound not]) ifTrue:[
+ "now collect all up to the next comment character"
+ aChar = $" ifFalse:[
+ aReadWriteStream nextPut: aChar.
+ ].
+ ].
+ nextFound ifTrue:[
+ "End reached - now try to make a HistoryLine"
+ aHistoryString := (aReadWriteStream contents) reverse.
+ "
+ Transcript showCr: aHistoryString.
+ "
+ h := HistoryLine fromString: aHistoryString at: position.
+ h notNil ifTrue:[
+ rcOC add:h.
+ ].
+"/ (aHistoryString startsWith: 'Modified:') ifTrue:[
+"/ "a history line was found - now make a NewInstance of HistoryLine"
+"/ rcOC add: ( HistoryLine fromString: aHistoryString at: position).
+"/ ].
+ nextFound := false.
+ ].
+ ].
+
+ ^rcOC reverse "the OrderedCollection with HistoryLines in the right order"
+
+ "Modified: 21.12.1993 / 18:32:30 / M.Noell"
+ "Modified: 9.8.1995 / 22:45:30 / R.Sailer"
+ "Modified: 8.9.1995 / 17:54:33 / claus"
+! !
+
!HistoryManager methodsFor:'accessing'!
historyMode
@@ -218,9 +275,10 @@
"private - add a historyLine at end to the sourceCode;
check for multiple lines of the same user and merge into one."
- | histLines pos hm wStream sourceCode historyMode previousHistories |
+ | histLines pos hm wStream sourceCode historyMode previousHistories
+ newLine |
- previousHistories := self getAllHistoriesFrom:someString.
+ previousHistories := self class getAllHistoriesFrom:someString.
"Check whether there is a Manager"
"/ hm := Smalltalk at: #HistoryManager ifAbsent: [ Transcript show: 'no HistoryManager present'.^someString].
@@ -235,13 +293,15 @@
"extract source body."
previousHistories isEmpty ifTrue: [
sourceCode := someString withoutSeparators.
+ newLine := (HistoryLine newCreated).
] ifFalse: [
pos := (previousHistories first) firstPositionInSourceCode.
sourceCode := (someString copyFrom: 1 to: pos - 1) withoutSeparators.
+ newLine := (HistoryLine new).
].
"add the actual user's historyLine."
- previousHistories add: (HistoryLine new).
+ previousHistories add:newLine.
"Filtering historyLines each user with one entry)."
histLines := HistoryLine filterHistoryLines: previousHistories.
@@ -258,58 +318,8 @@
^wStream contents.
- "Modified: 11.08.1995 / 16:51:50 / robert"
-!
-
-getAllHistoriesFrom:someString
- "returns anArray of HistoryLines"
-
- |position aReadWriteStream firstFound nextFound aHistoryString rcOC |
-
- "read begining from the end and look there for the first comment character. If there's none return"
-
- rcOC := OrderedCollection new.
- position := someString size.
- firstFound := false.
- nextFound := false.
-
- someString reverseDo:[ :aChar|
- position := position - 1.
- aChar = $" ifTrue:[
- firstFound ifTrue:[
- firstFound := false.
- nextFound := true.
- ] ifFalse:[
- aReadWriteStream := ReadWriteStream on: String new.
- firstFound := true.
- nextFound := false.
- ].
- ].
- (firstFound and: [nextFound not]) ifTrue:[
- "now collect all up to the next comment character"
- aChar = $" ifFalse:[
- aReadWriteStream nextPut: aChar.
- ].
- ].
- nextFound ifTrue:[
- "End reached - now try to make a HistoryLine"
- aHistoryString := (aReadWriteStream contents) reverse.
- "
- Transcript showCr: aHistoryString.
- "
- (aHistoryString startsWith: 'Modified:') ifTrue:[
- "a history line was found - now make a NewInstance of HistoryLine"
- rcOC add: ( HistoryLine fromString: aHistoryString at: position).
- ].
- nextFound := false.
- ].
- ].
-
- ^rcOC reverse "the OrderedCollection with HistoryLines in the right order"
-
-
- "Modified: 21.12.93 / 18:32:30 / M.Noell"
- "Modified: 09.08.95 / 22:45:30 / R.Sailer"
+ "Modified: 11.8.1995 / 16:51:50 / robert"
+ "Modified: 8.9.1995 / 17:55:38 / claus"
!
update: something with: someArgument from: changedObject