Changeset 11b9ad7 in mainline


Ignore:
Timestamp:
2012-06-06T21:12:38Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
520acaf
Parents:
50985c34
Message:

Bithenge: tree API and JSON/Python printing

Location:
uspace/app/bithenge
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/Makefile

    r50985c34 r11b9ad7  
    3636        block.c \
    3737        file.c \
    38         test.c
     38        print.c \
     39        test.c \
     40        tree.c
    3941
    4042include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/bithenge/test.c

    r50985c34 r11b9ad7  
    4141#include "block.h"
    4242#include "file.h"
     43#include "print.h"
     44#include "tree.h"
    4345
    4446static void
     
    9496        bithenge_blob_destroy(blob);
    9597
     98        // {True: {}, -1351: "zero", "true": False, 0: 17}
     99        bithenge_node_t *node;
     100        bithenge_node_t *nodes[8];
     101        bithenge_new_boolean_node(&nodes[0], true);
     102        bithenge_new_simple_internal_node(&nodes[1], NULL, 0, false);
     103        bithenge_new_integer_node(&nodes[2], -1351);
     104        bithenge_new_string_node(&nodes[3], "zero", false);
     105        bithenge_new_string_node(&nodes[4], "true", false);
     106        bithenge_new_boolean_node(&nodes[5], false);
     107        bithenge_new_integer_node(&nodes[6], 0);
     108        bithenge_new_integer_node(&nodes[7], 17);
     109        bithenge_new_simple_internal_node(&node, nodes, 4, false);
     110        bithenge_print_node(BITHENGE_PRINT_PYTHON, node);
     111        printf("\n");
     112        bithenge_print_node(BITHENGE_PRINT_JSON, node);
     113        printf("\n");
     114        bithenge_node_destroy(node);
     115
    96116        return 0;
    97117}
Note: See TracChangeset for help on using the changeset viewer.