Changeset 03b2b2c in mainline for uspace/app/bithenge/test.c
- Timestamp:
- 2012-06-24T17:32:30Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0d1a8fd
- Parents:
- da0fef6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/test.c
rda0fef6 r03b2b2c 42 42 #include "source.h" 43 43 #include "print.h" 44 #include "script.h" 45 #include "transform.h" 44 46 #include "tree.h" 45 47 46 48 int main(int argc, char *argv[]) 47 49 { 48 if (argc < 2) { 50 int rc; 51 if (argc < 3) { 49 52 // {True: {}, -1351: "\"false\"", "true": False, 0: b"..."} 50 53 const char data[] = "'Twas brillig, and the slithy toves"; … … 66 69 bithenge_node_destroy(node); 67 70 } else { 68 bithenge_node_t *node; 69 int rc = bithenge_node_from_source(&node, argv[1]); 71 bithenge_transform_t *transform; 72 rc = bithenge_parse_script(argv[1], &transform); 73 if (rc != EOK) { 74 printf("Error parsing script: %s\n", str_error(rc)); 75 return 1; 76 } 77 78 bithenge_node_t *node, *node2; 79 int rc = bithenge_node_from_source(&node, argv[2]); 70 80 if (rc != EOK) { 71 81 printf("Error creating node from source: %s\n", str_error(rc)); 72 82 return 1; 73 83 } 74 rc = bithenge_print_node(BITHENGE_PRINT_PYTHON, node); 84 85 rc = bithenge_transform_apply(transform, node, &node2); 86 if (rc != EOK) { 87 printf("Error applying transform: %s\n", str_error(rc)); 88 return 1; 89 } 90 91 bithenge_node_destroy(node); 92 bithenge_transform_dec_ref(transform); 93 94 rc = bithenge_print_node(BITHENGE_PRINT_PYTHON, node2); 75 95 if (rc != EOK) { 76 96 printf("Error printing node: %s\n", str_error(rc)); … … 78 98 } 79 99 printf("\n"); 80 bithenge_node_destroy(node);81 100 } 82 101
Note:
See TracChangeset
for help on using the changeset viewer.