Popular recipes tagged "struct" but not "top"http://code.activestate.com/recipes/tags/struct-top/2009-05-02T11:27:22-07:00ActiveState Code RecipesC struct decorator (Python)
2009-05-02T11:27:22-07:00geremy condrahttp://code.activestate.com/recipes/users/4170000/http://code.activestate.com/recipes/576734-c-struct-decorator/
<p style="color: grey">
Python
recipe 576734
by <a href="/recipes/users/4170000/">geremy condra</a>
(<a href="/recipes/tags/cpp/">cpp</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/struct/">struct</a>).
Revision 3.
</p>
<p>Like my earlier <a href="http://code.activestate.com/recipes/576731/">C function decorator</a>, this recipe is designed to make it easier to interact with C by removing some of the boilerplate code from defining C structs in Python.</p>
Nicer struct syntax thanks to Py3 metaclasses (Python)
2009-02-25T07:39:52-08:00Daniel Brodiehttp://code.activestate.com/recipes/users/1892511/http://code.activestate.com/recipes/576666-nicer-struct-syntax-thanks-to-py3-metaclasses/
<p style="color: grey">
Python
recipe 576666
by <a href="/recipes/users/1892511/">Daniel Brodie</a>
(<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/parsing/">parsing</a>, <a href="/recipes/tags/py3/">py3</a>, <a href="/recipes/tags/struct/">struct</a>).
</p>
<p>This is a quick-hack module I wrote up in a couple of hours that allows for a nicer syntax to build up struct-like binary packing and unpacking. The point was to get it to be concise and as C-like as possible. This script requires python3 for it's improved metaclass support.</p>
Converting arbitrary size Python integers to packed binary data strings (Python)
2009-01-16T13:27:29-08:00David Mosshttp://code.activestate.com/recipes/users/4124829/http://code.activestate.com/recipes/576617-converting-arbitrary-size-python-integers-to-packe/
<p style="color: grey">
Python
recipe 576617
by <a href="/recipes/users/4124829/">David Moss</a>
(<a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/integers/">integers</a>, <a href="/recipes/tags/pack/">pack</a>, <a href="/recipes/tags/struct/">struct</a>, <a href="/recipes/tags/unpack/">unpack</a>, <a href="/recipes/tags/unsigned/">unsigned</a>).
</p>
<p>Routines for converting <strong>large</strong> unsigned arbitrary sized Python integers to packed binary data strings and vice versa.</p>