diff options
author | Matthew Sackman <matthew@lshift.net> | 2010-01-31 22:30:27 +0000 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2010-01-31 22:30:27 +0000 |
commit | 0564f1071aa62ae82fd0eb59c87a6a168c723ad6 (patch) | |
tree | 51fb617ec1268898a17b979d50612349409ee94f | |
parent | fb5a27f668422cb4bc30332d1202eda14d7f1825 (diff) | |
parent | 1feff7d63ee2041f08866ab2a7a89bb085918fab (diff) | |
download | rabbitmq-server-0564f1071aa62ae82fd0eb59c87a6a168c723ad6.tar.gz |
Merging default into branch bug16653
-rw-r--r-- | codegen.py | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -126,7 +126,7 @@ def printFileHeader(): %% %% Contributor(s): ______________________________________. %%""" - + def genErl(spec): def erlType(domain): return erlangTypeMap[spec.resolveDomain(domain)] @@ -151,7 +151,7 @@ def genErl(spec): def genMethodHasContent(m): print "method_has_content(%s) -> %s;" % (m.erlangName(), str(m.hasContent).lower()) - + def genMethodIsSynchronous(m): hasNoWait = "nowait" in fieldNameList(m.arguments) if m.isSynchronous and hasNoWait: @@ -217,6 +217,9 @@ def genErl(spec): else: pass + def genMethodRecord(m): + print "method_record(%s) -> #%s{};" % (m.erlangName(), m.erlangName()) + def genDecodeMethodFields(m): packedFields = packMethodFields(m.arguments) binaryPattern = ', '.join([methodFieldFragment(f) for f in packedFields]) @@ -294,6 +297,7 @@ def genErl(spec): -export([method_id/1]). -export([method_has_content/1]). -export([is_method_synchronous/1]). +-export([method_record/1]). -export([method_fieldnames/1]). -export([decode_method_fields/2]). -export([decode_properties/2]). @@ -318,6 +322,9 @@ bitvalue(undefined) -> 0. for m in methods: genMethodIsSynchronous(m) print "is_method_synchronous(Name) -> exit({unknown_method_name, Name})." + for m in methods: genMethodRecord(m) + print "method_record(Name) -> exit({unknown_method_name, Name})." + for m in methods: genMethodFieldNames(m) print "method_fieldnames(Name) -> exit({unknown_method_name, Name})." @@ -357,7 +364,7 @@ def genHrl(spec): result += ' = ' + conv_fn(field.defaultvalue) return result return ', '.join([fillField(f) for f in fields]) - + methods = spec.allMethods() printFileHeader() @@ -381,7 +388,7 @@ def generateErl(specPath): def generateHrl(specPath): genHrl(AmqpSpec(specPath)) - + if __name__ == "__main__": do_main(generateHrl, generateErl) |