Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open up API for adding types to the type library #102

Open
lundmark opened this issue Nov 27, 2018 · 5 comments
Open

Open up API for adding types to the type library #102

lundmark opened this issue Nov 27, 2018 · 5 comments
Labels

Comments

@lundmark
Copy link
Collaborator

It would be really sweet if we could have an api for manually adding types/structs etc to a type library. That would allow the functionality for creating custom parsers more easily.

@wc-duck
Copy link
Owner

wc-duck commented Nov 27, 2018

As a workaround/solution you could actually embedded the tld-parser and add types via txt... That might be the easiest solution right now?

See dl_context_load_txt_type_library() in dl_typelib.h

@wc-duck
Copy link
Owner

wc-duck commented Nov 27, 2018

I'm not sure that I want to maintain another API as the above exists. Adding one more API would make it more work and more testing to add features + 2 ways to do the same thing. Does that make sense?

@lundmark
Copy link
Collaborator Author

Well, I thought it would be nice to have a common interface that both dl_typelib_read_txt and dl_typelib_read_bin uses. That way it could be exposed externally and used for other things. I mean sure it would be possible to generate a dl-text lib file and then load that one - but that really feels like a hack.

How else would you propose for someone to implement a c-header-parser that generates a dl-typelib from that?

@wc-duck
Copy link
Owner

wc-duck commented Nov 27, 2018

They could use the txtfmt as well ;) Jokes aside I think it would be quite a refactoring but I'll have a look...

@Tisten
Copy link
Contributor

Tisten commented Oct 27, 2022

I'm not sure I understand why it would be simpler to interact with DL types via a C API than it is via the JSON format?

I would vote against this, but that might be because I don't understand the problem.

Creating a C-header-parser which generates a json file from that sounds trivial. Interpretation of the C-header is the hard part, not expressing dl-types in json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants