<div class="gmail_quote">2012/1/23 Olaf Meeuwissen <span dir="ltr">&lt;<a href="mailto:olaf.meeuwissen@avasys.jp">olaf.meeuwissen@avasys.jp</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
While I had no trouble getting the parsing part for this to work, I&#39;m<br>
stuck on the generator part.  Specifically, I&#39;m stuck on getting the<br>
size into the output.<br>
<br>
The goal is a rule that takes a std::vector&lt;byte&gt; and outputs it in such<br>
a way that it is preceded by its size (in a custom encoding) and padded<br>
by zeroes to align on a four byte boundary.<br>
<br>
I want to reuse this rule in several other rules and prefer to break it<br>
up into smaller pieces.  A minimalistic example of what I have come up<br>
with so far is attached.  What I can&#39;t seem figure out how to get at and<br>
store the vector&#39;s size in pascal_string_size_.  There also seem to be<br>
problems with refering to the stored size_ in pascal_string_payload_ and<br>
pascal_string_padding_ that I don&#39;t understand.<br></blockquote><div><br></div><div>o Use phoenix::size to extrac the size</div><div>o Use karma::embed(*) to feed in the size</div><div>o Use local variable to store the size</div>
<div>o Use inherited attribute to pass the size
</div><div><br></div><div>Full code attached.</div><div><br></div><div>=footnotes=</div><div>(*) A component made by me, you can find it here: <a href="https://github.com/jamboree/boost-jamboree-spirit">https://github.com/jamboree/boost-jamboree-spirit</a>. As an alternative, you can search &quot;no_attr&quot; on Spirit ML.</div>
<div><br></div></div><br>

