summaryrefslogtreecommitdiffstats
path: root/python_modules/marshal.py
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Remove files moved to spice-protocol"Marc-André Lureau2016-03-101-0/+420
| | | | | | | | | | | | | | | | This reverts commit 7665dcf1bb2fa0b16b3d0015b28d7f5912664c3f. Also revert the related build-sys changes to fix the build. codegen generated code depends on spice-common code (marshaller, messages etc), it makes more sense to keep the generator along this. Otherwise a newer protocol release will fail to build older projects. *.proto files are required as well, since it generates code that parent modules depend on unconditionnaly. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Remove files moved to spice-protocolFrediano Ziglio2015-08-111-420/+0
| | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
* codegen: Simplify if/else blocksFrediano Ziglio2015-07-231-18/+11
| | | | | | Blocks were mainly the same, this reduces the amount of code. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
* Make spice_codegen.py work on both Python 2 and 3Alexander Wauck2015-04-011-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | This is a new version of my previous patch that does not include six.py. It's still kind of big, but at least it's all spice-common changes now. There are also a few other fixes that Christophe brought to my attention. Note that six now needs to be installed on the system (python-six on Fedora and Debian, six on PyPI). This *should* be enough to make spice_codegen.py work on both Python 2 and Python 3. The major changes are as follows: * cStringIO.StringIO -> io.StringIO * str vs. unicode updates (io.StringIO doesn't like str) * integer division * foo.has_key(bar) -> bar in foo * import internal_thing -> from . import internal_thing * removed from __future__ import with_statement (might break Python 2.5?) * changed some lambdas to list comprehensions (done by 2to3) * cast some_dict.keys() to list where needed (e.g. for sorting) * use normal type names with isinstance instead of types.WhateverType Signed-off-by: Alexander Wauck <awauck@codeweavers.com>
* python: Fix -Wsign-compareFabiano Fidêncio2014-09-181-3/+3
| | | | | | | The return of the get_array_size() is used as a limit in a loop, being compared with an unsigned index (indexes are always unsigned). To avoid the -Wsign-compare warning, let's cast the return of the get_array_size() to unsigned and make GCC happier.
* python: Fix -Wunused-parameterFabiano Fidêncio2014-09-181-1/+1
| | | | | | | | Although the most part of the parameters marked as unused are actually being used for a few functions, a bunch of warnings can be seen when the code is compiled with "-Wall -Wextra". As adding the unused attribute means that the variable/parameter is meant to be *possibly* unused, we're safe adding it in the generated code, even for used variables/parameters.
* Use #include "common/..." in (de)marshallersChristophe Fergeau2014-04-161-2/+2
| | | | | | | | Now that they are created in $builddir, their includes will need to refer to files in $srcdir, which can be different. It's cleaner to add -I $(top_srcdir)/spice-common/ to modules using spice-common rather than having -I $(top_srcdir)/spice-common/common which would could create header collisions.
* codegen: ifdef/endif function declaration tooMarc-André Lureau2012-03-211-0/+2
| | | | | | Compile out part that we are not supporting. In the future, we might want to declare a fake type and an empty function to keep API compatibility
* codegen: include headers locallyMarc-André Lureau2012-03-211-2/+2
|
* codegen: struct marshallers are not current function helperMarc-André Lureau2012-03-211-2/+3
| | | | | This solves the issue of struct_marshallers being included within the current ifdef/endif body, although they are independant functions.
* handle @ifdef on messages and channelsChristophe Fergeau2012-03-201-3/+25
|
* demarshaller/marshaller fix gcc 4.6.0Alon Levy2012-03-201-3/+5
| | | | | | | | | | python_modules/demarshal.py and marshal.py fixes for gcc 4.6.0 warning about set but unused variables. The fixes disable creating of variables mem_size when they are not used (demarshall) and declaring a src variable when the message doesn't use it (marshal). You need to touch *.proto after applying this (should add a Makefile dependency).
* mingw32 build: python_modules/marshal: use unsigned for for_loop index variableAlon Levy2012-03-201-1/+1
|
* support python 2.5.4+ for marshaller/demarshallersAlon Levy2012-03-201-0/+1
| | | | | Patch adds a "from __future__" import that doesn't affect newer python's but allows python 2.5.4 to run the code (tested under scratchbox, n900 build environment)
* codegen: Allow @to_ptr to make inline structs demarshal as pointersAlexander Larsson2012-03-201-2/+8
|
* codegen: Various cleanupsAlexander Larsson2012-03-201-45/+23
| | | | | | | | | | | | Remove all uses of @end in the marshaller, instead just using the C struct array-at-end-of-struct. To make this work we also remove all use of @end for switches (making them C unions). We drop the zero member of the notify message so that we can avoid this use of @end for a primitive in the marshaller (plus its useless to send over the wire). We change the offsets and stuff in the migration messages to real pointers.
* codegen: Pass member to SubMarshallingSource rather than nameAlexander Larsson2012-03-201-9/+10
| | | | This way we can check attributes on the member.
* marshaller: Make @nonnull a propagated attributeAlexander Larsson2012-03-201-1/+1
| | | | This cleans up some stuff
* marshaller: Add generic way to handle propagating attributesAlexander Larsson2012-03-201-2/+2
| | | | Also switches @ptr_array to use this
* Properly parse and marshall SpiceStringGerd Hoffmann2012-03-201-3/+17
|
* Support @marshall to automatically marshall pointersAlexander Larsson2012-03-201-15/+24
|
* Store SpicePath segment count rather than sizeAlexander Larsson2012-03-201-9/+18
| | | | | | | | | | | | | | | | | | | Internally and in the network protocol (for the new version) we now store the actual number of segments rather than the size of the full segments array in bytes. This change consists of multiple changes to handle this: * Make the qxl parser calculate num_segments * Make the canvas stroke code handle the new SpicePath layout. * Fix up is_equal_path in red_worker.c for the new layout * replace multiple calls to spice_marshall_PathSegment with a single spice_marshall_Path call * Make the byte_size() array size handling do the conversion from network size to number of elements when marshalling/demarshalling. * Update the current spice protocol to send the segment count rather than the size * Update the old spice protocol to use the new byte_size functionallity to calculate the size sent and the number of elements recieved
* Fix build error due to member "SpiceMsgEmpty" same name as typeAlexander Larsson2012-03-201-0/+2
|
* Make pointers 32bit in new protocol formatAlexander Larsson2012-03-201-2/+2
|
* Add support for @virtual markup in spice protocolAlexander Larsson2012-03-201-0/+3
| | | | | | | This means the member is not sent on the network at all. Instead its initialized to the attribute argument when demarshalled. This is useful for backwards compatibility support.
* Make internal generated marshaller functions staticAlexander Larsson2012-03-201-1/+1
|
* Support extra prefix in code generatorsAlexander Larsson2012-03-201-1/+1
| | | | | This is require when we add a new spice.proto for the old (major 1) protocol description.
* Support creating marshallers that are called indirectlyAlexander Larsson2012-03-201-6/+25
| | | | | This is needed if we want to switch marshallers depending on what major version the remote side has.
* Make generated marshallers build on win32Alexander Larsson2012-03-201-0/+1
|
* Add support for generating message and structure marshallersAlexander Larsson2012-03-201-0/+357