Open vallsv opened 3 years ago
Hi,
Thank you for your suggestion. It would probably be possible to implement any of these alternatives in a separate file (like annotations.py). You are welcome with a suggestion in a pull request.
However, it seems that most users are utilizing the cparser and standard C header files (or strings) to define there structs, bitfields etc.
/Joel
Yes you are right. But i was thinking about getting ride of castxml
for pure python lib. Just because it it's extra dependency which is more difficult to install.
There is probably an opportunity to provide a tool to convert .h
file to a pure python file using your lib. As result any project could remove the castxml
dependency easily if needed.
I will maybe play around if i have some time.
It would be great if pycstruct had a .h parser that did not depend on castxml.
castxml is extremly powerful and builds on a real compiler which supports the complete standard with all complex corner cases. Thus it would not be feasible to implement such a powerful parser.
However, it should be possible to implement the basic cases for enum, struct/bitfield and union. But it gets quite complex when the source includes typedefs, macros, includes etc.
When i saw your library, i was searching something to define cstrucs as descriptive way.
With the last python typing annotation there is probably way to provide something like that:
No idea if that stuff could work or not.
I would be very happy to use such thing. Do you think it could interest you?