From 802c04526ed46014ab558880d537f83c09eec4b3 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 23 Sep 2014 13:51:46 -0400 Subject: [PATCH] Yet more documentation, including the build for the tutorial. --- Makefile | 9 ++++++++- NEWS | 3 ++- README | 5 ++++- microjson.asc | 11 ++++++----- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 57cf3c5..0960e29 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ mjson.o: mjson.c mjson.h test_microjson: test_microjson.o mjson.o $(CC) $(CFLAGS) -o test_microjson test_microjson.o mjson.o +.SUFFIXES: .html .asc + +# Requires asciidoc and xsltproc/docbook stylesheets. +.asc.html: + asciidoc $*.asc + # Regression test check: test_microjson test_microjson @@ -25,6 +31,7 @@ example3: example3.c mjson.c clean: rm -f microjson.o test_microjson.o test_microjson example[123] + rm -f microjson.html CSUPPRESSIONS = -U__UNUSED__ cppcheck: @@ -38,5 +45,5 @@ microjson-$(VERSION).tar.gz: $(ALL) dist: microjson-$(VERSION).tar.gz -release: microjson-$(VERS).tar.gz mjson.html +release: microjson-$(VERS).tar.gz microjson.html shipper version=$(VERS) | sh -e -x diff --git a/NEWS b/NEWS index 7f44619..2999b7a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ microjson project news -Repository head: initial release. +1.0: 2014-09-23 + Initial release. diff --git a/README b/README index 611d093..a850fc2 100644 --- a/README +++ b/README @@ -8,10 +8,13 @@ constrained embedded environments. It may also be of interest for code where malloc is verboten to reduce reliability and sexurity vulnerabilities. +There's no man page, but there's a tutorial with examples in +microjson.asc. + BSD license terms apply; see the file COPYING. Eric S. Raymond - Ocrober 2014 + October 2014 diff --git a/microjson.asc b/microjson.asc index 0e302d3..7f54bfa 100644 --- a/microjson.asc +++ b/microjson.asc @@ -345,26 +345,27 @@ but not signed integer vs. unsigned integer). The parser will match the right spec against the actual data. (There's an instance of this in Example 3.) - The dialect this parses has some limitations. First, it cannot +The dialect this parses has some limitations. First, it cannot recognize the JSON "null" value. Second, all elements of an array must be of the same type. Third, some types (t_time, t_character) may not be array elements (this restriction could be lifted, and might be in a future release). There are separate entry points for beginning a parse of either JSON -object or a JSON array. JSON "float" quantities are actually stored as -doubles. +object or a JSON array. + +JSON "float" quantities are actually stored as doubles. This parser processes object arrays in one of two different ways, defending on whether the array subtype is declared as object or structobject. - Object arrays take one base address per object subfield, and are +Object arrays take one base address per object subfield, and are mapped into parallel C arrays (one per subfield). Strings are not supported in this kind of array, as they don't have a "natural" size to use as an offset multiplier. - Structobject arrays are a way to parse a list of objects to a set +Structobject arrays are a way to parse a list of objects to a set of modifications to a corresponding array of C structs. The trick is that the array object initialization has to specify both the C struct array's base address and the stride length (the size of the C struct). -- 2.43.0