summaryrefslogtreecommitdiff
path: root/python/qpid/spec.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2007-08-10 15:55:16 +0000
committerRafael H. Schloming <rhs@apache.org>2007-08-10 15:55:16 +0000
commit01652ef4ec4d7a92bfdcf677c27fb28968398bc6 (patch)
tree495a8d994def30a30512beaf4077643c41cff332 /python/qpid/spec.py
parent6577b14632d81c15482cb0793e01166cdb28eaff (diff)
downloadqpid-python-01652ef4ec4d7a92bfdcf677c27fb28968398bc6.tar.gz
added support for unpacked structs and execution.result
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@564637 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/spec.py')
-rw-r--r--python/qpid/spec.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/python/qpid/spec.py b/python/qpid/spec.py
index f9d305c133..8a511bcb3d 100644
--- a/python/qpid/spec.py
+++ b/python/qpid/spec.py
@@ -91,6 +91,8 @@ class Spec(Metadata):
self.classes = SpecContainer()
# methods indexed by classname_methname
self.methods = {}
+ # structs by type code
+ self.structs = {}
def post_load(self):
self.module = self.define_module("amqp%s%s" % (self.major, self.minor))
@@ -295,13 +297,18 @@ class Field(Metadata):
self.description = description
self.docs = docs
+ def default(self):
+ return Method.DEFAULTS[self.type]
+
def get_result(nd, spec):
result = nd["result"]
if not result: return None
name = result["@domain"]
if name != None: return spec.domains.byname[name]
st_nd = result["struct"]
- st = Struct(st_nd["@size"], st_nd["@type"], st_nd["@pack"])
+ st = Struct(st_nd["@size"], int(result.parent.parent["@index"])*256 +
+ int(st_nd["@type"]), st_nd["@pack"])
+ spec.structs[st.type] = st
load_fields(st_nd, st.fields, spec.domains.byname)
return st
@@ -352,7 +359,12 @@ def load(specfile, *errata):
type = nd["@type"]
if type == None:
st_nd = nd["struct"]
- type = Struct(st_nd["@size"], st_nd["@type"], st_nd["@pack"])
+ code = st_nd["@type"]
+ if code not in (None, "", "none"):
+ code = int(code)
+ type = Struct(st_nd["@size"], code, st_nd["@pack"])
+ if type.type != None:
+ spec.structs[type.type] = type
structs.append((type, st_nd))
else:
type = pythonize(type)