Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Generate bindings from JSON #59

Open
greenfork opened this issue Dec 27, 2021 · 5 comments
Open

Generate bindings from JSON #59

greenfork opened this issue Dec 27, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@greenfork
Copy link
Owner

Raylib provides a parser which conveniently generates specification of all the types and functions for its sources. This should be a better option than current struggle with multi-step processing of C and Nim files.

Current PoC: https://gist.github.com/planetis-m/04d4fb2a3784329d2c6d2e20ed52c2fc

@greenfork greenfork added the enhancement New feature or request label Dec 27, 2021
@planetis-m
Copy link
Collaborator

Just to mention, an alternative might be to modify c2nim postprocessor.nim to either output JSON or directly apply transformations to PNodes. This might be better considering raylib_parser is having trouble processing other files than raylib.h

@greenfork
Copy link
Owner Author

@planetis-m what is our current state of JSON vs c2nim implementation, what are your thoughts? JSON still has some problems as c2nim at least with pointers/arrays. So it's not that obvious what's going to be better at the end if we assume that c2nim will evolve. According to Nim survey tooling looks like a decent priority.

Did you have a chance to look at c2nim API for ways to better integrate the conversion script? We can certainly reuse ideas from JSON script I think, looks like they intersect quite a bit.

@planetis-m
Copy link
Collaborator

Did you have a chance to look at c2nim API for ways to better integrate the conversion script? We can certainly reuse ideas from JSON script I think, looks like they intersect quite a bit.

Araq made the branch araq-gobject that has an example of using c2nim as a library with a custom callback. I am stuck at trying to update c2nim to the latest compiler, there are a couple of regressions and I have limited time. But I believe it's the way forward.

@greenfork
Copy link
Owner Author

greenfork commented Jan 20, 2022

I see! Okay, than I will do my part at restructuring the pipeline and I will take a closer look at how to integrate all the great stuff in the JSON PR and whether we would like to completely switch to it. I have very mixed feelings about choosing between c2nim and JSON version :) It is probable that for research purposes we might want to maintain both versions until there's a clear leader.

@planetis-m
Copy link
Collaborator

In that case, a better alternative to raylib-parser is opir from futhark. We ca use its output instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants