Commit d3921882 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

merge

parents a824aa37 fadb9072
......@@ -17,7 +17,7 @@ ifeq ($(UNAME_S),Darwin)
else
cd simple ; sh compile.sh && sh run.sh
$(MAKE) -C wiki_example test
$(MAKE) -C user_types test
$(MAKE) -C user_types all
endif
$(MAKE) -C duck_typing test
$(MAKE) -C twoway test
......
......@@ -637,8 +637,7 @@ class struct(type_decl):
return not self.__eq__(other)
def __hash__(self):
tmp = str(self.field)
return hash(self.__class__) ^ hash(tmp)
return hash(self.__class__) ^ hash(self.field)
def encode_decl(self, encoder):
encoder.encode_type(i_STRUCT)
......@@ -918,8 +917,8 @@ class Decoder(Codec):
self.version = version
self.handlers = {}
def register_handler(self, sig, handler):
self.handlers[str(sig)] = handler
def register_handler(self, decl, handler):
self.handlers[decl] = handler
def unpack(self, format):
size = packer.calcsize(format)
......@@ -956,11 +955,16 @@ class Decoder(Codec):
data,decl = self.decode()
if decl:
if data != None:
if str(decl) in self.handlers:
handler = self.handlers[str(decl)]
if decl in self.handlers:
handler = self.handlers[decl]
handler(data)
else:
print ("No handler for %s" % decl.name )
for key, value in self.handlers.iteritems():
if key == decl:
print "but value %s == decl %s" % (key,decl)
print "hashes %d : %d" % (hash(key),hash(decl))
raise Exception()
def decode(self):
while True:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment