[json-glib] parser: Add debug annotations for json_parse_value()



commit 3355987049560b4d31af22476a7c2b20c9d6665b
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Mar 18 17:08:44 2010 +0000

    parser: Add debug annotations for json_parse_value()
    
    Print out the values we are parsing, for debug purposes.

 json-glib/json-parser.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 18a3d34..082e9b1 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -359,18 +359,26 @@ json_parse_value (JsonParser   *parser,
     {
     case G_TOKEN_INT:
       *node = json_node_new (JSON_NODE_VALUE);
+      JSON_NOTE (PARSER, "abs(node): %" G_GINT64_FORMAT " (sign: %s)",
+                 scanner->value.v_int64,
+                 is_negative ? "negative" : "positive");
       json_node_set_int (*node, is_negative ? scanner->value.v_int64 * -1
                                             : scanner->value.v_int64);
       break;
 
     case G_TOKEN_FLOAT:
       *node = json_node_new (JSON_NODE_VALUE);
+      JSON_NOTE (PARSER, "abs(node): %.6f (sign: %s)",
+                 scanner->value.v_float,
+                 is_negative ? "negative" : "positive");
       json_node_set_double (*node, is_negative ? scanner->value.v_float * -1.0
                                                : scanner->value.v_float);
       break;
 
     case G_TOKEN_STRING:
       *node = json_node_new (JSON_NODE_VALUE);
+      JSON_NOTE (PARSER, "node: '%s'",
+                 scanner->value.v_string);
       json_node_set_string (*node, scanner->value.v_string);
       break;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]