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

Btc/typos and more - clean up Makefile; add new example #124

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

drbitboy
Copy link
Contributor

Makefile

- Use make variables to define targets
- Remove test executables in [make clean]
- Make strict library libjsmn_strict.a and other products
- Give examples consistent names
  - simple => simple_example (no change)
  - jsondump => jsondump_example (instead of jsondump)

examples/jsmndump.c

- New example code
- Similar to jsondump
- Outputs JS-ish names for primitives, plus array lengths

Makefile

- Use make variables to define targets
- Remove test executables in [make clean]
- Make strict library libjsmn_strict.a and other products
- Give examples consistent names
  - simple => simple_example (no change)
  - jsondump => jsondump_example (instead of jsondump)

examples/jsmndump.c

- New example code
- Similar to jsondump
- Outputs JS-ish names for primitives, plus array lengths
@drbitboy
Copy link
Contributor Author

drbitboy commented Jan 25, 2018

Hi Serge,

The Makefile changes are mostly to make the different steps consistent (e.g. example/simple.c build to executable simple_example, but example/jsondump.c used to build to exectuable jsondump (not to jsondump_example).

I also added another example based on some work I am doing for the OSIRIS-REx spacecraft mission to asteroid (101955) Bennu, that dumps the JSON primitives, plus array lenghts, with Javascript-like names. It would be somewhat inefficient, but those primitives could be put into a tree (e.g. avltree) with the JS-like names as keys, and the tree then used as a way to access primitives in the JSON. So in some ways it is similar to examples/simple.c, where the program knows the structure of the JSON beforehand and needs a way to navigate. In structure the new example is very similar to examples/jsondump.c, although I cleaned up the code that reads the file, and added a way to pass a filename instead of using only STDIN; I fully admit that "cleaned up" is a subjective term, of course, and some may find my code style a bit too dense and/or confusing (e.g. putting assignments inside while and if expressions).

Thanks for the great package.

Feel free of course to edit or reject the example, or this entire pull request, if you feel it does not add anything to the package.

…e comments in example/jsmndump.c; add allall target to Makefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant