From: Eric S. Raymond Date: Fri, 26 Sep 2014 15:17:08 +0000 (-0400) Subject: Remove remnants of t_time. X-Git-Tag: 1.1~4 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=2561d99b10b9eeeed9d3ae3386a419ddee2c4978;p=microjson.git Remove remnants of t_time. --- diff --git a/example3.c b/example3.c index 6c2c786..e3d94ba 100644 --- a/example3.c +++ b/example3.c @@ -30,7 +30,6 @@ static int json_devicelist_read(const char *buf) const struct json_attr_t json_attrs_subdevice[] = { {"path", t_string, STRUCTOBJECT(struct devconfig_t, path), .len = sizeof(devicelist.list[0].path)}, - {"activated", t_time, STRUCTOBJECT(struct devconfig_t, activated)}, {"activated", t_real, STRUCTOBJECT(struct devconfig_t, activated)}, {NULL}, }; diff --git a/microjson.asc b/microjson.asc index 1ba10b4..2386ae1 100644 --- a/microjson.asc +++ b/microjson.asc @@ -146,10 +146,6 @@ C char buffer. +t_character+: Accept a single-character JSON string literal, copy that character to a C +char+ location. -+t_time+: Accept a string in the format of an RFC3339 UTC date with -optional fractional decimal seconds, interpret as seconds since -the Unix epoch UTC, store in a C double location.. - Associated with each simple value type's storage (in the +addr+ union) is a correspondingly-named field in the +dflt+ union). This is a default value which is copied to the target storage @@ -284,6 +280,7 @@ array of JSON objects directly into an array of C structs. #include #include + #include "mjson.h" #define MAXUSERDEVS 4 @@ -305,7 +302,6 @@ static int json_devicelist_read(const char *buf) const struct json_attr_t json_attrs_subdevice[] = { {"path", t_string, STRUCTOBJECT(struct devconfig_t, path), .len = sizeof(devicelist.list[0].path)}, - {"activated", t_time, STRUCTOBJECT(struct devconfig_t, activated)}, {"activated", t_real, STRUCTOBJECT(struct devconfig_t, activated)}, {NULL}, }; @@ -345,7 +341,7 @@ Here is an example: -------------------------------------------------------- $ example3 '{"devices":[{"path":"/dev/ttyUSB0", - "activated":"2014-09-23T10:32:20"}]}' + "activated":1411468340}]}' 1 devices: /dev/ttyUSB0 @ 1411468340.000000 -------------------------------------------------------- @@ -384,9 +380,8 @@ of this in Example 3.) 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). +be of the same type. Third, t_character may not be an array element +(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.