diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-03-16 11:06:54 +0100 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-03-16 11:06:54 +0100 |
commit | 7035f06bf453bdf2f9f09fd8a392778e9ad3cd43 (patch) | |
tree | 529e55a00a8882c5f9d7e701be125379e0d15efb /lib/Json.ml | |
parent | c54e20b2c444ddbb561bb4ac0422c92b77b656b1 (diff) | |
download | compcert-7035f06bf453bdf2f9f09fd8a392778e9ad3cd43.tar.gz compcert-7035f06bf453bdf2f9f09fd8a392778e9ad3cd43.zip |
Cleanup of AsmToJSON.
Removed unused code, factored out common functions and added an
interface file.
Bug 18394
Diffstat (limited to 'lib/Json.ml')
-rw-r--r-- | lib/Json.ml | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Json.ml b/lib/Json.ml index 4aa91e95..22b50a9e 100644 --- a/lib/Json.ml +++ b/lib/Json.ml @@ -15,7 +15,8 @@ open Printf (* Simple functions for JSON printing *) (* Print a string as json string *) -let p_jstring oc s = fprintf oc "\"%s\"" s +let p_jstring oc s = + fprintf oc "\"%s\"" s (* Print a list as json array *) let p_jarray elem oc l = @@ -29,13 +30,20 @@ let p_jarray elem oc l = (* Print a bool as json bool *) let p_jbool oc = fprintf oc "%B" -(* Print a int as json int *) +(* Print an int as json int *) let p_jint oc = fprintf oc "%d" +(* Print an int32 as json int *) +let p_jint32 oc = fprintf oc "%ld" + (* Print a member *) let p_jmember oc name p_mem mem = fprintf oc "\n%a:%a" p_jstring name p_mem mem +(* Print singleton object *) +let p_jsingle_object oc name p_mem mem = + fprintf oc "{%a:%a}" p_jstring name p_mem mem + (* Print optional value *) let p_jopt p_elem oc = function | None -> output_string oc "null" |