-
Notifications
You must be signed in to change notification settings - Fork 186
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
Flatbuffers may be interested in accepting this upstream #1
Comments
I have given it some thought, but having a C schema compiler was a more important goal when the project started. Personally I need to put a limit to how much additional work I put into this project as there are other pressing issues, but for anyone who wants to take it on: There are several ways to go about an integration:
But even with 4) there is very little benefit over simply passing the schema on to libflatcc - parsing text is after all not such a big deal in itself and I am not sure an alternative schema is worth the effort. |
We'd be happy to have C support directly in the main project. And while I understand the value of an all-C toolchain, for maintainability anything going into the main project would have to use the C++ schema parser. So 1) is preferable, and 2) would be acceptable, but I don't see the point, since reading from the binary schema is not necessarily easier than just reading the C++ parser state. |
This is understandable.
As it is 2) is insufficient or at least suboptimal - but it doesn't have to be total rewrite to enhance the schema: a) there need to be an order of structs - at least the order supplied in the original schema. The current listing is sorted for lookup by binary search. It can probably be worked around using forward struct declarations, but and additional vector in the schema with all symbols in original schema order would be useful - also for regenerating the text schema. With this covered, I think the code generator has enough information, just on top of my head. |
a) The binary search order is important for speed in most reflection cases. I think the better approach is if the C generator wants to work from this data, that it does its own sort. Doesn't even have to be a sort, simply iterate thru all struct multiple times, and only output those who don't rely on structs that haven't been generated yet. It seems like ensuring the binary schema holds all information the parser provides is more pain than it is worth. A better solution would be, if you want to keep sharing code between the two projects, is to put the bulk of your code generator in a .c file with an interface, then have specialized code call into that from both flatc and flatcc. |
a) [edited] yes fix-point iteration over the dataset could work though it does require some book keeping the generator would like to avoid. I think you suggestion about a common interface is good. Some data structures will be needed and whether they are C arrays of structs, or another flatbuffer schema is not really important as long as all the issues a) .. d) are being addressed somehow. |
After considering the interface structure required for an integration, and the many small details required, it does not seem worthwhile for the time being. I am in favor of an extended binary schema format that all parses can output to and all code generators can generate from, but this is an extended effort for everyone involved so I will let it rest for now and close the issue. |
Would you consider incorporating this tool directly into flatbuffers itself? It seems several people are interested here: google/flatbuffers#7.
The text was updated successfully, but these errors were encountered: