Import and export your C structures from external sources.
(Currently only JSON module is implemented.)
Disclaimer: This is still in development. While you can already use this, i can change API at some point. Also, before you use this, make sure it works as expected. I did some tests but it is not possible to test for every variation of source data.
All structures you want to work with using this library are defined using teplate JSON, structs.json.
This file is then processed by ks_generator.py, which will generate header file with C structures.
(It will also generate source code containing all the templates for parsers.)
Arrays, arrays of structures, structures inside structures and array structures inside structures ... inside structures ... are supported.
Numeric values can have minimum and maximum defined.
Template parsing script is capable of producing a schema for JSON Editor. Documentation / example pending.
Hmm ... maybe later ...
See structs.json for hints.
Important settings in ks_json.h.
JSON parser is capable of sequenced importing / exporting. That is, you don't have to provide the entire JSON buffer for handling. JSON parser is capable of skipping unknown values.
KS_JSON_MAX_STRING_LENGTHMaximum string length in bytes. NUL byte terminator also counts.- This affects any JSON string - so keys and values.
KS_JSON_MAX_DEPTHMaximum JSON recursion.- Keep in mind that ignored values are also counted into recursion.
- Every recursion takes a bit of memory, even if never used.
KS_JSON_ALLOW_STRING_NUMBERSAllow parsing numeric values from JSON strings.- This exists to support broken generators that export everything as strings.
Hmm ...
- Documentation
- More parsers
- CBOR
- ...