This is a C plugin for [Cap'n Proto](http://kentonv.github.io/capnproto), an efficient protocol for sharing data and capabilities.
Find a file
Nathanael Jones 27df3d6064 Align capn_segment to 64-bit boundaries on MSVC
Unless capn_segment is defined with __declspec(align(64)),
check_segment_alignment fails to compile in x86 mode, as (sizeof(struct
capn_segment)&7) -> (44 & 7) evaluates to 4
Always compiles in x64 mode, as (sizeof(struct capn_segment)&7) -> (80 &
7) evaluates to 0
2016-05-11 10:30:41 -07:00
ac tack on autoconf/automake build 2016-02-28 13:55:23 +01:00
compiler don't write out empty structs 2016-04-06 14:18:29 -03:00
gtest@d225acc90b gtest: integrate as git submodule 2016-03-19 00:39:29 +01:00
lib Align capn_segment to 64-bit boundaries on MSVC 2016-05-11 10:30:41 -07:00
m4 tack on autoconf/automake build 2016-02-28 13:55:23 +01:00
tests tests: move into tests/ subdir 2016-03-19 00:39:30 +01:00
.gitignore add & install pkgconfig file 2016-03-19 00:39:30 +01:00
.gitmodules gtest: integrate as git submodule 2016-03-19 00:39:29 +01:00
.travis.yml Travis CI: whatever. 2016-02-28 18:38:41 +01:00
c-capnproto.pc.in add & install pkgconfig file 2016-03-19 00:39:30 +01:00
configure.ac add & install pkgconfig file 2016-03-19 00:39:30 +01:00
COPYING tack on autoconf/automake build 2016-02-28 13:55:23 +01:00
Makefile.am add & install pkgconfig file 2016-03-19 00:39:30 +01:00
README.md Add build instructions 2016-04-27 10:25:43 -06:00

capnpc-c

This is a C plugin for Cap'n Proto, an efficient protocol for sharing data and capabilities.

This is only the plugin, to properly make use of it you need to download, build and install capnpc and then build and install this project and then you can utilize it as:

capnpc compiler/test.capnp -oc

Build Status

status

This is a merge of 3 forks of James McKaskill's great work, which has been untouched for a while:

usage

The compiler directory contains the C language plugin (capnpc-c) for use with the capnp tool: https://capnproto.org/capnp-tool.html.

capnp will by default search $PATH for capnpc-c - if it's on your PATH, you can generate code for your schema as follows:

$ capnp compile -o c myschema.capnp

Otherwise, you can specify the path to the c plugin:

$ capnp compile -o ./capnpc-c myschema.capnp

capnp generates a C struct that corresponds to each capn proto struct, along with read/write functions that convert to/from capn proto form.

TBD whether it will make sense in the future to provide accessor functions for struct members, rather than converting entire structs.

building on linux

git clone https://github.com/opensourcerouting/c-capnproto
cd c-capnproto
git submodule update --init --recursive
autoreconf -f -i -s 
./configure
make
make check