summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-10-13 14:47:06 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-10-13 14:47:06 +0100
commit3eed0f099b5753d5a8314d01f8ec030bb884a5b2 (patch)
tree93ce835953679853947729a4672c55da29afec78 /codegen.py
parentd6b780f02a700e341295dd17013d3de37c460e13 (diff)
parentf2bc8a9f1da01ef620ad14d2d56b76c7e8be7e7d (diff)
downloadrabbitmq-server-git-3eed0f099b5753d5a8314d01f8ec030bb884a5b2.tar.gz
Merging bug 23159 into default
Diffstat (limited to 'codegen.py')
-rw-r--r--codegen.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/codegen.py b/codegen.py
index 142297533f..4fdbec554f 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()))
@@ -167,6 +169,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)
@@ -325,6 +330,8 @@ def genErl(spec):
-export([version/0]).
-export([lookup_method_name/1]).
+-export([lookup_class_name/1]).
+
-export([method_id/1]).
-export([method_has_content/1]).
-export([is_method_synchronous/1]).
@@ -427,6 +434,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})."