From d973b4b8eaaa5e7f1d10f9f02069c6d7bde25dcc Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sun, 3 Oct 2021 21:31:59 +0100 Subject: Add testing code and fix a few bugs --- cudl.h | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'cudl.h') diff --git a/cudl.h b/cudl.h index 6586bba..a96cc45 100644 --- a/cudl.h +++ b/cudl.h @@ -7,10 +7,7 @@ struct cudl_array_value { }; struct cudl_map_value { - struct cudl_map_field { - char *key; - struct cudl_value value; - } *fields; + struct cudl_map_field *fields; size_t length; }; @@ -19,24 +16,31 @@ struct cudl_value { char *string; double number; int boolean; - struct array_value array; - struct map_value map; + struct cudl_array_value array; + struct cudl_map_value map; } data; int tag; }; +struct cudl_map_field { + char *key; + struct cudl_value value; +}; + enum { - CUDL_TAG_NULL; - CUDL_TAG_BOOL; - CUDL_TAG_ARRAY; -} + CUDL_TAG_NULL, + CUDL_TAG_BOOL, + CUDL_TAG_ARRAY, +}; enum { - CUDL_OK = 0; - CUDL_ERR_OUT_OF_MEMORY; - CUDL_ERR_EXPECTED_VALUE; - CUDL_ERR_READING; - CUDL_ERR_EXPECTED_BOOL_OR_NULL; + CUDL_OK = 0, + CUDL_ERR_OUT_OF_MEMORY, + CUDL_ERR_EXPECTED_VALUE, + CUDL_ERR_READING, + CUDL_ERR_EXPECTED_BOOL_OR_NULL, + CUDL_ERR_UNMATCHED_BRACK, + CUDL_ERR_UNRECOGNISED_VALUE, }; extern int cudl_err; -- cgit v1.2.3