The Trunk: Kernel-eem.927.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-eem.927.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.927.mcz

==================== Summary ====================

Name: Kernel-eem.927
Author: eem
Time: 29 May 2015, 4:04:53.411 pm
UUID: b759de23-0d29-460f-94ba-69d3ee900124
Ancestors: Kernel-eem.926

Support for condensing sources and changes while
preserving direct history.

=============== Diff against Kernel-eem.926 ===============

Item was added:
+ ----- Method: ClassDescription>>fileOutCategoryHistorically:on:moveSource:toFile: (in category 'fileIn/Out') -----
+ fileOutCategoryHistorically: aSymbol on: aFileStream moveSource: moveSource toFile: fileIndex
+ "File a description of the receiver's category, aString, onto aFileStream, preserving direct
+ history, but excluding branches . If moveSource, is true, then set the method source pointer
+ to the new file position. Note when this method is called with moveSource=true, it is
+ condensing the sources file, and should only write one preamble per method category."
+
+ | selectors |
+ aFileStream cr.
+ selectors := aSymbol asString = ClassOrganizer allCategory
+ ifTrue: [self organization allMethodSelectors]
+ ifFalse: [self organization listAtCategoryNamed: aSymbol].
+
+ selectors := selectors select: [:each | self includesLocalSelector: each].
+
+ "Overridden to preserve author stamps in sources file regardless."
+ selectors do: [:sel |
+ self printMethodChunkHistorically: sel
+ on: aFileStream
+ moveSource: moveSource
+ toFile: fileIndex]!

Item was changed:
  ----- Method: ClassDescription>>fileOutChangedMessages:on:moveSource:toFile: (in category 'fileIn/Out') -----
  fileOutChangedMessages: aSet on: aFileStream moveSource: moveSource toFile: fileIndex
  "File a description of the messages of this class that have been
  changed (i.e., are entered into the argument, aSet) onto aFileStream.  If
  moveSource, is true, then set the method source pointer to the new file position.
  Note when this method is called with moveSource=true, it is condensing the
  .changes file, and should only write a preamble for every method."
  | org |
  (org := self organization) categories do:
+ [:cat |  | sels |
- [:cat |
- | sels |
  sels := (org listAtCategoryNamed: cat) select: [:sel | aSet includes: sel].
+ (moveSource == #historically
+ or: [moveSource and: [(cat beginsWith: '*') and: [cat endsWith: '-override']]])
+ ifTrue: "when condensing sources/changes, preserve overridden methods"
+ [sels do:
+ [:sel |
+ self printMethodChunkHistorically: sel on: aFileStream
+ moveSource: moveSource ~~ false toFile: fileIndex]]
+ ifFalse:
+ [sels do:
- (moveSource and: [(cat beginsWith: '*') and: [cat endsWith: '-override']])
- ifTrue: ["when condensing sources/changes, preserve overridden methods"
- sels do:
- [:sel |  self printMethodChunkHistorically: sel on: aFileStream
- moveSource: moveSource toFile: fileIndex]]
- ifFalse: [
- sels do:
  [:sel |  self printMethodChunk: sel withPreamble: true on: aFileStream
  moveSource: moveSource toFile: fileIndex]]]!

Item was changed:
  ----- Method: ClassDescription>>fileOutOn:moveSource:toFile: (in category 'fileIn/Out') -----
  fileOutOn: aFileStream moveSource: moveSource toFile: fileIndex
+ "File a description of the receiver on aFileStream.  moveSOurce is one of
+ true, false or #historically.  If the argument, moveSource, is not false, then
+ set the trailing bytes to the position of aFileStream and to fileIndex in order
+ to indicate where to find the source code.  If moveSource == #historically,
+ print out each method's history, excluding branches"
- "File a description of the receiver on aFileStream. If the boolean
- argument, moveSource, is true, then set the trailing bytes to the position
- of aFileStream and to fileIndex in order to indicate where to find the
- source code."
 
+ aFileStream command: 'H3'; nextChunkPut: self definition; command: '/H3'.
- aFileStream command: 'H3'.
- aFileStream nextChunkPut: self definition.
- aFileStream command: '/H3'.
 
  self organization
  putCommentOnFile: aFileStream
  numbered: fileIndex
+ moveSource: moveSource ~~ false
- moveSource: moveSource
  forClass: self.
  self organization categories do:
  [:heading |
+ moveSource == #historically
+ ifTrue:
+ [self fileOutCategoryHistorically: heading
+ on: aFileStream
+ moveSource: true
+ toFile: fileIndex]
+ ifFalse:
+ [self fileOutCategory: heading
+ on: aFileStream
+ moveSource: moveSource
+ toFile: fileIndex]]!
- self fileOutCategory: heading
- on: aFileStream
- moveSource: moveSource
- toFile: fileIndex]!

Item was changed:
  ----- Method: ClassDescription>>printMethodChunkHistorically:on:moveSource:toFile: (in category 'fileIn/Out') -----
  printMethodChunkHistorically: selector on: outStream moveSource: moveSource toFile: fileIndex
  "Copy all source codes historically for the method associated with selector onto the
+ fileStream.  If moveSource is true, then also set the source code pointer of the method.
+ N.B. fileIndex is interpreted as follows, 0 => just a fileOut; 1 => condensing sources;
+ 2 => condensing changes; therefore only changes on the chnages file before the last
+ version in the sources file are recorded."
- fileStream.  If moveSource true, then also set the source code pointer of the method."
 
+ | preamble method newPos category changeList prior index |
- | preamble method sourceFile endPos category changeList newPos |
  category := self organization categoryOfElement: selector.
  preamble := self name , ' methodsFor: ', category asString printString.
  method := self methodDict at: selector.
+ (method filePosition = 0
+ or: [method fileIndex = 0
+ or: [(SourceFiles at: method fileIndex) isNil]])
+ ifTrue: "no source; must decompile"
+ [outStream cr; nextPut: $!!; nextChunkPut: preamble; cr.
+ outStream nextChunkPut: method decompileString.
+ outStream nextChunkPut: ' '; cr]
+ ifFalse:
+ [changeList := ChangeSet directAncestryOfVersions: (ChangeSet
+ scanVersionsOf: method
+ class: self
+ meta: self isMeta
+ category: category
+ selector: selector).
+ newPos := prior := nil.
+ (fileIndex = 2 "condensing changes; select changes file code and find last sources file change"
+ and: [(index := changeList findFirst: [:chgRec| chgRec fileIndex = 1]) > 0]) ifTrue:
+ [prior := changeList at: index.
+ changeList := changeList copyFrom: 1 to: index - 1].
+ changeList reverseDo:
+ [:chgRec|
+ chgRec file closed ifTrue:
+ [chgRec file reopen; setToEnd].
+ outStream copyPreamble: preamble from: chgRec file at: chgRec position.
+ prior ifNotNil:
+ [outStream
+ position: outStream position - 2;
+ nextPutAll: ' prior: ';
+ print: (SourceFiles
+ sourcePointerFromFileIndex: prior fileIndex
+ andPosition: prior position);
+ nextPut: $!!; cr].
- ((method fileIndex = 0
- or: [(SourceFiles at: method fileIndex) == nil])
- or: [method filePosition = 0])
- ifTrue: [
- outStream cr; nextPut: $!!; nextChunkPut: preamble; cr.
- outStream nextChunkPut: method decompileString.
- outStream nextChunkPut: ' '; cr]
- ifFalse: [
- changeList := ChangeSet
- scanVersionsOf: method
- class: self
- meta: self isMeta
- category: category
- selector: selector.
- newPos := nil.
- sourceFile := SourceFiles at: method fileIndex.
- changeList reverseDo: [ :chgRec | | prior |
- chgRec fileIndex = fileIndex ifTrue: [
- outStream copyPreamble: preamble from: sourceFile at: chgRec position.
- (prior := chgRec prior) ifNotNil: [
- outStream position: outStream position - 2.
- outStream nextPutAll: ' prior: ', (
- prior first = method fileIndex ifFalse: [prior third] ifTrue: [
- SourceFiles
- sourcePointerFromFileIndex: method fileIndex
- andPosition: newPos]) printString.
- outStream nextPut: $!!; cr].
  "Copy the method chunk"
  newPos := outStream position.
+ outStream copyMethodChunkFrom: chgRec file at: chgRec position.
+ chgRec file skipSeparators.      "The following chunk may have ]style["
+ chgRec file peek == $] ifTrue:
+ [outStream cr; copyMethodChunkFrom: chgRec file].
+ outStream nextChunkPut: ' '; cr.
+ chgRec position: newPos.
+ prior := chgRec].
+ moveSource ifTrue:
+ [method setSourcePosition: newPos inFile: fileIndex]].
+ ^outStream!
- outStream copyMethodChunkFrom: sourceFile at: chgRec position.
- sourceFile skipSeparators.      "The following chunk may have ]style["
- sourceFile peek == $] ifTrue: [
- outStream cr; copyMethodChunkFrom: sourceFile].
- outStream nextChunkPut: ' '; cr]].
- moveSource ifTrue: [
- endPos := outStream position.
- method checkOKToAdd: endPos - newPos at: newPos.
- method setSourcePosition: newPos inFile: fileIndex]].
- ^ outStream!

Item was changed:
  ----- Method: Metaclass>>fileOutOn:moveSource:toFile:initializing: (in category 'fileIn/Out') -----
  fileOutOn: aFileStream moveSource: moveSource toFile: fileIndex initializing: aBool
+ super fileOutOn: aFileStream moveSource: moveSource toFile: fileIndex.
+ (aBool
+ and: [moveSource == false
+ and: [self methodDict includesKey: #initialize]]) ifTrue:
+ [aFileStream cr; cr; nextChunkPut: thisClass name , ' initialize'; cr]!
- super fileOutOn: aFileStream
- moveSource: moveSource
- toFile: fileIndex.
- (aBool and:[moveSource not and: [self methodDict includesKey: #initialize]]) ifTrue:
- [aFileStream cr.
- aFileStream cr.
- aFileStream nextChunkPut: thisClass name , ' initialize'.
- aFileStream cr]!