]> thyrsus.com Git - microjson.git/commitdiff
Add a man page.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 26 Sep 2014 19:36:00 +0000 (15:36 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 26 Sep 2014 19:54:12 +0000 (15:54 -0400)
Makefile
mjson.asc [new file with mode: 0644]

index b95ce5f3a91ec47a3a5fd2bf695a161adf0879a7..110974f688511973d1f76fedd7445893871df532 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,11 +15,13 @@ 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
+.SUFFIXES: .html .asc .3
 
 # Requires asciidoc and xsltproc/docbook stylesheets.
 .asc.html:
        asciidoc $*.asc
+.asc.3:
+       a2x --doctype manpage --format manpage $*.asc
 
 # Regression test
 check: test_microjson
@@ -47,5 +49,5 @@ microjson-$(VERSION).tar.gz: $(ALL)
 
 dist: microjson-$(VERSION).tar.gz
 
-release: microjson-$(VERSION).tar.gz microjson.html
+release: microjson-$(VERSION).tar.gz microjson.html mjson.html
        shipper version=$(VERSION) | sh -e -x
diff --git a/mjson.asc b/mjson.asc
new file mode 100644 (file)
index 0000000..e8e1ab8
--- /dev/null
+++ b/mjson.asc
@@ -0,0 +1,54 @@
+= mjson(1) =
+:doctype: manpage
+
+== NAME ==
+mjson - fast parse of JSON to fixed-extent C structures
+
+== FUNCTIONS ==
+#include "mjson.h"
+
+int json_read_object(const char *, const struct json_attr_t *, const char **);
+
+int json_read_array(const char *, const struct json_array_t *, const char **);
+
+const char *json_error_string(int);
+
+void json_enable_debug(int, FILE *);
+
+== DESCRIPTION ==
++json_read_object()+ attempts to parse a whole JSON object from the
+buffer pointed at by the first argument.  The second argument points
+at an array of template structures describing the expected shape of 
+the JSON object (that is, the set of attribute names and their
+expected value types. order-independent) and specifying for each 
+attribute a C address where the parsed value should ve deivered.
+The third argument, if non-null, is where a copy of a pointer
+to just past the parsed object  is placed.
+
++json_read_object()+ attempts to parse a whole JSON object from the
+buffer pointed at by the first argument.  The second argument points
+at a template structure describing the array's elenent type and where
+successive elements are to be placed. The third argument, if non-null,
+is where a copy of a pointer to just past the parsed object is placed.
+
+Objects may contain arrays as attribute values, and an array may be
+composed of JSON objects.  These functions mutually recurse as
+required.
+
++void json_enable_debug(int, FILE *)+ enables the generation of trace
+messages to the indicated file pointer while parsing.
+
+For details on how to build template structures, consult the document
+_Building Static JSON Parsers With Microjson_ shipped with the
+distribution.
+
+== RETURN VALUE ==
+
+The two main functions return 0 for success, a nonzero error code for
+failure.  The function +json_error_string()+ maps error codes to
+explanatory messages.
+
+== REPORTING BUGS ==
+Report bugs to Eric S. Raymond <esr@thyrsus.com>.  The project page is
+at http://catb.org/~esr/microjson
+