-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
add jsmn (Jasmine) JSON parser #23673
Conversation
what is the advantage against picojson we are already using ? |
https://github.com/zserge/jsmn https://github.com/kazuho/picojson jsmm have no dynamic allocation |
Yep. No standard library either. Really wanted json parsing on sitl-on-hardware, but had to cut it out. |
0580605
to
9b652ca
Compare
I've done some more playing with this and this PR now replaced picojson with jasmine. Cost of just having the jsmn in-play is 1424 bytes (i.e. create the parser and call it on a 1-byte string). To actually walk through the tokens afterwards for Callisto.json to set parameters (in the same way that picojson did) costs an additional 1600 bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need comments, and need xplane working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need comments, and need xplane working
So you are happy with the way this is turning out and I should pursue it, then? That's what this most recent push was in aid of - to make sure people didn't immediately throw up when they saw it.
I believe jasmine might be able to be run as a progressive parser, too - I haven't tried that, but it does have this:
/* The string is not a full JSON packet, more bytes expected */
JSMN_ERROR_PART = -3
... that would be rather awesome if it worked.
44e9cf9
to
b9bc101
Compare
Flash cost for CubeOrange-SimOnHW is 3kB (+ whatever JSON you want in ROMFS e.g. 1kB for Callisto.json)
|
b9bc101
to
03de2d2
Compare
failed on libraries/SITL/examples/XPlane/xplane_alia.json |
03de2d2
to
f16d3bc
Compare
Fixed - it was just the maximum number of tokens we support in a file. |
ebd842b
to
5ebda0a
Compare
5ebda0a
to
cd8e4e4
Compare
@Ryanf55 I've changed this to use strtol etc |
d08d2e0
to
7d3686f
Compare
7d3686f
to
87134ac
Compare
87134ac
to
26500e1
Compare
Fixed XPlane. |
Not out library, someone else's where including in the tree doing this. We can be accomodating here
Replacing with jsmn
0c22378
to
a5b61f4
Compare
a5b61f4
to
aeed0cf
Compare
Going with tridge's picojson changes instead. |
No description provided.