summaryrefslogtreecommitdiff
path: root/codegen.py
diff options
context:
space:
mode:
authorVlad Ionescu <vlad@rabbitmq.com>2010-07-14 18:28:23 +0100
committerVlad Ionescu <vlad@rabbitmq.com>2010-07-14 18:28:23 +0100
commita9f832a9f2aaa30ced09cd58ca13291d288b162b (patch)
tree6c382f61e2c2a1686b8c4fa8321c0f4c6469727f /codegen.py
parent77d9f83cc2e8e6afea0a42d0953d3adfaf2769e1 (diff)
parent3316ba16951d6c87b9df99237021ad29f7b23249 (diff)
downloadrabbitmq-server-a9f832a9f2aaa30ced09cd58ca13291d288b162b.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 1244aae1..6042e78f 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)
@@ -319,6 +324,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]).
@@ -416,6 +422,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})."