]> thyrsus.com Git - microjson.git/commitdiff
Yet more documentation.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 23 Sep 2014 22:15:04 +0000 (18:15 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 23 Sep 2014 22:15:04 +0000 (18:15 -0400)
microjson.asc
mjson.c

index 76bd835bcaaaf94dfa33fe0705cad14acc8ee7b3..a400cf353af1c998449fe42e80f696006dc30c80 100644 (file)
@@ -157,6 +157,16 @@ when the JSON object does not contain the corresponding attribute.
 You can turn off this defaulting behavior by setting the +nodefault+
 member to +true+.
 
+Additionally, an +json_attr_t+ instance with a +t_integer+ or
++t_uinteger+ type field can point at a map (an array of +json_enum_t+
+structures) that lists names and pairs of integral values.  If this is
+done, the parser expects the values of the JSON attribute to be strings but 
+internally maps them to corresponding integer values beore setting the
+target storage. An un-enumerated string value causes the parse to
+error out.
+
+(Case 8 in the unit tet source code illistrates how to use this feature.)
+
 === Compound Value Types ===
 
 The following cases do not parse JSON value atoms:
diff --git a/mjson.c b/mjson.c
index 0bcef5eecc240a96414b617d5795d948010b2be9..c3c097913a759da021d3e135b773d10f412669cf 100644 (file)
--- a/mjson.c
+++ b/mjson.c
@@ -29,7 +29,7 @@ will match the right spec against the actual data.
    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
-ve array elements (this restriction could be lifted)
+be array elements (this restriction could be lifted)
 
    There are separate entry points for beginning a parse of either
 JSON object or a JSON array. JSON "float" quantities are actually
@@ -59,8 +59,7 @@ PERMISSIONS
 ***************************************************************************/
 
 /* The strptime prototype is not provided unless explicitly requested.
- * We also need to set the value high enough to signal inclusion of
- * newer features (like clock_gettime).  See the POSIX spec for more info:
+ * See the POSIX spec for more info:
  * http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_01_02 */
 #define _XOPEN_SOURCE 600