add support for default values
This commit is contained in:
parent
c85722874d
commit
2eb6628ae4
7 changed files with 700 additions and 466 deletions
|
|
@ -5,7 +5,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
struct check_segment_alignment {
|
||||
char foo : (sizeof(struct capn_segment)&7) ? -1 : 1;
|
||||
unsigned int foo : (sizeof(struct capn_segment)&7) ? -1 : 1;
|
||||
};
|
||||
|
||||
static struct capn_segment *create(void *u, uint32_t id, int sz) {
|
||||
|
|
|
|||
3
capn.c
3
capn.c
|
|
@ -1053,7 +1053,8 @@ int capn_set_text(capn_ptr p, int off, capn_text tgt) {
|
|||
}
|
||||
|
||||
capn_data capn_get_data(capn_ptr p, int off) {
|
||||
capn_data ret = {capn_getp(p, off)};
|
||||
capn_data ret;
|
||||
ret.p = capn_getp(p, off);
|
||||
if (ret.p.type != CAPN_LIST || ret.p.datasz != 1) {
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,18 +1,20 @@
|
|||
#include "schema.capnp.h"
|
||||
/* AUTO GENERATED DO NOT EDIT*/
|
||||
static const capn_text g_nullstr = {0, ""};
|
||||
/* AUTO GENERATED - DO NOT EDIT */
|
||||
static const capn_text g_val0 = {0,""};
|
||||
|
||||
Node_ptr new_Node(struct capn_segment *s) {
|
||||
Node_ptr p = {capn_new_struct(s, 24, 4)};
|
||||
Node_ptr p;
|
||||
p.p = capn_new_struct(s, 24, 4);
|
||||
return p;
|
||||
}
|
||||
Node_list new_Node_list(struct capn_segment *s, int len) {
|
||||
Node_list p = {capn_new_list(s, len, 24, 4)};
|
||||
Node_list p;
|
||||
p.p = capn_new_list(s, len, 24, 4);
|
||||
return p;
|
||||
}
|
||||
void read_Node(struct Node *s, Node_ptr p) {
|
||||
s->id = capn_read64(p.p, 0);
|
||||
s->displayName = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->displayName = capn_get_text(p.p, 0, g_val0);
|
||||
s->scopeId = capn_read64(p.p, 8);
|
||||
s->nestedNodes.p = capn_getp(p.p, 1);
|
||||
s->annotations.p = capn_getp(p.p, 2);
|
||||
|
|
@ -51,24 +53,28 @@ int write_Node(const struct Node *s, Node_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_Node(struct Node *s, Node_list l, int i) {
|
||||
Node_ptr p = {capn_getp(l.p, i)};
|
||||
Node_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_Node(s, p);
|
||||
}
|
||||
int set_Node(const struct Node *s, Node_list l, int i) {
|
||||
Node_ptr p = {capn_getp(l.p, i)};
|
||||
Node_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_Node(s, p);
|
||||
}
|
||||
|
||||
Node_NestedNode_ptr new_Node_NestedNode(struct capn_segment *s) {
|
||||
Node_NestedNode_ptr p = {capn_new_struct(s, 8, 1)};
|
||||
Node_NestedNode_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
return p;
|
||||
}
|
||||
Node_NestedNode_list new_Node_NestedNode_list(struct capn_segment *s, int len) {
|
||||
Node_NestedNode_list p = {capn_new_list(s, len, 8, 1)};
|
||||
Node_NestedNode_list p;
|
||||
p.p = capn_new_list(s, len, 8, 1);
|
||||
return p;
|
||||
}
|
||||
void read_Node_NestedNode(struct Node_NestedNode *s, Node_NestedNode_ptr p) {
|
||||
s->name = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->name = capn_get_text(p.p, 0, g_val0);
|
||||
s->id = capn_read64(p.p, 0);
|
||||
}
|
||||
int write_Node_NestedNode(const struct Node_NestedNode *s, Node_NestedNode_ptr p) {
|
||||
|
|
@ -78,20 +84,24 @@ int write_Node_NestedNode(const struct Node_NestedNode *s, Node_NestedNode_ptr p
|
|||
return err;
|
||||
}
|
||||
void get_Node_NestedNode(struct Node_NestedNode *s, Node_NestedNode_list l, int i) {
|
||||
Node_NestedNode_ptr p = {capn_getp(l.p, i)};
|
||||
Node_NestedNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_Node_NestedNode(s, p);
|
||||
}
|
||||
int set_Node_NestedNode(const struct Node_NestedNode *s, Node_NestedNode_list l, int i) {
|
||||
Node_NestedNode_ptr p = {capn_getp(l.p, i)};
|
||||
Node_NestedNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_Node_NestedNode(s, p);
|
||||
}
|
||||
|
||||
Type_ptr new_Type(struct capn_segment *s) {
|
||||
Type_ptr p = {capn_new_struct(s, 16, 1)};
|
||||
Type_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 1);
|
||||
return p;
|
||||
}
|
||||
Type_list new_Type_list(struct capn_segment *s, int len) {
|
||||
Type_list p = {capn_new_list(s, len, 16, 1)};
|
||||
Type_list p;
|
||||
p.p = capn_new_list(s, len, 16, 1);
|
||||
return p;
|
||||
}
|
||||
void read_Type(struct Type *s, Type_ptr p) {
|
||||
|
|
@ -157,20 +167,24 @@ int write_Type(const struct Type *s, Type_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_Type(struct Type *s, Type_list l, int i) {
|
||||
Type_ptr p = {capn_getp(l.p, i)};
|
||||
Type_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_Type(s, p);
|
||||
}
|
||||
int set_Type(const struct Type *s, Type_list l, int i) {
|
||||
Type_ptr p = {capn_getp(l.p, i)};
|
||||
Type_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_Type(s, p);
|
||||
}
|
||||
|
||||
Value_ptr new_Value(struct capn_segment *s) {
|
||||
Value_ptr p = {capn_new_struct(s, 16, 1)};
|
||||
Value_ptr p;
|
||||
p.p = capn_new_struct(s, 16, 1);
|
||||
return p;
|
||||
}
|
||||
Value_list new_Value_list(struct capn_segment *s, int len) {
|
||||
Value_list p = {capn_new_list(s, len, 16, 1)};
|
||||
Value_list p;
|
||||
p.p = capn_new_list(s, len, 16, 1);
|
||||
return p;
|
||||
}
|
||||
void read_Value(struct Value *s, Value_ptr p) {
|
||||
|
|
@ -203,7 +217,7 @@ void read_Value(struct Value *s, Value_ptr p) {
|
|||
s->body.float64Value = capn_to_f64(capn_read64(p.p, 8));
|
||||
break;
|
||||
case Value_textValue:
|
||||
s->body.textValue = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->body.textValue = capn_get_text(p.p, 0, g_val0);
|
||||
break;
|
||||
case Value_dataValue:
|
||||
s->body.dataValue = capn_get_data(p.p, 0);
|
||||
|
|
@ -243,13 +257,13 @@ int write_Value(const struct Value *s, Value_ptr p) {
|
|||
case Value_int64Value:
|
||||
case Value_uint64Value:
|
||||
case Value_float64Value:
|
||||
err = err || capn_write64(p.p, 4, capn_from_f64(s->body.float64Value));
|
||||
err = err || capn_write64(p.p, 8, capn_from_f64(s->body.float64Value));
|
||||
break;
|
||||
case Value_textValue:
|
||||
err = err || capn_set_text(p.p, 0, s->body.textValue);
|
||||
break;
|
||||
case Value_dataValue:
|
||||
err = err || capn_set_data(p.p, 0, s->body.dataValue);
|
||||
err = err || capn_setp(p.p, 0, s->body.dataValue.p);
|
||||
break;
|
||||
case Value_listValue:
|
||||
case Value_structValue:
|
||||
|
|
@ -260,20 +274,24 @@ int write_Value(const struct Value *s, Value_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_Value(struct Value *s, Value_list l, int i) {
|
||||
Value_ptr p = {capn_getp(l.p, i)};
|
||||
Value_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_Value(s, p);
|
||||
}
|
||||
int set_Value(const struct Value *s, Value_list l, int i) {
|
||||
Value_ptr p = {capn_getp(l.p, i)};
|
||||
Value_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_Value(s, p);
|
||||
}
|
||||
|
||||
Annotation_ptr new_Annotation(struct capn_segment *s) {
|
||||
Annotation_ptr p = {capn_new_struct(s, 8, 1)};
|
||||
Annotation_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
return p;
|
||||
}
|
||||
Annotation_list new_Annotation_list(struct capn_segment *s, int len) {
|
||||
Annotation_list p = {capn_new_list(s, len, 8, 1)};
|
||||
Annotation_list p;
|
||||
p.p = capn_new_list(s, len, 8, 1);
|
||||
return p;
|
||||
}
|
||||
void read_Annotation(struct Annotation *s, Annotation_ptr p) {
|
||||
|
|
@ -287,20 +305,24 @@ int write_Annotation(const struct Annotation *s, Annotation_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_Annotation(struct Annotation *s, Annotation_list l, int i) {
|
||||
Annotation_ptr p = {capn_getp(l.p, i)};
|
||||
Annotation_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_Annotation(s, p);
|
||||
}
|
||||
int set_Annotation(const struct Annotation *s, Annotation_list l, int i) {
|
||||
Annotation_ptr p = {capn_getp(l.p, i)};
|
||||
Annotation_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_Annotation(s, p);
|
||||
}
|
||||
|
||||
FileNode_ptr new_FileNode(struct capn_segment *s) {
|
||||
FileNode_ptr p = {capn_new_struct(s, 0, 1)};
|
||||
FileNode_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 1);
|
||||
return p;
|
||||
}
|
||||
FileNode_list new_FileNode_list(struct capn_segment *s, int len) {
|
||||
FileNode_list p = {capn_new_list(s, len, 0, 1)};
|
||||
FileNode_list p;
|
||||
p.p = capn_new_list(s, len, 0, 1);
|
||||
return p;
|
||||
}
|
||||
void read_FileNode(struct FileNode *s, FileNode_ptr p) {
|
||||
|
|
@ -312,25 +334,29 @@ int write_FileNode(const struct FileNode *s, FileNode_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_FileNode(struct FileNode *s, FileNode_list l, int i) {
|
||||
FileNode_ptr p = {capn_getp(l.p, i)};
|
||||
FileNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_FileNode(s, p);
|
||||
}
|
||||
int set_FileNode(const struct FileNode *s, FileNode_list l, int i) {
|
||||
FileNode_ptr p = {capn_getp(l.p, i)};
|
||||
FileNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_FileNode(s, p);
|
||||
}
|
||||
|
||||
FileNode_Import_ptr new_FileNode_Import(struct capn_segment *s) {
|
||||
FileNode_Import_ptr p = {capn_new_struct(s, 8, 1)};
|
||||
FileNode_Import_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
return p;
|
||||
}
|
||||
FileNode_Import_list new_FileNode_Import_list(struct capn_segment *s, int len) {
|
||||
FileNode_Import_list p = {capn_new_list(s, len, 8, 1)};
|
||||
FileNode_Import_list p;
|
||||
p.p = capn_new_list(s, len, 8, 1);
|
||||
return p;
|
||||
}
|
||||
void read_FileNode_Import(struct FileNode_Import *s, FileNode_Import_ptr p) {
|
||||
s->id = capn_read64(p.p, 0);
|
||||
s->name = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->name = capn_get_text(p.p, 0, g_val0);
|
||||
}
|
||||
int write_FileNode_Import(const struct FileNode_Import *s, FileNode_Import_ptr p) {
|
||||
int err = 0;
|
||||
|
|
@ -339,26 +365,30 @@ int write_FileNode_Import(const struct FileNode_Import *s, FileNode_Import_ptr p
|
|||
return err;
|
||||
}
|
||||
void get_FileNode_Import(struct FileNode_Import *s, FileNode_Import_list l, int i) {
|
||||
FileNode_Import_ptr p = {capn_getp(l.p, i)};
|
||||
FileNode_Import_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_FileNode_Import(s, p);
|
||||
}
|
||||
int set_FileNode_Import(const struct FileNode_Import *s, FileNode_Import_list l, int i) {
|
||||
FileNode_Import_ptr p = {capn_getp(l.p, i)};
|
||||
FileNode_Import_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_FileNode_Import(s, p);
|
||||
}
|
||||
|
||||
StructNode_ptr new_StructNode(struct capn_segment *s) {
|
||||
StructNode_ptr p = {capn_new_struct(s, 8, 1)};
|
||||
StructNode_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
return p;
|
||||
}
|
||||
StructNode_list new_StructNode_list(struct capn_segment *s, int len) {
|
||||
StructNode_list p = {capn_new_list(s, len, 8, 1)};
|
||||
StructNode_list p;
|
||||
p.p = capn_new_list(s, len, 8, 1);
|
||||
return p;
|
||||
}
|
||||
void read_StructNode(struct StructNode *s, StructNode_ptr p) {
|
||||
s->dataSectionWordSize = capn_read16(p.p, 0);
|
||||
s->pointerSectionSize = capn_read16(p.p, 2);
|
||||
s->preferredListEncoding = (enum ElementSize) capn_read16(p.p, 4);
|
||||
s->preferredListEncoding = (enum ElementSize) (capn_read16(p.p, 4));
|
||||
s->members.p = capn_getp(p.p, 0);
|
||||
}
|
||||
int write_StructNode(const struct StructNode *s, StructNode_ptr p) {
|
||||
|
|
@ -370,24 +400,28 @@ int write_StructNode(const struct StructNode *s, StructNode_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_StructNode(struct StructNode *s, StructNode_list l, int i) {
|
||||
StructNode_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_StructNode(s, p);
|
||||
}
|
||||
int set_StructNode(const struct StructNode *s, StructNode_list l, int i) {
|
||||
StructNode_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_StructNode(s, p);
|
||||
}
|
||||
|
||||
StructNode_Member_ptr new_StructNode_Member(struct capn_segment *s) {
|
||||
StructNode_Member_ptr p = {capn_new_struct(s, 8, 3)};
|
||||
StructNode_Member_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 3);
|
||||
return p;
|
||||
}
|
||||
StructNode_Member_list new_StructNode_Member_list(struct capn_segment *s, int len) {
|
||||
StructNode_Member_list p = {capn_new_list(s, len, 8, 3)};
|
||||
StructNode_Member_list p;
|
||||
p.p = capn_new_list(s, len, 8, 3);
|
||||
return p;
|
||||
}
|
||||
void read_StructNode_Member(struct StructNode_Member *s, StructNode_Member_ptr p) {
|
||||
s->name = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->name = capn_get_text(p.p, 0, g_val0);
|
||||
s->ordinal = capn_read16(p.p, 0);
|
||||
s->codeOrder = capn_read16(p.p, 2);
|
||||
s->annotations.p = capn_getp(p.p, 1);
|
||||
|
|
@ -417,20 +451,24 @@ int write_StructNode_Member(const struct StructNode_Member *s, StructNode_Member
|
|||
return err;
|
||||
}
|
||||
void get_StructNode_Member(struct StructNode_Member *s, StructNode_Member_list l, int i) {
|
||||
StructNode_Member_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_Member_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_StructNode_Member(s, p);
|
||||
}
|
||||
int set_StructNode_Member(const struct StructNode_Member *s, StructNode_Member_list l, int i) {
|
||||
StructNode_Member_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_Member_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_StructNode_Member(s, p);
|
||||
}
|
||||
|
||||
StructNode_Field_ptr new_StructNode_Field(struct capn_segment *s) {
|
||||
StructNode_Field_ptr p = {capn_new_struct(s, 8, 2)};
|
||||
StructNode_Field_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 2);
|
||||
return p;
|
||||
}
|
||||
StructNode_Field_list new_StructNode_Field_list(struct capn_segment *s, int len) {
|
||||
StructNode_Field_list p = {capn_new_list(s, len, 8, 2)};
|
||||
StructNode_Field_list p;
|
||||
p.p = capn_new_list(s, len, 8, 2);
|
||||
return p;
|
||||
}
|
||||
void read_StructNode_Field(struct StructNode_Field *s, StructNode_Field_ptr p) {
|
||||
|
|
@ -446,20 +484,24 @@ int write_StructNode_Field(const struct StructNode_Field *s, StructNode_Field_pt
|
|||
return err;
|
||||
}
|
||||
void get_StructNode_Field(struct StructNode_Field *s, StructNode_Field_list l, int i) {
|
||||
StructNode_Field_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_Field_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_StructNode_Field(s, p);
|
||||
}
|
||||
int set_StructNode_Field(const struct StructNode_Field *s, StructNode_Field_list l, int i) {
|
||||
StructNode_Field_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_Field_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_StructNode_Field(s, p);
|
||||
}
|
||||
|
||||
StructNode_Union_ptr new_StructNode_Union(struct capn_segment *s) {
|
||||
StructNode_Union_ptr p = {capn_new_struct(s, 8, 1)};
|
||||
StructNode_Union_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
return p;
|
||||
}
|
||||
StructNode_Union_list new_StructNode_Union_list(struct capn_segment *s, int len) {
|
||||
StructNode_Union_list p = {capn_new_list(s, len, 8, 1)};
|
||||
StructNode_Union_list p;
|
||||
p.p = capn_new_list(s, len, 8, 1);
|
||||
return p;
|
||||
}
|
||||
void read_StructNode_Union(struct StructNode_Union *s, StructNode_Union_ptr p) {
|
||||
|
|
@ -473,20 +515,24 @@ int write_StructNode_Union(const struct StructNode_Union *s, StructNode_Union_pt
|
|||
return err;
|
||||
}
|
||||
void get_StructNode_Union(struct StructNode_Union *s, StructNode_Union_list l, int i) {
|
||||
StructNode_Union_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_Union_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_StructNode_Union(s, p);
|
||||
}
|
||||
int set_StructNode_Union(const struct StructNode_Union *s, StructNode_Union_list l, int i) {
|
||||
StructNode_Union_ptr p = {capn_getp(l.p, i)};
|
||||
StructNode_Union_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_StructNode_Union(s, p);
|
||||
}
|
||||
|
||||
EnumNode_ptr new_EnumNode(struct capn_segment *s) {
|
||||
EnumNode_ptr p = {capn_new_struct(s, 0, 1)};
|
||||
EnumNode_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 1);
|
||||
return p;
|
||||
}
|
||||
EnumNode_list new_EnumNode_list(struct capn_segment *s, int len) {
|
||||
EnumNode_list p = {capn_new_list(s, len, 0, 1)};
|
||||
EnumNode_list p;
|
||||
p.p = capn_new_list(s, len, 0, 1);
|
||||
return p;
|
||||
}
|
||||
void read_EnumNode(struct EnumNode *s, EnumNode_ptr p) {
|
||||
|
|
@ -498,24 +544,28 @@ int write_EnumNode(const struct EnumNode *s, EnumNode_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_EnumNode(struct EnumNode *s, EnumNode_list l, int i) {
|
||||
EnumNode_ptr p = {capn_getp(l.p, i)};
|
||||
EnumNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_EnumNode(s, p);
|
||||
}
|
||||
int set_EnumNode(const struct EnumNode *s, EnumNode_list l, int i) {
|
||||
EnumNode_ptr p = {capn_getp(l.p, i)};
|
||||
EnumNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_EnumNode(s, p);
|
||||
}
|
||||
|
||||
EnumNode_Enumerant_ptr new_EnumNode_Enumerant(struct capn_segment *s) {
|
||||
EnumNode_Enumerant_ptr p = {capn_new_struct(s, 8, 2)};
|
||||
EnumNode_Enumerant_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 2);
|
||||
return p;
|
||||
}
|
||||
EnumNode_Enumerant_list new_EnumNode_Enumerant_list(struct capn_segment *s, int len) {
|
||||
EnumNode_Enumerant_list p = {capn_new_list(s, len, 8, 2)};
|
||||
EnumNode_Enumerant_list p;
|
||||
p.p = capn_new_list(s, len, 8, 2);
|
||||
return p;
|
||||
}
|
||||
void read_EnumNode_Enumerant(struct EnumNode_Enumerant *s, EnumNode_Enumerant_ptr p) {
|
||||
s->name = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->name = capn_get_text(p.p, 0, g_val0);
|
||||
s->codeOrder = capn_read16(p.p, 0);
|
||||
s->annotations.p = capn_getp(p.p, 1);
|
||||
}
|
||||
|
|
@ -527,20 +577,24 @@ int write_EnumNode_Enumerant(const struct EnumNode_Enumerant *s, EnumNode_Enumer
|
|||
return err;
|
||||
}
|
||||
void get_EnumNode_Enumerant(struct EnumNode_Enumerant *s, EnumNode_Enumerant_list l, int i) {
|
||||
EnumNode_Enumerant_ptr p = {capn_getp(l.p, i)};
|
||||
EnumNode_Enumerant_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_EnumNode_Enumerant(s, p);
|
||||
}
|
||||
int set_EnumNode_Enumerant(const struct EnumNode_Enumerant *s, EnumNode_Enumerant_list l, int i) {
|
||||
EnumNode_Enumerant_ptr p = {capn_getp(l.p, i)};
|
||||
EnumNode_Enumerant_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_EnumNode_Enumerant(s, p);
|
||||
}
|
||||
|
||||
InterfaceNode_ptr new_InterfaceNode(struct capn_segment *s) {
|
||||
InterfaceNode_ptr p = {capn_new_struct(s, 0, 1)};
|
||||
InterfaceNode_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 1);
|
||||
return p;
|
||||
}
|
||||
InterfaceNode_list new_InterfaceNode_list(struct capn_segment *s, int len) {
|
||||
InterfaceNode_list p = {capn_new_list(s, len, 0, 1)};
|
||||
InterfaceNode_list p;
|
||||
p.p = capn_new_list(s, len, 0, 1);
|
||||
return p;
|
||||
}
|
||||
void read_InterfaceNode(struct InterfaceNode *s, InterfaceNode_ptr p) {
|
||||
|
|
@ -552,24 +606,28 @@ int write_InterfaceNode(const struct InterfaceNode *s, InterfaceNode_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_InterfaceNode(struct InterfaceNode *s, InterfaceNode_list l, int i) {
|
||||
InterfaceNode_ptr p = {capn_getp(l.p, i)};
|
||||
InterfaceNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_InterfaceNode(s, p);
|
||||
}
|
||||
int set_InterfaceNode(const struct InterfaceNode *s, InterfaceNode_list l, int i) {
|
||||
InterfaceNode_ptr p = {capn_getp(l.p, i)};
|
||||
InterfaceNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_InterfaceNode(s, p);
|
||||
}
|
||||
|
||||
InterfaceNode_Method_ptr new_InterfaceNode_Method(struct capn_segment *s) {
|
||||
InterfaceNode_Method_ptr p = {capn_new_struct(s, 8, 4)};
|
||||
InterfaceNode_Method_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 4);
|
||||
return p;
|
||||
}
|
||||
InterfaceNode_Method_list new_InterfaceNode_Method_list(struct capn_segment *s, int len) {
|
||||
InterfaceNode_Method_list p = {capn_new_list(s, len, 8, 4)};
|
||||
InterfaceNode_Method_list p;
|
||||
p.p = capn_new_list(s, len, 8, 4);
|
||||
return p;
|
||||
}
|
||||
void read_InterfaceNode_Method(struct InterfaceNode_Method *s, InterfaceNode_Method_ptr p) {
|
||||
s->name = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->name = capn_get_text(p.p, 0, g_val0);
|
||||
s->codeOrder = capn_read16(p.p, 0);
|
||||
s->params.p = capn_getp(p.p, 1);
|
||||
s->requiredParamCount = capn_read16(p.p, 2);
|
||||
|
|
@ -587,24 +645,28 @@ int write_InterfaceNode_Method(const struct InterfaceNode_Method *s, InterfaceNo
|
|||
return err;
|
||||
}
|
||||
void get_InterfaceNode_Method(struct InterfaceNode_Method *s, InterfaceNode_Method_list l, int i) {
|
||||
InterfaceNode_Method_ptr p = {capn_getp(l.p, i)};
|
||||
InterfaceNode_Method_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_InterfaceNode_Method(s, p);
|
||||
}
|
||||
int set_InterfaceNode_Method(const struct InterfaceNode_Method *s, InterfaceNode_Method_list l, int i) {
|
||||
InterfaceNode_Method_ptr p = {capn_getp(l.p, i)};
|
||||
InterfaceNode_Method_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_InterfaceNode_Method(s, p);
|
||||
}
|
||||
|
||||
InterfaceNode_Method_Param_ptr new_InterfaceNode_Method_Param(struct capn_segment *s) {
|
||||
InterfaceNode_Method_Param_ptr p = {capn_new_struct(s, 0, 4)};
|
||||
InterfaceNode_Method_Param_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 4);
|
||||
return p;
|
||||
}
|
||||
InterfaceNode_Method_Param_list new_InterfaceNode_Method_Param_list(struct capn_segment *s, int len) {
|
||||
InterfaceNode_Method_Param_list p = {capn_new_list(s, len, 0, 4)};
|
||||
InterfaceNode_Method_Param_list p;
|
||||
p.p = capn_new_list(s, len, 0, 4);
|
||||
return p;
|
||||
}
|
||||
void read_InterfaceNode_Method_Param(struct InterfaceNode_Method_Param *s, InterfaceNode_Method_Param_ptr p) {
|
||||
s->name = capn_get_text(p.p, 0, g_nullstr);
|
||||
s->name = capn_get_text(p.p, 0, g_val0);
|
||||
s->type.p = capn_getp(p.p, 1);
|
||||
s->defaultValue.p = capn_getp(p.p, 2);
|
||||
s->annotations.p = capn_getp(p.p, 3);
|
||||
|
|
@ -618,20 +680,24 @@ int write_InterfaceNode_Method_Param(const struct InterfaceNode_Method_Param *s,
|
|||
return err;
|
||||
}
|
||||
void get_InterfaceNode_Method_Param(struct InterfaceNode_Method_Param *s, InterfaceNode_Method_Param_list l, int i) {
|
||||
InterfaceNode_Method_Param_ptr p = {capn_getp(l.p, i)};
|
||||
InterfaceNode_Method_Param_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_InterfaceNode_Method_Param(s, p);
|
||||
}
|
||||
int set_InterfaceNode_Method_Param(const struct InterfaceNode_Method_Param *s, InterfaceNode_Method_Param_list l, int i) {
|
||||
InterfaceNode_Method_Param_ptr p = {capn_getp(l.p, i)};
|
||||
InterfaceNode_Method_Param_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_InterfaceNode_Method_Param(s, p);
|
||||
}
|
||||
|
||||
ConstNode_ptr new_ConstNode(struct capn_segment *s) {
|
||||
ConstNode_ptr p = {capn_new_struct(s, 0, 2)};
|
||||
ConstNode_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 2);
|
||||
return p;
|
||||
}
|
||||
ConstNode_list new_ConstNode_list(struct capn_segment *s, int len) {
|
||||
ConstNode_list p = {capn_new_list(s, len, 0, 2)};
|
||||
ConstNode_list p;
|
||||
p.p = capn_new_list(s, len, 0, 2);
|
||||
return p;
|
||||
}
|
||||
void read_ConstNode(struct ConstNode *s, ConstNode_ptr p) {
|
||||
|
|
@ -645,20 +711,24 @@ int write_ConstNode(const struct ConstNode *s, ConstNode_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_ConstNode(struct ConstNode *s, ConstNode_list l, int i) {
|
||||
ConstNode_ptr p = {capn_getp(l.p, i)};
|
||||
ConstNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_ConstNode(s, p);
|
||||
}
|
||||
int set_ConstNode(const struct ConstNode *s, ConstNode_list l, int i) {
|
||||
ConstNode_ptr p = {capn_getp(l.p, i)};
|
||||
ConstNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_ConstNode(s, p);
|
||||
}
|
||||
|
||||
AnnotationNode_ptr new_AnnotationNode(struct capn_segment *s) {
|
||||
AnnotationNode_ptr p = {capn_new_struct(s, 8, 1)};
|
||||
AnnotationNode_ptr p;
|
||||
p.p = capn_new_struct(s, 8, 1);
|
||||
return p;
|
||||
}
|
||||
AnnotationNode_list new_AnnotationNode_list(struct capn_segment *s, int len) {
|
||||
AnnotationNode_list p = {capn_new_list(s, len, 8, 1)};
|
||||
AnnotationNode_list p;
|
||||
p.p = capn_new_list(s, len, 8, 1);
|
||||
return p;
|
||||
}
|
||||
void read_AnnotationNode(struct AnnotationNode *s, AnnotationNode_ptr p) {
|
||||
|
|
@ -692,20 +762,24 @@ int write_AnnotationNode(const struct AnnotationNode *s, AnnotationNode_ptr p) {
|
|||
return err;
|
||||
}
|
||||
void get_AnnotationNode(struct AnnotationNode *s, AnnotationNode_list l, int i) {
|
||||
AnnotationNode_ptr p = {capn_getp(l.p, i)};
|
||||
AnnotationNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_AnnotationNode(s, p);
|
||||
}
|
||||
int set_AnnotationNode(const struct AnnotationNode *s, AnnotationNode_list l, int i) {
|
||||
AnnotationNode_ptr p = {capn_getp(l.p, i)};
|
||||
AnnotationNode_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_AnnotationNode(s, p);
|
||||
}
|
||||
|
||||
CodeGeneratorRequest_ptr new_CodeGeneratorRequest(struct capn_segment *s) {
|
||||
CodeGeneratorRequest_ptr p = {capn_new_struct(s, 0, 2)};
|
||||
CodeGeneratorRequest_ptr p;
|
||||
p.p = capn_new_struct(s, 0, 2);
|
||||
return p;
|
||||
}
|
||||
CodeGeneratorRequest_list new_CodeGeneratorRequest_list(struct capn_segment *s, int len) {
|
||||
CodeGeneratorRequest_list p = {capn_new_list(s, len, 0, 2)};
|
||||
CodeGeneratorRequest_list p;
|
||||
p.p = capn_new_list(s, len, 0, 2);
|
||||
return p;
|
||||
}
|
||||
void read_CodeGeneratorRequest(struct CodeGeneratorRequest *s, CodeGeneratorRequest_ptr p) {
|
||||
|
|
@ -719,10 +793,12 @@ int write_CodeGeneratorRequest(const struct CodeGeneratorRequest *s, CodeGenerat
|
|||
return err;
|
||||
}
|
||||
void get_CodeGeneratorRequest(struct CodeGeneratorRequest *s, CodeGeneratorRequest_list l, int i) {
|
||||
CodeGeneratorRequest_ptr p = {capn_getp(l.p, i)};
|
||||
CodeGeneratorRequest_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
read_CodeGeneratorRequest(s, p);
|
||||
}
|
||||
int set_CodeGeneratorRequest(const struct CodeGeneratorRequest *s, CodeGeneratorRequest_list l, int i) {
|
||||
CodeGeneratorRequest_ptr p = {capn_getp(l.p, i)};
|
||||
CodeGeneratorRequest_ptr p;
|
||||
p.p = capn_getp(l.p, i);
|
||||
return write_CodeGeneratorRequest(s, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef CAPN_b471df2f45ca32c7
|
||||
#define CAPN_b471df2f45ca32c7
|
||||
/* AUTO GENERATED DO NOT EDIT*/
|
||||
#ifndef CAPN_B471DF2F45CA32C7
|
||||
#define CAPN_B471DF2F45CA32C7
|
||||
/* AUTO GENERATED - DO NOT EDIT */
|
||||
#include <capn.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -67,6 +67,8 @@ typedef struct {capn_ptr p;} ConstNode_list;
|
|||
typedef struct {capn_ptr p;} AnnotationNode_list;
|
||||
typedef struct {capn_ptr p;} CodeGeneratorRequest_list;
|
||||
|
||||
|
||||
|
||||
Node_ptr new_Node(struct capn_segment*);
|
||||
Node_NestedNode_ptr new_Node_NestedNode(struct capn_segment*);
|
||||
Type_ptr new_Type(struct capn_segment*);
|
||||
|
|
@ -275,7 +277,7 @@ enum Value_body {
|
|||
struct Value {
|
||||
enum Value_body body_tag;
|
||||
union {
|
||||
unsigned int boolValue : 1;
|
||||
unsigned int boolValue:1;
|
||||
int8_t int8Value;
|
||||
int16_t int16Value;
|
||||
int32_t int32Value;
|
||||
|
|
@ -392,17 +394,17 @@ struct ConstNode {
|
|||
|
||||
struct AnnotationNode {
|
||||
Type_ptr type;
|
||||
unsigned int targetsFile : 1;
|
||||
unsigned int targetsConst : 1;
|
||||
unsigned int targetsEnum : 1;
|
||||
unsigned int targetsEnumerant : 1;
|
||||
unsigned int targetsStruct : 1;
|
||||
unsigned int targetsField : 1;
|
||||
unsigned int targetsUnion : 1;
|
||||
unsigned int targetsInterface : 1;
|
||||
unsigned int targetsMethod : 1;
|
||||
unsigned int targetsParam : 1;
|
||||
unsigned int targetsAnnotation : 1;
|
||||
unsigned int targetsFile:1;
|
||||
unsigned int targetsConst:1;
|
||||
unsigned int targetsEnum:1;
|
||||
unsigned int targetsEnumerant:1;
|
||||
unsigned int targetsStruct:1;
|
||||
unsigned int targetsField:1;
|
||||
unsigned int targetsUnion:1;
|
||||
unsigned int targetsInterface:1;
|
||||
unsigned int targetsMethod:1;
|
||||
unsigned int targetsParam:1;
|
||||
unsigned int targetsAnnotation:1;
|
||||
};
|
||||
|
||||
struct CodeGeneratorRequest {
|
||||
|
|
|
|||
|
|
@ -94,3 +94,11 @@ int str_addf(struct str *v, const char* format, ...) {
|
|||
return str_vaddf(v, format, ap);
|
||||
}
|
||||
|
||||
char *strf(struct str *v, const char* format, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
str_reset(v);
|
||||
str_vaddf(v, format, ap);
|
||||
return v->str;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@ static void str_release(struct str *v) {
|
|||
}
|
||||
|
||||
static void str_reset(struct str *v) {
|
||||
if (v->len) {
|
||||
v->len = 0;
|
||||
v->str[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
static void str_setlen(struct str *v, int sz) {
|
||||
|
|
@ -38,5 +40,6 @@ static void str_setlen(struct str *v, int sz) {
|
|||
void str_add(struct str *v, const char *str, int sz);
|
||||
int str_vaddf(struct str *v, const char *format, va_list ap) ATTR(2,0);
|
||||
int str_addf(struct str *v, const char *format, ...) ATTR(2,3);
|
||||
char *strf(struct str *v, const char *format, ...) ATTR(2,3);
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue