changeset 11:3fce44ee023b

Minor documentation/comment tweaks
author Norman Gray <norman@astro.gla.ac.uk>
date Fri, 03 Jan 2014 16:29:47 +0000
parents 715d1f40595b
children a9a41fa6fa73
files src/jason.h src/json_lex.lex
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/jason.h	Fri Jan 03 16:16:43 2014 +0000
+++ b/src/jason.h	Fri Jan 03 16:29:47 2014 +0000
@@ -3,9 +3,17 @@
 
 #include <stdio.h>
 
-#include <inttypes.h> /* includes stdint.h */
+/*
+ * It would appear to be useful to define the type 'typedef uint8_t byte'.
+ * However doing so collides with a (quite likely) definition of this
+ * type in the code that calls this library.
+ */
 
-
+/*
+ * JSON integers are represented as a maximum-length integer type,
+ * intmax_t, from inttypes.h
+ */
+#include <inttypes.h> /* includes stdint.h */
 typedef intmax_t jsonint;
 #define JSONFMT PRIiMAX
 
@@ -29,15 +37,16 @@
         jsonint i;
         double f;
         /* both arrays and objects are represented by having 'a'
-           point to the first in a linked list of their contents, of
-           whatever types */
+           point to an array of pointers to struct json_object */
         struct {
             struct json_object** p;
             size_t alloc;
             size_t len;
         } a;
         /* kv is a single key-value pair, which comprises the
-           contents of an object */
+           contents of an object.  This is not a JSON type, and is not
+           exposed by the library, but is used so that (JSON) objects can be
+           represented as an array of these types. */
         struct {
             const char* k;
             struct json_object* v;
--- a/src/json_lex.lex	Fri Jan 03 16:16:43 2014 +0000
+++ b/src/json_lex.lex	Fri Jan 03 16:29:47 2014 +0000
@@ -28,6 +28,9 @@
 int lex_setup(const char*);
 void lex_release(void);
 
+/* Prevent flex emitting an input() function (not a documented flex option) */
+#define YY_NO_INPUT 1
+
 #define YY_INPUT(buf, result, max_size)                                 \
     {                                                                   \
         if (parse_string_p == NULL || parse_string_endp == NULL) {      \