Changeset 5e718d9 in mainline for uspace/app/bithenge/test.c
- Timestamp:
- 2012-08-21T10:04:16Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67edca6
- Parents:
- 0da6c04 (diff), 6a97f2e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/test.c
r0da6c04 r5e718d9 50 50 int rc; 51 51 if (argc < 3) { 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); 52 fprintf(stderr, "Usage: %s <script> <source>\n", argv[0]); 53 return 1; 70 54 } else { 71 55 bithenge_scope_t *scope = NULL; … … 96 80 rc = bithenge_transform_apply(transform, scope, node, &node2); 97 81 if (rc != EOK) { 98 printf("Error applying transform: %s\n", str_error(rc)); 82 const char *message = bithenge_scope_get_error(scope); 83 printf("Error applying transform: %s\n", 84 message ? message : str_error(rc)); 99 85 node2 = NULL; 100 86 goto error; … … 108 94 rc = bithenge_print_node(BITHENGE_PRINT_PYTHON, node2); 109 95 if (rc != EOK) { 110 printf("Error printing node: %s\n", str_error(rc)); 96 const char *message = bithenge_scope_get_error(scope); 97 printf("Error printing node: %s\n", 98 message ? message : str_error(rc)); 111 99 goto error; 112 100 }
Note:
See TracChangeset
for help on using the changeset viewer.