From 55dab1d54db51d4e606dfdeb968741037145b8ae Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 23 Sep 2014 18:15:04 -0400 Subject: [PATCH] Yet more documentation. --- microjson.asc | 10 ++++++++++ mjson.c | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/microjson.asc b/microjson.asc index 76bd835..a400cf3 100644 --- a/microjson.asc +++ b/microjson.asc @@ -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 0bcef5e..c3c0979 100644 --- 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 -- 2.43.0