summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@lshift.net>2010-01-21 14:34:48 +0000
committerVlad Ionescu <vlad@lshift.net>2010-01-21 14:34:48 +0000
commita08b9c150e1421f77642f961a9738b64a1f84c89 (patch)
treef978086139a14dca4720cae690bc48ef62059462 /codegen.py
parent18f07de1ed10785087a03f44003c3f3c115b7b8d (diff)
downloadrabbitmq-server-a08b9c150e1421f77642f961a9738b64a1f84c89.tar.gz
adding lookup_class_name to rabbit_framing
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 6f39574f..60caf060 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)
@@ -290,6 +295,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]).
@@ -309,6 +315,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})."