summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@lshift.net>2010-05-14 18:28:07 +0100
committerVlad Ionescu <vlad@lshift.net>2010-05-14 18:28:07 +0100
commit3316ba16951d6c87b9df99237021ad29f7b23249 (patch)
tree79e1f8c435207a01e018021170af9ef970f88b07 /codegen.py
parentc05ae22f463ce280bde92ab89c2d911c0e96730f (diff)
parent0f7fc0564900ecd153d3963698a2423751eb9915 (diff)
downloadrabbitmq-server-3316ba16951d6c87b9df99237021ad29f7b23249.tar.gz
merging in from default
Diffstat (limited to 'codegen.py')
-rw-r--r--codegen.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/codegen.py b/codegen.py
index 91c70e81..a24a32ff 100644
--- a/codegen.py
+++ b/codegen.py
@@ -75,6 +75,8 @@ def erlangize(s):
AmqpMethod.erlangName = lambda m: "'" + erlangize(m.klass.name) + '.' + erlangize(m.name) + "'"
+AmqpClass.erlangName = lambda c: "'" + erlangize(c.name) + "'"
+
def erlangConstantName(s):
return '_'.join(re.split('[- ]', s.upper()))
@@ -146,6 +148,9 @@ def genErl(spec):
def genLookupMethodName(m):
print "lookup_method_name({%d, %d}) -> %s;" % (m.klass.index, m.index, m.erlangName())
+ def genLookupClassName(c):
+ print "lookup_class_name(%d) -> %s;" % (c.index, c.erlangName())
+
def genMethodId(m):
print "method_id(%s) -> {%d, %d};" % (m.erlangName(), m.klass.index, m.index)
@@ -298,6 +303,7 @@ def genErl(spec):
-include("rabbit_framing.hrl").
-export([lookup_method_name/1]).
+-export([lookup_class_name/1]).
-export([method_id/1]).
-export([method_has_content/1]).
@@ -318,6 +324,9 @@ bitvalue(undefined) -> 0.
for m in methods: genLookupMethodName(m)
print "lookup_method_name({_ClassId, _MethodId} = Id) -> exit({unknown_method_id, Id})."
+ for c in spec.allClasses(): genLookupClassName(c)
+ print "lookup_class_name(ClassId) -> exit({unknown_class_id, ClassId})."
+
for m in methods: genMethodId(m)
print "method_id(Name) -> exit({unknown_method_name, Name})."