[squeak-dev] The Trunk: CommandLine-fbs.1.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Thu Oct 31 23:02:06 UTC 2013
+1, please include in the update.mcm!
I also like the Pharo alternative to Fuel out the error context...
Lighter than full image save. Oh but we don't have Fuel yet :(
Who wants to make it with a segment?
2013/10/31 <commits at source.squeak.org>
> Frank Shearar uploaded a new version of CommandLine to project The Trunk:
> http://source.squeak.org/trunk/CommandLine-fbs.1.mcz
>
> ==================== Summary ====================
>
> Name: CommandLine-fbs.1
> Author: fbs
> Time: 31 October 2013, 10:32:52.821 pm
> UUID: dc871e85-bd16-d742-acbf-4d2b838113d1
> Ancestors:
>
> CommandLineToolSet does little more than dump errors to stderr.
>
> DummyUIManager comes from Pharo via Pavel Krivanek's minimising script.
>
> ==================== Snapshot ====================
>
> SystemOrganization addCategory: #'CommandLine-Tools'!
> SystemOrganization addCategory: #'CommandLine-UIManager'!
>
> UIManager subclass: #DummyUIManager
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'CommandLine-UIManager'!
>
> !DummyUIManager commentStamp: 'fbs 10/31/2013 07:36' prior: 0!
> I'm an alternative UIManager used to run an the image without GUI. I
> redefine methods which require user input as these requests are irrelevant
> in a headless environment. !
>
> ----- Method: DummyUIManager>>checkForNewDisplaySize (in category
> 'display') -----
> checkForNewDisplaySize
> Display extent = DisplayScreen actualScreenSize ifTrue: [^ self].
> DisplayScreen startUp.
> !
>
> ----- Method: DummyUIManager>>chooseDirectory:from: (in category 'ui
> requests') -----
> chooseDirectory: label from: dir
> ^ nil!
>
> ----- Method: DummyUIManager>>chooseFrom:lines:title: (in category 'ui
> requests') -----
> chooseFrom: aList lines: linesArray title: aString
> ^ aList first!
>
> ----- Method: DummyUIManager>>chooseFrom:values:lines:title: (in category
> 'ui requests') -----
> chooseFrom: labelList values: valueList lines: linesArray title: aString
> ^ valueList first!
>
> ----- Method: DummyUIManager>>confirm: (in category 'ui requests') -----
> confirm: queryString
> (ProvideAnswerNotification signal: queryString)
> ifNotNil: [:answer|^answer].
>
> self error: 'No user response possible'!
>
> ----- Method: DummyUIManager>>confirm:orCancel: (in category 'ui
> requests') -----
> confirm: aString orCancel: cancelBlock
> (ProvideAnswerNotification signal: aString) ifNotNil: [:answer |
> ^answer == #cancel ifTrue: [cancelBlock value] ifFalse: [answer]].
>
> self error: 'No user response possible'!
>
> ----- Method: DummyUIManager>>displayProgress:at:from:to:during: (in
> category 'ui requests') -----
> displayProgress: titleString at: aPoint from: minVal to: maxVal during:
> workBlock
> ^ workBlock value: Association new!
>
> ----- Method: DummyUIManager>>edit:label:accept: (in category 'ui
> requests') -----
> edit: aText label: labelString accept: anAction
> ^ nil!
>
> ----- Method: DummyUIManager>>fontFromUser: (in category 'ui requests')
> -----
> fontFromUser: priorFont
> self error: 'No user response possible'!
>
> ----- Method: DummyUIManager>>inform: (in category 'ui requests') -----
> inform: aString
> "Nothing to be done here"!
>
> ----- Method: DummyUIManager>>informUserDuring: (in category 'ui
> requests') -----
> informUserDuring: aBlock
> aBlock value: nil!
>
> ----- Method: DummyUIManager>>newDisplayDepthNoRestore: (in category
> 'display') -----
> newDisplayDepthNoRestore: pixelSize
> "Change depths. Check if there is enough space!! , di"
> | area need |
> pixelSize = Display depth ifTrue: [^ self "no change"].
> pixelSize abs < Display depth ifFalse:
> ["Make sure there is enough space"
> area := Display boundingBox area. "pixels"
>
> need := (area * (pixelSize abs - Display depth) // 8)
> "new bytes needed"
> + Smalltalk lowSpaceThreshold.
> (Smalltalk garbageCollectMost <= need
> and: [Smalltalk garbageCollect <= need])
> ifTrue: [self error: 'Insufficient free space']].
> Display setExtent: Display extent depth: pixelSize.
>
> DisplayScreen startUp!
>
> ----- Method: DummyUIManager>>request:initialAnswer: (in category 'ui
> requests') -----
> request: queryString initialAnswer: defaultAnswer
> (ProvideAnswerNotification signal: queryString)
> ifNotNil: [:answer |
> ^ answer == #default ifTrue: [defaultAnswer] ifFalse:
> [answer]].
>
> self error: 'No user response possible'!
>
> ----- Method: DummyUIManager>>requestPassword: (in category 'ui requests')
> -----
> requestPassword: queryString
> ^ self request: queryString initialAnswer: ''!
>
> ----- Method: DummyUIManager>>restoreDisplay (in category 'display') -----
> restoreDisplay!
>
> ----- Method: DummyUIManager>>restoreDisplayAfter: (in category 'display')
> -----
> restoreDisplayAfter: aBlock
> aBlock value.
> Sensor waitButton.!
>
> StandardToolSet subclass: #CommandLineToolSet
> instanceVariableNames: ''
> classVariableNames: 'SaveSnapshotOnError'
> poolDictionaries: ''
> category: 'CommandLine-Tools'!
>
> ----- Method: CommandLineToolSet class>>debugError: (in category
> 'debugging') -----
> debugError: anError
> "Print out a sensible stack trace and bail"
> | problemPlace s |
> self saveSnapshotOnError
> ifTrue: [Smalltalk saveAs: 'Debug-' , (Smalltalk imageName
> subStrings: '/') last].
> problemPlace := anError signalerContext.
> s := FileStream stderr.
> (anError isKindOf: MessageNotUnderstood) ifTrue: [
> s
> nextPutAll: anError messageText; cr;
> nextPutAll: problemPlace sender methodNode
> printString; cr].
> (problemPlace stackOfSize: 20) do: [:ctx | s cr. ctx printOn: s].
> s flush.
>
> SmalltalkImage current snapshot: false andQuit: true!
>
> ----- Method: CommandLineToolSet class>>debugSyntaxError: (in category
> 'debugging') -----
> debugSyntaxError: anError
> | s |
> s := FileStream stderr.
> s nextPutAll: '----- Syntax error -----'; cr.
> s nextPutAll: anError errorCode; cr.
> s nextPutAll: '----- Syntax error -----'; cr.
>
> self debugError: anError!
>
> ----- Method: CommandLineToolSet class>>saveSnapshotOnError (in category
> 'preferences') -----
> saveSnapshotOnError
> <preference: 'Save snapshot of image on failure'
> category: 'debug'
> description: 'If true, saves a snapshot of the failing image to
> the current directory.'
> type: #Boolean>
> ^ SaveSnapshotOnError ifNil: [SaveSnapshotOnError := false].!
>
> ----- Method: CommandLineToolSet class>>saveSnapshotOnError: (in category
> 'preferences') -----
> saveSnapshotOnError: aBoolean
> SaveSnapshotOnError := aBoolean.!
>
> ----- Method: CommandLineToolSet class>>unload (in category 'class
> initialization') -----
> unload
> ToolSet unregister: self.!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131101/2e2768be/attachment.htm
More information about the Squeak-dev
mailing list
|