summaryrefslogtreecommitdiffstats
path: root/python_modules
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-07-19 16:27:42 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-20 15:25:49 +0100
commit4702feb5b1958eeef9b4414a2fb7cac259394a52 (patch)
tree562cd6b8304d4e38cb0a42c49397c84f20a91aec /python_modules
parentf3d92c736b5a2d25f6a881e7234e798b7e7ae7e5 (diff)
downloadspice-protocol-4702feb5b1958eeef9b4414a2fb7cac259394a52.tar.gz
spice-protocol-4702feb5b1958eeef9b4414a2fb7cac259394a52.tar.xz
spice-protocol-4702feb5b1958eeef9b4414a2fb7cac259394a52.zip
Don't send CursorHeader if cursor_flags is NONE
Diffstat (limited to 'python_modules')
-rw-r--r--python_modules/demarshal.py5
-rw-r--r--python_modules/ptypes.py4
-rw-r--r--python_modules/spice_parser.py2
3 files changed, 7 insertions, 4 deletions
diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 4aba7b0..f259ead 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -708,7 +708,10 @@ def write_switch_parser(writer, container, switch, dest, scope):
if switch.has_end_attr():
dest2 = dest.child_at_end(writer, m.member_type)
elif switch.has_attr("anon"):
- dest2 = dest
+ if t.is_struct() and not m.has_attr("to_ptr"):
+ dest2 = dest.child_sub(m.name)
+ else:
+ dest2 = dest
else:
if t.is_struct():
dest2 = dest.child_sub(switch.name + "." + m.name)
diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index 59ed897..0ae57ec 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -591,9 +591,9 @@ class SwitchCase:
if v == None:
return "1"
elif var_type.is_enum():
- checks.append("%s == %s" % (var_cname, var_type.c_enumname_by_name(v)))
+ checks.append("%s == %s" % (var_cname, var_type.c_enumname_by_name(v[1])))
else:
- checks.append("(%s & %s)" % (var_cname, var_type.c_enumname_by_name(v)))
+ checks.append("%s(%s & %s)" % (v[0], var_cname, var_type.c_enumname_by_name(v[1])))
return " || ".join(checks)
def resolve(self, container):
diff --git a/python_modules/spice_parser.py b/python_modules/spice_parser.py
index ac2da8d..43e930c 100644
--- a/python_modules/spice_parser.py
+++ b/python_modules/spice_parser.py
@@ -93,7 +93,7 @@ def SPICE_BNF():
variableDef = Group(typeSpec + Optional("*", default=None) + identifier + Optional(arraySizeSpec, default=None) + attributes - semi) \
.setParseAction(parseVariableDef)
- switchCase = Group(Group(OneOrMore(default_.setParseAction(replaceWith(None)) + colon | case_.suppress() + identifier + colon)) + variableDef) \
+ switchCase = Group(Group(OneOrMore(default_.setParseAction(replaceWith(None)) + colon | Group(case_.suppress() + Optional("!", default="") + identifier) + colon)) + variableDef) \
.setParseAction(lambda toks: ptypes.SwitchCase(toks[0][0], toks[0][1]))
switchBody = Group(switch_ + lparen + delimitedList(identifier,delim='.', combine=True) + rparen + lbrace + Group(OneOrMore(switchCase)) + rbrace + identifier + attributes - semi) \
.setParseAction(lambda toks: ptypes.Switch(toks[0][1], toks[0][2], toks[0][3], toks[0][4]))