From 9caf88c263f2bee43e997cb70ca1e46a5d61517f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 12 Jun 2022 13:25:16 -0400 Subject: Add error field to json output --- jdtalk.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'jdtalk.h') diff --git a/jdtalk.h b/jdtalk.h index 1c79f75..7ad5e4b 100644 --- a/jdtalk.h +++ b/jdtalk.h @@ -24,14 +24,15 @@ #define WT_ADVERB 3 #define WT_VERB 4 -#define JSON_BEGIN(FP) fprintf(FP, "{\n"); +#define JSON_BEGIN(FP) fprintf(FP, "{\n") #define JSON_INDENT(FP, LEVEL) for (size_t indenter = 0; indenter < LEVEL; indenter++) { fprintf(FP, " "); } -#define JSON_NEXT_ITEM(FP) fprintf(FP, ",\n"); -#define JSON_NEXT_LINE(FP) fprintf(FP, "\n"); -#define JSON_LIST_BEGIN(FP, KEY) JSON_INDENT(FP, 1); fprintf(FP, "\"%s\": [", KEY); -#define JSON_LIST_APPEND(FP, VALUE) JSON_INDENT(FP, 2); fprintf(FP, "\"%s\"", VALUE); -#define JSON_LIST_END(FP) fprintf(FP, "]\n"); -#define JSON_END(FP) fprintf(FP, "}\n"); +#define JSON_NEXT_ITEM(FP) fprintf(FP, ",\n") +#define JSON_NEXT_LINE(FP) fprintf(FP, "\n") +#define JSON_LIST_BEGIN(FP, KEY) JSON_INDENT(FP, 1); fprintf(FP, "\"%s\": [", KEY) +#define JSON_LIST_APPEND(FP, VALUE) JSON_INDENT(FP, 2); fprintf(FP, "\"%s\"", VALUE) +#define JSON_LIST_END(FP) fprintf(FP, "]") +#define JSON_STRING(FP, KEY, VALUE) JSON_INDENT(FP, 1); fprintf(FP, "\"%s\": \"%s\"", KEY, VALUE) +#define JSON_END(FP) fprintf(FP, "}\n") struct Word { char *word; -- cgit