GobySoft / dccl

Dynamic Compact Control Language
Other
17 stars 13 forks source link

Adding packed_enum option (fixes #45) #46

Closed chrismurf closed 5 years ago

chrismurf commented 5 years ago

When set to false, packed_enum will leave gaps in the encoded value range (rather than looking only at the enum value index). This fixes #45.

chrismurf commented 5 years ago

Toby, if you are amenable to this, do you mind pushing a new release to the PPA after merging? I don't know how much that's automated already.

tsaubergine commented 5 years ago

Which PPA?

ppa:tes/dccl-daily is automatically build from 3.0 daily ppa:dccl-dev/ppa is a release one (manual release)

chrismurf commented 5 years ago

I'll eventually need a release, but I may come up with another PR before then for this project. For now, I'll point at dccl-daily, and then request a real release in the future once we get stable.

tsaubergine commented 5 years ago
cd ~/dccl/include/dccl/test/dccl_packed_enum
dccl -a -f test.proto

gives

dccl -a -f test.proto 
||||||| Dynamic Compact Control Language (DCCL) Codec |||||||
2 messages loaded.
Field sizes are in bits unless otherwise noted.
================== 2: dccl.test.TestMsgPack ==================
Actual maximum size of message: 2 bytes / 16 bits
        dccl.id head...........................8
        user head..............................0
        body...................................8
        padding to full byte...................0
Allowed maximum size of message: 2 bytes / 16 bits
--------------------------- Header ---------------------------
dccl.id head...................................8 {dccl.default.id}
---------------------------- Body ----------------------------
dccl.test.TestMsgPack..........................8 {dccl.default3}
        1. five_bit_padding....................5 {dccl.default3}
        2. value...............................3 {dccl.default3}
================= 3: dccl.test.TestMsgUnpack =================
Actual maximum size of message: 4 bytes / 32 bits
        dccl.id head...........................8
        user head..............................0
        body..................................24
        padding to full byte...................0
Allowed maximum size of message: 4 bytes / 32 bits
--------------------------- Header ---------------------------
dccl.id head...................................8 {dccl.default.id}
---------------------------- Body ----------------------------
dccl.test.TestMsgUnpack.......................24 {dccl.default3}
        1. value..............................24 {dccl.default3}
tsaubergine commented 5 years ago

Looks good to me