Commit Graph

29 Commits

Author SHA1 Message Date
Alexander Larsson
f5c2e64f82 demarshaller: Fix palette marshalling
It turns out that using base + sizeof(struct) is not a good way to
access an array at the end of a struct. For SpicePalette sizeof is 16, but
offset of ents is 12. Using this calculation in the demarshaller breaks
things badly, so now we use the actual array member.
2012-03-20 15:25:49 +01:00
Alexander Larsson
3f2739ebc9 Fix uninitialized variable warnings 2012-03-20 15:25:49 +01:00
Alexander Larsson
7897a338db Don't send CursorHeader if cursor_flags is NONE 2012-03-20 15:25:49 +01:00
Alexander Larsson
bcf9b8acf2 codegen: Allow @to_ptr to make inline structs demarshal as pointers 2012-03-20 15:25:49 +01:00
Alexander Larsson
bdcfb2c83d codegen: Various cleanups
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.
2012-03-20 15:25:48 +01:00
Alexander Larsson
24c2e3c85f Fix inclusion of common files, no need for common/ part 2012-03-20 15:25:48 +01:00
Alexander Larsson
199c710a08 codegen: No SPICE_ADDRESS types left, drop @c_ptr 2012-03-20 15:25:47 +01:00
Gerd Hoffmann
e37ce72809 Properly parse QXLImage to the new-world SpiceImage
SpiceImage now replaces RedImage and has all image types in it.
All image data are now chunked (and as such not copied when demarshalling).
2012-03-20 15:25:47 +01:00
Alexander Larsson
4b6605fc42 codegen: support @chunk on non-pointer arrays
This is similar to @as_ptr, but generates a single chunk of data.
2012-03-20 15:25:47 +01:00
Alexander Larsson
601d1be843 Add support for @chunk 2012-03-20 15:25:47 +01:00
Alexander Larsson
09d9a18702 Convert SpicePath.segments to a pointer array 2012-03-20 15:25:47 +01:00
Alexander Larsson
bc8d26bfc0 Handle extra size for switch and array the right way
Even for is_extra_size() we should calculate the mem_size for
arrays, its just that the parent type (in this case switch) should
request mem_size if the type is_extra_size.
2012-03-20 15:25:47 +01:00
Alexander Larsson
8c2ff07518 marshaller: Add some docs describing the types of sizes 2012-03-20 15:25:47 +01:00
Alexander Larsson
ad7e75325d marshaller: Make @nonnull a propagated attribute
This cleans up some stuff
2012-03-20 15:25:47 +01:00
Alexander Larsson
71bf95171d marshaller: Make @c_ptr a propagated attribute
This simplifies some code
2012-03-20 15:25:47 +01:00
Alexander Larsson
1d5c7d1d79 marshaller: Add generic way to handle propagating attributes
Also switches @ptr_array to use this
2012-03-20 15:25:47 +01:00
Gerd Hoffmann
c5d06102b7 Properly parse and marshall SpiceString 2012-03-20 15:25:46 +01:00
Alexander Larsson
e3fadaef86 Fix 32bit failure in demarshaller
Due to a typo we always read offsets as pointers, never as SPICE_ADDRESS.
2012-03-20 15:25:46 +01:00
Alexander Larsson
bef8a0cf19 Simplify SpiceLineAttr by removing unsed stuff
Also in new protocol don't send style data if not needed.
2012-03-20 15:25:46 +01:00
Alexander Larsson
e6eb19e752 Store SpicePath segment count rather than size
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
2012-03-20 15:25:46 +01:00
Alexander Larsson
18a11d6be0 demarshaller: Support @c_ptr attributes for pointers
A @c_ptr pointer is stored in memory as a real pointer rather than a
SPICE_ADDRESS. This is a temporary thing that will be removed again
when all SPICE_ADDRESSes have been converted to real pointer.
2012-03-20 15:25:46 +01:00
Alexander Larsson
2feb07a7b8 demarshaller: Don't parse @zero members
These just write zeros at the right place in the network protocol
typically for old back-compat things. We don't want to read these
back in.
2012-03-20 15:25:46 +01:00
Alexander Larsson
13d9b32acc Make pointers 32bit in new protocol format 2012-03-20 15:25:45 +01:00
Alexander Larsson
9e8883a1f8 Add support for @virtual markup in spice protocol
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.
2012-03-20 15:25:44 +01:00
Alexander Larsson
7022f4d248 Make internal generated marshaller functions static 2012-03-20 15:25:44 +01:00
Alexander Larsson
bcc5cc0d91 Support extra prefix in code generators
This is require when we add a new spice.proto for the old (major 1)
protocol description.
2012-03-20 15:25:44 +01:00
Alexander Larsson
eded86ec1e Add destructor for demarshalled messages
This is required because we don't want to free messages that just
refer to the unparsed message (like SpiceMsgData).

Also, in the future we might need it for more complex demarshalling.
2012-03-20 15:25:44 +01:00
Alexander Larsson
53f8a1a7ba Support @as_ptr in demarshaller to avoid copying data unnecessary 2012-03-20 15:25:44 +01:00
Alexander Larsson
522dc931e8 Initial import of spice protocol description and demarshall generator
The "spice.proto" file describes in detail the networking prototcol
that spice uses and spice_codegen.py can parse this and generate
demarshallers for such network messages.
2012-03-20 15:25:43 +01:00