Draft
Conversation
Member
|
Should wait until #622 is fixed to rely on improved struct generation. |
b772dfb to
3142030
Compare
Contributor
Author
|
I've rebased this on top of the latest changes - the
|
This also adds some additional bindings for Cairo.RectangleInt in order to implement the unit tests (e.g. constructing a rectangle, comparing equality, and field accessors)
3142030 to
7b938ce
Compare
Member
|
Ah good point! I will add some equality check to the generator which just compares the pointers. edit: Or perhaps we do the member comparison? I think it could even be relatively easy. It would be nice to read your opinion in #1000. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This also adds some additional wrapper code for
Cairo.RectangleIntin order to implement the unit tests (e.g. constructing a rectangle, comparing equality, and field accessors) - this is the main thing I'd like to discuss since it's a more general topic on the generator side of things!The extra level of indirection to access the fields (
RectangleIntvsRectangleIntData) feels kind of awkward - my current changes have some rough code that attempts to hide this. I feel like it would be more natural if the generator could just directly emit astructtype here, since on the C side this is a plain struct rather than an opaque / handle typeI think it might also make something like cairo_region_create_rectangles() simpler to wrap as well since the memory layout would match
The old cairo bindings from Mono / GtkSharp also made this a struct type, so changing from value to reference semantics would also make it tricky to port existing code correctly