Changes in uspace/app/bithenge/test.c [6be4142:0191bd3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/test.c
r6be4142 r0191bd3 50 50 int rc; 51 51 if (argc < 3) { 52 fprintf(stderr, "Usage: %s <script> <source>\n", argv[0]); 53 return 1; 52 // {True: {}, -1351: "\"false\"", "true": False, 0: b"..."} 53 const char data[] = "'Twas brillig, and the slithy toves"; 54 bithenge_node_t *node; 55 bithenge_node_t *subnodes[8]; 56 bithenge_new_boolean_node(&subnodes[0], true); 57 bithenge_new_simple_internal_node(&subnodes[1], NULL, 0, false); 58 bithenge_new_integer_node(&subnodes[2], -1351); 59 bithenge_new_string_node(&subnodes[3], "\"false\"", false); 60 bithenge_new_string_node(&subnodes[4], "true", false); 61 bithenge_new_boolean_node(&subnodes[5], false); 62 bithenge_new_integer_node(&subnodes[6], 0); 63 bithenge_new_blob_from_data(&subnodes[7], data, sizeof(data)); 64 bithenge_new_simple_internal_node(&node, subnodes, 4, false); 65 bithenge_print_node(BITHENGE_PRINT_PYTHON, node); 66 printf("\n"); 67 bithenge_print_node(BITHENGE_PRINT_JSON, node); 68 printf("\n"); 69 bithenge_node_dec_ref(node); 54 70 } else { 55 71 bithenge_scope_t *scope = NULL; … … 80 96 rc = bithenge_transform_apply(transform, scope, node, &node2); 81 97 if (rc != EOK) { 82 const char *message = bithenge_scope_get_error(scope); 83 printf("Error applying transform: %s\n", 84 message ? message : str_error(rc)); 98 printf("Error applying transform: %s\n", str_error(rc)); 85 99 node2 = NULL; 86 100 goto error; … … 94 108 rc = bithenge_print_node(BITHENGE_PRINT_PYTHON, node2); 95 109 if (rc != EOK) { 96 const char *message = bithenge_scope_get_error(scope); 97 printf("Error printing node: %s\n", 98 message ? message : str_error(rc)); 110 printf("Error printing node: %s\n", str_error(rc)); 99 111 goto error; 100 112 }
Note:
See TracChangeset
for help on using the changeset viewer.