FFI: FFI-Kernel-mt.83.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.83.mcz

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

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

Name: FFI-Kernel-mt.83
Author: mt
Time: 1 June 2020, 10:07:38.001523 am
UUID: 6a3601c2-a649-2a4e-a6ad-ddba52738605
Ancestors: FFI-Kernel-mt.82

Moves C code generation for typedefs to FFI-Tools package.

=============== Diff against FFI-Kernel-mt.82 ===============

Item was removed:
- ----- Method: ExternalType>>printAtomicType:on: (in category 'printing') -----
- printAtomicType: spec on: aStream
- self assert: (spec anyMask: FFIFlagAtomic).
- aStream nextPutAll: (#( 'void' 'unsigned char' 'unsigned char' 'signed char'
- 'unsigned short' 'short' 'unsigned long' 'long'
- 'unsigned long long' 'long long' 'char' 'signed char'
- 'float' 'double') at: ((spec bitAnd: FFIAtomicTypeMask) bitShift: FFIAtomicTypeShift negated) + 1).
- aStream space.
- (spec anyMask: FFIFlagPointer) ifTrue:
- [aStream nextPut: $*]!

Item was removed:
- ----- Method: ExternalType>>printStructureField:at:inClass:on:indent: (in category 'printing') -----
- printStructureField: typeTuple at: initialSpecIndex inClass: structureClass on: aStream indent: indent
- "Print the structure's field starting at initialSpecIndex and answer the index in compiledSpec of the subsequent type."
- | typeName spec subStructureClass |
- aStream tab: indent.
- typeName := typeTuple first.
- spec := compiledSpec at: initialSpecIndex.
- (spec anyMask: FFIFlagAtomic) ifTrue:
- [self printAtomicType: spec on: aStream.
- aStream nextPutAll: (typeName ifNotNil: [typeName] ifNil: ['foo']).
- ^initialSpecIndex + 1].
- subStructureClass := self subStructureClassFor: typeName in: structureClass.
- (spec bitClear: FFIStructSizeMask) = FFIFlagStructure ifTrue:
- [| next |
- next := initialSpecIndex + 1.
- aStream
- nextPutAll: subStructureClass compositeKindName;
- nextPutAll: ' {'.
- subStructureClass fields withIndexDo:
- [:tuple :i|
- aStream cr.
- next := self printStructureField: tuple
- at: next
- inClass: subStructureClass
- on: aStream
- indent: indent + 1.
- aStream nextPut: $;].
- aStream crtab: indent; nextPut: $}.
- typeName ifNotNil: [aStream space; nextPutAll: typeName].
- self assert: (next - 1 = compiledSpec size or: [(compiledSpec at: next) = FFIFlagStructure]).
- ^next <= compiledSpec size ifTrue: [next + 1] ifFalse: [next]].
- self assert: (spec anyMask: FFIFlagPointer).
- (subStructureClass isKindOf: ExternalUnion)
- ifTrue: [aStream nextPutAll: 'union ']
- ifFalse: [aStream nextPutAll: 'struct '].
- aStream nextPutAll: subStructureClass name; nextPutAll: ' *'; nextPutAll: typeName.
- ^initialSpecIndex + 1!

Item was removed:
- ----- Method: ExternalType>>printTypedefOn: (in category 'printing') -----
- printTypedefOn: s
- s nextPutAll: 'typedef '.
- referentClass
- ifNotNil:
- [(compiledSpec first bitClear: FFIStructSizeMask) = FFIFlagStructure
- ifTrue:
- [| next |
- next := 2.
- s
- nextPutAll: referentClass compositeKindName;
- nextPutAll: ' {'.
- referentClass fields withIndexDo:
- [:tuple :i|
- s cr.
- next := self printStructureField: tuple
- at: next
- inClass: referentClass
- on: s
- indent: 1.
- s nextPut: $;].
- s cr; nextPutAll: '} '.
- self assert: (next - 1 = compiledSpec size or: [(compiledSpec at: next) = FFIFlagStructure])]
- ifFalse:
- [self assert: (compiledSpec first bitClear: FFIStructSizeMask) = FFIFlagPointer.
- s nextPutAll: referentClass name; nextPutAll: ' *foo'.
- ^self]]
- ifNil:
- [self printAtomicType: compiledSpec first on: s].
- s nextPutAll: (referentClass ifNotNil: [referentClass name] ifNil: ['foo'])!

Item was removed:
- ----- Method: ExternalType>>typedef (in category 'printing') -----
- typedef
- ^String streamContents: [:s| self printTypedefOn: s]!