Pass capn_ptr by value, better handling of tags

This commit is contained in:
James McKaskill 2013-05-07 22:44:21 -04:00
parent 3a235fe8c6
commit b8da11676a
10 changed files with 1236 additions and 438 deletions

29
compiler/capnpc-c.c Normal file
View file

@ -0,0 +1,29 @@
#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;
}