summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-10-18 10:04:13 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-10-18 10:04:13 +0100
commit80be238cda258b231c37b0adadff85ed72c9da9c (patch)
tree14975f33ce3e6de88fe01e80b15ead9924195482
parent68a318884b74919f98402bcf7378d394001fc719 (diff)
downloadrabbitmq-server-80be238cda258b231c37b0adadff85ed72c9da9c.tar.gz
cosmetic
And fix the '_':2 thing.
-rw-r--r--codegen.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/codegen.py b/codegen.py
index 9b4ebd83..494be73d 100644
--- a/codegen.py
+++ b/codegen.py
@@ -231,23 +231,28 @@ def genErl(spec):
def genDecodeProperties(c):
def presentBin(fields):
- return '<<' + ', '.join(['P' + str(f.index) + ':1' for f in fields]) + ', _:2, R0/binary>>'
+ ps = ', '.join(['P' + str(f.index) + ':1' for f in fields])
+ return '<<' + ps + ', _:%d, R0/binary>>' % (16 - len(fields),)
def mkMacroName(field):
return '?' + field.domain.upper() + '_PROP'
def writePropFieldLine(field, bin_next = None):
i = str(field.index)
if not bin_next:
- i1 = str(field.index + 1)
- bin_next = 'R' + i1
+ bin_next = 'R' + str(field.index + 1)
if field.domain in ['octet', 'timestamp']:
- print " {%s, %s} = %s(%s, %s, %s, %s)," % ('F' + i, bin_next, mkMacroName(field), 'P' + i, 'R' + i, 'I' + i, 'X' + i)
+ print (" {%s, %s} = %s(%s, %s, %s, %s)," %
+ ('F' + i, bin_next, mkMacroName(field), 'P' + i,
+ 'R' + i, 'I' + i, 'X' + i))
else:
- print " {%s, %s} = %s(%s, %s, %s, %s, %s)," % ('F' + i, bin_next, mkMacroName(field), 'P' + i, 'R' + i, 'L' + i, 'S' + i, 'X' + i)
+ print (" {%s, %s} = %s(%s, %s, %s, %s, %s)," %
+ ('F' + i, bin_next, mkMacroName(field), 'P' + i,
+ 'R' + i, 'L' + i, 'S' + i, 'X' + i))
if len(c.fields) == 0:
- print "decode_properties(%d, _) ->" % (c.index)
+ print "decode_properties(%d, _) ->" % (c.index,)
else:
- print "decode_properties(%d, %s) ->" % (c.index, presentBin(c.fields))
+ print ("decode_properties(%d, %s) ->" %
+ (c.index, presentBin(c.fields)))
for field in c.fields[:-1]:
writePropFieldLine(field)
writePropFieldLine(c.fields[-1], "<<>>")