Verilog Documentation Generator
veridoc-json.c File Reference

Provides declarations of utility functions for writing JSON data to a file stream. More...

#include "veridoc-json.h"

Functions

void json_close_file (json_file *tofree)
 Frees the memory allocated to a json_file construct. More...
 
void json_emit_object (json_file *fh, json_object *toemit, char *varName, unsigned char as_list)
 emits the supplied object into the supplied file, with an optional variable name. More...
 
json_filejson_new_file (char *path)
 Creates a new json file handle. More...
 
json_kvpjson_new_kvp (char *key, json_kvp_type type)
 Creates and returns a new KVP object with the supplied key and datatype.
 
json_object * json_new_object ()
 Creates and returns a pointer to a new json object.
 
void json_object_add_int (json_object *obj, char *key, int value)
 Adds an integer and associated key to the supplied object.
 
void json_object_add_list (json_object *obj, char *key, json_object *value)
 Adds a list and associated key to the supplied object.
 
void json_object_add_object (json_object *obj, char *key, json_object *value)
 Adds a object and associated key to the supplied object.
 
void json_object_add_string (json_object *obj, char *key, char *value)
 Adds a string and associated key to the supplied object.
 

Detailed Description

Provides declarations of utility functions for writing JSON data to a file stream.

Function Documentation

void json_close_file ( json_file tofree)

Frees the memory allocated to a json_file construct.

Frees the memory allocated to a json_file construct and closes the file.

void json_emit_object ( json_file fh,
json_object *  toemit,
char *  varName,
unsigned char  as_list 
)

emits the supplied object into the supplied file, with an optional variable name.

Parameters
[in]varName- The name of the first variable (var) in the file, which will hold the forthcoming JSON data structure. Iff NULL, no var X= will be emitted.
[in]as_list- Emit using the syntax for a list ([...]) rather than an object ({...}).
json_file* json_new_file ( char *  path)

Creates a new json file handle.

Parameters
[in]path- File path of the file to create / overwrite.
[in]varName- The name of the first variable (var) in the file, which will hold the forthcoming JSON data structure. Iff NULL, no var X= will be emitted.
Returns
a json_file construct if the output path can be opened, else NULL.