add a capnp annotation for creating name spaces

This patch adds an annotation for creating name spaces within
capnproto files with the C-language code generator.

Use the annotation like this:

  using C = import "/c.capnp";
  $C.namespace("sample_namespace_");

The string passed into the namespace annotation is prepended to the
name of all the struct's in the schema file.

Signed-off-by: Curt Brune <curt@enfabrica.net>
This commit is contained in:
Curt Brune 2022-04-26 14:48:12 -07:00
parent 0650ccbf17
commit c70796b9fb
2 changed files with 36 additions and 4 deletions

View file

@ -46,3 +46,6 @@ annotation donotinclude @0x8c99797357b357e9 (file): UInt64;
annotation typedefto @0xcefaf27713042144 (struct, enum): Text;
# generate a typedef for the annotated struct or enum declaration
annotation namespace @0xf2c035025fec7c2b (file): Text;
# prefix structs with a name space string