FFI: FFI-Tools-mt.12.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.12.mcz

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

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

Name: FFI-Tools-mt.12
Author: mt
Time: 6 June 2020, 2:16:38.695722 pm
UUID: 591b817d-fd8f-b24e-9a58-b4abe7980316
Ancestors: FFI-Tools-mt.11

- complements FFI-Kernel-mt.97
- fixes bugs when exploring external data
- fixes bugs when exploring type aliases
- makes ExternalStructureInspector work again
- adds copyright to FFI tool icons

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

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

Item was added:
+ ----- Method: ExternalData>>explorerContentsTypeFields (in category '*FFI-Tools') -----
+ explorerContentsTypeFields
+ "Ignore because our type is already in the basic explorer fields because it is an instance variable."
+ ^ #()!

Item was changed:
  ----- 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 flag: #dicuss. "mt: To which extent should tools support type aliasing when subclassing ExternalStructure instead of subclassing ExternalTypeAlias."
  ^ self isTypeAlias
+ ifTrue: [(ExternalType typeNamed: self originalTypeName) referentClass
+ ifNil: [#()] ifNotNil: [:structClass | structClass allFieldSelectors]]
+ ifFalse: [
+ self fields
+ collect: [:spec | spec first]
+ thenSelect: [:selector |
+ selector notNil and: [self includesSelector: selector]]]!
- ifTrue: [#()]
- ifFalse: [self fields
- collect: [:spec | spec first]
- thenSelect: [:selector |
- selector notNil and: [self includesSelector: selector]]]!

Item was changed:
  ----- Method: ExternalStructure>>explorerContents (in category '*FFI-Tools') -----
  explorerContents
 
  | basicExplorerFields |
  basicExplorerFields := super explorerContents.
  basicExplorerFields do: [:explorerField |
  explorerField itemName: '_', explorerField itemName].
+ ^ basicExplorerFields,
+ self explorerContentsTypeFields,
+ self explorerContentsStructFields!
- ^ basicExplorerFields, (self class allFieldSelectors replace: [:simpleGetter |
- ObjectExplorerWrapper
- with: (self isNull ifFalse: [self perform: simpleGetter])
- name: simpleGetter
- model: self])!

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

Item was added:
+ ----- Method: ExternalStructure>>explorerContentsTypeFields (in category '*FFI-Tools') -----
+ explorerContentsTypeFields
+
+ ^ {ObjectExplorerWrapper
+ with: (handle isExternalAddress ifTrue: [self class externalType asPointerType] ifFalse: [self class externalType])
+ name: '_type'
+ model: self}!

Item was changed:
  ----- Method: ExternalStructureInspector>>streamFieldsOn: (in category 'fields - streaming') -----
  streamFieldsOn: aStream
 
  self
  streamBaseFieldsOn: aStream;
+ streamVariableFieldsOn: aStream;
+ streamRecordFieldsOn: aStream;
+ streamCustomFieldsOn: aStream.!
- streamRecordFieldsOn: aStream.!

Item was changed:
  ----- Method: ExternalStructureInspector>>streamRecordFieldsOn: (in category 'fields - streaming') -----
  streamRecordFieldsOn: aStream
+ "Supports type aliases through #value field. See ExternalTypeAlias."
+
-
  self object class allFieldSelectors do: [:field |
  aStream nextPut: ((self newFieldForType: #record key: field)
+ name: '#', field;
+ valueGetter: [:object | object isNull ifFalse: [object value perform: field]];
+ valueSetter: [:object :value | object isNull ifFalse: [object value perform: (field, ':') asSymbol with: value]];
- valueGetter: [:object | object isNull ifFalse: [object perform: field]];
- valueSetter: [:object :value | object isNull ifFalse: [(field, ':') asSymbol with: value]];
  yourself)].!

Item was added:
+ ----- Method: ExternalType>>explorerContents (in category '*FFI-Tools') -----
+ explorerContents
+
+ | basicExplorerFields originalTypeField |
+ basicExplorerFields := super explorerContents.
+ self isTypeAlias ifFalse: [^ basicExplorerFields].
+ originalTypeField := ObjectExplorerWrapper
+ with: self originalType
+ name: '_originalType'
+ model: self.
+ ^ {originalTypeField}, basicExplorerFields!

Item was added:
+ ----- Method: ExternalTypeAlias class>>allFieldSelectors (in category '*FFI-Tools') -----
+ allFieldSelectors
+ "Overridden because we know that we are an alias."
+
+ ^ (ExternalType typeNamed: self originalTypeName) referentClass
+ ifNil: [#()]
+ ifNotNil: [:structClass | structClass allFieldSelectors]!

Item was added:
+ ----- Method: ExternalTypeAlias>>explorerContentsTypeFields (in category '*FFI-Tools') -----
+ explorerContentsTypeFields
+ "Add a field to -- just in case -- explore the external object after casting to it."
+
+ ^ super explorerContentsTypeFields, {ObjectExplorerWrapper
+ with: self value
+ name: '_value'
+ model: self}!

Item was changed:
  ----- Method: ToolIcons class>>externalData (in category '*FFI-Tools') -----
  externalData
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ 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 4278227710 4278227710 4278227710 4278227710 4294967295 4278190080 4294967295 0 0 4294967295 0 4278227710 4294967295 4294967295 4294967295 4278227710 4278227710 4294967295 0 0 0 0 0 4278227710 4294967295 4278227710 4278227710 4294967295 4278227710 0 0 0 0 0 0 4278227710 4294967295 4278227710 4278227710 4294967295 4278227710 0 0 0 0 0 0 4278227710 4294967295 4278227710 4278227710 4294
 967295 4278227710 0 0 0 0 0 0 4278227710 4294967295 4294967295 4294967295 4278227710 4278227710 0 0 0 0 0 0 0 4278227710 4278227710 4278227710 4278227710 0 0 0 0)
  offset: 0@0!

Item was changed:
  ----- Method: ToolIcons class>>externalObject (in category '*FFI-Tools') -----
  externalObject
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
 
  ^ 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 changed:
  ----- Method: ToolIcons class>>externalPackedStructure (in category '*FFI-Tools') -----
  externalPackedStructure
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ (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 4278235136 4278235136 4278235136 4278235136 4278235136 4294967295 4278190080 4294967295 0 0 0 4278235136 4278235136 4278235136 4294967295 4294967295 4294967295 4278235136 4294967295 0 0 0 0 4278235136 4278235136 4278235136 4294967295 4278235136 4278235136 4278235136 0 0 0 0 0 4278235136 4294967295 4294967295 4278235136 4294967295 4278235136 4278235136 0 0 0 0 0 4278235136 4294967295 4
 294967295 4278235136 4278235136 4294967295 4278235136 0 0 0 0 0 4278235136 4294967295 4278235136 4294967295 4294967295 4294967295 4278235136 0 0 0 0 0 0 4278235136 4278235136 4278235136 4278235136 4278235136 0 0 0 0)
  offset: 0@0)!

Item was changed:
  ----- Method: ToolIcons class>>externalStructure (in category '*FFI-Tools') -----
  externalStructure
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ (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 4278235136 4278235136 4278235136 4278235136 4294967295 4278190080 4294967295 0 0 4294967295 0 4278235136 4278235136 4294967295 4294967295 4294967295 4278235136 4294967295 0 0 0 0 0 4278235136 4294967295 4278235136 4278235136 4278235136 4278235136 0 0 0 0 0 0 4278235136 4278235136 4294967295 4294967295 4278235136 4278235136 0 0 0 0 0 0 4278235136 4278235136 4278235136 4278235136 4294
 967295 4278235136 0 0 0 0 0 0 4278235136 4294967295 4294967295 4294967295 4278235136 4278235136 0 0 0 0 0 0 0 4278235136 4278235136 4278235136 4278235136 0 0 0 0)
  offset: 0@0)!

Item was changed:
  ----- Method: ToolIcons class>>externalType (in category '*FFI-Tools') -----
  externalType
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ (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 4287861651 4287861651 4287861651 4287861651 4287861651 4294967295 4278190080 4294967295 0 0 4294967295 4287861651 4294967295 4294967295 4294967295 4294967295 4294967295 4287861651 4294967295 0 0 0 0 4287861651 4294967295 4287861651 4287861651 4287861651 4294967295 4287861651 0 0 0 0 0 4287861651 4294967295 4294967295 4287861651 4294967295 4294967295 4287861651 0 0 0 0 0 4287861651 429
 4967295 4294967295 4287861651 4294967295 4294967295 4287861651 0 0 0 0 0 4287861651 4294967295 4294967295 4294967295 4294967295 4294967295 4287861651 0 0 0 0 0 0 4287861651 4287861651 4287861651 4287861651 4287861651 0 0 0 0)
  offset: 0@0)!

Item was changed:
  ----- Method: ToolIcons class>>externalTypeAlias (in category '*FFI-Tools') -----
  externalTypeAlias
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ (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 4287861651 4287861651 4287861651 4287861651 4294967295 4278190080 4294967295 0 0 4294967295 0 4287861651 4287861651 4294967295 4294967295 4287861651 4287861651 4294967295 0 0 0 0 0 4287861651 4294967295 4287861651 4287861651 4294967295 4287861651 0 0 0 0 0 0 4287861651 4294967295 4294967295 4294967295 4294967295 4287861651 0 0 0 0 0 0 4287861651 4294967295 4287861651 4287861651 4294
 967295 4287861651 0 0 0 0 0 0 4287861651 4294967295 4287861651 4287861651 4294967295 4287861651 0 0 0 0 0 0 0 4287861651 4287861651 4287861651 4287861651 0 0 0 0)
  offset: 0@0)!

Item was changed:
  ----- Method: ToolIcons class>>externalTypeEmpty (in category '*FFI-Tools') -----
  externalTypeEmpty
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ (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 4294967295 4287861651 4294967295 4287861651 4294967295 4294967295 4278190080 4294967295 0 0 4294967295 4287861651 4294967295 4294967295 4294967295 4294967295 4294967295 4287861651 4294967295 0 0 0 0 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 4294967295 0 0 0 0 0 4287861651 4294967295 4294967295 4294967295 4294967295 4294967295 4287861651 0 0 0 0 0 4294967295 429
 4967295 4294967295 4294967295 4294967295 4294967295 4294967295 0 0 0 0 0 4287861651 4294967295 4294967295 4294967295 4294967295 4294967295 4287861651 0 0 0 0 0 0 4294967295 4287861651 4294967295 4287861651 4294967295 0 0 0 0)
  offset: 0@0)!

Item was changed:
  ----- Method: ToolIcons class>>externalUnion (in category '*FFI-Tools') -----
  externalUnion
+ "(c) 2020 Marcel Taeumel
+ Website: https://www.taeumel.eu
+ License: https://creativecommons.org/licenses/by/4.0"
+
-
  ^ (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 4294922834 4294922834 4294922834 4294922834 4294967295 4278190080 4294967295 0 0 4294967295 0 4294922834 4294967295 4294922834 4294922834 4294967295 4294922834 4294967295 0 0 0 0 0 4294922834 4294967295 4294922834 4294922834 4294967295 4294922834 0 0 0 0 0 0 4294922834 4294967295 4294922834 4294922834 4294967295 4294922834 0 0 0 0 0 0 4294922834 4294967295 4294922834 4294922834 4294
 967295 4294922834 0 0 0 0 0 0 4294922834 4294922834 4294967295 4294967295 4294922834 4294922834 0 0 0 0 0 0 0 4294922834 4294922834 4294922834 4294922834 0 0 0 0)
  offset: 0@0)!