summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-10-18 11:50:30 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-10-18 11:50:30 +0100
commit857f1d95583be1d15309a3738f63238a1706f45f (patch)
tree96b12ddf1e073a5a46a4ad238f65fbf6ec5d7a6d /codegen.py
parent4bd2aa1272c28b70ff8fa2e37eda09ae171f03e3 (diff)
parent303a7db9d979da1601035a79d09bad5b2ec0caac (diff)
downloadrabbitmq-server-git-857f1d95583be1d15309a3738f63238a1706f45f.tar.gz
Merging default into bug 22101
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})."