c-capnproto/compiler/capnpc-c.c
2013-05-07 22:44:21 -04:00

29 lines
577 B
C

#include "schema.h"
int main() {
struct capn capn;
struct CodeGeneratorRequest_ptr root;
struct CodeGeneratorRequest req;
int i;
if (capn_init_fp(&capn, stdin)) {
fprintf(stderr, "failed to read schema on input\n");
return -1;
}
root.p = capn_root(&capn);
read_CodeGeneratorRequest(&root, &req);
for (i = 0; i < req.nodes.size; i++) {
struct Node_ptr p;
struct Node n;
p.p = capn_getp(&req.nodes, i);
read_Node(&p, &n);
fprintf(stderr, "node %s id:%#llx scope:%#llx type:%d\n",
n.displayName.str, n.id, n.scopeId, n.body_tag);
}
return 0;
}