ffc338d50d807987ff5a22ccfdd8a59f660e70d2 kent Sun Jul 2 08:51:10 2017 -0700 Making JW_SEP not a define any more but a field of he jsonWrite structure. diff --git src/inc/jsonWrite.h src/inc/jsonWrite.h index 9e097f7..0683923 100644 --- src/inc/jsonWrite.h +++ src/inc/jsonWrite.h @@ -16,30 +16,32 @@ struct jwObjInfo /* Helps keep track of whether a comma is needed and whether we need to close an object or list */ { bool isNotEmpty; /* TRUE if an item has already been added to this object or list */ bool isObject; /* TRUE if item is an object (not a list). */ }; struct jsonWrite /* Object to help output JSON */ { struct jsonWrite *next; struct dyString *dy; /* Most of this module is building json text in here */ struct jwObjInfo objStack[128]; /* Make stack deep enough to handle nested objects and lists */ int stackIx; /* Current index in stack */ + char sep; /* Separator, defaults to ' ', but set to '\n' for human + * readability. */ }; struct jsonWrite *jsonWriteNew(); /* Return new empty jsonWrite struct. */ void jsonWriteFree(struct jsonWrite **pJw); /* Free up a jsonWrite object. */ void jsonWriteTag(struct jsonWrite *jw, char *var); /* Print out preceding comma if necessary, and if var is non-NULL, quoted tag followed by colon. */ void jsonWriteEndLine(struct jsonWrite *jw); /* Write comma if in middle, and then newline regardless. */ void jsonWriteString(struct jsonWrite *jw, char *var, char *string);