Skip to content

Conversation

@tinchodias
Copy link
Contributor

@tinchodias tinchodias commented Jan 9, 2026

Added method to read an array of a specified type and size.

I should add a test.

Added method to read an array of a specified type and size.
@tinchodias tinchodias marked this pull request as draft January 9, 2026 17:35
@tinchodias tinchodias marked this pull request as ready for review January 9, 2026 17:40
@tinchodias
Copy link
Contributor Author

tinchodias commented Jan 9, 2026

Note: this method wasn't useful the read the SDL_DisplayMode** result of this function because I wanted an array of SDL_DisplayMode instead of an array of pointers to SDL_DisplayMode.

I wrote this other method for that case:

readStructArrayFromPointers: aFFIStructure size: count
	"Return an array of structs of the specified size"

	^ Array streamContents: [ :stream |
		| address |
		address := self.
		1 to: count do: [ :index |
			stream nextPut: (aFFIStructure fromHandle: (address pointerAt: 1)).
			address := address + FFIExternalType pointerSize ] ]

Comment on lines +397 to +399
externalType := aType isString
ifTrue: [ FFIExternalType resolveType: aType ]
ifFalse: [ aType ].
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this if is right. I kept it from readArrayOf:until:, which was the base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants