git/contrib/buildsystems
Johannes Schindelin d293094601 scalar: implement a minimal JSON parser
No grown-up C project comes without their own JSON parser.

Just kidding!

We need to parse a JSON result when determining which cache server to
use. It would appear that searching for needles `"CacheServers":[`,
`"Url":"` and `"GlobalDefault":true` _happens_ to work right now, it is
fragile as it depends on no whitespace padding and on the order of the
fields remaining as-is.

Let's implement a super simple JSON parser (at the cost of being
slightly inefficient) for that purpose. To avoid allocating a ton of
memory, we implement a callback-based one. And to save on complexity,
let's not even bother validating the input properly (we will just go
ahead and instead rely on Azure Repos to produce correct JSON).

Note: An alternative would have been to use existing solutions such as
JSON-C, CentiJSON or JSMN. However, they are all a lot larger than the
current solution; The smallest, JSMN, which does not even provide parsed
string values (something we actually need) weighs in with 471 lines,
while we get away with 182 + 29 lines for the C and the header file,
respectively.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2023-06-01 10:53:55 -07:00
..
Generators Merge branch 'ci-fixes' 2023-06-01 10:14:25 -06:00
CMakeLists.txt scalar: implement a minimal JSON parser 2023-06-01 10:53:55 -07:00
Generators.pm
engine.pl vcxproj: ignore the `-pedantic` option 2023-06-01 10:14:14 -06:00
generate
parse.pl