FFI: FFI-Tools-mt.2.mcz

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

FFI: FFI-Tools-mt.2.mcz

commits-2
Marcel Taeumel uploaded a new version of FFI-Tools to project FFI:
http://source.squeak.org/FFI/FFI-Tools-mt.2.mcz

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

Name: FFI-Tools-mt.2
Author: mt
Time: 19 May 2020, 2:35:13.809702 pm
UUID: 9d58bef4-eee3-f741-b93c-6cd39fb77d05
Ancestors: FFI-Tools-mt.1

Adds basic tool support for Squeak's ObjectExplorer.

=============== Diff against FFI-Tools-mt.1 ===============

Item was added:
+ ----- Method: ExternalObject class>>toolIcon (in category '*FFI-Tools') -----
+ toolIcon
+
+ ^ #externalObject!

Item was added:
+ ----- Method: ExternalStructure class>>allFieldSelectors (in category '*FFI-Tools') -----
+ allFieldSelectors
+ "Answer a list of all simple getters for fields in this structure. Rely on the #fields definition but only return selectors that are actually implemented. Consequently for any change in #fields, #defineFields should be called before calling this method."
+
+ ^ self isTypeAlias
+ ifTrue: [#()]
+ ifFalse: [self fields
+ collect: [:spec | spec first]
+ thenSelect: [:selector |
+ selector notNil and: [self includesSelector: selector]]]!

Item was added:
+ ----- Method: ExternalStructure class>>isTypeAlias (in category '*FFI-Tools') -----
+ isTypeAlias
+ "Answer whether this structure is an alias for another C type, enum, etc."
+ "Example: #( nil 'long' )"
+
+ | fields |
+ ^ (fields := self fields) size = 2
+ and: [fields first isNil]!

Item was added:
+ ----- Method: ExternalStructure class>>toolIcon (in category '*FFI-Tools') -----
+ toolIcon
+
+ ^ #externalStructure!

Item was added:
+ ----- Method: ExternalStructure>>explorerContents (in category '*FFI-Tools') -----
+ explorerContents
+
+ ^ self class allFieldSelectors replace: [:simpleGetter |
+ ObjectExplorerWrapper
+ with: (self perform: simpleGetter)
+ name: simpleGetter
+ model: self]!

Item was added:
+ ----- Method: ExternalStructure>>hasContentsInExplorer (in category '*FFI-Tools') -----
+ hasContentsInExplorer
+
+ ^ self class allFieldSelectors notEmpty!

Item was removed:
- ----- Method: ExternalStructureInspector>>recordFieldList (in category 'accessing') -----
- recordFieldList
- | fields |
- fields := object class fields.
- (fields first isKindOf: Array) ifFalse: [fields := Array with: fields].
- ^fields collect: [ :field | field first ] thenSelect: [:name | name notNil]!

Item was changed:
  ----- Method: ExternalStructureInspector>>streamRecordFieldsOn: (in category 'fields - streaming') -----
  streamRecordFieldsOn: aStream
 
+ self object class allFieldSelectors do: [:field |
- self recordFieldList do: [:field |
  aStream nextPut: ((self newFieldForType: #record key: field)
  valueGetter: [:object | object perform: field];
  valueSetter: [:object :value | (field, ':') asSymbol with: value];
  yourself)].!

Item was added:
+ ----- Method: ToolIcons class>>externalObject (in category '*FFI-Tools') -----
+ externalObject
+
+ ^ (Form
+ extent: 12@12
+ depth: 32
+ fromArray: #( 0 4294967295 4294967295 4294967295 0 4294967295 4294967295 4294967295 0 4294967295 0 0 4294967295 4278190080 4278190080 4278190080 4294967295 4278190080 4278190080 4278190080 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 4294967295 4294967295 4278190080 4294967295 4294967295 4294967295 4278190080 4294967295 0 4294967295 4278190080 4278190080 4294967295 4294967295 4278190080 4278190080 4294967295 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 0 4294967295 0 0 0 4294967295 0 0 0 4294967295 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
+ offset: 0@0)!

Item was added:
+ ----- Method: ToolIcons class>>externalStructure (in category '*FFI-Tools') -----
+ externalStructure
+
+ ^ (Form
+ extent: 12@12
+ depth: 32
+ fromArray: #( 0 4294967295 4294967295 4294967295 0 4294967295 4294967295 4294967295 0 4294967295 0 0 4294967295 4278190080 4278190080 4278190080 4294967295 4278190080 4278190080 4278190080 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 4294967295 4294967295 4278190080 4294967295 4294967295 4294967295 4278190080 4294967295 0 4294967295 4278190080 4278190080 4294967295 4294967295 4278190080 4278190080 4294967295 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 4294967295 4278190080 4294967295 0 0 4294967295 0 0 4278235136 4278235136 4278235136 0 0 4294967295 0 0 0 0 0 4278235136 4278235136 4294967295 4294967295 4278235136 0 0 0 0 0 0 0 4278235136 4294967295 4294967295 4278235136 4278235136 0 0 0 0 0 0 0 4278235136 4278235136 4294967295 4294967295 4278235136 0 0 0 0 0 0 0 4278235136 4294967295 4294967295
 4278235136 4278235136 0 0 0 0 0 0 0 0 4278235136 4278235136 4278235136 0 0 0 0 0)
+ offset: 0@0)!