FFI: FFI-Kernel-mt.110.mcz

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

FFI: FFI-Kernel-mt.110.mcz

commits-2
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!