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
commit7897a338db23c29746dbd6062cbc615a3f15dbb4 (patch)
treee487dd900c5dec1a96c38b9b3f73ffcfb6be9b7f /python_modules
parentefba88ce725d91d9c33e44332b64f737cc1a07b6 (diff)
downloadspice-common-7897a338db23c29746dbd6062cbc615a3f15dbb4.tar.gz
spice-common-7897a338db23c29746dbd6062cbc615a3f15dbb4.tar.xz
spice-common-7897a338db23c29746dbd6062cbc615a3f15dbb4.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]))