Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.116.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.116
Author: mt
Time: 19 June 2020, 8:03:02.813645 pm
UUID: c862510f-5cc0-9b42-9b29-53a2eb5de0e9
Ancestors: FFI-Kernel-mt.115
Actually provide a default for type name for type aliases that can work. :-)
=============== Diff against FFI-Kernel-mt.115 ===============
Item was changed:
----- Method: ExternalTypeAlias class>>originalTypeName (in category 'type alias') -----
originalTypeName
"Answer the typeName this alias should be for, e.g., 'long', 'ulonglong*'. Provide a default here to make automated sends to #compileFields work."
+ ^ 'void*'!
- ^ 'void'!
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.115.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.115
Author: mt
Time: 19 June 2020, 10:00:32.312059 am
UUID: a0910ccc-0785-b74c-adab-b65816499d7e
Ancestors: FFI-Kernel-mt.114
Try to deal with the issue of having the wrong generated code present in the image.
(1) Avoid checking in generated field accessors via Monticello by putting them into *'autogenerated - accessing' instead of 'accessing' category
(2) Expand the #generated rule to also generate field accessors if the selector is not yet present (or if <generated> is found if present). That rule is used when re-compiling all struct fields on a platform change. See #compileAllFields.
So, you can still choose to manually manage field accessors by adding them in your own 'accessing' category and removing the <generated> pragma. But then you would be on your own. :-)
=============== Diff against FFI-Kernel-mt.114 ===============
Item was changed:
----- Method: ExternalStructure class>>maybeCompileAccessor:withSelector: (in category 'field definition - support') -----
maybeCompileAccessor: aString withSelector: selector
(self compiledMethodAt: selector ifAbsent: []) ifNotNil:
[:existingMethod|
existingMethod getSourceFromFile asString = aString ifTrue:
[^self]].
+ self compile: aString classified: #'*autogenerated - accessing'!
- self compile: aString classified: #accessing!
Item was changed:
----- Method: ExternalStructure class>>shouldGenerate:policy: (in category 'field definition - support') -----
shouldGenerate: fieldname policy: aSymbol
"Answer true if the field accessors must be compiled.
Do so according to the following rules:
- aSymbol = #always always generate the accessors
- aSymbol = #never never generate the accessors
- aSymbol = #generated only re-generate the auto-generated accessors
- aSymbol = #absent only generate the absent accessors"
aSymbol = #never ifTrue: [^ false].
aSymbol = #always ifTrue: [^ true].
aSymbol = #absent ifTrue: [^ (self methodDictionary includesKey: fieldname) not].
+ aSymbol = #generated "includes #absent rule"
+ ifTrue: [^ (self methodDictionary includesKey: fieldname) not
+ or: [(self methodDictionary at: fieldname) hasPragma: #generated]].
- aSymbol = #generated
- ifTrue: [^ (self methodDictionary includesKey: fieldname)
- and: [(self methodDictionary at: fieldname) pragmas
- anySatisfy: [:p | p keyword = #generated]]].
self error: 'unknown generation policy'!
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.110.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.110
Author: mt
Time: 17 June 2020, 11:46:38.027028 am
UUID: 4abaf7b7-51bd-2d43-b9e2-29a2aede563f
Ancestors: FFI-Kernel-mt.109
Fixes bug in #isIntegerType. Adds conversion methods between signed and unsigned integer types. Choose #asSigned over #asSignedType (or #asSignedIntegerType) to match existing #isSigned selector.
=============== Diff against FFI-Kernel-mt.109 ===============
Item was changed:
----- Method: ExternalType class>>c_ulong (in category 'type constants - extra') -----
c_ulong
"Try to approximate a fitting type for 'usigned long' in a C interface. See comment in #c_long."
+ ^ self c_long asUnsigned!
- ^ self typeNamed: 'u', self c_long atomicTypeName!
Item was added:
+ ----- Method: ExternalType>>asSigned (in category 'converting') -----
+ asSigned
+
+ self isSigned ifTrue: [^ self].
+ ^ AtomicTypes at: (AtomicTypeNames at: self atomicType + 1)!
Item was added:
+ ----- Method: ExternalType>>asUnsigned (in category 'converting') -----
+ asUnsigned
+
+ self isUnsigned ifTrue: [^ self].
+ ^ AtomicTypes at: (AtomicTypeNames at: self atomicType - 1)!
Item was added:
+ ----- Method: ExternalType>>checkIntegerType (in category 'private') -----
+ checkIntegerType
+
+ self isIntegerType
+ ifFalse: [self error: 'Test is only defined on integer types!!'].!
Item was changed:
----- Method: ExternalType>>isIntegerType (in category 'testing') -----
isIntegerType
"Return true if the receiver is a built-in integer type"
| type |
type := self atomicType.
+ ^type > FFITypeBool and:[type <= FFITypeSignedChar]!
- ^type > FFITypeBool and:[type <= FFITypeUnsignedLongLong]!
Item was changed:
----- Method: ExternalType>>isSigned (in category 'testing') -----
isSigned
+ "Return true if the receiver is a signed integer type."
+
+ self checkIntegerType.
- "Return true if the receiver is a signed type.
- Note: Only useful for integer types."
^self atomicType anyMask: 1!
Item was changed:
----- Method: ExternalType>>isUnsigned (in category 'testing') -----
isUnsigned
+ "Return true if the receiver is an unsigned integer type."
+
+ self checkIntegerType.
- "Return true if the receiver is an unsigned type.
- Note: Only useful for integer types."
^self isSigned not!
Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI:
http://source.squeak.org/FFI/FFI-Kernel-mt.111.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.111
Author: mt
Time: 17 June 2020, 7:56:43.540384 pm
UUID: 4421e4eb-4ac9-5f4b-9fcc-64c57a034587
Ancestors: FFI-Kernel-mt.110
Adds a simple interface to use ExternalData as representative of an external global/shared variable.
(We could add an extra subclass to make it more clear. Like ExternalTypeAlias.)
=============== Diff against FFI-Kernel-mt.109 ===============
Item was added:
+ ----- Method: ExternalData>>value (in category 'accessing - external globals') -----
+ value
+ "For convenience. Assume that the external data is just one global variable. Answer the value of that global variable."
+
+ ^ self at: 1!
Item was added:
+ ----- Method: ExternalData>>value: (in category 'accessing - external globals') -----
+ value: aValue
+ "For convenience. Assume that the external data is just one global variable. Set the value of that global variable."
+
+ self at: 1 put: aValue.!
Item was changed:
----- Method: ExternalType class>>c_ulong (in category 'type constants - extra') -----
c_ulong
"Try to approximate a fitting type for 'usigned long' in a C interface. See comment in #c_long."
+ ^ self c_long asUnsigned!
- ^ self typeNamed: 'u', self c_long atomicTypeName!
Item was added:
+ ----- Method: ExternalType>>asSigned (in category 'converting') -----
+ asSigned
+
+ self isSigned ifTrue: [^ self].
+ ^ AtomicTypes at: (AtomicTypeNames at: self atomicType + 1)!
Item was added:
+ ----- Method: ExternalType>>asUnsigned (in category 'converting') -----
+ asUnsigned
+
+ self isUnsigned ifTrue: [^ self].
+ ^ AtomicTypes at: (AtomicTypeNames at: self atomicType - 1)!
Item was added:
+ ----- Method: ExternalType>>checkIntegerType (in category 'private') -----
+ checkIntegerType
+
+ self isIntegerType
+ ifFalse: [self error: 'Test is only defined on integer types!!'].!
Item was changed:
----- Method: ExternalType>>isIntegerType (in category 'testing') -----
isIntegerType
"Return true if the receiver is a built-in integer type"
| type |
type := self atomicType.
+ ^type > FFITypeBool and:[type <= FFITypeSignedChar]!
- ^type > FFITypeBool and:[type <= FFITypeUnsignedLongLong]!
Item was changed:
----- Method: ExternalType>>isSigned (in category 'testing') -----
isSigned
+ "Return true if the receiver is a signed integer type."
+
+ self checkIntegerType.
- "Return true if the receiver is a signed type.
- Note: Only useful for integer types."
^self atomicType anyMask: 1!
Item was changed:
----- Method: ExternalType>>isUnsigned (in category 'testing') -----
isUnsigned
+ "Return true if the receiver is an unsigned integer type."
+
+ self checkIntegerType.
- "Return true if the receiver is an unsigned type.
- Note: Only useful for integer types."
^self isSigned not!
Marcel Taeumel uploaded a new version of FFI-Tools to project FFI:
http://source.squeak.org/FFI/FFI-Tools-mt.18.mcz
==================== Summary ====================
Name: FFI-Tools-mt.18
Author: mt
Time: 17 June 2020, 11:49:53.132028 am
UUID: 2fa1e5d5-aca8-a04c-b011-42d77447d585
Ancestors: FFI-Tools-mt.17
Make dynamic icon selection for robust to not break tools. This can happen if an implementor of #fields makes a mistake such as forgetting the "^". :-)
=============== Diff against FFI-Tools-mt.17 ===============
Item was changed:
----- Method: ExternalStructure class>>toolIcon (in category '*FFI-Tools') -----
toolIcon
+ ^ [self isTypeAlias
- ^ self isTypeAlias
ifTrue: [#externalTypeAlias]
+ ifFalse: [#externalStructure]]
+ ifError: [#blank]!
- ifFalse: [#externalStructure]!